Documentation
¶
Overview ¶
Package rag is the togo RAG capability — built on the `ai` plugin. It ingests documents (chunk → embed via the configured AI provider → vector store) and answers questions by retrieving the most relevant chunks and generating with the LLM. The vector store is pluggable (RegisterStore); the default is in-memory.
Index ¶
- func RegisterStore(name string, f StoreFactory)
- type Chunk
- type Service
- func (s *Service) Answer(ctx context.Context, query string, topK int) (string, []Chunk, error)
- func (s *Service) Delete(ctx context.Context, docID string) error
- func (s *Service) Ingest(ctx context.Context, docID, text string) (int, error)
- func (s *Service) Retrieve(ctx context.Context, query string, topK int) ([]Chunk, error)
- type Store
- type StoreFactory
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterStore ¶
func RegisterStore(name string, f StoreFactory)
RegisterStore registers a vector-store driver (e.g. a pgvector plugin's init()).
Types ¶
type Chunk ¶
type Chunk struct {
ID string `json:"id"`
DocID string `json:"doc_id"`
Text string `json:"text"`
Score float32 `json:"score,omitempty"`
Vector []float32 `json:"-"`
}
Chunk is a stored, embedded slice of a document.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is the kernel-bound RAG service.
func FromKernel ¶
FromKernel returns the RAG service bound to the kernel.
Click to show internal directories.
Click to hide internal directories.