From f6093f8d6e0573550b2b46887e3a92e06c88d7e6 Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Mon, 28 Oct 2024 15:33:28 -0700 Subject: [PATCH] Ruff and mypy fixes --- llm/__init__.py | 1 + llm/models.py | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/llm/__init__.py b/llm/__init__.py index f76e2728..0ea6c242 100644 --- a/llm/__init__.py +++ b/llm/__init__.py @@ -29,6 +29,7 @@ "get_model", "get_key", "user_dir", + "Attachment", "Collection", "Conversation", "Model", diff --git a/llm/models.py b/llm/models.py index 7fe54cc4..6a602f52 100644 --- a/llm/models.py +++ b/llm/models.py @@ -81,10 +81,10 @@ def from_row(cls, row): class Prompt: prompt: str model: "Model" - attachments: Optional[List[Attachment]] = field(default_factory=list) - system: Optional[str] = None - prompt_json: Optional[str] = None - options: "Options" = field(default_factory=dict) + attachments: Optional[List[Attachment]] + system: Optional[str] + prompt_json: Optional[str] + options: "Options" def __init__( self, @@ -115,7 +115,7 @@ def prompt( self, prompt: Optional[str], *, - attachments: Attachment = None, + attachments: Optional[List[Attachment]] = None, system: Optional[str] = None, stream: bool = True, **options @@ -371,7 +371,7 @@ class Model(ABC, _get_key_mixin): # Model characteristics can_stream: bool = False - attachment_types = set() + attachment_types: Set = set() class Options(_Options): pass @@ -397,7 +397,7 @@ def prompt( self, prompt: str, *, - attachments: Attachment = None, + attachments: Optional[List[Attachment]] = None, system: Optional[str] = None, stream: bool = True, **options