Skip to content

Conversation

carlows
Copy link

@carlows carlows commented Jul 16, 2025

Connected to #1015

As described in the README, the google APIs have a different format for their LLMs:

messages = [
  { role: "system", content: "You are a helpful assistant." },
  { role: "user", content: "What's the weather like today?" }
  # Google Gemini and Google VertexAI expect messages in a different format:
  # { role: "user", parts: [{ text: "why is the sky blue?" }]}
]
response = llm.chat(messages: messages)
chat_completion = response.chat_completion

And the OutputFixingParser class doesn't work with Gemini 2.5-flash, as it throws the following error:

{"error"=>{"code"=>400, "message"=>"Invalid JSON payload received. Unknown name "content" at 'contents[0]': Cannot find field.", "status"=>"INVALID_ARGUMENT", "details"=>[{"@type"=>"type.googleapis.com/google.rpc.BadRequest", "fieldViolations"=>[{"field"=>"contents[0]", "description"=>"Invalid JSON payload received. Unknown name "content" at 'contents[0]': Cannot find field."}]}]}}

The goal of this PR is to use the correct format instead.

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.

1 participant