dm-aioaiagent 0.4.6__tar.gz → 0.4.8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {dm_aioaiagent-0.4.6 → dm_aioaiagent-0.4.8}/PKG-INFO +1 -1
- {dm_aioaiagent-0.4.6 → dm_aioaiagent-0.4.8}/dm_aioaiagent/ai_agent.py +15 -14
- {dm_aioaiagent-0.4.6 → dm_aioaiagent-0.4.8}/dm_aioaiagent/async_ai_agent.py +0 -4
- {dm_aioaiagent-0.4.6 → dm_aioaiagent-0.4.8}/dm_aioaiagent.egg-info/PKG-INFO +1 -1
- {dm_aioaiagent-0.4.6 → dm_aioaiagent-0.4.8}/setup.py +1 -1
- {dm_aioaiagent-0.4.6 → dm_aioaiagent-0.4.8}/README.md +0 -0
- {dm_aioaiagent-0.4.6 → dm_aioaiagent-0.4.8}/dm_aioaiagent/__init__.py +0 -0
- {dm_aioaiagent-0.4.6 → dm_aioaiagent-0.4.8}/dm_aioaiagent/openai_image_message_content.py +0 -0
- {dm_aioaiagent-0.4.6 → dm_aioaiagent-0.4.8}/dm_aioaiagent/types.py +0 -0
- {dm_aioaiagent-0.4.6 → dm_aioaiagent-0.4.8}/dm_aioaiagent.egg-info/SOURCES.txt +0 -0
- {dm_aioaiagent-0.4.6 → dm_aioaiagent-0.4.8}/dm_aioaiagent.egg-info/dependency_links.txt +0 -0
- {dm_aioaiagent-0.4.6 → dm_aioaiagent-0.4.8}/dm_aioaiagent.egg-info/requires.txt +0 -0
- {dm_aioaiagent-0.4.6 → dm_aioaiagent-0.4.8}/dm_aioaiagent.egg-info/top_level.txt +0 -0
- {dm_aioaiagent-0.4.6 → dm_aioaiagent-0.4.8}/setup.cfg +0 -0
|
@@ -25,8 +25,8 @@ class DMAIAgent:
|
|
|
25
25
|
tools: list[BaseTool] = None,
|
|
26
26
|
*,
|
|
27
27
|
model: str = "gpt-4o-mini",
|
|
28
|
-
temperature:
|
|
29
|
-
parallel_tool_calls: bool =
|
|
28
|
+
temperature: float = None,
|
|
29
|
+
parallel_tool_calls: bool = None,
|
|
30
30
|
agent_name: str = "AIAgent",
|
|
31
31
|
input_output_logging: bool = True,
|
|
32
32
|
is_memory_enabled: bool = True,
|
|
@@ -44,8 +44,8 @@ class DMAIAgent:
|
|
|
44
44
|
self._tools = tools or []
|
|
45
45
|
self._is_tools_exists = bool(tools)
|
|
46
46
|
self._model = str(model)
|
|
47
|
-
self._temperature =
|
|
48
|
-
self._parallel_tool_calls =
|
|
47
|
+
self._temperature = temperature
|
|
48
|
+
self._parallel_tool_calls = parallel_tool_calls
|
|
49
49
|
self._llm_provider_api_key = str(llm_provider_api_key)
|
|
50
50
|
self._llm_provider_base_url = str(llm_provider_base_url)
|
|
51
51
|
|
|
@@ -193,27 +193,28 @@ class DMAIAgent:
|
|
|
193
193
|
return route
|
|
194
194
|
|
|
195
195
|
def _init_agent(self) -> None:
|
|
196
|
-
base_kwargs = {
|
|
197
|
-
|
|
198
|
-
"temperature"
|
|
199
|
-
"base_url": self._llm_provider_base_url if self._llm_provider_base_url else None
|
|
200
|
-
}
|
|
196
|
+
base_kwargs = {"model": self._model}
|
|
197
|
+
if isinstance(self._temperature, float):
|
|
198
|
+
base_kwargs["temperature"] = self._temperature
|
|
201
199
|
if self._llm_provider_api_key:
|
|
202
200
|
base_kwargs["api_key"] = SecretStr(self._llm_provider_api_key)
|
|
201
|
+
if self._llm_provider_base_url:
|
|
202
|
+
base_kwargs["base_url"] = self._llm_provider_base_url
|
|
203
203
|
|
|
204
204
|
if self._model.startswith("claude"):
|
|
205
205
|
from langchain_anthropic import ChatAnthropic
|
|
206
206
|
|
|
207
207
|
llm = ChatAnthropic(**base_kwargs)
|
|
208
|
-
bind_tool_kwargs = {"tool_choice": {
|
|
209
|
-
|
|
210
|
-
"disable_parallel_tool_use"
|
|
211
|
-
}}
|
|
208
|
+
bind_tool_kwargs = {"tool_choice": {"type": "auto"}}
|
|
209
|
+
if isinstance(self._parallel_tool_calls, bool):
|
|
210
|
+
bind_tool_kwargs["tool_choice"]["disable_parallel_tool_use"] = not self._parallel_tool_calls
|
|
212
211
|
else:
|
|
213
212
|
from langchain_openai import ChatOpenAI
|
|
214
213
|
|
|
215
214
|
llm = ChatOpenAI(**base_kwargs)
|
|
216
|
-
bind_tool_kwargs = {
|
|
215
|
+
bind_tool_kwargs = {}
|
|
216
|
+
if isinstance(self._parallel_tool_calls, bool):
|
|
217
|
+
bind_tool_kwargs["parallel_tool_calls"] = self._parallel_tool_calls
|
|
217
218
|
|
|
218
219
|
if self._is_tools_exists:
|
|
219
220
|
self._tool_map = {t.name: t for t in self._tools}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import sys
|
|
2
1
|
import uuid
|
|
3
2
|
import asyncio
|
|
4
3
|
from typing import Any
|
|
@@ -7,9 +6,6 @@ from langchain_core.messages import AIMessage, ToolMessage
|
|
|
7
6
|
from .ai_agent import DMAIAgent
|
|
8
7
|
from .types import *
|
|
9
8
|
|
|
10
|
-
if sys.platform == "win32":
|
|
11
|
-
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
|
|
12
|
-
|
|
13
9
|
__all__ = ["DMAioAIAgent"]
|
|
14
10
|
|
|
15
11
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|