Commit Graph

334 Commits (remove-git-from-cli)

Author SHA1 Message Date
Reinier van der Leer 250552cb3d
fix(agent/tests): Update test_config.py:test_initial_values 2024-02-12 13:26:47 +01:00
Reinier van der Leer 1d653973e9
feat(agent/llm): Use new OpenAI models as default `SMART_LLM`, `FAST_LLM`, and `EMBEDDING_MODEL`
- Change default `SMART_LLM` from `gpt-4` to `gpt-4-turbo-preview`
- Change default `FAST_LLM` from `gpt-3.5-turbo-16k` to `gpt-3.5-turbo-0125`
- Change default `EMBEDDING_MODEL` from `text-embedding-ada-002` to `text-embedding-3-small`
- Update .env.template, azure.yaml.template, and documentation accordingly
2024-02-12 13:19:37 +01:00
Reinier van der Leer 7bf9ba5502
chore(agent/llm): Update OpenAI model info
- Add `text-embedding-3-small` and `text-embedding-3-large` as `EMBEDDING_v3_S` and `EMBEDDING_v3_L` respectively
- Add `gpt-3.5-turbo-0125` as `GPT3_v4`
- Add `gpt-4-1106-vision-preview` as `GPT4_v3_VISION`
- Add GPT-4V models to info map
- Change chat model info mapping to derive info for aliases (e.g. `gpt-3.5-turbo`) from specific versions instead of the other way around
2024-02-12 13:17:20 +01:00
Reinier van der Leer 39fddb1214
fix(agent): Fix application of `extra_request_headers` in `OpenAIProvider` 2024-02-12 12:21:30 +01:00
Reinier van der Leer fe0923ba6c
feat(agent/web): Add browser extensions to deal with cookie walls and ads (#6778)
* Add `_sideload_chrome_extensions` subroutine to `open_page_in_browser` in web_selenium.py
   * Sideloads uBlock Origin and I Still Don't Care About Cookies, downloading them if necessary
* Add 2-second delay to `open_page_in_browser` to allow time for handling cookie walls
2024-02-02 18:30:37 +01:00
Reinier van der Leer dfaeda7cd5
lint(agent/tests): Fix line length in test_utils.py 2024-02-02 18:29:28 +01:00
Reinier van der Leer 9b7fee673e
fix(agent/tests): Update `test_utils.py:test_extract_json_from_response*` in accordance with 956cdc7
Commit 956cdc7 "fix(agent/json_utils): Decode as JSON rather than Python objects" broke these unit tests because they generated "JSON" by stringifying a Python object.
2024-02-02 18:21:19 +01:00
Reinier van der Leer 925269d17b
lint(agent): Fix line length in docstring of `EpisodicActionHistory.handle_compression` 2024-02-02 17:43:42 +01:00
Reinier van der Leer 66e0c87894
feat(agent): Add history compression to increase longevity and efficiency
* Compress steps in the prompt to reduce token usage, and to increase longevity when using models with limited context windows
* Move multiple copies of step formatting code to `Episode.format` method
* Add `EpisodicActionHistory.handle_compression` method to handle compression of new steps
2024-01-31 17:51:45 +01:00
Reinier van der Leer 55433f468a
feat(agent/web): Improve `read_webpage` information extraction abilities
* Implement `extract_information` function in `autogpt.processing.text` module. This function extracts pieces of information from a body of text based on a list of topics of interest.
* Add `topics_of_interest` and `get_raw_content` parameters to `read_webpage` commmand
   * Limit maximum content length if `get_raw_content=true` is specified
2024-01-31 15:08:08 +01:00
Reinier van der Leer 956cdc77fa
fix(agent/json_utils): Decode as JSON rather than Python objects
* Replace `ast.literal_eval` with `json.loads` in `extract_dict_from_response`

This fixes a bug where boolean values could not be decoded because of their required capitalization in Python.
2024-01-31 14:15:02 +01:00
Reinier van der Leer 83a0b03523
fix(agent/prompting): Fix representation of (optional) command parameters in prompt 2024-01-31 14:10:22 +01:00
Reinier van der Leer 25b9e290a5
fix(agent/json_utils): Make `extract_dict_from_response` more robust
* Accommodate for both ```json and ```JSON blocks in responses
2024-01-29 15:03:09 +01:00
Reinier van der Leer ab860981d8
feat(agent/llm): Add support for `gpt-4-0125-preview`
* Add `gpt-4-0125-preview` model to OpenAI model list
* Add `gpt-4-turbo-preview` alias to OpenAI model list
2024-01-29 11:22:32 +01:00
Reinier van der Leer fc37ffdfcf
feat(agent/llm/openai): Include compatibility tool call extraction in LLM response parse-fix loop 2024-01-19 19:23:17 +01:00
Reinier van der Leer 8c65f3c748
fix(agent/serve): Fix task cost tracking persistence in `AgentProtocolServer`
- Pydantic shallow-copies models when they are passed into a parent model, meaning they can't be updated through the original reference. This commit adds a fix for the resulting cost persistence issue.
2024-01-19 19:20:05 +01:00
Reinier van der Leer 354106be7b
feat(agent/llm): Add cost tracking and logging to `AgentProtocolServer` 2024-01-19 17:31:59 +01:00
Reinier van der Leer faf5f9e5a4
fix(agent): Fix `extract_dict_from_response` flakiness
- The `extract_dict_from_response` function, which is supposed to reliably extract a JSON object from an LLM's response, positively discriminated objects defined on a single line, causing issues.
2024-01-19 15:49:32 +01:00
Reinier van der Leer e4687e0f03
fix(agent): Fix "ChatModelResponse not subscriptable" errors in `summarize_text` and `QueryLanguageModel` ability
- `summarize_text` and `QueryLanguageModel.__call__` still tried to access `response["content"]`, which isn't possible since upgrading to the OpenAI v1 client library.
2024-01-19 15:45:31 +01:00
Reinier van der Leer c5b17851e0
fix(agent): Handle artifact modification properly
- When an Artifact's file is modified by the agent, set its `agent_created` attribute to `True` instead of registering a new Artifact
- Update the `autogpt-forge` dependency to the newest version, in which `AgentDB.update_artifact` has been implemented
2024-01-19 12:08:59 +01:00
Reinier van der Leer f2595af362
refactor(agent/openai): Upgrade OpenAI library to v1
- Update `openai` dependency from ^v0.27.10 to ^v1.7.2
- Update poetry.lock
- Update code for changed endpoints and new output types of OpenAI library
- Replace uses of `AssistantChatMessageDict` by `AssistantChatMessage`
   - Update `PromptStrategy`, `BaseAgent`, and all of their subclasses accordingly
- Update `OpenAIProvider`, `OpenAICredentials`, azure.yaml.template, .env.template and test_config.py to work with new separate `AzureOpenAI` client
- Remove `_OpenAIRetryHandler` and implement retry mechanism with `tenacity`
- Rewrite pytest fixture `cached_openai_client` (renamed from `patched_api_requestor`) for OpenAI v1 library
2024-01-17 20:11:13 +01:00
Reinier van der Leer 797c5bbc13
fix(agent/workspace): Fix GCS workspace binary file upload 2024-01-16 14:20:54 +01:00
Nicholas Tindle 97023b9a3c
feat(agent/server): Make port configurable, add documentation for Agent Protocol DB and port config (#6569)
* docs: Add documentation on how to use Agent Protocol in the template

- Added documentation on how to use Agent Protocol and its settings in the `.env.template` file.
- An explanation is provided for the `AP_SERVER_PORT` and `AP_SERVER_DB_URL` settings.
- This change aims to improve the understanding and usage of Agent Protocol in the project.

* docs: Update usage.md with information about configuring the API port

- Update the documentation for the `serve` mode in `usage.md`
- Add information about configuring the port for the API server using the `AP_SERVER_PORT` environment variable.

---------

Co-authored-by: Reinier van der Leer <pwuts@agpt.co>
2024-01-12 14:41:43 +01:00
Reinier van der Leer 45c8476e67
fix(agent/release): Add gitpython as a direct dependency
gitpython was installed as an indirect dependency via agbenchmark. The release builds don't contain agbenchmark and thus also lack the gitpython package, which breaks the image.
2023-12-14 16:13:55 +01:00
Reinier van der Leer 21d4ce8d4b
fix(agent/release): Move auto-gpt-plugin-template to regular dependencies
- Move `auto-gpt-plugin-template` from dev dependencies to regular dependencies in `pyproject.toml`.
- Fixes #6566 - No module named 'auto_gpt_plugin_template'.
2023-12-14 13:31:57 +01:00
Reinier van der Leer efb5fed462
feat(agent/logging): Log warning when action raises error
- Add logging to capture errors raised during execution of actions in the Agent
- Move `fmt_kwargs` function from `agent_protocol_server.py` to `logs/utils.py`
2023-12-14 02:38:48 +01:00
Reinier van der Leer 167fea3f1e
test: Speed up test_gcs_file_workspace
- Change the GCS workspace fixture to module level so it is only built and torn down once. This saves 30-40s on a test run.
2023-12-14 02:31:05 +01:00
Reinier van der Leer 5107c6bbb9
lint: Remove unused `os` import in file_operations_utils.py 2023-12-14 02:27:40 +01:00
Reinier van der Leer e428130e4a
fix(agent/file_operations): Fix read_file command in GCS and S3 workspaces
- Update the `read_file` function in `file_operations.py` to pass the file's extension to the `decode_textual_file` function.
- Modify the `decode_textual_file` function in `file_operations_utils.py` to accept the file extension as an argument.
- Update the `content` property in the `FileContextItem` class in `context_item.py` to pass the file's extension to the `decode_textual_file` function.
- Update the `test_parsers` function in `test_text_file_parsers.py` to pass the file extension to the `decode_textual_file` function.
2023-12-14 02:07:22 +01:00
Reinier van der Leer 5978031f7a
lint: Remove unused import in autogpt/core/utils/json_schema.py 2023-12-13 22:53:27 +01:00
Reinier van der Leer 0e94c7b5fc
fix(agent/tty): Fix `finish` command in TTY mode
- Prevent the Agent from treating `AgentTerminated` like it would any other exception raised by a command.
- The agent should raise AgentTerminated exception to exit the loop.
2023-12-13 22:50:02 +01:00
Reinier van der Leer acf4df9f87
fix: Implement self-correction for invalid LLM responses
- Fix the parsing of invalid LLM responses by appending an error message to the prompt and allowing the LLM to fix its mistakes.
- Update the `OpenAIProvider` to handle the self-correction process and limit the number of attempts to fix parsing errors.
- Update the `BaseAgent` to profit from the new pasing and parse-fixing mechanism.

This change ensures that the system can handle and recover from errors in parsing LLM responses.

Hopefully this fixes #1407 once and for all.
2023-12-13 22:48:07 +01:00
Reinier van der Leer 6b0d0d4dc8
ci: Reset cassettes for test_dalle 2023-12-13 22:06:00 +01:00
Reinier van der Leer d41963d5fa
chore: Bump version to 0.5.0 and update bulletin
- Updated the quick links and user guide URLs in the bulletin
- Released v0.5.0 with cloud-readiness, a new UI, support for the newest Agent Protocol version, and other improvements

See the release notes on Github for more details: https://github.com/Significant-Gravitas/AutoGPT/releases
2023-12-13 19:55:08 +01:00
Reinier van der Leer 9e9142aa8e
refactor(agent): Reduce log spam in Agent Protocol mode
- Removed unnecessary print_attribute calls in configurators.py and configurator.py files
- Consolidated printing of configuration attributes in main.py for improved readability and reduced log spam in Agent Protocol mode
2023-12-13 19:47:46 +01:00
Reinier van der Leer bdc4c38d04
chore(agent): Update dependencies
- Update dependencies
- Remove `markdown` dependency after it became unused in d95e3b5b
2023-12-13 18:31:17 +01:00
Reinier van der Leer 967338193e
fix(agent/file_workspace): Fix workspace initialization and listing behavior in GCS and S3 file workspaces
- Update GCSFileWorkspace.initialize() to handle cases where the bucket doesn't exist and create it if necessary
- Add logging to S3FileWorkspace.initialize() and GCSFileWorkspace.initialize()
- Update GCSFileWorkspace.list() and S3FileWorkspace.list() to correctly handle nested paths and return the relative paths of files
- Fix tests for GCSFileWorkspace and S3FileWorkspace to account for the changes in initialization and listing behavior
- Fix S3FileWorkspace.open_file() to correctly switch between binary and text mode
- Added tests to verify the fixes in workspace initialization and listing behavior
2023-12-13 18:07:25 +01:00
Reinier van der Leer d820239a7c
chore(autogpt): Update duckduckgo-search to v4.0.0
- Fixes #6553 (`web_search` command not working)
- v3.x.x of the duckduckgo-search library no longer works, so updating to v4.0.0 unbreaks the `web_search` command
2023-12-13 15:52:33 +01:00
Nicholas Tindle b33f4cca6b
Add dependencies required to use PostgreSQL (#6558)
feat: Add dependencies required to use PostgreSQL

- Added psycopg2-binary version 2.9.9 to the dependencies in pyproject.toml
- Updated the poetry.lock file with the new package information
2023-12-12 19:06:50 -06:00
Reinier van der Leer d95e3b5b54
refactor(agent/file_operations): Refactor file opening/reading and parsing
- Update the signature of `FileWorkspace.open_file` and fix implementations in every workspace backend
- Replace `open()` with `workspace.open_file` in the `read_file` command to use the workspace's file opening functionality
- Fix the parametrization of the `test_text_file_parsers` test to correctly test text file parsers
2023-12-12 17:41:55 +01:00
Reinier van der Leer 198a0ecad6
fix(agent/file_operations): Fix path processing in file_operations.py and across workspace backend implementations
- Adjusted path processing and use of `agent.workspace` in the file_operations.py module to prevent double path resolution.
- Updated the `is_duplicate_operation` and `log_operation` functions in file_operations.py to use the `make_relative` argument of the `sanitize_path_arg` decorator.
- Refactored the `write_to_file`, `list_folder`, and `list_files` functions in file_operations.py to accept both string and Path objects as the path argument.
- Modified the GCSFileWorkspace and S3FileWorkspace classes in the file_workspace module to ensure that the root path is always an absolute path.

This commit addresses issues with path processing in the file_operations.py module and across different workspace backend implementations. The changes ensure that relative paths are correctly converted to absolute paths where necessary and that the file operations logic functions consistently handle path arguments as strings or Path objects. Additionally, the GCSFileWorkspace and S3FileWorkspace classes now enforce that the root path is always an absolute path.
2023-12-12 15:29:25 +01:00
Reinier van der Leer 3e19da1258
refactor: Remove X- prefix from API request headers
- Remove X- prefix from X-AutoGPT-UserID, X-AP-TaskID, and X-AP-StepID headers
- Refactor literal references to "ask_user" to `ask_user.__name__` in AgentProtocolServer
2023-12-12 10:52:18 +01:00
Reinier van der Leer f3faa47814
build: Reduce AutoGPT Docker image size
- Removed firefox-esr package to reduce image size
- Added --no-cache flag to poetry install steps
- Removed source code files after installation to reduce image size
2023-12-08 15:43:36 +01:00
Reinier van der Leer 2d4e16d5e1
fix(agent): Fix type issues with agent ID and apply_overrides_to_ai_settings
- Fix type annotation for `agent_id` in `BaseAgentSettings` class
- Add assertion to ensure `agent_id` is not an empty string in `AgentManager.get_agent_dir()` method
- Change type of `override_name` and `override_role` to be optional in `apply_overrides_to_ai_settings()` function
2023-12-08 14:13:59 +01:00
Reinier van der Leer fadfea2046
feat(agent/serve): Add StepID header to outgoing LLM requests
- Update `AgentProtocolServer` to include `X-AP-StepID` header in outgoing LLM requests.
2023-12-08 13:54:31 +01:00
Reinier van der Leer 6b19b78f87
feat(agent/serve): Add TaskID and UserID headers to outgoing LLM requests
- Update `AgentProtocolServer` to include `X-AP-TaskID` and `X-AutoGPT-UserID` headers in outgoing requests for Agent Protocol tasks.
- Modify `ModelProvider` and `OpenAIProvider` to allow configuring extra headers to be added to all outgoing requests.
- Fix the type of the `task_id` parameter in `AgentProtocolServer.get_task`
2023-12-08 13:41:37 +01:00
Reinier van der Leer a17f752705
fix(agent): Fix artifact download method & response
- Update the return type of the `AgentProtocolServer.get_artifact` method to `StreamingResponse`.
- Fix the Content-Disposition header in the response to include quotes around the filename.
2023-12-08 12:36:51 +01:00
Reinier van der Leer 05321c9dce
chore(agent): Update forge dependency 2023-12-08 12:17:56 +01:00
Reinier van der Leer 55fee0471f
fix(agent): Fix setup script
- Remove `poetry install` that caused uninstall+reinstall of benchmark packages on every run
2023-12-08 12:10:07 +01:00
Reinier van der Leer e2f760aef4
chore: Update forge dependency
- Update forge.sdk.schema import to forge.sdk.model in agent_protocol_server.py
- Update poetry.lock with new forge dependency reference
2023-12-08 01:06:06 +01:00
Reinier van der Leer 8985b7b01b
fix(agent/serve): Fix artifact creation
- Link agent-created artifacts to the corresponding step
- Mark agent-created artifacts as such
2023-12-07 16:24:14 +01:00
Reinier van der Leer 1f40d72081
feat(agent/workspace): Add GCS and S3 FileWorkspace providers (#6485)
* refactor: Rename FileWorkspace to LocalFileWorkspace and create FileWorkspace abstract class
  - Rename `FileWorkspace` to `LocalFileWorkspace` to provide a more descriptive name for the class that represents a file workspace that works with local files.
  - Create a new base class `FileWorkspace` to serve as the parent class for `LocalFileWorkspace`. This allows for easier extension and customization of file workspaces in the future.
  - Update import statements and references to `FileWorkspace` throughout the codebase to use the new naming conventions.

* feat: Add S3FileWorkspace + tests + test setups for CI and Docker
  - Added S3FileWorkspace class to provide an interface for interacting with a file workspace and storing files in an S3 bucket.
  - Updated pyproject.toml to include dependencies for boto3 and boto3-stubs.
  - Implemented unit tests for S3FileWorkspace.
  - Added MinIO service to Docker CI to allow testing S3 features in CI.
  - Added autogpt-test service config to docker-compose.yml for local testing with MinIO.

* ci(docker): tee test output instead of capturing

* fix: Improve error handling in S3FileWorkspace.initialize()
  - Do not tolerate all `botocore.exceptions.ClientError`s
  - Raise the exception anyways if the error is not "NoSuchBucket"

* feat: Add S3 workspace backend support and S3Credentials
  - Added support for S3 workspace backend in the Autogpt configuration
  - Added a new sub-config `S3Credentials` to store S3 credentials
  - Modified the `.env.template` file to include variables related to S3 credentials
  - Added a new `s3_credentials` attribute on the `Config` class to store S3 credentials
  - Moved the `unmasked` method from `ModelProviderCredentials` to the parent `ProviderCredentials` class to handle unmasking for S3 credentials

* fix(agent/tests): Fix S3FileWorkspace initialization in test_s3_file_workspace.py
  - Update the S3FileWorkspace initialization in the test_s3_file_workspace.py file to include the required S3 Credentials.

* refactor: Remove S3Credentials and add get_workspace function
  - Remove `S3Credentials` as boto3 will fetch the config from the environment by itself
  - Add `get_workspace` function in `autogpt.file_workspace` module
  - Update `.env.template` and tests to reflect the changes

* feat(agent/workspace): Make agent workspace backend configurable
  - Modified `autogpt.file_workspace.get_workspace` function to either take a workspace `id` or `root_path`.
  - Modified `FileWorkspaceMixin` to use the `get_workspace` function to set up the workspace.
  - Updated the type hints and imports accordingly.

* feat(agent/workspace): Add GCSFileWorkspace for Google Cloud Storage
  - Added support for Google Cloud Storage as a storage backend option in the workspace.
  - Created the `GCSFileWorkspace` class to interface with a file workspace stored in a Google Cloud Storage bucket.
  - Implemented the `GCSFileWorkspaceConfiguration` class to handle the configuration for Google Cloud Storage workspaces.
  - Updated the `get_workspace` function to include the option to use Google Cloud Storage as a workspace backend.
  - Added unit tests for the new `GCSFileWorkspace` class.

* fix: Unbreak use of non-local workspaces in AgentProtocolServer
  - Modify the `_get_task_agent_file_workspace` method to handle both local and non-local workspaces correctly
2023-12-07 14:46:08 +01:00
Reinier van der Leer c47f81a3e0
chore: Replace deprecated PyPDF2 with pypdf
- Replace deprecated PyPDF2 with successor pypdf to get rid of deprecation warnings and keep receiving updates.
2023-12-05 18:41:52 +01:00
Reinier van der Leer ffeb45eda3
refactor: Replace deprecated logger.warn calls with logger.warning
- Replaced all instances of logger.warn with logger.warning to get rid of deprecation warnings.
2023-12-05 18:41:12 +01:00
Auto-GPT-Bot a38ddc395b Update cassette submodule 2023-12-05 15:30:16 +00:00
Reinier van der Leer 7b05245286
refactor(agent/config): Modularize `Config` and revive Azure support (#6497)
* feat: Refactor config loading and initialization to be modular and decentralized

   - Refactored the `ConfigBuilder` class to support modular loading and initialization of the configuration from environment variables.
   - Implemented recursive loading and initialization of nested config objects.
   - Introduced the `SystemConfiguration` base class to provide common functionality for all system settings.
   - Added the `from_env` attribute to the `UserConfigurable` decorator to provide environment variable mappings.
   - Updated the `Config` class and its related classes to inherit from `SystemConfiguration` and use the `UserConfigurable` decorator.
   - Updated `LoggingConfig` and `TTSConfig` to use the `UserConfigurable` decorator for their fields.
   - Modified the implementation of the `build_config_from_env` method in `ConfigBuilder` to utilize the new modular and recursive loading and initialization logic.
   - Updated applicable test cases to reflect the changes in the config loading and initialization logic.

   This refactor improves the flexibility and maintainability of the configuration loading process by introducing modular and recursive behavior, allowing for easier extension and customization through environment variables.

* refactor: Move OpenAI credentials into `OpenAICredentials` sub-config

   - Move OpenAI API key and other OpenAI credentials from the global config to a new sub-config called OpenAICredentials.
   - Update the necessary code to use the new OpenAICredentials sub-config instead of the global config when accessing OpenAI credentials.
   - (Hopefully) unbreak Azure support.
      - Update azure.yaml.template.
   - Enable validation of assignment operations on SystemConfiguration and SystemSettings objects.

* feat: Update AutoGPT configuration options and setup instructions

   - Added new configuration options for logging and OpenAI usage to .env.template
   - Removed deprecated configuration options in config/config.py
   - Updated setup instructions in Docker and general setup documentation to include information on using Azure's OpenAI services

* fix: Fix image generation with Dall-E

   - Fix issue with image generation with Dall-E API

Additional user context: This commit fixes an issue with image generation using the Dall-E API. The code now correctly retrieves the API key from the agent's legacy configuration.

* refactor(agent/core): Refactor `autogpt.core.configuration.schema` and update docstrings

   - Refactor the `schema.py` file in the `autogpt.core.configuration` module.
   - Added docstring to `SystemConfiguration.from_env()`
   - Updated docstrings for functions `_get_user_config_values`, `_get_non_default_user_config_values`, `_recursive_init_model`, `_recurse_user_config_fields`, and `_recurse_user_config_values`.
2023-12-05 16:28:23 +01:00
Reinier van der Leer 03eb921ca6
Roll back cassette updates 2023-12-05 16:25:36 +01:00
Reinier van der Leer 47dc5ad220
fix(test): Fix test that was being skipped because of missing async marker
- Fix a test case in test_web_selenium.py that was failing due to a missing `pytest.mark.asyncio`
2023-12-05 15:34:57 +01:00
Reinier van der Leer b73fa47089
fix: Exclude Cookie header from VCR matching
- Exclude Cookie header from VCR matching to prevent cache misses caused by CloudFlare cookies.
2023-12-05 15:33:47 +01:00
Reinier van der Leer 775a27eea0
refactor: Modify instruction in prompt for increased JSON output reliability
- Update the instruction in the prompt strategy to ensure the response is pure JSON.
- Remove unnecessary text and make the instruction clearer.
- Also update the error logging to include the received JSON content.

This commit refactors the code in the `one_shot.py` file and the `utilities.py` file.
2023-12-05 15:21:04 +01:00
Auto-GPT-Bot b1419e856c Update cassette submodule 2023-12-02 14:41:59 +00:00
Reinier van der Leer 760e0a0816
fix: Fix agent poetry env usage in pre-commit hook
- Update the pytest command in the .pre-commit-config.yaml file to use Poetry run instead of directly running pytest in the autogpts/autogpt directory.
2023-12-02 15:39:22 +01:00
Reinier van der Leer ef35702c4b
refactor: Reduce breakage in vector memory module and split MemoryItem class
- Refactored the `MemoryItem` class in the `autogpt.memory.vector.memory_item` module to improve code organization and readability.
- Split the `MemoryItem` class into two separate classes: `MemoryItem` and `MemoryItemFactory`.
- Modified the `get_embedding` function in the `autogpt.memory.vector.utils` module to accept an `EmbeddingModelProvider` for creating embeddings.
- Updated the usage of the `get_embedding` function in the `MemoryItem` class to pass the `embedding_provider` parameter.
- Updated the imports in the affected modules.
2023-12-02 15:38:19 +01:00
Reinier van der Leer 6d439f4f63
fix: Fix check for optional dependencies in check_requirements.py
- Modify check_requirements.py to correctly handle optional dependencies
- Skip optional dependencies when iterating through dependence group dependencies in check_requirements.py
2023-12-02 14:20:11 +01:00
Auto-GPT-Bot dedab125e1 Update cassette submodule 2023-12-02 13:18:45 +00:00
Reinier van der Leer 6743636996
fix: Fix poetry env issues with the agent's entrypoint scripts
- Update autogpt.bat to use `poetry install` instead of `%PYTHON_CMD% -m poetry install`
- Update autogpt.sh to use `poetry install` instead of `$PYTHON_CMD -m poetry install`
- Use `poetry run` to execute the `autogpt` command in both scripts
2023-12-02 14:15:18 +01:00
Reinier van der Leer 4bcfe72485
fix: fix VCR submodule reference
- Update the reference to the VCR submodule in the autogpt tests
- Previous reference: 1896d8ac12ff1d27b7e9e5db6549abc38b260b40
- New reference: 9996f1d104a1e4f33c1e10aa664d01ea78db2a06
2023-12-02 13:57:50 +01:00
Reinier van der Leer 2c70059c2d
fix(agent): Fix `setup` and `run` scripts
- Updated the `run` script to also check if `$OPENAI_API_KEY` is empty before copying `.env.example` and prompting the user to set API keys.
- Modified the `setup` script to install `--extras benchmark` separately from the initial `poetry install` command.
- Added `POETRY_INSTALLER_PARALLEL=false` flag to prevent conflicts between `forge` and `agbenchmark` during installation.
2023-12-02 13:48:45 +01:00
Reinier van der Leer 5ca48de07f
fix(agent/tests): Fix code execution tests
- Add unique agent ID to mock agent in `conftest.py`
2023-12-02 13:27:36 +01:00
Reinier van der Leer 38f436aa6d
test: fix test_huggingface_fail_request_with_delay
- Fix failing test_huggingface_fail_request_with_delay by adding mock API key to agent configuration.
2023-12-02 13:15:23 +01:00
Reinier van der Leer ba8f83d09d
fix: Fix get_current_git_branch test
- Use `InvalidGitRepositoryError` instead of generic `Exception` in `test_get_current_git_branch_failure` to accurately simulate a failure scenario.
2023-12-02 07:02:14 +01:00
Reinier van der Leer fc429408a3
fix: Update isort config 2023-12-02 06:54:14 +01:00
Reinier van der Leer e44d70d6d3
fix: Fix pre-commit config for pytest
- Modify the entry command to change directories before running pytest
2023-12-02 06:23:25 +01:00
Reinier van der Leer fe96f6d783
refactor: Disable mypy and autoflake in CI and pre-commit hook
- Commented out the mypy and autoflake checks in the CI workflow and pre-commit config files.
- The intention is to enable the mypy check again later.
2023-12-02 06:11:51 +01:00
Reinier van der Leer c072c7d008
refactor: Move isort and mypy configuration into pyproject.toml
- Deleted .isort.cfg and mypy.ini
- Updated pyproject.toml to include isort and mypy configuration
2023-12-02 06:10:45 +01:00
Reinier van der Leer d938c2595e
refactor(agent): Fix all trivial linting errors
* Fix all but one flake8 linting errors
  * Remove unused imports
  * Wrap strings that are too long
  * Add basic autogpts/autogpt/.flake8
* Delete planning_agent.py
* Delete default_prompts.py
* Delete _test_json_parser.py
* Refactor the example function call in AgentProfileGeneratorConfiguration from a string to an object
* Rewrite/update docstrings here and there while I'm at it
* Minor change to the description of the `open_file` command
* Use `user-agent` from config in web_selenium.py
* Delete hardcoded ABILITIES from core/planning/templates.py
* Delete duplicate and superseded test from test_image_gen.py
* Fix parameter definitions in mock_commands.py
* Delete code analysis blocks from test_spinner.py, test_url_validation.py
2023-12-02 05:42:10 +01:00
Reinier van der Leer 604217a957
fix(agent/docker): Fix venv issue fix for Docker build on Google Cloud 2023-12-01 10:39:43 +01:00
Reinier van der Leer 207201d907
fix: Fix venv issue with Docker build on Google Cloud
See also https://stackoverflow.com/a/70340377
2023-11-30 18:39:42 +01:00
Reinier van der Leer 3ad7a2cfaa
fix: Fix URL validation test
- Modify the test_url_validation_fails_local_path function to remove the specific match parameter and raise the ValueError without any match requirement.
2023-11-30 18:03:32 +01:00
Reinier van der Leer 6c69e16f31
fix: Fix CI failing tests
- Update `test_config.py` to check if `config.smart_llm` starts with "gpt-4"
- Delete `test_retry_provider_openai.py` as it is no longer needed
- Update `test_url_validation.py` to properly test local file URLs
- Update `test_web_search.py` to assert against expected parts of output
2023-11-30 17:56:05 +01:00
Reinier van der Leer 99fe114502
refactor: Make Agent Protocol server DB URL configurable
- Refactor the `run_auto_gpt_server` function to make the Agent Protocol server database URL configurable.
- Use the `os.getenv` method to retrieve the database URL from the environment variable `AP_SERVER_DB_URL`.
2023-11-30 17:26:16 +01:00
Reinier van der Leer ca6e9e5e34
lint: Address linting issues from #5458
- Fixed linting issues in `json_utils/utilities.py` and `test_json_utils.py`
2023-11-30 17:20:42 +01:00
Reinier van der Leer ae1e030824
feat: Implement LoggingConfig and structured logging
- Created a new `LoggingConfig` class to represent the logging configuration in the `Config` class.
- Created a new `LogFormatName` enum to represent the available log formats: 'simple', 'debug', and 'structured_google_cloud'.
- Modified the `configure_logging` function to also accept an unpacked `LoggingConfig` object for arguments.
- Updated the `configure_logging` function to use the appropriate log format based on the log level.
- Added a `StructuredLoggingFormatter` class to handle formatting for structured logs.
- Updated the import statements and usages of `configure_logging` etc. in relevant modules to reflect the changes.
- Updated the `config` fixture in the unit tests to include the new logging configuration attributes.
- Updated the CLI with new parameters for log level and format.
- Reordered the parameters of the CLI.
- Removed memory related parameter from CLI.
2023-11-30 17:12:58 +01:00
Reinier van der Leer c65d6f7ff8
refactor: Remove unused debug argument from plugin setup helpers
- Remove the unused debug argument from the functions `inspect_zip_for_modules`, `initialize_openai_plugins`, `instantiate_openai_plugin_clients`, and `scan_plugins`.
- The debug argument was not being used in these functions and was unnecessary.
2023-11-30 16:17:31 +01:00
Reinier van der Leer 809173c3f5
docs: Update AutoGPT workspace location and other minor fixes
- Update the `RESTRICT_TO_WORKSPACE` variable in `.env.template` to use the new workspace location
- Update the `.gitignore` files to remove the old workspace directory
- Update the `voice.md` file in the documentation to reflect the new command for speech mode
2023-11-25 16:21:27 +01:00
Reinier van der Leer 6ed833368a
chore: Delete broken and deprecated data ingestion script 2023-11-25 15:36:47 +01:00
Reinier van der Leer 1ce82372fd
refactor: Rename Agent's entrypoint to autogpt.sh
- Renamed `run.sh` to `autogpt.sh` for consistent naming and easier command usage.
- Updated relevant documentation to reflect the new entrypoint name.
2023-11-24 18:59:21 +01:00
Reinier van der Leer aaee6d2cbb
fix: Adjust Docker setup and update documentation
- Adjusted the Docker setup for AutoGPT to expose the full CLI and allow access to the Agent Protocol Server's port.
- Updated the AutoGPT+Docker guide in the documentation to reflect the changes.

Changes made:
- In the `Dockerfile`, removed the `--install-plugin-deps` option from the `ENTRYPOINT` command.
- In the `docker-compose.yml` file, added the `ports` section to expose port `8000`.
- In the `pyproject.toml` file, changed the `run` script to `autogpt.app.cli:cli`.
- In the `docker.md` file, added instructions for the new Docker setup and updated the configuration steps.
2023-11-24 18:50:42 +01:00
Balázs Varga 155718aa69
fix(docker build): Changed agbenchmark dependency to git reference (#6274)
* Fix docker build.
  Changing agbenchmark dependency as git reference instead of folder reference.
2023-11-24 17:26:06 +01:00
Reinier van der Leer 24008e8741
docs: Streamline documentation for getting started (#6335)
* README.md
  - Mark evo.ninja as hackathon winner and new Current Best Agent.
  - Remove hackathon banner.
  - Rewrite sections about Forge, Benchmark, UI, Agent Protocol.
  - Add sections about Leaderboard and CLI.
  - Add quick links for improved user navigation, including links to documentation, contributing guidelines, and quickstart guide.
  - Remove Quickstart.

* docs.agpt.co
  - Removed links to outdated pages from navbar.
  - Added quick links to several pages.
  - Refactored and updated titles in docs site navbar for better readability and consistency.
  - Rewrite intros on homepage to be more clear and professional and less cringe-worthy.
  - Fix broken links.
  - Rewrote setup and usage guides for AutoGPT Agent.
    - Removed mentions of Azure support, except in the Docker guide.
  - Added page with general information about AutoGPT.

* CONTRIBUTING.md
  - Make CONTRIBUTING.md more friendly and accessible: added link to public kanban board, encouraged collaboration, removed section about net-negative PRs.

* autogpt/README.md
  - Update description of AutoGPT to mention "modern Large Language Models" instead of GPT-4.
  - Add quick links for improved user navigation, including links to documentation and contributing guidelines.
  - Add features and setup guide: Agent Protocol, UI features, setup instructions, configuration options, Quickstart, CLI instructions, Agent Protocol server instructions, additional resources (wiki, project board, roadmap), and a note on sustainable development.
  - Update links: documentation, setup instructions.
  - Remove outdated Twitter accounts section.
2023-11-23 14:59:17 +01:00
Reinier van der Leer 84afbf6b45
fix: Update URL validation to allow non-local domains
- Modify the check_local_file_access function to only check for local file prefixes and return True if the URL starts with any of them.
- Remove the section of code that parsed the URL and checked if the hostname was in a list of local domains.

This change fixes the URL validation in the validators.py file. Previously, only local domains were allowed. After the change, non-local domains are allowed again.

(Note: this change was made in response to PR #5318 where the validation was modified to allow more local domains, but also accidentally to block any non-local domain.
2023-11-23 10:45:14 +01:00
Reinier van der Leer 1ba917a3e2
refactor: Remove unnecessary sections from AutoGPT agent README
- Removed Discord, GitHub stars, and Twitter follow badges
- Removed funding and sponsor sections
- Removed contributor and sponsor avatars
- Removed unnecessary line breaks and div tags
2023-11-22 18:11:18 +01:00
Aaron 874000624d
Allow AutoGPT to access local web hosts (#5318)
Update validators.py

allow ports to be used in host names. e.g. localhost:8888. 
(Note: code generated by ChatGPT.)
2023-11-16 15:31:22 +01:00
HawkClaws 6664eec8ce
Improve the accuracy of the extract_dict_from_response method's JSON extraction (#5458) 2023-11-16 15:19:09 +01:00
Reinier van der Leer c4494d8c02
fix: Add data directory to lint exclusion list
- Add data directory to exclusion list in `.flake8` configuration file
- Ignore agent-generated python files while linting in `pyproject.toml` file
2023-11-16 14:36:08 +01:00
Reinier van der Leer 0b3aea92d1
fix: Improve parsing of JSON in LLM responses
- Ignored any content preceding the first opening brace in the response
- Updated `utilities.py` file in the `autogpt` package
2023-11-16 14:33:16 +01:00
SwiftyOS 0719780c91 Allowed all for CORS added autogpt to the arena 2023-11-15 10:53:11 +01:00
Reinier van der Leer 6c84035c7e
Disable hybrid mode in AutoGPT by default
- Update `big_brain` attribute in `BaseAgentConfiguration` to default to `True`.
- This change disables hybrid mode in AutoGPT, making it use the configured smart LLM for thinking.
2023-11-08 10:11:40 -06:00
Reinier van der Leer 345ff6f88d
feat: Add support for new models and features from OpenAI's November 6 update (#6147)
* feat: Add support for new models and features from OpenAI's November 6 update
  - Updated the `OpenAIModelName` enum to include new GPT-3.5 Turbo and GPT-4 models
  - Added support for the `GPT3_v3` and `GPT4_v3` models in the `OPEN_AI_CHAT_MODELS` dictionary
  - Modified the `OpenAIProvider` class to handle the new models and features
  - Updated the schema definitions in the `schema.py` module to include `AssistantToolCall` and `AssistantToolCallDict` 
models
  - Updated the `AssistantChatMessage` and `AssistantChatMessageDict` models to include the `tool_calls` field
  - Refactored the code in various modules to handle the new tool calls and function arguments

  Added support for the new models and features introduced with OpenAI's latest update. This commit allows the system to utilize the `GPT3_v3` and `GPT4_v3` models and includes all necessary modifications to the codebase to handle the new models and associated features.

* Fix validation error in LLM response handling

* fix: Fix profile generator in-prompt example for functions compatibility mode
  - Updated the in-prompt example in the profile generator to be compatible with functions compatibility mode.
  - Modified the example call section to correctly reflect the structure of function calls.
2023-11-07 17:34:11 -06:00
Surav Shrestha ad305fd019
docs: fix typos in markdown files (#5871)
* docs: fix typos in QUICKSTART.md

* docs: fix typos in autogpts/autogpt/autogpt/core/ARCHITECTURE_NOTES.md

---------

Co-authored-by: Nicholas Tindle <nicholas.tindle@agpt.co>
2023-11-07 17:16:33 -06:00
Reinier van der Leer a2dc4b1834
refactor: Delete dead legacy code from `autogpt.llm.providers.openai` 2023-11-07 16:52:16 -06:00
Reinier van der Leer 7a7a144690
refactor: Tweak prompts & improve AutoGPT agent step output
- Make minor adjustments to prompts in the OneShotAgentPromptConfiguration class
- Enhance the output format of the execute_result in AgentProtocolServer
- Update the key name from "criticism" to "self_criticism" in print_assistant_thoughts function
- Modify the output format of the web search results in the web_search function
2023-11-07 16:51:32 -06:00
Reinier van der Leer 0bd776dde5
fix: Prevent AutoGPT crashes when LLM does not use a command
- Updated `agent.py` to check if `command_name` exists before registering an action in `event_history`.
- Updated `agent_protocol_server.py` to handle the scenario when `execute_command` is not provided by LLM.
- Updated `main.py` to check if `command_name` exists before executing the command and logging the result.
2023-11-07 16:48:54 -06:00
Reinier van der Leer c65b71d51d
feat: Re-use Docker container for code execution
- Create a unique container name based on agent ID
- Check if the container with the name exists, otherwise create a new container
- If the container is not running, start it; otherwise, restart it
- Execute the code in the container
- Return the output of the code execution

This change enables reusing the same container for consecutive code execution commands, allowing for iterative changes to the execution environment.

Note: This change also includes handling the case where the Docker image is not found locally by pulling it from Docker Hub. The image used in this case is "python:3-alpine".
2023-10-31 00:03:23 -07:00
Reinier van der Leer 653fc5851d
fix: Fix serialization error caused by ignored field in ErrorInfo object
- Change `ErrorInfo` class attribute `_repr` to `repr` for consistent serialization
- Update `__repr__` method to return `self.repr` instead of `self._repr`
2023-10-30 16:10:40 -07:00
Reinier van der Leer fc1d73ba60
fix: Serialize Exception objects in ActionErrorResult
- Replaced `error` field in `ActionErrorResult` with `ErrorInfo` model.
- Implemented `ErrorInfo` model with necessary fields (`args`, `message`, `exception_type`, `_repr`).
- Added `from_exception` method to `ErrorInfo` model to create an instance from an Exception object.
- Updated `ActionErrorResult.from_exception` method to utilize `ErrorInfo.from_exception`.
- Ensured that `ActionErrorResult` is now fully serializable and won't cause crashes.
- Made necessary changes in code comments and documentation.

This commit fixes crashes caused by attempted serialiation of `AgentException` objects in the `ActionHistory` (as part of `ActionErrorResult`s). To this end, it introduces a new `ErrorInfo` model to encapsulate information about the exception, including the exception type, message, arguments, and representation. The `from_exception` method is added to both `ActionErrorResult` and `ErrorInfo` to create an `ActionErrorResult` object from an exception, extracting the relevant information.
2023-10-30 15:52:56 -07:00
Reinier van der Leer 6f66376bb8
AutoGPT: require function call if only 1 function is given 2023-10-26 12:02:15 -07:00
Reinier van der Leer 6678f6bd72
AutoGPT: Fix showing of task input in UI 2023-10-26 11:49:28 -07:00
Nicholas Tindle b4ee485906
Rename autogpts/autogpt/CITATION.cff to CITATION.cff (#5785)
* Rename autogpts/autogpt/CITATION.cff to CITATION.cff

* Update CITATION.cff
2023-10-22 13:25:05 -05:00
Reinier van der Leer 16e266c65f
Set up CI for `development` branch; deprecate `stable` branch 2023-10-21 15:46:53 -07:00
Ikko Eltociear Ashimine e8d16d6823
Fix typo in exceptions.py
occured -> occurred
2023-10-19 14:41:20 +09:00
Reinier van der Leer e9b64adae9
Lint AutoGPT 2023-10-17 21:23:43 -07:00
Reinier van der Leer 8dbcdc28ed
AutoGPT: Fix error handling in `AgentProtocolServer.execute_step` 2023-10-17 21:23:05 -07:00
Reinier van der Leer d617c3fa2f
AutoGPT: Use watchdog to mitigate empty commands 2023-10-17 21:22:44 -07:00
Reinier van der Leer 21a014790f
AutoGPT: Prompt tweaks 2023-10-17 21:22:23 -07:00
Reinier van der Leer 4fd3df9b87
Unbreak `core.prompting.utils:json_loads` :') 2023-10-17 19:56:09 -07:00
Reinier van der Leer e0a9341fc0
AutoGPT: Enable hybrid mode by default 2023-10-17 19:48:00 -07:00
Reinier van der Leer cd0df40a4f
AutoGPT: Make `core.prompting.utils:json_loads` slightly more robust 2023-10-17 19:47:25 -07:00
Reinier van der Leer 7a7e1578d3
.gitignore agbenchmark_config data 2023-10-17 19:33:24 -07:00
Reinier van der Leer c8fbb5153a
AutoGPT: Fix context sharing between agent 2023-10-17 19:30:57 -07:00
Reinier van der Leer 07e8603345
Fix AutoGPT dependence on forge (vol. 2) 2023-10-17 18:56:59 -07:00
Reinier van der Leer 62df429ffa
AutoGPT: Fix artifact creation & downloading 2023-10-17 18:37:56 -07:00
Reinier van der Leer b1f1f7aa05
Fix AutoGPT forge dependency 2023-10-17 18:35:46 -07:00
Reinier van der Leer 18352d834e
Merge branch 'master' into autogpt/agent-protocol 2023-10-17 17:20:54 -07:00
Reinier van der Leer 6a05e11239
AutoGPT: Fix decorator typings 2023-10-17 17:20:21 -07:00
Reinier van der Leer fc9689b000
Fix setup tests 2023-10-17 17:07:51 -07:00
Reinier van der Leer 3cc8b2abf7
Fix web_search tests 2023-10-17 17:07:37 -07:00
Reinier van der Leer 7e7365eac2
Fix file_operations tests 2023-10-17 17:07:15 -07:00
Reinier van der Leer 129483b21c
Disable broken memory tests 2023-10-17 17:06:33 -07:00
Reinier van der Leer 03992b3232
Abandon tests/challenges in favor of benchmark 2023-10-17 17:06:15 -07:00
Reinier van der Leer 9dc059fa3a
lint 2023-10-17 16:34:19 -07:00
Reinier van der Leer 4a3f052b3a
Bodge BaseAgent.file_manager type to get rid of type errors everywhere 2023-10-17 16:33:30 -07:00
Reinier van der Leer 7efd62233e
Fix profile generator in-prompt example 2023-10-17 16:12:05 -07:00
Reinier van der Leer 11eeaeb4b9
AutoGPT: Fix artifact download 2023-10-17 15:56:56 -07:00
Reinier van der Leer 8adfca5fb7
AutoGPT: Fix artifact upload 2023-10-17 15:50:55 -07:00
Reinier van der Leer fac52a6bc6
AutoGPT: Handle Agent self-termination gracefully 2023-10-17 15:44:35 -07:00
Reinier van der Leer fff7667c68
AutoGPT: Save step output to DB 2023-10-17 15:35:38 -07:00
Reinier van der Leer 27e362c6ea
AutoGPT: Fix file ops (vol. 2) 2023-10-17 14:36:33 -07:00
Reinier van der Leer b75b41250b
Merge branch 'master' into autogpt/agent-protocol 2023-10-17 13:23:50 -07:00
Reinier van der Leer 24cd8e3eeb
AutoGPT: Fix file ops 2023-10-17 13:23:19 -07:00
Reinier van der Leer 69094139bf
AutoGPT: accept "y" as input for proceeding with action 2023-10-17 13:08:23 -07:00
Reinier van der Leer 70f617ddd6
Debug AIDirectives validation 2023-10-17 13:01:50 -07:00
Reinier van der Leer 2660e5ec8c
Fix AutoGPT agbenchmark config 2023-10-17 12:36:14 -07:00
Reinier van der Leer 12d959f780
Update AutoGPT .dockerignore to include nested .venv and __pycache__ 2023-10-17 12:15:04 -07:00
Reinier van der Leer 53c2b26dde
AGBenchmark v0.0.10 compatible? 2023-10-17 11:34:05 -07:00
Reinier van der Leer 799ee19334
Merge branch 'master' into autogpt/agent-protocol 2023-10-17 10:43:37 -07:00
Reinier van der Leer 10aececc6a
Fix subproject dependency compatibility 2023-10-17 10:36:05 -07:00
Reinier van der Leer ce1353bdc5
Update dependencies 2023-10-17 09:47:19 -07:00
Reinier van der Leer 3ae376c584
Fix AutoGPT dependencies (step 3) 2023-10-16 18:07:10 -07:00
Reinier van der Leer 0f555693f7
Fix AutoGPT Docker build 2023-10-16 17:52:35 -07:00