Documentation
¶
Index ¶
- func ValidateDocument(path string) error
- type Client
- func (c *Client) CreateCollection(name, description string) (string, error)
- func (c *Client) DeleteCollection(collectionID string) error
- func (c *Client) ListCollections() ([]Collection, error)
- func (c *Client) UploadDocument(collectionID, name string, data []byte, contentType string) (string, error)
- type Collection
- type CollectionsError
- type Document
- type Manager
- func (m *Manager) DisableCollection(collectionID string) error
- func (m *Manager) EnableCollection(collectionID string) error
- func (m *Manager) GetActiveCollectionIDs() map[string]bool
- func (m *Manager) GetActiveCollections() []string
- func (m *Manager) ListCollections() ([]Collection, error)
- func (m *Manager) SaveConfig() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateDocument ¶
ValidateDocument checks if a document is valid for upload
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client handles xAI Collections Management API operations
func (*Client) CreateCollection ¶
CreateCollection creates a new collection
func (*Client) DeleteCollection ¶
DeleteCollection deletes a collection
func (*Client) ListCollections ¶
func (c *Client) ListCollections() ([]Collection, error)
ListCollections lists all collections
type Collection ¶
type Collection struct {
ID string `json:"collection_id"`
Name string `json:"collection_name"`
Description string `json:"description"`
CreatedAt time.Time `json:"created_at"`
DocumentCount int `json:"document_count,omitempty"`
}
Collection represents an xAI collection
type CollectionsError ¶
CollectionsError represents an API error
func (*CollectionsError) Error ¶
func (e *CollectionsError) Error() string
type Document ¶
type Document struct {
FileID string `json:"file_id"`
Name string `json:"name"`
ContentType string `json:"content_type"`
Size int64 `json:"size"`
UploadedAt time.Time `json:"uploaded_at"`
}
Document represents a document in a collection
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager provides high-level collections management
func NewManager ¶
NewManager creates a new collections manager
func (*Manager) DisableCollection ¶
DisableCollection removes a collection from the active set
func (*Manager) EnableCollection ¶
EnableCollection adds a collection to the active set
func (*Manager) GetActiveCollectionIDs ¶
GetActiveCollectionIDs returns a map of active collection IDs for quick lookup
func (*Manager) GetActiveCollections ¶
GetActiveCollections returns the list of active collection IDs
func (*Manager) ListCollections ¶
func (m *Manager) ListCollections() ([]Collection, error)
ListCollections fetches all collections from the API
func (*Manager) SaveConfig ¶
SaveConfig saves the configuration to disk