maitai-python 1.1.10__tar.gz → 1.1.11b0__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.
- {maitai_python-1.1.10 → maitai_python-1.1.11b0}/PKG-INFO +1 -1
- {maitai_python-1.1.10 → maitai_python-1.1.11b0}/maitai/_maitai.py +7 -0
- {maitai_python-1.1.10 → maitai_python-1.1.11b0}/maitai/_maitai_async.py +7 -0
- {maitai_python-1.1.10 → maitai_python-1.1.11b0}/maitai/_utils.py +1 -1
- {maitai_python-1.1.10 → maitai_python-1.1.11b0}/maitai_common/processes/io_thread.py +9 -12
- {maitai_python-1.1.10 → maitai_python-1.1.11b0}/maitai_common/version.py +1 -1
- {maitai_python-1.1.10 → maitai_python-1.1.11b0}/maitai_python.egg-info/PKG-INFO +1 -1
- {maitai_python-1.1.10 → maitai_python-1.1.11b0}/README.md +0 -0
- {maitai_python-1.1.10 → maitai_python-1.1.11b0}/maitai/__init__.py +0 -0
- {maitai_python-1.1.10 → maitai_python-1.1.11b0}/maitai/_azure.py +0 -0
- {maitai_python-1.1.10 → maitai_python-1.1.11b0}/maitai/_config.py +0 -0
- {maitai_python-1.1.10 → maitai_python-1.1.11b0}/maitai/_config_listener_thread.py +0 -0
- {maitai_python-1.1.10 → maitai_python-1.1.11b0}/maitai/_context.py +0 -0
- {maitai_python-1.1.10 → maitai_python-1.1.11b0}/maitai/_evaluator.py +0 -0
- {maitai_python-1.1.10 → maitai_python-1.1.11b0}/maitai/_inference.py +0 -0
- {maitai_python-1.1.10 → maitai_python-1.1.11b0}/maitai/_maitai_client.py +0 -0
- {maitai_python-1.1.10 → maitai_python-1.1.11b0}/maitai/_types.py +0 -0
- {maitai_python-1.1.10 → maitai_python-1.1.11b0}/maitai/tools/__init__.py +0 -0
- {maitai_python-1.1.10 → maitai_python-1.1.11b0}/maitai_common/__init__.py +0 -0
- {maitai_python-1.1.10 → maitai_python-1.1.11b0}/maitai_common/config/__init__.py +0 -0
- {maitai_python-1.1.10 → maitai_python-1.1.11b0}/maitai_common/config/config_service.py +0 -0
- {maitai_python-1.1.10 → maitai_python-1.1.11b0}/maitai_common/processes/__init__.py +0 -0
- {maitai_python-1.1.10 → maitai_python-1.1.11b0}/maitai_common/processes/websocket_listener_thread.py +0 -0
- {maitai_python-1.1.10 → maitai_python-1.1.11b0}/maitai_common/utils/__init__.py +0 -0
- {maitai_python-1.1.10 → maitai_python-1.1.11b0}/maitai_common/utils/proto_utils.py +0 -0
- {maitai_python-1.1.10 → maitai_python-1.1.11b0}/maitai_common/utils/types.py +0 -0
- {maitai_python-1.1.10 → maitai_python-1.1.11b0}/maitai_gen/__init__.py +0 -0
- {maitai_python-1.1.10 → maitai_python-1.1.11b0}/maitai_gen/application/__init__.py +0 -0
- {maitai_python-1.1.10 → maitai_python-1.1.11b0}/maitai_gen/backtest/__init__.py +0 -0
- {maitai_python-1.1.10 → maitai_python-1.1.11b0}/maitai_gen/chat/__init__.py +0 -0
- {maitai_python-1.1.10 → maitai_python-1.1.11b0}/maitai_gen/company/__init__.py +0 -0
- {maitai_python-1.1.10 → maitai_python-1.1.11b0}/maitai_gen/config/__init__.py +0 -0
- {maitai_python-1.1.10 → maitai_python-1.1.11b0}/maitai_gen/embedding/__init__.py +0 -0
- {maitai_python-1.1.10 → maitai_python-1.1.11b0}/maitai_gen/event/__init__.py +0 -0
- {maitai_python-1.1.10 → maitai_python-1.1.11b0}/maitai_gen/inference/__init__.py +0 -0
- {maitai_python-1.1.10 → maitai_python-1.1.11b0}/maitai_gen/key/__init__.py +0 -0
- {maitai_python-1.1.10 → maitai_python-1.1.11b0}/maitai_gen/metric/__init__.py +0 -0
- {maitai_python-1.1.10 → maitai_python-1.1.11b0}/maitai_gen/model/__init__.py +0 -0
- {maitai_python-1.1.10 → maitai_python-1.1.11b0}/maitai_gen/notification/__init__.py +0 -0
- {maitai_python-1.1.10 → maitai_python-1.1.11b0}/maitai_gen/sandbox/__init__.py +0 -0
- {maitai_python-1.1.10 → maitai_python-1.1.11b0}/maitai_gen/sentinel/__init__.py +0 -0
- {maitai_python-1.1.10 → maitai_python-1.1.11b0}/maitai_gen/session/__init__.py +0 -0
- {maitai_python-1.1.10 → maitai_python-1.1.11b0}/maitai_python.egg-info/SOURCES.txt +0 -0
- {maitai_python-1.1.10 → maitai_python-1.1.11b0}/maitai_python.egg-info/dependency_links.txt +0 -0
- {maitai_python-1.1.10 → maitai_python-1.1.11b0}/maitai_python.egg-info/requires.txt +0 -0
- {maitai_python-1.1.10 → maitai_python-1.1.11b0}/maitai_python.egg-info/top_level.txt +0 -0
- {maitai_python-1.1.10 → maitai_python-1.1.11b0}/setup.cfg +0 -0
- {maitai_python-1.1.10 → maitai_python-1.1.11b0}/setup.py +0 -0
|
@@ -160,6 +160,13 @@ class Completions:
|
|
|
160
160
|
raise ValueError("server_side_inference must be true to apply_corrections")
|
|
161
161
|
if apply_corrections is True and evaluation_enabled is False:
|
|
162
162
|
raise ValueError("evaluations must be enabled to apply_corrections")
|
|
163
|
+
if assistant is True:
|
|
164
|
+
user_msgs = [True for msg in messages if msg["role"] == "user"]
|
|
165
|
+
assistant_messages = [True for msg in messages if msg["role"] == "user"]
|
|
166
|
+
if len(user_msgs) != 1:
|
|
167
|
+
raise ValueError("When assistant = True, exactly 1 user message is required")
|
|
168
|
+
if len(assistant_messages) > 0:
|
|
169
|
+
raise ValueError("When assistant = True, no assistant messages are allowed")
|
|
163
170
|
if not session_id:
|
|
164
171
|
session_id = str(uuid.uuid4())
|
|
165
172
|
if not intent and action_type:
|
|
@@ -155,6 +155,13 @@ class AsyncCompletions:
|
|
|
155
155
|
raise ValueError("server_side_inference must be true to apply_corrections")
|
|
156
156
|
if apply_corrections is True and evaluation_enabled is False:
|
|
157
157
|
raise ValueError("evaluations must be enabled to apply_corrections")
|
|
158
|
+
if assistant is True:
|
|
159
|
+
user_msgs = [True for msg in messages if msg["role"] == "user"]
|
|
160
|
+
assistant_messages = [True for msg in messages if msg["role"] == "user"]
|
|
161
|
+
if len(user_msgs) != 1:
|
|
162
|
+
raise ValueError("When assistant = True, exactly 1 user message is required")
|
|
163
|
+
if len(assistant_messages) > 0:
|
|
164
|
+
raise ValueError("When assistant = True, no assistant messages are allowed")
|
|
158
165
|
if not session_id:
|
|
159
166
|
session_id = str(uuid.uuid4())
|
|
160
167
|
if action_type and not intent:
|
|
@@ -160,7 +160,7 @@ def get_chat_completion_params(*,
|
|
|
160
160
|
params.tools = []
|
|
161
161
|
if isinstance(tools, Tools):
|
|
162
162
|
params.tools = tools.get_tool_definitions()
|
|
163
|
-
|
|
163
|
+
elif tools:
|
|
164
164
|
for tool in tools:
|
|
165
165
|
if isinstance(tool, Callable) and not isinstance(tool, ToolFunction):
|
|
166
166
|
raise TypeError(f"Method passed into tools missing @tool decorator")
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import asyncio
|
|
2
2
|
import time
|
|
3
3
|
import traceback
|
|
4
4
|
from threading import Thread
|
|
@@ -16,17 +16,20 @@ class IOThread(Thread):
|
|
|
16
16
|
self.completed_loops = 0
|
|
17
17
|
self.avg_loop_time = 0
|
|
18
18
|
self.cleaned = False
|
|
19
|
-
self.timer_thread = None
|
|
20
19
|
self.last_loop_start = -1
|
|
21
20
|
self.child_name = self.__class__.__name__ if name is None else name
|
|
22
21
|
|
|
23
22
|
def run(self):
|
|
24
23
|
if not self.initialized:
|
|
25
24
|
self.initialize()
|
|
26
|
-
|
|
27
|
-
self.loop()
|
|
25
|
+
asyncio.run(self.main_loop())
|
|
28
26
|
|
|
29
|
-
def
|
|
27
|
+
async def main_loop(self):
|
|
28
|
+
await asyncio.sleep(self.interval)
|
|
29
|
+
while self.run_thread:
|
|
30
|
+
await self.loop()
|
|
31
|
+
|
|
32
|
+
async def loop(self):
|
|
30
33
|
if self.run_thread:
|
|
31
34
|
self.last_loop_start = time.time()
|
|
32
35
|
self.is_running = True
|
|
@@ -41,18 +44,12 @@ class IOThread(Thread):
|
|
|
41
44
|
self.avg_loop_time = ((self.avg_loop_time * self.completed_loops) * delta) / (self.completed_loops + 1)
|
|
42
45
|
self.completed_loops += 1
|
|
43
46
|
next_run = self.interval - delta
|
|
44
|
-
|
|
45
|
-
self.timer_thread.name = self.child_name
|
|
46
|
-
self.timer_thread.start()
|
|
47
|
+
await asyncio.sleep(max(0, next_run))
|
|
47
48
|
else:
|
|
48
|
-
if self.timer_thread is not None:
|
|
49
|
-
self.timer_thread.cancel()
|
|
50
49
|
self.cleaned = True
|
|
51
50
|
|
|
52
51
|
def terminate(self):
|
|
53
52
|
self.run_thread = False
|
|
54
|
-
if self.timer_thread is not None:
|
|
55
|
-
self.timer_thread.cancel()
|
|
56
53
|
self.cleaned = True
|
|
57
54
|
self.print(f'{self.child_name} cleaned up')
|
|
58
55
|
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{maitai_python-1.1.10 → maitai_python-1.1.11b0}/maitai_common/processes/websocket_listener_thread.py
RENAMED
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|