mirror of
https://github.com/kharonsec/ollama-python
synced 2026-05-10 00:52:32 +02:00
examples: use type hinting generics in standard collections for structured outputs (#389)
--------- Signed-off-by: Tomoya Fujita <Tomoya.Fujita@sony.com> Co-authored-by: ParthSareen <parth.sareen@ollama.com>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user