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: Fix error message if there is empty string in Gemini message #164

Merged
merged 2 commits into from
Jan 3, 2025

Conversation

roman-romanov-o
Copy link
Collaborator

Currently if user will send messages like this (which is possible in chat if we stop model generation right after the first message, and run one more query after it)

{
  "messages": [
    {
      "content": "hi, what's your name?",
      "role": "user"
    },
    {
      "content": "",
      "role": "assistant"
    },
    {
      "content": "please come again?",
      "role": "user"
    }
  ]
}

Response is

{"error":{"message":"{\"error\":{\"message\":\"Invalid argument: 400 Unable to submit request because it must include at least one parts field, which describes the prompt input. Learn more: [https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/gemini\",\"type\":\"invalid_request_error\",\"code\":\"400\"}}","type":"runtime_error","code":"400"}}](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/gemini/%22,/%22type/%22:/%22invalid_request_error/%22,/%22code/%22:/%22400/%22%7D%7D%22,%22type%22:%22runtime_error%22,%22code%22:%22400%22%7D%7D)

Changed it to same ValidationError("System message content must be present") / ValidationError("User message content must be present") which we raise if content is None

@roman-romanov-o
Copy link
Collaborator Author

roman-romanov-o commented Jan 3, 2025

/deploy-review

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

@roman-romanov-o roman-romanov-o merged commit 9607524 into development Jan 3, 2025
6 checks passed
@roman-romanov-o roman-romanov-o deleted the fix/gemini-empty-string-content-fix branch January 3, 2025 13:10
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