Drop the database name from single-database document output

Naming one database on the command line points the configuration at it,
so no command that prints a document ever has a name to print.
This commit is contained in:
Yiorgis Gozadinos 2026-08-24 14:31:55 +03:00
parent c284d86885
commit a9e66b001b
No known key found for this signature in database
4 changed files with 4 additions and 31 deletions

View file

@ -5,7 +5,7 @@
### Added
- `api_key` on model and embedding-model config, overriding the provider's environment variable. Honored on the `openai` and `ollama` providers, `vllm` embedders and rerankers, the picture-description VLM endpoint, and `doctor`'s endpoint probes; other providers raise.
- `lancedb.databases`: a name-to-location mapping for searching several databases at once, mutually exclusive with `lancedb.uri`. `client.search(..., sources=[...])` selects which to search, `sources=None` searches all of them, and `SearchResult.source` carries the configured name a result came from. `Document.source` names it on a document from a listing or a lookup. Candidates are fused by the configured reranker over the union, or by reciprocal rank fusion when none is configured. Databases searched together must have been written with the same embedder; two that disagree raise `ConfigMismatchError`. The query is embedded once for the whole selection. `SearchResult.format_for_agent` names the database, so the model can attribute evidence to one while it answers. `haiku-rag search`, `ask`, `analyze` and `chat` cover the configured set and label each result and citation with its database; every other command works on one, named with `--database NAME` or `--db PATH`.
- `lancedb.databases`: a name-to-location mapping for searching several databases at once, mutually exclusive with `lancedb.uri`. `client.search(..., sources=[...])` selects which to search, `sources=None` searches all of them, and `SearchResult.source` carries the configured name a result came from. `Document.source` names it on a document from a listing or a lookup, so a listing that spans databases says which one each came from. Candidates are fused by the configured reranker over the union, or by reciprocal rank fusion when none is configured. Databases searched together must have been written with the same embedder; two that disagree raise `ConfigMismatchError`. The query is embedded once for the whole selection. `SearchResult.format_for_agent` names the database, so the model can attribute evidence to one while it answers. `haiku-rag search`, `ask`, `analyze` and `chat` cover the configured set and label each result and citation with its database; every other command works on one, named with `--database NAME` or `--db PATH`.
- `client.ask(..., sources=[...])` asks across the selected databases, and `Citation.source` names the one a cited chunk came from. The cite fallback for an id absent from the run's results looks only in the selected databases, so a question scoped to some cannot cite another.
- `client.analyze(..., sources=[...])` analyzes across the selected databases: the sandbox mounts their documents under one flat `/documents/{id}/` namespace, resolving each id to the database holding it, and in-code `search()` covers the same selection.

View file

@ -219,8 +219,9 @@ Candidates from each database are fused into one ranked list, by the configured
reranker where there is one and by reciprocal rank fusion otherwise. Each result
carries `source`, the name of the database it came from, and so does each
citation. A document from `list_documents`, `get_document_by_id`,
`get_document_by_uri` or `resolve_document` carries it too, whether it came from
a set or from one database named in `lancedb.databases`.
`get_document_by_uri` or `resolve_document` carries it too. Naming one database
on the command line points the configuration at it, so commands that work on one
database report no name.
**Configure a reranker when searching several databases.** Reciprocal rank fusion
compares ranks, not scores, so every database contributes its own best matches

View file

@ -850,16 +850,10 @@ class HaikuRAGApp:
if doc.title
else ""
)
database_part = (
f" [repr.attrib_name]database[/repr.attrib_name]: {doc.source}"
if doc.source
else ""
)
self.console.print(
f"[repr.attrib_name]id[/repr.attrib_name]: {doc.id} "
f"[repr.attrib_name]uri[/repr.attrib_name]: {doc.uri}"
+ title_part
+ database_part
+ f" [repr.attrib_name]meta[/repr.attrib_name]: {doc.metadata}"
)
self.console.print(

View file

@ -64,28 +64,6 @@ async def test_list_documents_prints_each_document(app, client):
assert "second" in out(app)
async def test_list_documents_names_the_database_of_each(app, client):
"""A listing spanning databases has to say which one each document is from."""
client.list_documents.return_value = [
_doc("first", source="arxiv"),
_doc("second", source="wiki"),
]
await app.list_documents()
printed = out(app)
assert "database: arxiv" in printed
assert "database: wiki" in printed
async def test_list_documents_omits_the_database_when_unnamed(app, client):
client.list_documents.return_value = [_doc("only")]
await app.list_documents()
assert "database:" not in out(app)
async def test_add_document_from_text_reports_the_new_id(app, client):
client.create_document.return_value = _doc("added body")