maitai-python 1.2.16b0__tar.gz → 1.2.17b0__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.2.16b0 → maitai_python-1.2.17b0}/PKG-INFO +1 -1
- {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai/_config_listener.py +3 -1
- {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai/_types.py +22 -5
- {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai_common/version.py +1 -1
- {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai_python.egg-info/PKG-INFO +1 -1
- {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/README.md +0 -0
- {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai/__init__.py +0 -0
- {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai/_config.py +0 -0
- {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai/_context.py +0 -0
- {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai/_evaluator.py +0 -0
- {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai/_inference.py +0 -0
- {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai/_maitai.py +0 -0
- {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai/_maitai_async.py +0 -0
- {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai/_maitai_client.py +0 -0
- {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai/_pydantic.py +0 -0
- {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai/_utils.py +0 -0
- {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai/exceptions.py +0 -0
- {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai/models/__init__.py +0 -0
- {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai/models/application.py +0 -0
- {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai/models/chat.py +0 -0
- {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai/models/config.py +0 -0
- {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai/models/event.py +0 -0
- {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai/models/inference.py +0 -0
- {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai/models/key.py +0 -0
- {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai/models/metric.py +0 -0
- {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai/models/sentinel.py +0 -0
- {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai/tools/__init__.py +0 -0
- {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai_common/__init__.py +0 -0
- {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai_common/config/__init__.py +0 -0
- {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai_common/config/config_service.py +0 -0
- {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai_python.egg-info/SOURCES.txt +0 -0
- {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai_python.egg-info/dependency_links.txt +0 -0
- {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai_python.egg-info/requires.txt +0 -0
- {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai_python.egg-info/top_level.txt +0 -0
- {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/setup.cfg +0 -0
- {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/setup.py +0 -0
|
@@ -25,7 +25,9 @@ class ConfigListener:
|
|
|
25
25
|
application_json = event.get("event_data")
|
|
26
26
|
if application_json:
|
|
27
27
|
try:
|
|
28
|
-
application = Application.model_validate(
|
|
28
|
+
application = Application.model_validate(
|
|
29
|
+
json.loads(application_json)
|
|
30
|
+
)
|
|
29
31
|
logging.log("Maitai received configuration change")
|
|
30
32
|
self.config.store_application_metadata([application])
|
|
31
33
|
except Exception as e:
|
|
@@ -89,23 +89,40 @@ class QueueIterable:
|
|
|
89
89
|
self.queue = chunk_queue
|
|
90
90
|
self.done = False
|
|
91
91
|
self.timeout = timeout
|
|
92
|
+
# Keep track of whether we're in async or sync mode
|
|
93
|
+
self._async_mode = None
|
|
92
94
|
|
|
93
95
|
def __aiter__(self):
|
|
94
96
|
"""Returns the asynchronous iterator object itself."""
|
|
97
|
+
# Set mode to async to prevent mixing with sync iteration
|
|
98
|
+
if self._async_mode is None:
|
|
99
|
+
self._async_mode = True
|
|
100
|
+
elif self._async_mode is False:
|
|
101
|
+
# Reset state if switching from sync to async
|
|
102
|
+
self.done = False
|
|
103
|
+
self._async_mode = True
|
|
95
104
|
return self
|
|
96
105
|
|
|
97
106
|
def __iter__(self):
|
|
98
107
|
"""Returns the iterator object itself."""
|
|
108
|
+
# Set mode to sync to prevent mixing with async iteration
|
|
109
|
+
if self._async_mode is None:
|
|
110
|
+
self._async_mode = False
|
|
111
|
+
elif self._async_mode is True:
|
|
112
|
+
# Reset state if switching from async to sync
|
|
113
|
+
self.done = False
|
|
114
|
+
self._async_mode = False
|
|
99
115
|
return self
|
|
100
116
|
|
|
101
117
|
def __next__(self) -> chat_types.ChatCompletionChunk:
|
|
118
|
+
if self.done:
|
|
119
|
+
raise StopIteration
|
|
120
|
+
|
|
102
121
|
while not self.done:
|
|
103
122
|
try:
|
|
104
123
|
# Wait for an item from the queue, block if necessary
|
|
105
|
-
item = self.queue.get(
|
|
106
|
-
|
|
107
|
-
) # Wait for 10 seconds, adjust as needed
|
|
108
|
-
if isinstance(item, StopIteration):
|
|
124
|
+
item = self.queue.get(timeout=self.timeout)
|
|
125
|
+
if item is None or isinstance(item, StopIteration):
|
|
109
126
|
self.done = True # Set done to True to prevent further blocking
|
|
110
127
|
raise StopIteration
|
|
111
128
|
elif isinstance(item, Exception):
|
|
@@ -128,7 +145,7 @@ class QueueIterable:
|
|
|
128
145
|
else:
|
|
129
146
|
item = await self.queue.get()
|
|
130
147
|
|
|
131
|
-
if isinstance(item, StopIteration):
|
|
148
|
+
if item is None or isinstance(item, StopIteration):
|
|
132
149
|
self.done = True # Set done to True to prevent further blocking
|
|
133
150
|
raise StopAsyncIteration
|
|
134
151
|
elif isinstance(item, Exception):
|
|
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
|
{maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai_python.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|