Class AnthropicProvider
java.lang.Object
ai.doctruth.AnthropicProvider
- All Implemented Interfaces:
LlmProvider
Anthropic Messages API provider. Hand-rolled JDK-
HttpClient-backed implementation
per ADR 0003 — no Anthropic SDK on the classpath. Vendor wire types are confined to
ai.doctruth.internal.providers.anthropic and never appear in this class's public
surface.
non-sealed so that test code (and advanced users) can anonymously subclass to
supply canned responses or wrap behaviour. Public API is thread-safe: the underlying
AnthropicHttpClient is stateless and shares one HttpClient.
- Since:
- 0.1.0
-
Constructor Summary
ConstructorsConstructorDescriptionAnthropicProvider(String apiKey) Build a provider against the public Anthropic endpoint and "claude-sonnet-4-5".AnthropicProvider(String apiKey, URI endpoint, String model) Build a provider against an explicit endpoint and model name. -
Method Summary
Modifier and TypeMethodDescriptionapiKey()complete(ProviderRequest request) Execute one extraction call against the provider.name()Logical lower-case name of the provider, e.g.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface LlmProvider
region
-
Constructor Details
-
AnthropicProvider
Build a provider against the public Anthropic endpoint and "claude-sonnet-4-5".- Parameters:
apiKey- non-blank Anthropic API key.
-
AnthropicProvider
Build a provider against an explicit endpoint and model name. Required for users on Bedrock / Vertex Anthropic-compat endpoints, in-cluster proxies, or test harnesses.- Parameters:
apiKey- non-blank Anthropic API key.endpoint- full Messages-API URL (typically ending in/v1/messages).model- Anthropic model identifier (e.g."claude-sonnet-4-5").
-
-
Method Details
-
apiKey
-
name
Description copied from interface:LlmProviderLogical lower-case name of the provider, e.g."anthropic". Recorded intoProvenance.model()on everyExtractionResult.- Specified by:
namein interfaceLlmProvider
-
complete
Description copied from interface:LlmProviderExecute one extraction call against the provider.- Specified by:
completein interfaceLlmProvider- 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.
-