maitai-python 1.0.10__tar.gz → 1.0.12__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.0.10 → maitai_python-1.0.12}/PKG-INFO +1 -1
- {maitai_python-1.0.10 → maitai_python-1.0.12}/maitai/_config.py +1 -1
- {maitai_python-1.0.10 → maitai_python-1.0.12}/maitai/_inference.py +5 -2
- {maitai_python-1.0.10 → maitai_python-1.0.12}/maitai/_openai.py +5 -0
- {maitai_python-1.0.10 → maitai_python-1.0.12}/maitai/_openai_async.py +5 -0
- {maitai_python-1.0.10 → maitai_python-1.0.12}/maitai_gen/application/__init__.py +1 -3
- {maitai_python-1.0.10 → maitai_python-1.0.12}/maitai_gen/chat/__init__.py +2 -2
- {maitai_python-1.0.10 → maitai_python-1.0.12}/maitai_gen/inference/__init__.py +1 -0
- {maitai_python-1.0.10 → maitai_python-1.0.12}/maitai_gen/notification/__init__.py +2 -0
- {maitai_python-1.0.10 → maitai_python-1.0.12}/maitai_python.egg-info/PKG-INFO +1 -1
- {maitai_python-1.0.10 → maitai_python-1.0.12}/setup.py +1 -1
- {maitai_python-1.0.10 → maitai_python-1.0.12}/README.md +0 -0
- {maitai_python-1.0.10 → maitai_python-1.0.12}/maitai/__init__.py +0 -0
- {maitai_python-1.0.10 → maitai_python-1.0.12}/maitai/_azure.py +0 -0
- {maitai_python-1.0.10 → maitai_python-1.0.12}/maitai/_config_listener_thread.py +0 -0
- {maitai_python-1.0.10 → maitai_python-1.0.12}/maitai/_evaluator.py +0 -0
- {maitai_python-1.0.10 → maitai_python-1.0.12}/maitai/_maitai_client.py +0 -0
- {maitai_python-1.0.10 → maitai_python-1.0.12}/maitai/_openai_types.py +0 -0
- {maitai_python-1.0.10 → maitai_python-1.0.12}/maitai/_utils.py +0 -0
- {maitai_python-1.0.10 → maitai_python-1.0.12}/maitai_common/__init__.py +0 -0
- {maitai_python-1.0.10 → maitai_python-1.0.12}/maitai_common/config/__init__.py +0 -0
- {maitai_python-1.0.10 → maitai_python-1.0.12}/maitai_common/config/config_service.py +0 -0
- {maitai_python-1.0.10 → maitai_python-1.0.12}/maitai_common/processes/__init__.py +0 -0
- {maitai_python-1.0.10 → maitai_python-1.0.12}/maitai_common/processes/io_thread.py +0 -0
- {maitai_python-1.0.10 → maitai_python-1.0.12}/maitai_common/processes/websocket_listener_thread.py +0 -0
- {maitai_python-1.0.10 → maitai_python-1.0.12}/maitai_common/utils/__init__.py +0 -0
- {maitai_python-1.0.10 → maitai_python-1.0.12}/maitai_common/utils/proto_utils.py +0 -0
- {maitai_python-1.0.10 → maitai_python-1.0.12}/maitai_common/utils/types.py +0 -0
- {maitai_python-1.0.10 → maitai_python-1.0.12}/maitai_gen/__init__.py +0 -0
- {maitai_python-1.0.10 → maitai_python-1.0.12}/maitai_gen/company/__init__.py +0 -0
- {maitai_python-1.0.10 → maitai_python-1.0.12}/maitai_gen/config/__init__.py +0 -0
- {maitai_python-1.0.10 → maitai_python-1.0.12}/maitai_gen/sandbox/__init__.py +0 -0
- {maitai_python-1.0.10 → maitai_python-1.0.12}/maitai_gen/sentinel/__init__.py +0 -0
- {maitai_python-1.0.10 → maitai_python-1.0.12}/maitai_gen/session/__init__.py +0 -0
- {maitai_python-1.0.10 → maitai_python-1.0.12}/maitai_python.egg-info/SOURCES.txt +0 -0
- {maitai_python-1.0.10 → maitai_python-1.0.12}/maitai_python.egg-info/dependency_links.txt +0 -0
- {maitai_python-1.0.10 → maitai_python-1.0.12}/maitai_python.egg-info/requires.txt +0 -0
- {maitai_python-1.0.10 → maitai_python-1.0.12}/maitai_python.egg-info/top_level.txt +0 -0
- {maitai_python-1.0.10 → maitai_python-1.0.12}/setup.cfg +0 -0
|
@@ -10,7 +10,7 @@ from maitai_gen.config import Config as ActionConfig
|
|
|
10
10
|
|
|
11
11
|
class Config:
|
|
12
12
|
maitai_host = os.environ.get("MAITAI_HOST", 'https://api.trymaitai.ai')
|
|
13
|
-
maitai_ws = os.environ.get("MAITAI_WS", 'wss://
|
|
13
|
+
maitai_ws = os.environ.get("MAITAI_WS", 'wss://09hidyy627.execute-api.us-west-2.amazonaws.com/production')
|
|
14
14
|
|
|
15
15
|
def __init__(self):
|
|
16
16
|
self._api_key = None
|
|
@@ -13,6 +13,11 @@ from maitai_gen.chat import ChatCompletionChunk, ChatCompletionParams, ChatCompl
|
|
|
13
13
|
from maitai_gen.inference import InferenceStreamResponse
|
|
14
14
|
|
|
15
15
|
|
|
16
|
+
class InferenceException(Exception):
|
|
17
|
+
def __init__(self, msg: str):
|
|
18
|
+
super().__init__(msg)
|
|
19
|
+
|
|
20
|
+
|
|
16
21
|
class Inference(MaitaiClient):
|
|
17
22
|
|
|
18
23
|
def __init__(self):
|
|
@@ -66,8 +71,6 @@ class Inference(MaitaiClient):
|
|
|
66
71
|
if response.status_code != 200:
|
|
67
72
|
print(f"Failed to send inference request. Status code: {response.status_code}. Error: {response.text}")
|
|
68
73
|
return
|
|
69
|
-
else:
|
|
70
|
-
print(f"Successfully sent inference request. Status code: {response.status_code}")
|
|
71
74
|
try:
|
|
72
75
|
for line in response.iter_lines():
|
|
73
76
|
if line:
|
|
@@ -8,6 +8,7 @@ import openai.types.chat as openai_chat_types
|
|
|
8
8
|
import maitai
|
|
9
9
|
from maitai._config import config
|
|
10
10
|
from maitai._evaluator import Evaluator
|
|
11
|
+
from maitai._inference import InferenceException
|
|
11
12
|
from maitai._openai_types import Body, Headers, Query
|
|
12
13
|
from maitai._utils import convert_open_ai_chat_completion_chunk, convert_openai_chat_completion, get_chat_completion_params, required_args
|
|
13
14
|
from maitai_common.utils.proto_utils import openai_messages_to_proto
|
|
@@ -165,6 +166,8 @@ class Completions:
|
|
|
165
166
|
# ChatCompletion only
|
|
166
167
|
chat_completion: Optional[ChatCompletionResponse] = None
|
|
167
168
|
for resp in response:
|
|
169
|
+
if resp.error:
|
|
170
|
+
raise InferenceException(resp.error)
|
|
168
171
|
return resp.chat_completion_response
|
|
169
172
|
return chat_completion
|
|
170
173
|
else:
|
|
@@ -276,6 +279,8 @@ def _process_openai_stream(session_id: Union[str, int],
|
|
|
276
279
|
|
|
277
280
|
def _process_inference_stream(stream: Iterable[InferenceStreamResponse]) -> Iterable[ChatCompletionChunk]:
|
|
278
281
|
for infer_resp in stream:
|
|
282
|
+
if infer_resp.error:
|
|
283
|
+
raise InferenceException(infer_resp.error)
|
|
279
284
|
chunk = infer_resp.chat_completion_chunk
|
|
280
285
|
if chunk is not None:
|
|
281
286
|
yield chunk
|
|
@@ -8,6 +8,7 @@ import openai.types.chat as openai_chat_types
|
|
|
8
8
|
import maitai
|
|
9
9
|
from maitai._config import config
|
|
10
10
|
from maitai._evaluator import Evaluator
|
|
11
|
+
from maitai._inference import InferenceException
|
|
11
12
|
from maitai._openai_types import Body, Headers, Query
|
|
12
13
|
from maitai._utils import convert_open_ai_chat_completion_chunk, convert_openai_chat_completion, get_chat_completion_params, required_args
|
|
13
14
|
from maitai_common.utils.proto_utils import openai_messages_to_proto
|
|
@@ -169,6 +170,8 @@ class AsyncCompletions:
|
|
|
169
170
|
# ChatCompletion only
|
|
170
171
|
chat_completion: Optional[ChatCompletionResponse] = None
|
|
171
172
|
async for resp in response:
|
|
173
|
+
if resp.error:
|
|
174
|
+
raise InferenceException(resp.error)
|
|
172
175
|
return resp.chat_completion_response
|
|
173
176
|
return chat_completion
|
|
174
177
|
else:
|
|
@@ -280,6 +283,8 @@ async def _process_async_openai_stream(session_id: Union[str, int],
|
|
|
280
283
|
|
|
281
284
|
async def _process_inference_stream_async(stream: AsyncIterable[InferenceStreamResponse]) -> AsyncIterable[ChatCompletionChunk]:
|
|
282
285
|
async for infer_resp in stream:
|
|
286
|
+
if infer_resp.error:
|
|
287
|
+
raise InferenceException(infer_resp.error)
|
|
283
288
|
chunk = infer_resp.chat_completion_chunk
|
|
284
289
|
if chunk is not None:
|
|
285
290
|
yield chunk
|
|
@@ -41,9 +41,7 @@ class Application(betterproto.Message):
|
|
|
41
41
|
company_id: int = betterproto.int64_field(5)
|
|
42
42
|
application_objective: "ApplicationObjective" = betterproto.message_field(6)
|
|
43
43
|
state: str = betterproto.string_field(7)
|
|
44
|
-
meta:
|
|
45
|
-
8, betterproto.TYPE_STRING, betterproto.TYPE_STRING
|
|
46
|
-
)
|
|
44
|
+
meta: "_config__.Config" = betterproto.message_field(8)
|
|
47
45
|
action_types: List["ApplicationAction"] = betterproto.message_field(9)
|
|
48
46
|
|
|
49
47
|
|
|
@@ -61,8 +61,8 @@ class ChatCompletionParams(betterproto.Message):
|
|
|
61
61
|
seed: int = betterproto.int32_field(11)
|
|
62
62
|
stream: bool = betterproto.bool_field(12)
|
|
63
63
|
stream_options: "StreamOptions" = betterproto.message_field(13)
|
|
64
|
-
logit_bias: Dict[
|
|
65
|
-
14, betterproto.
|
|
64
|
+
logit_bias: Dict[str, float] = betterproto.map_field(
|
|
65
|
+
14, betterproto.TYPE_STRING, betterproto.TYPE_DOUBLE
|
|
66
66
|
)
|
|
67
67
|
presence_penalty: float = betterproto.double_field(15)
|
|
68
68
|
frequency_penalty: float = betterproto.double_field(16)
|
|
@@ -20,6 +20,8 @@ class Notification(betterproto.Message):
|
|
|
20
20
|
meta: Dict[str, str] = betterproto.map_field(
|
|
21
21
|
7, betterproto.TYPE_STRING, betterproto.TYPE_STRING
|
|
22
22
|
)
|
|
23
|
+
application_id: int = betterproto.int64_field(8)
|
|
24
|
+
session_id: str = betterproto.string_field(9)
|
|
23
25
|
|
|
24
26
|
|
|
25
27
|
@dataclass(eq=False, repr=False)
|
|
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.0.10 → maitai_python-1.0.12}/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
|