mirror of
https://github.com/Xe138/AI-Trader.git
synced 2026-04-07 03:07:24 -04:00
chore: remove obsolete chat model wrapper
The ToolCallArgsParsingWrapper was replaced by the model factory approach which uses native ChatDeepSeek for DeepSeek models. Removed: - agent/chat_model_wrapper.py (no longer used) - tests/unit/test_chat_model_wrapper.py (tests for removed functionality) The model factory provides a cleaner solution by using provider-specific implementations rather than wrapping ChatOpenAI.
This commit is contained in:
@@ -1,51 +0,0 @@
|
||||
"""
|
||||
Chat model wrapper - Passthrough wrapper for ChatOpenAI models.
|
||||
|
||||
Originally created to fix DeepSeek tool_calls arg parsing issues, but investigation
|
||||
revealed DeepSeek already returns the correct format (arguments as JSON strings).
|
||||
|
||||
This wrapper is now a simple passthrough that proxies all calls to the underlying model.
|
||||
Kept for backward compatibility and potential future use.
|
||||
"""
|
||||
|
||||
from typing import Any
|
||||
|
||||
|
||||
class ToolCallArgsParsingWrapper:
|
||||
"""
|
||||
Passthrough wrapper around ChatOpenAI models.
|
||||
|
||||
After systematic debugging, determined that DeepSeek returns tool_calls.arguments
|
||||
as JSON strings (correct format), so no parsing/conversion is needed.
|
||||
|
||||
This wrapper simply proxies all calls to the wrapped model.
|
||||
"""
|
||||
|
||||
def __init__(self, model: Any, **kwargs):
|
||||
"""
|
||||
Initialize wrapper around a chat model.
|
||||
|
||||
Args:
|
||||
model: The chat model to wrap
|
||||
**kwargs: Additional parameters (ignored, for compatibility)
|
||||
"""
|
||||
self.wrapped_model = model
|
||||
|
||||
@property
|
||||
def _llm_type(self) -> str:
|
||||
"""Return identifier for this LLM type"""
|
||||
if hasattr(self.wrapped_model, '_llm_type'):
|
||||
return f"wrapped-{self.wrapped_model._llm_type}"
|
||||
return "wrapped-chat-model"
|
||||
|
||||
def __getattr__(self, name: str):
|
||||
"""Proxy all attributes/methods to the wrapped model"""
|
||||
return getattr(self.wrapped_model, name)
|
||||
|
||||
def bind_tools(self, tools: Any, **kwargs):
|
||||
"""Bind tools to the wrapped model"""
|
||||
return self.wrapped_model.bind_tools(tools, **kwargs)
|
||||
|
||||
def bind(self, **kwargs):
|
||||
"""Bind settings to the wrapped model"""
|
||||
return self.wrapped_model.bind(**kwargs)
|
||||
Reference in New Issue
Block a user