fix remove index from tool calls cohere error

This commit is contained in:
Ishaan Jaff 2024-07-16 21:49:17 -07:00
parent 5e1e413de0
commit ee33a80486
3 changed files with 22 additions and 0 deletions

View file

@ -953,6 +953,12 @@ class OpenAIChatCompletion(BaseLLM):
new_messages = messages
new_messages.append({"role": "user", "content": ""})
messages = new_messages
elif (
"unknown field: parameter index is not a valid field" in str(e)
) and "tools" in data:
litellm.remove_index_from_tool_calls(
tool_calls=data["tools"], messages=messages
)
else:
raise e
except OpenAIError as e: