maitai-python 1.1.39b0__tar.gz → 1.1.40b0__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.39b0 → maitai_python-1.1.40b0}/PKG-INFO +1 -1
- {maitai_python-1.1.39b0 → maitai_python-1.1.40b0}/maitai/_utils.py +37 -0
- {maitai_python-1.1.39b0 → maitai_python-1.1.40b0}/maitai_common/version.py +1 -1
- {maitai_python-1.1.39b0 → maitai_python-1.1.40b0}/maitai_gen/chat/__init__.py +9 -4
- maitai_python-1.1.40b0/maitai_gen/model.py +24 -0
- {maitai_python-1.1.39b0 → maitai_python-1.1.40b0}/maitai_python.egg-info/PKG-INFO +1 -1
- {maitai_python-1.1.39b0 → maitai_python-1.1.40b0}/maitai_python.egg-info/SOURCES.txt +1 -1
- maitai_python-1.1.39b0/maitai_gen/model/__init__.py +0 -25
- {maitai_python-1.1.39b0 → maitai_python-1.1.40b0}/README.md +0 -0
- {maitai_python-1.1.39b0 → maitai_python-1.1.40b0}/maitai/__init__.py +0 -0
- {maitai_python-1.1.39b0 → maitai_python-1.1.40b0}/maitai/_azure.py +0 -0
- {maitai_python-1.1.39b0 → maitai_python-1.1.40b0}/maitai/_config.py +0 -0
- {maitai_python-1.1.39b0 → maitai_python-1.1.40b0}/maitai/_config_listener_thread.py +0 -0
- {maitai_python-1.1.39b0 → maitai_python-1.1.40b0}/maitai/_context.py +0 -0
- {maitai_python-1.1.39b0 → maitai_python-1.1.40b0}/maitai/_evaluator.py +0 -0
- {maitai_python-1.1.39b0 → maitai_python-1.1.40b0}/maitai/_inference.py +0 -0
- {maitai_python-1.1.39b0 → maitai_python-1.1.40b0}/maitai/_maitai.py +0 -0
- {maitai_python-1.1.39b0 → maitai_python-1.1.40b0}/maitai/_maitai_async.py +0 -0
- {maitai_python-1.1.39b0 → maitai_python-1.1.40b0}/maitai/_maitai_client.py +0 -0
- {maitai_python-1.1.39b0 → maitai_python-1.1.40b0}/maitai/_types.py +0 -0
- {maitai_python-1.1.39b0 → maitai_python-1.1.40b0}/maitai/tools/__init__.py +0 -0
- {maitai_python-1.1.39b0 → maitai_python-1.1.40b0}/maitai_common/__init__.py +0 -0
- {maitai_python-1.1.39b0 → maitai_python-1.1.40b0}/maitai_common/config/__init__.py +0 -0
- {maitai_python-1.1.39b0 → maitai_python-1.1.40b0}/maitai_common/config/config_service.py +0 -0
- {maitai_python-1.1.39b0 → maitai_python-1.1.40b0}/maitai_common/processes/__init__.py +0 -0
- {maitai_python-1.1.39b0 → maitai_python-1.1.40b0}/maitai_common/processes/io_thread.py +0 -0
- {maitai_python-1.1.39b0 → maitai_python-1.1.40b0}/maitai_common/processes/websocket_listener_thread.py +0 -0
- {maitai_python-1.1.39b0 → maitai_python-1.1.40b0}/maitai_gen/__init__.py +0 -0
- {maitai_python-1.1.39b0 → maitai_python-1.1.40b0}/maitai_gen/annotation/__init__.py +0 -0
- {maitai_python-1.1.39b0 → maitai_python-1.1.40b0}/maitai_gen/application/__init__.py +0 -0
- {maitai_python-1.1.39b0 → maitai_python-1.1.40b0}/maitai_gen/backtest/__init__.py +0 -0
- {maitai_python-1.1.39b0 → maitai_python-1.1.40b0}/maitai_gen/billing/__init__.py +0 -0
- {maitai_python-1.1.39b0 → maitai_python-1.1.40b0}/maitai_gen/company/__init__.py +0 -0
- {maitai_python-1.1.39b0 → maitai_python-1.1.40b0}/maitai_gen/config/__init__.py +0 -0
- {maitai_python-1.1.39b0 → maitai_python-1.1.40b0}/maitai_gen/embedding/__init__.py +0 -0
- {maitai_python-1.1.39b0 → maitai_python-1.1.40b0}/maitai_gen/event/__init__.py +0 -0
- {maitai_python-1.1.39b0 → maitai_python-1.1.40b0}/maitai_gen/inference/__init__.py +0 -0
- {maitai_python-1.1.39b0 → maitai_python-1.1.40b0}/maitai_gen/key/__init__.py +0 -0
- {maitai_python-1.1.39b0 → maitai_python-1.1.40b0}/maitai_gen/metric/__init__.py +0 -0
- {maitai_python-1.1.39b0 → maitai_python-1.1.40b0}/maitai_gen/notification/__init__.py +0 -0
- {maitai_python-1.1.39b0 → maitai_python-1.1.40b0}/maitai_gen/rates/__init__.py +0 -0
- {maitai_python-1.1.39b0 → maitai_python-1.1.40b0}/maitai_gen/sandbox/__init__.py +0 -0
- {maitai_python-1.1.39b0 → maitai_python-1.1.40b0}/maitai_gen/sentinel/__init__.py +0 -0
- {maitai_python-1.1.39b0 → maitai_python-1.1.40b0}/maitai_gen/session/__init__.py +0 -0
- {maitai_python-1.1.39b0 → maitai_python-1.1.40b0}/maitai_python.egg-info/dependency_links.txt +0 -0
- {maitai_python-1.1.39b0 → maitai_python-1.1.40b0}/maitai_python.egg-info/requires.txt +0 -0
- {maitai_python-1.1.39b0 → maitai_python-1.1.40b0}/maitai_python.egg-info/top_level.txt +0 -0
- {maitai_python-1.1.39b0 → maitai_python-1.1.40b0}/setup.cfg +0 -0
- {maitai_python-1.1.39b0 → maitai_python-1.1.40b0}/setup.py +0 -0
|
@@ -17,6 +17,7 @@ import openai
|
|
|
17
17
|
import openai.types.chat as openai_types
|
|
18
18
|
from betterproto import Casing
|
|
19
19
|
from openai.types import ChatModel
|
|
20
|
+
from pydantic.json_schema import GenerateJsonSchema
|
|
20
21
|
|
|
21
22
|
import maitai_gen.chat as chat_types
|
|
22
23
|
from maitai._types import ToolFunction
|
|
@@ -28,6 +29,35 @@ __version__ = f"{version}_python_{sys.version_info.major}.{sys.version_info.mino
|
|
|
28
29
|
CallableT = TypeVar("CallableT", bound=Callable[..., Any])
|
|
29
30
|
|
|
30
31
|
|
|
32
|
+
class OpenAISchemaGenerator(GenerateJsonSchema):
|
|
33
|
+
def generate(self, schema, mode="validation") -> dict:
|
|
34
|
+
json_schema = super().generate(schema, mode=mode)
|
|
35
|
+
|
|
36
|
+
# Inline the referenced objects
|
|
37
|
+
def resolve_refs(obj):
|
|
38
|
+
if isinstance(obj, dict):
|
|
39
|
+
if "$ref" in obj and obj["$ref"].startswith("#/$defs/"):
|
|
40
|
+
ref_name = obj["$ref"].split("/")[-1]
|
|
41
|
+
return resolve_refs(json_schema.get("$defs", {}).get(ref_name, {}))
|
|
42
|
+
return {k: resolve_refs(v) for k, v in obj.items()}
|
|
43
|
+
elif isinstance(obj, list):
|
|
44
|
+
return [resolve_refs(item) for item in obj]
|
|
45
|
+
return obj
|
|
46
|
+
|
|
47
|
+
properties = resolve_refs(json_schema["properties"])
|
|
48
|
+
|
|
49
|
+
return {
|
|
50
|
+
"name": schema.get("title", "").lower() + "_schema",
|
|
51
|
+
"strict": True,
|
|
52
|
+
"schema": {
|
|
53
|
+
"type": "object",
|
|
54
|
+
"properties": properties,
|
|
55
|
+
"required": json_schema.get("required", []),
|
|
56
|
+
"additionalProperties": False,
|
|
57
|
+
},
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
|
|
31
61
|
def required_args(*variants: Sequence[str]) -> Callable[[CallableT], CallableT]:
|
|
32
62
|
def inner(func: CallableT) -> CallableT:
|
|
33
63
|
params = inspect.signature(func).parameters
|
|
@@ -193,6 +223,13 @@ def get_chat_completion_params(
|
|
|
193
223
|
}
|
|
194
224
|
|
|
195
225
|
if response_format != openai.NOT_GIVEN:
|
|
226
|
+
if hasattr(response_format, "model_json_schema"):
|
|
227
|
+
response_format = {
|
|
228
|
+
"type": "json_schema",
|
|
229
|
+
"json_schema": response_format.model_json_schema(
|
|
230
|
+
schema_generator=OpenAISchemaGenerator, mode="serialization"
|
|
231
|
+
),
|
|
232
|
+
}
|
|
196
233
|
params["response_format"] = {"type": response_format["type"]}
|
|
197
234
|
if response_format.get("json_schema"):
|
|
198
235
|
params["response_format"]["json_schema"] = response_format["json_schema"]
|
|
@@ -172,9 +172,7 @@ class Property(betterproto.Message):
|
|
|
172
172
|
class JsonSchema(betterproto.Message):
|
|
173
173
|
name: str = betterproto.string_field(1)
|
|
174
174
|
strict: bool = betterproto.bool_field(2)
|
|
175
|
-
schema:
|
|
176
|
-
3, betterproto.TYPE_STRING, betterproto.TYPE_STRING
|
|
177
|
-
)
|
|
175
|
+
schema: "FunctionParameters" = betterproto.message_field(3)
|
|
178
176
|
|
|
179
177
|
|
|
180
178
|
@dataclass(eq=False, repr=False)
|
|
@@ -364,6 +362,8 @@ class EvaluateRequest(betterproto.Message):
|
|
|
364
362
|
apply_corrections: bool = betterproto.bool_field(22)
|
|
365
363
|
timing_metrics: "_metric__.RequestTimingMetric" = betterproto.message_field(23)
|
|
366
364
|
tools: List["Tool"] = betterproto.message_field(24)
|
|
365
|
+
sentinels: List["_sentinel__.Sentinel"] = betterproto.message_field(25)
|
|
366
|
+
evaluation_request_id: str = betterproto.string_field(26)
|
|
367
367
|
|
|
368
368
|
|
|
369
369
|
@dataclass(eq=False, repr=False)
|
|
@@ -383,18 +383,23 @@ class EvaluateResult(betterproto.Message):
|
|
|
383
383
|
severity: int = betterproto.int64_field(12)
|
|
384
384
|
correction: str = betterproto.string_field(13)
|
|
385
385
|
sentinel_directive_id: int = betterproto.int64_field(14)
|
|
386
|
+
evaluation_request_id: str = betterproto.string_field(15)
|
|
387
|
+
request_id: str = betterproto.string_field(16)
|
|
388
|
+
application_id: int = betterproto.int64_field(17)
|
|
386
389
|
|
|
387
390
|
|
|
388
391
|
@dataclass(eq=False, repr=False)
|
|
389
392
|
class EvaluateResponse(betterproto.Message):
|
|
390
393
|
application_id: int = betterproto.int64_field(1)
|
|
391
394
|
session_id: str = betterproto.string_field(2)
|
|
392
|
-
request_id:
|
|
395
|
+
request_id: str = betterproto.string_field(3)
|
|
393
396
|
evaluation_results: List["EvaluateResult"] = betterproto.message_field(4)
|
|
394
397
|
evaluation_request_id: str = betterproto.string_field(5)
|
|
395
398
|
evaluate_summary: str = betterproto.string_field(7)
|
|
396
399
|
evaluation_time: int = betterproto.int64_field(8)
|
|
397
400
|
reference_id: str = betterproto.string_field(9)
|
|
401
|
+
id: int = betterproto.int64_field(10)
|
|
402
|
+
date_created: int = betterproto.int64_field(11)
|
|
398
403
|
|
|
399
404
|
|
|
400
405
|
@dataclass(eq=False, repr=False)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# This is an automatically generated file, please do not change
|
|
2
|
+
# gen by protobuf_to_pydantic[v0.3.0](https://github.com/so1n/protobuf_to_pydantic)
|
|
3
|
+
# Protobuf Version: 5.27.0
|
|
4
|
+
# Pydantic Version: 2.8.2
|
|
5
|
+
import typing
|
|
6
|
+
|
|
7
|
+
from google.protobuf.message import Message # type: ignore
|
|
8
|
+
from pydantic import BaseModel, Field
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class Model(BaseModel):
|
|
12
|
+
id: int = Field(default=0)
|
|
13
|
+
date_added: int = Field(default=0)
|
|
14
|
+
company_id: int = Field(default=0)
|
|
15
|
+
provider: str = Field(default="")
|
|
16
|
+
model: str = Field(default="")
|
|
17
|
+
points_to: typing.Optional[str] = Field(default="")
|
|
18
|
+
status: str = Field(default="")
|
|
19
|
+
use_fallback: bool = Field(default=False)
|
|
20
|
+
rate_limited: bool = Field(default=False)
|
|
21
|
+
base_url: typing.Optional[str] = Field(default="")
|
|
22
|
+
token: typing.Optional[str] = Field(default="")
|
|
23
|
+
model_ref: str = Field(default="")
|
|
24
|
+
hosted_name: typing.Optional[str] = Field(default="")
|
|
@@ -21,6 +21,7 @@ maitai_common/processes/__init__.py
|
|
|
21
21
|
maitai_common/processes/io_thread.py
|
|
22
22
|
maitai_common/processes/websocket_listener_thread.py
|
|
23
23
|
maitai_gen/__init__.py
|
|
24
|
+
maitai_gen/model.py
|
|
24
25
|
maitai_gen/annotation/__init__.py
|
|
25
26
|
maitai_gen/application/__init__.py
|
|
26
27
|
maitai_gen/backtest/__init__.py
|
|
@@ -33,7 +34,6 @@ maitai_gen/event/__init__.py
|
|
|
33
34
|
maitai_gen/inference/__init__.py
|
|
34
35
|
maitai_gen/key/__init__.py
|
|
35
36
|
maitai_gen/metric/__init__.py
|
|
36
|
-
maitai_gen/model/__init__.py
|
|
37
37
|
maitai_gen/notification/__init__.py
|
|
38
38
|
maitai_gen/rates/__init__.py
|
|
39
39
|
maitai_gen/sandbox/__init__.py
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
2
|
-
# sources: model.proto
|
|
3
|
-
# plugin: python-betterproto
|
|
4
|
-
# This file has been @generated
|
|
5
|
-
|
|
6
|
-
from dataclasses import dataclass
|
|
7
|
-
|
|
8
|
-
import betterproto
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
@dataclass(eq=False, repr=False)
|
|
12
|
-
class Model(betterproto.Message):
|
|
13
|
-
id: int = betterproto.int64_field(1)
|
|
14
|
-
date_added: int = betterproto.int64_field(2)
|
|
15
|
-
company_id: int = betterproto.int64_field(3)
|
|
16
|
-
provider: str = betterproto.string_field(4)
|
|
17
|
-
model: str = betterproto.string_field(5)
|
|
18
|
-
points_to: str = betterproto.string_field(6)
|
|
19
|
-
status: str = betterproto.string_field(7)
|
|
20
|
-
use_fallback: bool = betterproto.bool_field(8)
|
|
21
|
-
rate_limited: bool = betterproto.bool_field(9)
|
|
22
|
-
base_url: str = betterproto.string_field(10)
|
|
23
|
-
token: str = betterproto.string_field(11)
|
|
24
|
-
model_ref: str = betterproto.string_field(12)
|
|
25
|
-
hosted_name: str = betterproto.string_field(13)
|
|
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.39b0 → maitai_python-1.1.40b0}/maitai_python.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|