Open wwzeng1 opened 9 months ago
None
)[!TIP] I can email you next time I complete a pull request if you set up your email here!
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/9159660fe39e8db1ec039e836362627e567045b8 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.
• Define a new class named QueryFilterAgent within this file.
• Import necessary modules and classes, such as the ChatGPT class from sweepai/agents/pr_description_bot.py, as this new agent will likely use similar functionality.
• Implement a method within QueryFilterAgent named filter_search_query that takes a search query as input and returns a filtered version of the query. This method will use a prompt to filter out unnecessary terms, similar to how PRDescriptionBot generates PR descriptions.
• The method should handle cases where the filtering does not yield a result by returning the original query as a fallback.
sweepai/agents/query_filter_agent.py
✓ Edit
Check sweepai/agents/query_filter_agent.py with contents:
Ran GitHub Actions for 9159660fe39e8db1ec039e836362627e567045b8:
sweepai/utils/ticket_utils.py
✓ https://github.com/sweepai/sweep/commit/8d2252011a45e78dce97cddb27a991e025f7568c Edit
Modify sweepai/utils/ticket_utils.py with contents:
• Import the QueryFilterAgent class from the newly created file sweepai/agents/query_filter_agent.py at the top of the ticket_utils.py file.
• Inside the fetch_relevant_files function, replace the current search_query concatenation logic (lines 111-115) with a call to the filter_search_query method of a QueryFilterAgent instance.
• Create an instance of QueryFilterAgent before the try block where the search_query is currently being concatenated.
• Pass the concatenated title, summary, and replies_text to the filter_search_query method and assign the result back to the search_query variable.
• Ensure that the rest of the function uses this new filtered search_query for further processing.
--- +++ @@ -5,6 +5,7 @@ from sweepai.config.client import SweepConfig from sweepai.core.context_pruning import RepoContextManager, get_relevant_context +from sweepai.agents.query_filter_agent import QueryFilterAgent from sweepai.core.lexical_search import ( compute_vector_search_scores, prepare_lexical_search_index, @@ -108,7 +109,8 @@ ): logger.info("Fetching relevant files...") try: - search_query = (title + summary + replies_text).strip("\n") + filter_agent = QueryFilterAgent() + search_query = filter_agent.filter_search_query((title + summary + replies_text).strip('\n')) replies_text = f"\n{replies_text}" if replies_text else "" formatted_query = (f"{title.strip()}\n{summary.strip()}" + replies_text).strip( "\n"
sweepai/utils/ticket_utils.py
✓ Edit
Check sweepai/utils/ticket_utils.py with contents:
Ran GitHub Actions for 8d2252011a45e78dce97cddb27a991e025f7568c:
I have finished reviewing the code for completeness. I did not find errors for sweep/create_a_new_agent_to_be_used_in_ticket_2f9c3
.
💡 To recreate the pull request edit the issue title or description. Something wrong? Let us know.
This is an automated message generated by Sweep AI.
Details
The agent should filter unnecessary terms out of the search query to be sent into lexical search. Write a prompt to do this, using pr_description as a reference
Checklist
- [X] Create `sweepai/agents/query_filter_agent.py` ✓ https://github.com/sweepai/sweep/commit/9159660fe39e8db1ec039e836362627e567045b8 [Edit](https://github.com/sweepai/sweep/edit/sweep/create_a_new_agent_to_be_used_in_ticket_2f9c3/sweepai/agents/query_filter_agent.py) - [X] Running GitHub Actions for `sweepai/agents/query_filter_agent.py` ✓ [Edit](https://github.com/sweepai/sweep/edit/sweep/create_a_new_agent_to_be_used_in_ticket_2f9c3/sweepai/agents/query_filter_agent.py) - [X] Modify `sweepai/utils/ticket_utils.py` ✓ https://github.com/sweepai/sweep/commit/8d2252011a45e78dce97cddb27a991e025f7568c [Edit](https://github.com/sweepai/sweep/edit/sweep/create_a_new_agent_to_be_used_in_ticket_2f9c3/sweepai/utils/ticket_utils.py#L94-L118) - [X] Running GitHub Actions for `sweepai/utils/ticket_utils.py` ✓ [Edit](https://github.com/sweepai/sweep/edit/sweep/create_a_new_agent_to_be_used_in_ticket_2f9c3/sweepai/utils/ticket_utils.py#L94-L118)