Commit Graph

81 Commits (9fd6d3df423477e32921ec705af398da3241aea8)

Author SHA1 Message Date
Toran Bruce Richards 0d8dfaf312
tweak(docs): Update setup.md with git instructions. (#8192)
Update setup.md with git instructions.
2024-09-26 16:57:17 +01:00
Toran Bruce Richards 351fdcef32
Update broken link in setup.md 2024-09-26 16:25:12 +01:00
Reinier van der Leer 5e2874c315
feat(platform): OAuth support + API key management + GitHub blocks (#8044)
## Config
- For Supabase, the back end needs `SUPABASE_URL`, `SUPABASE_SERVICE_ROLE_KEY`, and `SUPABASE_JWT_SECRET`
- For the GitHub integration to work, the back end needs `GITHUB_CLIENT_ID` and `GITHUB_CLIENT_SECRET`
- For integrations OAuth flows to work in local development, the back end needs `FRONTEND_BASE_URL` to generate login URLs with accurate redirect URLs

## REST API
- Tweak output of OAuth `/login` endpoint: add `state_token` separately in response
- Add `POST /integrations/{provider}/credentials` (for API keys)
- Add `DELETE /integrations/{provider}/credentials/{cred_id}`

## Back end
- Add Supabase support to `AppService`
- Add `FRONTEND_BASE_URL` config option, mainly for local development use

### `autogpt_libs.supabase_integration_credentials_store`
- Add `CredentialsType` alias
- Add `.bearer()` helper methods to `APIKeyCredentials` and `OAuth2Credentials`

### Blocks
- Add `CredentialsField(..) -> CredentialsMetaInput`

## Front end
### UI components
- `CredentialsInput` for use on `CustomNode`: allows user to add/select credentials for a service.
  - `APIKeyCredentialsModal`: a dialog for creating API keys
  - `OAuth2FlowWaitingModal`: a dialog to indicate that the application is waiting for the user to log in to the 3rd party service in the provided pop-up window
- `NodeCredentialsInput`: wrapper for `CredentialsInput` with the "usual" interface of node input components
- New icons: `IconKey`, `IconKeyPlus`, `IconUser`, `IconUserPlus`

### Data model
- `CredentialsProvider`: introduces the app-level `CredentialsProvidersContext`, which acts as an application-wide store and cache for credentials metadata.
- `useCredentials` for use on `CustomNode`: uses `CredentialsProvidersContext` and provides node-specific credential data and provider-specific data/functions
- `/auth/integrations/oauth_callback` route to close the loop to the `CredentialsInput` after a user completes sign-in to the external service
- Add `BlockIOCredentialsSubSchema`

### API client
- Add `isAuthenticated` method
- Add methods for integration OAuth flow: `oAuthLogin`, `oAuthCallback`
- Add CRD methods for credentials: `createAPIKeyCredentials`, `listCredentials`, `getCredentials`, `deleteCredentials`
- Add mirrored types `CredentialsMetaResponse`, `CredentialsMetaInput`, `OAuth2Credentials`, `APIKeyCredentials`
- Add GitHub blocks + "DEVELOPER_TOOLS" category
- Add `**kwargs` to `Block.run(..)` signature to support additional kwargs
- Add support for loading blocks from nested modules (e.g. `blocks/github/issues.py`)

#### Executor
- Add strict support for `credentials` fields on blocks
- Fetch credentials for graph execution and pass them down through to the node execution
2024-09-26 00:36:29 +02:00
Zamil Majdy 6da8007ce0
fix(platform): Refresh doc setup instruction (#8142) 2024-09-24 22:43:54 +00:00
Aarushi 88e278b736
tweak(rnd): Move to the PG within Supabase (#8085)
* move to supabase pg instance

* remove postgres and bind supabase port

* Updated setup
- Switched db name to postgres to work with prisma studio
- Added platform schema
- Added Market-migartions
- bound prisma studio port

* remove studio port

* updated .env

* updated readmes

---------

Co-authored-by: SwiftyOS <craigswift13@gmail.com>
2024-09-23 14:04:26 +01:00
Swifty 6718007d9b
refactor(platform): Update docker compose file names (#8135)
* update docker compose file names

* update docs
2024-09-23 10:10:56 +01:00
Swifty ef7cfbb860
refactor: AutoGPT Platform Stealth Launch Repo Re-Org (#8113)
Restructuring the Repo to make it clear the difference between classic autogpt and the autogpt platform:
* Move the "classic" projects `autogpt`, `forge`, `frontend`, and `benchmark` into a `classic` folder
  * Also rename `autogpt` to `original_autogpt` for absolute clarity
* Rename `rnd/` to `autogpt_platform/`
  * `rnd/autogpt_builder` -> `autogpt_platform/frontend`
  * `rnd/autogpt_server` -> `autogpt_platform/backend`
* Adjust any paths accordingly
2024-09-20 16:50:43 +02:00
Aarushi 2dfc927f03
tweak(docs) add to docs supabase submodule steps (#8115)
add to docs
2024-09-20 10:39:52 +01:00
matanm 9b5bf81d7c
Fix typo in Groq setup docs (#8018)
Co-authored-by: Nicholas Tindle <nicholas.tindle@agpt.co>
2024-09-18 20:22:57 +00:00
Aarushi dc72ec97bc
feat(rnd): Add support for supabase locally (#8077)
* add just auth for now

* add supabase script

* add to docker compose

* update docker compose

* tweak(rnd) Add prefix in logs (#8001)

* add prefix

* fix typos

* fix conflicts

* feat(rnd): Reduce container size remove dep with forge and autogpt (#8040)

* Remove forge and autogpt

* update lock files

* Update build process to reduce image size

* Reduced built image size

* fixed docker compose watch

* Updated logging

* updated env.example

* formatting

* linting issue

* linting not working in github actions..

* trying to get around github action linting issue

* updated version

* sleep for prisma issues

* add exp backoff on connection issues

* updated config based on review comments

* Sorting alphabetical

* updated default config

* updated depends checks

* fixed missing prisma binaries

* remove dead layer

* remove try

* remove dead layer

* updated lock file

* add to docker compose

* update for init

* add local supabase variables to docker compose

* wip supbase connectioon

* subabase submodule

* combined docker file wth new supbase url pointing to kong

* updated combined

* ngix

* updated docker compose without frontend

* updated docker compose

* update to remove frontend

* update docs

* update newline

* remove unescessary change

---------

Co-authored-by: Swifty <craigswift13@gmail.com>
2024-09-18 09:50:39 +01:00
Aarushi ebd2ecd84c
docs(server): Update docs (#8031)
update docs
2024-09-10 10:24:54 +01:00
Nicholas Tindle ef691359b7
feat: document the use of isolation better (#8028) 2024-09-09 20:55:05 +00:00
Aarushi 5000aa7ee0
tweak(rnd,docker) Remove SQLite (#7966)
* move migrations, update networking and dockignore

* update docs

* remove sqlite from ci

* remove schema linting checks

* fix formatting

* remove schema linting

* add test script

* formatting and linting

* stop pg not down

* seperate test db

* diff port

* remove duplicate
2024-09-04 10:18:57 +01:00
Aarushi e4dc16a867
docs(server): Update docs with new docker compose steps (#7944)
* update setup

* add docker links
2024-09-02 10:55:54 +02:00
Aarushi 012bad72e8
feat(rnd,blocks): Add D-ID Block (#7798)
* talking head

* linting

* remove clip id, not needed

* add more descriptive name

* add min requirement to polling attempts and intervals

* add docs and link to docs

* remove extra space

* force new tab

* fix linting

* add did key to .env.template
2024-08-23 09:39:55 +01:00
Konstantinos Voulgaropoulos f30b2cdf25
inclusion of poetry run prisma generate in the documentation (#7790) 2024-08-13 10:46:28 -05:00
Nicholas Tindle 98a07f1265
Add new agent ideas to docs (#7716) 2024-08-06 13:45:28 -05:00
alex 6440a8e217
fix punctuation in setup.md (#7689) 2024-08-04 06:53:32 -07:00
Nicholas Tindle 08905d71f9
docs(server): add docs link to server readme (#7638)
Co-authored-by: Swifty <craigswift13@gmail.com>
2024-08-01 14:32:08 +02:00
Aarushi dccc33152b
feat(docs) Add how to run ollama with AutoGPT (#7665)
add ollama howto
2024-08-01 12:12:01 +01:00
Nicholas Tindle 76feead3b1
docs(server): written setup guide for server (#7595)
Co-authored-by: Swifty <craigswift13@gmail.com>
2024-07-29 22:24:03 +01:00
A.Daee 3b0cd9518d
feat(froge): Improvement in web components (#7068)
- Add `duckduckgo_backend` field to `WebSearchComponent` configuration
- Add `selenium_proxy` to `WebSeleniumComponent` configuration
- Update docs
2024-07-25 10:02:34 +01:00
Nicholas Tindle d0ec31b698
docs: fix dead links (#7470) 2024-07-22 09:56:32 +02:00
Bently 2dc673614f
feat(doc): Update node creation docs (#7462)
* feat(doc): Update node creation docs

* small fixes

* fix formatting

* remove mention of registering a block

* Update docs/content/server/new_blocks.md

Co-authored-by: Nicholas Tindle <nicholas.tindle@agpt.co>

---------

Co-authored-by: Nicholas Tindle <nicholas.tindle@agpt.co>
2024-07-18 20:01:40 -05:00
Kate Silverstein 62c420e26f
feat(forge/llm): Add `LlamafileProvider` (#7091)
* Add minimal implementation of `LlamafileProvider`, a new `ChatModelProvider` for llamafiles. It extends `BaseOpenAIProvider` and only overrides methods that are necessary to get the system to work at a basic level.

* Add support for `mistral-7b-instruct-v0.2`. This is the only model currently supported by `LlamafileProvider` because this is the only model I tested anything with.

* Add instructions to use AutoGPT with llamafile in the docs at `autogpt/setup/index.md`
* Add helper script to get it running quickly at `scripts/llamafile/serve.py`

---------

Co-authored-by: Reinier van der Leer <pwuts@agpt.co>
2024-07-17 15:56:55 +02:00
Toran Bruce Richards d3dae2264d
tweak(docs): Replace all instances of "Node" with "Block". (#7416)
Replace all instances of "Node" with "Block" in the doccumentation.
2024-07-13 22:04:24 +01:00
Nicholas Tindle 0b9f3be6b8
feat(docs): add server new node docs (#7395)
Co-authored-by: Bently <27962737+Bentlybro@users.noreply.github.com>
2024-07-12 08:59:35 -05:00
Krzysztof Czerwinski bffb92bfbc
fix(agent, forge): Fix Pydantic v2 protected namespace `model_` warnings (#7340)
Rename `model_*` fields to `llm_*`
2024-07-12 12:05:03 +02:00
Krzysztof Czerwinski 39f70b0c83
docs(agent, forge): Update component configuration docs (#7232) 2024-07-03 09:50:38 +01:00
Reinier van der Leer 97e4cceb94
feat(agent, forge): Markdown-formatted history -> message history (#7228)
- Implement message based history in `ActionHistoryComponent`
- Make non-summarized message count configurable (`ActionHistoryComponent.full_message_count`)
- Run `ActionHistoryComponent` after `SystemComponent` so that history messages are last in the prompt
- Omit final instruction message if prompt already contains assistant messages
- Filter `raw_message` from `ActionProposal.schema()`

---------

Co-authored-by: Krzysztof Czerwinski <kpczerwinski@gmail.com>
2024-07-02 03:47:55 +02:00
Krzysztof Czerwinski c19ab2b24f
feat(forge): Component-specific configuration (#7170)
Remove many env vars and use component-level configuration that could be loaded from file instead.

### Changed

- `BaseAgent` provides `serialize_configs` and `deserialize_configs` that can save and load all component configuration as json `str`. Deserialized components/values overwrite existing values, so not all values need to be present in the serialized config.
- Decoupled `forge/content_processing/text.py` from `Config`
- Kept `execute_local_commands` in `Config` because it's needed to know if OS info should be included in the prompt
- Updated docs to reflect changes
- Renamed `Config` to `AppConfig`

### Added

- Added `ConfigurableComponent` class for components and following configs:
  - `ActionHistoryConfiguration`
  - `CodeExecutorConfiguration`
  - `FileManagerConfiguration` - now file manager allows to have multiple agents using the same workspace
  - `GitOperationsConfiguration`
  - `ImageGeneratorConfiguration`
  - `WebSearchConfiguration`
  - `WebSeleniumConfiguration`
- `BaseConfig` in `forge` and moved `Config` (now inherits from `BaseConfig`) back to `autogpt`
- Required `config_class` attribute for the `ConfigurableComponent` class that should be set to configuration class for a component
`--component-config-file` CLI option and `COMPONENT_CONFIG_FILE` env var and field in `Config`. This option allows to load configuration from a specific file, CLI option takes precedence over env var.
- Added comments to config models

### Removed

- Unused `change_agent_id` method from `FileManagerComponent`
- Unused `allow_downloads` from `Config` and CLI options (it should be in web component config if needed)
- CLI option `--browser-name` (the option is inside `WebSeleniumConfiguration`)
- Unused `workspace_directory` from CLI options
- No longer needed variables from `Config` and docs
- Unused fields from `Config`: `image_size`, `audio_to_text_provider`, `huggingface_audio_to_text_model`
- Removed `files` and `workspace` class attributes from `FileManagerComponent`
2024-06-19 09:14:01 +01:00
Nicholas Tindle c754ecd5d1
fix(docs): bad link from Options to built in components config (#7207) 2024-06-10 17:57:29 +01:00
Reinier van der Leer 319232568a
fix+docs(agent): Update LLM access instructions & remove GPT-specific flags (#7183)
* Update instructions to set up OpenAI / GPT-4 access
* Add instructions to set up Anthropic access
* Add instructions to set up Groq access
* Remove GPT-specific `--gpt3only`, `--gpt4only` CLI flags and related logic
* Remove duplicate config instructions from docker setup page, replace it by a link to the standard setup instructions
2024-06-03 08:51:46 -05:00
RainRat cb9ad6f64d
fix typos (#7123)
* fix typos in various places

* Revert changes to NOTICES

---------

Co-authored-by: Nicholas Tindle <nicholas.tindle@agpt.co>
2024-05-31 11:16:23 +02:00
Reinier van der Leer f107ff8cf0
Set up unified pre-commit + CI w/ linting + type checking & FIX EVERYTHING (#7171)
- **FIX ALL LINT/TYPE ERRORS IN AUTOGPT, FORGE, AND BENCHMARK**

### Linting
- Clean up linter configs for `autogpt`, `forge`, and `benchmark`
- Add type checking with Pyright
- Create unified pre-commit config
- Create unified linting and type checking CI workflow

### Testing
- Synchronize CI test setups for `autogpt`, `forge`, and `benchmark`
   - Add missing pytest-cov to benchmark dependencies
- Mark GCS tests as slow to speed up pre-commit test runs
- Repair `forge` test suite
  - Add `AgentDB.close()` method for test DB teardown in db_test.py
  - Use actual temporary dir instead of forge/test_workspace/
- Move left-behind dependencies for moved `forge`-code to from autogpt to forge

### Notable type changes
- Replace uses of `ChatModelProvider` by `MultiProvider`
- Removed unnecessary exports from various __init__.py
- Simplify `FileStorage.open_file` signature by removing `IOBase` from return type union
  - Implement `S3BinaryIOWrapper(BinaryIO)` type interposer for `S3FileStorage`

- Expand overloads of `GCSFileStorage.open_file` for improved typing of read and write modes

  Had to silence type checking for the extra overloads, because (I think) Pyright is reporting a false-positive:
  https://github.com/microsoft/pyright/issues/8007

- Change `count_tokens`, `get_tokenizer`, `count_message_tokens` methods on `ModelProvider`s from class methods to instance methods

- Move `CompletionModelFunction.schema` method -> helper function `format_function_def_for_openai` in `forge.llm.providers.openai`

- Rename `ModelProvider` -> `BaseModelProvider`
- Rename `ChatModelProvider` -> `BaseChatModelProvider`
- Add type `ChatModelProvider` which is a union of all subclasses of `BaseChatModelProvider`

### Removed rather than fixed
- Remove deprecated and broken autogpt/agbenchmark_config/benchmarks.py
- Various base classes and properties on base classes in `forge.llm.providers.schema` and `forge.models.providers`

### Fixes for other issues that came to light
- Clean up `forge.agent_protocol.api_router`, `forge.agent_protocol.database`, and `forge.agent.agent`

- Add fallback behavior to `ImageGeneratorComponent`
   - Remove test for deprecated failure behavior

- Fix `agbenchmark.challenges.builtin` challenge exclusion mechanism on Windows

- Fix `_tool_calls_compat_extract_calls` in `forge.llm.providers.openai`

- Add support for `any` (= no type specified) in `JSONSchema.typescript_type`
2024-05-28 05:04:21 +02:00
Reinier van der Leer edcbbbce25
feat(forge/llm): Add `GroqProvider` (#7130)
* Add `GroqProvider` in `forge.llm.providers.groq`
  * Add to `llm.providers.multi`
  * Add `groq` dependency (v0.8.0)

* Update AutoGPT docs & config template
  * Update .env.template
  * Update docs
2024-05-24 16:34:51 +02:00
Krzysztof Czerwinski 4c325724ec
refactor(autogpt, forge): Remove `autogpts` directory (#7163)
- Moved `autogpt` and `forge` to project root
- Removed `autogpts` directory
- Moved and renamed submodule `autogpts/autogpt/tests/vcr_cassettes` to `autogpt/tests/vcr_cassettes`
- When using CLI agents will be created in `agents` directory (instead of `autogpts`)
- Renamed relevant docs, code and config references from `autogpts/[forge|autogpt]` to `[forge|autogpt]` and from `*../../*` to `*../*`
- Updated `CODEOWNERS`, GitHub Actions and Docker `*.yml` configs
- Updated symbolic links in `docs`
2024-05-22 13:08:54 +01:00
Krzysztof Czerwinski 3475aaf384
refactor(agent): Remove unused `autogpt` code (#7112)
Remove unused `autogpt` code and reorganize its file structure.

* Moved:
  * `autogpt/agent_manager/agent_manager.py` to `autogpt/agents/agent_manager.py`, so the dir `agent_manager` was removed
  * `dump_prompt` from `autogpt.core.runner.client_lib.logging.helpers` to `forge/llm/prompting/utils.py`
  * `coroutine` decorator from `autogpt.core.runner.client_lib.utils` to `autogpt/app/utils.py`
* Removed within `autogpt`:
  * Memory-related code from multiple files (not used), including `memory/*`
  * Memory-related config entries/env vars: `memory_backend`, `memory_index`, `redis_host`, `redis_port`, `redis_password`, `wipe_redis_on_start`
  * `core` files, from failed re-arch:
    * `*.md` docs
    * `core/ability/*`
    * `core/agent/*`
    * `core/memory/*`
    * `core/planning/*`
    * `core/plugin/*`
    * `core/workspace/*`
    * `core/runner/*` (`dump_prompt` and `coroutine` were moved)
  * Related tests
* Updated relevant docs
2024-05-22 09:43:15 +01:00
Krzysztof Czerwinski bcc5282aba
refactor(forge): Clean `forge` (#7117)
Remove unused `forge` code and improve structure of `forge`.

* Put all Agent Protocol stuff together in `forge.agent_protocol`
  * ... including `forge.agent_protocol.database` (was `forge.db`)
* Remove duplicate/unused parts from `forge`
  * `forge.actions`, containing old commands; replaced by `forge.components` from `autogpt`
  * `forge/agent.py` (the old one, `ForgeAgent`)
  * `forge/app.py`, which was used to serve and run the `ForgeAgent`
  * `forge/db.py` (`ForgeDatabase`), which was used for `ForgeAgent`
  * `forge/llm.py`, which has been replaced by new `forge.llm` module which was ported from `autogpt.core.resource.model_providers`
  * `forge.memory`, which is not in use and not being maintained
  * `forge.sdk`, much of which was moved into other modules and the rest is deprecated
  * `AccessDeniedError`: unused
  * `forge_log.py`: replaced with `logging`
  * `validate_yaml_file`: not needed
  * `ai_settings_file` and associated loading logic and env var `AI_SETTINGS_FILE`: unused
  * `prompt_settings_file` and associated loading logic and env var `PROMPT_SETTINGS_FILE`: default directives are now provided by the `SystemComponent`
    * `request_user_double_check`, which was only used in `AIDirectives.load`
  * `TypingConsoleHandler`: not used
2024-05-21 19:18:47 +01:00
Krzysztof Czerwinski e8d7dfa386
refactor(agent, forge): Move library code from `autogpt` to `forge` (#7106)
Moved from `autogpt` to `forge`:
- `autogpt.config`          -> `forge.config`
- `autogpt.processing`      -> `forge.content_processing`
- `autogpt.file_storage`    -> `forge.file_storage`
- `autogpt.logs`            -> `forge.logging`
- `autogpt.speech`          -> `forge.speech`
- `autogpt.agents.(base|components|protocols)`  -> `forge.agent.*`
- `autogpt.command_decorator`                   -> `forge.command.decorator`
- `autogpt.models.(command|command_parameter)`  -> `forge.command.(command|parameter)`
- `autogpt.(commands|components|features)`      -> `forge.components`
- `autogpt.core.utils.json_utils`           -> `forge.json.parsing`
- `autogpt.prompts.utils`                   -> `forge.llm.prompting.utils`
- `autogpt.core.prompting.(base|schema|utils)`    -> `forge.llm.prompting.*`
- `autogpt.core.resource.model_providers`   -> `forge.llm.providers`
- `autogpt.llm.providers.openai` + `autogpt.core.resource.model_providers.utils`
                                            -> `forge.llm.providers.utils`
- `autogpt.models.action_history:Action*`   -> `forge.models.action`
- `autogpt.core.configuration.schema`       -> `forge.models.config`
- `autogpt.core.utils.json_schema`          -> `forge.models.json_schema`
- `autogpt.core.resource.schema`            -> `forge.models.providers`
- `autogpt.models.utils`                    -> `forge.models.utils`
- `forge.sdk.(errors|utils)` + `autogpt.utils.(exceptions|file_operations_utils|validators)`
                        -> `forge.utils.(exceptions|file_operations|url_validator)`
- `autogpt.utils.utils` -> `forge.utils.const` + `forge.utils.yaml_validator`

Moved within `forge`:
- forge/prompts/* -> forge/llm/prompting/*

The rest are mostly import updates, and some sporadic removals and necessary updates (for example to fix circular deps):
- Changed `CommandOutput = Any` to remove coupling with `ContextItem` (no longer needed)
- Removed unused `Singleton` class
- Reluctantly moved `speech` to forge due to coupling (tts needs to be changed into component)
- Moved `function_specs_from_commands` and `core/resource/model_providers` to `llm/providers` (resources were a `core` thing and are no longer relevant)
- Keep tests in `autogpt` to reduce changes in this PR
- Removed unused memory-related code from tests
- Removed duplicated classes: `FancyConsoleFormatter`, `BelowLevelFilter`
- `prompt_settings.yaml` is in both `autogpt` and `forge` because for some reason doesn't work when placed in just one dir (need to be taken care of)
- Removed `config` param from `clean_input`, it wasn't used and caused circular dependency
- Renamed `BaseAgentActionProposal` to `ActionProposal`
- Updated `pyproject.toml` in `forge` and `autogpt`
- Moved `Action*` models from `forge/components/action_history/model.py` to `forge/models/action.py` as those are relevant to the entire agent and not just `EventHistoryComponent` + to reduce coupling
- Renamed `DEFAULT_ASK_COMMAND` to `ASK_COMMAND` and `DEFAULT_FINISH_COMMAND` to `FINISH_COMMAND`
- Renamed `AutoGptFormatter` to `ForgeFormatter` and moved to `forge`

Includes changes from PR https://github.com/Significant-Gravitas/AutoGPT/pull/7148
---------

Co-authored-by: Reinier van der Leer <pwuts@agpt.co>
2024-05-16 00:37:53 +02:00
Swifty 34fdbaa26b
Remove arena (#7134)
* remove arena

* refactor: Remove Arena intake workflow

* Remove all mention of the arena

* remove evo.ninja
2024-05-09 11:36:40 +02:00
Reinier van der Leer 2ef5cd7d4c
fix(agent): Swap target files and symlinks of component documentation to make package buildable
Documentation files were in docs/content/AutoGPT/components, symlinks in autogpts/autogpt/autogpt/(agents|commands).
Chef doesn't allow symlinks that point to locations outside of package dir.
Replacing the documentation files with symlinks, and symlinks with the actual documentation files, should fix this.
2024-05-07 13:44:31 +02:00
Reinier van der Leer 39c46ef6be
feat(agent/core): Add Anthropic Claude 3 support (#7085)
- feat(agent/core): Add `AnthropicProvider`
  - Add `ANTHROPIC_API_KEY` to .env.template and docs

  Notable differences in logic compared to `OpenAIProvider`:
  - Merges subsequent user messages in `AnthropicProvider._get_chat_completion_args`
  - Merges and extracts all system messages into `system` parameter in `AnthropicProvider._get_chat_completion_args`
  - Supports prefill; merges prefill content (if any) into generated response

- Prompt changes to improve compatibility with `AnthropicProvider`
  Anthropic has a slightly different API compared to OpenAI, and has much stricter input validation. E.g. Anthropic only supports a single `system` prompt, where OpenAI allows multiple `system` messages. Anthropic also forbids sequences of multiple `user` or `assistant` messages and requires that messages alternate between roles.
  - Move response format instruction from separate message into main system prompt
  - Fix clock message format
  - Add pre-fill to `OneShot` generated prompt

- refactor(agent/core): Tweak `model_providers.schema`
  - Simplify `ModelProviderUsage`
     - Remove attribute `total_tokens` as it is always equal to `prompt_tokens + completion_tokens`
     - Modify signature of `update_usage(..)`; no longer requires a full `ModelResponse` object as input
  - Improve `ModelProviderBudget`
     - Change type of attribute `usage` to `defaultdict[str, ModelProviderUsage]` -> allow per-model usage tracking
     - Modify signature of `update_usage_and_cost(..)`; no longer requires a full `ModelResponse` object as input
     - Allow `ModelProviderBudget` zero-argument instantiation
  - Fix type of `AssistantChatMessage.role` to match `ChatMessage.role` (str -> `ChatMessage.Role`)
  - Add shared attributes and constructor to `ModelProvider` base class
  - Add `max_output_tokens` parameter to `create_chat_completion` interface
  - Add pre-filling as a global feature
    - Add `prefill_response` field to `ChatPrompt` model
    - Add `prefill_response` parameter to `create_chat_completion` interface
  - Add `ChatModelProvider.get_available_models()` and remove `ApiManager`
  - Remove unused `OpenAIChatParser` typedef in openai.py
  - Remove redundant `budget` attribute definition on `OpenAISettings`
  - Remove unnecessary `usage` in `OpenAIProvider` > `default_settings` > `budget`

- feat(agent): Allow use of any available LLM provider through `MultiProvider`
  - Add `MultiProvider` (`model_providers.multi`)
  - Replace all references to / uses of `OpenAIProvider` with `MultiProvider`
  - Change type of `Config.smart_llm` and `Config.fast_llm` from `str` to `ModelName`

- feat(agent/core): Validate function call arguments in `create_chat_completion`
    - Add `validate_call` method to `CompletionModelFunction` in `model_providers.schema`
    - Add `validate_tool_calls` utility function in `model_providers.utils`
    - Add tool call validation step to `create_chat_completion` in `OpenAIProvider` and `AnthropicProvider`
    - Remove (now redundant) command argument validation logic in agent.py and models/command.py

- refactor(agent): Rename `get_openai_command_specs` to `function_specs_from_commands`
2024-05-04 20:33:25 +02:00
Krzysztof Czerwinski d38e8b8f6c
clean(autogpt): Remove old plugin system (#7097)
### Background

Follow up after merging https://github.com/Significant-Gravitas/AutoGPT/pull/7054, old plugins will no longer be used.

### Changes 🏗️

- Removed all dead code needed to load and use plugins.
- Removed `auto-gpt-plugin-template` dependency
- Removed `rev=` from `autogpt-forge` dependency (the set `rev` had incompatible `duckduckgo-search` versions)
- Kept `--install-plugin-deps` CLI option and dead code associated (may be needed for new plugins)
2024-04-28 21:10:53 +02:00
Nicholas Tindle 5e89b8c6d1
Add all the new component docs to the site and do a tidy up of docs (#7098)
* feat: add all the new component docs to the site

* fix(docs): relative links and markdown warnings

* feat(docs): How to contribute to the docs as a docs section

* fix(docs): missed docs page for developer setup

* fix(docs): re-add configurations options

* fix(docs): bad link to components fixed

* fix(docs): bad link to components fixed

* ref(docs): reorder some items to make more sense

* fix(docs): bad indentation and duplicate block

* fix(docs): warning about out of date markdown extension

* fix(docs): broken links fixed

* fix(docs): markdown formatter complaints
2024-04-23 08:49:07 -05:00
Krzysztof Czerwinski a74548d3cd
feat(agent): Component-based Agents (#7054)
This incremental re-architecture unifies Agent code and plugins, so everything is component-based.

## Breaking changes

- Removed command categories and `DISABLED_COMMAND_CATEGORIES` environment variable. Use `DISABLED_COMMANDS` environment variable to disable individual commands.
- Changed `command` decorator; old-style commands are no longer supported. Implement `CommandProvider` on components instead.
- Removed `CommandRegistry`, now all commands are provided by components implementing `CommandProvider`.
- Removed `prompt_config` from `AgentSettings`.
- Removed plugin support: old plugins will no longer be loaded and executed.
- Removed `PromptScratchpad`, it was used by plugins and is no longer needed.
- Changed `ThoughtProcessOutput` from tuple to pydantic `BaseModel`.

## Other changes

- Created `AgentComponent`, protocols and logic to execute them.
- `BaseAgent` and `Agent` is now composed of components.
- Moved some logic from `BaseAgent` to `Agent`.
- Moved agent features and commands to components.
- Removed check if the same operation is about to be executed twice in a row.
- Removed file logging from `FileManagerComponent` (formerly `AgentFileManagerMixin`)
- Updated tests
- Added docs

See [Introduction](https://github.com/kcze/AutoGPT/blob/kpczerwinski/open-440-modular-agents/docs/content/AutoGPT/component%20agent/introduction.md) for more information.
2024-04-22 19:20:01 +02:00
Nicholas Tindle fa14865163
docs: Redirect AutoGPT users from Forge tutorial with warning (#7014)
Update forge/get-started.md
2024-03-15 11:38:52 +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
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 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