Documentation update for title
This commit is contained in:
parent
73aff1695f
commit
8e2829bf0e
4 changed files with 17 additions and 4 deletions
|
|
@ -13,7 +13,8 @@ The simple QA agent answers a single question using the knowledge base. It retri
|
||||||
Key points:
|
Key points:
|
||||||
|
|
||||||
- Uses a single `search_documents` tool to fetch relevant chunks
|
- Uses a single `search_documents` tool to fetch relevant chunks
|
||||||
- Can be run with or without inline citations in the prompt
|
- Can be run with or without inline citations in the prompt (citations prefer
|
||||||
|
document titles when present, otherwise URIs)
|
||||||
- Returns a plain string answer
|
- Returns a plain string answer
|
||||||
|
|
||||||
Python usage:
|
Python usage:
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,9 @@ From file or URL:
|
||||||
```bash
|
```bash
|
||||||
haiku-rag add-src /path/to/document.pdf
|
haiku-rag add-src /path/to/document.pdf
|
||||||
haiku-rag add-src https://example.com/article.html
|
haiku-rag add-src https://example.com/article.html
|
||||||
|
|
||||||
|
# Optionally set a human‑readable title stored in the DB schema
|
||||||
|
haiku-rag add-src /mnt/data/doc1.pdf --title "Q3 Financial Report"
|
||||||
```
|
```
|
||||||
|
|
||||||
!!! note
|
!!! note
|
||||||
|
|
@ -83,6 +86,7 @@ haiku-rag ask "Who is the author of haiku.rag?" --cite
|
||||||
```
|
```
|
||||||
|
|
||||||
The QA agent will search your documents for relevant information and provide a comprehensive answer. With `--cite`, responses include citations showing which documents were used.
|
The QA agent will search your documents for relevant information and provide a comprehensive answer. With `--cite`, responses include citations showing which documents were used.
|
||||||
|
When available, citations use the document title; otherwise they fall back to the URI.
|
||||||
|
|
||||||
## Research
|
## Research
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@
|
||||||
- **Extended file format support**: Parse 40+ file formats including PDF, DOCX, HTML, Markdown, code files and more. Or add a URL!
|
- **Extended file format support**: Parse 40+ file formats including PDF, DOCX, HTML, Markdown, code files and more. Or add a URL!
|
||||||
- **MCP server**: Exposes functionality as MCP tools
|
- **MCP server**: Exposes functionality as MCP tools
|
||||||
- **CLI commands**: Access all functionality from your terminal
|
- **CLI commands**: Access all functionality from your terminal
|
||||||
|
- Add sources from text, files, or URLs, optionally with a human‑readable title
|
||||||
- **Python client**: Call `haiku.rag` from your own python applications
|
- **Python client**: Call `haiku.rag` from your own python applications
|
||||||
|
|
||||||
## Quick Start
|
## Quick Start
|
||||||
|
|
@ -42,6 +43,7 @@ async with HaikuRAG("database.lancedb") as client:
|
||||||
Or use the CLI:
|
Or use the CLI:
|
||||||
```bash
|
```bash
|
||||||
haiku-rag add "Your document content"
|
haiku-rag add "Your document content"
|
||||||
|
haiku-rag add-src /path/to/document.pdf --title "Q3 Financial Report"
|
||||||
haiku-rag search "query"
|
haiku-rag search "query"
|
||||||
haiku-rag ask "Who is the author of haiku.rag?"
|
haiku-rag ask "Who is the author of haiku.rag?"
|
||||||
haiku-rag migrate old_database.sqlite # Migrate from SQLite
|
haiku-rag migrate old_database.sqlite # Migrate from SQLite
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ From text:
|
||||||
doc = await client.create_document(
|
doc = await client.create_document(
|
||||||
content="Your document content here",
|
content="Your document content here",
|
||||||
uri="doc://example",
|
uri="doc://example",
|
||||||
|
title="My Example Document", # optional human‑readable title
|
||||||
metadata={"source": "manual", "topic": "example"}
|
metadata={"source": "manual", "topic": "example"}
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
@ -54,12 +55,16 @@ doc = await client.create_document(
|
||||||
|
|
||||||
From file:
|
From file:
|
||||||
```python
|
```python
|
||||||
doc = await client.create_document_from_source("path/to/document.pdf")
|
doc = await client.create_document_from_source(
|
||||||
|
"path/to/document.pdf", title="Project Brief"
|
||||||
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
From URL:
|
From URL:
|
||||||
```python
|
```python
|
||||||
doc = await client.create_document_from_source("https://example.com/article.html")
|
doc = await client.create_document_from_source(
|
||||||
|
"https://example.com/article.html", title="Example Article"
|
||||||
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
### Retrieving Documents
|
### Retrieving Documents
|
||||||
|
|
@ -159,6 +164,7 @@ for chunk, relevance_score in results:
|
||||||
print(f"Content: {chunk.content}")
|
print(f"Content: {chunk.content}")
|
||||||
print(f"From document: {chunk.document_id}")
|
print(f"From document: {chunk.document_id}")
|
||||||
print(f"Document URI: {chunk.document_uri}")
|
print(f"Document URI: {chunk.document_uri}")
|
||||||
|
print(f"Document Title: {chunk.document_title}") # when available
|
||||||
print(f"Document metadata: {chunk.document_meta}")
|
print(f"Document metadata: {chunk.document_meta}")
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -201,7 +207,7 @@ answer = await client.ask("Who is the author of haiku.rag?", cite=True)
|
||||||
print(answer)
|
print(answer)
|
||||||
```
|
```
|
||||||
|
|
||||||
The QA agent will search your documents for relevant information and use the configured LLM to generate a comprehensive answer. With `cite=True`, responses include citations showing which documents were used as sources.
|
The QA agent will search your documents for relevant information and use the configured LLM to generate a comprehensive answer. With `cite=True`, responses include citations showing which documents were used as sources. Citations prefer the document title when present, otherwise they use the URI.
|
||||||
|
|
||||||
The QA provider and model can be configured via environment variables (see [Configuration](configuration.md)).
|
The QA provider and model can be configured via environment variables (see [Configuration](configuration.md)).
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue