Commit Graph

5255 Commits (autogpt-v0.5.1)

Author SHA1 Message Date
Reinier van der Leer 26324f2984
fix(agent): Update .env.template to match changes in 370615e 2024-04-26 19:35:09 +02:00
Reinier van der Leer ba5d0c8627
feat(agent): Add support for new `gpt-4-turbo` model and set as default `SMART_LLM` 2024-04-26 19:35:01 +02:00
Reinier van der Leer 7d727d1b54
fix(agent): Fix `OneShotAgentPromptStrategy` parser when using functions/tools API
Also:
- Improve error message when the LLM doesn't call any tools
2024-04-26 19:34:49 +02:00
Reinier van der Leer d2260bec5a
fix(agent): Expand failure check in `json_loads(..)`
Not only check if the resulting object is `demjson3.undefined`, but also `demjson3.syntax_error`.
2024-04-26 19:34:44 +02:00
Reinier van der Leer a88d5fca86
chore(agent): Update `duckduckgo-search` to v5.3.0 2024-04-26 19:33:32 +02:00
Reinier van der Leer 0ecb233101
fix(agent): Fix crash when `LOG_FORMAT=structured_google_cloud`
Another piece of fallout from cf00c33 - fix(agent): Fix debug logging & amend configure_logging for easier use
2024-04-26 19:33:25 +02:00
Nicholas Tindle 27e92dad4f
fix(agent/setup): Fix installing ONNXRuntime on macOS on some architectures (#7022)
Co-authored-by: Reinier van der Leer <pwuts@agpt.co>
2024-04-26 19:33:15 +02:00
Fullstop000 7430e011f1
fix(agent): Support OpenAI Project API keys (#7099)
Amend regex expression in config.py that OpenAI API keys are validated against

Signed-off-by: Fullstop000 <fullstop1005@gmail.com>
2024-04-26 19:33:08 +02:00
Reinier van der Leer 706bff4778
fix(agent): Full fix for CLI breakage introduced in cf00c33 2024-04-26 19:31:38 +02:00
Reinier van der Leer 3d10637a5d
Merge commit '6ff02677d2b30bec8edd5bafcb35e399e33217da' into release-autogpt-v0.5.x 2024-04-26 19:29:34 +02:00
Reinier van der Leer 6ff02677d2
fix(agent/core): Set `OpenAIProvider._configuration.retries_per_request` to 7 by default
10 was too much, caused multi-minute timeouts between retries
2024-04-22 18:46:28 +02:00
Reinier van der Leer 4db4ca08b2
refactor(agent): Tweak `model_providers.schema` for easier use
- Set default values for `ProviderBudget` / `ModelProviderBudget` fields
- Remove redundant field redefinitions on `ModelProviderBudget` class
- Change `ModelProviderUsage.update_usage(..)` and `ModelProviderBudget.update_usage_and_cost(..)` signatures for easier use
- Change `ModelProviderBudget.usage` from `ModelProviderUsage` to `defaultdict[str, ModelProviderUsage]` for per-model usage tracking
- Fix `ChatModelInfo`/`EmbeddingModelInfo` `service` attribute: rename from `llm_service` to match base class and fix types.
  This makes it unnecessary to specify the `service` field when creating a `ChatModelInfo` or `EmbeddingModelInfo` object.
- Use `defaultdict(ModelProviderBudget)` for task budget tracking in agent_protocol_server.py
2024-04-22 18:40:48 +02:00
Reinier van der Leer 7bb7c30842
feat(agent/core): Add `max_output_tokens` parameter to `create_chat_completion` interface 2024-04-22 17:47:15 +02:00
Reinier van der Leer 35ebb10378
refactor(agent): Add `ChatModelProvider.get_available_models()` and remove `ApiManager` 2024-04-22 17:44:49 +02:00
Reinier van der Leer b77451bb3a
fix(agent/tests): Remove useless tests in test_config.py 2024-04-22 17:26:02 +02:00
Reinier van der Leer cf00c33f90
fix(agent): Fix debug logging & amend `configure_logging` for easier use 2024-04-22 17:14:22 +02:00
Reinier van der Leer 61adf58f4f
lint(agent): Remove unused `os` import in file_storage/s3.py 2024-04-21 22:22:10 +02:00
Reinier van der Leer 452df39a52
feat(agent/core): Allow zero-argument instantiation of `OpenAIProvider` 2024-04-18 21:35:11 +02:00
Reinier van der Leer 49a08ba7db
refactor(agent): Remove redundant parsing functions in config classes
Pydantic has built-in typecasting logic, so converting to Python builtin types and enums is done automatically.
2024-04-18 20:01:39 +02:00
Reinier van der Leer 7082e63b11
refactor(agent): Refactor & improve `create_chat_completion` (#7082)
* refactor(agent/core): Rearrange and split up `OpenAIProvider.create_chat_completion`
   - Rearrange to reduce complexity, improve separation/abstraction of concerns, and allow multiple points of failure during parsing
   - Move conversion from `ChatMessage` to `openai.types.ChatCompletionMessageParam` to `_get_chat_completion_args`
   - Move token usage and cost tracking boilerplate code to `_create_chat_completion`
   - Move tool call conversion/parsing to `_parse_assistant_tool_calls` (new)

* fix(agent/core): Handle decoding of function call arguments in `create_chat_completion`
   - Amend `model_providers.schema`: change type of `arguments` from `str` to `dict[str, Any]` on `AssistantFunctionCall` and `AssistantFunctionCallDict`
   - Implement robust and transparent parsing in `OpenAIProvider._parse_assistant_tool_calls`
   - Remove now unnecessary `json_loads` calls throughout codebase

* feat(agent/utils): Improve conditions and errors in `json_loads`
   - Include all decoding errors when raising a ValueError on decode failure
   - Use errors returned by `return_errors` instead of an error buffer
   - Fix check for decode failure
2024-04-16 10:38:49 +02:00
Reinier van der Leer d7f00a996f
feat(agent): Improve feedback in `create_chat_completion` parse-fix mechanism
Include error type in feedback message
2024-04-12 20:13:15 +02:00
Reinier van der Leer cf033504c2
refactor(agent/utils): Clean up `JSONSchema.validate_object` signature & docstring 2024-04-12 20:11:20 +02:00
Krzysztof Czerwinski e866a4ba04
fix(agent): Make `Agent.save_state` behave like save as (#7025)
* Make `Agent.save_state` behave like "save as"
   - Leave previously saved state untouched
   - Save agent state in new folder corresponding to new `agent_id`
   - Copy over workspace contents to new folder

* Add `copy` method to `FileStorage`

---------

Co-authored-by: Reinier van der Leer <pwuts@agpt.co>
2024-04-12 12:41:02 +02:00
Reinier van der Leer 90f3c5e2d9
fix(ci): Disable annoying "PR too big" auto-message 2024-04-10 17:49:31 +02:00
Krzysztof Czerwinski fb8ed0b46b
fix(agent, forge): Conform web_search.py to duckduckgo_search v5 (#7046)
Update web_search command for both autogpt and forge to adjust for breaking change in v5 of duckduckgo_search,
update duckduckgo_search to ^5.0.0

---------

Co-authored-by: Nicholas Tindle <nicholas.tindle@agpt.co>
2024-03-25 21:10:13 +01:00
Krzysztof Czerwinski 12640f7092
fix(agent, forge): Conform `web_search.py` to `duckduckgo_search` v5 (#7045)
Update `web_search` command for both autogpt and forge to adjust for breaking change in v5 of `duckduckgo_search`
2024-03-25 19:50:26 +01:00
Reinier van der Leer 5f9cc585b1
fix(agent): Fix type issue in test_s3_file_storage.py 2024-03-22 17:09:31 +01:00
Krzysztof Czerwinski 262771a69c
fix(agent): Fix check when loading an existing agent (#7026)
Now the check also ensures the chosen agent number is within proper range
2024-03-22 14:55:49 +01:00
Matheus Oliveira a1ffe15142
security(agent): Replace unsafe `pyyaml` loader with `SafeLoader` (#7035)
Co-authored-by: pixeebot[bot] <104101892+pixeebot[bot]@users.noreply.github.com>
2024-03-22 14:45:07 +01:00
Reinier van der Leer 30bc761391
ci(agent): Add macOS on M1 to AutoGPT CI matrix (#7041)
Use a `macos-14` runner to cover macOS on M1/arm64

- Add `macos-arm64` to `platform-os` matrix, and map it to `macos-14` runner
2024-03-22 14:26:16 +01:00
Reinier van der Leer 2a0e087461
ci(agent): Disable Python dependency caching on Windows
On Windows, unpacking cached dependencies takes longer than just installing them with `poetry install`. :')
2024-03-22 14:15:43 +01:00
Reinier van der Leer 828b81e5ef
ci(agent): Fix Python dependency caching on macOS 2024-03-22 14:13:22 +01:00
Reinier van der Leer fe3f835b3e
fix(cli): Add timeout to `agent start` command
- Add `timeout` parameter (default 30) to `wait_until_conn_ready(..)` function
- Apply `isort` and `black` formatting
2024-03-22 13:25:23 +01:00
Reinier van der Leer 6dd76afad5
test(agent): Fix VCRpy request header filter for cross-platform cassette reuse (#7040)
- Move filtering logic from tests/vcr/__init__.py to tests/vcr/vcr_filter.py
- Ignore all `X-Stainless-*` headers for cassette matching, e.g. `X-Stainless-OS` and `X-Stainless-Runtime-Version`
- Remove deprecated OpenAI proxy logic
- Reorder methods in vcr_filter.py for readability
2024-03-22 13:08:15 +01:00
Reinier van der Leer 20041d65bf
ci(agent): Fix Docker CI for PR runs from forks (vol. 2)
- Fix docker image tag format error when `secrets.DOCKER_USER` is not set
2024-03-22 12:57:29 +01:00
Krzysztof Czerwinski 028d2c319f
feat(autogpt): Handle OpenAI API key exceptions gracefully (#6992)
* Better handle no API keys or invalid ones
* Handle exception and exit when invalid key is provided
* Handle any APIError exception when trying to get OpenAI models and exit

---------

Co-authored-by: Reinier van der Leer <pwuts@agpt.co>
2024-03-22 12:55:40 +01:00
Reinier van der Leer 9e39937072
ci(agent): Fix Docker CI for PR runs from forks
- Disable 'Log in to Docker hub' step for `pull_request` runs
2024-03-22 12:50:58 +01:00
Reinier van der Leer 07a3c1848c
test(agent): Update VCRpy cassettes
Add new entries for `test_dalle`
2024-03-22 11:24:29 +01:00
Reinier van der Leer dde0c70a81
ci(agent): Matrix CI tests across Linux, macOS and Windows (#7029)
* Matrix the AutoGPT Python CI's `test` job across Ubuntu, macOS and Windows

   - Set up MinIO in a step rather than specifying it under `jobs[test].services`, because services are only supported on Linux runners

   - Add Windows version of step to install Poetry

   - Add macOS compatibility patches to 'Install Poetry (Unix)' and `setup_git_auth` steps
  
   **Caveats:**
   - **No Docker on macOS or Windows**
      * Windows comes with Docker but only supports running Windows containers, while we're mainly interested in using Linux containers for code execution and/or running auxiliary services.
      * [The macOS runner doesn't come with Docker](https://github.com/actions/runner-images/issues/17). Setting it up is possible but takes ~3-4 minutes, and the performance of the Colima engine is poor: a `docker pull` that takes 2 seconds on Linux takes 45 seconds on macOS.

   - **No S3 service available on Windows**
   It seems that running a background process [isn't possible on Windows](https://github.com/actions/runner/issues/598#issuecomment-2011890429), and neither is running Linux-based Docker containers.

* Add `autogpt-agent` and OS-specific flags to Codecov upload step

* Improve caching of Python dependencies in CI by changing the cache key
   - Include hash of `poetry.lock` instead of `pyproject.toml` in key
   - Remove date component from key; it was included to avoid getting stuck to old cached versions of packages when we were still using `requirements.txt`. With `poetry.lock` that is no longer a concern.

* Fix skip check in test_s3_file_storage.py
2024-03-21 21:15:46 +01:00
Krzysztof Czerwinski 76d6e61941
feat(agent): Implement more fault tolerant `json_loads` function (#7016)
* Implement syntax fault tolerant `json_loads` function using `dem3json`
   - Add `dem3json` dependency

* Replace `json.loads` by `json_loads` in places where malformed JSON may occur

* Move `json_utils.py` to `autogpt/core/utils`

* Add tests for `json_utils`

---------

Co-authored-by: Reinier van der Leer <pwuts@agpt.co>
2024-03-21 18:11:36 +01:00
Reinier van der Leer bca50310f6
fix(agent): Add check for Linux container support to `is_docker_available` 2024-03-20 21:46:09 +01:00
Reinier van der Leer 632686cfa5
fix(agent): Replace `PromptToolkit` with `click.prompt`
- Replace `session.prompt_async(..)` with `click.prompt(..)` in `clean_input` (autogpt/app/utils.py)
- Convert `clean_input` back to a synchronous function (and amend its usages accordingly)
- Remove `prompt-toolkit` dependency

This mitigates issues crashes in some shell environments on Windows.
2024-03-20 17:51:10 +01:00
Reinier van der Leer 1262b72f5c
feat(agent): Allow boolean values for `available` param on `@command` 2024-03-20 17:24:11 +01:00
Reinier van der Leer e985f7c105
test(agent): Add skip statements to test_execute_code.py for when Docker is not available 2024-03-20 17:23:14 +01:00
Reinier van der Leer 596487b9ad
fix(agent): Windows-proof file_operations
Make file_operations and test_file_operations behave more consistently between Unix and Windows
2024-03-20 17:13:47 +01:00
Reinier van der Leer a7c0440e9b
fix(agent): Fix and windows-proof `scan_plugins`
- Improve error output for failure to load plugin
- Fix logic to determine qualified module name
- Use `importlib` rather than `__import__` magic function

This unbreaks `scan_plugins` on Windows.
2024-03-20 17:10:03 +01:00
Reinier van der Leer 03ffb50dcf
ci(docs): Fix Netlify build ignore check 2024-03-20 11:49:41 +01:00
Krzysztof Czerwinski e201f57861
feat(autogpt/cli): Display info if code execution is enabled (#6997)
Display if code execution is enabled or not on CLI startup, depending if Docker is available.
2024-03-18 20:09:56 +01:00
Krzysztof Czerwinski fea62a77bc
feat(autogpt/cli): Check if port is available before running server (#6996) 2024-03-16 12:10:43 +01:00
Sukka dfad535dea
fix(docs): Replace `polyfill.io` by Cloudflare mirror (#6952) 2024-03-15 13:01:30 +01:00