ailoy-py 0.0.3__cp311-cp311-manylinux_2_28_x86_64.whl → 0.0.6__cp311-cp311-manylinux_2_28_x86_64.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.
Potentially problematic release.
This version of ailoy-py might be problematic. Click here for more details.
- ailoy/agent.py +7 -2
- ailoy/ailoy_py.cpython-311-x86_64-linux-gnu.so +0 -0
- ailoy/models/api_model.py +23 -3
- ailoy/tools.py +18 -3
- {ailoy_py-0.0.3.dist-info → ailoy_py-0.0.6.dist-info}/METADATA +1 -1
- {ailoy_py-0.0.3.dist-info → ailoy_py-0.0.6.dist-info}/RECORD +8 -8
- {ailoy_py-0.0.3.dist-info → ailoy_py-0.0.6.dist-info}/WHEEL +0 -0
- {ailoy_py-0.0.3.dist-info → ailoy_py-0.0.6.dist-info}/entry_points.txt +0 -0
ailoy/agent.py
CHANGED
|
@@ -216,8 +216,11 @@ class ToolParameters(BaseModel):
|
|
|
216
216
|
required: Optional[list[str]] = []
|
|
217
217
|
|
|
218
218
|
|
|
219
|
+
JsonSchemaTypes = Literal["string", "integer", "number", "boolean", "object", "array", "null"]
|
|
220
|
+
|
|
221
|
+
|
|
219
222
|
class ToolParametersProperty(BaseModel):
|
|
220
|
-
type:
|
|
223
|
+
type: JsonSchemaTypes | list[JsonSchemaTypes]
|
|
221
224
|
description: Optional[str] = None
|
|
222
225
|
model_config = ConfigDict(extra="allow")
|
|
223
226
|
|
|
@@ -506,7 +509,9 @@ class Agent:
|
|
|
506
509
|
raise RuntimeError("Tool not found")
|
|
507
510
|
tool_result = tool_.call(**tool_call.function.arguments)
|
|
508
511
|
return ToolMessage(
|
|
509
|
-
content=[
|
|
512
|
+
content=[
|
|
513
|
+
TextContent(text=tool_result if isinstance(tool_result, str) else json.dumps(tool_result))
|
|
514
|
+
],
|
|
510
515
|
tool_call_id=tool_call.id,
|
|
511
516
|
)
|
|
512
517
|
|
|
Binary file
|
ailoy/models/api_model.py
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
from typing import Literal, Optional,
|
|
1
|
+
from typing import Literal, Optional, get_args
|
|
2
2
|
|
|
3
3
|
from pydantic import model_validator
|
|
4
4
|
from pydantic.dataclasses import dataclass
|
|
5
5
|
|
|
6
6
|
OpenAIModelId = Literal[
|
|
7
|
+
"gpt-5",
|
|
8
|
+
"gpt-5-mini",
|
|
9
|
+
"gpt-5-nano",
|
|
10
|
+
"gpt-5-chat-latest",
|
|
7
11
|
"o4-mini",
|
|
8
12
|
"o3",
|
|
9
13
|
"o3-pro",
|
|
@@ -28,13 +32,27 @@ ClaudeModelId = Literal[
|
|
|
28
32
|
"claude-3-7-sonnet-20250219",
|
|
29
33
|
"claude-3-5-sonnet-20241022",
|
|
30
34
|
"claude-3-5-sonnet-20240620",
|
|
35
|
+
"claude-opus-4-1-20250805",
|
|
31
36
|
"claude-opus-4-20250514",
|
|
32
37
|
"claude-3-opus-20240229",
|
|
33
38
|
"claude-3-5-haiku-20241022",
|
|
34
39
|
"claude-3-haiku-20240307",
|
|
35
40
|
]
|
|
36
41
|
|
|
37
|
-
|
|
42
|
+
GrokModelId = Literal[
|
|
43
|
+
"grok-4",
|
|
44
|
+
"grok-4-0709",
|
|
45
|
+
"grok-3",
|
|
46
|
+
"grok-3-fast",
|
|
47
|
+
"grok-3-mini",
|
|
48
|
+
"grok-3-mini-fast",
|
|
49
|
+
"grok-2",
|
|
50
|
+
"grok-2-1212",
|
|
51
|
+
"grok-2-vision-1212",
|
|
52
|
+
"grok-2-image-1212",
|
|
53
|
+
]
|
|
54
|
+
|
|
55
|
+
APIModelProvider = Literal["openai", "gemini", "claude", "grok"]
|
|
38
56
|
|
|
39
57
|
|
|
40
58
|
@dataclass
|
|
@@ -44,7 +62,7 @@ class APIModel:
|
|
|
44
62
|
provider: Optional[APIModelProvider] = None
|
|
45
63
|
|
|
46
64
|
@model_validator(mode="after")
|
|
47
|
-
def validate_provider(self)
|
|
65
|
+
def validate_provider(self):
|
|
48
66
|
if self.provider is None:
|
|
49
67
|
if self.id in get_args(OpenAIModelId):
|
|
50
68
|
self.provider = "openai"
|
|
@@ -52,6 +70,8 @@ class APIModel:
|
|
|
52
70
|
self.provider = "gemini"
|
|
53
71
|
elif self.id in get_args(ClaudeModelId):
|
|
54
72
|
self.provider = "claude"
|
|
73
|
+
elif self.id in get_args(GrokModelId):
|
|
74
|
+
self.provider = "grok"
|
|
55
75
|
else:
|
|
56
76
|
raise ValueError(
|
|
57
77
|
f'Failed to infer the model provider based on the model id "{self.id}". '
|
ailoy/tools.py
CHANGED
|
@@ -5,6 +5,7 @@ import types
|
|
|
5
5
|
from typing import (
|
|
6
6
|
Any,
|
|
7
7
|
Callable,
|
|
8
|
+
Literal,
|
|
8
9
|
Optional,
|
|
9
10
|
Union,
|
|
10
11
|
get_args,
|
|
@@ -41,7 +42,7 @@ class DocstringParsingException(Exception):
|
|
|
41
42
|
pass
|
|
42
43
|
|
|
43
44
|
|
|
44
|
-
def _get_json_schema_type(param_type:
|
|
45
|
+
def _get_json_schema_type(param_type: type) -> dict[str, str]:
|
|
45
46
|
type_mapping = {
|
|
46
47
|
int: {"type": "integer"},
|
|
47
48
|
float: {"type": "number"},
|
|
@@ -85,6 +86,20 @@ def _parse_type_hint(hint: str) -> dict:
|
|
|
85
86
|
return_dict["nullable"] = True
|
|
86
87
|
return return_dict
|
|
87
88
|
|
|
89
|
+
elif origin is Literal and len(args) > 0:
|
|
90
|
+
LITERAL_TYPES = (int, float, str, bool, type(None))
|
|
91
|
+
args_types = []
|
|
92
|
+
for arg in args:
|
|
93
|
+
if type(arg) not in LITERAL_TYPES:
|
|
94
|
+
raise TypeHintParsingException("Only the valid python literals can be listed in typing.Literal.")
|
|
95
|
+
arg_type = _get_json_schema_type(type(arg)).get("type")
|
|
96
|
+
if arg_type is not None and arg_type not in args_types:
|
|
97
|
+
args_types.append(arg_type)
|
|
98
|
+
return {
|
|
99
|
+
"type": args_types.pop() if len(args_types) == 1 else list(args_types),
|
|
100
|
+
"enum": list(args),
|
|
101
|
+
}
|
|
102
|
+
|
|
88
103
|
elif origin is list:
|
|
89
104
|
if not args:
|
|
90
105
|
return {"type": "array"}
|
|
@@ -100,13 +115,13 @@ def _parse_type_hint(hint: str) -> dict:
|
|
|
100
115
|
f"The type hint {str(hint).replace('typing.', '')} is a Tuple with a single element, which "
|
|
101
116
|
"we do not automatically convert to JSON schema as it is rarely necessary. If this input can contain "
|
|
102
117
|
"more than one element, we recommend "
|
|
103
|
-
"using a
|
|
118
|
+
"using a list[] type instead, or if it really is a single element, remove the tuple[] wrapper and just "
|
|
104
119
|
"pass the element directly."
|
|
105
120
|
)
|
|
106
121
|
if ... in args:
|
|
107
122
|
raise TypeHintParsingException(
|
|
108
123
|
"Conversion of '...' is not supported in Tuple type hints. "
|
|
109
|
-
"Use
|
|
124
|
+
"Use list[] types for variable-length"
|
|
110
125
|
" inputs instead."
|
|
111
126
|
)
|
|
112
127
|
return {"type": "array", "prefixItems": [_parse_type_hint(t) for t in args]}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
ailoy/__init__.py,sha256=INeFsnHtrqTwkMKUPSdD_9l8DhudnW574e9rsRtrMJc,783
|
|
2
|
-
ailoy/agent.py,sha256=
|
|
3
|
-
ailoy/ailoy_py.cpython-311-x86_64-linux-gnu.so,sha256=
|
|
2
|
+
ailoy/agent.py,sha256=7v2E1ft1Aaufem9lxLEra3S-nX2fzeutJDgT-4LXwL8,26954
|
|
3
|
+
ailoy/ailoy_py.cpython-311-x86_64-linux-gnu.so,sha256=tMoXZqBIAMwUf44UgUYMKY5JqD7tXTkrAc-3AMB4Vds,22797537
|
|
4
4
|
ailoy/ailoy_py.pyi,sha256=Yf90FEXkslpCpr1r2eqQ3-_1jLo65zmG94bBXDRqinU,991
|
|
5
5
|
ailoy/mcp.py,sha256=wVzXfwUh4UcU60PYq17kCFG7ZClmEDBRt8LxetuSkns,6800
|
|
6
6
|
ailoy/runtime.py,sha256=-75KawEMQSwxGvX5wtECVCWiTNdcHojsQ1e-OVB4IQ8,10545
|
|
7
|
-
ailoy/tools.py,sha256=
|
|
7
|
+
ailoy/tools.py,sha256=hLdKe3TN_yn2qSbNG0uX2extokPIdJ6inLbSbhXdYTo,8861
|
|
8
8
|
ailoy/vector_store.py,sha256=ZfIuGYKv2dQmjOuDlSKDc-BBPlQ8no_70mZwnPzbBzo,7515
|
|
9
9
|
ailoy/cli/__main__.py,sha256=HnBVb2em1F2NLPeNX5r3xRndRrnGaXVCduo8WBULAI0,179
|
|
10
10
|
ailoy/cli/model.py,sha256=cerCHE-VY9TOwqRcLBtmqnV-5vphpvyhtrfPFZiTKCM,2979
|
|
11
11
|
ailoy/models/__init__.py,sha256=1AtlJV9gYThw_3snu0jPEH_aQGI74ip7ZcVJLtN5nMU,117
|
|
12
|
-
ailoy/models/api_model.py,sha256=
|
|
12
|
+
ailoy/models/api_model.py,sha256=r_HQ0tWmCnhfggxHy_3GkGSanTJwjnBRTMvSj6X1VGE,2196
|
|
13
13
|
ailoy/models/local_model.py,sha256=Iyur0UEUSbLKzptx9croP_OAF-qh9S-ZDukDthHNz9w,1206
|
|
14
14
|
ailoy/presets/tools/calculator.json,sha256=ePnZsjZChnvS08s9eVdIp4Bys_PlJBXPHCCjv6oMvzA,1040
|
|
15
15
|
ailoy/presets/tools/frankfurter.json,sha256=bZ5vhszf_aR-B_QN4L2xrI5nR-f4AMZk41UUDq1dTXg,1152
|
|
@@ -19,7 +19,7 @@ ailoy/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
19
19
|
ailoy/utils/image.py,sha256=zkufequcQVTmIkArreYUyB8r2nrcOL_8O6KOv5B-yis,288
|
|
20
20
|
ailoy_py.libs/libgomp-870cb1d0.so.1.0.0,sha256=Ta6ZPLbakQH8LP74JzBt0DuJIBHS4nicjkSCjKnyWDw,253289
|
|
21
21
|
ailoy_py.libs/libtvm_runtime-c9b1997b.so,sha256=OLiYdpcijjzZc_5wzEpaEkxSiavSA5JCfuhcmiWWG-4,5617177
|
|
22
|
-
ailoy_py-0.0.
|
|
23
|
-
ailoy_py-0.0.
|
|
24
|
-
ailoy_py-0.0.
|
|
25
|
-
ailoy_py-0.0.
|
|
22
|
+
ailoy_py-0.0.6.dist-info/METADATA,sha256=4FpJrqFqxEPG2vYv3mc9gYj9a6wlazswgct9ZOmvRf4,2053
|
|
23
|
+
ailoy_py-0.0.6.dist-info/WHEEL,sha256=P2KCBwGAL2R32ZvRLAXfe3MZBdxF1lYexVNFNgVVEzI,118
|
|
24
|
+
ailoy_py-0.0.6.dist-info/entry_points.txt,sha256=gVG45uDE6kef0wm6SEMYSgZgRNNRhSAeP2n2lPR00dI,50
|
|
25
|
+
ailoy_py-0.0.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|