dm-aioaiagent 0.4.2__tar.gz → 0.4.6__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.2 → dm_aioaiagent-0.4.6}/PKG-INFO +4 -4
- {dm_aioaiagent-0.4.2 → dm_aioaiagent-0.4.6}/dm_aioaiagent/ai_agent.py +22 -13
- {dm_aioaiagent-0.4.2 → dm_aioaiagent-0.4.6}/dm_aioaiagent/async_ai_agent.py +3 -1
- {dm_aioaiagent-0.4.2 → dm_aioaiagent-0.4.6}/dm_aioaiagent.egg-info/PKG-INFO +4 -4
- {dm_aioaiagent-0.4.2 → dm_aioaiagent-0.4.6}/dm_aioaiagent.egg-info/requires.txt +3 -3
- {dm_aioaiagent-0.4.2 → dm_aioaiagent-0.4.6}/setup.py +4 -4
- {dm_aioaiagent-0.4.2 → dm_aioaiagent-0.4.6}/README.md +0 -0
- {dm_aioaiagent-0.4.2 → dm_aioaiagent-0.4.6}/dm_aioaiagent/__init__.py +0 -0
- {dm_aioaiagent-0.4.2 → dm_aioaiagent-0.4.6}/dm_aioaiagent/openai_image_message_content.py +0 -0
- {dm_aioaiagent-0.4.2 → dm_aioaiagent-0.4.6}/dm_aioaiagent/types.py +0 -0
- {dm_aioaiagent-0.4.2 → dm_aioaiagent-0.4.6}/dm_aioaiagent.egg-info/SOURCES.txt +0 -0
- {dm_aioaiagent-0.4.2 → dm_aioaiagent-0.4.6}/dm_aioaiagent.egg-info/dependency_links.txt +0 -0
- {dm_aioaiagent-0.4.2 → dm_aioaiagent-0.4.6}/dm_aioaiagent.egg-info/top_level.txt +0 -0
- {dm_aioaiagent-0.4.2 → dm_aioaiagent-0.4.6}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: dm-aioaiagent
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.6
|
|
4
4
|
Summary: This is my custom aioaiagent client
|
|
5
5
|
Home-page: https://pypi.org/project/dm-aioaiagent
|
|
6
6
|
Author: dimka4621
|
|
@@ -17,12 +17,12 @@ Requires-Dist: python-dotenv>=1.0.0
|
|
|
17
17
|
Requires-Dist: pydantic<3.0.0,>=2.9.2
|
|
18
18
|
Requires-Dist: langchain~=0.3.0
|
|
19
19
|
Requires-Dist: langchain-core~=0.3.5
|
|
20
|
+
Requires-Dist: langchain-community~=0.3.0
|
|
21
|
+
Requires-Dist: langchain-openai~=0.3.0
|
|
22
|
+
Requires-Dist: langchain-anthropic~=0.3.0
|
|
20
23
|
Requires-Dist: langgraph~=0.2.23
|
|
21
24
|
Requires-Dist: langsmith~=0.1.144
|
|
22
25
|
Requires-Dist: grandalf>=0.8
|
|
23
|
-
Requires-Dist: langchain-community~=0.3.0
|
|
24
|
-
Requires-Dist: langchain-openai~=0.2.0
|
|
25
|
-
Requires-Dist: langchain-anthropic~=0.3.0
|
|
26
26
|
Dynamic: author
|
|
27
27
|
Dynamic: author-email
|
|
28
28
|
Dynamic: classifier
|
|
@@ -33,6 +33,7 @@ class DMAIAgent:
|
|
|
33
33
|
max_memory_messages: int = MAX_MEMORY_MESSAGES,
|
|
34
34
|
save_tools_responses_in_memory: bool = True,
|
|
35
35
|
llm_provider_api_key: str = "",
|
|
36
|
+
llm_provider_base_url: str = "",
|
|
36
37
|
response_if_request_fail: str = "I can't provide a response right now. Please try again later.",
|
|
37
38
|
response_if_invalid_image: str = "The image is unavailable or the link is incorrect."
|
|
38
39
|
):
|
|
@@ -46,6 +47,7 @@ class DMAIAgent:
|
|
|
46
47
|
self._temperature = int(temperature)
|
|
47
48
|
self._parallel_tool_calls = bool(parallel_tool_calls)
|
|
48
49
|
self._llm_provider_api_key = str(llm_provider_api_key)
|
|
50
|
+
self._llm_provider_base_url = str(llm_provider_base_url)
|
|
49
51
|
|
|
50
52
|
self._memory_messages = []
|
|
51
53
|
self._is_memory_enabled = bool(is_memory_enabled)
|
|
@@ -125,7 +127,9 @@ class DMAIAgent:
|
|
|
125
127
|
self._logger.error(e)
|
|
126
128
|
if second_attempt:
|
|
127
129
|
response = self._response_if_invalid_image if "invalid_image_url" in str(e) else self._response_if_request_fail
|
|
128
|
-
|
|
130
|
+
ai_response = AIMessage(content=response)
|
|
131
|
+
state["messages"].append(ai_response)
|
|
132
|
+
state["new_messages"].append(ai_response)
|
|
129
133
|
return state
|
|
130
134
|
return self._invoke_llm_node(state, second_attempt=True)
|
|
131
135
|
state["messages"].append(ai_response)
|
|
@@ -189,29 +193,34 @@ class DMAIAgent:
|
|
|
189
193
|
return route
|
|
190
194
|
|
|
191
195
|
def _init_agent(self) -> None:
|
|
196
|
+
base_kwargs = {
|
|
197
|
+
"model": self._model,
|
|
198
|
+
"temperature": self._temperature,
|
|
199
|
+
"base_url": self._llm_provider_base_url if self._llm_provider_base_url else None
|
|
200
|
+
}
|
|
192
201
|
if self._llm_provider_api_key:
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
if self._model.startswith("gpt"):
|
|
196
|
-
from langchain_openai import ChatOpenAI
|
|
202
|
+
base_kwargs["api_key"] = SecretStr(self._llm_provider_api_key)
|
|
197
203
|
|
|
198
|
-
|
|
199
|
-
llm = ChatOpenAI(model_name=self._model, temperature=self._temperature, openai_api_key=api_key)
|
|
200
|
-
elif self._model.startswith("claude"):
|
|
204
|
+
if self._model.startswith("claude"):
|
|
201
205
|
from langchain_anthropic import ChatAnthropic
|
|
202
206
|
|
|
203
|
-
|
|
204
|
-
|
|
207
|
+
llm = ChatAnthropic(**base_kwargs)
|
|
208
|
+
bind_tool_kwargs = {"tool_choice": {
|
|
209
|
+
"type": "auto",
|
|
210
|
+
"disable_parallel_tool_use": not self._parallel_tool_calls
|
|
211
|
+
}}
|
|
205
212
|
else:
|
|
206
|
-
|
|
213
|
+
from langchain_openai import ChatOpenAI
|
|
214
|
+
|
|
215
|
+
llm = ChatOpenAI(**base_kwargs)
|
|
216
|
+
bind_tool_kwargs = {"parallel_tool_calls": self._parallel_tool_calls}
|
|
207
217
|
|
|
208
218
|
if self._is_tools_exists:
|
|
209
219
|
self._tool_map = {t.name: t for t in self._tools}
|
|
210
|
-
llm = llm.bind_tools(self._tools,
|
|
220
|
+
llm = llm.bind_tools(self._tools, **bind_tool_kwargs)
|
|
211
221
|
|
|
212
222
|
prompt = ChatPromptTemplate.from_messages([SystemMessage(content=self._system_message),
|
|
213
223
|
MessagesPlaceholder(variable_name="messages")])
|
|
214
|
-
|
|
215
224
|
self._agent = prompt | llm
|
|
216
225
|
|
|
217
226
|
def _init_graph(self) -> None:
|
|
@@ -51,7 +51,9 @@ class DMAioAIAgent(DMAIAgent):
|
|
|
51
51
|
self._logger.error(e)
|
|
52
52
|
if second_attempt:
|
|
53
53
|
response = self._response_if_invalid_image if "invalid_image_url" in str(e) else self._response_if_request_fail
|
|
54
|
-
|
|
54
|
+
ai_response = AIMessage(content=response)
|
|
55
|
+
state["messages"].append(ai_response)
|
|
56
|
+
state["new_messages"].append(ai_response)
|
|
55
57
|
return state
|
|
56
58
|
return await self._invoke_llm_node(state, second_attempt=True)
|
|
57
59
|
state["messages"].append(ai_response)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: dm-aioaiagent
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.6
|
|
4
4
|
Summary: This is my custom aioaiagent client
|
|
5
5
|
Home-page: https://pypi.org/project/dm-aioaiagent
|
|
6
6
|
Author: dimka4621
|
|
@@ -17,12 +17,12 @@ Requires-Dist: python-dotenv>=1.0.0
|
|
|
17
17
|
Requires-Dist: pydantic<3.0.0,>=2.9.2
|
|
18
18
|
Requires-Dist: langchain~=0.3.0
|
|
19
19
|
Requires-Dist: langchain-core~=0.3.5
|
|
20
|
+
Requires-Dist: langchain-community~=0.3.0
|
|
21
|
+
Requires-Dist: langchain-openai~=0.3.0
|
|
22
|
+
Requires-Dist: langchain-anthropic~=0.3.0
|
|
20
23
|
Requires-Dist: langgraph~=0.2.23
|
|
21
24
|
Requires-Dist: langsmith~=0.1.144
|
|
22
25
|
Requires-Dist: grandalf>=0.8
|
|
23
|
-
Requires-Dist: langchain-community~=0.3.0
|
|
24
|
-
Requires-Dist: langchain-openai~=0.2.0
|
|
25
|
-
Requires-Dist: langchain-anthropic~=0.3.0
|
|
26
26
|
Dynamic: author
|
|
27
27
|
Dynamic: author-email
|
|
28
28
|
Dynamic: classifier
|
|
@@ -3,9 +3,9 @@ python-dotenv>=1.0.0
|
|
|
3
3
|
pydantic<3.0.0,>=2.9.2
|
|
4
4
|
langchain~=0.3.0
|
|
5
5
|
langchain-core~=0.3.5
|
|
6
|
+
langchain-community~=0.3.0
|
|
7
|
+
langchain-openai~=0.3.0
|
|
8
|
+
langchain-anthropic~=0.3.0
|
|
6
9
|
langgraph~=0.2.23
|
|
7
10
|
langsmith~=0.1.144
|
|
8
11
|
grandalf>=0.8
|
|
9
|
-
langchain-community~=0.3.0
|
|
10
|
-
langchain-openai~=0.2.0
|
|
11
|
-
langchain-anthropic~=0.3.0
|
|
@@ -8,7 +8,7 @@ def readme():
|
|
|
8
8
|
|
|
9
9
|
setup(
|
|
10
10
|
name='dm-aioaiagent',
|
|
11
|
-
version='v0.4.
|
|
11
|
+
version='v0.4.6',
|
|
12
12
|
author='dimka4621',
|
|
13
13
|
author_email='mismartconfig@gmail.com',
|
|
14
14
|
description='This is my custom aioaiagent client',
|
|
@@ -22,12 +22,12 @@ setup(
|
|
|
22
22
|
'pydantic>=2.9.2, < 3.0.0',
|
|
23
23
|
'langchain~=0.3.0',
|
|
24
24
|
'langchain-core~=0.3.5',
|
|
25
|
+
'langchain-community~=0.3.0',
|
|
26
|
+
'langchain-openai~=0.3.0',
|
|
27
|
+
'langchain-anthropic~=0.3.0',
|
|
25
28
|
'langgraph~=0.2.23',
|
|
26
29
|
'langsmith~=0.1.144',
|
|
27
30
|
'grandalf>=0.8',
|
|
28
|
-
'langchain-community~=0.3.0',
|
|
29
|
-
'langchain-openai~=0.2.0',
|
|
30
|
-
'langchain-anthropic~=0.3.0'
|
|
31
31
|
],
|
|
32
32
|
classifiers=[
|
|
33
33
|
'Programming Language :: Python :: 3.8',
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|