Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HandleModelsFromRegistry ¶
func HandleModelsFromRegistry(reg *registry.ModelRegistry) http.HandlerFunc
HandleModelsFromRegistry returns a handler that lists models from the model registry.
Types ¶
type ChatMessage ¶
type ChatMessage struct {
Role string `json:"role"`
Content any `json:"content"`
ToolCalls []flow.ToolCall `json:"tool_calls,omitempty"`
Name string `json:"name,omitempty"`
ToolCallID string `json:"tool_call_id,omitempty"`
}
ChatMessage represents a single message in the conversation.
type ChatRequest ¶
type ChatRequest struct {
Model string `json:"model"`
Messages []ChatMessage `json:"messages"`
Stream *bool `json:"stream,omitempty"`
Temperature *float64 `json:"temperature,omitempty"`
TopP *float64 `json:"top_p,omitempty"`
MaxTokens *int `json:"max_tokens,omitempty"`
Stop []string `json:"stop,omitempty"`
PresencePenalty *float64 `json:"presence_penalty,omitempty"`
FrequencyPenalty *float64 `json:"frequency_penalty,omitempty"`
ReasoningEffort string `json:"reasoning_effort,omitempty"`
Tools []flow.Tool `json:"tools,omitempty"`
ToolChoice any `json:"tool_choice,omitempty"`
ParallelToolCalls *bool `json:"parallel_tool_calls,omitempty"`
ImageConfig *ImageConfig `json:"image_config,omitempty"`
VideoConfig *VideoConfig `json:"video_config,omitempty"`
DeepSearch string `json:"deepsearch,omitempty"` // "default" | "deeper"
}
ChatRequest represents an OpenAI-compatible chat completion request.
type Handler ¶
type Handler struct {
ChatFlow *flow.ChatFlow
VideoFlow *flow.VideoFlow
ImageFlow *flow.ImageFlow
CacheService *cache.Service
Cfg *config.Config
Runtime *config.Runtime
ModelRegistry *registry.ModelRegistry
}
Handler holds dependencies for OpenAI-compatible API endpoints.
func (*Handler) SetupRoutes ¶
SetupRoutes registers OpenAI-compatible API endpoints on the given router.
type ImageConfig ¶
type ImageConfig struct {
N int `json:"n,omitempty"`
Size string `json:"size,omitempty"`
ResponseFormat string `json:"response_format,omitempty"`
EnableNSFW *bool `json:"enable_nsfw,omitempty"`
}
ImageConfig controls image generation in chat multimodal mode.
type ModelEntry ¶
type ModelEntry struct {
ID string `json:"id"`
Object string `json:"object"`
Created int64 `json:"created"`
OwnedBy string `json:"owned_by"`
Type string `json:"type,omitempty"`
}
ModelEntry represents a single model in the OpenAI models list.
type ModelsResponse ¶
type ModelsResponse struct {
Object string `json:"object"`
Data []ModelEntry `json:"data"`
}
ModelsResponse is the OpenAI models list response.