Skip to content

Commit

Permalink
examples: use type hinting generics in standard collections for struc…
Browse files Browse the repository at this point in the history
…tured outputs (#389)


---------

Signed-off-by: Tomoya Fujita <[email protected]>
Co-authored-by: ParthSareen <[email protected]>
  • Loading branch information
fujitatomoya and ParthSareen authored Dec 20, 2024
1 parent 4daf4af commit 7d1e002
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions examples/structured-outputs-image.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from pathlib import Path
from pydantic import BaseModel
from typing import List, Optional, Literal
from typing import Literal
from ollama import chat


Expand All @@ -13,12 +13,12 @@ class Object(BaseModel):

class ImageDescription(BaseModel):
summary: str
objects: List[Object]
objects: list[Object]
scene: str
colors: List[str]
colors: list[str]
time_of_day: Literal['Morning', 'Afternoon', 'Evening', 'Night']
setting: Literal['Indoor', 'Outdoor', 'Unknown']
text_content: Optional[str] = None
text_content: str | None = None


# Get path from user input
Expand Down

0 comments on commit 7d1e002

Please sign in to comment.