knowledge

package
v1.10.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package knowledge defines the abstraction for knowledge retrieval providers.

It decouples Cortex from specific RAG engines (e.g., Weave) the same way the llm.Client interface decouples Cortex from specific LLM providers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CollectionInfo

type CollectionInfo struct {
	ID             string `json:"id"`
	Name           string `json:"name"`
	DocumentCount  int64  `json:"document_count"`
	ChunkCount     int64  `json:"chunk_count"`
	EmbeddingModel string `json:"embedding_model,omitempty"`
}

CollectionInfo describes an available knowledge collection.

type Provider

type Provider interface {
	// Retrieve performs a semantic search and returns scored chunks.
	Retrieve(ctx context.Context, query string, params *RetrieveParams) ([]ScoredChunk, error)

	// ListCollections returns available knowledge collections.
	ListCollections(ctx context.Context) ([]CollectionInfo, error)
}

Provider is the interface for knowledge retrieval backends. Implementations wrap specific engines (e.g., Weave) to provide knowledge to Cortex agents.

type RetrieveParams

type RetrieveParams struct {
	Collection string  // Collection name or ID to search in (empty = all).
	TopK       int     // Max results (default: 5).
	MinScore   float64 // Minimum relevance score (default: 0.0).
}

RetrieveParams configures a knowledge retrieval query.

type ScoredChunk

type ScoredChunk struct {
	Content      string            `json:"content"`
	Score        float64           `json:"score"`
	Source       string            `json:"source,omitempty"`
	DocumentID   string            `json:"document_id,omitempty"`
	CollectionID string            `json:"collection_id,omitempty"`
	Metadata     map[string]string `json:"metadata,omitempty"`
}

ScoredChunk represents a retrieved knowledge chunk with relevance score.

Directories

Path Synopsis
Package weave adapts the Weave RAG engine to the cortex knowledge.Provider interface.
Package weave adapts the Weave RAG engine to the cortex knowledge.Provider interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL