Closed ajroetker closed 1 week ago
I tried to use the example format of the Function Responses in https://ai.google.dev/gemini-api/docs/function-calling as well but similarly get a 400 from the google apis
change from example_test.go
res, err = session.SendMessage(ctx, genai.FunctionResponse{
Name: movieTool.FunctionDeclarations[0].Name,
Response: map[string]any{
"name": "find_theaters",
"content": map[string]any{
"theaters": []any{map[string]any{
"name": "AMC Mountain View 16",
"address": "2000 W El Camino Real, Mountain View, CA 94040",
}},
"title": "Barbie",
},
},
})
if err != nil {
# session.History
&{[Which theaters in Mountain View show Barbie movie?] user}
&{[{find_theaters map[location:Mountain View, CA title:Barbie]} ] model}
---
2024/11/18 11:46:05 session.SendMessage: googleapi: Error 400:
Any insight on what might be the underlying issue? Is it a change to the FunctionResponse format?
https://github.com/google/generative-ai-go/pull/226 should fix this.
Awesome @jba thanks for the quick turnaround!
➜ git:(main) ✗ go run main.go example
{find_theaters map[location:Mountain View, CA title:Barbie]}
---
&{[Which theaters in Mountain View show Barbie movie?] user}
&{[{find_theaters map[location:Mountain View, CA title:Barbie]}] model}
---
AMC Mountain View 16 at 2000 W El Camino Real, Mountain View, CA 94040 shows Barbie.
---
it is indeed workin!
@jba Thanks for the fix! When can we expect a new release with these changes?
Description of the bug:
https://github.com/google/generative-ai-go/blob/main/genai/example_test.go#L1185-L1191 There's a panic because of an unchecked error and a nil resp, the actual SendMessage of the FunctionResponse is 400'ing Is the example just broken or are function responses not yet supported?
Actual vs expected behavior:
No response
Any other information you'd like to share?
No response