mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-11 22:51:28 +00:00
fix: support response_text key for Cloudflare Workers AI Nemotron models
Fixes Issue #24065 - Cloudflare Workers AI API Error when using Nemotron 3 120B model. Added fallback support to check for both response and response_text keys.
This commit is contained in:
parent
488b93c477
commit
d1fda5a2ad
1 changed files with 3 additions and 3 deletions
|
|
@ -147,9 +147,9 @@ class CloudflareChatConfig(BaseConfig):
|
|||
) -> ModelResponse:
|
||||
completion_response = raw_response.json()
|
||||
|
||||
model_response.choices[0].message.content = completion_response["result"][ # type: ignore
|
||||
"response"
|
||||
]
|
||||
# Support both "response" and "response_text" keys (newer models like Nemotron use "response_text")
|
||||
result = completion_response["result"]
|
||||
model_response.choices[0].message.content = result.get("response") or result.get("response_text", "") # type: ignore
|
||||
|
||||
prompt_tokens = litellm.utils.get_token_count(messages=messages, model=model)
|
||||
completion_tokens = len(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue