Description of the bug:
I'm encountering intermittent errors when using context caching with the gemini-1.5-pro-002 model or another in the generative-ai-go library. The errors include TLS handshake timeouts and API error 400 responses.
Here are some examples of the errors I encountered:
Code to Reproduce
Here is the relevant part of my implementation:
ctx := context.Background()
argcc := &genai.CachedContent{
Expiration: genai.ExpireTimeOrTTL{
ExpireTime: time.Now().Add(1 * time.Hour),
},
Model: "gemini-1.5-pro-002",
SystemInstruction: genai.NewUserContent(genai.Text("Example system instruction")),
Contents: content, // Multiple PDFs loaded as genai.Content
}
cc, err := g.Client.CreateCachedContent(ctx, argcc)
if err != nil {
fmt.Printf("Error creating cached content: %v", err)
panic(err)
}
resp, err := g.Session.SendMessage(ctx, genai.Text("Example prompt"))
if err != nil {
fmt.Printf("Error sending message: %v", err)
panic(err)
}
Actual vs expected behavior:
I should receive the response
Any other information you'd like to share?
I'm using the latest version of the SDK.
I've already set my json credentials and Gemini API KEY.
Description of the bug:
I'm encountering intermittent errors when using context caching with the gemini-1.5-pro-002 model or another in the generative-ai-go library. The errors include TLS handshake timeouts and API error 400 responses.
Here are some examples of the errors I encountered:
Code to Reproduce
Here is the relevant part of my implementation:
Actual vs expected behavior:
I should receive the response
Any other information you'd like to share?
I'm using the latest version of the SDK.
I've already set my json credentials and Gemini API KEY.