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: Add model selection support for Anthropic handler #124 #125

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

diekotto
Copy link

The Anthropic handler currently uses a hardcoded model (claude-3-opus-20240229). This change allows model selection through configuration, matching the behavior of the OpenAI handler.

Changes:

  • Remove hardcoded model string
  • Use config loader to get model name from configuration
  • Update model settings initialization

Fixes #124

The Anthropic handler currently uses a hardcoded model (claude-3-opus-20240229).
This change allows model selection through configuration, matching the behavior
of the OpenAI handler.

Changes:
- Remove hardcoded model string
- Use config loader to get model name from configuration
- Update model settings initialization
@diekotto
Copy link
Author

Hi @eli64s, hope you are getting a good time. This pr is quite simple and will help a lot to those how wants to custom Anthropic usage on the tool. Can you give a quick view? Only 2 lines of code, promise.

@eli64s
Copy link
Owner

eli64s commented Dec 25, 2024

@diekotto Awesome, good catch! Reviewing now.

@eli64s eli64s added the enhancement New feature or request label Dec 25, 2024
@eli64s
Copy link
Owner

eli64s commented Dec 25, 2024

@diekotto Looks like a unit test failed for the anthropic handler:

FAILED tests/models/test_anthropic.py::test_make_request_api_error - Failed: DID NOT RAISE <class 'tenacity.RetryError'>
FAILED tests/models/test_anthropic.py::test_make_request_success - AssertionError: assert ('index', '<code>❯ REPLACE-ME</code>') == ('index', 'Generated text')
  
  At index 1 diff: '<code>❯ REPLACE-ME</code>' != 'Generated text'
  
  Full diff:
    (
        'index',
  -     'Generated text',
  +     '<code>❯ REPLACE-ME</code>',
    )
FAILED tests/models/test_anthropic.py::test_build_payload - AttributeError: 'AnthropicHandler' object has no attribute 'model'

Can you check this out?

@diekotto
Copy link
Author

Yes, working on it.

@diekotto diekotto force-pushed the feat/anthropic-model-selection branch from fe4f7d2 to 8abe727 Compare December 26, 2024 10:05
@diekotto
Copy link
Author

@eli64s ready. The constructor of the handler don't create the client if the api key is not present.

@diekotto
Copy link
Author

Results (49.07s):

  • 336 passed
  • 9 skipped

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect Model Selection in Anthropic API Integration
2 participants