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.
Files changed (36) hide show
  1. {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/PKG-INFO +1 -1
  2. {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai/_config_listener.py +3 -1
  3. {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai/_types.py +22 -5
  4. {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai_common/version.py +1 -1
  5. {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai_python.egg-info/PKG-INFO +1 -1
  6. {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/README.md +0 -0
  7. {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai/__init__.py +0 -0
  8. {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai/_config.py +0 -0
  9. {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai/_context.py +0 -0
  10. {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai/_evaluator.py +0 -0
  11. {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai/_inference.py +0 -0
  12. {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai/_maitai.py +0 -0
  13. {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai/_maitai_async.py +0 -0
  14. {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai/_maitai_client.py +0 -0
  15. {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai/_pydantic.py +0 -0
  16. {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai/_utils.py +0 -0
  17. {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai/exceptions.py +0 -0
  18. {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai/models/__init__.py +0 -0
  19. {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai/models/application.py +0 -0
  20. {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai/models/chat.py +0 -0
  21. {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai/models/config.py +0 -0
  22. {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai/models/event.py +0 -0
  23. {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai/models/inference.py +0 -0
  24. {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai/models/key.py +0 -0
  25. {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai/models/metric.py +0 -0
  26. {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai/models/sentinel.py +0 -0
  27. {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai/tools/__init__.py +0 -0
  28. {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai_common/__init__.py +0 -0
  29. {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai_common/config/__init__.py +0 -0
  30. {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai_common/config/config_service.py +0 -0
  31. {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai_python.egg-info/SOURCES.txt +0 -0
  32. {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai_python.egg-info/dependency_links.txt +0 -0
  33. {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai_python.egg-info/requires.txt +0 -0
  34. {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/maitai_python.egg-info/top_level.txt +0 -0
  35. {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/setup.cfg +0 -0
  36. {maitai_python-1.2.16b0 → maitai_python-1.2.17b0}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maitai-python
3
- Version: 1.2.16b0
3
+ Version: 1.2.17b0
4
4
  Summary: Maitai SDK for Python
5
5
  Home-page: https://docs.trymaitai.ai
6
6
  Author: Maitai
@@ -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(application_json)
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
- timeout=self.timeout
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):
@@ -1,3 +1,3 @@
1
- version = "1.2.16b0"
1
+ version = "1.2.17b0"
2
2
  if __name__ == "__main__":
3
3
  print(version)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maitai-python
3
- Version: 1.2.16b0
3
+ Version: 1.2.17b0
4
4
  Summary: Maitai SDK for Python
5
5
  Home-page: https://docs.trymaitai.ai
6
6
  Author: Maitai