mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 11:14:04 +00:00
fix - choices index for gemini/ provider
This commit is contained in:
parent
e9358684fb
commit
a2ef089667
2 changed files with 3 additions and 2 deletions
|
@ -260,7 +260,7 @@ def completion(
|
|||
message_obj = Message(content=item.content.parts[0].text)
|
||||
else:
|
||||
message_obj = Message(content=None)
|
||||
choice_obj = Choices(index=idx + 1, message=message_obj)
|
||||
choice_obj = Choices(index=idx, message=message_obj)
|
||||
choices_list.append(choice_obj)
|
||||
model_response["choices"] = choices_list
|
||||
except Exception as e:
|
||||
|
@ -352,7 +352,7 @@ async def async_completion(
|
|||
message_obj = Message(content=item.content.parts[0].text)
|
||||
else:
|
||||
message_obj = Message(content=None)
|
||||
choice_obj = Choices(index=idx + 1, message=message_obj)
|
||||
choice_obj = Choices(index=idx, message=message_obj)
|
||||
choices_list.append(choice_obj)
|
||||
model_response["choices"] = choices_list
|
||||
except Exception as e:
|
||||
|
|
|
@ -3246,6 +3246,7 @@ def test_completion_gemini():
|
|||
response = completion(model=model_name, messages=messages)
|
||||
# Add any assertions,here to check the response
|
||||
print(response)
|
||||
assert response.choices[0]["index"] == 0
|
||||
except litellm.APIError as e:
|
||||
pass
|
||||
except Exception as e:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue