Open wwzeng1 opened 11 months ago
7bc8e3e248
)[!TIP] I'll email you at william@sweep.dev when I complete this pull request!
Here are the GitHub Actions logs prior to making any changes:
0db6b3e
Checking sweepai/utils/ticket_utils.py for syntax errors... β sweepai/utils/ticket_utils.py has no syntax errors!
1/1 βChecking sweepai/utils/ticket_utils.py for syntax errors... β sweepai/utils/ticket_utils.py has no syntax errors!
Sandbox passed on the latest main
, so sandbox checks will be enabled for this issue.
I found the following snippets in your repository. I will now analyze these snippets and come up with a plan.
sweepai/agents/query_filter_agent.py
β https://github.com/sweepai/sweep/commit/1b24e73308bdcba66960dde23ceff6ae2811eccf Edit
Create sweepai/agents/query_filter_agent.py with contents:
β’ Create a new Python file named `query_filter_agent.py` in the `sweepai/agents/` directory.
β’ Import the `ChatGPT` class from `sweepai/core/chat.py`.
β’ Define a new class `QueryFilterAgent` that inherits from `ChatGPT`.
β’ Inside the `QueryFilterAgent` class, define a method `filter_search_query` that takes parameters such as `search_query`, `title`, `summary`, and `replies_text`.
β’ Construct a prompt within `filter_search_query` that instructs the AI to filter out unnecessary terms from the search query. Use the `doc_query_rewriter_prompt` from `sweepai/core/prompts.py` as a reference for structuring the prompt.
β’ Call the `chat` method of the `ChatGPT` class with the constructed prompt to get the AI's response.
β’ Process the AI's response to extract the filtered search query.
β’ Return the filtered search query from the `filter_search_query` method.
sweepai/agents/query_filter_agent.py
β Edit
Check sweepai/agents/query_filter_agent.py with contents:
Ran GitHub Actions for 1b24e73308bdcba66960dde23ceff6ae2811eccf:
β’ Vercel Preview Comments: β
sweepai/utils/ticket_utils.py
βΆ Edit
Modify sweepai/utils/ticket_utils.py with contents:
β’ Import the `QueryFilterAgent` class from the newly created `sweepai/agents/query_filter_agent.py`.
β’ Inside the `fetch_relevant_files` function, after constructing the `search_query` in line 110, instantiate a `QueryFilterAgent` object.
β’ Call the `filter_search_query` method of the `QueryFilterAgent` object, passing the `title`, `summary`, and `replies_text` as arguments.
β’ Replace the original `search_query` with the filtered search query returned by the `filter_search_query` method.
β’ Ensure that the filtered `search_query` is used in subsequent operations within the `fetch_relevant_files` function.
sweepai/utils/ticket_utils.py
βΆ Edit
Check sweepai/utils/ticket_utils.py with contents:
Working on it...
π‘ To recreate the pull request edit the issue title or description. To tweak the pull request, leave a comment on the pull request. Join Our Discord
Details
The agent should filter unnecessary terms out of the search query to be sent into lexical search. Use a prompt to do this, using name_agent.py as a reference