mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 18:54:30 +00:00
fix(anthropic.py): fix translation from /v1/messages format to openai format
This commit is contained in:
parent
2776d9cb0d
commit
4ac0afef2c
4 changed files with 105 additions and 7 deletions
|
@ -5373,7 +5373,13 @@ async def anthropic_response(
|
|||
litellm.adapters = [{"id": "anthropic", "adapter": anthropic_adapter}]
|
||||
|
||||
global user_temperature, user_request_timeout, user_max_tokens, user_api_base
|
||||
data: dict = {**anthropic_data, "adapter_id": "anthropic"}
|
||||
body = await request.body()
|
||||
body_str = body.decode()
|
||||
try:
|
||||
request_data: dict = ast.literal_eval(body_str)
|
||||
except Exception:
|
||||
request_data = json.loads(body_str)
|
||||
data: dict = {**request_data, "adapter_id": "anthropic"}
|
||||
try:
|
||||
data["model"] = (
|
||||
general_settings.get("completion_model", None) # server default
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue