yoheinakajima / babyagi

MIT License
19.9k stars 2.61k forks source link

File output, enriched results and category agent #210

Closed robiwan303 closed 1 year ago

robiwan303 commented 1 year ago

I did combine some changes/updates in this commit. Please see the list below:

1.) Added a simple write functionality to have the terminal output in a txt-file for usage with GPT-4, which can read-in a few pages for each prompt. I am playing around a lot with this combination, using a task-based list created with BabyAGI for GPT-4, amazing results! :-)

2.) Adding a new agent for classification of a configurable number of categories for the task results ('category_agent'). These categories been added to 'enriched_results' and are included in metadata.

The intention behind this is to generate more context for each task result. Not sure how this impacts the system, but it seems to improve the task generation procedure. Was a little bit tricky to setup the prompt accordingly, but the categories seem to be helpful.

The parameter 'm' is intended to limit the number of words, but ChatGPT is not obeying to this limit always.

3.) Did some minor optimization for the 'prioritization_agent' and the prompt. The the description how to structure the numbered list sometimes lead to output of '#' and subsequent crash. With two more example lines this does not happen. Did anyone else observe this behavior?

I also did change the the line above in the prompt a bit, team -> team of agents. Should be more exact.

4.) Did some beautification for the print() terminal output, activated the part for 'RELEVANT CONTEXT' output and added one for 'ENRICHED RESULT'.

I also did add a timestamp (system time), which is up to now only used for output to terminal. Not sure if such a timestamp would make sense as metadata.

5.) Merging of latest updates from main branch.

Maybe not all changes are relevant for the main branch. @yoheinakajima : Please decide for yourself.

robiwan303 commented 1 year ago

@francip : Thanks for the review and the suggestions!

I agree, would make sense to split the two changes. And yes, the text file part has room for improvement. Will consider your recommendation for a single function.

Regarding the category addition, the feature seems to really improve the results. Did a few test runs with same topics as before. Up to now I just did add it to the metadata. Please share your ideas on how to play around more and find out the best usage for this metadata.