pipeworks_mud_mapper.services.ollama_client

Thin client for interacting with a local Ollama server.

This module isolates HTTP communication so callbacks can remain focused on UI state and response handling. It also provides a central place for timeouts and request formatting.

Functions

list_models(server_url)

Return the list of models from the Ollama server.

chat(server_url, model, messages, options)

Send a chat request to the Ollama /api/chat endpoint.

Module Contents

pipeworks_mud_mapper.services.ollama_client.list_models(server_url)[source]

Return the list of models from the Ollama server.

Parameters:

server_url (str) – Base URL for the Ollama server (e.g., http://localhost:11434).

Returns:

Raw model entries from the Ollama /api/tags endpoint.

Return type:

list[dict[str, Any]]

pipeworks_mud_mapper.services.ollama_client.chat(server_url, model, messages, options)[source]

Send a chat request to the Ollama /api/chat endpoint.

Parameters:
  • server_url (str) – Base URL for the Ollama server (e.g., http://localhost:11434).

  • model (str) – Ollama model identifier (e.g., “llama3:8b”).

  • messages (list[dict[str, str]]) – Chat message objects with role/content keys.

  • options (dict[str, Any]) – Ollama generation options (seed, temperature, etc.).

Returns:

Parsed JSON response from the Ollama server.

Return type:

dict[str, Any]