ai-agent-book 精选快照(<2MB 代码与文档,来自 github.com/bojieli/ai-agent-book)
Build latest book artifacts / build (push) Canceled after 0s
dependency resolution / resolve (3.11) (push) Canceled after 0s
dependency resolution / resolve (3.13) (push) Canceled after 0s
deploy-pages / build (push) Canceled after 0s
deploy-pages / deploy (push) Canceled after 0s
i18n consistency check / check (push) Canceled after 0s
provider adoption tests / test (chapter2/context-compression) (push) Canceled after 0s
provider adoption tests / test (chapter2/prompt-injection) (push) Canceled after 0s
provider adoption tests / test (chapter2/system-hint) (push) Canceled after 0s
provider adoption tests / test (chapter3/log-sanitization) (push) Canceled after 0s
web-search-agent tests / test (push) Canceled after 0s
web-search-agent tests / agentbook (push) Canceled after 0s

This commit is contained in:
2026-08-20 13:12:50 +00:00
commit b119135836
10275 changed files with 3284984 additions and 0 deletions
+71
View File
@@ -0,0 +1,71 @@
# Contextual Retrieval System Configuration
# Copy this file to .env and fill in your API keys
# LLM Provider Configuration
# Choose your preferred provider for context generation
# Kimi/Moonshot (Recommended for Chinese content)
MOONSHOT_API_KEY=your_kimi_api_key_here
# Doubao
ARK_API_KEY=your_doubao_api_key_here
# Alibaba Cloud Model Studio / Bailian (Qwen)
DASHSCOPE_API_KEY=your_dashscope_api_key_here
# DASHSCOPE_BASE_URL=https://dashscope-intl.aliyuncs.com/compatible-mode/v1
# OpenAI (Good for general use)
OPENAI_API_KEY=your_openai_api_key_here
# SiliconFlow
SILICONFLOW_API_KEY=your_siliconflow_api_key_here
# OpenRouter: usable as an explicit LLM_PROVIDER, and also a universal fallback
# — if the configured provider's key is missing but OPENROUTER_API_KEY is set,
# the agent auto-routes through OpenRouter (model names mapped automatically;
# set OPENROUTER_MODEL to override).
OPENROUTER_API_KEY=your_openrouter_api_key_here
# Groq (Fast inference)
GROQ_API_KEY=your_groq_api_key_here
# Together AI
TOGETHER_API_KEY=your_together_api_key_here
# DeepSeek
DEEPSEEK_API_KEY=your_deepseek_api_key_here
# Default LLM Configuration
LLM_PROVIDER=openai # Options include dashscope/qwen/bailian, kimi, doubao, openai, siliconflow, etc.
LLM_MODEL=gpt-5.6-luna # Model for context generation (use cheaper models to save cost)
LLM_TEMPERATURE=0.3 # Lower temperature for consistent context generation
LLM_MAX_TOKENS=150 # Max tokens for context generation (2-3 sentences)
# Knowledge Base Configuration
KB_TYPE=local # Options: local, dify, raptor, graphrag
KB_LOCAL_BASE_URL=http://localhost:4242 # Local retrieval pipeline URL
# Chunking Configuration
CHUNK_SIZE=2048 # Characters per chunk
MAX_CHUNK_SIZE=1024 # Maximum chunk size
CHUNK_OVERLAP=200 # Overlap between chunks
RESPECT_PARAGRAPH_BOUNDARY=true # Preserve paragraph structure
# Contextual Retrieval Settings
USE_CONTEXTUAL=true # Enable contextual retrieval by default
ENABLE_COMPARISON=false # Enable comparison mode for evaluation
CACHE_CONTEXTS=true # Cache generated contexts to reduce API calls
# Agent Configuration
AGENT_MAX_ITERATIONS=10 # Max iterations for ReAct loop
AGENT_VERBOSE=true # Enable detailed logging
CONVERSATION_HISTORY_LIMIT=20 # Number of messages to keep in history
# Performance Settings
BATCH_SIZE=10 # Number of chunks to process in parallel
MAX_WORKERS=4 # Maximum parallel workers for processing
CACHE_SIZE=1000 # Maximum number of contexts to cache
# Cost Control
MAX_CONTEXT_GENERATION_COST=10.0 # Maximum cost in USD for context generation
WARN_AT_COST=5.0 # Warn when cost exceeds this amount