mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-04 07:29:45 +08:00
* feat: enhance error handling and logging in DocumentAdder * feat: implement robust error handling utilities for API exceptions * style: fix formatting issues * feat: implement retry logic for LLM API calls to handle rate limits and timeouts * feat: enhance document validation and error handling in file uploads * feat: enhance valid tools configuration and error handling in project structure * feat: refactor error handling and validation functions for improved robustness * fix: pre-commit format * feat: implement configuration validation for tool consistency and enhance error handling in file uploads * feat: add exception hierarchy for LLM service errors to improve error handling * chore: update repo roster images [skip ci] * chore: update repo roster images [skip ci] * Integrate documentation updates and rebase onto upstream dev * Implement error handling utilities and validation functions * feat: implement multi-provider support with enhanced capability handling and model extraction * fix: enhance error handling and validation across multiple modules * chore: remove unused local environment configuration file * commit * fix: improve error handling and logging in utilities and error handler * fix: enhance error handling and logging across multiple modules * fix: enhance async initialization and validation in multiple modules * feat: implement LLM error framework - Add LLM-specific exception classes in exceptions.py - Create error mapping utilities for standardized error handling - Implement base provider interface with error handling - Add OpenAI provider implementation with error mapping - Define LLM types and response structures * feat: add missing registry and telemetry modules - Add registry.py for provider registration system - Add telemetry.py for basic LLM call tracking - Complete the LLM error framework implementation * fix(llm): safer sync wrapper + smarter retries + optional openai mapping * Fix LLM error framework and code quality improvements * feat: update environment configuration and improve logging in LLM services * Update README.md Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Refactor code structure for improved readability and maintainability * chore: update documentation, improve error handling, and enhance file upload validation * feat: enhance error handling and configuration validation across multiple modules * feat: add configuration for pytest, improve error handling, and enhance byte formatting utilities --------- Co-authored-by: scrrlt <smo0051@student.monash.edu> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
6.9 KiB
6.9 KiB
Configuration
DeepTutor uses YAML configuration files and environment variables for easy customization.
📁 Configuration Files
config/
├── main.yaml # Main system configuration (paths, tools, module settings)
├── agents.yaml # Unified agent parameters (temperature, max_tokens)
└── README.md # Full documentation
| File | Purpose |
|---|---|
.env |
API keys, server ports, and service configuration |
config/agents.yaml |
LLM parameters for each agent module |
config/main.yaml |
Paths, tools, module settings |
🔧 Server Configuration
Server ports are configured in .env file:
# Server ports (defaults: 8001/3782)
BACKEND_PORT=8001
FRONTEND_PORT=3782
# Remote access
NEXT_PUBLIC_API_BASE=http://your-server-ip:8001
# Web search
SEARCH_PROVIDER=perplexity # or: baidu
PERPLEXITY_API_KEY=your_key
# TTS
TTS_MODEL=
TTS_URL=
TTS_API_KEY=
☁️ Azure OpenAI Configuration
When using Azure OpenAI, you must set the LLM_API_VERSION and provide the correct endpoint URL including the deployment name.
LLM_BINDING=azure_openai
LLM_MODEL=gpt-4o # Your Azure deployment name
LLM_HOST=https://{your-resource}.openai.azure.com/openai/deployments/{deployment-id}
LLM_API_KEY=your_azure_api_key
LLM_API_VERSION=2024-02-15-preview # Required for Azure
Similarly for embeddings:
EMBEDDING_BINDING=azure_openai
EMBEDDING_MODEL=text-embedding-3-large # Your Azure deployment name
EMBEDDING_HOST=https://{your-resource}.openai.azure.com/openai/deployments/{deployment-id}
EMBEDDING_API_KEY=your_azure_api_key
EMBEDDING_API_VERSION=2024-02-15-preview
Agent Parameters
Edit config/agents.yaml:
# Solve Module - Problem solving agents
solve:
temperature: 0.3
max_tokens: 8192
# Research Module - Deep research agents
research:
temperature: 0.5
max_tokens: 12000
# Question Module - Question generation agents
question:
temperature: 0.7
max_tokens: 4096
# Guide Module - Learning guidance agents
guide:
temperature: 0.5
max_tokens: 8192
# IdeaGen Module - Idea generation agents
ideagen:
temperature: 0.7
max_tokens: 4096
# CoWriter Module - Collaborative writing agents
co_writer:
temperature: 0.7
max_tokens: 4096
🔑 Environment Variables
Create a .env file based on .env.example:
# ============================================================================
# Server Configuration
# ============================================================================
BACKEND_PORT=8001 # Backend API port
FRONTEND_PORT=3782 # Frontend web port
# For remote/LAN access - set to your server's IP address
# Example: http://192.168.1.100:8001 (if not set, defaults to localhost)
# NEXT_PUBLIC_API_BASE=http://your-server-ip:8001
# ============================================================================
# LLM (Large Language Model) Configuration - Required
# ============================================================================
LLM_BINDING=openai # Provider type (see supported list below)
LLM_MODEL=gpt-4o # e.g., gpt-4o, deepseek-chat, qwen-plus
LLM_HOST=https://api.openai.com/v1
LLM_API_KEY=your_api_key
DISABLE_SSL_VERIFY=false # Set true for self-signed certificates
# ============================================================================
# Embedding Model Configuration - Required for Knowledge Base
# ============================================================================
EMBEDDING_BINDING=openai # Provider type (see supported list below)
EMBEDDING_MODEL=text-embedding-3-large # e.g., text-embedding-3-large, nomic-embed-text
EMBEDDING_DIMENSION=3072 # Important! Must match model dimensions
EMBEDDING_HOST=https://api.openai.com/v1
EMBEDDING_API_KEY=your_api_key
# ============================================================================
# Web Search Configuration - Optional
# ============================================================================
SEARCH_PROVIDER=perplexity # Options: perplexity, baidu
PERPLEXITY_API_KEY=your_perplexity_key
BAIDU_API_KEY=your_baidu_key # For Baidu AI Search (百度AI搜索)
# ============================================================================
# TTS (Text-to-Speech) Configuration - Optional
# ============================================================================
TTS_MODEL=
TTS_URL=
TTS_API_KEY=
🔌 Supported Providers
LLM Providers
| Provider | LLM_BINDING Value |
Notes |
|---|---|---|
| OpenAI | openai |
GPT-4o, GPT-4, GPT-3.5, etc. |
| Anthropic | anthropic |
Claude 3.5, Claude 3, etc. |
| Azure OpenAI | azure_openai |
Enterprise deployments |
| Ollama | ollama |
Local models (auto adds /v1 suffix) |
| Groq | groq |
Fast inference |
| OpenRouter | openrouter |
Multi-model gateway |
| DeepSeek | deepseek |
DeepSeek-V3, DeepSeek-R1 |
| Google Gemini | gemini |
OpenAI-compatible mode |
Embedding Providers
| Provider | EMBEDDING_BINDING Value |
Notes |
|---|---|---|
| OpenAI | openai |
text-embedding-3-large/small |
| Azure OpenAI | azure_openai |
Enterprise deployments |
| Jina AI | jina |
jina-embeddings-v3 |
| Cohere | cohere |
embed-v3 series |
| Ollama | ollama |
Local embedding models |
| LM Studio | lm_studio |
Local inference server |
| HuggingFace | huggingface |
OpenAI-compatible endpoints |
Note
: Ensure that
EMBEDDING_DIMENSIONmatches your embedding model's output dimensions. The RAG module uses RAG-Anything—see the repository for details.
🛠️ Tool Configuration
Configure tool availability in config/main.yaml:
tools:
rag_tool:
kb_base_dir: ./data/knowledge_bases
default_kb: ai_textbook
run_code:
workspace: ./data/user/run_code_workspace
web_search:
enabled: true # Global switch for web search
query_item:
enabled: true
max_results: 5
📂 Data Storage
All user content and system data are stored in the data/ directory:
data/
├── knowledge_bases/ # Knowledge base storage
└── user/ # User activity data
├── solve/ # Problem solving results
├── question/ # Generated questions
├── research/ # Research reports and cache
├── co_writer/ # Interactive IdeaGen documents
├── notebook/ # Notebook records
├── guide/ # Guided learning sessions
├── logs/ # System logs
└── run_code_workspace/ # Code execution workspace
🔗 Advanced Configuration
For the full configuration reference, see config/README.md.