From 7d1e002be9fa4cf507b2030c9469a1871306c65b Mon Sep 17 00:00:00 2001 From: Tomoya Fujita Date: Fri, 20 Dec 2024 13:31:21 -0800 Subject: [PATCH] examples: use type hinting generics in standard collections for structured outputs (#389) --------- Signed-off-by: Tomoya Fujita Co-authored-by: ParthSareen --- examples/structured-outputs-image.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/structured-outputs-image.py b/examples/structured-outputs-image.py index 2de17b4..dbcd45f 100644 --- a/examples/structured-outputs-image.py +++ b/examples/structured-outputs-image.py @@ -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 @@ -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