mellea.backends.ollama
A model backend wrapping the Ollama Python SDK.
Functions
chat_response_delta_merge
mot
: the ModelOutputThunk that the deltas are being used to populated.delta
: the most recent ollama ChatResponse.
Classes
OllamaModelBackend
A model that uses the Ollama Python SDK for local inference.
Methods:
is_model_available
model_name
: The name of the model to check for (e.g., “llama2”).
- True if the model is available, False otherwise.
generate_from_context
generate_from_chat_context
.
generate_from_chat_context
Formatter
.
This implementation treats the Context
as a chat history, and uses the ollama.Client.chat()
interface to generate a completion.
This will not always work, because sometimes we want to use non-chat models.
Raises:
RuntimeError
: If not called from a thread with a running event loop.