maitai-python 1.1.16b0__tar.gz → 1.1.18__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.16b0 → maitai_python-1.1.18}/PKG-INFO +1 -1
- {maitai_python-1.1.16b0 → maitai_python-1.1.18}/maitai/_config.py +3 -1
- {maitai_python-1.1.16b0 → maitai_python-1.1.18}/maitai_common/processes/websocket_listener_thread.py +7 -3
- {maitai_python-1.1.16b0 → maitai_python-1.1.18}/maitai_common/version.py +1 -1
- {maitai_python-1.1.16b0 → maitai_python-1.1.18}/maitai_gen/chat/__init__.py +3 -1
- {maitai_python-1.1.16b0 → maitai_python-1.1.18}/maitai_gen/config/__init__.py +3 -0
- maitai_python-1.1.18/maitai_gen/rates/__init__.py +39 -0
- {maitai_python-1.1.16b0 → maitai_python-1.1.18}/maitai_python.egg-info/PKG-INFO +1 -1
- {maitai_python-1.1.16b0 → maitai_python-1.1.18}/maitai_python.egg-info/SOURCES.txt +1 -0
- {maitai_python-1.1.16b0 → maitai_python-1.1.18}/README.md +0 -0
- {maitai_python-1.1.16b0 → maitai_python-1.1.18}/maitai/__init__.py +0 -0
- {maitai_python-1.1.16b0 → maitai_python-1.1.18}/maitai/_azure.py +0 -0
- {maitai_python-1.1.16b0 → maitai_python-1.1.18}/maitai/_config_listener_thread.py +0 -0
- {maitai_python-1.1.16b0 → maitai_python-1.1.18}/maitai/_context.py +0 -0
- {maitai_python-1.1.16b0 → maitai_python-1.1.18}/maitai/_evaluator.py +0 -0
- {maitai_python-1.1.16b0 → maitai_python-1.1.18}/maitai/_inference.py +0 -0
- {maitai_python-1.1.16b0 → maitai_python-1.1.18}/maitai/_maitai.py +0 -0
- {maitai_python-1.1.16b0 → maitai_python-1.1.18}/maitai/_maitai_async.py +0 -0
- {maitai_python-1.1.16b0 → maitai_python-1.1.18}/maitai/_maitai_client.py +0 -0
- {maitai_python-1.1.16b0 → maitai_python-1.1.18}/maitai/_types.py +0 -0
- {maitai_python-1.1.16b0 → maitai_python-1.1.18}/maitai/_utils.py +0 -0
- {maitai_python-1.1.16b0 → maitai_python-1.1.18}/maitai/tools/__init__.py +0 -0
- {maitai_python-1.1.16b0 → maitai_python-1.1.18}/maitai_common/__init__.py +0 -0
- {maitai_python-1.1.16b0 → maitai_python-1.1.18}/maitai_common/config/__init__.py +0 -0
- {maitai_python-1.1.16b0 → maitai_python-1.1.18}/maitai_common/config/config_service.py +0 -0
- {maitai_python-1.1.16b0 → maitai_python-1.1.18}/maitai_common/processes/__init__.py +0 -0
- {maitai_python-1.1.16b0 → maitai_python-1.1.18}/maitai_common/processes/io_thread.py +0 -0
- {maitai_python-1.1.16b0 → maitai_python-1.1.18}/maitai_common/utils/__init__.py +0 -0
- {maitai_python-1.1.16b0 → maitai_python-1.1.18}/maitai_common/utils/proto_utils.py +0 -0
- {maitai_python-1.1.16b0 → maitai_python-1.1.18}/maitai_common/utils/types.py +0 -0
- {maitai_python-1.1.16b0 → maitai_python-1.1.18}/maitai_gen/__init__.py +0 -0
- {maitai_python-1.1.16b0 → maitai_python-1.1.18}/maitai_gen/application/__init__.py +0 -0
- {maitai_python-1.1.16b0 → maitai_python-1.1.18}/maitai_gen/backtest/__init__.py +0 -0
- {maitai_python-1.1.16b0 → maitai_python-1.1.18}/maitai_gen/billing/__init__.py +0 -0
- {maitai_python-1.1.16b0 → maitai_python-1.1.18}/maitai_gen/company/__init__.py +0 -0
- {maitai_python-1.1.16b0 → maitai_python-1.1.18}/maitai_gen/embedding/__init__.py +0 -0
- {maitai_python-1.1.16b0 → maitai_python-1.1.18}/maitai_gen/event/__init__.py +0 -0
- {maitai_python-1.1.16b0 → maitai_python-1.1.18}/maitai_gen/inference/__init__.py +0 -0
- {maitai_python-1.1.16b0 → maitai_python-1.1.18}/maitai_gen/key/__init__.py +0 -0
- {maitai_python-1.1.16b0 → maitai_python-1.1.18}/maitai_gen/metric/__init__.py +0 -0
- {maitai_python-1.1.16b0 → maitai_python-1.1.18}/maitai_gen/model/__init__.py +0 -0
- {maitai_python-1.1.16b0 → maitai_python-1.1.18}/maitai_gen/notification/__init__.py +0 -0
- {maitai_python-1.1.16b0 → maitai_python-1.1.18}/maitai_gen/sandbox/__init__.py +0 -0
- {maitai_python-1.1.16b0 → maitai_python-1.1.18}/maitai_gen/sentinel/__init__.py +0 -0
- {maitai_python-1.1.16b0 → maitai_python-1.1.18}/maitai_gen/session/__init__.py +0 -0
- {maitai_python-1.1.16b0 → maitai_python-1.1.18}/maitai_python.egg-info/dependency_links.txt +0 -0
- {maitai_python-1.1.16b0 → maitai_python-1.1.18}/maitai_python.egg-info/requires.txt +0 -0
- {maitai_python-1.1.16b0 → maitai_python-1.1.18}/maitai_python.egg-info/top_level.txt +0 -0
- {maitai_python-1.1.16b0 → maitai_python-1.1.18}/setup.cfg +0 -0
- {maitai_python-1.1.16b0 → maitai_python-1.1.18}/setup.py +0 -0
|
@@ -18,6 +18,7 @@ from maitai_gen.key import Key, KeyMap
|
|
|
18
18
|
|
|
19
19
|
class Config:
|
|
20
20
|
maitai_host = os.environ.get("MAITAI_HOST", 'https://api.trymaitai.ai')
|
|
21
|
+
maitai_host = maitai_host.rstrip('/')
|
|
21
22
|
maitai_ws = os.environ.get("MAITAI_WS", 'wss://09hidyy627.execute-api.us-west-2.amazonaws.com/production')
|
|
22
23
|
|
|
23
24
|
def __init__(self):
|
|
@@ -162,4 +163,5 @@ class Config:
|
|
|
162
163
|
config = Config()
|
|
163
164
|
|
|
164
165
|
import atexit
|
|
165
|
-
|
|
166
|
+
|
|
167
|
+
atexit.register(config.cleanup)
|
{maitai_python-1.1.16b0 → maitai_python-1.1.18}/maitai_common/processes/websocket_listener_thread.py
RENAMED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import threading
|
|
2
|
+
import time
|
|
2
3
|
|
|
3
4
|
import websocket
|
|
4
5
|
|
|
@@ -17,6 +18,7 @@ class WebsocketListenerThread(IOThread):
|
|
|
17
18
|
self.ws_threads = []
|
|
18
19
|
self.closing_ws = False # Add a shutdown flag
|
|
19
20
|
self.connection_established_event = threading.Event() # Add an event attribute
|
|
21
|
+
self.retry_backoff = 1
|
|
20
22
|
|
|
21
23
|
def connect_to_websocket(self):
|
|
22
24
|
self.connection_established_event.clear() # Clear the event before attempting a new connection
|
|
@@ -31,6 +33,7 @@ class WebsocketListenerThread(IOThread):
|
|
|
31
33
|
# Starting a new thread to handle the WebSocket connection
|
|
32
34
|
ws_thread = threading.Thread(target=self.ws.run_forever, name="WebsocketThread")
|
|
33
35
|
ws_thread.start()
|
|
36
|
+
self.retry_backoff = 1
|
|
34
37
|
tmp = [ws_thread]
|
|
35
38
|
for t in self.ws_threads:
|
|
36
39
|
if t.is_alive():
|
|
@@ -38,11 +41,10 @@ class WebsocketListenerThread(IOThread):
|
|
|
38
41
|
self.ws_threads = tmp
|
|
39
42
|
|
|
40
43
|
def on_message(self, ws, message):
|
|
41
|
-
print(f'Received message: {message}')
|
|
42
44
|
self.messages.append(message)
|
|
43
45
|
|
|
44
46
|
def on_close(self, ws, _, __):
|
|
45
|
-
print("
|
|
47
|
+
print("Maitai config websocket closed. Reconnecting...")
|
|
46
48
|
self.connect_to_websocket()
|
|
47
49
|
|
|
48
50
|
def on_open(self, ws):
|
|
@@ -53,7 +55,9 @@ class WebsocketListenerThread(IOThread):
|
|
|
53
55
|
self.ws.close()
|
|
54
56
|
|
|
55
57
|
def on_error(self, ws, error):
|
|
56
|
-
print(f"
|
|
58
|
+
print(f"Maitai config websocket error: {error}. Reconnecting...")
|
|
59
|
+
time.sleep(self.retry_backoff)
|
|
60
|
+
self.retry_backoff *= 2
|
|
57
61
|
self.connect_to_websocket()
|
|
58
62
|
|
|
59
63
|
def initialize(self):
|
|
@@ -18,6 +18,7 @@ import grpclib
|
|
|
18
18
|
from betterproto.grpc.grpclib_server import ServiceBase
|
|
19
19
|
|
|
20
20
|
from .. import (
|
|
21
|
+
application as _application__,
|
|
21
22
|
key as _key__,
|
|
22
23
|
metric as _metric__,
|
|
23
24
|
sentinel as _sentinel__,
|
|
@@ -280,7 +281,7 @@ class ToolCall(betterproto.Message):
|
|
|
280
281
|
id: str = betterproto.string_field(1)
|
|
281
282
|
type: str = betterproto.string_field(2)
|
|
282
283
|
function: "ToolCallFunction" = betterproto.message_field(3)
|
|
283
|
-
index: int = betterproto.int64_field(4)
|
|
284
|
+
index: Optional[int] = betterproto.int64_field(4, optional=True, group="_index")
|
|
284
285
|
|
|
285
286
|
|
|
286
287
|
@dataclass(eq=False, repr=False)
|
|
@@ -387,6 +388,7 @@ class Turn(betterproto.Message):
|
|
|
387
388
|
request: "ChatCompletionRequest" = betterproto.message_field(1)
|
|
388
389
|
response: "ChatCompletionResponse" = betterproto.message_field(2)
|
|
389
390
|
eval_request: "EvaluateRequest" = betterproto.message_field(3)
|
|
391
|
+
application: "_application__.Application" = betterproto.message_field(4)
|
|
390
392
|
|
|
391
393
|
|
|
392
394
|
@dataclass(eq=False, repr=False)
|
|
@@ -39,6 +39,9 @@ class Config(betterproto.Message):
|
|
|
39
39
|
fallback_model: Optional[str] = betterproto.string_field(
|
|
40
40
|
19, optional=True, group="_fallback_model"
|
|
41
41
|
)
|
|
42
|
+
intent_stability: Optional[str] = betterproto.string_field(
|
|
43
|
+
20, optional=True, group="_intent_stability"
|
|
44
|
+
)
|
|
42
45
|
|
|
43
46
|
|
|
44
47
|
@dataclass(eq=False, repr=False)
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
2
|
+
# sources: rates.proto
|
|
3
|
+
# plugin: python-betterproto
|
|
4
|
+
# This file has been @generated
|
|
5
|
+
|
|
6
|
+
from dataclasses import dataclass
|
|
7
|
+
|
|
8
|
+
import betterproto
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass(eq=False, repr=False)
|
|
12
|
+
class RateLimits(betterproto.Message):
|
|
13
|
+
id: int = betterproto.int64_field(1)
|
|
14
|
+
date_created: int = betterproto.int64_field(2)
|
|
15
|
+
company_id: int = betterproto.int64_field(3)
|
|
16
|
+
requests_day: int = betterproto.int64_field(4)
|
|
17
|
+
requests_minute: int = betterproto.int64_field(5)
|
|
18
|
+
tokens_day: int = betterproto.int64_field(6)
|
|
19
|
+
tokens_minute: int = betterproto.int64_field(7)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@dataclass(eq=False, repr=False)
|
|
23
|
+
class RateUsage(betterproto.Message):
|
|
24
|
+
company_id: int = betterproto.int64_field(1)
|
|
25
|
+
requests_day: int = betterproto.int64_field(2)
|
|
26
|
+
requests_minute: int = betterproto.int64_field(3)
|
|
27
|
+
tokens_day: int = betterproto.int64_field(4)
|
|
28
|
+
tokens_minute: int = betterproto.int64_field(5)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
@dataclass(eq=False, repr=False)
|
|
32
|
+
class RequestInfo(betterproto.Message):
|
|
33
|
+
request_id: str = betterproto.string_field(1)
|
|
34
|
+
company_id: int = betterproto.int64_field(2)
|
|
35
|
+
application_id: int = betterproto.int64_field(3)
|
|
36
|
+
application_action_id: int = betterproto.int64_field(4)
|
|
37
|
+
model: str = betterproto.string_field(5)
|
|
38
|
+
date_created: int = betterproto.int64_field(6)
|
|
39
|
+
prompt_tokens: int = betterproto.int64_field(7)
|
|
@@ -37,6 +37,7 @@ maitai_gen/key/__init__.py
|
|
|
37
37
|
maitai_gen/metric/__init__.py
|
|
38
38
|
maitai_gen/model/__init__.py
|
|
39
39
|
maitai_gen/notification/__init__.py
|
|
40
|
+
maitai_gen/rates/__init__.py
|
|
40
41
|
maitai_gen/sandbox/__init__.py
|
|
41
42
|
maitai_gen/sentinel/__init__.py
|
|
42
43
|
maitai_gen/session/__init__.py
|
|
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
|
|
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
|