maitai-python 1.0.21__tar.gz → 1.0.23__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.21 → maitai_python-1.0.23}/PKG-INFO +1 -1
- {maitai_python-1.0.21 → maitai_python-1.0.23}/maitai/_config.py +5 -1
- maitai_python-1.0.23/maitai/_config_listener_thread.py +23 -0
- {maitai_python-1.0.21 → maitai_python-1.0.23}/maitai_common/config/config_service.py +4 -3
- {maitai_python-1.0.21 → maitai_python-1.0.23}/maitai_common/version.py +1 -1
- {maitai_python-1.0.21 → maitai_python-1.0.23}/maitai_gen/chat/__init__.py +3 -0
- {maitai_python-1.0.21 → maitai_python-1.0.23}/maitai_python.egg-info/PKG-INFO +1 -1
- maitai_python-1.0.21/maitai/_config_listener_thread.py +0 -14
- {maitai_python-1.0.21 → maitai_python-1.0.23}/README.md +0 -0
- {maitai_python-1.0.21 → maitai_python-1.0.23}/maitai/__init__.py +0 -0
- {maitai_python-1.0.21 → maitai_python-1.0.23}/maitai/_azure.py +0 -0
- {maitai_python-1.0.21 → maitai_python-1.0.23}/maitai/_evaluator.py +0 -0
- {maitai_python-1.0.21 → maitai_python-1.0.23}/maitai/_inference.py +0 -0
- {maitai_python-1.0.21 → maitai_python-1.0.23}/maitai/_maitai_client.py +0 -0
- {maitai_python-1.0.21 → maitai_python-1.0.23}/maitai/_openai.py +0 -0
- {maitai_python-1.0.21 → maitai_python-1.0.23}/maitai/_openai_async.py +0 -0
- {maitai_python-1.0.21 → maitai_python-1.0.23}/maitai/_openai_types.py +0 -0
- {maitai_python-1.0.21 → maitai_python-1.0.23}/maitai/_utils.py +0 -0
- {maitai_python-1.0.21 → maitai_python-1.0.23}/maitai_common/__init__.py +0 -0
- {maitai_python-1.0.21 → maitai_python-1.0.23}/maitai_common/config/__init__.py +0 -0
- {maitai_python-1.0.21 → maitai_python-1.0.23}/maitai_common/processes/__init__.py +0 -0
- {maitai_python-1.0.21 → maitai_python-1.0.23}/maitai_common/processes/io_thread.py +0 -0
- {maitai_python-1.0.21 → maitai_python-1.0.23}/maitai_common/processes/websocket_listener_thread.py +0 -0
- {maitai_python-1.0.21 → maitai_python-1.0.23}/maitai_common/utils/__init__.py +0 -0
- {maitai_python-1.0.21 → maitai_python-1.0.23}/maitai_common/utils/proto_utils.py +0 -0
- {maitai_python-1.0.21 → maitai_python-1.0.23}/maitai_common/utils/types.py +0 -0
- {maitai_python-1.0.21 → maitai_python-1.0.23}/maitai_gen/__init__.py +0 -0
- {maitai_python-1.0.21 → maitai_python-1.0.23}/maitai_gen/application/__init__.py +0 -0
- {maitai_python-1.0.21 → maitai_python-1.0.23}/maitai_gen/company/__init__.py +0 -0
- {maitai_python-1.0.21 → maitai_python-1.0.23}/maitai_gen/config/__init__.py +0 -0
- {maitai_python-1.0.21 → maitai_python-1.0.23}/maitai_gen/inference/__init__.py +0 -0
- {maitai_python-1.0.21 → maitai_python-1.0.23}/maitai_gen/notification/__init__.py +0 -0
- {maitai_python-1.0.21 → maitai_python-1.0.23}/maitai_gen/sandbox/__init__.py +0 -0
- {maitai_python-1.0.21 → maitai_python-1.0.23}/maitai_gen/sentinel/__init__.py +0 -0
- {maitai_python-1.0.21 → maitai_python-1.0.23}/maitai_gen/session/__init__.py +0 -0
- {maitai_python-1.0.21 → maitai_python-1.0.23}/maitai_python.egg-info/SOURCES.txt +0 -0
- {maitai_python-1.0.21 → maitai_python-1.0.23}/maitai_python.egg-info/dependency_links.txt +0 -0
- {maitai_python-1.0.21 → maitai_python-1.0.23}/maitai_python.egg-info/requires.txt +0 -0
- {maitai_python-1.0.21 → maitai_python-1.0.23}/maitai_python.egg-info/top_level.txt +0 -0
- {maitai_python-1.0.21 → maitai_python-1.0.23}/setup.cfg +0 -0
- {maitai_python-1.0.21 → maitai_python-1.0.23}/setup.py +0 -0
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import os
|
|
2
|
+
from typing import List
|
|
2
3
|
|
|
3
4
|
import requests
|
|
4
5
|
|
|
5
6
|
from maitai._config_listener_thread import ConfigListenerThread
|
|
6
|
-
from maitai_common.version import version
|
|
7
7
|
from maitai_common.config import config_service
|
|
8
|
+
from maitai_common.version import version
|
|
8
9
|
from maitai_gen.application import Application
|
|
9
10
|
from maitai_gen.chat import ChatCompletionAuth
|
|
10
11
|
from maitai_gen.config import Config as ActionConfig
|
|
@@ -86,6 +87,9 @@ class Config:
|
|
|
86
87
|
print(f"Failed to initialize API client. Status code: {response.status_code}. Error: {response.text}")
|
|
87
88
|
return
|
|
88
89
|
applications = [Application().from_dict(app_json) for app_json in response.json()]
|
|
90
|
+
return self.store_application_metadata(applications)
|
|
91
|
+
|
|
92
|
+
def store_application_metadata(self, applications: List[Application]):
|
|
89
93
|
for application in applications:
|
|
90
94
|
self._applications[application.application_ref_name] = application
|
|
91
95
|
for action_type in application.action_types:
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import json
|
|
2
|
+
|
|
3
|
+
from maitai_common.processes.websocket_listener_thread import WebsocketListenerThread
|
|
4
|
+
from maitai_gen.application import Application
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class ConfigListenerThread(WebsocketListenerThread):
|
|
8
|
+
def __init__(self, config, path, type, key=None):
|
|
9
|
+
super(ConfigListenerThread, self).__init__(path, type, key)
|
|
10
|
+
self.config = config
|
|
11
|
+
|
|
12
|
+
def on_message(self, ws, message):
|
|
13
|
+
event = json.loads(message)
|
|
14
|
+
if event.get("event_type") == 'APPLICATION_CONFIG_CHANGE':
|
|
15
|
+
application_json = event.get("event_data")
|
|
16
|
+
if application_json:
|
|
17
|
+
try:
|
|
18
|
+
application = Application().from_dict(application_json)
|
|
19
|
+
self.config.store_application_metadata([application])
|
|
20
|
+
except:
|
|
21
|
+
self.config.refresh_applications()
|
|
22
|
+
else:
|
|
23
|
+
self.config.refresh_applications()
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
from
|
|
1
|
+
from betterproto import Casing
|
|
2
|
+
|
|
2
3
|
from maitai_gen.config import Config, InferenceLocations, ModelConfig
|
|
3
4
|
|
|
4
5
|
# TODO consider finding a source of truth where we don't need to deploy everytime a new model comes out
|
|
@@ -54,7 +55,7 @@ def get_default_config() -> Config:
|
|
|
54
55
|
|
|
55
56
|
|
|
56
57
|
def reconcile_config_with_default(config_dict: dict) -> Config:
|
|
57
|
-
default_config_json =
|
|
58
|
+
default_config_json = get_default_config().to_pydict(casing=Casing.SNAKE)
|
|
58
59
|
for key, value in default_config_json.items():
|
|
59
60
|
if key not in config_dict:
|
|
60
61
|
config_dict[key] = value
|
|
@@ -81,4 +82,4 @@ def get_available_models():
|
|
|
81
82
|
default_client_model=DEFAULT_CLIENT_MODEL,
|
|
82
83
|
default_server_model=DEFAULT_SERVER_MODEL,
|
|
83
84
|
)
|
|
84
|
-
return
|
|
85
|
+
return model_config.to_pydict(casing=Casing.SNAKE)
|
|
@@ -52,6 +52,7 @@ class ChatCompletionRequest(betterproto.Message):
|
|
|
52
52
|
evaluation_enabled: bool = betterproto.bool_field(11)
|
|
53
53
|
auth_info: "ChatCompletionAuth" = betterproto.message_field(12)
|
|
54
54
|
return_evaluation: bool = betterproto.bool_field(13)
|
|
55
|
+
error: str = betterproto.string_field(14)
|
|
55
56
|
|
|
56
57
|
|
|
57
58
|
@dataclass(eq=False, repr=False)
|
|
@@ -125,6 +126,7 @@ class ChatCompletionResponse(betterproto.Message):
|
|
|
125
126
|
evaluate_response: Optional["EvaluateResponse"] = betterproto.message_field(
|
|
126
127
|
11, optional=True, group="_evaluate_response"
|
|
127
128
|
)
|
|
129
|
+
correction_applied: bool = betterproto.bool_field(12)
|
|
128
130
|
|
|
129
131
|
|
|
130
132
|
@dataclass(eq=False, repr=False)
|
|
@@ -161,6 +163,7 @@ class ChatCompletionChunk(betterproto.Message):
|
|
|
161
163
|
evaluate_response: Optional["EvaluateResponse"] = betterproto.message_field(
|
|
162
164
|
8, optional=True, group="_evaluate_response"
|
|
163
165
|
)
|
|
166
|
+
correction_applied: bool = betterproto.bool_field(9)
|
|
164
167
|
|
|
165
168
|
|
|
166
169
|
@dataclass(eq=False, repr=False)
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import json
|
|
2
|
-
|
|
3
|
-
from maitai_common.processes.websocket_listener_thread import WebsocketListenerThread
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class ConfigListenerThread(WebsocketListenerThread):
|
|
7
|
-
def __init__(self, config, path, type, key=None):
|
|
8
|
-
super(ConfigListenerThread, self).__init__(path, type, key)
|
|
9
|
-
self.config = config
|
|
10
|
-
|
|
11
|
-
def on_message(self, ws, message):
|
|
12
|
-
event = json.loads(message)
|
|
13
|
-
if event.get("event_type") == 'APPLICATION_CONFIG_CHANGE':
|
|
14
|
-
self.config.refresh_applications()
|
|
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.0.21 → maitai_python-1.0.23}/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
|