sweepai / sweep

Sweep: open-source AI-powered Software Developer for small features and bug fixes.
https://sweep.dev
Other
7.37k stars 420 forks source link

Sweep: create a new agent to be used in ticket_utils.py #2661

Open wwzeng1 opened 9 months ago

wwzeng1 commented 9 months ago

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

Checklist - [X] Create `sweepai/agents/filter_agent.py` ✓ https://github.com/sweepai/sweep/commit/da604ba2c876a82460d66c6672ccf8eb3c69c39e [Edit](https://github.com/sweepai/sweep/edit/sweep/create_a_new_agent_to_be_used_in_ticket/sweepai/agents/filter_agent.py) - [X] Running GitHub Actions for `sweepai/agents/filter_agent.py` ✓ [Edit](https://github.com/sweepai/sweep/edit/sweep/create_a_new_agent_to_be_used_in_ticket/sweepai/agents/filter_agent.py) - [X] Modify `sweepai/utils/ticket_utils.py` ✓ https://github.com/sweepai/sweep/commit/c811ac000518981cf641a4baa77a6960595559e4 [Edit](https://github.com/sweepai/sweep/edit/sweep/create_a_new_agent_to_be_used_in_ticket/sweepai/utils/ticket_utils.py#L23-L26) - [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/sweepai/utils/ticket_utils.py#L23-L26) - [X] Create `sweepai/agents/filter_agent_test.py` ✓ https://github.com/sweepai/sweep/commit/f25dae8b531ee4984790efa66924f10fba58382d [Edit](https://github.com/sweepai/sweep/edit/sweep/create_a_new_agent_to_be_used_in_ticket/sweepai/agents/filter_agent_test.py) - [X] Running GitHub Actions for `sweepai/agents/filter_agent_test.py` ✓ [Edit](https://github.com/sweepai/sweep/edit/sweep/create_a_new_agent_to_be_used_in_ticket/sweepai/agents/filter_agent_test.py)
sweep-nightly[bot] commented 9 months ago

🚀 Here's the PR! #2766

See Sweep's progress at the progress dashboard!
💎 Sweep Pro: I'm using GPT-4. You have unlimited GPT-4 tickets. (tracking ID: f85850415a)

Actions (click)

Sandbox Execution ✓

Here are the sandbox execution logs prior to making any changes:

Sandbox logs for 1bc1b31
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.


Step 1: 🔎 Searching

I found the following snippets in your repository. I will now analyze these snippets and come up with a plan.

Some code snippets I think are relevant in decreasing order of relevance (click to expand). If some file is missing from here, you can mention the path in the ticket description. https://github.com/sweepai/sweep/blob/1bc1b31302bdea0f475a5a11fae0f9afaec641ec/sweepai/utils/ticket_utils.py#L22-L26 https://github.com/sweepai/sweep/blob/1bc1b31302bdea0f475a5a11fae0f9afaec641ec/sweepai/agents/name_agent.py#L5-L28

Step 2: ⌨️ Coding

Ran GitHub Actions for da604ba2c876a82460d66c6672ccf8eb3c69c39e:
• black:

--- 
+++ 
@@ -16,6 +16,7 @@
 from sweepai.utils.chat_logger import discord_log_error
 from sweepai.utils.event_logger import posthog
 from sweepai.utils.github_utils import ClonedRepo
+from sweepai.agents.filter_agent import FilterBot
 from sweepai.utils.progress import TicketProgress
 from sweepai.utils.str_utils import total_number_of_snippet_tokens

@@ -40,7 +41,9 @@
     for snippet in snippets:
         snippet.file_path = snippet.file_path[len(cloned_repo.cached_dir) + 1 :]

-    content_to_lexical_score = search_index(query, lexical_index)
+    filter_bot = FilterBot()
+    filtered_query = filter_bot.filter_query(query)[0]
+    content_to_lexical_score = search_index(filtered_query, lexical_index)
     snippet_to_key = (
         lambda snippet: f"{snippet.file_path}:{snippet.start}:{snippet.end}"
     )

Ran GitHub Actions for c811ac000518981cf641a4baa77a6960595559e4:

Ran GitHub Actions for f25dae8b531ee4984790efa66924f10fba58382d:
• Vercel Preview Comments:
• black:


Step 3: 🔁 Code Review

I have finished reviewing the code for completeness. I did not find errors for sweep/create_a_new_agent_to_be_used_in_ticket.


🎉 Latest improvements to Sweep:


💡 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