From 872928a1872d1ee97ed8d25f1d0550b59a55b9b1 Mon Sep 17 00:00:00 2001 From: Bill Date: Thu, 6 Nov 2025 07:58:43 -0500 Subject: [PATCH] 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 --- CHANGELOG.md | 15 +++++++++++++++ CLAUDE.md | 16 ++++++++++++++-- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bed2916..8de71cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.4.2] - 2025-11-05 + +### Fixed +- Fixed "No trading" message always displaying despite trading activity by initializing `IF_TRADE` to `True` (trades expected by default) +- Resolved sporadic Pydantic validation errors for DeepSeek tool_calls arguments by switching to native `ChatDeepSeek` integration + +### Added +- Added `agent/model_factory.py` for provider-specific model creation +- Added `langchain-deepseek` dependency for native DeepSeek support +- Added integration tests for DeepSeek tool calls argument parsing + +### Changed +- `BaseAgent` now uses model factory instead of direct `ChatOpenAI` instantiation +- DeepSeek models (`deepseek/*`) now use `ChatDeepSeek` instead of OpenAI compatibility layer + ## [0.4.1] - 2025-11-05 ### Fixed diff --git a/CLAUDE.md b/CLAUDE.md index 419870c..f9dc7f8 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -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 `` within `max_steps` - Increase `max_steps` if agent needs more reasoning time -- Check `log.jsonl` for errors preventing completion \ No newline at end of file +- 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 \ No newline at end of file