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(model): Support claude proxy models #2155

Merged
merged 1 commit into from
Nov 26, 2024

Conversation

fangyinc
Copy link
Collaborator

Description

Closes #2106

How Has This Been Tested?

  1. Using claude proxyllm in DB-GPT webserver
# .env
LLM_MODEL=claude_proxyllm
ANTHROPIC_MODEL_VERSION=claude-3-5-sonnet-20241022
ANTHROPIC_BASE_URL=https://api.openai-proxy.org/anthropic
ANTHROPIC_API_KEY={your-claude-api-key}
  1. Using ClaudeLLMClient
    Create python file test_proxyllm.py
import asyncio

from dbgpt.core import ModelRequest
from dbgpt.model.proxy import ClaudeLLMClient

client = ClaudeLLMClient(model_alias="claude-3-5-sonnet-20241022")
print(
    asyncio.run(
        client.generate(
            ModelRequest._build("claude-3-5-sonnet-20241022", "Hi, claude!")
        )
    )
)

Run test_proxyllm.py

ANTHROPIC_API_KEY={your-claude-api-key} python test_proxyllm.py

The output like this:

ModelOutput(text="Hi! I'm Claude. How can I help you today?", error_code=0, incremental=False, model_context=None, finish_reason='end_turn', usage={'prompt_tokens': 11, 'completion_tokens': 16}, metrics=None)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

Snapshots:

Include snapshots for easier review.

Checklist:

  • My code follows the style guidelines of this project
  • I have already rebased the commits and make the commit message conform to the project standard.
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • Any dependent changes have been merged and published in downstream modules

@github-actions github-actions bot added enhancement New feature or request model Module: model labels Nov 26, 2024
Copy link
Collaborator

@Aries-ckt Aries-ckt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Aries-ckt
Copy link
Collaborator

test success
image

Copy link
Collaborator

@csunny csunny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r+

@csunny csunny merged commit 61509dc into eosphoros-ai:main Nov 26, 2024
5 checks passed
@fangyinc fangyinc deleted the issue2106 branch November 26, 2024 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request model Module: model
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature][Claude] Add claude sonnet new
3 participants