mirror of
https://github.com/ollama/ollama-python.git
synced 2026-01-13 21:57:16 +08: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:
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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user