-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Open
Labels
bugSomething isn't workingSomething isn't working
Description
What happened?
Reopening with python example.
I try to call different models with tool calls. Working on openai but not on some other ( sonar / claude )
Using : litellm 1.71.1
Is this planned to be supported ?
import openai
client = openai.OpenAI(api_key="TOKEN",base_url="LITELLM-SERVER")
response = client.chat.completions.create(model="PERPLEXITYMODEL", messages = [
{
"role": "assistant",
"tool_calls": [
{
"function": {
"arguments": '{"query":"foobar"}',
"name": "Search",
},
"id": "call_ShUM9uxonziXPYjU9a4uoy4s",
"type": "function",
},
],
},
{
"content": "this is a tool response",
"role": "tool",
"tool_call_id": "call_ShUM9uxonziXPYjU9a4uoy4s",
},
{
"content": "hi",
"role": "user",
},
])
'litellm.BadRequestError: PerplexityException - ["At body -> messages -> 0 -> content: Field required", "At body -> messages -> 1 -> role: Input should be 'system', 'user' or 'assistant'"].
Thank you
Relevant log output
Are you a ML Ops Team?
No
What LiteLLM version are you on ?
v1.71.1
Twitter / LinkedIn details
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working