maitai-python 1.0.13__tar.gz → 1.0.15__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.13 → maitai_python-1.0.15}/PKG-INFO +1 -1
- {maitai_python-1.0.13 → maitai_python-1.0.15}/maitai/_config.py +12 -2
- {maitai_python-1.0.13 → maitai_python-1.0.15}/maitai/_evaluator.py +1 -0
- {maitai_python-1.0.13 → maitai_python-1.0.15}/maitai/_maitai_client.py +9 -1
- {maitai_python-1.0.13 → maitai_python-1.0.15}/maitai_gen/application/__init__.py +2 -0
- {maitai_python-1.0.13 → maitai_python-1.0.15}/maitai_gen/chat/__init__.py +2 -0
- {maitai_python-1.0.13 → maitai_python-1.0.15}/maitai_python.egg-info/PKG-INFO +1 -1
- {maitai_python-1.0.13 → maitai_python-1.0.15}/setup.py +4 -1
- {maitai_python-1.0.13 → maitai_python-1.0.15}/README.md +0 -0
- {maitai_python-1.0.13 → maitai_python-1.0.15}/maitai/__init__.py +0 -0
- {maitai_python-1.0.13 → maitai_python-1.0.15}/maitai/_azure.py +0 -0
- {maitai_python-1.0.13 → maitai_python-1.0.15}/maitai/_config_listener_thread.py +0 -0
- {maitai_python-1.0.13 → maitai_python-1.0.15}/maitai/_inference.py +0 -0
- {maitai_python-1.0.13 → maitai_python-1.0.15}/maitai/_openai.py +0 -0
- {maitai_python-1.0.13 → maitai_python-1.0.15}/maitai/_openai_async.py +0 -0
- {maitai_python-1.0.13 → maitai_python-1.0.15}/maitai/_openai_types.py +0 -0
- {maitai_python-1.0.13 → maitai_python-1.0.15}/maitai/_utils.py +0 -0
- {maitai_python-1.0.13 → maitai_python-1.0.15}/maitai_common/__init__.py +0 -0
- {maitai_python-1.0.13 → maitai_python-1.0.15}/maitai_common/config/__init__.py +0 -0
- {maitai_python-1.0.13 → maitai_python-1.0.15}/maitai_common/config/config_service.py +0 -0
- {maitai_python-1.0.13 → maitai_python-1.0.15}/maitai_common/processes/__init__.py +0 -0
- {maitai_python-1.0.13 → maitai_python-1.0.15}/maitai_common/processes/io_thread.py +0 -0
- {maitai_python-1.0.13 → maitai_python-1.0.15}/maitai_common/processes/websocket_listener_thread.py +0 -0
- {maitai_python-1.0.13 → maitai_python-1.0.15}/maitai_common/utils/__init__.py +0 -0
- {maitai_python-1.0.13 → maitai_python-1.0.15}/maitai_common/utils/proto_utils.py +0 -0
- {maitai_python-1.0.13 → maitai_python-1.0.15}/maitai_common/utils/types.py +0 -0
- {maitai_python-1.0.13 → maitai_python-1.0.15}/maitai_gen/__init__.py +0 -0
- {maitai_python-1.0.13 → maitai_python-1.0.15}/maitai_gen/company/__init__.py +0 -0
- {maitai_python-1.0.13 → maitai_python-1.0.15}/maitai_gen/config/__init__.py +0 -0
- {maitai_python-1.0.13 → maitai_python-1.0.15}/maitai_gen/inference/__init__.py +0 -0
- {maitai_python-1.0.13 → maitai_python-1.0.15}/maitai_gen/notification/__init__.py +0 -0
- {maitai_python-1.0.13 → maitai_python-1.0.15}/maitai_gen/sandbox/__init__.py +0 -0
- {maitai_python-1.0.13 → maitai_python-1.0.15}/maitai_gen/sentinel/__init__.py +0 -0
- {maitai_python-1.0.13 → maitai_python-1.0.15}/maitai_gen/session/__init__.py +0 -0
- {maitai_python-1.0.13 → maitai_python-1.0.15}/maitai_python.egg-info/SOURCES.txt +0 -0
- {maitai_python-1.0.13 → maitai_python-1.0.15}/maitai_python.egg-info/dependency_links.txt +0 -0
- {maitai_python-1.0.13 → maitai_python-1.0.15}/maitai_python.egg-info/requires.txt +0 -0
- {maitai_python-1.0.13 → maitai_python-1.0.15}/maitai_python.egg-info/top_level.txt +0 -0
- {maitai_python-1.0.13 → maitai_python-1.0.15}/setup.cfg +0 -0
|
@@ -30,9 +30,12 @@ class Config:
|
|
|
30
30
|
def api_key(self):
|
|
31
31
|
if self._api_key is None:
|
|
32
32
|
if self.initialized:
|
|
33
|
-
raise ValueError("Maitai API Key has not been set")
|
|
33
|
+
raise ValueError("Maitai API Key has not been set. Either pass it directly into the client, or by setting the environment variable MAITAI_API_KEY.")
|
|
34
34
|
else:
|
|
35
|
-
|
|
35
|
+
api_key = os.environ.get("MAITAI_API_KEY")
|
|
36
|
+
if not api_key:
|
|
37
|
+
raise ValueError("Maitai API Key has not been set. Either pass it directly into the client, or by setting the environment variable MAITAI_API_KEY.")
|
|
38
|
+
self.initialize(api_key=api_key)
|
|
36
39
|
return self._api_key
|
|
37
40
|
|
|
38
41
|
@api_key.setter
|
|
@@ -61,6 +64,10 @@ class Config:
|
|
|
61
64
|
}
|
|
62
65
|
|
|
63
66
|
response = requests.get(url, headers=headers, verify=False)
|
|
67
|
+
if response.status_code != 200:
|
|
68
|
+
print(f"Failed to initialize API client. Status code: {response.status_code}. Error: {response.text}")
|
|
69
|
+
return
|
|
70
|
+
|
|
64
71
|
self._company_id = response.json().get("id")
|
|
65
72
|
|
|
66
73
|
def refresh_applications(self):
|
|
@@ -72,6 +79,9 @@ class Config:
|
|
|
72
79
|
}
|
|
73
80
|
|
|
74
81
|
response = requests.get(url, headers=headers, verify=False)
|
|
82
|
+
if response.status_code != 200:
|
|
83
|
+
print(f"Failed to initialize API client. Status code: {response.status_code}. Error: {response.text}")
|
|
84
|
+
return
|
|
75
85
|
applications = [Application().from_dict(app_json) for app_json in response.json()]
|
|
76
86
|
for application in applications:
|
|
77
87
|
self._applications[application.application_ref_name] = application
|
|
@@ -2,11 +2,18 @@ import asyncio
|
|
|
2
2
|
import os
|
|
3
3
|
import threading
|
|
4
4
|
|
|
5
|
-
from maitai_gen.chat import ChatCompletionParams, ChatCompletionRequest
|
|
6
5
|
from maitai._config import config
|
|
6
|
+
from maitai_gen.chat import ChatCompletionParams, ChatCompletionRequest
|
|
7
|
+
|
|
8
|
+
version_file_path = os.path.join(os.path.dirname(__file__), "..", "version.txt")
|
|
9
|
+
|
|
10
|
+
with open(version_file_path) as version_file:
|
|
11
|
+
VERSION = version_file.read().strip()
|
|
12
|
+
|
|
7
13
|
|
|
8
14
|
class MaitaiClient:
|
|
9
15
|
MAITAI_HOST = os.environ.get("MAITAI_HOST", 'https://api.trymaitai.ai')
|
|
16
|
+
VERSION = VERSION
|
|
10
17
|
|
|
11
18
|
def __init__(self):
|
|
12
19
|
super().__init__()
|
|
@@ -46,4 +53,5 @@ class MaitaiClient:
|
|
|
46
53
|
infer_request.params = completion_params
|
|
47
54
|
infer_request.evaluation_enabled = evaluation_enabled
|
|
48
55
|
infer_request.auth_info = config.auth_info
|
|
56
|
+
infer_request.client_version = cls.VERSION
|
|
49
57
|
return infer_request
|
|
@@ -43,6 +43,7 @@ class Application(betterproto.Message):
|
|
|
43
43
|
state: str = betterproto.string_field(7)
|
|
44
44
|
meta: "_config__.Config" = betterproto.message_field(8)
|
|
45
45
|
action_types: List["ApplicationAction"] = betterproto.message_field(9)
|
|
46
|
+
last_activity: int = betterproto.int64_field(10)
|
|
46
47
|
|
|
47
48
|
|
|
48
49
|
@dataclass(eq=False, repr=False)
|
|
@@ -52,3 +53,4 @@ class ApplicationAction(betterproto.Message):
|
|
|
52
53
|
date_created: int = betterproto.int64_field(3)
|
|
53
54
|
application_id: int = betterproto.int64_field(4)
|
|
54
55
|
meta: "_config__.Config" = betterproto.message_field(5)
|
|
56
|
+
last_activity: int = betterproto.int64_field(6)
|
|
@@ -45,6 +45,7 @@ class ChatCompletionRequest(betterproto.Message):
|
|
|
45
45
|
request_id: str = betterproto.string_field(10)
|
|
46
46
|
evaluation_enabled: bool = betterproto.bool_field(11)
|
|
47
47
|
auth_info: "ChatCompletionAuth" = betterproto.message_field(12)
|
|
48
|
+
client_version: str = betterproto.string_field(13)
|
|
48
49
|
|
|
49
50
|
|
|
50
51
|
@dataclass(eq=False, repr=False)
|
|
@@ -230,6 +231,7 @@ class EvaluateRequest(betterproto.Message):
|
|
|
230
231
|
chat_completion_response: Optional["ChatCompletionResponse"] = (
|
|
231
232
|
betterproto.message_field(18, optional=True, group="_chat_completion_response")
|
|
232
233
|
)
|
|
234
|
+
client_version: str = betterproto.string_field(19)
|
|
233
235
|
|
|
234
236
|
|
|
235
237
|
@dataclass(eq=False, repr=False)
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
# setup.py
|
|
2
2
|
|
|
3
3
|
from setuptools import setup, find_packages
|
|
4
|
+
with open("version.txt") as version_file:
|
|
5
|
+
version = version_file.read().strip()
|
|
6
|
+
|
|
4
7
|
setup(
|
|
5
8
|
name='maitai-python',
|
|
6
|
-
version=
|
|
9
|
+
version=version,
|
|
7
10
|
packages=find_packages(exclude=("maitai_back", "maitai_back.*")),
|
|
8
11
|
install_requires=[
|
|
9
12
|
'requests',
|
|
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.13 → maitai_python-1.0.15}/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
|