mirror of
https://github.com/Xe138/AI-Trader.git
synced 2026-04-02 01:27:24 -04:00
Compare commits
3 Commits
v0.4.1-alp
...
v0.4.1-alp
| Author | SHA1 | Date | |
|---|---|---|---|
| 2d41717b2b | |||
| 7c4874715b | |||
| 6d30244fc9 |
13
CHANGELOG.md
13
CHANGELOG.md
@@ -7,13 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [0.4.1] - 2025-11-05
|
||||
## [0.4.1] - 2025-11-06
|
||||
|
||||
### Fixed
|
||||
- Resolved Pydantic validation errors when using DeepSeek Chat v3.1 through systematic debugging
|
||||
- Root cause: Initial implementation incorrectly converted tool_calls arguments from strings to dictionaries, causing LangChain's `parse_tool_call()` to fail and create invalid_tool_calls with wrong format
|
||||
- Solution: Removed unnecessary conversion logic - DeepSeek already returns arguments in correct format (JSON strings)
|
||||
- `ToolCallArgsParsingWrapper` now acts as a simple passthrough proxy (kept for backward compatibility)
|
||||
- Fixed "No trading" message always displaying despite trading activity by initializing `IF_TRADE` to `True` (trades expected by default)
|
||||
- Root cause: `IF_TRADE` was initialized to `False` in runtime config but never updated when trades executed
|
||||
|
||||
### Note
|
||||
- ChatDeepSeek integration was reverted as it conflicts with OpenRouter unified gateway architecture
|
||||
- System uses `OPENAI_API_BASE` (OpenRouter) with single `OPENAI_API_KEY` for all providers
|
||||
- Sporadic DeepSeek validation errors appear to be transient and do not require code changes
|
||||
|
||||
## [0.4.0] - 2025-11-05
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@ from tools.deployment_config import (
|
||||
from agent.context_injector import ContextInjector
|
||||
from agent.pnl_calculator import DailyPnLCalculator
|
||||
from agent.reasoning_summarizer import ReasoningSummarizer
|
||||
from agent.chat_model_wrapper import ToolCallArgsParsingWrapper
|
||||
|
||||
# Load environment variables
|
||||
load_dotenv()
|
||||
@@ -209,10 +208,10 @@ class BaseAgent:
|
||||
# Create AI model (mock in DEV mode, real in PROD mode)
|
||||
if is_dev_mode():
|
||||
from agent.mock_provider import MockChatModel
|
||||
base_model = MockChatModel(date="2025-01-01") # Date will be updated per session
|
||||
self.model = MockChatModel(date="2025-01-01") # Date will be updated per session
|
||||
print(f"🤖 Using MockChatModel (DEV mode)")
|
||||
else:
|
||||
base_model = ChatOpenAI(
|
||||
self.model = ChatOpenAI(
|
||||
model=self.basemodel,
|
||||
base_url=self.openai_base_url,
|
||||
api_key=self.openai_api_key,
|
||||
@@ -220,10 +219,6 @@ class BaseAgent:
|
||||
timeout=30
|
||||
)
|
||||
print(f"🤖 Using {self.basemodel} (PROD mode)")
|
||||
|
||||
# Wrap model to fix tool_calls args parsing
|
||||
self.model = ToolCallArgsParsingWrapper(model=base_model)
|
||||
print(f"✅ Applied tool_calls args parsing wrapper")
|
||||
except Exception as e:
|
||||
raise RuntimeError(f"❌ Failed to initialize AI model: {e}")
|
||||
|
||||
@@ -546,7 +541,7 @@ Summary:"""
|
||||
|
||||
# Update mock model date if in dev mode
|
||||
if is_dev_mode():
|
||||
self.model.wrapped_model.date = today_date
|
||||
self.model.date = today_date
|
||||
|
||||
# Get job_id from context injector
|
||||
job_id = self.context_injector.job_id if self.context_injector else get_config_value("JOB_ID")
|
||||
|
||||
@@ -80,7 +80,7 @@ class RuntimeConfigManager:
|
||||
initial_config = {
|
||||
"TODAY_DATE": date,
|
||||
"SIGNATURE": model_sig,
|
||||
"IF_TRADE": False,
|
||||
"IF_TRADE": True, # FIX: Trades are expected by default
|
||||
"JOB_ID": job_id,
|
||||
"TRADING_DAY_ID": trading_day_id
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ class TestRuntimeConfigCreation:
|
||||
|
||||
assert config["TODAY_DATE"] == "2025-01-16"
|
||||
assert config["SIGNATURE"] == "gpt-5"
|
||||
assert config["IF_TRADE"] is False
|
||||
assert config["IF_TRADE"] is True
|
||||
assert config["JOB_ID"] == "test-job-123"
|
||||
|
||||
def test_create_runtime_config_unique_paths(self):
|
||||
@@ -108,6 +108,32 @@ class TestRuntimeConfigCreation:
|
||||
# Config file should exist
|
||||
assert os.path.exists(config_path)
|
||||
|
||||
def test_create_runtime_config_if_trade_defaults_true(self):
|
||||
"""Test that IF_TRADE initializes to True (trades expected by default)"""
|
||||
from api.runtime_manager import RuntimeConfigManager
|
||||
|
||||
with tempfile.TemporaryDirectory() as temp_dir:
|
||||
manager = RuntimeConfigManager(data_dir=temp_dir)
|
||||
|
||||
config_path = manager.create_runtime_config(
|
||||
job_id="test-job-123",
|
||||
model_sig="test-model",
|
||||
date="2025-01-16",
|
||||
trading_day_id=1
|
||||
)
|
||||
|
||||
try:
|
||||
# Read the config file
|
||||
with open(config_path, 'r') as f:
|
||||
config = json.load(f)
|
||||
|
||||
# Verify IF_TRADE is True by default
|
||||
assert config["IF_TRADE"] is True, "IF_TRADE should initialize to True"
|
||||
finally:
|
||||
# Cleanup
|
||||
if os.path.exists(config_path):
|
||||
os.remove(config_path)
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
class TestRuntimeConfigCleanup:
|
||||
|
||||
Reference in New Issue
Block a user