Documentation
¶
Overview ¶
Package llm contains shared types for interacting with language model APIs.
Index ¶
Constants ¶
const (
// ProxyPathPrefix is where Obot serves its LLM proxy.
ProxyPathPrefix = "/api/llm-proxy/"
)
Variables ¶
This section is empty.
Functions ¶
func DatedVersionOf ¶ added in v0.28.0
DatedVersionOf reports whether id is a dated version of alias, as Anthropic names them: "claude-sonnet-4-5-20250929" is a version of "claude-sonnet-4-5", which Anthropic's API accepts as an alias of its latest version. It returns the version's date (YYYYMMDD), which orders versions.
func IsFirstPartyProvider ¶ added in v0.28.0
IsFirstPartyProvider reports whether a gateway provider serves only its own company's models.
func IsProxyPath ¶ added in v0.28.0
IsProxyPath reports whether path is on Obot's LLM proxy.
func WriteError ¶ added in v0.28.0
WriteError writes an error response to an LLM proxy request in the API format the request expects, so API clients and SDKs report the error as they would the provider's own.
Types ¶
type Dialect ¶
type Dialect string
Dialect identifies the API format used by an LLM provider.
const ( // DialectAnthropicMessages is the Anthropic Messages API format. DialectAnthropicMessages Dialect = "AnthropicMessages" // DialectOpenAIResponses is the OpenAI Responses API format. DialectOpenAIResponses Dialect = "OpenAIResponses" // DialectOpenResponses is the provider-neutral OpenResponses API format. DialectOpenResponses Dialect = "OpenResponses" // DialectOpenAIChatCompletions is the OpenAI Chat Completions API format. DialectOpenAIChatCompletions Dialect = "OpenAIChatCompletions" )
func ErrorDialect ¶ added in v0.28.0
ErrorDialect is the API format an LLM proxy request expects its errors in: Anthropic's for the Messages API and for Anthropic clients (which send anthropic-version on every request, including model listing), and OpenAI's otherwise.