Commit Graph

39 Commits (ee4043ae19129eece625adb84ac06b24aa3efddd)

Author SHA1 Message Date
Johnny C 1772a01d04
Fix URL to docs in API throttling message (#3201)
Co-authored-by: Reinier van der Leer <github@pwuts.nl>
2023-04-27 23:43:56 +02:00
James Collins 0ff471a49a
Have api manager use singleton pattern (#3269)
Co-authored-by: Nicholas Tindle <nick@ntindle.com>
2023-04-26 11:37:49 -05:00
Robin Richtsfeld d75379358f
Fix `get_ada_embedding` return type (#3263) 2023-04-25 16:52:38 -07:00
James Collins 6fbac455d4
Remove import time loading of config from llm_utils (#3245) 2023-04-25 12:10:12 -07:00
James Collins f962939737
Use explicit API keys when querying openai rather than import time manipulation of the package attributes (#3241) 2023-04-25 11:38:06 -07:00
James Collins 2619740daa
Extract OpenAI API retry handler and unify ADA embeddings calls. (#3191)
* Extract retry logic, unify embedding functions

* Add some docstrings

* Remove embedding creation from API manager

* Add test suite for retry handler

* Make api manager fixture

* Fix typing

* Streamline tests
2023-04-25 11:12:24 -07:00
Soheil Sam Yasrebi 794a164098
handle API timeouts (#3024) 2023-04-24 08:26:14 +01:00
James Collins aedd288dbe
Refactor/collect embeddings code (#3060)
* Collect all embedding code into a single module

* Collect all embedding code into a single module

* actually, llm_utils is a better place

* Oh, and remove the module now that we don't use it

---------

Co-authored-by: Nicholas Tindle <nick@ntindle.com>
2023-04-23 17:50:50 -05:00
Vwing d6ef9d1b5d
Make Auto-GPT aware of its running cost (#762)
* Implemented running cost counter for chat completions

This data is known to the AI as additional system context, and is printed out to the user

* Added comments to api_manager.py

* Added user-defined API budget.

The user is now prompted if they want to give the AI a budget for API calls. If they enter nothing, there is no monetary limit, but if they define a budget then the AI will be told to shut down gracefully once it has come within 1 cent of its limit, and to shut down immediately once it has exceeded its limit. If a budget is defined, Auto-GPT is always aware of how much it was given and how much remains to be spent.

* Chat completion calls are now done through api_manager. Total running cost is printed.

* Implemented api budget setting and tracking

User can now configure a maximum api budget, and the AI is aware of that and its remaining budget. The AI is instructed to shut down when exceeding the budget.

* Update autogpt/api_manager.py

Change "per token" to "per 1000 tokens" in a comment on the api cost

Co-authored-by: Rob Luke <code@robertluke.net>

* Fixed lint errors

* Include embedding costs

* Add embedding completion cost

* lint

* Added 'requires_api_key' decorator to test_commands.py, switched to a valid chat completions model

* Refactor API manager, add debug mode, and add tests

- Extract model costs to  to avoid duplication
- Add debug mode parameter to ApiManager class
- Move debug mode configuration to
- Log AI response and budget messages in debug mode
- Implement 'test_api_manager.py'

* Fixed test_setup failing. An extra user input is needed for api budget

* Linting

---------

Co-authored-by: Rob Luke <code@robertluke.net>
Co-authored-by: Nicholas Tindle <nick@ntindle.com>
2023-04-23 16:04:31 -05:00
BillSchumacher d7679d755f
Fix all commands and cleanup 2023-04-19 18:17:04 -05:00
BillSchumacher 86d3444fb8
isort, add proper skips. 2023-04-18 18:59:23 -05:00
BillSchumacher 085842d43c
Merge branch 'master' of https://github.com/BillSchumacher/Auto-GPT into plugin-support 2023-04-18 18:44:40 -05:00
Taylor Beeston b84de4f7f8
♻️ Use AutoGPT template package for the plugin type 2023-04-17 22:10:40 -07:00
Merwane Hamadi cf9a94a8b6 isort implemented 2023-04-17 13:42:01 -07:00
Sourcery AI 9705f60dd3 'Refactored by Sourcery' 2023-04-17 19:44:54 +00:00
Taylor Beeston ea67b6772c
🐛 Minor type fixes 2023-04-17 12:42:17 -07:00
BillSchumacher 64e05778ef
Merge pull request #1987 from cryptidv/fix-oai-error-msgs
Improve the error logging for OAI Issues
2023-04-17 12:47:28 -05:00
H-jj-R 8dadf79614 Spelling fixes 2023-04-17 13:25:49 +01:00
BillSchumacher fbd4e06df5
Add early abort functions. 2023-04-16 23:39:33 -05:00
BillSchumacher 3715ebc7eb
Add hooks for chat completion 2023-04-16 23:30:42 -05:00
BillSchumacher c110f3489d
Finish integrating command registry 2023-04-16 21:51:36 -05:00
Eesa Hamza 2d24876530 Fix linter issues 2023-04-16 22:16:43 +03:00
BillSchumacher c544cebbe6
Merge branch 'master' of https://github.com/BillSchumacher/Auto-GPT into plugin-support 2023-04-16 14:15:15 -05:00
Eesa Hamza 9b6bce4592 Improve the error logging for OAI Issues 2023-04-16 22:10:48 +03:00
jayceslesar 8990911522 unify annotations to future syntax 2023-04-16 14:02:48 -04:00
BillSchumacher 1af463b03c
Merge branch 'master' of https://github.com/Significant-Gravitas/Auto-GPT into plugin-support 2023-04-15 21:37:27 -05:00
BillSchumacher 4a19124cb7
Blacked. 2023-04-15 16:40:12 -05:00
BillSchumacher ff5b8f1490
Merge pull request #1683 from Hyaxia/feature/rate-limit-log
in debug mode add a log about rate limit error
2023-04-15 15:18:28 -05:00
BillSchumacher 8978844111
Update llm_utils.py
Remove pass
2023-04-15 15:17:23 -05:00
BillSchumacher 898b7eed8a
Merge pull request #1635 from Imccccc/feature/embedding-with-retry
Embedding Improvement
2023-04-15 15:04:31 -05:00
BillSchumacher 93b3e8428c
Update llm_utils.py
Fix trailing whitespace
2023-04-15 15:03:03 -05:00
hyaxia 2f776957d8 changed error msg 2023-04-15 22:20:05 +03:00
hyaxia 051b5372ce in debug mode add a log about rate limit error 2023-04-15 22:06:27 +03:00
Imccccc f67b81e200 Embedding Improvement
1. move embedding function into llm_utils
2. add try feature with in embedding function
2023-04-16 00:47:41 +08:00
youkaichao a51b37f01c fix dict type annotation 2023-04-15 22:10:22 +08:00
BillSchumacher 1073954fb7
Reorg (#1537)
* Pi's message.

* Fix most everything.

* Blacked

* Add Typing, Docstrings everywhere, organize the code a bit.

* Black

* fix import

* Update message, dedupe.

* Increase backoff time.

* bump up retries
2023-04-15 13:56:23 +01:00
BillSchumacher 4bb7a598a5
Fix everything (#1444)
* Pi's message.

* Fix most everything.

* Blacked
2023-04-15 01:04:48 +01:00
0xArty 328ba5e69e formatting 2023-04-14 20:42:28 +01:00
Dino Hensen d64f866bfa Convert to python module named autogpt.
Also fixed the Dockerfile.
Converting to module makes development easier.
Fixes coverage script in CI and test imports.
2023-04-14 10:27:41 -07:00