maitai-python 1.1.24__tar.gz → 1.1.25__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.24 → maitai_python-1.1.25}/PKG-INFO +1 -1
- {maitai_python-1.1.24 → maitai_python-1.1.25}/maitai/_maitai.py +5 -0
- {maitai_python-1.1.24 → maitai_python-1.1.25}/maitai/_maitai_async.py +31 -4
- {maitai_python-1.1.24 → maitai_python-1.1.25}/maitai_common/version.py +1 -1
- {maitai_python-1.1.24 → maitai_python-1.1.25}/maitai_gen/model/__init__.py +1 -0
- {maitai_python-1.1.24 → maitai_python-1.1.25}/maitai_python.egg-info/PKG-INFO +1 -1
- {maitai_python-1.1.24 → maitai_python-1.1.25}/README.md +0 -0
- {maitai_python-1.1.24 → maitai_python-1.1.25}/maitai/__init__.py +0 -0
- {maitai_python-1.1.24 → maitai_python-1.1.25}/maitai/_azure.py +0 -0
- {maitai_python-1.1.24 → maitai_python-1.1.25}/maitai/_config.py +0 -0
- {maitai_python-1.1.24 → maitai_python-1.1.25}/maitai/_config_listener_thread.py +0 -0
- {maitai_python-1.1.24 → maitai_python-1.1.25}/maitai/_context.py +0 -0
- {maitai_python-1.1.24 → maitai_python-1.1.25}/maitai/_evaluator.py +0 -0
- {maitai_python-1.1.24 → maitai_python-1.1.25}/maitai/_inference.py +0 -0
- {maitai_python-1.1.24 → maitai_python-1.1.25}/maitai/_maitai_client.py +0 -0
- {maitai_python-1.1.24 → maitai_python-1.1.25}/maitai/_types.py +0 -0
- {maitai_python-1.1.24 → maitai_python-1.1.25}/maitai/_utils.py +0 -0
- {maitai_python-1.1.24 → maitai_python-1.1.25}/maitai/tools/__init__.py +0 -0
- {maitai_python-1.1.24 → maitai_python-1.1.25}/maitai_common/__init__.py +0 -0
- {maitai_python-1.1.24 → maitai_python-1.1.25}/maitai_common/config/__init__.py +0 -0
- {maitai_python-1.1.24 → maitai_python-1.1.25}/maitai_common/config/config_service.py +0 -0
- {maitai_python-1.1.24 → maitai_python-1.1.25}/maitai_common/processes/__init__.py +0 -0
- {maitai_python-1.1.24 → maitai_python-1.1.25}/maitai_common/processes/io_thread.py +0 -0
- {maitai_python-1.1.24 → maitai_python-1.1.25}/maitai_common/processes/websocket_listener_thread.py +0 -0
- {maitai_python-1.1.24 → maitai_python-1.1.25}/maitai_common/utils/__init__.py +0 -0
- {maitai_python-1.1.24 → maitai_python-1.1.25}/maitai_common/utils/proto_utils.py +0 -0
- {maitai_python-1.1.24 → maitai_python-1.1.25}/maitai_common/utils/types.py +0 -0
- {maitai_python-1.1.24 → maitai_python-1.1.25}/maitai_gen/__init__.py +0 -0
- {maitai_python-1.1.24 → maitai_python-1.1.25}/maitai_gen/annotation/__init__.py +0 -0
- {maitai_python-1.1.24 → maitai_python-1.1.25}/maitai_gen/application/__init__.py +0 -0
- {maitai_python-1.1.24 → maitai_python-1.1.25}/maitai_gen/backtest/__init__.py +0 -0
- {maitai_python-1.1.24 → maitai_python-1.1.25}/maitai_gen/billing/__init__.py +0 -0
- {maitai_python-1.1.24 → maitai_python-1.1.25}/maitai_gen/chat/__init__.py +0 -0
- {maitai_python-1.1.24 → maitai_python-1.1.25}/maitai_gen/company/__init__.py +0 -0
- {maitai_python-1.1.24 → maitai_python-1.1.25}/maitai_gen/config/__init__.py +0 -0
- {maitai_python-1.1.24 → maitai_python-1.1.25}/maitai_gen/embedding/__init__.py +0 -0
- {maitai_python-1.1.24 → maitai_python-1.1.25}/maitai_gen/event/__init__.py +0 -0
- {maitai_python-1.1.24 → maitai_python-1.1.25}/maitai_gen/inference/__init__.py +0 -0
- {maitai_python-1.1.24 → maitai_python-1.1.25}/maitai_gen/key/__init__.py +0 -0
- {maitai_python-1.1.24 → maitai_python-1.1.25}/maitai_gen/metric/__init__.py +0 -0
- {maitai_python-1.1.24 → maitai_python-1.1.25}/maitai_gen/notification/__init__.py +0 -0
- {maitai_python-1.1.24 → maitai_python-1.1.25}/maitai_gen/rates/__init__.py +0 -0
- {maitai_python-1.1.24 → maitai_python-1.1.25}/maitai_gen/sandbox/__init__.py +0 -0
- {maitai_python-1.1.24 → maitai_python-1.1.25}/maitai_gen/sentinel/__init__.py +0 -0
- {maitai_python-1.1.24 → maitai_python-1.1.25}/maitai_gen/session/__init__.py +0 -0
- {maitai_python-1.1.24 → maitai_python-1.1.25}/maitai_python.egg-info/SOURCES.txt +0 -0
- {maitai_python-1.1.24 → maitai_python-1.1.25}/maitai_python.egg-info/dependency_links.txt +0 -0
- {maitai_python-1.1.24 → maitai_python-1.1.25}/maitai_python.egg-info/requires.txt +0 -0
- {maitai_python-1.1.24 → maitai_python-1.1.25}/maitai_python.egg-info/top_level.txt +0 -0
- {maitai_python-1.1.24 → maitai_python-1.1.25}/setup.cfg +0 -0
- {maitai_python-1.1.24 → maitai_python-1.1.25}/setup.py +0 -0
|
@@ -167,6 +167,7 @@ class Completions:
|
|
|
167
167
|
logit_bias: Union[Optional[Dict[str, int]], openai.NotGiven] = openai.NOT_GIVEN,
|
|
168
168
|
logprobs: Union[Optional[bool], openai.NotGiven] = openai.NOT_GIVEN,
|
|
169
169
|
max_tokens: Union[Optional[int], openai.NotGiven] = openai.NOT_GIVEN,
|
|
170
|
+
max_completion_tokens: Union[Optional[int], openai.NotGiven] = openai.NOT_GIVEN,
|
|
170
171
|
n: Union[Optional[int], openai.NotGiven] = openai.NOT_GIVEN,
|
|
171
172
|
presence_penalty: Union[Optional[float], openai.NotGiven] = openai.NOT_GIVEN,
|
|
172
173
|
response_format: Union[
|
|
@@ -255,6 +256,8 @@ class Completions:
|
|
|
255
256
|
logprobs = maitai_config.logprobs
|
|
256
257
|
if max_tokens == openai.NOT_GIVEN and maitai_config.max_tokens is not None:
|
|
257
258
|
max_tokens = maitai_config.max_tokens
|
|
259
|
+
if max_completion_tokens and max_completion_tokens != openai.NOT_GIVEN:
|
|
260
|
+
max_tokens = max_completion_tokens
|
|
258
261
|
if n == openai.NOT_GIVEN:
|
|
259
262
|
n = maitai_config.n
|
|
260
263
|
if frequency_penalty == openai.NOT_GIVEN:
|
|
@@ -521,6 +524,8 @@ def _process_inference_stream(
|
|
|
521
524
|
if chunk.choices and chunk.choices[0].finish_reason:
|
|
522
525
|
timing.time_request_end = time.time()
|
|
523
526
|
maitai.Inference.store_request_timing_data(timing)
|
|
527
|
+
if chunk.usage:
|
|
528
|
+
return
|
|
524
529
|
except MaitaiConnectionError as e:
|
|
525
530
|
if "gpt" not in retry_args.get("model", "") and "gpt" in retry_args.get(
|
|
526
531
|
"fallback_model", ""
|
|
@@ -13,13 +13,35 @@ from openai.types.chat import ChatCompletionStreamOptionsParam
|
|
|
13
13
|
import maitai
|
|
14
14
|
from maitai._config import config
|
|
15
15
|
from maitai._evaluator import Evaluator
|
|
16
|
-
from maitai._inference import
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
from maitai._inference import (
|
|
17
|
+
InferenceException,
|
|
18
|
+
InferenceWarning,
|
|
19
|
+
MaitaiConnectionError,
|
|
20
|
+
)
|
|
21
|
+
from maitai._types import (
|
|
22
|
+
Body,
|
|
23
|
+
Headers,
|
|
24
|
+
MaitaiChunk,
|
|
25
|
+
MaitaiCompletion,
|
|
26
|
+
Query,
|
|
27
|
+
ToolFunction,
|
|
28
|
+
)
|
|
29
|
+
from maitai._utils import (
|
|
30
|
+
convert_open_ai_chat_completion_chunk,
|
|
31
|
+
convert_openai_chat_completion,
|
|
32
|
+
get_chat_completion_params,
|
|
33
|
+
required_args,
|
|
34
|
+
)
|
|
19
35
|
from maitai.tools import Tools
|
|
20
36
|
from maitai_common.utils.proto_utils import openai_messages_to_proto
|
|
21
37
|
from maitai_common.utils.types import EvaluateCallback
|
|
22
|
-
from maitai_gen.chat import
|
|
38
|
+
from maitai_gen.chat import (
|
|
39
|
+
ChatCompletionParams,
|
|
40
|
+
ChatCompletionRequest,
|
|
41
|
+
ChatMessage,
|
|
42
|
+
ClientParams,
|
|
43
|
+
EvaluationContentType,
|
|
44
|
+
)
|
|
23
45
|
from maitai_gen.config import InferenceLocations
|
|
24
46
|
from maitai_gen.inference import InferenceStreamResponse
|
|
25
47
|
from maitai_gen.metric import RequestTimingMetric
|
|
@@ -143,6 +165,7 @@ class AsyncCompletions:
|
|
|
143
165
|
logit_bias: Union[Optional[Dict[str, int]], openai.NotGiven] = openai.NOT_GIVEN,
|
|
144
166
|
logprobs: Union[Optional[bool], openai.NotGiven] = openai.NOT_GIVEN,
|
|
145
167
|
max_tokens: Union[Optional[int], openai.NotGiven] = openai.NOT_GIVEN,
|
|
168
|
+
max_completion_tokens: Union[Optional[int], openai.NotGiven] = openai.NOT_GIVEN,
|
|
146
169
|
n: Union[Optional[int], openai.NotGiven] = openai.NOT_GIVEN,
|
|
147
170
|
presence_penalty: Union[Optional[float], openai.NotGiven] = openai.NOT_GIVEN,
|
|
148
171
|
response_format: Union[
|
|
@@ -231,6 +254,8 @@ class AsyncCompletions:
|
|
|
231
254
|
logprobs = maitai_config.logprobs
|
|
232
255
|
if max_tokens == openai.NOT_GIVEN and maitai_config.max_tokens is not None:
|
|
233
256
|
max_tokens = maitai_config.max_tokens
|
|
257
|
+
if max_completion_tokens and max_completion_tokens != openai.NOT_GIVEN:
|
|
258
|
+
max_tokens = max_completion_tokens
|
|
234
259
|
if n == openai.NOT_GIVEN:
|
|
235
260
|
n = maitai_config.n
|
|
236
261
|
if frequency_penalty == openai.NOT_GIVEN:
|
|
@@ -498,6 +523,8 @@ async def _process_inference_stream_async(
|
|
|
498
523
|
if chunk.choices and chunk.choices[0].finish_reason:
|
|
499
524
|
timing.time_request_end = time.time()
|
|
500
525
|
maitai.Inference.store_request_timing_data(timing)
|
|
526
|
+
if chunk.usage:
|
|
527
|
+
return
|
|
501
528
|
except MaitaiConnectionError as e:
|
|
502
529
|
if "gpt" not in retry_args.get("model", "") and "gpt" in retry_args.get(
|
|
503
530
|
"fallback_model", ""
|
|
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.24 → maitai_python-1.1.25}/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
|
|
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
|