Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultEmbedderFromEnv ¶
DefaultEmbedderFromEnv creates an OpenAI-compatible embedder from environment variables:
- LLM_BASE_URL — base URL (default: http://localhost:11434/v1)
- LLM_API_KEY — API key (default: ollama)
- LLM_EMBED_MODEL — embedding model (default: nomic-embed-text)
Returns nil if LLM_BASE_URL is explicitly set to empty.
func StoreFromEnv ¶ added in v0.9.0
func StoreFromEnv() (draftrag.VectorStore, error)
StoreFromEnv reads environment variables and dispatches to the corresponding draftrag VectorStore constructor. If no backend env var is set, it returns an error naming the expected variables.
Types ¶
type CSVSource ¶
type CSVSource struct {
// contains filtered or unexported fields
}
CSVSource reads a CSV file and indexes each row as a text document via a Pipeline.
func NewCSVSource ¶
NewCSVSource creates a CSVSource for the given file path.
type DirectorySource ¶ added in v0.9.0
type DirectorySource struct {
// contains filtered or unexported fields
}
DirectorySource walks a directory and indexes all supported files via a Pipeline.
func NewDirectorySource ¶ added in v0.9.0
func NewDirectorySource(root string) *DirectorySource
NewDirectorySource creates a DirectorySource for the given directory path.
type JSONSource ¶
type JSONSource struct {
// contains filtered or unexported fields
}
JSONSource reads a JSON file and indexes its flattened content via a Pipeline.
func NewJSONSource ¶
func NewJSONSource(path string) *JSONSource
NewJSONSource creates a JSONSource for the given file path.
type KnowledgeSource ¶
type KnowledgeSource interface {
Load(ctx context.Context, pipeline *Pipeline) error
Query(ctx context.Context, query string, limit int) ([]Chunk, error)
}
KnowledgeSource is the interface for document sources that can load content into a pipeline and answer queries against the indexed data.
type PDFSource ¶
type PDFSource struct {
// contains filtered or unexported fields
}
PDFSource reads a PDF file and indexes its text content via a Pipeline.
func NewPDFSource ¶
NewPDFSource creates a PDFSource for the given file path.
type Pipeline ¶
type Pipeline struct {
// contains filtered or unexported fields
}
Pipeline wraps a draftRAG pipeline with an in-memory store. Each agent should create one shared pipeline for all its knowledge sources.
func NewPipeline ¶
NewPipeline creates a new Pipeline wrapper with an in-memory vector store.
func NewPipelineWithStore ¶ added in v0.9.0
func NewPipelineWithStore(store draftrag.VectorStore, embedder draftrag.Embedder) (*Pipeline, error)
NewPipelineWithStore creates a Pipeline using the given store and embedder.
type PipelineConfig ¶ added in v0.9.0
type PipelineConfig struct {
Store draftrag.VectorStore
Embedder draftrag.Embedder
}
PipelineConfig configures a Pipeline with an optional external store. If Store is nil, NewPipelineWithStore falls back to an in-memory store.
type TextFileSource ¶
type TextFileSource struct {
// contains filtered or unexported fields
}
TextFileSource reads a .txt file and indexes its content via a Pipeline.
func NewTextFileSource ¶
func NewTextFileSource(path string) *TextFileSource
NewTextFileSource creates a TextFileSource for the given file path.
type URLSource ¶
type URLSource struct {
// contains filtered or unexported fields
}
URLSource fetches a web page and indexes its text content via a Pipeline.
func NewURLSource ¶
NewURLSource creates a URLSource for the given URL with a default 10s timeout.