Documentation
¶
Overview ¶
Package models defines shared, credential-free model metadata.
Index ¶
Constants ¶
View Source
const ( // ExtraAPI forces a protocol ("openai-responses", "anthropic-messages", ...). ExtraAPI = "api" // ExtraRemoteModelName sends a different model id on the wire. ExtraRemoteModelName = "remote_model_name" // ExtraAPIVersion is the Azure api-version query parameter. ExtraAPIVersion = "api_version" // ExtraThinkingControl is the legacy thinking encoding selector written // by older UIs: none | enable_thinking | thinking_type | chat_template_kwargs. ExtraThinkingControl = "thinking_control" // ExtraTruncatePromptTokens is the vLLM-only server-side truncation // budget for rerank, opt-in per row. It is never sent unless the operator // set it: vendors that do not implement it reject the unknown field. ExtraTruncatePromptTokens = "truncate_prompt_tokens" // LegacyTruncatePromptTokens is the embedding truncation budget the // pre-catalog OpenAI-compatible client sent whenever a row left it at 0. LegacyTruncatePromptTokens = 511 // ExtraScoreScale overrides the vendor rerank score scale for one row. // A self-hosted gateway serves whatever reranker was deployed behind it // and normalization depends on the serving configuration, not the // model family. Already-normalized 0..1 relevance uses probability; // raw logits use logit. A vendor can only state its documented default. ExtraScoreScale = "score_scale" )
Extra-config keys honoured by Resolve. They predate the catalog and stay supported so existing model rows keep working unchanged.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Capabilities ¶
type Capabilities struct {
Provider string `json:"provider"`
API api.API `json:"api" extensions:"x-agent"`
Cataloged bool `json:"cataloged" extensions:"x-agent"`
Reasoning bool `json:"reasoning" extensions:"x-agent"`
ThinkingLevels []api.ReasoningEffort `json:"thinking_levels" extensions:"x-agent"`
ThinkingFormat string `json:"thinking_format"`
Input []string `json:"input,omitempty" extensions:"x-agent"`
ContextWindow int `json:"context_window,omitempty" extensions:"x-agent"`
MaxOutputTokens int `json:"max_output_tokens,omitempty" extensions:"x-agent"`
MaxTokensField string `json:"max_tokens_field,omitempty"`
}
Capabilities is the UI-facing summary of a resolved model.
type ModelCost ¶
type ModelCost struct {
Input float64 `json:"input"`
Output float64 `json:"output"`
CacheRead float64 `json:"cache_read,omitempty"`
CacheWrite float64 `json:"cache_write,omitempty"`
Currency string `json:"currency,omitempty"`
}
ModelCost is priced per million tokens, in USD unless Currency says otherwise.
type ModelSpec ¶
type ModelSpec struct {
ID string `json:"id"`
Name string `json:"name,omitempty"`
// Type is the WeKnora model type this entry describes. Chat models with
// image input are still KnowledgeQA; the UI derives VLM eligibility from
// Input. Embedding / Rerank / ASR entries exist for the model picker.
Type types.ModelType `json:"type,omitempty"`
API api.API `json:"api,omitempty"`
// Aliases are additional ids that resolve to this entry (dated
// snapshots, vendor-prefixed names on gateways).
Aliases []string `json:"aliases,omitempty"`
// Match is a case-insensitive glob ("gpt-5*", "*deepseek-r1*") that lets
// one entry describe a family. Exact ids and aliases win over patterns;
// among patterns the longest literal prefix wins.
Match string `json:"match,omitempty"`
// Reasoning reports whether the model can emit thinking at all.
Reasoning bool `json:"reasoning"`
// Input lists accepted modalities: text, image, audio, video.
Input []string `json:"input,omitempty"`
ContextWindow int `json:"context_window,omitempty"`
MaxOutputTokens int `json:"max_output_tokens,omitempty"`
Cost *ModelCost `json:"cost,omitempty"`
// ThinkingLevels maps protocol-neutral levels to vendor values; missing
// keys inherit the vendor map. See api.ThinkingLevelMap.
ThinkingLevels api.ThinkingLevelMap `json:"thinking_levels,omitempty"`
// Compat is the protocol-specific overlay for this model (flat object,
// fields depend on API). Decoded lazily by Resolve.
Compat json.RawMessage `json:"compat,omitempty"`
// Dimension is the embedding vector width (embedding entries only).
Dimension int `json:"dimension,omitempty"`
// Deprecated hides the entry from pickers but keeps resolution working.
Deprecated bool `json:"deprecated,omitempty"`
// Source is the documentation URL the facts were taken from.
Source string `json:"source,omitempty"`
}
ModelSpec is one entry of the generated model catalog.
Only ID is required. API defaults to the vendor's API; Type defaults to KnowledgeQA. Compat is interpreted according to API (see compat.go).
func (ModelSpec) AcceptsImages ¶
AcceptsImages reports whether Input lists image.
func (ModelSpec) DisplayName ¶
DisplayName returns Name or the id.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package api holds the protocol-neutral request model shared by every wire protocol implementation (OpenAI Chat Completions, OpenAI Responses, Anthropic Messages, Google Generative AI, Ollama) plus the helpers those implementations share: SSE reading, the SSRF-safe transport, streaming tool-call assembly, prompt-cache bookkeeping and usage logging.
|
Package api holds the protocol-neutral request model shared by every wire protocol implementation (OpenAI Chat Completions, OpenAI Responses, Anthropic Messages, Google Generative AI, Ollama) plus the helpers those implementations share: SSE reading, the SSRF-safe transport, streaming tool-call assembly, prompt-cache bookkeeping and usage logging. |
|
anthropicmessages
Package anthropicmessages implements the Anthropic Messages wire protocol (https://docs.anthropic.com/en/api/messages).
|
Package anthropicmessages implements the Anthropic Messages wire protocol (https://docs.anthropic.com/en/api/messages). |
|
arkembeddings
Package arkembeddings implements Volcengine Ark's multimodal embedding shape: an input array of typed parts answering a single `data` object.
|
Package arkembeddings implements Volcengine Ark's multimodal embedding shape: an input array of typed parts answering a single `data` object. |
|
cohererank
Package cohererank implements the rerank shape Cohere defined and almost every other vendor copied: POST {base}/rerank with {model, query, documents} answering {results: [{index, relevance_score, document}]}.
|
Package cohererank implements the rerank shape Cohere defined and almost every other vendor copied: POST {base}/rerank with {model, query, documents} answering {results: [{index, relevance_score, document}]}. |
|
dashscopeembeddings
Package dashscopeembeddings implements Alibaba Model Studio's native multimodal embedding shape: input.contents, parameters.dimension, and results under output.embeddings.
|
Package dashscopeembeddings implements Alibaba Model Studio's native multimodal embedding shape: input.contents, parameters.dimension, and results under output.embeddings. |
|
dashscoperank
Package dashscoperank implements Alibaba Model Studio's native text-rerank shape: the same fields as the Cohere dialect, wrapped in input/parameters and answered under output.
|
Package dashscoperank implements Alibaba Model Studio's native text-rerank shape: the same fields as the Cohere dialect, wrapped in input/parameters and answered under output. |
|
googleembeddings
Package googleembeddings implements Gemini's batchEmbedContents: one POST carrying a request per text, answering embeddings[].values in order.
|
Package googleembeddings implements Gemini's batchEmbedContents: one POST carrying a request per text, answering embeddings[].values in order. |
|
googlegenai
Package googlegenai implements the native Google Gemini generateContent wire protocol (https://ai.google.dev/api/generate-content).
|
Package googlegenai implements the native Google Gemini generateContent wire protocol (https://ai.google.dev/api/generate-content). |
|
nimrerank
Package nimrerank implements NVIDIA NIM's retrieval reranking shape: a query object, a passages array, and rankings carrying a logit.
|
Package nimrerank implements NVIDIA NIM's retrieval reranking shape: a query object, a passages array, and rankings carrying a logit. |
|
openaichataudio
Package openaichataudio implements speech recognition served through the chat completions endpoint: one user message whose only content part is {"type": "input_audio", "input_audio": {"data": "data:<mime>;base64,..."}}, answered by an assistant message whose content is the transcript.
|
Package openaichataudio implements speech recognition served through the chat completions endpoint: one user message whose only content part is {"type": "input_audio", "input_audio": {"data": "data:<mime>;base64,..."}}, answered by an assistant message whose content is the transcript. |
|
openaicompletions
Package openaicompletions implements the OpenAI Chat Completions wire protocol.
|
Package openaicompletions implements the OpenAI Chat Completions wire protocol. |
|
openaiembeddings
Package openaiembeddings implements the embedding shape OpenAI defined and every compatible gateway copied: POST {base}/embeddings with {model, input} answering {data: [{embedding, index}]}.
|
Package openaiembeddings implements the embedding shape OpenAI defined and every compatible gateway copied: POST {base}/embeddings with {model, input} answering {data: [{embedding, index}]}. |
|
openairesponses
Package openairesponses implements the OpenAI Responses wire protocol (POST /responses).
|
Package openairesponses implements the OpenAI Responses wire protocol (POST /responses). |
|
openaitranscriptions
Package openaitranscriptions implements the speech-to-text shape OpenAI defined and the compatible servers copied: a multipart POST to {base}/audio/transcriptions carrying file and model, answering {text}, or {text, segments} when response_format is verbose_json.
|
Package openaitranscriptions implements the speech-to-text shape OpenAI defined and the compatible servers copied: a multipart POST to {base}/audio/transcriptions carrying file and model, answering {text}, or {text, segments} when response_format is verbose_json. |
|
pineconerank
Package pineconerank implements Pinecone Inference's standalone rerank API.
|
Package pineconerank implements Pinecone Inference's standalone rerank API. |
|
teirank
Package teirank implements the native Text Embeddings Inference rerank protocol.
|
Package teirank implements the native Text Embeddings Inference rerank protocol. |
|
tencentlkeap
Package tencentlkeap implements Tencent RunRerank through its official SDK.
|
Package tencentlkeap implements Tencent RunRerank through its official SDK. |
|
volcengineknowledge
Package volcengineknowledge implements Volcengine Knowledge Service rerank through its official SDK.
|
Package volcengineknowledge implements Volcengine Knowledge Service rerank through its official SDK. |
|
Package catalog loads and queries model metadata.
|
Package catalog loads and queries model metadata. |
|
Package chat exposes the Chat interface used by the application layer and builds the right protocol client for a configured model.
|
Package chat exposes the Chat interface used by the application layer and builds the right protocol client for a configured model. |
|
Package imageprep turns stored image bytes into an image a model will take: converted to a format the vendor documents and shrunk to its size limit.
|
Package imageprep turns stored image bytes into an image a model will take: converted to a format the vendor documents and shrunk to its size limit. |
|
internal
|
|
|
configcopy
Package configcopy copies exported configuration data and immutable function values.
|
Package configcopy copies exported configuration data and immutable function values. |
|
Package limiter provides a distributed, per-key concurrency governor for outbound model-provider calls.
|
Package limiter provides a distributed, per-key concurrency governor for outbound model-provider calls. |
|
Package providers registers Alibaba Cloud Model Studio (Bailian / DashScope) through its OpenAI-compatible mode.
|
Package providers registers Alibaba Cloud Model Studio (Bailian / DashScope) through its OpenAI-compatible mode. |
|
Package rerank adapts rerank protocols to application batching and score semantics.
|
Package rerank adapts rerank protocols to application batching and score semantics. |
|
Package runtime resolves one model's effective settings and assembles its authenticated endpoint.
|
Package runtime resolves one model's effective settings and assembles its authenticated endpoint. |
Click to show internal directories.
Click to hide internal directories.