Weave

Go Packages

Quick reference for all Weave Go packages and their public APIs.

All Weave packages are importable from github.com/xraph/weave.

Core packages

github.com/xraph/weave

Root package. Exports context helpers, error constants, and shared types.

ExportDescription
WithTenant(ctx, id)Inject tenant ID into context
WithApp(ctx, id)Inject app ID into context
TenantFromContext(ctx)Read tenant ID from context
AppFromContext(ctx)Read app ID from context
ConfigEngine configuration struct
DefaultConfig()Returns default Config values
ErrNoStore, ErrNoEmbedder, ErrNoVectorStore, ErrNoChunkerMissing-component errors
ErrEmptyContent, ErrInvalidInputInput validation errors

github.com/xraph/weave/engine

The central Engine and all ingestion/retrieval operations.

ExportDescription
New(...Option) (*Engine, error)Create an engine
Engine.CreateCollectionCreate a collection
Engine.GetCollectionGet collection by ID
Engine.GetCollectionByNameGet collection by name
Engine.ListCollectionsList collections
Engine.DeleteCollectionDelete collection and all contents
Engine.CollectionStatsAggregate stats for a collection
Engine.IngestIngest a single document
Engine.IngestBatchIngest multiple documents
Engine.GetDocumentGet document by ID
Engine.ListDocumentsList documents
Engine.DeleteDocumentDelete document and chunks
Engine.RetrieveSemantic retrieval
Engine.HybridSearchCross-collection search
Engine.ReindexCollectionRe-embed all chunks
Engine.StopGraceful shutdown
IngestInputInput struct for Ingest
IngestResultOutput struct from Ingest
ScoredChunkRetrieved chunk with score
RetrieveOptionFunctional option for Retrieve
WithCollection, WithTopK, WithMinScore, WithStrategy, WithTenantIDRetrieve options

Interface packages

github.com/xraph/weave/chunker

type Chunker interface {
    Chunk(ctx context.Context, text string, opts *Options) ([]ChunkResult, error)
}

github.com/xraph/weave/embedder

type Embedder interface {
    Embed(ctx context.Context, texts []string) ([]EmbedResult, error)
    Dimensions() int
}

github.com/xraph/weave/loader

type Loader interface {
    Load(ctx context.Context, reader io.Reader) (*LoadResult, error)
    Supports(mimeType string) bool
}

github.com/xraph/weave/retriever

type Retriever interface {
    Retrieve(ctx context.Context, query string, opts *Options) ([]Result, error)
}

github.com/xraph/weave/store

type Store interface {
    collection.Store
    document.Store
    chunk.Store
    Migrate(ctx context.Context) error
    Ping(ctx context.Context) error
    Close() error
}

github.com/xraph/weave/vectorstore

type VectorStore interface {
    Upsert(ctx context.Context, entries []Entry) error
    Search(ctx context.Context, vector []float32, opts *SearchOptions) ([]SearchResult, error)
    Delete(ctx context.Context, ids []string) error
    DeleteByMetadata(ctx context.Context, filter map[string]string) error
}

Extension packages

github.com/xraph/weave/ext

All lifecycle hook interfaces: CollectionCreated, CollectionDeleted, IngestStarted, IngestChunked, IngestEmbedded, IngestCompleted, IngestFailed, RetrievalStarted, RetrievalCompleted, RetrievalFailed, DocumentDeleted, ReindexStarted, ReindexCompleted, Shutdown.

github.com/xraph/weave/observability

func NewMetricsExtension() *MetricsExtension
func NewMetricsExtensionWithFactory(factory gu.MetricFactory) *MetricsExtension

Assembler

github.com/xraph/weave/assembler

func New(...Option) *Assembler
func (a *Assembler) Assemble(ctx, []retriever.Result) (*AssembleResult, error)
func AssembleSimple(results []retriever.Result) string

Implementations

PackageImplementsNotes
store/memorystore.StoreIn-memory, for tests
store/postgresstore.StorePostgreSQL via bun
store/sqlitestore.StoreSQLite via bun
vectorstore/memoryvectorstore.VectorStoreBrute-force cosine similarity
vectorstore/pgvectorvectorstore.VectorStorePostgreSQL + pgvector
chunker/recursivechunker.ChunkerDefault — splits on paragraph/sentence/word
chunker/fixedchunker.ChunkerFixed token-size chunks
chunker/slidingchunker.ChunkerSliding window
chunker/semanticchunker.ChunkerTopic-coherent groups
chunker/codechunker.ChunkerFunction/class boundary splits
embedder/openaiembedder.EmbedderOpenAI text-embedding-* models
embedder/localembedder.EmbedderLocal model wrapper
retriever/similarityretriever.RetrieverCosine similarity
retriever/mmrretriever.RetrieverMaximal Marginal Relevance
retriever/hybridretriever.RetrieverDense + keyword
retriever/rerankerretriever.RetrieverTwo-stage cross-encoder
loader/textloader.LoaderPlain text
loader/markdownloader.LoaderMarkdown
loader/htmlloader.LoaderHTML
loader/csvloader.LoaderCSV
loader/jsonloader.LoaderJSON
loader/urlloader.LoaderFetches URL
loader/directoryloader.LoaderRecursive directory
extensionforge.ExtensionForge integration

ID package

github.com/xraph/weave/id

func NewCollectionID() CollectionID
func NewDocumentID() DocumentID
func NewChunkID() ChunkID

func ParseCollectionID(s string) (CollectionID, error)
func ParseDocumentID(s string) (DocumentID, error)
func ParseChunkID(s string) (ChunkID, error)

All IDs implement String() string and are based on TypeID (UUIDv7, K-sortable).

On this page