google / google/generative-ai-go

Tools In Context Caching

Open
#243 0 comments 0 reactions 0 assignees View on GitHub
p2 status:triaged type:bug
Dominant language
Go
Stars
857
Forks
104
PR merge metrics
No merged PRs in 30d

Description

![Image](https://github.com/user-attachments/assets/1e972249-6f74-4ed5-8ca3-f28a48dc0cfd)

### Description of the bug:

Tools in cached content is not working. If I don't use cached content and declare the tools direct using the example below, my tools work. But if I put the tools inside of cached content (as in the attached image), the model have so many difficulty to call a tool.

Example:
```
model := client.GenerativeModel("gemini-1.5-flash-001")
model.Tools = []*genai.Tool{}
```

The PDF file have 41 pages and I have 17 tools declared, that is returned in g.ToolsDeclarations().

I execute a test, and the tools don't exists in cached content:
Code:

![Image](https://github.com/user-attachments/assets/f0a76257-0f9b-4f47-a589-57ec47139183)

Result:

![Image](https://github.com/user-attachments/assets/cf8292a5-f981-462f-a3b9-0e473b498234)

### Actual vs expected behavior:

_No response_

### Any other information you'd like to share?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.