Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement babyagi_agent and integrate it into multimodel role playing #210

Merged
merged 70 commits into from
Aug 1, 2023

Conversation

hychen-naza
Copy link
Contributor

@hychen-naza hychen-naza commented Jul 7, 2023

Description

Add babyagi code under camel agents, and put its its example code and testing code in corresponding folders.

Feature change:
camel/agents/babyagi_agent.py: main updates happen here. I tried to make the code style and format close to chat_agent.py and reuse its functions, which hopefully would make your review process easier.

Example File:
camel/societies/role_playing_multi_model.py: babyagi_agent and chat_agent work together, but I only changed agent initialization compare to role_playing.py
examples/ai_society/babyagi_playing.py : babyagi_agent alone to plan and solve the task

Test File:
test/agents/test_babyagi_agent.py: test babyagi_agent

Babyagi Agent works by running an infinite loop that does the following steps:
1, Pulls the first task from the task list.
2, Sends the task to the execution agent, which uses OpenAI's API to complete the task based on the context.
3, Enriches the result and stores it in Chroma.
4, Creates new tasks and reprioritizes the task list based on the objective and the result of the previous task.

Compared to role-play, which has AI user and AI assistant, Babyagi Agent gives itself instructions through task creation and solve solutions by task execution.

Motivation and Context

Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
close #186

  • I have raised an issue to propose this change (required for new features and bug fixes)

Types of changes

What types of changes does your code introduce? Put an x in all the boxes that apply:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds core functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (update in the documentation)
  • Example (update in the folder of example)

Checklist

Go over all the following points, and put an x in all the boxes that apply.
If you are unsure about any of these, don't hesitate to ask. We are here to help!

  • I have read the CONTRIBUTION guide. (required)
  • My change requires a change to the documentation.
  • I have updated the tests accordingly. (required for a bug fix or a new feature)
  • I have updated the documentation accordingly.

@hychen-naza hychen-naza mentioned this pull request Jul 7, 2023
10 tasks
@Obs01ete
Copy link
Collaborator

Obs01ete commented Jul 7, 2023

Please keep this PR as a draft

@hychen-naza hychen-naza marked this pull request as draft July 7, 2023 19:28
@hychen-naza
Copy link
Contributor Author

Still one error in mypy test: camel/agents/babyagi_agent.py:21: error: Cannot find implementation or library stub for module named "chromadb.utils.embedding_functions" [import].

I used # type: ignore to let mypy ignore the import missing. It works for import chromadb but fails in from chromadb.utils.embedding_functions import OpenAIEmbeddingFunction.

@hychen-naza hychen-naza changed the title Just to debug the doc check failure Implement babyagi_agent and intergrate it into multimodel role playing Jul 15, 2023
@hychen-naza hychen-naza changed the title Implement babyagi_agent and intergrate it into multimodel role playing Implement babyagi_agent and integrate it into multimodel role playing Jul 15, 2023
@hychen-naza hychen-naza marked this pull request as ready for review July 15, 2023 17:26
Copy link
Member

@lightaime lightaime left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look good! Thanks for the fix. Left a few small comments.

camel/agents/task_agent.py Outdated Show resolved Hide resolved
camel/agents/task_agent.py Outdated Show resolved Hide resolved
camel/agents/task_agent.py Outdated Show resolved Hide resolved
camel/agents/task_agent.py Outdated Show resolved Hide resolved
camel/agents/task_agent.py Outdated Show resolved Hide resolved
camel/utils/functions.py Outdated Show resolved Hide resolved
camel/agents/task_agent.py Outdated Show resolved Hide resolved
camel/agents/task_agent.py Outdated Show resolved Hide resolved
camel/agents/task_agent.py Outdated Show resolved Hide resolved
camel/agents/task_agent.py Outdated Show resolved Hide resolved
hychen-naza and others added 11 commits July 26, 2023 21:06
Co-authored-by: Guohao Li <lightaime@gmail.com>
Co-authored-by: Guohao Li <lightaime@gmail.com>
Co-authored-by: Guohao Li <lightaime@gmail.com>
Co-authored-by: Guohao Li <lightaime@gmail.com>
Co-authored-by: Guohao Li <lightaime@gmail.com>
Co-authored-by: Guohao Li <lightaime@gmail.com>
Co-authored-by: Guohao Li <lightaime@gmail.com>
Co-authored-by: Guohao Li <lightaime@gmail.com>
Co-authored-by: Guohao Li <lightaime@gmail.com>
Co-authored-by: Guohao Li <lightaime@gmail.com>
@lightaime
Copy link
Member

The output of the TaskPrioritizationAgent makes sense. 😆

original_task_prompt = "Prove the Riemann hypothesis as a high school student"

task_list = [
    "Obtain a PhD in mathematics",
    "Learn high school math",
    "Learn graduate school math",
    "Learn college math",
    "Drop out of high school",
    "Start a tech company",
]
    
Prioritized task list:
['Learn high school math', 'Learn college math', 'Learn graduate school math', 'Obtain a PhD in mathematics', 'Start a tech company', 'Drop out of high school']

@lightaime lightaime added the Agent Related to camel agents label Jul 31, 2023
Copy link
Member

@lightaime lightaime left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @hychen-naza. Did some small modifications. I think it is good to merge.

@lightaime
Copy link
Member

@hychen-naza @Obs01ete let me know if there is any question.

Copy link
Collaborator

@Obs01ete Obs01ete left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lightaime lightaime merged commit aa1c912 into master Aug 1, 2023
10 checks passed
@lightaime lightaime deleted the new_agents branch August 1, 2023 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Agent Related to camel agents
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

[Roadmap] Reproduce more SOTA LLM agents
4 participants