Class AnthropicLlmClient

java.lang.Object
org.mockserver.llm.client.AbstractLlmClient
org.mockserver.llm.client.AnthropicLlmClient
All Implemented Interfaces:
LlmClient
Direct Known Subclasses:
BedrockLlmClient

public class AnthropicLlmClient extends AbstractLlmClient
Runtime client for the Anthropic Messages API (POST /v1/messages, x-api-key + anthropic-version). System messages are hoisted to the top-level system parameter as Anthropic requires.
  • Constructor Details

    • AnthropicLlmClient

      public AnthropicLlmClient()
  • Method Details

    • provider

      public Provider provider()
      Description copied from interface: LlmClient
      The provider this client handles — the registry key.
    • buildCompletionRequest

      public HttpRequest buildCompletionRequest(LlmBackend backend, ParsedConversation prompt)
      Description copied from interface: LlmClient
      Build 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 pin temperature=0 and a seed where the provider supports it, for reproducibility.
    • parseCompletionResponse

      public Completion parseCompletionResponse(HttpResponse response)
      Description copied from interface: LlmClient
      Parse a successful provider response body into a Completion. 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) by LlmCompletionService.