maitai-python 1.0.17b2__tar.gz → 1.0.19__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.17b2 → maitai_python-1.0.19}/PKG-INFO +1 -1
- {maitai_python-1.0.17b2 → maitai_python-1.0.19}/maitai/_config.py +5 -2
- {maitai_python-1.0.17b2 → maitai_python-1.0.19}/maitai/_evaluator.py +5 -3
- {maitai_python-1.0.17b2 → maitai_python-1.0.19}/maitai/_inference.py +7 -3
- {maitai_python-1.0.17b2 → maitai_python-1.0.19}/maitai/_maitai_client.py +0 -7
- {maitai_python-1.0.17b2 → maitai_python-1.0.19}/maitai/_utils.py +6 -7
- maitai_python-1.0.19/maitai_common/version.py +3 -0
- {maitai_python-1.0.17b2 → maitai_python-1.0.19}/maitai_gen/chat/__init__.py +0 -2
- {maitai_python-1.0.17b2 → maitai_python-1.0.19}/maitai_python.egg-info/PKG-INFO +1 -1
- {maitai_python-1.0.17b2 → maitai_python-1.0.19}/maitai_python.egg-info/SOURCES.txt +1 -1
- {maitai_python-1.0.17b2 → maitai_python-1.0.19}/setup.py +2 -2
- maitai_python-1.0.17b2/maitai/version.py +0 -1
- {maitai_python-1.0.17b2 → maitai_python-1.0.19}/README.md +0 -0
- {maitai_python-1.0.17b2 → maitai_python-1.0.19}/maitai/__init__.py +0 -0
- {maitai_python-1.0.17b2 → maitai_python-1.0.19}/maitai/_azure.py +0 -0
- {maitai_python-1.0.17b2 → maitai_python-1.0.19}/maitai/_config_listener_thread.py +0 -0
- {maitai_python-1.0.17b2 → maitai_python-1.0.19}/maitai/_openai.py +0 -0
- {maitai_python-1.0.17b2 → maitai_python-1.0.19}/maitai/_openai_async.py +0 -0
- {maitai_python-1.0.17b2 → maitai_python-1.0.19}/maitai/_openai_types.py +0 -0
- {maitai_python-1.0.17b2 → maitai_python-1.0.19}/maitai_common/__init__.py +0 -0
- {maitai_python-1.0.17b2 → maitai_python-1.0.19}/maitai_common/config/__init__.py +0 -0
- {maitai_python-1.0.17b2 → maitai_python-1.0.19}/maitai_common/config/config_service.py +0 -0
- {maitai_python-1.0.17b2 → maitai_python-1.0.19}/maitai_common/processes/__init__.py +0 -0
- {maitai_python-1.0.17b2 → maitai_python-1.0.19}/maitai_common/processes/io_thread.py +0 -0
- {maitai_python-1.0.17b2 → maitai_python-1.0.19}/maitai_common/processes/websocket_listener_thread.py +0 -0
- {maitai_python-1.0.17b2 → maitai_python-1.0.19}/maitai_common/utils/__init__.py +0 -0
- {maitai_python-1.0.17b2 → maitai_python-1.0.19}/maitai_common/utils/proto_utils.py +0 -0
- {maitai_python-1.0.17b2 → maitai_python-1.0.19}/maitai_common/utils/types.py +0 -0
- {maitai_python-1.0.17b2 → maitai_python-1.0.19}/maitai_gen/__init__.py +0 -0
- {maitai_python-1.0.17b2 → maitai_python-1.0.19}/maitai_gen/application/__init__.py +0 -0
- {maitai_python-1.0.17b2 → maitai_python-1.0.19}/maitai_gen/company/__init__.py +0 -0
- {maitai_python-1.0.17b2 → maitai_python-1.0.19}/maitai_gen/config/__init__.py +0 -0
- {maitai_python-1.0.17b2 → maitai_python-1.0.19}/maitai_gen/inference/__init__.py +0 -0
- {maitai_python-1.0.17b2 → maitai_python-1.0.19}/maitai_gen/notification/__init__.py +0 -0
- {maitai_python-1.0.17b2 → maitai_python-1.0.19}/maitai_gen/sandbox/__init__.py +0 -0
- {maitai_python-1.0.17b2 → maitai_python-1.0.19}/maitai_gen/sentinel/__init__.py +0 -0
- {maitai_python-1.0.17b2 → maitai_python-1.0.19}/maitai_gen/session/__init__.py +0 -0
- {maitai_python-1.0.17b2 → maitai_python-1.0.19}/maitai_python.egg-info/dependency_links.txt +0 -0
- {maitai_python-1.0.17b2 → maitai_python-1.0.19}/maitai_python.egg-info/requires.txt +0 -0
- {maitai_python-1.0.17b2 → maitai_python-1.0.19}/maitai_python.egg-info/top_level.txt +0 -0
- {maitai_python-1.0.17b2 → maitai_python-1.0.19}/setup.cfg +0 -0
|
@@ -3,6 +3,7 @@ import os
|
|
|
3
3
|
import requests
|
|
4
4
|
|
|
5
5
|
from maitai._config_listener_thread import ConfigListenerThread
|
|
6
|
+
from maitai_common.version import version
|
|
6
7
|
from maitai_common.config import config_service
|
|
7
8
|
from maitai_gen.application import Application
|
|
8
9
|
from maitai_gen.chat import ChatCompletionAuth
|
|
@@ -60,7 +61,8 @@ class Config:
|
|
|
60
61
|
url = f'{host}/company/'
|
|
61
62
|
headers = {
|
|
62
63
|
'Content-Type': 'application/json',
|
|
63
|
-
'x-api-key': self.api_key
|
|
64
|
+
'x-api-key': self.api_key,
|
|
65
|
+
'x-client-version': version,
|
|
64
66
|
}
|
|
65
67
|
|
|
66
68
|
response = requests.get(url, headers=headers, verify=False)
|
|
@@ -75,7 +77,8 @@ class Config:
|
|
|
75
77
|
url = f'{host}/application/'
|
|
76
78
|
headers = {
|
|
77
79
|
'Content-Type': 'application/json',
|
|
78
|
-
'x-api-key': self.api_key
|
|
80
|
+
'x-api-key': self.api_key,
|
|
81
|
+
'x-client-version': version,
|
|
79
82
|
}
|
|
80
83
|
|
|
81
84
|
response = requests.get(url, headers=headers, verify=False)
|
|
@@ -9,6 +9,7 @@ from betterproto import Casing
|
|
|
9
9
|
from maitai._config import config
|
|
10
10
|
from maitai._maitai_client import MaitaiClient
|
|
11
11
|
from maitai._utils import chat_completion_chunk_to_response
|
|
12
|
+
from maitai_common.version import version
|
|
12
13
|
from maitai_common.utils.types import EvaluateCallback
|
|
13
14
|
from maitai_gen.chat import ChatCompletionChunk, ChatCompletionParams, ChatCompletionResponse, EvaluateRequest, EvaluateResponse, EvaluationContentType
|
|
14
15
|
|
|
@@ -91,7 +92,6 @@ class Evaluator(MaitaiClient):
|
|
|
91
92
|
eval_request.action_type = action_type
|
|
92
93
|
if fault_description:
|
|
93
94
|
eval_request.fault_description = fault_description
|
|
94
|
-
eval_request.client_version = cls.VERSION
|
|
95
95
|
return eval_request
|
|
96
96
|
|
|
97
97
|
@classmethod
|
|
@@ -101,7 +101,8 @@ class Evaluator(MaitaiClient):
|
|
|
101
101
|
url = f'{host}/evaluation/request'
|
|
102
102
|
headers = {
|
|
103
103
|
'Content-Type': 'application/json',
|
|
104
|
-
'x-api-key': config.api_key
|
|
104
|
+
'x-api-key': config.api_key,
|
|
105
|
+
'x-client-version': version,
|
|
105
106
|
}
|
|
106
107
|
async with aiohttp.ClientSession(connector=aiohttp.TCPConnector(ssl=False)) as session:
|
|
107
108
|
async with session.post(url, headers=headers,
|
|
@@ -130,7 +131,8 @@ class Evaluator(MaitaiClient):
|
|
|
130
131
|
url = f'{host}/evaluation/realtime'
|
|
131
132
|
headers = {
|
|
132
133
|
'Content-Type': 'application/json',
|
|
133
|
-
'x-api-key': config.api_key
|
|
134
|
+
'x-api-key': config.api_key,
|
|
135
|
+
'x-client-version': version,
|
|
134
136
|
}
|
|
135
137
|
|
|
136
138
|
response = requests.post(url, headers=headers, data=eval_request.to_json(casing=Casing.SNAKE), verify=False, stream=True)
|
|
@@ -8,6 +8,7 @@ from betterproto import Casing
|
|
|
8
8
|
from maitai._config import config
|
|
9
9
|
from maitai._maitai_client import MaitaiClient
|
|
10
10
|
from maitai._utils import chat_completion_chunk_to_response
|
|
11
|
+
from maitai_common.version import version
|
|
11
12
|
from maitai_common.utils.types import AsyncChunkQueue, ChunkQueue, EvaluateCallback, QueueIterable
|
|
12
13
|
from maitai_gen.chat import ChatCompletionChunk, ChatCompletionParams, ChatCompletionRequest, ChatCompletionResponse, ChatStorageRequest
|
|
13
14
|
from maitai_gen.inference import InferenceStreamResponse
|
|
@@ -65,7 +66,8 @@ class Inference(MaitaiClient):
|
|
|
65
66
|
url = f'{host}/chat/completions/serialized'
|
|
66
67
|
headers = {
|
|
67
68
|
'Content-Type': 'application/json',
|
|
68
|
-
'x-api-key': config.api_key
|
|
69
|
+
'x-api-key': config.api_key,
|
|
70
|
+
'x-client-version': version,
|
|
69
71
|
}
|
|
70
72
|
response = requests.post(url, headers=headers, data=chat_request.to_json(casing=Casing.SNAKE), verify=False, stream=True)
|
|
71
73
|
if response.status_code != 200:
|
|
@@ -88,7 +90,8 @@ class Inference(MaitaiClient):
|
|
|
88
90
|
url = f'{host}/chat/completions/serialized'
|
|
89
91
|
headers = {
|
|
90
92
|
'Content-Type': 'application/json',
|
|
91
|
-
'x-api-key': config.api_key
|
|
93
|
+
'x-api-key': config.api_key,
|
|
94
|
+
'x-client-version': version,
|
|
92
95
|
}
|
|
93
96
|
async with aiohttp.ClientSession(connector=aiohttp.TCPConnector(ssl=False)) as session:
|
|
94
97
|
async with session.post(url, headers=headers, data=chat_request.to_json(casing=Casing.SNAKE)) as response:
|
|
@@ -123,7 +126,8 @@ class Inference(MaitaiClient):
|
|
|
123
126
|
url = f'{host}/chat/completions/response'
|
|
124
127
|
headers = {
|
|
125
128
|
'Content-Type': 'application/json',
|
|
126
|
-
'x-api-key': config.api_key
|
|
129
|
+
'x-api-key': config.api_key,
|
|
130
|
+
'x-client-version': version,
|
|
127
131
|
}
|
|
128
132
|
try:
|
|
129
133
|
async with aiohttp.ClientSession(connector=aiohttp.TCPConnector(ssl=False)) as session:
|
|
@@ -5,15 +5,9 @@ import threading
|
|
|
5
5
|
from maitai._config import config
|
|
6
6
|
from maitai_gen.chat import ChatCompletionParams, ChatCompletionRequest
|
|
7
7
|
|
|
8
|
-
version_file_path = os.path.join(os.path.dirname(__file__), "version.py")
|
|
9
|
-
|
|
10
|
-
with open(version_file_path) as version_file:
|
|
11
|
-
VERSION = version_file.read().strip()
|
|
12
|
-
|
|
13
8
|
|
|
14
9
|
class MaitaiClient:
|
|
15
10
|
MAITAI_HOST = os.environ.get("MAITAI_HOST", 'https://api.trymaitai.ai')
|
|
16
|
-
VERSION = VERSION
|
|
17
11
|
|
|
18
12
|
def __init__(self):
|
|
19
13
|
super().__init__()
|
|
@@ -53,5 +47,4 @@ class MaitaiClient:
|
|
|
53
47
|
infer_request.params = completion_params
|
|
54
48
|
infer_request.evaluation_enabled = evaluation_enabled
|
|
55
49
|
infer_request.auth_info = config.auth_info
|
|
56
|
-
infer_request.client_version = cls.VERSION
|
|
57
50
|
return infer_request
|
|
@@ -9,7 +9,6 @@ from openai.types import ChatModel
|
|
|
9
9
|
|
|
10
10
|
import maitai_gen.chat as chat_types
|
|
11
11
|
from maitai_common.utils.proto_utils import openai_messages_to_proto
|
|
12
|
-
from maitai_gen.chat import ChatCompletionParams, Function, ResponseFormat, StreamOptions, Tool
|
|
13
12
|
|
|
14
13
|
CallableT = TypeVar("CallableT", bound=Callable[..., Any])
|
|
15
14
|
|
|
@@ -123,8 +122,8 @@ def get_chat_completion_params(*,
|
|
|
123
122
|
top_logprobs: Union[Optional[int], openai.NotGiven] = openai.NOT_GIVEN,
|
|
124
123
|
top_p: Union[Optional[float], openai.NotGiven] = openai.NOT_GIVEN,
|
|
125
124
|
user: Union[str, openai.NotGiven] = openai.NOT_GIVEN,
|
|
126
|
-
) -> ChatCompletionParams:
|
|
127
|
-
params = ChatCompletionParams(
|
|
125
|
+
) -> chat_types.ChatCompletionParams:
|
|
126
|
+
params = chat_types.ChatCompletionParams(
|
|
128
127
|
messages=openai_messages_to_proto(messages),
|
|
129
128
|
model=model,
|
|
130
129
|
stream=stream,
|
|
@@ -151,19 +150,19 @@ def get_chat_completion_params(*,
|
|
|
151
150
|
setattr(params, param_name, value)
|
|
152
151
|
|
|
153
152
|
if stream_options != openai.NOT_GIVEN and stream_options:
|
|
154
|
-
params.stream_options = StreamOptions(include_usage=stream_options.get("include_usage"))
|
|
153
|
+
params.stream_options = chat_types.StreamOptions(include_usage=stream_options.get("include_usage"))
|
|
155
154
|
|
|
156
155
|
if response_format != openai.NOT_GIVEN:
|
|
157
|
-
params.response_format = ResponseFormat(type=response_format["type"])
|
|
156
|
+
params.response_format = chat_types.ResponseFormat(type=response_format["type"])
|
|
158
157
|
|
|
159
158
|
if tools != openai.NOT_GIVEN:
|
|
160
159
|
params.tools = []
|
|
161
160
|
for tool in tools:
|
|
162
161
|
function = tool.get("function")
|
|
163
162
|
params.tools.append(
|
|
164
|
-
Tool(
|
|
163
|
+
chat_types.Tool(
|
|
165
164
|
type=tool["type"],
|
|
166
|
-
function=Function(
|
|
165
|
+
function=chat_types.Function(
|
|
167
166
|
name=function.get("name"),
|
|
168
167
|
description=function.get("description"),
|
|
169
168
|
parameters=function.get("parameters")
|
|
@@ -45,7 +45,6 @@ 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)
|
|
49
48
|
|
|
50
49
|
|
|
51
50
|
@dataclass(eq=False, repr=False)
|
|
@@ -231,7 +230,6 @@ class EvaluateRequest(betterproto.Message):
|
|
|
231
230
|
chat_completion_response: Optional["ChatCompletionResponse"] = (
|
|
232
231
|
betterproto.message_field(18, optional=True, group="_chat_completion_response")
|
|
233
232
|
)
|
|
234
|
-
client_version: str = betterproto.string_field(19)
|
|
235
233
|
|
|
236
234
|
|
|
237
235
|
@dataclass(eq=False, repr=False)
|
|
@@ -11,8 +11,8 @@ maitai/_openai.py
|
|
|
11
11
|
maitai/_openai_async.py
|
|
12
12
|
maitai/_openai_types.py
|
|
13
13
|
maitai/_utils.py
|
|
14
|
-
maitai/version.py
|
|
15
14
|
maitai_common/__init__.py
|
|
15
|
+
maitai_common/version.py
|
|
16
16
|
maitai_common/config/__init__.py
|
|
17
17
|
maitai_common/config/config_service.py
|
|
18
18
|
maitai_common/processes/__init__.py
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
1.0.17b2
|
|
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.17b2 → maitai_python-1.0.19}/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
|