Documentation
¶
Overview ¶
Package omnillm provides a batteries-included LLM client with all official SDK providers.
This package imports omnillm-core plus all thick (SDK-based) providers, giving you full official SDK support for OpenAI, Anthropic, and Gemini out of the box.
The thick providers automatically override the thin (native HTTP) implementations in omnillm-core via the priority-based provider registry.
Usage:
import "github.com/plexusone/omnillm"
client := omnillm.NewClient(omnillm.ClientConfig{
Providers: []omnillm.ProviderConfig{
{Provider: omnillm.ProviderNameOpenAI, APIKey: os.Getenv("OPENAI_API_KEY")},
{Provider: omnillm.ProviderNameAnthropic, APIKey: os.Getenv("ANTHROPIC_API_KEY")},
{Provider: omnillm.ProviderNameGemini, APIKey: os.Getenv("GEMINI_API_KEY")},
},
})
For a lightweight alternative with minimal dependencies (thin providers only), use github.com/plexusone/omnillm-core directly.
Index ¶
- Constants
- Variables
- type APIError
- type Capabilities
- type ChatClient
- type ChatCompletionChoice
- type ChatCompletionChunk
- type ChatCompletionRequest
- type ChatCompletionResponse
- type ChatCompletionStream
- type ClientConfig
- type LLMCallInfo
- type Message
- type ObservabilityHook
- type Provider
- type ProviderConfig
- type ProviderFactory
- type ProviderName
- type ResponseFormat
- type Role
- type Tool
- type ToolCall
- type ToolFunction
- type ToolSpec
- type Usage
Constants ¶
const ( ProviderNameOpenAI = core.ProviderNameOpenAI ProviderNameAnthropic = core.ProviderNameAnthropic ProviderNameGemini = core.ProviderNameGemini ProviderNameXAI = core.ProviderNameXAI ProviderNameGLM = core.ProviderNameGLM ProviderNameKimi = core.ProviderNameKimi ProviderNameQwen = core.ProviderNameQwen ProviderNameOllama = core.ProviderNameOllama ProviderNameBedrock = core.ProviderNameBedrock )
Re-export provider name constants.
const ( RoleSystem = core.RoleSystem RoleUser = core.RoleUser RoleAssistant = core.RoleAssistant RoleTool = core.RoleTool )
Re-export role constants.
const ( PriorityThin = core.PriorityThin PriorityThick = core.PriorityThick )
Re-export priority constants.
Variables ¶
var ( ErrUnsupportedProvider = core.ErrUnsupportedProvider ErrInvalidConfiguration = core.ErrInvalidConfiguration ErrNoProviders = core.ErrNoProviders ErrEmptyAPIKey = core.ErrEmptyAPIKey ErrInvalidAPIKey = core.ErrInvalidAPIKey ErrEmptyModel = core.ErrEmptyModel ErrEmptyMessages = core.ErrEmptyMessages ErrStreamClosed = core.ErrStreamClosed ErrInvalidResponse = core.ErrInvalidResponse ErrRateLimitExceeded = core.ErrRateLimitExceeded ErrQuotaExceeded = core.ErrQuotaExceeded ErrInvalidRequest = core.ErrInvalidRequest ErrModelNotFound = core.ErrModelNotFound ErrServerError = core.ErrServerError ErrNetworkError = core.ErrNetworkError )
Re-export common errors.
var ( NewClient = core.NewClient NewAPIError = core.NewAPIError NewAPIErrorFull = core.NewAPIErrorFull RegisterProvider = core.RegisterProvider GetProviderFactory = core.GetProviderFactory ListRegisteredProviders = core.ListRegisteredProviders GetProviderPriority = core.GetProviderPriority ClassifyError = core.ClassifyError IsRetryableError = core.IsRetryableError IsNonRetryableError = core.IsNonRetryableError )
Re-export constructor functions.
Functions ¶
This section is empty.
Types ¶
type Capabilities ¶ added in v0.15.1
type Capabilities = core.Capabilities
Capabilities describes provider features.
type ChatCompletionChoice ¶
type ChatCompletionChoice = core.ChatCompletionChoice
ChatCompletionChoice is a single choice in a response.
type ChatCompletionChunk ¶
type ChatCompletionChunk = core.ChatCompletionChunk
ChatCompletionChunk is a streaming response chunk.
type ChatCompletionRequest ¶
type ChatCompletionRequest = core.ChatCompletionRequest
ChatCompletionRequest is the request for chat completion.
type ChatCompletionResponse ¶
type ChatCompletionResponse = core.ChatCompletionResponse
ChatCompletionResponse is the response from chat completion.
type ChatCompletionStream ¶
type ChatCompletionStream = core.ChatCompletionStream
ChatCompletionStream is the interface for streaming responses.
type ClientConfig ¶
type ClientConfig = core.ClientConfig
ClientConfig holds configuration for creating a multi-provider client.
type LLMCallInfo ¶
type LLMCallInfo = core.LLMCallInfo
LLMCallInfo provides metadata about the LLM call for observability.
type ObservabilityHook ¶
type ObservabilityHook = core.ObservabilityHook
ObservabilityHook allows external packages to observe LLM calls.
type ProviderConfig ¶
type ProviderConfig = core.ProviderConfig
ProviderConfig holds configuration for a single provider.
type ProviderFactory ¶ added in v0.15.1
type ProviderFactory = core.ProviderFactory
ProviderFactory creates providers from config.
type ResponseFormat ¶ added in v0.15.1
type ResponseFormat = core.ResponseFormat
ResponseFormat specifies the response format.
type ToolFunction ¶
type ToolFunction = core.ToolFunction
ToolFunction represents the function details of a tool call.