Files
OpenJarvis/examples/doc_qa
Jon Saad-FalconandClaude Opus 4.6 880e3f67f2 feat: feature gap closure — streaming SDK, parallel tools, structured output, Docker sandbox, session checkpoints, 5 hero demos
Closes the remaining feature gaps vs Qwen-Agent, CoPaw, Google ADK, Apple FM SDK, and LFM2:

SDK:
- Add ask_stream() and ask_full_stream() async generator methods to Jarvis class

Orchestrator:
- Parallel tool execution via ThreadPoolExecutor (parallel_tools=True by default)

Engine:
- ResponseFormat dataclass for structured output / JSON mode
- OpenAI, Anthropic, Google, and Ollama structured output support

Tools:
- DockerCodeInterpreterTool (code_interpreter_docker) with sandboxed execution
- sandbox-docker optional dependency

Rust:
- Session checkpointing with checkpoint(), rewind(), list_checkpoints()

Examples (5 hero demo apps):
- browser_assistant — web browsing agent
- security_scanner — project security auditor
- daily_digest — morning news briefing
- doc_qa — document Q&A with memory indexing
- multi_model_router — cost-optimized model routing

Docs:
- 10 copy-paste code snippets page
- "What You Can Build" quickstart section

Tests: 275 Python tests pass, 392 Rust tests pass, lint clean.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 04:47:24 +00:00
..

Document QA

Index a directory of documents into OpenJarvis memory and answer questions with context-augmented retrieval and citations.

Requirements

  • OpenJarvis installed (pip install openjarvis or uv sync --extra dev)
  • An inference engine running (Ollama, cloud API, vLLM, etc.)
  • A memory backend available (SQLite is the built-in default)

Usage

python examples/doc_qa/doc_qa.py --help
python examples/doc_qa/doc_qa.py --docs-path ./docs --query "How does authentication work?"
python examples/doc_qa/doc_qa.py --docs-path ./papers --query "What are the main findings?" \
    --model gpt-4o --engine cloud --chunk-size 256 --top-k 10

How It Works

The script performs two steps:

  1. Index -- Uses Jarvis.memory.index() to chunk the documents at --docs-path and store them in the memory backend. Each chunk is stored with its source path so answers can cite specific files.

  2. Ask -- Uses j.ask(query, context=True) which automatically retrieves the most relevant chunks from memory and injects them as context before sending the query to the model. The model produces an answer grounded in the retrieved documents.

This is the retrieval-augmented generation (RAG) pattern built into the OpenJarvis SDK. Adjust --chunk-size and --top-k to tune the retrieval quality for your documents.