dm-aioaiagent 0.4.8__tar.gz → 0.4.9__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.8 → dm_aioaiagent-0.4.9}/PKG-INFO +28 -27
- {dm_aioaiagent-0.4.8 → dm_aioaiagent-0.4.9}/README.md +25 -24
- {dm_aioaiagent-0.4.8 → dm_aioaiagent-0.4.9}/dm_aioaiagent/ai_agent.py +12 -11
- {dm_aioaiagent-0.4.8 → dm_aioaiagent-0.4.9}/dm_aioaiagent/async_ai_agent.py +11 -0
- {dm_aioaiagent-0.4.8 → dm_aioaiagent-0.4.9}/dm_aioaiagent.egg-info/PKG-INFO +28 -27
- {dm_aioaiagent-0.4.8 → dm_aioaiagent-0.4.9}/dm_aioaiagent.egg-info/requires.txt +1 -1
- {dm_aioaiagent-0.4.8 → dm_aioaiagent-0.4.9}/setup.py +2 -2
- {dm_aioaiagent-0.4.8 → dm_aioaiagent-0.4.9}/dm_aioaiagent/__init__.py +0 -0
- {dm_aioaiagent-0.4.8 → dm_aioaiagent-0.4.9}/dm_aioaiagent/openai_image_message_content.py +0 -0
- {dm_aioaiagent-0.4.8 → dm_aioaiagent-0.4.9}/dm_aioaiagent/types.py +0 -0
- {dm_aioaiagent-0.4.8 → dm_aioaiagent-0.4.9}/dm_aioaiagent.egg-info/SOURCES.txt +0 -0
- {dm_aioaiagent-0.4.8 → dm_aioaiagent-0.4.9}/dm_aioaiagent.egg-info/dependency_links.txt +0 -0
- {dm_aioaiagent-0.4.8 → dm_aioaiagent-0.4.9}/dm_aioaiagent.egg-info/top_level.txt +0 -0
- {dm_aioaiagent-0.4.8 → dm_aioaiagent-0.4.9}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: dm-aioaiagent
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.9
|
|
4
4
|
Summary: This is my custom aioaiagent client
|
|
5
5
|
Home-page: https://pypi.org/project/dm-aioaiagent
|
|
6
6
|
Author: dimka4621
|
|
@@ -12,7 +12,7 @@ Classifier: License :: OSI Approved :: MIT License
|
|
|
12
12
|
Classifier: Operating System :: OS Independent
|
|
13
13
|
Requires-Python: >=3.9
|
|
14
14
|
Description-Content-Type: text/markdown
|
|
15
|
-
Requires-Dist: dm-logger~=0.
|
|
15
|
+
Requires-Dist: dm-logger~=0.6.2
|
|
16
16
|
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
|
|
@@ -48,6 +48,16 @@ Dynamic: summary
|
|
|
48
48
|
|
|
49
49
|
Analogue to `DMAioAIAgent` is the synchronous client `DMAIAgent`.
|
|
50
50
|
|
|
51
|
+
### Windows Setup
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
import asyncio
|
|
55
|
+
import sys
|
|
56
|
+
|
|
57
|
+
if sys.platform == "win32":
|
|
58
|
+
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
|
|
59
|
+
```
|
|
60
|
+
|
|
51
61
|
### Use agent *with* inner memory and run *single* message
|
|
52
62
|
|
|
53
63
|
By default, agent use inner memory to store the conversation history.
|
|
@@ -172,30 +182,21 @@ if __name__ == "__main__":
|
|
|
172
182
|
|
|
173
183
|
### Set custom logger
|
|
174
184
|
|
|
175
|
-
_If you want set up custom logger_
|
|
176
|
-
|
|
177
185
|
```python
|
|
178
|
-
from dm_aioaiagent import
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
def error(self, message):
|
|
193
|
-
print(message)
|
|
194
|
-
|
|
186
|
+
from dm_aioaiagent import DMAIAgent
|
|
187
|
+
from dm_logger import FormatterConfig
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
# set up custom logger for all clients
|
|
191
|
+
DMAIAgent.set_logger_params(
|
|
192
|
+
{
|
|
193
|
+
"name": "my_name",
|
|
194
|
+
"formatter_config": FormatterConfig(
|
|
195
|
+
show_datetime=False,
|
|
196
|
+
)
|
|
197
|
+
}
|
|
198
|
+
)
|
|
199
|
+
```
|
|
195
200
|
|
|
196
|
-
|
|
197
|
-
ai_agent = DMAioAIAgent()
|
|
201
|
+
See more about DMLogger [here](https://github.com/MykhLibs/dm-logger)
|
|
198
202
|
|
|
199
|
-
# set up custom logger for this agent
|
|
200
|
-
ai_agent.set_logger(MyLogger())
|
|
201
|
-
```
|
|
@@ -11,6 +11,16 @@
|
|
|
11
11
|
|
|
12
12
|
Analogue to `DMAioAIAgent` is the synchronous client `DMAIAgent`.
|
|
13
13
|
|
|
14
|
+
### Windows Setup
|
|
15
|
+
|
|
16
|
+
```python
|
|
17
|
+
import asyncio
|
|
18
|
+
import sys
|
|
19
|
+
|
|
20
|
+
if sys.platform == "win32":
|
|
21
|
+
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
|
|
22
|
+
```
|
|
23
|
+
|
|
14
24
|
### Use agent *with* inner memory and run *single* message
|
|
15
25
|
|
|
16
26
|
By default, agent use inner memory to store the conversation history.
|
|
@@ -135,30 +145,21 @@ if __name__ == "__main__":
|
|
|
135
145
|
|
|
136
146
|
### Set custom logger
|
|
137
147
|
|
|
138
|
-
_If you want set up custom logger_
|
|
139
|
-
|
|
140
148
|
```python
|
|
141
|
-
from dm_aioaiagent import
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
def error(self, message):
|
|
156
|
-
print(message)
|
|
157
|
-
|
|
149
|
+
from dm_aioaiagent import DMAIAgent
|
|
150
|
+
from dm_logger import FormatterConfig
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
# set up custom logger for all clients
|
|
154
|
+
DMAIAgent.set_logger_params(
|
|
155
|
+
{
|
|
156
|
+
"name": "my_name",
|
|
157
|
+
"formatter_config": FormatterConfig(
|
|
158
|
+
show_datetime=False,
|
|
159
|
+
)
|
|
160
|
+
}
|
|
161
|
+
)
|
|
162
|
+
```
|
|
158
163
|
|
|
159
|
-
|
|
160
|
-
ai_agent = DMAioAIAgent()
|
|
164
|
+
See more about DMLogger [here](https://github.com/MykhLibs/dm-logger)
|
|
161
165
|
|
|
162
|
-
# set up custom logger for this agent
|
|
163
|
-
ai_agent.set_logger(MyLogger())
|
|
164
|
-
```
|
|
@@ -18,6 +18,7 @@ __all__ = ["DMAIAgent"]
|
|
|
18
18
|
class DMAIAgent:
|
|
19
19
|
MAX_MEMORY_MESSAGES = 20 # Only INT greater than 0
|
|
20
20
|
_ALLOWED_ROLES = ("user", "ai")
|
|
21
|
+
_logger_params = None
|
|
21
22
|
|
|
22
23
|
def __init__(
|
|
23
24
|
self,
|
|
@@ -37,7 +38,7 @@ class DMAIAgent:
|
|
|
37
38
|
response_if_request_fail: str = "I can't provide a response right now. Please try again later.",
|
|
38
39
|
response_if_invalid_image: str = "The image is unavailable or the link is incorrect."
|
|
39
40
|
):
|
|
40
|
-
self.
|
|
41
|
+
self._set_logger(agent_name)
|
|
41
42
|
self._input_output_logging = bool(input_output_logging)
|
|
42
43
|
|
|
43
44
|
self._system_message = str(system_message)
|
|
@@ -265,13 +266,13 @@ class DMAIAgent:
|
|
|
265
266
|
except Exception as e:
|
|
266
267
|
self._logger.error(e)
|
|
267
268
|
|
|
268
|
-
def
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
269
|
+
def _set_logger(self, agent_name: str) -> None:
|
|
270
|
+
params = {"name": agent_name}
|
|
271
|
+
if isinstance(self._logger_params, dict):
|
|
272
|
+
params.update(self._logger_params)
|
|
273
|
+
self._logger = DMLogger(**params)
|
|
274
|
+
|
|
275
|
+
@classmethod
|
|
276
|
+
def set_logger_params(cls, extra_params = None) -> None:
|
|
277
|
+
if isinstance(extra_params, dict) or extra_params is None:
|
|
278
|
+
cls._logger_params = extra_params
|
|
@@ -10,6 +10,17 @@ __all__ = ["DMAioAIAgent"]
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
class DMAioAIAgent(DMAIAgent):
|
|
13
|
+
_logger_params = None
|
|
14
|
+
|
|
15
|
+
def __init__(self, *args, agent_name: str = "AioAIAgent", **kwargs):
|
|
16
|
+
super().__init__(*args, **kwargs)
|
|
17
|
+
|
|
18
|
+
if not isinstance(self._logger_params, dict):
|
|
19
|
+
self._logger_params = {}
|
|
20
|
+
if "name" not in self._logger_params:
|
|
21
|
+
self._logger_params["name"] = agent_name
|
|
22
|
+
self._set_logger(agent_name)
|
|
23
|
+
|
|
13
24
|
async def run(self, query: str, *args, **kwargs) -> str:
|
|
14
25
|
new_messages = await self.run_messages(messages=[{"role": "user", "content": query}], *args, **kwargs)
|
|
15
26
|
return new_messages[-1].content
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: dm-aioaiagent
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.9
|
|
4
4
|
Summary: This is my custom aioaiagent client
|
|
5
5
|
Home-page: https://pypi.org/project/dm-aioaiagent
|
|
6
6
|
Author: dimka4621
|
|
@@ -12,7 +12,7 @@ Classifier: License :: OSI Approved :: MIT License
|
|
|
12
12
|
Classifier: Operating System :: OS Independent
|
|
13
13
|
Requires-Python: >=3.9
|
|
14
14
|
Description-Content-Type: text/markdown
|
|
15
|
-
Requires-Dist: dm-logger~=0.
|
|
15
|
+
Requires-Dist: dm-logger~=0.6.2
|
|
16
16
|
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
|
|
@@ -48,6 +48,16 @@ Dynamic: summary
|
|
|
48
48
|
|
|
49
49
|
Analogue to `DMAioAIAgent` is the synchronous client `DMAIAgent`.
|
|
50
50
|
|
|
51
|
+
### Windows Setup
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
import asyncio
|
|
55
|
+
import sys
|
|
56
|
+
|
|
57
|
+
if sys.platform == "win32":
|
|
58
|
+
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
|
|
59
|
+
```
|
|
60
|
+
|
|
51
61
|
### Use agent *with* inner memory and run *single* message
|
|
52
62
|
|
|
53
63
|
By default, agent use inner memory to store the conversation history.
|
|
@@ -172,30 +182,21 @@ if __name__ == "__main__":
|
|
|
172
182
|
|
|
173
183
|
### Set custom logger
|
|
174
184
|
|
|
175
|
-
_If you want set up custom logger_
|
|
176
|
-
|
|
177
185
|
```python
|
|
178
|
-
from dm_aioaiagent import
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
def error(self, message):
|
|
193
|
-
print(message)
|
|
194
|
-
|
|
186
|
+
from dm_aioaiagent import DMAIAgent
|
|
187
|
+
from dm_logger import FormatterConfig
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
# set up custom logger for all clients
|
|
191
|
+
DMAIAgent.set_logger_params(
|
|
192
|
+
{
|
|
193
|
+
"name": "my_name",
|
|
194
|
+
"formatter_config": FormatterConfig(
|
|
195
|
+
show_datetime=False,
|
|
196
|
+
)
|
|
197
|
+
}
|
|
198
|
+
)
|
|
199
|
+
```
|
|
195
200
|
|
|
196
|
-
|
|
197
|
-
ai_agent = DMAioAIAgent()
|
|
201
|
+
See more about DMLogger [here](https://github.com/MykhLibs/dm-logger)
|
|
198
202
|
|
|
199
|
-
# set up custom logger for this agent
|
|
200
|
-
ai_agent.set_logger(MyLogger())
|
|
201
|
-
```
|
|
@@ -8,7 +8,7 @@ def readme():
|
|
|
8
8
|
|
|
9
9
|
setup(
|
|
10
10
|
name='dm-aioaiagent',
|
|
11
|
-
version='v0.4.
|
|
11
|
+
version='v0.4.9',
|
|
12
12
|
author='dimka4621',
|
|
13
13
|
author_email='mismartconfig@gmail.com',
|
|
14
14
|
description='This is my custom aioaiagent client',
|
|
@@ -17,7 +17,7 @@ setup(
|
|
|
17
17
|
url='https://pypi.org/project/dm-aioaiagent',
|
|
18
18
|
packages=find_packages(),
|
|
19
19
|
install_requires=[
|
|
20
|
-
'dm-logger~=0.
|
|
20
|
+
'dm-logger~=0.6.2',
|
|
21
21
|
'python-dotenv>=1.0.0',
|
|
22
22
|
'pydantic>=2.9.2, < 3.0.0',
|
|
23
23
|
'langchain~=0.3.0',
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|