yoheinakajima / babyagi Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
Hardcoded API keys in the code can easily leak, posing a security risk.
Store API keys in environmental variables or a separate config file that is not checked into version control.
I need task ID's and I don't have them
I cannot get access to openAI and thus I cannot use the original get_ada_embedding
function. However, I find that there's an executable called embedding
in llama.cpp and it can output a 5120 D vector. So I modify the get_ada_embedding
function and let LLAMA do the embedding. I am wondering if it could work as well.
However, the modified program hasn't provide me with any result and it runs for over 5 minutes :(
How do you delete current objective and start over? Anyone? Bueller?
I'm wondering if there's alternative to the OpenAI API, such as a self-hosted model that can do the same?
What should be written in the following, I'm having error messages about pinecone & table name. Can you give an example?
Is the table name an index in pincone? I'm a noob coder, actually I don't know sh*t about coding so help would be helpful :D/
PINECONE_ENVIRONMENT=
TABLE_NAME=
Just notice that openai_call was USED the text-davinci-003
as default , why not use gpt-3.5-turbo ?
def openai_call(prompt: str, use_gpt4: bool = False, temperature: float = 0.5, max_tokens: int = 100):
if not use_gpt4:
#Call GPT-3 DaVinci model
response = openai.Completion.create(
engine='text-davinci-003',
prompt=prompt,
temperature=temperature,
max_tokens=max_tokens,
top_p=1,
frequency_penalty=0,
presence_penalty=0
)
return response.choices[0].text.strip()
else:
#Call GPT-4 chat model
messages=[{"role": "user", "content": prompt}]
response = openai.ChatCompletion.create(
model="gpt-4",
messages = messages,
temperature=temperature,
max_tokens=max_tokens,
n=1,
stop=None,
)
return response.choices[0].message.content.strip()
Why ? The text-davinci-003
is 10x expensive than gpt-3.5-turbo . What's the reason ? Can you explain that .
question from a non-technical me:
can you make it work with a local model like LLaMa 7-60b or GPT4All so we won't get errors from openAI on a free accounts ?
After a while, we assume it will now be more proficient in a certain kind of task, how then do you use it to make it work for you?
@yoheinakajima, thank you for open-sourcing babyagi! I cloned this repository and had it up and running in no time. I think this project is going to be the spark of a ton of ideas for features, improvements, and future AI projects. I'm exploring how to use this to produce longer-form documents and articles. It would be great to have the ability to selectively output results to a separate file. I wanted to open an issue to introduce myself and get the conversation rolling! I'm going to open a pull request when I get something to work if someone doesn't beat me to the punch!
Hey, so I have a game built from HTML/Javascript. I would like to see how well Baby AGI could try to understand and then modify the existing game. Make changes... re-run the game... play it for finding bugs, etc.
For this it will need to learn how to press buttons, type text into fields, and
How might this be achieved? What plugin(s) could we pull in or other API's to link up to?
I am of the opinion that the task_creation_agent
should understand when a task should not be split up in a long list of tasks.
Here's an example of a particular failure.
Counter-argument: obviously this task can be performed well by GPT-4 alone, so I may overthink the issue. But
task_creation_agent
should know when 2 vs 5 or 10 are enough*****OBJECTIVE*****
Write a list of the top 5 countries for best food in the world
*****TASK LIST*****
1: Develop a task list
*****NEXT TASK*****
1: Develop a task list
*****TASK RESULT*****
1. Research food cultures around the world
2. Evaluate the quality of food in each country
3. Research popular dishes in each country
4. Rank countries based on the quality and variety of their cuisine
5. Create a list of the top 5 countries for best food in the world
You are a task creation AI that uses the result of an execution agent to create new tasks with the following objective: Write a list of the top 5 countries for best food in the world, The last completed task has the result: {'data': '1. Research food cultures around the world \n2. Evaluate the quality of food in each country \n3. Research popular dishes in each country \n4. Rank countries based on the quality and variety of their cuisine \n5. Create a list of the top 5 countries for best food in the world'}. This result was based on this task description: Develop a task list. These are incomplete tasks: . Based on the result, create new tasks to be completed by the AI system that do not overlap with incomplete tasks. Return the tasks as an array.
*****TASK LIST*****
2: Analyze the quality of the ingredients used in each country's cuisine
3: Gather information on the ingredients used in each country's cuisine
4: Compare the cooking methods used in each country's cuisine
5: Assess the presentation of food in each country
6: Compare the cost of food in each country
7: Write a list of the top 5 countries for best food in the world
*****NEXT TASK*****
2: Analyze the quality of the ingredients used in each country's cuisine
*****TASK RESULT*****
1. France - French cuisine is renowned for its high-quality ingredients, such as butter, cream, and fresh produce.
2. Italy - Italian cuisine is renowned for using fresh, seasonal ingredients, such as tomatoes, olives, and artichokes.
3. Japan - Japanese cuisine is renowned for its use of fresh seafood, such as tuna, eel, and squid.
4. China - Chinese cuisine is renowned for its use of fresh vegetables, such as cabbage, bok choy, and mushrooms.
5. India - Indian cuisine is renowned for its use of spices, such as cumin, turmeric, and coriander.
You are a task creation AI that uses the result of an execution agent to create new tasks with the following objective: Write a list of the top 5 countries for best food in the world, The last completed task has the result: {'data': '1. France - French cuisine is renowned for its high-quality ingredients, such as butter, cream, and fresh produce.\n2. Italy - Italian cuisine is renowned for using fresh, seasonal ingredients, such as tomatoes, olives, and artichokes.\n3. Japan - Japanese cuisine is renowned for its use of fresh seafood, such as tuna, eel, and squid.\n4. China - Chinese cuisine is renowned for its use of fresh vegetables, such as cabbage, bok choy, and mushrooms.\n5. India - Indian cuisine is renowned for its use of spices, such as cumin, turmeric, and coriander.'}. This result was based on this task description: Analyze the quality of the ingredients used in each country's cuisine. These are incomplete tasks: Gather information on the ingredients used in each country's cuisine, Compare the cooking methods used in each country's cuisine, Assess the presentation of food in each country, Compare the cost of food in each country, Write a list of the top 5 countries for best food in the world. Based on the result, create new tasks to be completed by the AI system that do not overlap with incomplete tasks. Return the tasks as an array.
*****TASK LIST*****
3: Assess the presentation of food in each country
4: Compare the cost of food in each country
5: Research the regional variations of each country's cuisine
6: Analyze the cultural influences on each country's cuisine
7: Compare the nutritional value of food from each country
8: Investigate the history of each country's cuisine
9: Evaluate the sustainability of food production in each country
10: Write a list of the top 5 countries for best food
*****NEXT TASK*****
3: Assess the presentation of food in each country
*****TASK RESULT*****
1. France - French cuisine is known for its exquisite presentation, with dishes often composed like works of art.
2. Japan - Japanese food is often presented in an aesthetically-pleasing way, with beautiful plating and intricate designs.
3. Italy - Italian cuisine is renowned for its eye-catching presentation, with dishes often decorated with edible garnishes.
4. Thailand - Thailand's elegant food presentation includes vibrant colors and intricate details, making it a feast for the eyes as well as the taste buds.
5. India - Indian food is known for its beautiful presentation, with dishes often garnished with edible flowers and herbs.
You are a task creation AI that uses the result of an execution agent to create new tasks with the following objective: Write a list of the top 5 countries for best food in the world, The last completed task has the result: {'data': "1. France - French cuisine is known for its exquisite presentation, with dishes often composed like works of art.\n2. Japan - Japanese food is often presented in an aesthetically-pleasing way, with beautiful plating and intricate designs.\n3. Italy - Italian cuisine is renowned for its eye-catching presentation, with dishes often decorated with edible garnishes.\n4. Thailand - Thailand's elegant food presentation includes vibrant colors and intricate details, making it a feast for the eyes as well as the taste buds.\n5. India - Indian food is known for its beautiful presentation, with dishes often garnished with edible flowers and herbs."}. This result was based on this task description: Assess the presentation of food in each country. These are incomplete tasks: Compare the cost of food in each country, Research the regional variations of each country's cuisine, Analyze the cultural influences on each country's cuisine, Compare the nutritional value of food from each country, Investigate the history of each country's cuisine, Evaluate the sustainability of food production in each country, Write a list of the top 5 countries for best food. Based on the result, create new tasks to be completed by the AI system that do not overlap with incomplete tasks. Return the tasks as an array.
HTTP response body: The index exceeds the project quota of 1 pods by 1 pods. Upgrade your account or change the project settings to increase the quota.
do I need a standard $70 a month pinecone account to use this?
After seemingly completing a lot of tasks it failed as follows :(
Traceback (most recent call last):
File "./babyagi.py", line 176, in
prioritization_agent(this_task_id)
File "./babyagi.py", line 111, in prioritization_agent
response = openai_call(prompt)
File "./babyagi.py", line 87, in openai_call
response = openai.ChatCompletion.create(
File "/home/rajesh/.local/lib/python3.8/site-packages/openai/api_resources/chat_completion.py", line 25, in create
return super().create(*args, **kwargs)
File "/home/rajesh/.local/lib/python3.8/site-packages/openai/api_resources/abstract/engine_api_resource.py", line 153, in create
response, _, api_key = requestor.request(
File "/home/rajesh/.local/lib/python3.8/site-packages/openai/api_requestor.py", line 226, in request
resp, got_stream = self._interpret_response(result, stream)
File "/home/rajesh/.local/lib/python3.8/site-packages/openai/api_requestor.py", line 619, in _interpret_response
self._interpret_response_line(
File "/home/rajesh/.local/lib/python3.8/site-packages/openai/api_requestor.py", line 674, in _interpret_response_line
raise error.APIError(
openai.error.APIError: HTTP code 502 from API (
<div id="cf-error-details" class="p-0">
<header class="mx-auto pt-10 lg:pt-6 lg:px-8 w-240 lg:w-full mb-8">
<h1 class="inline-block sm:block sm:mb-2 font-light text-60 lg:text-4xl text-black-dark leading-tight mr-2">
<span class="inline-block">Bad gateway</span>
<span class="code-label">Error code 502</span>
</h1>
<div>
Visit <a href="https://www.cloudflare.com/5xx-error-landing?utm_source=errorcode_502&utm_campaign=api.openai.com" target="_blank" rel="noopener noreferrer">cloudflare.com</a> for more information.
</div>
<div class="mt-3">2023-04-07 10:17:09 UTC</div>
</header>
<div class="my-8 bg-gradient-gray">
<div class="w-240 lg:w-full mx-auto">
<div class="clearfix md:px-8">
<span class="cf-icon-browser block md:hidden h-20 bg-center bg-no-repeat"></span>
<span class="cf-icon-ok w-12 h-12 absolute left-1/2 md:left-auto md:right-0 md:top-0 -ml-6 -bottom-4"></span>
Browser
<span class="cf-icon-server block md:hidden h-20 bg-center bg-no-repeat"></span>
<span class="cf-icon-error w-12 h-12 absolute left-1/2 md:left-auto md:right-0 md:top-0 -ml-6 -bottom-4"></span>
Host
</div>
</div>
</div>
<div class="w-240 lg:w-full mx-auto mb-8 lg:px-8">
<div class="clearfix">
<div class="w-1/2 md:w-full float-left pr-6 md:pb-10 md:pr-0 leading-relaxed">
<h2 class="text-3xl font-normal leading-1.3 mb-4">What happened?</h2>
<p>The web server reported a bad gateway error.</p>
</div>
<div class="w-1/2 md:w-full float-left leading-relaxed">
<h2 class="text-3xl font-normal leading-1.3 mb-4">What can I do?</h2>
<p class="mb-6">Please try again in a few minutes.</p>
</div>
</div>
</div>
<div class="cf-error-footer cf-wrapper w-240 lg:w-full py-10 sm:py-4 sm:px-8 mx-auto text-center sm:text-left border-solid border-0 border-t border-gray-300">
Cloudflare Ray ID: 7b417d3fede7be97 โข Performance & security by Cloudflare
<script>(function(){function d(){var b=a.getElementById("cf-footer-item-ip"),c=a.getElementById("cf-footer-ip-reveal");b&&"classList"in b&&(b.classList.remove("hidden"),c.addEventListener("click",function(){c.classList.add("hidden");a.getElementById("cf-footer-ip").classList.remove("hidden")}))}var a=document;document.addEventListener&&a.addEventListener("DOMContentLoaded",d)})();</script></div>
There is a major issue with how the LLM replies with task lists. The typical response is in the format:
1. Do something
but it a few cycles down the chain it commonly becomes
1: Do something
I think a better way to parse the task list is needed. Maybe just don't ask the LLM to put numbers there in the first place but still write them out in order? Otherwise, a secondary parsing layer is needed beyond just splitting on delimiters.
Hi Gentlefolks,
After the task list crashed again because of OpenAi being overloaded with requests, I thought it might be a good idea if you could create a task and output library that can be reused from the cloud.
Cheers
I left it running a content mapping research task, and it ran the same tasks over-and-over, 37 times (yes, I counted)
I'm left with the suspicious feeling that this is designed to do nothing but eat up OpenAI tokens.
In 8 hours, the content map it came up with is 19 items long. This is less than I get with a single (shorter) prompt in the playground or chat.
It's definitely creating the pinecone storage area, but for some reason it can't seem to remember anything (37 repeats).
Hi there! Tried to solve this one myself but I'm stumped. Every time I run babyagi.py I get this message. I've got the API keys and environment name verified and in my .env file. Any ideas?
Traceback (most recent call last):
File "C:\Users\darko\Downloads\babyagi-main\babyagi-main\babyagi.py", line 81, in
pinecone.init(api_key=PINECONE_API_KEY, environment=PINECONE_ENVIRONMENT)
AttributeError: module 'pinecone' has no attribute 'init'
Import "openai" could not be resolved
Import "openai" could not be resolved
Import "openai" could not be resolved
The loop of
seems to work well, but one point of contention crops up when analyzing the scope and complexity of individual tasks. For example, a task of "install ruby 3.2.1" seems completable within a single chain of ops, but a larger task of "start a company" would probably be better executed after breaking it up into smaller, more discrete steps ("search competitors for a desired name", "register a company", "publish a landing page", etc) without then tracking the task as complete.
Is there any work planned or being done in analyzing scope/complexity of tasks and decomposing one task into many, especially in place of "executing" that larger task? Seems like something that would be useful for larger, more involved goals attempting to complete more complicated tasks.
I have a pretty good idea that may become key to an artificial intelligence capable of performing tasks on a computer (at least based on Linux). The idea that occurs to me is very aligned with this project, it is the following:
The task list will be created and distributed to other sub agents that will be in charge of creating various processes including creating .sh files (to execute linux commands) and visual feedback for GPT-4. When this feedback occurs, another agent will create a .sh file that will continue processing until the assigned goal is met.
This will give babyAGI the ability to start accomplishing goals, but within the operating system, from small goals like "Open a program" to more complex goals like getting things done within the internet browser in conjunction with other programs.
This would be relatively easy to test, since it doesn't need to "execute" all those instructions, just that the output is the list of commands in order to be executed, so there is little risk.
It is also possible that the commands to be executed include mouse and keyboard events. Also, screenshots that serve as feedback for BabyAGI to continue interacting with the computer.
In short, given a goal as input, BabyAGI creates the commands for the Linux distribution to meet that goal, the output would be the interaction with the computer. It would be a great experiment because it aims to give your operating system "own brain and decision power".
The implementation of this proposal could be considered an important step towards the development of a strong artificial intelligence, since it would allow the AI to interact with the physical world through a computer.
Hey,
am kinda new to the whole ML space. I was exploring github and found https://github.com/chroma-core/chroma and was thinking isnt it similiar to pinecone? If so is it possible to add functionality for chroma to babyagi?
If it is i would love to try implementing it
The current configuration management in the project relies on the .env file for managing both configuration and environment variables. As the project grows, the .env file and related validation code will become cluttered and difficult to maintain. Additionally, task prompts and prompt templates could be moved out to a YAML file for enhanced configurability.
To improve organization and maintainability, there could be a couple of approaches
Option 1: Keep API keys in environment variables and move the rest of the configuration to YAML.
Option 2: Move all configurations, including API keys, to the YAML file.
Before proceeding with any further requirements, I would like to discuss other users and consider all options to make the best decision for the project. Has this issue been previously raised? Is there a Discord channel where this could be talked about?
Some edge cases in task formatting may confuse the agents. For example:
task_creation_agent()
function, when creating new tasks, it's possible to receive empty task descriptions from the OpenAI API. This can lead to tasks being added to the task list with no meaningful content.prioritization_agent()
:prioritization_agent()
function expects the OpenAI API to return a list of tasks in a specific format, with each task string containing a number and a task description separated by a period. If the API returns an invalid format, the code may not parse the task correctly, leading to issues with the task list.prioritization_agent()
function relies on the OpenAI API to return a properly numbered list of tasks. If the returned task numbering is inconsistent or incorrect, the task list may become disorganized or unmanageable.What if those autonomous bots can actually control your device like a human ?
Will it become Super Human ?
https://github.com/abhiprojectz/SingularGPT
SingularGPT - Can easily automate anything on what's your device and even headless?
It can even detect and recognise elements using by its own.
No crawling system no restriction.
It can perform UI actions and can internally process them and also automates them all by natural language.
Anyone please leave your thoughts!
Ask it to create the GUI
If the OpenAI or Pinecone APIs return an error or fail, the code may not handle it gracefully.
Add try-except blocks to catch API errors and implement appropriate error handling and logging mechanisms
Thank you for making this great system available open source!
So, it could print out periodically like every time it exceeds another X dollars or cents, or after every API call, some estimated API cost analytics, possibly including all-time total expense, total expense for this run, and expense of last API call, as a 3-tuple or something.
The ability to halt before a certain cost limit has been reached.
I would please really like to see some of the redacted features put back into this or a forked repo, because not everyone who has a valid use of those features has the ability to reimplement those features.
Integration with an existing to-do list system or API. I have about 200,000 tasks recorded in a planning system.
The ability to utilize a local LLM instead of GPT-4, for cost and infosec reasons.
Some kind of FIFO assurances, so that tasks are processed in sequence.
Some Jason/AgentSpeak(L) event loop architectural features (if any are missing): see:
The possibility for a human to enter and exit the loop, via some kind of dialogue system.
very cool concept here.
For similar types of projects I have found using sqlite database + hnswlib useful since with pinecone I still typically need another database anyway for persisting other state.
I have a minimal integration of these 2 that behaves similar to pinecone:
https://github.com/jiggy-ai/hnsqlite
Here i have babyagi working with hnsqlite 0.2.0:
https://github.com/wskish/babyagi/blob/hnsqlite-integration/babyagi.py
Let me know if this approach is of any interest. It seems like a possible next step is persisting the task_list so the sqlite db could be useful for that.
can you make it work with the unofficial chatgpt api, so its completely free to use.
I have ported BabyAGI to swift, and had a question about how context is used. (So this is more a discussion point, not an issue)
It seems that the context in the execution agent is a list of the previously completed tasks, by name, not including the results? (Unless my python read is bad, which could be the case!) I guess I understand that the execution doesn't need the previous results, just what was completed (ie the task names). And the result is what is used to create the embedding vector.
But if that's true, is there any reason to also store the whole result in Pinecones metadata?
code will run indefinitely in it's current state, as there is no termination condition for the main loop.
Implement a termination condition (for example, an empty task list or a maximum number of iterations) to break the loop
As stated I'm wondering how many pods on Pinecone that are needed to run this, because I keep getting the following error
HTTP response body: The index exceeds the project quota of 1 pods by 1 pods. Upgrade your account or change the project settings to increase the quota.
I was hoping LangChain would be built into the process so it could leverage all the cool stuff already integrated with LangChain.
At a minimum it should be able to search the internet and gather information.
Am I missing something here?
Just got this error:
ConnectionResetError: [Errno 104] Connection reset by peer
Anyone have thoughts about building in some kind of retry method to enable Babyagi to keep running if OpenAI hangs up for awhile?
Would like to see local LLMS like Alpaca and Llama.
Enhancement suggestion: add capability of evaluating, testing and updating babyAGIs own code.
I'm getting openai.error.InvalidRequestError: The model: gpt-4 does not exist
I have GPT Plus. Why am I still seeing this error? Thank you.
hey! I used Graphical Code Tracer to create a UML diagram of babyagi.py to help beginners understand your code. Would love it if you could attach it to the readme. Have better context now with this visualization ๐
Can the readme be updated to explain how to interface with llama? I've tried
./babyagi.py -l llama -m models/ggml-vicuna-13b-4bit.bin
Setting the .env
OPENAI_API_KEY=
OPENAI_API_MODEL=llama
As far as I know there is no OPENAI_API_KEY as it is run locally on my computer.
Over time the list of tasks be comes more and more similar.
This is likely due to the task list using during the creation of tasks, creating a bias in the format and topics used in the newly created tasks.
It's also possible that this is exaggerated by the task list being being cut off at certain lengths when the max_token limit is hit and more tasks aren't generated, especially when tasks become longer in description.
These screenshots have about 3 iterations between each, but notice the second has an item cutoff due to the length, resulting in a loss of that item by the reprioritization the next iteration.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.