diff --git a/genai/example_test.go b/genai/example_test.go index 184eb7c..cd225b0 100644 --- a/genai/example_test.go +++ b/genai/example_test.go @@ -912,7 +912,10 @@ func ExampleGenerativeModel_jSONNoSchema() { model := client.GenerativeModel("gemini-1.5-pro-latest") // Ask the model to respond with JSON. model.ResponseMIMEType = "application/json" - resp, err := model.GenerateContent(ctx, genai.Text("List a few popular cookie recipes.")) + prompt := `List a few popular cookie recipes using this JSON schema: + Recipe = {'recipeName': string} + Return: Array` + resp, err := model.GenerateContent(ctx, genai.Text(prompt)) 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 92ee450..4e6a0d1 100644 --- a/genai/internal/samples/docs-snippets_test.go +++ b/genai/internal/samples/docs-snippets_test.go @@ -942,7 +942,10 @@ func ExampleGenerativeModel_jSONNoSchema() { model := client.GenerativeModel("gemini-1.5-pro-latest") // Ask the model to respond with JSON. model.ResponseMIMEType = "application/json" - resp, err := model.GenerateContent(ctx, genai.Text("List a few popular cookie recipes.")) + prompt := `List a few popular cookie recipes using this JSON schema: + Recipe = {'recipeName': string} + Return: Array` + resp, err := model.GenerateContent(ctx, genai.Text(prompt)) if err != nil { log.Fatal(err) }