mirror of
https://github.com/ollama/ollama-python.git
synced 2026-08-12 16:07:47 +00:00
examples: use type hinting generics in standard collections for structured outputs (#389)
--------- Signed-off-by: Tomoya Fujita <[email protected]> Co-authored-by: ParthSareen <[email protected]>
This commit is contained in:
co-authored by
ParthSareen
parent
4daf4afdb6
commit
7d1e002be9
@@ -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