SmartManoj / Kevin

⚡ Kevin: Code Quick, Create Fast
MIT License
6 stars 0 forks source link

Include relevant file names if any #7

Closed kevin-support-bot[bot] closed 6 days ago

kevin-support-bot[bot] commented 1 month ago

https://github.com/OpenDevin/OpenDevin/pull/2865 PR discussion

kevin-support-bot[bot] commented 1 month ago

agent.py └── DummyAgent(Agent) - The DummyAgent is used for e2e testing. It just sends the same set of actions deterministically,without making any LLM calls. ├── init(self, llm) ├── step(self, state) ├── simulate_browser_action(self, action) └── handle_browser_unavailable(self, action)

@rezzie-rich Isn't the above structure generated using ast equivalent to the summary?

Could you provide a small prompt to test the agent using your summary and the above structure?

rezzie-rich commented 1 month ago

I like that. I used your summary as a sample and created a more detailed example.

File: codeact_agent.py
Module: Implements CodeActAgent for interaction via conversational and executable code paths.
Dependencies: Internal (action_parser, prompt), External (opendevin).
Key Components:


Here's an example of a prompt you might use to guide a search agent in creating a concise, AI-optimized summary of a code file(which might require minor adjusting):

Prompt for Search Agent:

Generate a concise summary of the specified code file, focusing on key elements essential for an AI's understanding within a limited context window. The summary should be structured and optimized for AI readability and comprehension.

  1. File Identification: Specify the file name and its primary functionality.
  2. Dependencies: List both internal and external dependencies crucial for the file's operation.
  3. Key Components and Functions:
    • Briefly describe major classes and their roles.
    • Summarize important methods and their purposes, especially those critical to the file's functionality.
  4. Important Variables: Identify significant variables, especially those that control key behaviors or configurations.
  5. Features and Systems:
    • Highlight any unique systems or features implemented, such as plugin systems or execution environments.
  6. Metadata: Include any available metadata like version number or last updated date.
  7. Output Format:
    • Use bullet points for each section.
    • Maintain clear, direct language with technical accuracy.
    • Ensure the summary is no longer than 200 words to maintain conciseness.

Objective: The summary should allow an AI agent to quickly grasp the structure, functionality, and key elements of the code file, facilitating better context awareness in further operations or tasks.

rezzie-rich commented 1 month ago

@SmartManoj check if it includes everything. If u can think of anything else that should be included, then that should be added. Code agent should know everything about the file without seeing the source code as if when the summary is given as instructions, it will generate a very similar source code.

rezzie-rich commented 1 month ago

@SmartManoj real problem is storing and updating. How to effectively and efficiently update any changes to the project. Will it be stored only as a sessional or "permanent memory" for repeated use?

Memgpt is a must addition. The current structure uses only 1 memory stream for all events, but IMO, the future is multiple memory streams. Besides the current stream, there should be parallel streams with dedicated purposes.

1- priority stream: stores the key context only from the main memory stream, so due to summarization, if any key context is lost or overlooked, this stream can recalibrate the agents. 2- avoidance stream: stores all faulty approaches or bugs to possibly prevent loops such as generating content that is either explicitly requested to not include or approaches that are not compatible with the relevant source code or even a common bug/issue. This should be carefully crafted so it doesn't accidentally store valid approaches. 3- knowledge stream: This will work like a knowledge base where source code summaries and similar contexts will be stored. 4- possibly more stream as needed.

SmartManoj commented 1 month ago

Could you provide a small prompt to test the agent using your summary and the above structure?

Could you provide a small task to test the CodeActAgent using your summary and the above structure?

I think the outline of a file is enough for an LLM if the method names are clear and the docstrings for non common methods.

  • action_to_str: Converts actions to strings.

Methods names like this are self-explanatory.

rezzie-rich commented 1 month ago

Could you provide a small task to test the CodeActAgent using your summary and the above structure?

I'm not sure what do you mean. In order to test it, agent first have to go through the whole project and create summary of it first. Then a task can be given to test the effectiveness. It should be tested in 3 stages: 1- current stage, 2- just with docstring, 3- with docstring and file summary

I think the outline of a file is enough for an LLM if the method names are clear and the docstrings for non common methods.

  • action_to_str: Converts actions to strings.

Methods names like this are self-explanatory.

We cant always rely on method names to be self-explanatory. What if the name doesn't explain the task properly? If having 3 extra words can guarantee a better contextual understanding, we should include that.

SmartManoj commented 1 month ago

Then a task can be given to test the effectiveness.

Asking this task only.

rezzie-rich commented 1 month ago

Create the tutor agent then. Check the issue on opendevin 'open-D-tutor'. All the details are in the issue post and comments.

I used mentat-bot on that so u can see the PR for comparison. Mentat uses vector db for project related contextual awareness.

