maitai-python 1.1.20b4__tar.gz → 1.1.21b1__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.20b4 → maitai_python-1.1.21b1}/PKG-INFO +1 -1
- {maitai_python-1.1.20b4 → maitai_python-1.1.21b1}/maitai/_inference.py +5 -2
- {maitai_python-1.1.20b4 → maitai_python-1.1.21b1}/maitai/_maitai.py +1 -0
- {maitai_python-1.1.20b4 → maitai_python-1.1.21b1}/maitai/_maitai_async.py +15 -12
- {maitai_python-1.1.20b4 → maitai_python-1.1.21b1}/maitai_common/version.py +1 -1
- {maitai_python-1.1.20b4 → maitai_python-1.1.21b1}/maitai_python.egg-info/PKG-INFO +1 -1
- {maitai_python-1.1.20b4 → maitai_python-1.1.21b1}/README.md +0 -0
- {maitai_python-1.1.20b4 → maitai_python-1.1.21b1}/maitai/__init__.py +0 -0
- {maitai_python-1.1.20b4 → maitai_python-1.1.21b1}/maitai/_azure.py +0 -0
- {maitai_python-1.1.20b4 → maitai_python-1.1.21b1}/maitai/_config.py +0 -0
- {maitai_python-1.1.20b4 → maitai_python-1.1.21b1}/maitai/_config_listener_thread.py +0 -0
- {maitai_python-1.1.20b4 → maitai_python-1.1.21b1}/maitai/_context.py +0 -0
- {maitai_python-1.1.20b4 → maitai_python-1.1.21b1}/maitai/_evaluator.py +0 -0
- {maitai_python-1.1.20b4 → maitai_python-1.1.21b1}/maitai/_maitai_client.py +0 -0
- {maitai_python-1.1.20b4 → maitai_python-1.1.21b1}/maitai/_types.py +0 -0
- {maitai_python-1.1.20b4 → maitai_python-1.1.21b1}/maitai/_utils.py +0 -0
- {maitai_python-1.1.20b4 → maitai_python-1.1.21b1}/maitai/tools/__init__.py +0 -0
- {maitai_python-1.1.20b4 → maitai_python-1.1.21b1}/maitai_common/__init__.py +0 -0
- {maitai_python-1.1.20b4 → maitai_python-1.1.21b1}/maitai_common/config/__init__.py +0 -0
- {maitai_python-1.1.20b4 → maitai_python-1.1.21b1}/maitai_common/config/config_service.py +0 -0
- {maitai_python-1.1.20b4 → maitai_python-1.1.21b1}/maitai_common/processes/__init__.py +0 -0
- {maitai_python-1.1.20b4 → maitai_python-1.1.21b1}/maitai_common/processes/io_thread.py +0 -0
- {maitai_python-1.1.20b4 → maitai_python-1.1.21b1}/maitai_common/processes/websocket_listener_thread.py +0 -0
- {maitai_python-1.1.20b4 → maitai_python-1.1.21b1}/maitai_common/utils/__init__.py +0 -0
- {maitai_python-1.1.20b4 → maitai_python-1.1.21b1}/maitai_common/utils/proto_utils.py +0 -0
- {maitai_python-1.1.20b4 → maitai_python-1.1.21b1}/maitai_common/utils/types.py +0 -0
- {maitai_python-1.1.20b4 → maitai_python-1.1.21b1}/maitai_gen/__init__.py +0 -0
- {maitai_python-1.1.20b4 → maitai_python-1.1.21b1}/maitai_gen/application/__init__.py +0 -0
- {maitai_python-1.1.20b4 → maitai_python-1.1.21b1}/maitai_gen/backtest/__init__.py +0 -0
- {maitai_python-1.1.20b4 → maitai_python-1.1.21b1}/maitai_gen/billing/__init__.py +0 -0
- {maitai_python-1.1.20b4 → maitai_python-1.1.21b1}/maitai_gen/chat/__init__.py +0 -0
- {maitai_python-1.1.20b4 → maitai_python-1.1.21b1}/maitai_gen/company/__init__.py +0 -0
- {maitai_python-1.1.20b4 → maitai_python-1.1.21b1}/maitai_gen/config/__init__.py +0 -0
- {maitai_python-1.1.20b4 → maitai_python-1.1.21b1}/maitai_gen/embedding/__init__.py +0 -0
- {maitai_python-1.1.20b4 → maitai_python-1.1.21b1}/maitai_gen/event/__init__.py +0 -0
- {maitai_python-1.1.20b4 → maitai_python-1.1.21b1}/maitai_gen/inference/__init__.py +0 -0
- {maitai_python-1.1.20b4 → maitai_python-1.1.21b1}/maitai_gen/key/__init__.py +0 -0
- {maitai_python-1.1.20b4 → maitai_python-1.1.21b1}/maitai_gen/metric/__init__.py +0 -0
- {maitai_python-1.1.20b4 → maitai_python-1.1.21b1}/maitai_gen/model/__init__.py +0 -0
- {maitai_python-1.1.20b4 → maitai_python-1.1.21b1}/maitai_gen/notification/__init__.py +0 -0
- {maitai_python-1.1.20b4 → maitai_python-1.1.21b1}/maitai_gen/rates/__init__.py +0 -0
- {maitai_python-1.1.20b4 → maitai_python-1.1.21b1}/maitai_gen/sandbox/__init__.py +0 -0
- {maitai_python-1.1.20b4 → maitai_python-1.1.21b1}/maitai_gen/sentinel/__init__.py +0 -0
- {maitai_python-1.1.20b4 → maitai_python-1.1.21b1}/maitai_gen/session/__init__.py +0 -0
- {maitai_python-1.1.20b4 → maitai_python-1.1.21b1}/maitai_python.egg-info/SOURCES.txt +0 -0
- {maitai_python-1.1.20b4 → maitai_python-1.1.21b1}/maitai_python.egg-info/dependency_links.txt +0 -0
- {maitai_python-1.1.20b4 → maitai_python-1.1.21b1}/maitai_python.egg-info/requires.txt +0 -0
- {maitai_python-1.1.20b4 → maitai_python-1.1.21b1}/maitai_python.egg-info/top_level.txt +0 -0
- {maitai_python-1.1.20b4 → maitai_python-1.1.21b1}/setup.cfg +0 -0
- {maitai_python-1.1.20b4 → maitai_python-1.1.21b1}/setup.py +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import time
|
|
1
2
|
import traceback
|
|
2
3
|
from typing import AsyncIterable, Iterable, Optional
|
|
3
4
|
|
|
@@ -8,7 +9,8 @@ from betterproto import Casing
|
|
|
8
9
|
|
|
9
10
|
from maitai._config import config
|
|
10
11
|
from maitai._maitai_client import MaitaiClient
|
|
11
|
-
from maitai._utils import __version__ as version
|
|
12
|
+
from maitai._utils import __version__ as version
|
|
13
|
+
from maitai._utils import chat_completion_chunk_to_response
|
|
12
14
|
from maitai_common.utils.types import AsyncChunkQueue, ChunkQueue, EvaluateCallback, QueueIterable
|
|
13
15
|
from maitai_gen.chat import ChatCompletionChunk, ChatCompletionParams, ChatCompletionRequest, ChatCompletionResponse, ChatStorageRequest
|
|
14
16
|
from maitai_gen.inference import InferenceStreamResponse
|
|
@@ -80,6 +82,7 @@ class Inference(MaitaiClient):
|
|
|
80
82
|
'x-client-version': version,
|
|
81
83
|
}
|
|
82
84
|
try:
|
|
85
|
+
print("REQUETS SEND TIME", time.time())
|
|
83
86
|
response = requests.post(url, headers=headers, data=chat_request.to_json(casing=Casing.SNAKE), stream=True, timeout=timeout or 120)
|
|
84
87
|
if response.status_code != 200:
|
|
85
88
|
cls.log_error(response.text, url)
|
|
@@ -112,6 +115,7 @@ class Inference(MaitaiClient):
|
|
|
112
115
|
}
|
|
113
116
|
try:
|
|
114
117
|
async with aiohttp.ClientSession(connector=aiohttp.TCPConnector(ssl=False), timeout=ClientTimeout(timeout or 120)) as session:
|
|
118
|
+
print("REQUETS SEND TIME", time.time())
|
|
115
119
|
async with session.post(url, headers=headers, data=chat_request.to_json(casing=Casing.SNAKE)) as response:
|
|
116
120
|
if response.status != 200:
|
|
117
121
|
error_text = await response.text()
|
|
@@ -162,7 +166,6 @@ class Inference(MaitaiClient):
|
|
|
162
166
|
return await session.put(url, headers=headers, data=chat_storage_request.to_json(casing=Casing.SNAKE))
|
|
163
167
|
except Exception as e:
|
|
164
168
|
await cls.increment_error(str(e), url)
|
|
165
|
-
pass
|
|
166
169
|
|
|
167
170
|
@classmethod
|
|
168
171
|
def store_request_timing_data(cls, metric: RequestTimingMetric):
|
|
@@ -151,6 +151,7 @@ class Completions:
|
|
|
151
151
|
timeout: Union[float, httpx.Timeout, None, openai.NotGiven] = openai.NOT_GIVEN,
|
|
152
152
|
parallel_tool_calls: Union[bool, openai.NotGiven] = openai.NOT_GIVEN,
|
|
153
153
|
) -> Union[MaitaiCompletion, Iterable[MaitaiChunk]]:
|
|
154
|
+
print("ENTER TIME", time.time())
|
|
154
155
|
retry_args = locals()
|
|
155
156
|
timing = RequestTimingMetric(
|
|
156
157
|
time_request_start=time.time(),
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import os
|
|
1
2
|
import time
|
|
2
3
|
import uuid
|
|
3
4
|
import warnings
|
|
@@ -61,18 +62,20 @@ class MaitaiAsync:
|
|
|
61
62
|
config.auth_keys.groq_api_key.key_value = groq_api_key
|
|
62
63
|
if anthropic_api_key:
|
|
63
64
|
config.auth_keys.anthropic_api_key.key_value = anthropic_api_key
|
|
64
|
-
self._client =
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
65
|
+
self._client = None
|
|
66
|
+
if api_key or openai_api_key or os.environ.get("OPENAI_API_KEY"):
|
|
67
|
+
self._client = openai.AsyncClient(
|
|
68
|
+
api_key=api_key or openai_api_key or os.environ.get("OPENAI_API_KEY"),
|
|
69
|
+
organization=organization,
|
|
70
|
+
project=project,
|
|
71
|
+
base_url=base_url,
|
|
72
|
+
timeout=timeout,
|
|
73
|
+
max_retries=max_retries,
|
|
74
|
+
default_headers=default_headers,
|
|
75
|
+
default_query=default_query,
|
|
76
|
+
http_client=http_client,
|
|
77
|
+
_strict_response_validation=_strict_response_validation,
|
|
78
|
+
)
|
|
76
79
|
|
|
77
80
|
client_params = None
|
|
78
81
|
if base_url or default_headers or default_query:
|
|
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
|
{maitai_python-1.1.20b4 → maitai_python-1.1.21b1}/maitai_python.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|