Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrCollectionNotFound = errors.New("collection not found")
)
Functions ¶
func ToRetriever ¶
func ToRetriever(vectorStore VectorStore, numDocs int, options ...Option) schema.Retriever
ToRetriever creates a retriever from a vector store.
Types ¶
type ContextNetwork ¶ added in v0.15.0
type ContextNetwork struct {
// Dependencies are documents that the current code imports/depends on
Dependencies []schema.Document
// Dependents are documents that import/depend on the current code (impact analysis)
Dependents []schema.Document
}
ContextNetwork represents the graph neighborhood of a piece of code
type DependencyRetriever ¶ added in v0.15.0
type DependencyRetriever struct {
// contains filtered or unexported fields
}
DependencyRetriever optimizes RAG by traversing the dependency graph
func NewDependencyRetriever ¶ added in v0.15.0
func NewDependencyRetriever(store VectorStore) *DependencyRetriever
NewDependencyRetriever creates a new graph-based retriever
func (*DependencyRetriever) GetContextNetwork ¶ added in v0.15.0
func (r *DependencyRetriever) GetContextNetwork(ctx context.Context, packageName string, imports []string) (*ContextNetwork, error)
GetContextNetwork retrieves both upstream dependencies and downstream impact
type DocumentWithScore ¶
type Option ¶
type Option func(*Options)
func WithCollectionName ¶ added in v0.7.1
WithCollectionName sets the collection name for the Qdrant store.
func WithEmbedder ¶
func WithEmbedder(embedder embeddings.Embedder) Option
func WithFilter ¶
func WithFilters ¶
func WithNameSpace ¶
func WithScoreThreshold ¶
type Options ¶
type Options struct {
Embedder embeddings.Embedder
NameSpace string
CollectionName string
ScoreThreshold float32
Filters map[string]any
}
func ParseOptions ¶
type RerankingRetriever ¶ added in v0.15.0
type RerankingRetriever struct {
Retriever schema.Retriever
Reranker schema.Reranker
TopK int // Final number of documents to return after reranking
}
RerankingRetriever wraps a standard retriever and uses a reranker to refine results.
func (RerankingRetriever) GetRelevantDocuments ¶ added in v0.15.0
func (RerankingRetriever) GetRelevantScoredDocuments ¶ added in v0.15.0
func (r RerankingRetriever) GetRelevantScoredDocuments(ctx context.Context, query string) ([]schema.ScoredDocument, error)
type Retriever ¶
type Retriever interface {
GetRelevantDocuments(ctx context.Context, query string) ([]schema.Document, error)
}
Retriever is the interface for fetching relevant documents for a query.
type ScoredRetriever ¶ added in v0.15.0
type ScoredRetriever interface {
GetRelevantScoredDocuments(ctx context.Context, query string) ([]schema.ScoredDocument, error)
}
ScoredRetriever is a retriever that returns documents with relevance scores.
type VectorStore ¶
type VectorStore interface {
AddDocuments(ctx context.Context, docs []schema.Document, options ...Option) ([]string, error)
SimilaritySearch(ctx context.Context, query string, numDocuments int, options ...Option) ([]schema.Document, error)
SimilaritySearchBatch(ctx context.Context, queries []string, numDocuments int, options ...Option) ([][]schema.Document, error)
SimilaritySearchWithScores(ctx context.Context, query string, numDocuments int, options ...Option) ([]DocumentWithScore, error)
ListCollections(ctx context.Context) ([]string, error)
DeleteCollection(ctx context.Context, collectionName string) error
DeleteDocumentsByFilter(ctx context.Context, filters map[string]any, options ...Option) error
}
Click to show internal directories.
Click to hide internal directories.