synth-ai 0.1.4__py3-none-any.whl → 0.1.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.
- synth_ai/__init__.py +1 -1
- synth_ai/zyk/lms/tools/__init__.py +3 -0
- synth_ai/zyk/lms/tools/base.py +118 -0
- {synth_ai-0.1.4.dist-info → synth_ai-0.1.6.dist-info}/METADATA +1 -1
- {synth_ai-0.1.4.dist-info → synth_ai-0.1.6.dist-info}/RECORD +8 -6
- {synth_ai-0.1.4.dist-info → synth_ai-0.1.6.dist-info}/WHEEL +0 -0
- {synth_ai-0.1.4.dist-info → synth_ai-0.1.6.dist-info}/licenses/LICENSE +0 -0
- {synth_ai-0.1.4.dist-info → synth_ai-0.1.6.dist-info}/top_level.txt +0 -0
synth_ai/__init__.py
CHANGED
@@ -0,0 +1,118 @@
|
|
1
|
+
from typing import Type
|
2
|
+
|
3
|
+
from pydantic import BaseModel
|
4
|
+
|
5
|
+
|
6
|
+
class BaseTool(BaseModel):
|
7
|
+
name: str
|
8
|
+
arguments: Type[BaseModel]
|
9
|
+
description: str = ""
|
10
|
+
strict: bool = True
|
11
|
+
|
12
|
+
def to_openai_tool(self):
|
13
|
+
schema = self.arguments.model_json_schema()
|
14
|
+
schema["additionalProperties"] = False
|
15
|
+
|
16
|
+
if "properties" in schema:
|
17
|
+
for prop_name, prop_schema in schema["properties"].items():
|
18
|
+
if prop_schema.get("type") == "array":
|
19
|
+
items_schema = prop_schema.get("items", {})
|
20
|
+
if not isinstance(items_schema, dict) or not items_schema.get("type"):
|
21
|
+
prop_schema["items"] = {"type": "string"}
|
22
|
+
|
23
|
+
elif "anyOf" in prop_schema:
|
24
|
+
for sub_schema in prop_schema["anyOf"]:
|
25
|
+
if isinstance(sub_schema, dict) and sub_schema.get("type") == "array":
|
26
|
+
items_schema = sub_schema.get("items", {})
|
27
|
+
if not isinstance(items_schema, dict) or not items_schema.get("type"):
|
28
|
+
sub_schema["items"] = {"type": "string"}
|
29
|
+
|
30
|
+
return {
|
31
|
+
"type": "function",
|
32
|
+
"function": {
|
33
|
+
"name": self.name,
|
34
|
+
"description": self.description,
|
35
|
+
"parameters": schema,
|
36
|
+
"strict": self.strict,
|
37
|
+
},
|
38
|
+
}
|
39
|
+
|
40
|
+
def to_anthropic_tool(self):
|
41
|
+
schema = self.arguments.model_json_schema()
|
42
|
+
schema["additionalProperties"] = False
|
43
|
+
|
44
|
+
return {
|
45
|
+
"name": self.name,
|
46
|
+
"description": self.description,
|
47
|
+
"input_schema": {
|
48
|
+
"type": "object",
|
49
|
+
"properties": schema["properties"],
|
50
|
+
"required": schema.get("required", []),
|
51
|
+
},
|
52
|
+
}
|
53
|
+
|
54
|
+
def to_mistral_tool(self):
|
55
|
+
schema = self.arguments.model_json_schema()
|
56
|
+
properties = {}
|
57
|
+
for prop_name, prop in schema.get("properties", {}).items():
|
58
|
+
prop_type = prop["type"]
|
59
|
+
if prop_type == "array" and "items" in prop:
|
60
|
+
properties[prop_name] = {
|
61
|
+
"type": "array",
|
62
|
+
"items": prop["items"],
|
63
|
+
"description": prop.get("description", ""),
|
64
|
+
}
|
65
|
+
continue
|
66
|
+
|
67
|
+
properties[prop_name] = {
|
68
|
+
"type": prop_type,
|
69
|
+
"description": prop.get("description", ""),
|
70
|
+
}
|
71
|
+
if "enum" in prop:
|
72
|
+
properties[prop_name]["enum"] = prop["enum"]
|
73
|
+
|
74
|
+
parameters = {
|
75
|
+
"type": "object",
|
76
|
+
"properties": properties,
|
77
|
+
"required": schema.get("required", []),
|
78
|
+
"additionalProperties": False,
|
79
|
+
}
|
80
|
+
return {
|
81
|
+
"type": "function",
|
82
|
+
"function": {
|
83
|
+
"name": self.name,
|
84
|
+
"description": self.description,
|
85
|
+
"parameters": parameters,
|
86
|
+
},
|
87
|
+
}
|
88
|
+
|
89
|
+
def to_gemini_tool(self):
|
90
|
+
schema = self.arguments.model_json_schema()
|
91
|
+
# Convert Pydantic schema types to Gemini schema types
|
92
|
+
properties = {}
|
93
|
+
for name, prop in schema["properties"].items():
|
94
|
+
prop_type = prop.get("type", "string")
|
95
|
+
if prop_type == "array" and "items" in prop:
|
96
|
+
properties[name] = {
|
97
|
+
"type": "array",
|
98
|
+
"items": prop["items"],
|
99
|
+
"description": prop.get("description", ""),
|
100
|
+
}
|
101
|
+
continue
|
102
|
+
|
103
|
+
properties[name] = {
|
104
|
+
"type": prop_type,
|
105
|
+
"description": prop.get("description", ""),
|
106
|
+
}
|
107
|
+
if "enum" in prop:
|
108
|
+
properties[name]["enum"] = prop["enum"]
|
109
|
+
|
110
|
+
return {
|
111
|
+
"name": self.name,
|
112
|
+
"description": self.description,
|
113
|
+
"parameters": {
|
114
|
+
"type": "object",
|
115
|
+
"properties": properties,
|
116
|
+
"required": schema.get("required", []),
|
117
|
+
},
|
118
|
+
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
synth_ai/__init__.py,sha256=
|
1
|
+
synth_ai/__init__.py,sha256=2y79prX5jWHSuU6LWUXIQueT6y_o79P1ACvxDjNSKI0,225
|
2
2
|
synth_ai/zyk/__init__.py,sha256=kGMD-drlBVdsyT-QFODMwaZUtxPCJ9mg58GKQUvFqo0,134
|
3
3
|
synth_ai/zyk/lms/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
4
|
synth_ai/zyk/lms/config.py,sha256=UBMi0DIFQDBV_eGPK5vG8R7VwxXcV10BPGq1iV8vVjg,282
|
@@ -22,6 +22,8 @@ synth_ai/zyk/lms/structured_outputs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQ
|
|
22
22
|
synth_ai/zyk/lms/structured_outputs/handler.py,sha256=4DboLNZyXpqNB5YNCSgGHBsNbWqFk-8uwV944nOYNo8,16919
|
23
23
|
synth_ai/zyk/lms/structured_outputs/inject.py,sha256=Fy-zDeleRxOZ8ZRM6IuZ6CP2XZnMe4K2PEn4Q9c_KPY,11777
|
24
24
|
synth_ai/zyk/lms/structured_outputs/rehabilitate.py,sha256=ecKGWrgWYUSplqHzK40KdohwaN8gBV0xl4LUReLN_vg,7910
|
25
|
+
synth_ai/zyk/lms/tools/__init__.py,sha256=3JM5vqZqKloaeHaxuO49C8A_0qljys3pQ1yt70WKhho,51
|
26
|
+
synth_ai/zyk/lms/tools/base.py,sha256=i-AIVRlitiQ4JMJ_BBFRSpUcWgxWIUYoHxAqfxHN_7E,4056
|
25
27
|
synth_ai/zyk/lms/vendors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
26
28
|
synth_ai/zyk/lms/vendors/base.py,sha256=aK4PEtkMLt_o3qD22kW-x3HJUEKdIk06zlH4kX0VkAE,760
|
27
29
|
synth_ai/zyk/lms/vendors/openai_standard.py,sha256=dgHC7RWrxwaWto6_frKdfEKazKvvAMYJM1YgJgbVpb8,12279
|
@@ -39,8 +41,8 @@ synth_ai/zyk/lms/vendors/supported/deepseek.py,sha256=BElW0NGpkSA62wOqzzMtDw8XR3
|
|
39
41
|
synth_ai/zyk/lms/vendors/supported/groq.py,sha256=Fbi7QvhdLx0F-VHO5PY-uIQlPR0bo3C9h1MvIOx8nz0,388
|
40
42
|
synth_ai/zyk/lms/vendors/supported/ollama.py,sha256=K30VBFRTd7NYyPmyBVRZS2sm0UB651AHp9i3wd55W64,469
|
41
43
|
synth_ai/zyk/lms/vendors/supported/together.py,sha256=Ni_jBqqGPN0PkkY-Ew64s3gNKk51k3FCpLSwlNhKbf0,342
|
42
|
-
synth_ai-0.1.
|
43
|
-
synth_ai-0.1.
|
44
|
-
synth_ai-0.1.
|
45
|
-
synth_ai-0.1.
|
46
|
-
synth_ai-0.1.
|
44
|
+
synth_ai-0.1.6.dist-info/licenses/LICENSE,sha256=ynhjRQUfqA_RdGRATApfFA_fBAy9cno04sLtLUqxVFM,1069
|
45
|
+
synth_ai-0.1.6.dist-info/METADATA,sha256=0hsFxGTFlxSxCisga5bK7WZXYRgO-ycB7dueqW4VW1g,1084
|
46
|
+
synth_ai-0.1.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
47
|
+
synth_ai-0.1.6.dist-info/top_level.txt,sha256=fBmtZyVHuKaGa29oHBaaUkrUIWTqSpoVMPiVdCDP3k8,9
|
48
|
+
synth_ai-0.1.6.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|