Documentation
¶
Index ¶
- type APIError
- type AddFileRequest
- type BackupMetadata
- type Client
- func (c *Client) AddFileToKnowledge(knowledgeID, fileID string) error
- func (c *Client) CreateFileFromExport(file *FileExport) error
- func (c *Client) CreateKnowledge(form *KnowledgeForm) (*KnowledgeCreateResponse, error)
- func (c *Client) CreatePrompt(prompt *PromptForm) error
- func (c *Client) ExportModels() ([]Model, error)
- func (c *Client) ExportTools() ([]Tool, error)
- func (c *Client) GetBaseURL() string
- func (c *Client) GetFile(fileID string) (*FileData, error)
- func (c *Client) GetFileWithContent(id string) (*FileExport, error)
- func (c *Client) GetKnowledgeByID(id string) (*KnowledgeBase, error)
- func (c *Client) GetModelByID(id string) (*Model, error)
- func (c *Client) ImportModels(models []Model) error
- func (c *Client) ImportTool(tool *ToolForm) error
- func (c *Client) ListFiles() ([]FileMetadata, error)
- func (c *Client) ListKnowledge() ([]KnowledgeBase, error)
- func (c *Client) ListPrompts() ([]Prompt, error)
- func (c *Client) RemoveFileFromKnowledge(knowledgeID, fileID string) error
- func (c *Client) UpdateKnowledge(id string, form *KnowledgeForm) error
- func (c *Client) UploadFile(filename string, content []byte) (*FileUploadResponse, error)
- type FileContent
- type FileData
- type FileExistsError
- type FileExport
- type FileMeta
- type FileMetadata
- type FileUploadResponse
- type KnowledgeBase
- type KnowledgeCreateResponse
- type KnowledgeData
- type KnowledgeExistsError
- type KnowledgeForm
- type KnowledgeItem
- type Model
- type ModelForm
- type ModelMeta
- type Prompt
- type PromptForm
- type Tool
- type ToolForm
- type ToolMeta
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddFileRequest ¶
type AddFileRequest struct {
FileID string `json:"file_id"`
}
AddFileRequest represents the request to add a file to knowledge base
type BackupMetadata ¶ added in v0.3.0
type BackupMetadata struct {
OpenWebUIURL string `json:"open_webui_url"`
OpenWebUIVersion string `json:"open_webui_version,omitempty"`
BackupToolVersion string `json:"backup_tool_version"`
BackupTimestamp string `json:"backup_timestamp"`
BackupType string `json:"backup_type"` // "knowledge", "model", "tool", "prompt", "file", "all"
ItemCount int `json:"item_count"`
UnifiedBackup bool `json:"unified_backup"` // true for backup-all
ContainedTypes []string `json:"contained_types,omitempty"` // ["knowledge", "model", "tool", "prompt", "file"]
}
BackupMetadata contains information about the backup
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents an HTTP client for the Open WebUI API
func (*Client) AddFileToKnowledge ¶
AddFileToKnowledge associates an uploaded file with a knowledge base
func (*Client) CreateFileFromExport ¶ added in v0.3.0
func (c *Client) CreateFileFromExport(file *FileExport) error
CreateFileFromExport uploads a file from export data
func (*Client) CreateKnowledge ¶
func (c *Client) CreateKnowledge(form *KnowledgeForm) (*KnowledgeCreateResponse, error)
CreateKnowledge creates a new knowledge base
func (*Client) CreatePrompt ¶ added in v0.3.0
func (c *Client) CreatePrompt(prompt *PromptForm) error
CreatePrompt creates a new prompt
func (*Client) ExportModels ¶ added in v0.2.0
ExportModels fetches all models via /api/v1/models/export
func (*Client) ExportTools ¶ added in v0.3.0
ExportTools fetches all tools from /api/v1/tools/export
func (*Client) GetBaseURL ¶ added in v0.3.0
GetBaseURL returns the base URL of the client
func (*Client) GetFileWithContent ¶ added in v0.3.0
func (c *Client) GetFileWithContent(id string) (*FileExport, error)
GetFileWithContent fetches a file with its full content
func (*Client) GetKnowledgeByID ¶
func (c *Client) GetKnowledgeByID(id string) (*KnowledgeBase, error)
GetKnowledgeByID fetches a specific knowledge base with its files
func (*Client) GetModelByID ¶ added in v0.2.0
GetModelByID fetches a specific model by ID
func (*Client) ImportModels ¶ added in v0.2.0
ImportModels posts models to /api/v1/models/import
func (*Client) ImportTool ¶ added in v0.3.0
ImportTool creates or imports a tool
func (*Client) ListFiles ¶ added in v0.3.0
func (c *Client) ListFiles() ([]FileMetadata, error)
ListFiles fetches all files (metadata only) from /api/v1/files/
func (*Client) ListKnowledge ¶
func (c *Client) ListKnowledge() ([]KnowledgeBase, error)
ListKnowledge fetches all knowledge bases from the API
func (*Client) ListPrompts ¶ added in v0.3.0
ListPrompts fetches all prompts from /api/v1/prompts/
func (*Client) RemoveFileFromKnowledge ¶
RemoveFileFromKnowledge removes a file from a knowledge base
func (*Client) UpdateKnowledge ¶
func (c *Client) UpdateKnowledge(id string, form *KnowledgeForm) error
UpdateKnowledge updates an existing knowledge base
func (*Client) UploadFile ¶
func (c *Client) UploadFile(filename string, content []byte) (*FileUploadResponse, error)
UploadFile uploads a file via multipart/form-data
type FileContent ¶
FileContent contains the actual file content
type FileData ¶
type FileData struct {
ID string `json:"id"`
UserID string `json:"user_id"`
Hash string `json:"hash"`
Filename string `json:"filename"`
Path string `json:"path"`
Data *FileContent `json:"data"`
Meta FileMeta `json:"meta"`
AccessControl map[string]interface{} `json:"access_control"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
}
FileData represents a complete file with content from the API
type FileExistsError ¶
type FileExistsError struct {
Path string
}
FileExistsError indicates a backup file already exists
func (*FileExistsError) Error ¶
func (e *FileExistsError) Error() string
Error implements the error interface for FileExistsError
type FileExport ¶ added in v0.3.0
type FileExport struct {
ID string `json:"id"`
UserID string `json:"user_id"`
Filename string `json:"filename"`
Meta FileMeta `json:"meta"`
Data *FileContent `json:"data"`
Hash string `json:"hash,omitempty"`
AccessControl map[string]interface{} `json:"access_control,omitempty"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
}
FileExport represents a complete file export with all metadata
type FileMeta ¶
type FileMeta struct {
Name string `json:"name"`
ContentType string `json:"content_type"`
Size int64 `json:"size"`
Data map[string]interface{} `json:"data"`
CollectionName string `json:"collection_name"`
}
FileMeta contains file-specific metadata
type FileMetadata ¶
type FileMetadata struct {
ID string `json:"id"`
Meta FileMeta `json:"meta"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
}
FileMetadata represents file metadata from the API
type FileUploadResponse ¶
type FileUploadResponse struct {
ID string `json:"id"`
UserID string `json:"user_id"`
Filename string `json:"filename"`
Meta FileMeta `json:"meta"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
}
FileUploadResponse represents the response from uploading a file
type KnowledgeBase ¶
type KnowledgeBase struct {
ID string `json:"id"`
UserID string `json:"user_id"`
Name string `json:"name"`
Description string `json:"description"`
Data *KnowledgeData `json:"data"`
Meta map[string]interface{} `json:"meta"`
AccessControl map[string]interface{} `json:"access_control"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
Files []FileMetadata `json:"files"`
}
KnowledgeBase represents a knowledge base from the API
type KnowledgeCreateResponse ¶
type KnowledgeCreateResponse struct {
ID string `json:"id"`
UserID string `json:"user_id"`
Name string `json:"name"`
Description string `json:"description"`
Data *KnowledgeData `json:"data"`
Meta map[string]interface{} `json:"meta"`
AccessControl map[string]interface{} `json:"access_control"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
}
KnowledgeCreateResponse represents the response from creating a knowledge base
type KnowledgeData ¶
type KnowledgeData struct {
FileIDs []string `json:"file_ids"`
}
KnowledgeData contains file IDs associated with the knowledge base
type KnowledgeExistsError ¶
type KnowledgeExistsError struct {
Name string
}
KnowledgeExistsError indicates a knowledge base with the name already exists
func (*KnowledgeExistsError) Error ¶
func (e *KnowledgeExistsError) Error() string
Error implements the error interface for KnowledgeExistsError
type KnowledgeForm ¶
type KnowledgeForm struct {
Name string `json:"name"`
Description string `json:"description"`
Data *KnowledgeData `json:"data,omitempty"`
AccessControl map[string]interface{} `json:"access_control,omitempty"`
}
KnowledgeForm represents the request body for creating/updating knowledge
type KnowledgeItem ¶ added in v0.2.0
type KnowledgeItem struct {
Type string `json:"type"` // "file" or "collection"
Data map[string]interface{} `json:"-"` // Raw data for flexibility
}
KnowledgeItem represents a single knowledge item (file or collection)
type Model ¶ added in v0.2.0
type Model struct {
ID string `json:"id"`
UserID string `json:"user_id"`
BaseModelID *string `json:"base_model_id"`
Name string `json:"name"`
Params map[string]interface{} `json:"params"`
Meta ModelMeta `json:"meta"`
AccessControl map[string]interface{} `json:"access_control"`
IsActive bool `json:"is_active"`
UpdatedAt int64 `json:"updated_at"`
CreatedAt int64 `json:"created_at"`
}
Model represents a model from the Open WebUI API
type ModelForm ¶ added in v0.2.0
type ModelForm struct {
ID string `json:"id"`
BaseModelID *string `json:"base_model_id,omitempty"`
Name string `json:"name"`
Params map[string]interface{} `json:"params"`
Meta ModelMeta `json:"meta"`
AccessControl map[string]interface{} `json:"access_control,omitempty"`
IsActive bool `json:"is_active"`
}
ModelForm for creating/updating models
type ModelMeta ¶ added in v0.2.0
type ModelMeta struct {
ProfileImageURL string `json:"profile_image_url,omitempty"`
Description *string `json:"description,omitempty"`
Capabilities map[string]interface{} `json:"capabilities,omitempty"`
Knowledge []map[string]interface{} `json:"knowledge,omitempty"` // Can be files or collections
Tags []string `json:"tags,omitempty"`
}
ModelMeta contains model metadata including knowledge base references
type Prompt ¶ added in v0.3.0
type Prompt struct {
Command string `json:"command"`
Title string `json:"title"`
Content string `json:"content"`
UserID string `json:"user_id,omitempty"`
AccessControl map[string]interface{} `json:"access_control,omitempty"`
UpdatedAt int64 `json:"updated_at,omitempty"`
CreatedAt int64 `json:"created_at,omitempty"`
}
Prompt represents a prompt from the Open WebUI API
type PromptForm ¶ added in v0.3.0
type PromptForm struct {
Command string `json:"command"`
Title string `json:"title"`
Content string `json:"content"`
AccessControl map[string]interface{} `json:"access_control,omitempty"`
}
PromptForm for creating/updating prompts
type Tool ¶ added in v0.3.0
type Tool struct {
ID string `json:"id"`
UserID string `json:"user_id"`
Name string `json:"name"`
Content string `json:"content"`
Meta ToolMeta `json:"meta"`
AccessControl map[string]interface{} `json:"access_control"`
UpdatedAt int64 `json:"updated_at"`
CreatedAt int64 `json:"created_at"`
}
Tool represents a tool from the Open WebUI API