From d528a92d1f25448dd9a808bd5506c5c97d6345a0 Mon Sep 17 00:00:00 2001 From: Pedro Dias <petermdias@gmail.com> Date: Fri, 9 Feb 2024 16:04:44 +0000 Subject: [PATCH] OllamaMultiModal kwargs (#10541) --- llama_index/multi_modal_llms/ollama.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/llama_index/multi_modal_llms/ollama.py b/llama_index/multi_modal_llms/ollama.py index 5bff2ba72a..4d56c13274 100644 --- a/llama_index/multi_modal_llms/ollama.py +++ b/llama_index/multi_modal_llms/ollama.py @@ -106,7 +106,9 @@ class OllamaMultiModal(MultiModalLLM): import ollama ollama_messages = _messages_to_dicts(messages) - response = ollama.chat(model=self.model, messages=ollama_messages, stream=False) + response = ollama.chat( + model=self.model, messages=ollama_messages, stream=False, **kwargs + ) return ChatResponse( message=ChatMessage( content=response["message"]["content"], @@ -124,7 +126,9 @@ class OllamaMultiModal(MultiModalLLM): import ollama ollama_messages = _messages_to_dicts(messages) - response = ollama.chat(model=self.model, messages=ollama_messages, stream=True) + response = ollama.chat( + model=self.model, messages=ollama_messages, stream=True, **kwargs + ) text = "" for chunk in response: if "done" in chunk and chunk["done"]: @@ -161,6 +165,7 @@ class OllamaMultiModal(MultiModalLLM): images=image_documents_to_base64(image_documents), stream=False, options=self._model_kwargs, + **kwargs, ) return CompletionResponse( text=response["response"], @@ -184,6 +189,7 @@ class OllamaMultiModal(MultiModalLLM): images=image_documents_to_base64(image_documents), stream=True, options=self._model_kwargs, + **kwargs, ) text = "" for chunk in response: -- GitLab