mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-11 22:51:28 +00:00
Update litellm/proxy/response_api_endpoints/endpoints.py
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
This commit is contained in:
parent
018750e0cd
commit
39762983b1
1 changed files with 13 additions and 0 deletions
|
|
@ -469,6 +469,7 @@ async def count_response_input_tokens(
|
|||
|
||||
if isinstance(input_data, str):
|
||||
messages.append({"role": "user", "content": input_data})
|
||||
elif isinstance(input_data, list):
|
||||
elif isinstance(input_data, list):
|
||||
for item in input_data:
|
||||
if isinstance(item, dict):
|
||||
|
|
@ -480,6 +481,18 @@ async def count_response_input_tokens(
|
|||
"content": item.get("output", ""),
|
||||
"tool_call_id": item.get("call_id", ""),
|
||||
})
|
||||
elif item.get("type") == "function_call":
|
||||
messages.append({
|
||||
"role": "assistant",
|
||||
"tool_calls": [{
|
||||
"id": item.get("call_id", ""),
|
||||
"type": "function",
|
||||
"function": {
|
||||
"name": item.get("name", ""),
|
||||
"arguments": item.get("arguments", ""),
|
||||
},
|
||||
}],
|
||||
})
|
||||
else:
|
||||
messages.append({"role": role, "content": content})
|
||||
elif isinstance(item, str):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue