ข้ามไปที่เนื้อหา

Deep Research

เอเจนต์วิจัยแบบ multi-hop ที่ค้นหาข้ามเอกสารที่ index ไว้ของคุณ อ้างอิงไขว้ข้อมูล และคืนคำตอบพร้อมการอ้างอิงแหล่งที่มา มันให้เหตุผลผ่านคำถามที่ซับซ้อนทีละขั้นตอน ดึงบริบทจากหลายแหล่งข้อมูลในฐานความรู้ในเครื่องของคุณ

Quickstart (5 นาที)

1. ติดตั้งและเริ่มต้น

git clone https://github.com/open-jarvis/OpenJarvis.git
cd OpenJarvis
uv sync --extra dev
jarvis init --preset deep-research

คำสั่งนี้จะเขียน ~/.openjarvis/config.toml ที่ตั้งค่าไว้ล่วงหน้าสำหรับเอเจนต์ deep research

2. Index เอกสารของคุณ

# Install Ollama: https://ollama.com
ollama pull qwen3.5:9b

# Index a directory of files
jarvis memory index ./docs/
jarvis memory index ~/Documents/papers/

OpenJarvis จะแบ่งเนื้อหาเป็นชิ้นๆ (chunk) แล้วเก็บไว้ในฐานข้อมูล SQLite/FTS5 ในเครื่อง รูปแบบไฟล์ที่รองรับ ได้แก่ .txt, .md, .pdf, .py, .json, .csv และอื่นๆ

3. ถามคำถามเชิงวิจัย

jarvis ask "Summarize all documents about transformer architectures"

เอเจนต์ deep research จะ:

  1. ค้นหา chunk ที่เกี่ยวข้องในเอกสารที่ index ไว้ของคุณ
  2. ให้เหตุผลข้ามหลายแหล่งข้อมูล (สูงสุด 8 hop)
  3. สังเคราะห์คำตอบที่สอดคล้องกัน พร้อมอ้างอิงเอกสารต้นทาง

คำสั่ง CLI

# Ask a question (uses deep_research agent by default with this config)
jarvis ask "What meetings did I have with Alice last month?"

# Explicitly specify the agent
jarvis ask --agent deep_research "Compare the approaches described in paper-a.pdf and paper-b.pdf"

# Index more documents
jarvis memory index ~/Downloads/reports/
jarvis memory index ./notes.md

# Search memory directly
jarvis memory search "project timeline"
jarvis memory search -k 20 "budget estimates"

# Check what's indexed
jarvis memory stats

เอกสารอ้างอิง Configuration

preset นี้จะเขียนสิ่งนี้ลงใน ~/.openjarvis/config.toml:

[engine]
default = "ollama"

[intelligence]
default_model = "qwen3.5:9b"
temperature = 0.3               # Low temperature for factual research

[agent]
default_agent = "deep_research"
max_turns = 8                   # Multi-hop reasoning steps

[tools]
enabled = ["knowledge_search", "knowledge_sql", "scan_chunks", "think", "web_search"]

[tools.storage]
default_backend = "sqlite"

การตั้งค่าหลัก

การตั้งค่า ค่าเริ่มต้น คำอธิบาย
intelligence.default_model qwen3.5:9b โมเดลที่ใช้ให้เหตุผล โมเดลที่ใหญ่กว่า (เช่น qwen3.5:35b) ให้ผลลัพธ์ดีกว่าสำหรับคำถามซับซ้อน
intelligence.temperature 0.3 Temperature ต่ำช่วยให้คำตอบยึดข้อเท็จจริง เพิ่มค่านี้เพื่อการสังเคราะห์ที่สร้างสรรค์มากขึ้น
agent.max_turns 8 จำนวน hop การให้เหตุผลสูงสุด เพิ่มค่านี้สำหรับงานวิจัยที่ซ้อนลึก
tools.enabled 5 tools knowledge_search (semantic), knowledge_sql (structured), scan_chunks (เรียกดู), think (พื้นที่ร่างความคิด), web_search (fallback แบบออนไลน์)
tools.storage.default_backend sqlite full-text search แบบ FTS5 รองรับ faiss, colbert, bm25 และ hybrid ด้วย

ตัวอย่างคำถาม

# Summarize across multiple documents
jarvis ask "Summarize all emails about the Q3 budget review"

# Cross-reference sources
jarvis ask "What do papers A and B agree on regarding attention mechanisms?"

# Find specific information
jarvis ask "What meetings did I have with Alice last month?"

# Extract structured data
jarvis ask "List all action items from the meeting notes in ~/Documents/meetings/"

# Research with web fallback
jarvis ask "Compare our internal benchmarks with the latest published results"

การ Index แหล่งข้อมูลที่แตกต่างกัน

ไฟล์และไดเรกทอรีในเครื่อง

# Recursively index a directory
jarvis memory index ~/Documents/

# Single file
jarvis memory index ./report.pdf

# Custom chunk size for long documents
jarvis memory index ./paper.pdf --chunk-size 1024 --chunk-overlap 128

PDF

PDF จะถูกดึงเนื้อหาและแบ่ง chunk โดยอัตโนมัติ สำหรับผลลัพธ์ที่ดีที่สุดกับ PDF ที่สแกนมา ตรวจสอบว่าผ่านการทำ OCR แล้ว

jarvis memory index ~/Papers/*.pdf

หน้าเว็บ

ใช้ tool web_search (เปิดใช้งานเป็นค่าเริ่มต้นใน config นี้) เพื่อดึงแหล่งข้อมูลออนไลน์ ตอนถามคำถาม สำหรับการ index เนื้อหาเว็บแบบถาวร ให้ดาวน์โหลดหน้าเว็บก่อน:

curl -s https://example.com/article | jarvis memory index --stdin --source "example.com"

Code Repository

jarvis memory index ./src/ --chunk-size 256

ขนาด chunk ที่เล็กกว่าเหมาะกับโค้ดมากกว่า เพราะแต่ละฟังก์ชันหรือคลาสเป็นหน่วยตามธรรมชาติ

การแก้ปัญหา

"No results found" -- ตรวจสอบว่า index เอกสารแล้วด้วย jarvis memory index ตรวจสอบเนื้อหาที่ index ไว้ด้วย jarvis memory stats

คำตอบคลุมเครือเกินไป -- ลองเพิ่ม max_turns ใน config (เช่น 12 หรือ 15) เพื่อให้เอเจนต์มีขั้นตอนการให้เหตุผลมากขึ้น หรือลองใช้โมเดลที่ใหญ่กว่าอย่าง qwen3.5:35b

การตอบกลับช้า -- เอเจนต์ค้นหาหลายรอบ แต่ละรอบมีการเรียกโมเดลหนึ่งครั้ง ลด max_turns หรือใช้โมเดลที่เล็กกว่า (qwen3.5:4b) เพื่อให้เร็วขึ้นแต่ผลลัพธ์ละเอียดน้อยลง

การค้นหาเว็บใช้งานไม่ได้ -- tool web_search ต้องการ Tavily API ติดตั้งด้วย uv sync --extra tools-search และตั้งค่า TAVILY_API_KEY

ดึง chunk ผิด -- ลอง index ใหม่ด้วยขนาด chunk ที่ต่างออกไป สำหรับเอกสารเชิงเทคนิค chunk ที่เล็กกว่า (256) มักดึงข้อมูลได้แม่นยำกว่า สำหรับข้อความเชิงบรรยาย chunk ที่ใหญ่กว่า (1024) รักษาบริบทได้มากกว่า