Documentation
¶
Index ¶
- Constants
- func ErrorHandler(c fiber.Ctx, err error) error
- func NewChatHandler(chatter usecase.ChatProvider, cfg appconfig.RuntimeConfig, timeoutSeconds int) *chatHandler
- func NewConfigHandler(queries systemrepo.Querier, cfg appconfig.RuntimeConfig) *configHandler
- func NewEmbedHandler(embedder usecase.EmbeddingProvider, embeddingService *usecase.EmbeddingService, ...) *embedHandler
- func NewJobHandler(riverClient *river.Client[pgx.Tx]) *jobHandler
- type APIError
- type ChatRequest
- type ChatResponse
- type ConfigResponse
- type EmbedRequest
- type EmbedResponse
- type EmbedResult
- type JobStatusResponse
- type QueuedResult
- type SetModelRequest
- type SetModelResponse
- type SetPromptRequest
Constants ¶
const ( CodeBadRequest = "bad_request" CodeNotFound = "not_found" CodeInvalidSkill = "invalid_skill" CodeTimeout = "timeout" CodeInternal = "internal" )
Error code constants
Variables ¶
This section is empty.
Functions ¶
func ErrorHandler ¶
ErrorHandler is Fiber's global error handler. Maps Go errors to HTTP responses without leaking internal details.
func NewChatHandler ¶
func NewChatHandler(chatter usecase.ChatProvider, cfg appconfig.RuntimeConfig, timeoutSeconds int) *chatHandler
NewChatHandler creates a new chat handler.
func NewConfigHandler ¶
func NewConfigHandler(queries systemrepo.Querier, cfg appconfig.RuntimeConfig) *configHandler
NewConfigHandler creates a new config handler.
func NewEmbedHandler ¶
func NewEmbedHandler(embedder usecase.EmbeddingProvider, embeddingService *usecase.EmbeddingService, riverClient *river.Client[pgx.Tx]) *embedHandler
NewEmbedHandler creates a new embed handler.
Types ¶
type ChatRequest ¶
type ChatRequest struct {
Skill string `json:"skill"`
Model string `json:"model,omitempty"`
Messages []usecase.Message `json:"messages"`
}
ChatRequest is the API request format for chat endpoints.
type ChatResponse ¶
type ChatResponse struct {
Model string `json:"model"`
Content string `json:"content"`
DurationMS float64 `json:"duration_ms"`
}
ChatResponse is the response format for blocking chat.
type ConfigResponse ¶
ConfigResponse is the response format for GET /api/v1/config.
type EmbedRequest ¶
type EmbedRequest struct {
Texts []string `json:"texts"`
}
EmbedRequest is the API request format for embedding.
type EmbedResponse ¶
type EmbedResponse struct {
Results []EmbedResult `json:"results"`
}
EmbedResponse is the response for synchronous embedding.
type EmbedResult ¶
EmbedResult represents a single embedding.
type JobStatusResponse ¶
type JobStatusResponse struct {
ID int64 `json:"id"`
Kind string `json:"kind"`
State string `json:"state"`
QueuedAt string `json:"queued_at"`
AttemptedAt *string `json:"attempted_at,omitempty"`
CompletedAt *string `json:"completed_at,omitempty"`
Error *string `json:"error,omitempty"`
}
JobStatusResponse represents the status of a River job.
type QueuedResult ¶
type QueuedResult struct {
JobID string `json:"job_id"`
Status string `json:"status"`
Count int `json:"count"`
}
QueuedResult is the response for async (queued) embedding.
type SetModelRequest ¶
type SetModelRequest struct {
Model string `json:"model"`
}
SetModelRequest is the request format for PUT /api/v1/config/models/:skill.
type SetModelResponse ¶
type SetModelResponse struct {
Skill string `json:"skill"`
Model string `json:"model"`
UpdatedAt string `json:"updated_at"`
}
SetModelResponse is the response format for setting a model.
type SetPromptRequest ¶
type SetPromptRequest struct {
OutputLength *string `json:"output_length"`
MaxTokens *int `json:"max_tokens"`
Temperature *float32 `json:"temperature"`
}
SetPromptRequest is the request format for PUT /api/v1/config/prompt.