Documentation
¶
Overview ¶
Package collection defines the Collection entity.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Collection ¶
type Collection struct {
weave.Entity
ID id.CollectionID `json:"id" bun:"id,pk"`
Name string `json:"name" bun:"name,notnull"`
Description string `json:"description,omitempty" bun:"description"`
TenantID string `json:"tenant_id" bun:"tenant_id,notnull"`
AppID string `json:"app_id" bun:"app_id,notnull"`
EmbeddingModel string `json:"embedding_model" bun:"embedding_model,notnull,default:'text-embedding-3-small'"`
EmbeddingDims int `json:"embedding_dims" bun:"embedding_dims,notnull,default:1536"`
ChunkStrategy string `json:"chunk_strategy" bun:"chunk_strategy,notnull,default:'recursive'"`
ChunkSize int `json:"chunk_size" bun:"chunk_size,notnull,default:512"`
ChunkOverlap int `json:"chunk_overlap" bun:"chunk_overlap,notnull,default:50"`
Metadata map[string]string `json:"metadata" bun:"metadata,notnull,default:'{}'"`
DocumentCount int64 `json:"document_count" bun:"document_count,notnull,default:0"`
ChunkCount int64 `json:"chunk_count" bun:"chunk_count,notnull,default:0"`
}
Collection represents a named group of documents with shared embedding and chunking configuration.
type CountFilter ¶
type CountFilter struct {
// Search filters collections by name (case-insensitive substring match).
Search string
// Tenant is the old explicit tenant filter.
//
// Deprecated: the tenant comes from the context (weave.WithTenant). A non-nil value must equal it.
Tenant *string
}
CountFilter controls filtering for collection count queries.
type ListFilter ¶
type ListFilter struct {
// Search filters collections by name (case-insensitive substring match).
Search string
// Limit is the maximum number of collections to return. Zero means no limit.
Limit int
// Offset is the number of collections to skip.
Offset int
// SortDesc lists newest first. The default is oldest first, which API
// clients paging by offset already depend on.
SortDesc bool
// Tenant is the old explicit tenant filter.
//
// Deprecated: the tenant comes from the context (weave.WithTenant). A non-nil value must equal it.
Tenant *string
}
ListFilter controls pagination and filtering for collection list queries.
type Store ¶
type Store interface {
// CreateCollection persists a new collection. Its TenantID must be the
// context tenant.
CreateCollection(ctx context.Context, col *Collection) error
// GetCollection retrieves a collection by ID.
GetCollection(ctx context.Context, colID id.CollectionID) (*Collection, error)
// GetCollectionByName retrieves a collection by tenant and name.
// tenantID must equal the context tenant, else weave.ErrInvalidArgument.
GetCollectionByName(ctx context.Context, tenantID, name string) (*Collection, error)
// UpdateCollection persists changes to an existing collection.
UpdateCollection(ctx context.Context, col *Collection) error
// DeleteCollection removes a collection by ID.
DeleteCollection(ctx context.Context, colID id.CollectionID) error
// ListCollections returns collections matching the given filter.
ListCollections(ctx context.Context, filter *ListFilter) ([]*Collection, error)
// CountCollections returns the number of collections matching the given filter.
CountCollections(ctx context.Context, filter *CountFilter) (int64, error)
}
Store defines the persistence contract for collections. Every method is scoped to the context tenant; see store.Store for the rules.
Click to show internal directories.
Click to hide internal directories.