Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddOllamaRoutes ¶
func AddOllamaRoutes(mux *http.ServeMux, deps CompatDeps)
func AddOpenAIRoutes ¶
func AddOpenAIRoutes(mux *http.ServeMux, deps CompatDeps)
AddOpenAIRoutes registers the OpenAI-compatible routes on mux (apiMux, paths without /api prefix). Existing GET /openai/v1/models routes are NOT registered here — they already exist in backendapi.
func AddRootRoutes ¶
func AddRootRoutes(mux *http.ServeMux, deps CompatDeps)
AddRootRoutes registers root-level /v1/* aliases on rootMux for clients that set api_url: http://host (e.g. tools pointed at port 11434 expecting OpenAI-compat routes).
Types ¶
type ChatCompletionRequest ¶
type ChatCompletionRequest struct {
Model string `json:"model"`
Messages []ChatMessage `json:"messages"`
Stream bool `json:"stream"`
Temperature *float64 `json:"temperature,omitempty"`
MaxTokens *int `json:"max_tokens,omitempty"`
MaxCompletionTokens *int `json:"max_completion_tokens,omitempty"`
Stop []string `json:"stop,omitempty"`
}
ChatCompletionRequest is the OpenAI /v1/chat/completions request body.
type ChatMessage ¶
ChatMessage is a single message in the OpenAI chat format.
type CompatDeps ¶
type CompatDeps struct {
Agent agentservice.Agent
Chains taskchainservice.Service
StateService stateservice.Service
DefaultChainRef string
DefaultFIMChainRef string
DefaultModel string
DefaultProvider string
DefaultMaxTokens string
Auth middleware.AuthZReader // nil = no auth required on compat routes
Token string // protects root-level mutating compat routes when set
}
CompatDeps holds the dependencies required by the OpenAI/Ollama compat handlers.
type FIMCompletionRequest ¶
type FIMCompletionRequest struct {
Model string `json:"model"`
Prompt string `json:"prompt"`
Suffix string `json:"suffix,omitempty"`
Temperature *float64 `json:"temperature,omitempty"`
MaxTokens *int `json:"max_tokens,omitempty"`
Stream bool `json:"stream"`
Stop []string `json:"stop,omitempty"`
}
FIMCompletionRequest is the OpenAI /v1/fim/completions (and legacy /v1/completions) request body.