maitai-python 1.2.4b0__py3-none-any.whl → 1.2.6__py3-none-any.whl

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/_maitai_client.py CHANGED
@@ -95,8 +95,14 @@ class MaitaiClient:
95
95
  atexit.register(self.cleanup)
96
96
 
97
97
  def cleanup(self):
98
- self.run_async_with_result(self.close_async_session())
99
- self.close_session()
98
+ try:
99
+ asyncio.get_running_loop().create_task(self.close_async_session())
100
+ except Exception as e:
101
+ pass
102
+ try:
103
+ self.close_session()
104
+ except Exception as e:
105
+ pass
100
106
  if self._loop.is_running():
101
107
  self._loop.call_soon_threadsafe(self._loop.stop)
102
108
  if self._thr.is_alive():
@@ -132,8 +138,7 @@ class MaitaiClient:
132
138
  cls._async_session = None
133
139
 
134
140
  def __del__(self):
135
- self.close_session()
136
- self.run_async_with_result(self.close_async_session())
141
+ self.cleanup()
137
142
 
138
143
  @classmethod
139
144
  def run_async(cls, coro):
maitai/_utils.py CHANGED
@@ -34,25 +34,54 @@ class OpenAISchemaGenerator(GenerateJsonSchema):
34
34
  json_schema = super().generate(schema, mode=mode)
35
35
 
36
36
  # Inline the referenced objects
37
- def resolve_refs(obj):
37
+ def resolve_refs(obj, processed_refs=None):
38
+ if processed_refs is None:
39
+ processed_refs = set()
40
+
38
41
  if isinstance(obj, dict):
39
42
  if "$ref" in obj and obj["$ref"].startswith("#/$defs/"):
40
43
  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()}
44
+
45
+ # If we've seen this ref before, return a simplified version
46
+ if ref_name in processed_refs:
47
+ return {"type": "object"}
48
+
49
+ processed_refs.add(ref_name)
50
+ return resolve_refs(
51
+ json_schema.get("$defs", {}).get(ref_name, {}), processed_refs
52
+ )
53
+
54
+ return {k: resolve_refs(v, processed_refs) for k, v in obj.items()}
43
55
  elif isinstance(obj, list):
44
- return [resolve_refs(item) for item in obj]
56
+ return [resolve_refs(item, processed_refs) for item in obj]
45
57
  return obj
46
58
 
47
- properties = resolve_refs(json_schema["properties"])
59
+ # Get the main schema from $defs if it exists
60
+ main_schema = None
61
+ if "allOf" in json_schema and json_schema["allOf"]:
62
+ ref = json_schema["allOf"][0].get("$ref")
63
+ if ref and ref.startswith("#/$defs/"):
64
+ ref_name = ref.split("/")[-1]
65
+ main_schema = json_schema["$defs"][ref_name]
66
+
67
+ properties = resolve_refs(
68
+ main_schema["properties"] if main_schema else json_schema["properties"]
69
+ )
48
70
 
49
71
  return {
50
- "name": schema.get("title", "").lower() + "_schema",
72
+ "name": (
73
+ main_schema.get("title", "") if main_schema else schema.get("title", "")
74
+ ).lower()
75
+ + "_schema",
51
76
  "strict": True,
52
77
  "schema": {
53
78
  "type": "object",
54
79
  "properties": properties,
55
- "required": json_schema.get("required", []),
80
+ "required": (
81
+ main_schema.get("required", [])
82
+ if main_schema
83
+ else json_schema.get("required", [])
84
+ ),
56
85
  "additionalProperties": False,
57
86
  },
58
87
  }
maitai_common/version.py CHANGED
@@ -1,3 +1,3 @@
1
- version = "1.2.4b0"
1
+ version = "1.2.6"
2
2
  if __name__ == "__main__":
3
3
  print(version)
@@ -68,6 +68,7 @@ class ExportRequest(betterproto.Message):
68
68
  run_name: Optional[str] = betterproto.string_field(9, optional=True)
69
69
  base_model: str = betterproto.string_field(10)
70
70
  display_name: str = betterproto.string_field(11)
71
+ prompt_deletions: List[str] = betterproto.string_field(12)
71
72
 
72
73
 
73
74
  @dataclass(eq=False, repr=False)
@@ -84,3 +85,4 @@ class FinetuneRequest(betterproto.Message):
84
85
  run_id: int = betterproto.int64_field(10)
85
86
  base_model: str = betterproto.string_field(11)
86
87
  display_name: str = betterproto.string_field(12)
88
+ prompt_deletions: List[str] = betterproto.string_field(13)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: maitai-python
3
- Version: 1.2.4b0
3
+ Version: 1.2.6
4
4
  Summary: Maitai SDK for Python
5
5
  Home-page: https://docs.trymaitai.ai
6
6
  Author: Maitai
@@ -6,12 +6,12 @@ maitai/_evaluator.py,sha256=x2XSKv6h90VcYBnqb1BRcPOrX7O3gQ4hShZCJzXfO9Y,10344
6
6
  maitai/_inference.py,sha256=4cijo8J7LDLOZFxD9jPeF9KMUmPk8xG-NaT8cGYaITs,12597
