Package org.mockserver.llm.client


package org.mockserver.llm.client
  • Class
    Description
    Shared scaffolding for LlmClient implementations: URL parsing, base-request construction (method, path, host, scheme, custom headers) and a shared ObjectMapper.
    Runtime client for the Anthropic Messages API (POST /v1/messages, x-api-key + anthropic-version).
    Stateless, deterministic implementation of AWS Signature Version 4 (header-based Authorization header signing) using only JDK crypto primitives: MessageDigest (SHA-256) and Mac / SecretKeySpec (HmacSHA256).
    Runtime client for Azure OpenAI.
    Runtime client for Amazon Bedrock's Anthropic models (POST /model/{modelId}/invoke).
    Runtime client for the Google Gemini generateContent API.
    Declares a real LLM backend that MockServer can call as a client (the opposite direction to the mock codecs, which build outbound mock responses).
    Resolves which LlmBackend a runtime-LLM feature should use, across the three config layers (simplest first): Provider env conventions — auto-detect from OPENAI_API_KEY / ANTHROPIC_API_KEY / GEMINI_API_KEY / OLLAMA_HOST (the same vars each provider SDK reads). MockServer properties — a single default backend via mockserver.llmProvider / llmApiKey / llmModel / llmBaseUrl. Named backends JSONmockserver.llmBackendsConfig points at a JSON array of backends, selectable by name. The default backend prefers layer 2 (explicit properties) over layer 1 (env); named backends come from layer 3.
    Per-provider knowledge for calling a real LLM as a client.
    Singleton registry of LlmClient implementations keyed by Provider.
    Orchestrates an outbound completion against a real LLM backend: looks up the per-provider LlmClient, builds the request, sends it via the LlmTransport, and parses the response into a Completion.
    Transport seam for outbound runtime-LLM calls.
    LlmTransport backed by the server's NettyHttpClient.
    Runtime client for a local Ollama server.
    Runtime client for the OpenAI Chat Completions API (POST /v1/chat/completions, Authorization: Bearer).
    Runtime client for the OpenAI Responses API (POST /v1/responses, Authorization: Bearer).