xr_ai_tools.rag#
Native tools backed by the typed document-retrieval service.
Classes#
Search parameters for retrieving relevant document passages. |
|
A document passage returned by similarity search. |
|
Ranked document passages returned for a retrieval request. |
|
Documents currently indexed by the retrieval service. |
|
Readiness and index statistics reported by the RAG service. |
|
Own the RAG-service client and document retrieval tools. |
Module Contents#
- class xr_ai_tools.rag.RetrieveRequest#
Search parameters for retrieving relevant document passages.
- query: str#
Question or search phrase to retrieve context for.
- top_k: int#
Maximum number of matching passages to return.
- classmethod query_must_not_be_blank(value: str) str#
Require visible text in the retrieval query.
- class xr_ai_tools.rag.RetrievedChunk#
A document passage returned by similarity search.
- text: str#
Retrieved document passage.
- source: str#
Source path relative to the configured document directory.
- score: float#
Cosine similarity between the query and passage.
- class xr_ai_tools.rag.RetrieveResult#
Ranked document passages returned for a retrieval request.
- results: list[RetrievedChunk]#
Matching passages in service-defined relevance order.
- class xr_ai_tools.rag.ListDocumentsResult#
Documents currently indexed by the retrieval service.
- documents: list[str]#
Source paths relative to the configured document directory.
- class xr_ai_tools.rag.RAGHealthResult#
Readiness and index statistics reported by the RAG service.
- ready: bool#
Whether the service is ready to answer retrieval requests.
- document_count: int#
Number of indexed documents.
- chunk_count: int#
Number of indexed document passages.
- class xr_ai_tools.rag.RAGTools(endpoint: str, *, timeout_s: float = 30.0)#
Own the RAG-service client and document retrieval tools.
- async get_health() RAGHealthResult#
Return detailed readiness and index statistics.
- async health() bool#
Return whether the RAG service is reachable and ready.
- async close() None#
Close the underlying service connection.