Documentation
¶
Index ¶
- Constants
- func APIKeyMiddleware(apiKey string) gin.HandlerFunc
- func NewModelsHandler(r *gin.Engine, vendorManager *ai.VendorsManager)
- func NewStrategiesHandler(r *gin.Engine)
- func Serve(registry *core.PluginRegistry, address string, apiKey string) (err error)
- func ServeOllama(registry *core.PluginRegistry, address string, version string) (err error)
- type APIConvert
- type ChatHandler
- type ChatRequest
- type ConfigHandler
- type ContextsHandler
- type FabricResponseFormat
- type Model
- type ModelDetails
- type ModelsHandler
- type OllamaMessage
- type OllamaModel
- type OllamaRequestBody
- type OllamaResponse
- type PatternApplyRequest
- type PatternsHandler
- type PromptRequest
- type SessionsHandler
- type StorageHandler
- func (h *StorageHandler[T]) Delete(c *gin.Context)
- func (h *StorageHandler[T]) Exists(c *gin.Context)
- func (h *StorageHandler[T]) Get(c *gin.Context)
- func (h *StorageHandler[T]) GetNames(c *gin.Context)
- func (h *StorageHandler[T]) Rename(c *gin.Context)
- func (h *StorageHandler[T]) Save(c *gin.Context)
- type StrategyMeta
- type StreamResponse
- type YouTubeHandler
- type YouTubeRequest
- type YouTubeResponse
Constants ¶
const APIKeyHeader = "X-API-Key"
Variables ¶
This section is empty.
Functions ¶
func APIKeyMiddleware ¶
func APIKeyMiddleware(apiKey string) gin.HandlerFunc
func NewModelsHandler ¶
func NewModelsHandler(r *gin.Engine, vendorManager *ai.VendorsManager)
func NewStrategiesHandler ¶
NewStrategiesHandler registers the /strategies GET endpoint
func ServeOllama ¶
func ServeOllama(registry *core.PluginRegistry, address string, version string) (err error)
Types ¶
type APIConvert ¶
type APIConvert struct {
// contains filtered or unexported fields
}
type ChatHandler ¶
type ChatHandler struct {
// contains filtered or unexported fields
}
func NewChatHandler ¶
func NewChatHandler(r *gin.Engine, registry *core.PluginRegistry, db *fsdb.Db) *ChatHandler
func (*ChatHandler) HandleChat ¶
func (h *ChatHandler) HandleChat(c *gin.Context)
type ChatRequest ¶
type ChatRequest struct { Prompts []PromptRequest `json:"prompts"` Language string `json:"language"` // Add Language field to bind from request domain.ChatOptions // Embed the ChatOptions from common package }
type ConfigHandler ¶
type ConfigHandler struct {
// contains filtered or unexported fields
}
ConfigHandler defines the handler for configuration-related operations
func NewConfigHandler ¶
func NewConfigHandler(r *gin.Engine, db *fsdb.Db) *ConfigHandler
func (*ConfigHandler) GetConfig ¶
func (h *ConfigHandler) GetConfig(c *gin.Context)
func (*ConfigHandler) UpdateConfig ¶
func (h *ConfigHandler) UpdateConfig(c *gin.Context)
type ContextsHandler ¶
type ContextsHandler struct { *StorageHandler[fsdb.Context] // contains filtered or unexported fields }
ContextsHandler defines the handler for contexts-related operations
func NewContextsHandler ¶
func NewContextsHandler(r *gin.Engine, contexts *fsdb.ContextsEntity) (ret *ContextsHandler)
NewContextsHandler creates a new ContextsHandler
type FabricResponseFormat ¶
type ModelDetails ¶
type ModelsHandler ¶
type ModelsHandler struct {
// contains filtered or unexported fields
}
func (*ModelsHandler) GetModelNames ¶
func (h *ModelsHandler) GetModelNames(c *gin.Context)
type OllamaMessage ¶
type OllamaModel ¶
type OllamaModel struct {
Models []Model `json:"models"`
}
type OllamaRequestBody ¶
type OllamaRequestBody struct { Messages []OllamaMessage `json:"messages"` Model string `json:"model"` Options struct { } `json:"options"` Stream bool `json:"stream"` }
type OllamaResponse ¶
type OllamaResponse struct { Model string `json:"model"` CreatedAt string `json:"created_at"` Message struct { Role string `json:"role"` Content string `json:"content"` } `json:"message"` DoneReason string `json:"done_reason,omitempty"` Done bool `json:"done"` TotalDuration int64 `json:"total_duration,omitempty"` LoadDuration int `json:"load_duration,omitempty"` PromptEvalCount int `json:"prompt_eval_count,omitempty"` PromptEvalDuration int `json:"prompt_eval_duration,omitempty"` EvalCount int `json:"eval_count,omitempty"` EvalDuration int64 `json:"eval_duration,omitempty"` }
type PatternApplyRequest ¶
type PatternApplyRequest struct { Input string `json:"input"` Variables map[string]string `json:"variables,omitempty"` }
PatternApplyRequest represents the request body for applying a pattern
type PatternsHandler ¶
type PatternsHandler struct { *StorageHandler[fsdb.Pattern] // contains filtered or unexported fields }
PatternsHandler defines the handler for patterns-related operations
func NewPatternsHandler ¶
func NewPatternsHandler(r *gin.Engine, patterns *fsdb.PatternsEntity) (ret *PatternsHandler)
NewPatternsHandler creates a new PatternsHandler
func (*PatternsHandler) ApplyPattern ¶
func (h *PatternsHandler) ApplyPattern(c *gin.Context)
ApplyPattern handles the POST /patterns/:name/apply route
func (*PatternsHandler) Get ¶
func (h *PatternsHandler) Get(c *gin.Context)
Get handles the GET /patterns/:name route - returns raw pattern without variable processing
type PromptRequest ¶
type PromptRequest struct { UserInput string `json:"userInput"` Vendor string `json:"vendor"` Model string `json:"model"` ContextName string `json:"contextName"` PatternName string `json:"patternName"` StrategyName string `json:"strategyName"` // Optional strategy name Variables map[string]string `json:"variables,omitempty"` // Pattern variables }
type SessionsHandler ¶
type SessionsHandler struct { *StorageHandler[fsdb.Session] // contains filtered or unexported fields }
SessionsHandler defines the handler for sessions-related operations
func NewSessionsHandler ¶
func NewSessionsHandler(r *gin.Engine, sessions *fsdb.SessionsEntity) (ret *SessionsHandler)
NewSessionsHandler creates a new SessionsHandler
type StorageHandler ¶
type StorageHandler[T any] struct { // contains filtered or unexported fields }
StorageHandler defines the handler for storage-related operations
func NewStorageHandler ¶
func NewStorageHandler[T any](r *gin.Engine, entityType string, storage db.Storage[T]) (ret *StorageHandler[T])
NewStorageHandler creates a new StorageHandler
func (*StorageHandler[T]) Delete ¶
func (h *StorageHandler[T]) Delete(c *gin.Context)
Delete handles the DELETE /storage/:name route
func (*StorageHandler[T]) Exists ¶
func (h *StorageHandler[T]) Exists(c *gin.Context)
Exists handles the GET /storage/exists/:name route
func (*StorageHandler[T]) Get ¶
func (h *StorageHandler[T]) Get(c *gin.Context)
Get handles the GET /storage/:name route
func (*StorageHandler[T]) GetNames ¶
func (h *StorageHandler[T]) GetNames(c *gin.Context)
GetNames handles the GET /storage/names route
func (*StorageHandler[T]) Rename ¶
func (h *StorageHandler[T]) Rename(c *gin.Context)
Rename handles the PUT /storage/rename/:oldName/:newName route
func (*StorageHandler[T]) Save ¶
func (h *StorageHandler[T]) Save(c *gin.Context)
Save handles the POST /storage/save/:name route
type StrategyMeta ¶
type StrategyMeta struct { Name string `json:"name"` Description string `json:"description"` Prompt string `json:"prompt"` }
StrategyMeta represents the minimal info about a strategy
type StreamResponse ¶
type YouTubeHandler ¶
type YouTubeHandler struct {
// contains filtered or unexported fields
}
func NewYouTubeHandler ¶
func NewYouTubeHandler(r *gin.Engine, registry *core.PluginRegistry) *YouTubeHandler
func (*YouTubeHandler) Transcript ¶
func (h *YouTubeHandler) Transcript(c *gin.Context)