rezzie-rich commented 1 month ago

@SmartManoj i saw the PR being merged. Where are you able to test it in different stages? What were the findings from the test? I'm really curious to know how it performed with and without a summary.

SmartManoj commented 1 month ago

The summary should allow an AI agent to quickly grasp the structure, functionality, and key elements of the code file, facilitating better context awareness in further operations or tasks.

The summary should be used at the starting only?

rezzie-rich commented 1 month ago

Not really. This is why i mentioned earlier in this post about memory management and the importance of memgpt.

The best way I can think of it is through multiple event streams, each having its own purpose. In this case, besides the regular memory stream, there should be another one for the knowledge base like the knowledge stream.

Only when a user selects to load a local project/github repo like uploading to a knowledge base, the search agent will go through the project and create the summary as per each file in the file structure. This will be saved in that knowledge stream. The search agent should also make a complete standalone summary of the project and tag it with the file structure.

when a user's request involves the project, an agent should access the knowledge base for the project's context awareness then make a plan and execute. agents will also access the actual raw context (source code) of the file as well when needed for task completion.

SmartManoj commented 1 month ago

when a user's request involves the project, an agent should access the knowledge base for the project's context awareness then make a plan and execute.

still, it is used at the start of the task?

rezzie-rich commented 1 month ago

The summary should be made and saved at the beginning when the user loads the project.

That summary is used when the task requires it, after the user requests it, and before making plans and executing them. fetching the actual files is part of the planning and execution.

SmartManoj commented 1 month ago

Is this equivalent to RepoExplorerAgent and CoderAgent used for the prompt "replace chroma db with pinecone"? https://github.com/SmartManoj/Kevin/pull/13#issuecomment-2264396084

rezzie-rich commented 1 month ago

Is this equivalent to RepoExplorerAgent and CoderAgent used for the prompt "replace chroma db with pinecone"? https://github.com/SmartManoj/Kevin/pull/13#issuecomment-2264396084

Kind of. However, the memory should already contain the file structure of the project and the summaries.

After giving the user instructions, agent will look at the file structure and summaries to better understand the task.

After better understanding the task, agent will make a plan of execution, which would involve fetching the actual file for a more precise context.

SmartManoj commented 1 month ago

However, the memory should already contain the file structure of the project and the summaries.

What is the use of memory if it accesses that only once throughout the task?

rezzie-rich commented 1 month ago

What is the use of memory if it accesses that only once throughout the task?

It's not gonna be used once. That's just the first time it will be used. Agents can use that whenever they need project related info.

The goal is to better understand the user request and effectively make a plan to execute the task, having more contextual information.

rezzie-rich commented 1 month ago

It's kind of being used just as only the file names would be used. The only difference is that with file names, there's a file summary, and then there is a project summary.

Process to retrieve just the file names and the process to retrieve a file, and project summary is different. But the usage is very similar if not the same.

SmartManoj commented 1 month ago

Agents can use that whenever they need project related info.

Could you provide a sample task that fails without this?

rezzie-rich commented 1 month ago

Could you provide a sample task that fails without this?

User: Create a multiple event stream. Besides the current one, there will be another stream that will record only the key contexts from the main event stream.

OD: [ takes user request], [ access the knowledge base for project summary], [ cross reference the user request and project summary to better understand the task], [Makes a draft plan], [Access all the necessary files for the tasks], [Makes detailed instructions as a plan], [Exicutes the plan], [Checks the exicuted plan satisfied the user request], [If yes, give user progress report of some feedback. If not, then highlight the issues], [Access the knowledge base for summary and repeat the following steps]

This is just an outline of the possible steps. It should be matched with current OD architecture.

If u had just used the file name, what would you do? Save it?use it only once? It's being used in the same way. It just adds some additional context for better understanding.

SmartManoj commented 1 month ago

User: Create a multiple event stream. Besides the current one, there will be another stream that will record only the key contexts from the main event stream.

Could you share the event history for this?

rezzie-rich commented 1 month ago

User: Create a multiple event stream. Besides the current one, there will be another stream that will record only the key contexts from the main event stream.

Could you share the event history for this?

It was just a chain of action i wrote, not an executed event.

SmartManoj commented 1 month ago

This is just an outline of the possible steps. It should be matched with current OD architecture.

Could you outline the current steps for comparison?

rezzie-rich commented 1 month ago

Could you outline the current steps for comparison?

I believe this is where your expertise and experience with OD come in handy. I proposed the file summaries in addition to the file name only ( something you proposed and committed, supported by the copilot workspace's approach ) to give agents more contextual awareness. My expertise is limited to SWOT Analysis.

github-actions[bot] commented 1 week ago

This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] commented 6 days ago

This issue was closed because it has been stalled for over 30 days with no activity.