Protected_Protected property to store additional provider-specific settings
ProtectedthinkingState tracking for streaming thinking extraction Providers should initialize this if they support thinking models
Get the current additional settings
Read only getter method to get the Anthropic client instance
ProtectedapiOnly sub-classes can access the API key
Anthropic natively supports assistant prefill
Anthropic supports streaming
ProtectedaddAdd thinking content to a chat completion message
OptionalthinkingContent: stringProcess a chat completion request. If streaming is enabled and supported, this will route to the streaming implementation.
Process multiple chat completion requests in parallel. This is useful for:
Array of chat completion parameter objects
Optionalcallbacks: ParallelChatCompletionsCallbacksOptional callbacks for progress and individual completions
Promise resolving to an array of ChatResults in the same order as the input params
Clear all additional settings This is useful for resetting the state of the provider or when switching between different configurations.
Utility method to map a MemberJunction role to OpenAI role
ProtectedcreateProtectedextractExtract thinking content from non-streaming content This method handles case-insensitive extraction of thinking blocks
ProtectedfinalizeCreate the final response from streaming results for Anthropic
ProtectedformatFormat messages for Anthropic API with caching support. Handles both text and multi-modal content (images).
Messages to format
Whether to enable caching
Formatted messages
ProtectedformatFormat system messages for Anthropic API with caching support. System messages support multi-modal content (images).
Messages to format
Whether to enable caching
Flattened array of formatted content blocks
Anthropic supports PDF and image file inputs natively.
ProtectedgetGet the thinking tag format for this provider Providers can override this to customize the thinking tag format
ProtectedhandleTemplate method for handling streaming chat completion This implements the common pattern across providers while delegating provider-specific logic to abstract methods.
ProtectedinitializeInitialize thinking stream state for streaming extraction
ProtectednonProtectedprocessProcess streaming chunk with thinking extraction This method handles case-insensitive extraction across chunk boundaries
ProtectedprocessProcess a streaming chunk from Anthropic
ProtectedresetReset streaming state for a new request. Overrides the base-class hook so
BaseLLM.handleStreamingChatCompletion calls this both at the start of a
request AND in its finally block — the latter releases accumulated
thinking buffers (which can grow to 100k+ chars on extended-thinking
outputs) and prevents state from a prior request bleeding into the next.
See audit R2-C5.
ProtectedresetReset thinking stream state
Set additional provider-specific settings Subclasses should override this method to validate required settings
Provider-specific settings
ProtectedsupportsCheck if the provider supports thinking models Providers should override this to return true if they support thinking extraction
Base class for all LLM sub-class implementations. Not all sub-classes will support all methods. If a method is not supported an exception will be thrown.