Interface LlmProvider

All Known Implementing Classes:
AnthropicProvider, DeepSeekProvider, GeminiProvider, OpenAiProvider

public sealed interface LlmProvider permits AnthropicProvider, OpenAiProvider, GeminiProvider, DeepSeekProvider
The Layer 2 backend abstraction: an LLM API client. Sealed; the only permitted implementations are the four first-class providers Anthropic, OpenAI, Gemini, and DeepSeek. New providers require a major version bump and a new permits entry.

Implementations must NOT leak vendor-SDK types through this interface (see ADR 0003). All interaction with vendor APIs goes through ai.doctruth.internal.providers.*.

Each implementation is non-sealed, which lets test code anonymously subclass to inject canned ProviderResponse values for orchestration tests, and lets advanced users wrap a provider for behaviours like in-process recording or A/B routing.

Since:
0.1.0
  • Method Summary

    Modifier and Type
    Method
    Description
    Execute one extraction call against the provider.
    Logical lower-case name of the provider, e.g.
    default Optional<String>
    Optional region identifier for the provider's deployment, e.g.
  • Method Details

    • complete

      Execute one extraction call against the provider.
      Parameters:
      request - the prepared request; never null.
      Returns:
      the provider's raw JSON response and usage metadata.
      Throws:
      ProviderException - on transport, schema, or upstream failure.
    • name

      String name()
      Logical lower-case name of the provider, e.g. "anthropic". Recorded into Provenance.model() on every ExtractionResult.
    • region

      default Optional<String> region()
      Optional region identifier for the provider's deployment, e.g. "ap-southeast-2" for AWS Bedrock-AU or "australiaeast" for Azure-OpenAI-AU. Recorded into Provenance.region() on every ExtractionResult; when the caller has data-residency requirements, this is what proves them.

      Default: empty (the four built-in providers point at their public global endpoints, which return Optional.empty()). Region-aware provider wrappers can populate this.