7
7
  maitai/_maitai.py,sha256=5aF0SGbpt3O7Lu-9zHCWdPq133SlyW-uwJ9c6gMlco4,25561
8
8
  maitai/_maitai_async.py,sha256=1Wh5KDOYesC-7xAw58iITAI5RRA4DvmCES1lRpboXzI,25636
9
- maitai/_maitai_client.py,sha256=s3eZAu4HmJauZMVIxi5X5ZeW-ZChKDKK4h3LHJ3PHVs,7744
9
+ maitai/_maitai_client.py,sha256=VE6c_xMUYrq5RME08JuKW1nfTsmwWo9Oa24asHrmfMg,7817
10
10
  maitai/_types.py,sha256=uIYm1YQv6ZmGZ4GG6p6xrCjfVGq8VSxkehLgRqtr1Rw,6436
11
- maitai/_utils.py,sha256=3JN5MClGZNkcmn-hWgi8fNV2n-Ytlek37H3S6TEHzuk,11276
11
+ maitai/_utils.py,sha256=-LGF6I13KBj10DSWyh_OmE5ouOsD4DIjmx4jZOuej0A,12351
12
12
  maitai/tools/__init__.py,sha256=TxJ-g4A0eIzoIMD60ctIPVppCWcdcuZWms3hPGrqkSs,4043
13
13
  maitai_common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
- maitai_common/version.py,sha256=I7iWpJYcLL9eCJM3ItO3vRonf6tX0ZpGZ3lel0-0hCU,66
14
+ maitai_common/version.py,sha256=U83mCM3joMCaLRXouMUmRbxu-42ssvSKsckO19rt2jE,64
15
15
  maitai_common/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
16
  maitai_common/config/config_service.py,sha256=U8hU0F9juZtrZwIayOM_OBShxynUS8gu5K0F40KvcA0,940
17
17
  maitai_common/processes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -28,7 +28,7 @@ maitai_gen/config/__init__.py,sha256=k9tdqH1uhV-cYkZn1FtP4rzMxmKJRGJzxaToWFbTY1g
28
28
  maitai_gen/embedding/__init__.py,sha256=py5vAEdXFatL7daub1YSnruIRV-im0heWSa5hjaSljM,941
29
29
  maitai_gen/evaluation/__init__.py,sha256=HdrDNEPlV3lrvw14VyoeLnY_u8jfGDcocSv2XD9RyY4,2558
30
30
  maitai_gen/event/__init__.py,sha256=puOhfH-KQu_fL-yPJPjceDhwy3VbzP0oTtQs-RHeTE4,670
31
- maitai_gen/finetuning/__init__.py,sha256=e0kdoBdKjXXgufokcEr5WOjEFuqRE1JUCj3FJ0SroHA,3301
31
+ maitai_gen/finetuning/__init__.py,sha256=IwFicInYHwMFjOQlz_bWVxZjlkmaJuz7eiJvvzakWBg,3427
32
32
  maitai_gen/inference/__init__.py,sha256=KUWiTng5KeibART4NZ91JuN6fR4u7hmxcx8BjhCde78,741
33
33
  maitai_gen/key/__init__.py,sha256=6B924RX6F50vOEUVMuw8Ca1leVraneWquAYppZ9d_eI,1446
34
34
  maitai_gen/metric/__init__.py,sha256=RX1sF74PB2L2lTD7EYfim5BSRmvGVd63L__IgJhZDh0,615
@@ -37,7 +37,7 @@ maitai_gen/rates/__init__.py,sha256=Aho7HzMKRfjQz10tMJCoRVttq_cGlYh2DxxpSyTQAzU,
37
37
  maitai_gen/sandbox/__init__.py,sha256=IZ4hf76V1aZrYk5S-4p7z38e-op_s341utVG2domE_g,1549
38
38
  maitai_gen/sentinel/__init__.py,sha256=3yR28usTBIAC-M_uxEUFgqXo2PWylEKEPYmWX_dp7Cs,2513
39
39
  maitai_gen/session/__init__.py,sha256=kCJweCFagUqGkzktucaWLti9HSLaO5AML8Jewl89yM0,1242
40
- maitai_python-1.2.4b0.dist-info/METADATA,sha256=GaS83tZrClifKqVFL_yIdKUV44snPmjnIj9P7rIQ6I4,1496
41
- maitai_python-1.2.4b0.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
42
- maitai_python-1.2.4b0.dist-info/top_level.txt,sha256=-5U1krxnwlqB-AY7nEe29ZcNvwByNc-SnBe-mph-QjI,32
43
- maitai_python-1.2.4b0.dist-info/RECORD,,
40
+ maitai_python-1.2.6.dist-info/METADATA,sha256=ZI5ueq3GWdKfLVHTJPTX440VaG5JafgaF2z_5Afm7y0,1494
41
+ maitai_python-1.2.6.dist-info/WHEEL,sha256=A3WOREP4zgxI0fKrHUG8DC8013e3dK3n7a6HDbcEIwE,91
42
+ maitai_python-1.2.6.dist-info/top_level.txt,sha256=-5U1krxnwlqB-AY7nEe29ZcNvwByNc-SnBe-mph-QjI,32
43
+ maitai_python-1.2.6.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.6.0)
2
+ Generator: setuptools (75.7.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5