docs: update for IF_TRADE and DeepSeek fixes

- Document model factory architecture
- Add troubleshooting for DeepSeek validation errors
- Update changelog with version 0.4.2 fixes
This commit is contained in:
2025-11-06 07:58:43 -05:00
parent 81ec0ec53b
commit 872928a187
2 changed files with 29 additions and 2 deletions

View File

@@ -167,12 +167,18 @@ bash main.sh
### Agent System
**BaseAgent Key Methods:**
- `initialize()`: Connect to MCP services, create AI model
- `initialize()`: Connect to MCP services, create AI model via model factory
- `run_trading_session(date)`: Execute single day's trading with retry logic
- `run_date_range(init_date, end_date)`: Process all weekdays in range
- `get_trading_dates()`: Resume from last date in position.jsonl
- `register_agent()`: Create initial position file with $10,000 cash
**Model Factory:**
The `create_model()` factory automatically selects the appropriate chat model:
- `deepseek/*` models → `ChatDeepSeek` (native tool calling support)
- `openai/*` models → `ChatOpenAI`
- Other providers → `ChatOpenAI` (OpenAI-compatible endpoint)
**Adding Custom Agents:**
1. Create new class inheriting from `BaseAgent`
2. Add to `AGENT_REGISTRY` in `main.py`:
@@ -452,4 +458,10 @@ The project uses a well-organized documentation structure:
**Agent Doesn't Stop Trading:**
- Agent must output `<FINISH_SIGNAL>` within `max_steps`
- Increase `max_steps` if agent needs more reasoning time
- Check `log.jsonl` for errors preventing completion
- Check `log.jsonl` for errors preventing completion
**DeepSeek Pydantic Validation Errors:**
- Error: "Input should be a valid dictionary [type=dict_type, input_value='...', input_type=str]"
- Cause: Using `ChatOpenAI` for DeepSeek models (OpenAI compatibility layer issue)
- Fix: Ensure `langchain-deepseek` is installed and basemodel uses `deepseek/` prefix
- The model factory automatically uses `ChatDeepSeek` for native support