Skip to content

Commit

Permalink
Update prompt in json_no_schema snippet
Browse files Browse the repository at this point in the history
Make this match the other language snippets. Tested the change on my machine, and the output is as expected: 

`[{"recipeName": "Chocolate Chip Cookies"}, {"recipeName": "Peanut Butter Cookies"}, {"recipeName": "Oatmeal Raisin Cookies"}, {"recipeName": "Sugar Cookies"}, {"recipeName": "Snickerdoodles"}]`
  • Loading branch information
pcoet authored Sep 12, 2024
1 parent 1aa0515 commit c7155d2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion genai/internal/samples/docs-snippets_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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<Recipe>`
resp, err := model.GenerateContent(ctx, genai.Text(prompt))
if err != nil {
log.Fatal(err)
}
Expand Down

0 comments on commit c7155d2

Please sign in to comment.