From 98b3a44b146eda011a0749c3b06513944d0c35be Mon Sep 17 00:00:00 2001 From: Josh Yan Date: Tue, 16 Jul 2024 11:39:42 -0700 Subject: [PATCH] include tool calls --- ollama/_client.py | 4 ++++ ollama/_types.py | 2 ++ 2 files changed, 6 insertions(+) diff --git a/ollama/_client.py b/ollama/_client.py index 1109aeed..75ebf0ea 100644 --- a/ollama/_client.py +++ b/ollama/_client.py @@ -109,6 +109,7 @@ def generate( raw: bool = False, format: Literal['', 'json'] = '', images: Optional[Sequence[AnyStr]] = None, + tools: Optional[Sequence[Any]] = None, options: Optional[Options] = None, keep_alive: Optional[Union[float, str]] = None, ) -> Mapping[str, Any]: ... @@ -125,6 +126,7 @@ def generate( raw: bool = False, format: Literal['', 'json'] = '', images: Optional[Sequence[AnyStr]] = None, + tools: Optional[Sequence[Any]] = None, options: Optional[Options] = None, keep_alive: Optional[Union[float, str]] = None, ) -> Iterator[Mapping[str, Any]]: ... @@ -140,6 +142,7 @@ def generate( raw: bool = False, format: Literal['', 'json'] = '', images: Optional[Sequence[AnyStr]] = None, + tools: Optional[Sequence[Any]] = None, options: Optional[Options] = None, keep_alive: Optional[Union[float, str]] = None, ) -> Union[Mapping[str, Any], Iterator[Mapping[str, Any]]]: @@ -168,6 +171,7 @@ def generate( 'stream': stream, 'raw': raw, 'images': [_encode_image(image) for image in images or []], + 'tools': tools or [], 'format': format, 'options': options or {}, 'keep_alive': keep_alive, diff --git a/ollama/_types.py b/ollama/_types.py index e29888e8..fd626346 100644 --- a/ollama/_types.py +++ b/ollama/_types.py @@ -52,6 +52,8 @@ class GenerateResponse(BaseGenerateResponse): context: Sequence[int] 'Tokenized history up to the point of the response.' + tool_calls: Sequence[Any] + 'List of tool calls made by the model.' class Message(TypedDict): """