Documentation
¶
Overview ¶
Package app wires config, stores, embedders and indexers into the running service shared by the REST API, the MCP server and the CLI.
Index ¶
- type App
- func (a *App) Close()
- func (a *App) DeleteDocument(ctx context.Context, kbName, id string) error
- func (a *App) KB(name string) (*KB, error)
- func (a *App) KBNames() []string
- func (a *App) Readiness() map[string]error
- func (a *App) Search(ctx context.Context, kbName, query string, opts SearchOpts) ([]Hit, error)
- func (a *App) SearchAll(ctx context.Context, query string, opts SearchOpts) ([]Hit, error)
- func (a *App) SetReady(kbName string, err error)
- func (a *App) StoreDocument(ctx context.Context, kbName, title, content string, metadata map[string]string) (string, error)
- type Hit
- type KB
- type SearchOpts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct {
Config *config.Config
Logger *slog.Logger
// contains filtered or unexported fields
}
func New ¶
New builds the runtime: opens every KB's store and constructs sources. It does NOT wait for embedding backends; call WaitReady from serve/index.
func (*App) DeleteDocument ¶
DeleteDocument removes a managed document from a writable KB.
func (*App) Search ¶
Search runs a hybrid query against one KB. MinScore filters on the normalized relevance (0..1).
type Hit ¶
type Hit struct {
store.Hit
KnowledgeBase string `json:"knowledge_base"`
Relevance float64 `json:"relevance"`
// RerankScore is the cross-encoder score when reranking ordered the
// results, and is nil (omitted) when fusion did. Exposed alongside
// fts_rank/vec_rank so a caller can tell which path won without a second
// query — the visibility #14 asked for.
RerankScore *float64 `json:"rerank_score,omitempty"`
}
Hit is a search result with a normalized relevance score in [0,1].
type KB ¶
type KB struct {
Config *config.KnowledgeBase
Store store.Store
Embedder *inference.Embedder
Reranker *inference.Reranker // nil when reranking is disabled
Indexer *pipeline.Indexer
Sources []source.Source
}
KB is one knowledge base's runtime.
type SearchOpts ¶ added in v0.2.0
type SearchOpts struct {
Limit int
MinScore float64
// Rerank overrides the KB default: nil = rerank when the KB has a
// reranker configured; &false disables it for this request; &true is a
// no-op when no reranker exists.
Rerank *bool
// MaxPerDoc caps how many chunks of the same document appear in the
// results. 0 = the default cap (2); negative = no cap.
MaxPerDoc int
// Filter keeps only documents whose metadata contains every given
// key/value pair (AND semantics).
Filter map[string]string
}
SearchOpts tunes one search request. Zero values mean "use defaults".
Click to show internal directories.
Click to hide internal directories.