diff options
| author | Max Resnick <max@ofmax.li> | 2025-02-04 22:22:55 -0800 |
|---|---|---|
| committer | Max Resnick <max@ofmax.li> | 2025-02-04 22:22:55 -0800 |
| commit | 21f54bd0d623563436d506b6f855ba39cb7ea078 (patch) | |
| tree | 4fb9720e88097ce7f24fe01dd165fe4fa2a1b6fa /py/types.py | |
| parent | c8162fc43a748a97aab4647be2f5cdf50bc739ea (diff) | |
| download | vim-ai-21f54bd0d623563436d506b6f855ba39cb7ea078.tar.gz | |
feat: update to handle newer messagesCHECKPOINTprovider-config-poc
Diffstat (limited to 'py/types.py')
| -rw-r--r-- | py/types.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/py/types.py b/py/types.py index 819afe5..4eb0ccc 100644 --- a/py/types.py +++ b/py/types.py @@ -1,5 +1,5 @@ from collections.abc import Sequence, Mapping -from typing import TypedDict, Protocol +from typing import TypedDict, Literal, Union, List class AIProvider(Protocol): @@ -15,3 +15,18 @@ class Message(TypedDict): content: str type: str + +class TextContent(TypedDict): + type: Literal['text'] + text: str + +class ImageUrlContent(TypedDict): + type: Literal['image_url'] + image_url: dict[str, str] # {'url': str} + +MessageContent = Union[TextContent, ImageUrlContent] + +class Message(TypedDict): + role: Literal['system', 'user', 'assistant'] + content: List[MessageContent] + |