anibal

anibal

Ash AI tool use fails because of additionalProperties in JSON when using Google (Gemini) models

I tried to switch a PoC chat built with Ash AI from OpenAI to Google models (Gemini), and tool use broke because of the presence of additionalProperties in the JSON

It looks like in pydantic-ai they suffered a similar problem pydantic-ai Gemini Schema Generation Fails for Dynamically Created Models with List[KeyValuePair] Replacement for Dict · Issue #1469 · pydantic/pydantic-ai · GitHub

Here is a simple live tool use test with Gemini that generates the error Added a failing that fails in a live call to the Google API because of · ash-project/ash_ai@47321f3 · GitHub (generated), the error looks like:

$ mix test test/ash_ai/gemini_additional_properties_test.exs --include live_call --include live_google_ai

Running ExUnit with seed: 401571, max_cases: 16
Including tags: [:live_call, :live_google_ai]

21:30:23.677 [error] Error during chat call. Reason: %LangChain.LangChainError{type: nil, message: "Failed with status: 400", original: %Req.Response{status: 400, headers: %{"alt-svc" => ["h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000"], "content-type" => ["application/json; charset=UTF-8"], "date" => ["Mon, 23 Jun 2025 02:30:23 GMT"], "server" => ["scaffolding on HTTPServer2"], "server-timing" => ["gfet4t7; dur=415"], "transfer-encoding" => ["chunked"], "vary" => ["Origin", "X-Origin", "Referer"], "x-content-type-options" => ["nosniff"], "x-frame-options" => ["SAMEORIGIN"], "x-xss-protection" => ["0"]}, body: %{"error" => %{"code" => 400, "details" => [%{"@type" => "type.googleapis.com/google.rpc.BadRequest", "fieldViolations" => [%{"description" => "Invalid JSON payload received. Unknown name \"additionalProperties\" at 'tools[0].function_declarations[0].parameters': Cannot find field.", "field" => "tools[0].function_declarations[0].parameters"}]}], "message" => "Invalid JSON payload received. Unknown name \"additionalProperties\" at 'tools[0].function_declarations[0].parameters': Cannot find field.", "status" => "INVALID_ARGUMENT"}}, trailers: %{}, private: %{}}}

This patch (generated) Tool use is working with a live call to the Google/Gemini API · ash-project/ash_ai@89ddbd6 · GitHub fixes the error.

Not opening a PR because I am just starting to learn Elixir and I can’t really evaluate the quality of the code, despite it not being particularly complex.

Also, bumped into a different error later in the PoC app that looks related to handling a streamed response from Google, but I still need to confirm it with an isolated failing test.

Most Liked

zachdaniel

zachdaniel

Creator of Ash

we are working on support for different models, see our open issues for more info.

Last Post!

anibal

anibal

Thanks, willl check!

Where Next?

Popular in Questions Top

vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
Emily
I have VueJS GUIs with the project generated using Webpack. I have Elixir modules that will need to be used by the VueJS GUIs. I forese...
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New

Other popular topics Top

rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
AstonJ
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New

We're in Beta

About us Mission Statement