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] content filter errors handled properly #126

Merged
merged 2 commits into from
Sep 19, 2024

Conversation

adubovik
Copy link
Collaborator

@adubovik adubovik commented Sep 18, 2024

chunk.candidates may be None or empty, when the response is blocked.
Such a response will lead to out-of-bounds index runtime error when the adapter tries to access chunk.candidates[0].

So the fixes are the following:

  1. check the existense of chunk.candidates[0] before using it,
  2. check the blocking feedback chunk.prompt_feedback and translate it to content_filter finish reason.

=====

For a test request to reproduce the blocking response - ask Gemini a question about a medium-size wiki-page referencing in the middle of it a sensitive topic.

@adubovik adubovik self-assigned this Sep 18, 2024
@adubovik
Copy link
Collaborator Author

adubovik commented Sep 18, 2024

/deploy-review

Environment URL: https://chat-ai-dial-adapter-vertexai-pr-126.nightly-test.deltixhub.io
E2E tests status: success

@adubovik
Copy link
Collaborator Author

adubovik commented Sep 18, 2024

/deploy-review

Environment URL: https://chat-ai-dial-adapter-vertexai-pr-126.nightly-test.deltixhub.io
E2E tests status: failed

@adubovik
Copy link
Collaborator Author

adubovik commented Sep 19, 2024

/deploy-review

Environment URL: https://chat-ai-dial-adapter-vertexai-pr-126.nightly-test.deltixhub.io
E2E tests status: success

@adubovik adubovik merged commit e2b8298 into development Sep 19, 2024
8 checks passed
@adubovik adubovik deleted the fix/handle-content-filter-error-for-gemini branch September 19, 2024 09:27
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