core

package
v0.35.0 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chunk

type Chunk struct {
	ID        string
	Text      string
	Namespace string
	Metadata  map[string]any
}

Chunk 表示切分后的最小文本单元。

type IngestRequest

type IngestRequest struct {
	ID        string         // 文档 ID,可为空则自动生成
	Text      string         // 原文文本
	Namespace string         // 命名空间,可为空使用默认
	Metadata  map[string]any // 自定义元数据
}

IngestRequest 描述一次知识摄入请求(轻量模型)。

type Pipeline

type Pipeline struct {
	// contains filtered or unexported fields
}

Pipeline 提供最小 ingest/search 能力,不依赖高级特性。

func NewPipeline

func NewPipeline(cfg PipelineConfig) (*Pipeline, error)

NewPipeline 创建管线实例。

func (*Pipeline) Ingest

func (p *Pipeline) Ingest(ctx context.Context, req IngestRequest) ([]Chunk, error)

Ingest 将文本切分并写入向量库。

func (*Pipeline) Search

func (p *Pipeline) Search(ctx context.Context, query string, topK int, metadata map[string]any) ([]SearchHit, error)

Search 执行向量检索。

type PipelineConfig

type PipelineConfig struct {
	Store       vector.VectorStore
	Embedder    vector.Embedder
	Namespace   string
	DefaultTopK int
}

PipelineConfig 轻量 RAG 管线配置。

type SearchHit

type SearchHit struct {
	ID       string
	Score    float64
	Text     string
	Metadata map[string]any
}

SearchHit 表示一次检索命中。

Jump to

Keyboard shortcuts

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