Package org.mockserver.llm.client
Class OllamaLlmClient
java.lang.Object
org.mockserver.llm.client.AbstractLlmClient
org.mockserver.llm.client.OllamaLlmClient
- All Implemented Interfaces:
LlmClient
Runtime client for a local Ollama server.
No auth, runs locally, free — the ideal first backend for proving the
end-to-end path without cloud keys, token cost, or network flakiness.
Uses the /api/chat endpoint with stream:false and pins
temperature=0 + seed=0 for reproducibility.
-
Field Summary
Fields inherited from class org.mockserver.llm.client.AbstractLlmClient
OBJECT_MAPPER -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuildCompletionRequest(LlmBackend backend, ParsedConversation prompt) Build the outbound completion request (URL path, auth headers, request body) for the given backend and prompt.parseCompletionResponse(HttpResponse response) Parse a successful provider response body into aCompletion.provider()The provider this client handles — the registry key.Methods inherited from class org.mockserver.llm.client.AbstractLlmClient
appendRoleContentMessages, postJson, readBody, resolveBaseUrl, resolveModel, writeJson
-
Constructor Details
-
OllamaLlmClient
public OllamaLlmClient()
-
-
Method Details
-
provider
Description copied from interface:LlmClientThe provider this client handles — the registry key. -
buildCompletionRequest
Description copied from interface:LlmClientBuild the outbound completion request (URL path, auth headers, request body) for the given backend and prompt. The returned request carries the socket address resolved from the backend's base URL (or the provider default). Implementations pintemperature=0and a seed where the provider supports it, for reproducibility. -
parseCompletionResponse
Description copied from interface:LlmClientParse a successful provider response body into aCompletion. Implementations should tolerate missing optional fields and never throw for a well-formed-but-sparse response; malformed bodies may throw and are handled (fail-closed) byLlmCompletionService.
-