From 2bfb559f3eef1daeef883676e93d3ebc064945f9 Mon Sep 17 00:00:00 2001 From: Jonathan Amsterdam Date: Fri, 26 Jul 2024 09:39:41 -0400 Subject: [PATCH] genai: add explicit MIME type CreateCachedContent example (#199) The model seems to require it (even though it correctly infers that the MIME type is text/plain). Fixes #198. --- genai/example_test.go | 2 +- genai/internal/samples/docs-snippets_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/genai/example_test.go b/genai/example_test.go index 411d869..0a3f8ff 100644 --- a/genai/example_test.go +++ b/genai/example_test.go @@ -1223,7 +1223,7 @@ func ExampleCachedContent_create() { } defer client.Close() - file, err := uploadFile(ctx, client, filepath.Join(testDataDir, "a11.txt"), "") + file, err := uploadFile(ctx, client, filepath.Join(testDataDir, "a11.txt"), "text/plain") if err != nil { log.Fatal(err) } diff --git a/genai/internal/samples/docs-snippets_test.go b/genai/internal/samples/docs-snippets_test.go index 3c1ff31..23fff17 100644 --- a/genai/internal/samples/docs-snippets_test.go +++ b/genai/internal/samples/docs-snippets_test.go @@ -1262,7 +1262,7 @@ func ExampleCachedContent_create() { // [START cache_create] // [START cache_delete] - file, err := uploadFile(ctx, client, filepath.Join(testDataDir, "a11.txt"), "") + file, err := uploadFile(ctx, client, filepath.Join(testDataDir, "a11.txt"), "text/plain") if err != nil { log.Fatal(err) }