Abstract Protected _additionalProtected property to store additional provider-specific settings
Protected thinkingState tracking for streaming thinking extraction Providers should initialize this if they support thinking models
Get the current additional settings
Check if this provider supports streaming
true if streaming is supported, false otherwise
Protected apiOnly sub-classes can access the API key
Process 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
Optional callbacks: ParallelChatCompletionsCallbacksOptional callbacks for progress and individual completions
Promise resolving to an array of ChatResults in the same order as the input params
Abstract ClassifyAbstract SummarizeProtected addAdd thinking content to a chat completion message
Optional thinkingContent: stringProtected Abstract createCreate a provider-specific streaming request
Chat parameters
A stream object that can be iterated with for await
Protected extractExtract thinking content from non-streaming content This method handles case-insensitive extraction of thinking blocks
Optional thinking?: stringProtected Abstract finalizeCreate the final response object from streaming results
The complete content accumulated from all chunks
The last chunk received from the stream
The usage information (tokens, etc.)
A complete ChatResult object
Protected getProtected handleTemplate method for handling streaming chat completion This implements the common pattern across providers while delegating provider-specific logic to abstract methods.
Protected initializeProtected Abstract nonImplementation for non-streaming chat completion
Protected processProtected Abstract processProcess a streaming chunk from the provider
The raw chunk from the provider
Processed content and metadata
Optional finishOptional usage?: anyProtected resetProtected supports
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.