Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(agent/core): Add Anthropic Claude 3 support #7085

Merged
merged 35 commits into from
May 4, 2024

Commits on Apr 16, 2024

  1. refactor(agent/core): Tweak model_providers.schema

    - Fix type of `AssistantChatMessage.role` to match `ChatMessage.role` (str -> `ChatMessage.Role`)
    - 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
    
    Also:
    - Remove unused `OpenAIChatParser` typedef in openai.py
    - Remove redundant `budget` attribute definition on `OpenAISettings`
    - Remove unnecessary `usage` in `OpenAIProvider` > `default_settings` > `budget`
    Pwuts committed Apr 16, 2024
    Configuration menu
    Copy the full SHA
    76e9fd1 View commit details
    Browse the repository at this point in the history
  2. feat(agent/core): Add AnthropicProvider

    yee haw!
    
    Also:
    - Add `ToolResultMessage` to `model_providers.schema`
    Pwuts committed Apr 16, 2024
    Configuration menu
    Copy the full SHA
    7ecc459 View commit details
    Browse the repository at this point in the history

Commits on Apr 18, 2024

  1. Configuration menu
    Copy the full SHA
    95bbda0 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    001fe75 View commit details
    Browse the repository at this point in the history
  3. feat(agent/core): Add max_output_tokens parameter to `create_chat_c…

    …ompletion` interface
    Pwuts committed Apr 18, 2024
    Configuration menu
    Copy the full SHA
    8beaedd View commit details
    Browse the repository at this point in the history

Commits on Apr 21, 2024

  1. refactor(agent): Add ChatModelProvider.get_available_models() and r…

    …emove `ApiManager`
    Pwuts committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    d5eb79f View commit details
    Browse the repository at this point in the history
  2. refactor(agent/core): Allow ModelProviderBudget zero-argument insta…

    …ntiation
    
    Also:
    - straighten out related model definitions
        - remove now-redundant `service=` arguments for `ChatModelInfo`/`EmbeddingModelInfo` usages
    - use `defaultdict(ModelProviderBudget)` in agent_protocol_server.py to simplify budget tracking setup
    Pwuts committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    0594653 View commit details
    Browse the repository at this point in the history
  3. refactor(agent/core): Add shared attributes and constructor to `Model…

    …Provider` base class
    Pwuts committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    651c99d View commit details
    Browse the repository at this point in the history
  4. fix(agent): Change max_tokens to max_output_tokens in `create_cha…

    …t_completion_call`
    
    in `processing/text.py:_process_text`
    Pwuts committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    2da125d View commit details
    Browse the repository at this point in the history
  5. feat(agent): Allow use of any available LLM provider through `MultiPr…

    …ovider`
    
    - Add `MultiProvider`
    - Replace all references to / uses of `OpenAIProvider` with `MultiProvider`
    - Change type of `Config.smart_llm` and `Config.fast_llm` from `str` to `ModelName`
    Pwuts committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    9d38dbd View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    70c97ca View commit details
    Browse the repository at this point in the history
  7. fix(agent/core): Make retry mechanism of AnthropicProvider specific…

    … to not-our-fault errors
    
    So e.g. don't retry on 400 Bad Request errors or anything else in the 4xx range
    Pwuts committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    dcd1685 View commit details
    Browse the repository at this point in the history
  8. fix(agent/core): Set retries_per_request to 7 by default

    10 was too much, caused multi-minute timeouts between retries
    Pwuts committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    2aa4ca5 View commit details
    Browse the repository at this point in the history

Commits on Apr 22, 2024

  1. Configuration menu
    Copy the full SHA
    a60854e View commit details
    Browse the repository at this point in the history

Commits on Apr 23, 2024

  1. Configuration menu
    Copy the full SHA
    1ae07a5 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    92ff5a4 View commit details
    Browse the repository at this point in the history

Commits on Apr 24, 2024

  1. Configuration menu
    Copy the full SHA
    933ec93 View commit details
    Browse the repository at this point in the history
  2. Adhere to Anthropic message schema in AnthropicProvider parse-fix m…

    …echanism
    
    If assistant  message contains `tool_use` blocks, include required `tool_result` blocks in feedback message
    Pwuts committed Apr 24, 2024
    Configuration menu
    Copy the full SHA
    72d0248 View commit details
    Browse the repository at this point in the history

Commits on Apr 25, 2024

  1. feat(agent/core): Validate function call arguments in `create_chat_co…

    …mpletion`
    
    - 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`
    
    Also:
    - Remove (now redundant) command argument validation logic in agent.py and models/command.py
    Pwuts committed Apr 25, 2024
    Configuration menu
    Copy the full SHA
    e492258 View commit details
    Browse the repository at this point in the history

Commits on Apr 27, 2024

  1. Configuration menu
    Copy the full SHA
    d5d8bfc View commit details
    Browse the repository at this point in the history

Commits on Apr 30, 2024

  1. Configuration menu
    Copy the full SHA
    a62ec0f View commit details
    Browse the repository at this point in the history

Commits on May 1, 2024

  1. Configuration menu
    Copy the full SHA
    6503b9e View commit details
    Browse the repository at this point in the history
  2. feat(agent): Formalize pre-filling as a global feature

    - Add `prefill_response` attribute to `ChatPrompt` model
    - Add `prefill_response` parameter to `ChatModelProvider.create_chat_completion` and its implementations
    - Amend `OneShotAgentPromptStrategy` to use new pre-filling feature
    Pwuts committed May 1, 2024
    Configuration menu
    Copy the full SHA
    e65b57f View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    b32778b View commit details
    Browse the repository at this point in the history
  4. Fix clock message format

    Pwuts committed May 1, 2024
    Configuration menu
    Copy the full SHA
    fd067a0 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    c10fafa View commit details
    Browse the repository at this point in the history
  6. Remove unused imports

    Pwuts committed May 1, 2024
    Configuration menu
    Copy the full SHA
    338986d View commit details
    Browse the repository at this point in the history

Commits on May 2, 2024

  1. Configuration menu
    Copy the full SHA
    32fe727 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    d2a9be0 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    2e197eb View commit details
    Browse the repository at this point in the history
  4. Revert "Remove problematic "final instruction message" from OneShot

    … prompt"
    
    This reverts commit c10fafa.
    Pwuts committed May 2, 2024
    Configuration menu
    Copy the full SHA
    207957b View commit details
    Browse the repository at this point in the history
  5. Implement mechanism to merge subsequent user messages in `AnthropicPr…

    …ovider._get_chat_completion_args`
    Pwuts committed May 2, 2024
    Configuration menu
    Copy the full SHA
    94985ef View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    1ca8d20 View commit details
    Browse the repository at this point in the history

Commits on May 3, 2024

  1. Configuration menu
    Copy the full SHA
    bb4f8a2 View commit details
    Browse the repository at this point in the history

Commits on May 4, 2024

  1. Configuration menu
    Copy the full SHA
    0f778e5 View commit details
    Browse the repository at this point in the history