Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
Change-Id: I8f6f9389f1cae0a7c934217968d4e2e20bb9590e
  • Loading branch information
MarkDaoust committed Sep 9, 2024
1 parent 165aeb0 commit 7e617bc
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions samples/controlled_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,12 @@ class Recipe(TypedDict):
recipe_name: str
grade: Grade


model = genai.GenerativeModel("gemini-1.5-pro-latest")

result = model.generate_content(
"List about 10 cookie recipes, grade them based on popularity",
generation_config=genai.GenerationConfig(
response_mime_type="application/json",
response_schema=list[Recipe]
response_mime_type="application/json", response_schema=list[Recipe]
),
)
print(result) # [{"grade": "a+", "recipe_name": "Chocolate Chip Cookies"}, ...]
Expand All @@ -121,7 +119,6 @@ def test_json_enum_raw(self):
print(result) # "Keyboard"
# [END json_enum_raw]


def test_x_enum(self):
# [START x_enum]
import enum
Expand Down Expand Up @@ -163,5 +160,6 @@ def test_x_enum_raw(self):
print(result) # "Keyboard"
# [END x_enum_raw]


if __name__ == "__main__":
absltest.main()

0 comments on commit 7e617bc

Please sign in to comment.