Guava.RAG.ServerRAG (Guava v0.34.0)

Copy Markdown View Source

RAG via the Guava server API (v1/rag/*). Uploads plain-text documents; the server stores and answers over them. Handles content-addressed keys and namespace scoping.

Summary

Functions

Ask a question, optionally scoped to document_keys, with optional instructions.

Derive a deterministic 16-char key from document content.

Delete a document by key.

List stored documents.

Apply a namespace prefix to a key when a namespace is set.

Sync server state to match documents.

Upload (or replace) a document by key.

Functions

ask(client, question, document_keys \\ nil, instructions \\ nil)

@spec ask(Guava.Client.t(), String.t(), [String.t()] | nil, String.t() | nil) ::
  String.t()

Ask a question, optionally scoped to document_keys, with optional instructions.

content_key(text)

@spec content_key(String.t()) :: String.t()

Derive a deterministic 16-char key from document content.

delete_document(client, key)

@spec delete_document(Guava.Client.t(), String.t()) :: :ok

Delete a document by key.

list_documents(client)

@spec list_documents(Guava.Client.t()) :: [map()]

List stored documents.

prefixed_key(ns, key)

@spec prefixed_key(String.t() | nil, String.t()) :: String.t()

Apply a namespace prefix to a key when a namespace is set.

reconcile(client, namespace, documents, ids)

@spec reconcile(Guava.Client.t(), String.t() | nil, [String.t()], [String.t()] | nil) ::
  MapSet.t()

Sync server state to match documents.

Returns the set of tracked keys. When ids is nil, keys are content hashes and unchanged documents are skipped; stale documents in the namespace are deleted.

upload_document(client, key, text)

@spec upload_document(Guava.Client.t(), String.t(), String.t()) :: map()

Upload (or replace) a document by key.