Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: gemini: fixed bug in a finish reason handler #161

Merged
merged 1 commit into from
Dec 20, 2024

Conversation

adubovik
Copy link
Collaborator

The FinishReasonOtherError ctor fails with the error:

Upstream: http://vertexai-adapter:5000/openai/deployments/gemini-1.5-flash-002/chat/completions. Status: 200. Headers: 4
vertexai-adapter-1                 | ERROR:    | 2024-12-20 09:33:20 | 1 | app | caught exception: builtins.AttributeError
vertexai-adapter-1                 | Traceback (most recent call last):
vertexai-adapter-1                 |   File "/app/aidial_adapter_vertexai/dial_api/exceptions.py", line 72, in wrapper
vertexai-adapter-1                 |     return await func(*args, **kwargs)
vertexai-adapter-1                 |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
vertexai-adapter-1                 |   File "/app/aidial_adapter_vertexai/chat_completion.py", line 107, in chat_completion
vertexai-adapter-1                 |     await asyncio.gather(
vertexai-adapter-1                 |   File "/app/aidial_adapter_vertexai/chat_completion.py", line 97, in generate_response
vertexai-adapter-1                 |     await model.chat(params, consumer, truncated_prompt.prompt)
vertexai-adapter-1                 |   File "/app/aidial_adapter_vertexai/chat/gemini/adapter.py", line 237, in chat
vertexai-adapter-1                 |     async for content in generate_with_retries(
vertexai-adapter-1                 |   File "/app/aidial_adapter_vertexai/chat/gemini/adapter.py", line 405, in generate_with_retries
vertexai-adapter-1                 |     async for content in generator():
vertexai-adapter-1                 |   File "/app/aidial_adapter_vertexai/chat/gemini/adapter.py", line 210, in process_chunks
vertexai-adapter-1                 |     await set_finish_reason(candidate, consumer)
vertexai-adapter-1                 |   File "/app/aidial_adapter_vertexai/chat/gemini/adapter.py", line 284, in set_finish_reason
vertexai-adapter-1                 |     openai_reason = to_openai_finish_reason(
vertexai-adapter-1                 |                     ^^^^^^^^^^^^^^^^^^^^^^^^
vertexai-adapter-1                 |   File "/app/aidial_adapter_vertexai/chat/gemini/adapter.py", line 378, in to_openai_finish_reason
vertexai-adapter-1                 |     raise FinishReasonOtherError(
vertexai-adapter-1                 |           ^^^^^^^^^^^^^^^^^^^^^^^
vertexai-adapter-1                 |   File "/app/aidial_adapter_vertexai/chat/gemini/adapter.py", line 93, in __init__
vertexai-adapter-1                 |     super().__init__(self.msg)
vertexai-adapter-1                 |                      ^^^^^^^^
vertexai-adapter-1                 | AttributeError: 'FinishReasonOtherError' object has no attribute 'msg'

@adubovik adubovik self-assigned this Dec 20, 2024
@adubovik adubovik changed the title fix: fixed bug in FinishReasonOtherError ctor fix: gemini: fixed bug in a finish reason handler Dec 20, 2024
@adubovik adubovik merged commit c76c673 into development Dec 20, 2024
7 checks passed
@adubovik adubovik deleted the fix/fixed-finish-reason-other-error branch December 20, 2024 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants