Documentation
¶
Index ¶
- type APIError
- type AddFileRequest
- type Client
- func (c *Client) AddFileToKnowledge(knowledgeID, fileID string) error
- func (c *Client) CreateKnowledge(form *KnowledgeForm) (*KnowledgeCreateResponse, error)
- func (c *Client) ExportModels() ([]Model, error)
- func (c *Client) GetFile(fileID string) (*FileData, 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) ListKnowledge() ([]KnowledgeBase, 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 FileMeta
- type FileMetadata
- type FileUploadResponse
- type KnowledgeBase
- type KnowledgeCreateResponse
- type KnowledgeData
- type KnowledgeExistsError
- type KnowledgeForm
- type KnowledgeItem
- type Model
- type ModelForm
- type ModelMeta
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 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) CreateKnowledge ¶
func (c *Client) CreateKnowledge(form *KnowledgeForm) (*KnowledgeCreateResponse, error)
CreateKnowledge creates a new knowledge base
func (*Client) ExportModels ¶ added in v0.2.0
ExportModels fetches all models via /api/v1/models/export
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) ListKnowledge ¶
func (c *Client) ListKnowledge() ([]KnowledgeBase, error)
ListKnowledge fetches all knowledge bases from the API
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 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