airia 0.1.26__py3-none-any.whl → 0.1.27__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.
- airia/client/async_client.py +2 -0
- airia/client/pipelines_config/async_pipelines_config.py +50 -0
- airia/client/pipelines_config/base_pipelines_config.py +37 -0
- airia/client/pipelines_config/sync_pipelines_config.py +50 -0
- airia/client/sync_client.py +2 -0
- airia/client/tools/__init__.py +4 -0
- airia/client/tools/async_tools.py +259 -0
- airia/client/tools/base_tools.py +153 -0
- airia/client/tools/sync_tools.py +245 -0
- airia/types/api/__init__.py +1 -0
- airia/types/api/tools/__init__.py +7 -0
- airia/types/api/tools/_tools.py +223 -0
- {airia-0.1.26.dist-info → airia-0.1.27.dist-info}/METADATA +1 -1
- {airia-0.1.26.dist-info → airia-0.1.27.dist-info}/RECORD +17 -11
- {airia-0.1.26.dist-info → airia-0.1.27.dist-info}/WHEEL +0 -0
- {airia-0.1.26.dist-info → airia-0.1.27.dist-info}/licenses/LICENSE +0 -0
- {airia-0.1.26.dist-info → airia-0.1.27.dist-info}/top_level.txt +0 -0
airia/client/async_client.py
CHANGED
|
@@ -21,6 +21,7 @@ from .pipeline_import import AsyncPipelineImport
|
|
|
21
21
|
from .pipelines_config import AsyncPipelinesConfig
|
|
22
22
|
from .project import AsyncProject
|
|
23
23
|
from .store import AsyncStore
|
|
24
|
+
from .tools import AsyncTools
|
|
24
25
|
|
|
25
26
|
|
|
26
27
|
class AiriaAsyncClient(AiriaBaseClient):
|
|
@@ -74,6 +75,7 @@ class AiriaAsyncClient(AiriaBaseClient):
|
|
|
74
75
|
self.data_vector_search = AsyncDataVectorSearch(self._request_handler)
|
|
75
76
|
self.library = AsyncLibrary(self._request_handler)
|
|
76
77
|
self.models = AsyncModels(self._request_handler)
|
|
78
|
+
self.tools = AsyncTools(self._request_handler)
|
|
77
79
|
|
|
78
80
|
@classmethod
|
|
79
81
|
def with_openai_gateway(
|
|
@@ -188,3 +188,53 @@ class AsyncPipelinesConfig(BasePipelinesConfig):
|
|
|
188
188
|
resp = await self._request_handler.make_request("GET", request_data)
|
|
189
189
|
|
|
190
190
|
return GetPipelinesConfigResponse(**resp)
|
|
191
|
+
|
|
192
|
+
async def delete_pipeline(
|
|
193
|
+
self,
|
|
194
|
+
pipeline_id: str,
|
|
195
|
+
correlation_id: Optional[str] = None,
|
|
196
|
+
) -> None:
|
|
197
|
+
"""
|
|
198
|
+
Delete a pipeline by its ID.
|
|
199
|
+
|
|
200
|
+
This method permanently removes a pipeline and all its configuration
|
|
201
|
+
from the Airia platform. This action cannot be undone.
|
|
202
|
+
|
|
203
|
+
Args:
|
|
204
|
+
pipeline_id (str): The unique identifier of the pipeline to delete.
|
|
205
|
+
correlation_id (str, optional): A unique identifier for request tracing
|
|
206
|
+
and logging. If not provided, one will be automatically generated.
|
|
207
|
+
|
|
208
|
+
Returns:
|
|
209
|
+
None: This method returns nothing upon successful deletion (204 No Content).
|
|
210
|
+
|
|
211
|
+
Raises:
|
|
212
|
+
AiriaAPIError: If the API request fails, including cases where:
|
|
213
|
+
- The pipeline_id doesn't exist (404)
|
|
214
|
+
- Authentication fails (401)
|
|
215
|
+
- Access is forbidden (403)
|
|
216
|
+
- Server errors (5xx)
|
|
217
|
+
|
|
218
|
+
Example:
|
|
219
|
+
```python
|
|
220
|
+
from airia import AiriaAsyncClient
|
|
221
|
+
|
|
222
|
+
client = AiriaAsyncClient(api_key="your_api_key")
|
|
223
|
+
|
|
224
|
+
# Delete a pipeline
|
|
225
|
+
await client.pipelines_config.delete_pipeline(
|
|
226
|
+
pipeline_id="your_pipeline_id"
|
|
227
|
+
)
|
|
228
|
+
print("Pipeline deleted successfully")
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
Warning:
|
|
232
|
+
This operation is permanent and cannot be reversed. Ensure you have
|
|
233
|
+
the correct pipeline_id before calling this method.
|
|
234
|
+
"""
|
|
235
|
+
request_data = self._pre_delete_pipeline(
|
|
236
|
+
pipeline_id=pipeline_id,
|
|
237
|
+
correlation_id=correlation_id,
|
|
238
|
+
api_version=ApiVersion.V1.value,
|
|
239
|
+
)
|
|
240
|
+
await self._request_handler.make_request("DELETE", request_data, return_json=False)
|
|
@@ -114,3 +114,40 @@ class BasePipelinesConfig:
|
|
|
114
114
|
)
|
|
115
115
|
|
|
116
116
|
return request_data
|
|
117
|
+
|
|
118
|
+
def _pre_delete_pipeline(
|
|
119
|
+
self,
|
|
120
|
+
pipeline_id: str,
|
|
121
|
+
correlation_id: Optional[str] = None,
|
|
122
|
+
api_version: str = ApiVersion.V1.value,
|
|
123
|
+
):
|
|
124
|
+
"""
|
|
125
|
+
Prepare request data for deleting a pipeline by ID.
|
|
126
|
+
|
|
127
|
+
This internal method constructs the URL for pipeline deletion
|
|
128
|
+
requests using the provided pipeline identifier.
|
|
129
|
+
|
|
130
|
+
Args:
|
|
131
|
+
pipeline_id: ID of the pipeline to delete
|
|
132
|
+
correlation_id: Optional correlation ID for tracing
|
|
133
|
+
api_version: API version to use for the request
|
|
134
|
+
|
|
135
|
+
Returns:
|
|
136
|
+
RequestData: Prepared request data for the pipeline deletion endpoint
|
|
137
|
+
|
|
138
|
+
Raises:
|
|
139
|
+
ValueError: If an invalid API version is provided
|
|
140
|
+
"""
|
|
141
|
+
if api_version not in ApiVersion.as_list():
|
|
142
|
+
raise ValueError(
|
|
143
|
+
f"Invalid API version: {api_version}. Valid versions are: {', '.join(ApiVersion.as_list())}"
|
|
144
|
+
)
|
|
145
|
+
url = urljoin(
|
|
146
|
+
self._request_handler.base_url,
|
|
147
|
+
f"{api_version}/PipelinesConfig/{pipeline_id}",
|
|
148
|
+
)
|
|
149
|
+
request_data = self._request_handler.prepare_request(
|
|
150
|
+
url, correlation_id=correlation_id
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
return request_data
|
|
@@ -188,3 +188,53 @@ class PipelinesConfig(BasePipelinesConfig):
|
|
|
188
188
|
resp = self._request_handler.make_request("GET", request_data)
|
|
189
189
|
|
|
190
190
|
return GetPipelinesConfigResponse(**resp)
|
|
191
|
+
|
|
192
|
+
def delete_pipeline(
|
|
193
|
+
self,
|
|
194
|
+
pipeline_id: str,
|
|
195
|
+
correlation_id: Optional[str] = None,
|
|
196
|
+
) -> None:
|
|
197
|
+
"""
|
|
198
|
+
Delete a pipeline by its ID.
|
|
199
|
+
|
|
200
|
+
This method permanently removes a pipeline and all its configuration
|
|
201
|
+
from the Airia platform. This action cannot be undone.
|
|
202
|
+
|
|
203
|
+
Args:
|
|
204
|
+
pipeline_id (str): The unique identifier of the pipeline to delete.
|
|
205
|
+
correlation_id (str, optional): A unique identifier for request tracing
|
|
206
|
+
and logging. If not provided, one will be automatically generated.
|
|
207
|
+
|
|
208
|
+
Returns:
|
|
209
|
+
None: This method returns nothing upon successful deletion (204 No Content).
|
|
210
|
+
|
|
211
|
+
Raises:
|
|
212
|
+
AiriaAPIError: If the API request fails, including cases where:
|
|
213
|
+
- The pipeline_id doesn't exist (404)
|
|
214
|
+
- Authentication fails (401)
|
|
215
|
+
- Access is forbidden (403)
|
|
216
|
+
- Server errors (5xx)
|
|
217
|
+
|
|
218
|
+
Example:
|
|
219
|
+
```python
|
|
220
|
+
from airia import AiriaClient
|
|
221
|
+
|
|
222
|
+
client = AiriaClient(api_key="your_api_key")
|
|
223
|
+
|
|
224
|
+
# Delete a pipeline
|
|
225
|
+
client.pipelines_config.delete_pipeline(
|
|
226
|
+
pipeline_id="your_pipeline_id"
|
|
227
|
+
)
|
|
228
|
+
print("Pipeline deleted successfully")
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
Warning:
|
|
232
|
+
This operation is permanent and cannot be reversed. Ensure you have
|
|
233
|
+
the correct pipeline_id before calling this method.
|
|
234
|
+
"""
|
|
235
|
+
request_data = self._pre_delete_pipeline(
|
|
236
|
+
pipeline_id=pipeline_id,
|
|
237
|
+
correlation_id=correlation_id,
|
|
238
|
+
api_version=ApiVersion.V1.value,
|
|
239
|
+
)
|
|
240
|
+
self._request_handler.make_request("DELETE", request_data, return_json=False)
|
airia/client/sync_client.py
CHANGED
|
@@ -21,6 +21,7 @@ from .pipeline_import import PipelineImport
|
|
|
21
21
|
from .pipelines_config import PipelinesConfig
|
|
22
22
|
from .project import Project
|
|
23
23
|
from .store import Store
|
|
24
|
+
from .tools import Tools
|
|
24
25
|
|
|
25
26
|
|
|
26
27
|
class AiriaClient(AiriaBaseClient):
|
|
@@ -74,6 +75,7 @@ class AiriaClient(AiriaBaseClient):
|
|
|
74
75
|
self.data_vector_search = DataVectorSearch(self._request_handler)
|
|
75
76
|
self.library = Library(self._request_handler)
|
|
76
77
|
self.models = Models(self._request_handler)
|
|
78
|
+
self.tools = Tools(self._request_handler)
|
|
77
79
|
|
|
78
80
|
@classmethod
|
|
79
81
|
def with_openai_gateway(
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
from typing import Any, Dict, List, Optional, Literal
|
|
2
|
+
|
|
3
|
+
from ...types._api_version import ApiVersion
|
|
4
|
+
from ...types.api.tools import CreateToolResponse
|
|
5
|
+
from .._request_handler import AsyncRequestHandler
|
|
6
|
+
from .base_tools import BaseTools
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class AsyncTools(BaseTools):
|
|
10
|
+
def __init__(self, request_handler: AsyncRequestHandler):
|
|
11
|
+
super().__init__(request_handler)
|
|
12
|
+
|
|
13
|
+
async def create_tool(
|
|
14
|
+
self,
|
|
15
|
+
name: str,
|
|
16
|
+
description: str,
|
|
17
|
+
purpose: str,
|
|
18
|
+
api_endpoint: str,
|
|
19
|
+
method_type: str,
|
|
20
|
+
body: str,
|
|
21
|
+
tool_credentials: Dict[str, Any],
|
|
22
|
+
headers: List[Dict[str, str]] = [],
|
|
23
|
+
parameters: List[Dict[str, Any]] = [],
|
|
24
|
+
request_timeout: int = 100,
|
|
25
|
+
body_type: Literal["Json", "XFormUrlEncoded", "None"] = "Json",
|
|
26
|
+
category: Literal["Action", "Airia", "Mcp"] = "Airia",
|
|
27
|
+
tool_type: str = "Custom",
|
|
28
|
+
provider: str = "Custom",
|
|
29
|
+
route_through_acc: bool = False,
|
|
30
|
+
should_redirect: bool = True,
|
|
31
|
+
acc_group: Optional[str] = None,
|
|
32
|
+
documentation: Optional[str] = None,
|
|
33
|
+
project_id: Optional[str] = None,
|
|
34
|
+
tags: Optional[List[str]] = None,
|
|
35
|
+
tool_metadata: Optional[List[Dict[str, Any]]] = None,
|
|
36
|
+
correlation_id: Optional[str] = None,
|
|
37
|
+
) -> CreateToolResponse:
|
|
38
|
+
"""
|
|
39
|
+
Create a new tool in the Airia platform.
|
|
40
|
+
|
|
41
|
+
Args:
|
|
42
|
+
name (str): Name of the tool.
|
|
43
|
+
description (str): Brief description of what the tool does.
|
|
44
|
+
Example: "Use this tool to get the current weather in a given location."
|
|
45
|
+
api_endpoint (str): Web API endpoint where the tool sends its requests to
|
|
46
|
+
perform its task.
|
|
47
|
+
method_type (str): HTTP method type. Valid values: "Get", "Post", "Put", "Delete".
|
|
48
|
+
purpose (str): When and why to use this tool.
|
|
49
|
+
Example: "When a user asks about the weather, including current conditions,
|
|
50
|
+
forecasts, or specific weather events."
|
|
51
|
+
body_type (str): Type of the request body. Valid values: "Json", "XFormUrlEncoded", "None".
|
|
52
|
+
category (str): Category of the tool. Valid values: "Action", "Airia", "Mcp".
|
|
53
|
+
provider (str): Provider of the tool.
|
|
54
|
+
tool_type (str): Type of the tool. Valid values: "Custom", "Calculator", "MCP",
|
|
55
|
+
"LoadMemory", "StoreMemory", etc.
|
|
56
|
+
body (str): Body of the request that the tool sends to the API.
|
|
57
|
+
headers (list[dict]): List of headers required when making the API request.
|
|
58
|
+
Each header should be a dictionary with "key" and "value" fields.
|
|
59
|
+
Example: [{"key": "Content-Type", "value": "application/json"}]
|
|
60
|
+
parameters (list[dict]): Collection of parameters required by the tool
|
|
61
|
+
to execute its function.
|
|
62
|
+
request_timeout (int): Request timeout in seconds for tool execution.
|
|
63
|
+
route_through_acc (bool): Flag indicating whether the tool should route
|
|
64
|
+
through the ACC.
|
|
65
|
+
should_redirect (bool): Flag indicating whether the tool should redirect
|
|
66
|
+
with authorization header attached.
|
|
67
|
+
tool_credentials (dict): Tool credentials model.
|
|
68
|
+
acc_group (str, optional): ACC specific group name. If provided, the tool will
|
|
69
|
+
route through this ACC group.
|
|
70
|
+
documentation (str, optional): Documentation for the tool.
|
|
71
|
+
project_id (str, optional): Unique identifier of the project to which the tool
|
|
72
|
+
is associated.
|
|
73
|
+
tags (list[str], optional): List of tags for the tool.
|
|
74
|
+
tool_metadata (list[dict], optional): User provided metadata for the tool definition.
|
|
75
|
+
correlation_id (str, optional): A unique identifier for request tracing
|
|
76
|
+
and logging. If not provided, one will be automatically generated.
|
|
77
|
+
|
|
78
|
+
Returns:
|
|
79
|
+
CreateToolResponse: A response object containing the created tool details
|
|
80
|
+
including its ID, creation timestamp, configuration, credentials,
|
|
81
|
+
parameters, and all provided metadata.
|
|
82
|
+
|
|
83
|
+
Raises:
|
|
84
|
+
AiriaAPIError: If the API request fails, including cases where:
|
|
85
|
+
- Invalid parameters are provided (400)
|
|
86
|
+
- Authentication fails (401)
|
|
87
|
+
- Access is forbidden (403)
|
|
88
|
+
- Server errors (5xx)
|
|
89
|
+
|
|
90
|
+
Example:
|
|
91
|
+
```python
|
|
92
|
+
from airia import AiriaAsyncClient
|
|
93
|
+
import asyncio
|
|
94
|
+
|
|
95
|
+
async def main():
|
|
96
|
+
client = AiriaAsyncClient(api_key="your_api_key")
|
|
97
|
+
|
|
98
|
+
# Create a weather tool with all required parameters
|
|
99
|
+
tool = await client.tools.create_tool(
|
|
100
|
+
name="get_weather",
|
|
101
|
+
description="Use this tool to get the current weather in a given location.",
|
|
102
|
+
api_endpoint="https://api.weather.com/v1/current",
|
|
103
|
+
method_type="Get",
|
|
104
|
+
purpose="When a user asks about the weather, including current conditions.",
|
|
105
|
+
body_type="None",
|
|
106
|
+
category="Action",
|
|
107
|
+
provider="WeatherAPI",
|
|
108
|
+
tool_type="Custom",
|
|
109
|
+
body="",
|
|
110
|
+
headers=[],
|
|
111
|
+
parameters=[],
|
|
112
|
+
request_timeout=100,
|
|
113
|
+
route_through_acc=False,
|
|
114
|
+
should_redirect=False,
|
|
115
|
+
tool_credentials={}
|
|
116
|
+
)
|
|
117
|
+
print(f"Created tool: {tool.id}")
|
|
118
|
+
|
|
119
|
+
# Create an email tool with headers and optional parameters
|
|
120
|
+
tool = await client.tools.create_tool(
|
|
121
|
+
name="send_email",
|
|
122
|
+
description="Send an email to a recipient.",
|
|
123
|
+
api_endpoint="https://api.email-service.com/v1/send",
|
|
124
|
+
method_type="Post",
|
|
125
|
+
purpose="When a user wants to send an email message.",
|
|
126
|
+
body_type="Json",
|
|
127
|
+
category="Action",
|
|
128
|
+
provider="EmailService",
|
|
129
|
+
tool_type="Custom",
|
|
130
|
+
body='{"to": "{{recipient}}", "subject": "{{subject}}", "body": "{{message}}"}',
|
|
131
|
+
headers=[
|
|
132
|
+
{"key": "Content-Type", "value": "application/json"},
|
|
133
|
+
{"key": "Authorization", "value": "Bearer {{api_key}}"}
|
|
134
|
+
],
|
|
135
|
+
parameters=[
|
|
136
|
+
{"name": "recipient", "type": "string", "required": True},
|
|
137
|
+
{"name": "subject", "type": "string", "required": True},
|
|
138
|
+
{"name": "message", "type": "string", "required": True}
|
|
139
|
+
],
|
|
140
|
+
request_timeout=120,
|
|
141
|
+
route_through_acc=False,
|
|
142
|
+
should_redirect=False,
|
|
143
|
+
tool_credentials={},
|
|
144
|
+
documentation="This tool sends emails using the Email Service API.",
|
|
145
|
+
tags=["email", "communication"]
|
|
146
|
+
)
|
|
147
|
+
print(f"Created email tool: {tool.id}")
|
|
148
|
+
|
|
149
|
+
await client.close()
|
|
150
|
+
|
|
151
|
+
asyncio.run(main())
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Note:
|
|
155
|
+
- Required parameters: name, description, api_endpoint, method_type, purpose,
|
|
156
|
+
body_type, category, provider, tool_type, body, headers, parameters,
|
|
157
|
+
request_timeout, route_through_acc, should_redirect, and tool_credentials.
|
|
158
|
+
- Optional parameters: acc_group, documentation, project_id, tags, and tool_metadata.
|
|
159
|
+
- The method_type must be one of: "Get", "Post", "Put", "Delete"
|
|
160
|
+
- The body_type must be one of: "Json", "XFormUrlEncoded", "None"
|
|
161
|
+
- The category must be one of: "Action", "Airia", "Mcp"
|
|
162
|
+
- The tool_type must be one of: "Custom", "Calculator", "MCP", "LoadMemory",
|
|
163
|
+
"StoreMemory", etc.
|
|
164
|
+
"""
|
|
165
|
+
request_data = self._pre_create_tool(
|
|
166
|
+
name=name,
|
|
167
|
+
description=description,
|
|
168
|
+
api_endpoint=api_endpoint,
|
|
169
|
+
method_type=method_type,
|
|
170
|
+
purpose=purpose,
|
|
171
|
+
body_type=body_type,
|
|
172
|
+
category=category,
|
|
173
|
+
provider=provider,
|
|
174
|
+
tool_type=tool_type,
|
|
175
|
+
body=body,
|
|
176
|
+
headers=headers,
|
|
177
|
+
parameters=parameters,
|
|
178
|
+
request_timeout=request_timeout,
|
|
179
|
+
route_through_acc=route_through_acc,
|
|
180
|
+
should_redirect=should_redirect,
|
|
181
|
+
tool_credentials=tool_credentials,
|
|
182
|
+
acc_group=acc_group,
|
|
183
|
+
documentation=documentation,
|
|
184
|
+
project_id=project_id,
|
|
185
|
+
tags=tags,
|
|
186
|
+
tool_metadata=tool_metadata,
|
|
187
|
+
correlation_id=correlation_id,
|
|
188
|
+
api_version=ApiVersion.V1.value,
|
|
189
|
+
)
|
|
190
|
+
resp = await self._request_handler.make_request("POST", request_data)
|
|
191
|
+
|
|
192
|
+
return CreateToolResponse(**resp)
|
|
193
|
+
|
|
194
|
+
async def delete_tool(
|
|
195
|
+
self,
|
|
196
|
+
tool_id: str,
|
|
197
|
+
correlation_id: Optional[str] = None,
|
|
198
|
+
) -> None:
|
|
199
|
+
"""
|
|
200
|
+
Delete a tool by its ID.
|
|
201
|
+
|
|
202
|
+
This method permanently removes a tool from the Airia platform.
|
|
203
|
+
This action cannot be undone.
|
|
204
|
+
|
|
205
|
+
Args:
|
|
206
|
+
tool_id (str): The unique identifier of the tool to delete.
|
|
207
|
+
correlation_id (str, optional): A unique identifier for request tracing
|
|
208
|
+
and logging. If not provided, one will be automatically generated.
|
|
209
|
+
|
|
210
|
+
Returns:
|
|
211
|
+
None: This method returns nothing upon successful deletion.
|
|
212
|
+
|
|
213
|
+
Raises:
|
|
214
|
+
AiriaAPIError: If the API request fails, including cases where:
|
|
215
|
+
- The tool_id doesn't exist (404)
|
|
216
|
+
- Authentication fails (401)
|
|
217
|
+
- Access is forbidden (403)
|
|
218
|
+
- Server errors (5xx)
|
|
219
|
+
|
|
220
|
+
Example:
|
|
221
|
+
```python
|
|
222
|
+
from airia import AiriaAsyncClient
|
|
223
|
+
import asyncio
|
|
224
|
+
|
|
225
|
+
async def main():
|
|
226
|
+
client = AiriaAsyncClient(api_key="your_api_key")
|
|
227
|
+
|
|
228
|
+
# Delete a tool
|
|
229
|
+
await client.tools.delete_tool(tool_id="tool_123")
|
|
230
|
+
print("Tool deleted successfully")
|
|
231
|
+
|
|
232
|
+
# Handle deletion errors
|
|
233
|
+
from airia.exceptions import AiriaAPIError
|
|
234
|
+
|
|
235
|
+
try:
|
|
236
|
+
await client.tools.delete_tool(tool_id="nonexistent_id")
|
|
237
|
+
except AiriaAPIError as e:
|
|
238
|
+
if e.status_code == 404:
|
|
239
|
+
print("Tool not found")
|
|
240
|
+
else:
|
|
241
|
+
print(f"Error deleting tool: {e.message}")
|
|
242
|
+
|
|
243
|
+
await client.close()
|
|
244
|
+
|
|
245
|
+
asyncio.run(main())
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
Note:
|
|
249
|
+
This operation is permanent and cannot be undone. Make sure you have
|
|
250
|
+
the correct tool_id before calling this method.
|
|
251
|
+
"""
|
|
252
|
+
request_data = self._pre_delete_tool(
|
|
253
|
+
tool_id=tool_id,
|
|
254
|
+
correlation_id=correlation_id,
|
|
255
|
+
api_version=ApiVersion.V1.value,
|
|
256
|
+
)
|
|
257
|
+
await self._request_handler.make_request(
|
|
258
|
+
"DELETE", request_data, return_json=False
|
|
259
|
+
)
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
from typing import Any, Dict, List, Optional, Union
|
|
2
|
+
from urllib.parse import urljoin
|
|
3
|
+
|
|
4
|
+
from ...types._api_version import ApiVersion
|
|
5
|
+
from .._request_handler import AsyncRequestHandler, RequestHandler
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class BaseTools:
|
|
9
|
+
def __init__(self, request_handler: Union[RequestHandler, AsyncRequestHandler]):
|
|
10
|
+
self._request_handler = request_handler
|
|
11
|
+
|
|
12
|
+
def _pre_create_tool(
|
|
13
|
+
self,
|
|
14
|
+
name: str,
|
|
15
|
+
description: str,
|
|
16
|
+
api_endpoint: str,
|
|
17
|
+
method_type: str,
|
|
18
|
+
purpose: str,
|
|
19
|
+
body_type: str,
|
|
20
|
+
category: str,
|
|
21
|
+
provider: str,
|
|
22
|
+
tool_type: str,
|
|
23
|
+
body: str,
|
|
24
|
+
headers: List[Dict[str, str]],
|
|
25
|
+
parameters: List[Dict[str, Any]],
|
|
26
|
+
request_timeout: int,
|
|
27
|
+
route_through_acc: bool,
|
|
28
|
+
should_redirect: bool,
|
|
29
|
+
tool_credentials: Dict[str, Any],
|
|
30
|
+
acc_group: Optional[str] = None,
|
|
31
|
+
documentation: Optional[str] = None,
|
|
32
|
+
project_id: Optional[str] = None,
|
|
33
|
+
tags: Optional[List[str]] = None,
|
|
34
|
+
tool_metadata: Optional[List[Dict[str, Any]]] = None,
|
|
35
|
+
correlation_id: Optional[str] = None,
|
|
36
|
+
api_version: str = ApiVersion.V1.value,
|
|
37
|
+
):
|
|
38
|
+
"""
|
|
39
|
+
Prepare request data for creating a new tool.
|
|
40
|
+
|
|
41
|
+
This internal method constructs the URL and payload for tool creation
|
|
42
|
+
requests, including all tool configuration and metadata.
|
|
43
|
+
|
|
44
|
+
Args:
|
|
45
|
+
name: Name of the tool
|
|
46
|
+
description: Brief description of what the tool does
|
|
47
|
+
api_endpoint: Web API endpoint where the tool sends its requests
|
|
48
|
+
method_type: HTTP method type (Get, Post, Put, Delete)
|
|
49
|
+
purpose: When and why to use this tool
|
|
50
|
+
body_type: Type of the request body (Json, XFormUrlEncoded, None)
|
|
51
|
+
category: Category of the tool (Action, Airia, Mcp)
|
|
52
|
+
provider: Provider of the tool
|
|
53
|
+
tool_type: Type of the tool (Custom, Calculator, MCP, etc.)
|
|
54
|
+
body: Body of the request that the tool sends to the API
|
|
55
|
+
headers: List of headers required when making the API request
|
|
56
|
+
parameters: Collection of parameters required by the tool
|
|
57
|
+
request_timeout: Request timeout in seconds for tool execution
|
|
58
|
+
route_through_acc: Flag indicating whether the tool should route through the ACC
|
|
59
|
+
should_redirect: Flag indicating whether the tool should redirect with authorization header
|
|
60
|
+
tool_credentials: Tool credentials
|
|
61
|
+
acc_group: Optional ACC specific group name
|
|
62
|
+
documentation: Optional documentation for the tool
|
|
63
|
+
project_id: Optional unique identifier of the project to which the tool is associated
|
|
64
|
+
tags: Optional list of tags for the tool
|
|
65
|
+
tool_metadata: Optional user provided metadata for the tool definition
|
|
66
|
+
correlation_id: Optional correlation ID for tracing
|
|
67
|
+
api_version: API version to use for the request
|
|
68
|
+
|
|
69
|
+
Returns:
|
|
70
|
+
RequestData: Prepared request data for the tool creation endpoint
|
|
71
|
+
|
|
72
|
+
Raises:
|
|
73
|
+
ValueError: If an invalid API version is provided
|
|
74
|
+
"""
|
|
75
|
+
if api_version not in ApiVersion.as_list():
|
|
76
|
+
raise ValueError(
|
|
77
|
+
f"Invalid API version: {api_version}. Valid versions are: {', '.join(ApiVersion.as_list())}"
|
|
78
|
+
)
|
|
79
|
+
url = urljoin(self._request_handler.base_url, f"{api_version}/Tools")
|
|
80
|
+
|
|
81
|
+
payload: Dict[str, Any] = {
|
|
82
|
+
"name": name,
|
|
83
|
+
"description": description,
|
|
84
|
+
"apiEndpoint": api_endpoint,
|
|
85
|
+
"methodType": method_type,
|
|
86
|
+
"purpose": purpose,
|
|
87
|
+
"bodyType": body_type,
|
|
88
|
+
"category": category,
|
|
89
|
+
"provider": provider,
|
|
90
|
+
"toolType": tool_type,
|
|
91
|
+
"body": body,
|
|
92
|
+
"headers": headers,
|
|
93
|
+
"parameters": parameters,
|
|
94
|
+
"requestTimeout": request_timeout,
|
|
95
|
+
"routeThroughACC": route_through_acc,
|
|
96
|
+
"shouldRedirect": should_redirect,
|
|
97
|
+
"toolCredentials": tool_credentials,
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
# Add optional fields only if they are provided
|
|
101
|
+
if acc_group is not None:
|
|
102
|
+
payload["accGroup"] = acc_group
|
|
103
|
+
if documentation is not None:
|
|
104
|
+
payload["documentation"] = documentation
|
|
105
|
+
if project_id is not None:
|
|
106
|
+
payload["projectId"] = project_id
|
|
107
|
+
if tags is not None:
|
|
108
|
+
payload["tags"] = tags
|
|
109
|
+
if tool_metadata is not None:
|
|
110
|
+
payload["toolMetadata"] = tool_metadata
|
|
111
|
+
|
|
112
|
+
request_data = self._request_handler.prepare_request(
|
|
113
|
+
url=url, payload=payload, correlation_id=correlation_id
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
return request_data
|
|
117
|
+
|
|
118
|
+
def _pre_delete_tool(
|
|
119
|
+
self,
|
|
120
|
+
tool_id: str,
|
|
121
|
+
correlation_id: Optional[str] = None,
|
|
122
|
+
api_version: str = ApiVersion.V1.value,
|
|
123
|
+
):
|
|
124
|
+
"""
|
|
125
|
+
Prepare request data for deleting a tool by ID.
|
|
126
|
+
|
|
127
|
+
This internal method constructs the URL for tool deletion
|
|
128
|
+
requests using the provided tool identifier.
|
|
129
|
+
|
|
130
|
+
Args:
|
|
131
|
+
tool_id: ID of the tool to delete
|
|
132
|
+
correlation_id: Optional correlation ID for tracing
|
|
133
|
+
api_version: API version to use for the request
|
|
134
|
+
|
|
135
|
+
Returns:
|
|
136
|
+
RequestData: Prepared request data for the tool deletion endpoint
|
|
137
|
+
|
|
138
|
+
Raises:
|
|
139
|
+
ValueError: If an invalid API version is provided
|
|
140
|
+
"""
|
|
141
|
+
if api_version not in ApiVersion.as_list():
|
|
142
|
+
raise ValueError(
|
|
143
|
+
f"Invalid API version: {api_version}. Valid versions are: {', '.join(ApiVersion.as_list())}"
|
|
144
|
+
)
|
|
145
|
+
url = urljoin(
|
|
146
|
+
self._request_handler.base_url,
|
|
147
|
+
f"{api_version}/Tools/{tool_id}",
|
|
148
|
+
)
|
|
149
|
+
request_data = self._request_handler.prepare_request(
|
|
150
|
+
url, correlation_id=correlation_id
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
return request_data
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
from typing import Any, Dict, List, Optional, Literal
|
|
2
|
+
|
|
3
|
+
from ...types._api_version import ApiVersion
|
|
4
|
+
from ...types.api.tools import CreateToolResponse
|
|
5
|
+
from .._request_handler import RequestHandler
|
|
6
|
+
from .base_tools import BaseTools
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class Tools(BaseTools):
|
|
10
|
+
def __init__(self, request_handler: RequestHandler):
|
|
11
|
+
super().__init__(request_handler)
|
|
12
|
+
|
|
13
|
+
def create_tool(
|
|
14
|
+
self,
|
|
15
|
+
name: str,
|
|
16
|
+
description: str,
|
|
17
|
+
purpose: str,
|
|
18
|
+
api_endpoint: str,
|
|
19
|
+
method_type: str,
|
|
20
|
+
body: str,
|
|
21
|
+
tool_credentials: Dict[str, Any],
|
|
22
|
+
headers: List[Dict[str, str]] = [],
|
|
23
|
+
parameters: List[Dict[str, Any]] = [],
|
|
24
|
+
request_timeout: int = 100,
|
|
25
|
+
body_type: Literal["Json", "XFormUrlEncoded", "None"] = "Json",
|
|
26
|
+
category: Literal["Action", "Airia", "Mcp"] = "Airia",
|
|
27
|
+
tool_type: str = "Custom",
|
|
28
|
+
provider: str = "Custom",
|
|
29
|
+
route_through_acc: bool = False,
|
|
30
|
+
should_redirect: bool = True,
|
|
31
|
+
acc_group: Optional[str] = None,
|
|
32
|
+
documentation: Optional[str] = None,
|
|
33
|
+
project_id: Optional[str] = None,
|
|
34
|
+
tags: Optional[List[str]] = None,
|
|
35
|
+
tool_metadata: Optional[List[Dict[str, Any]]] = None,
|
|
36
|
+
correlation_id: Optional[str] = None,
|
|
37
|
+
) -> CreateToolResponse:
|
|
38
|
+
"""
|
|
39
|
+
Create a new tool in the Airia platform.
|
|
40
|
+
|
|
41
|
+
Args:
|
|
42
|
+
name (str): Name of the tool.
|
|
43
|
+
description (str): Brief description of what the tool does.
|
|
44
|
+
Example: "Use this tool to get the current weather in a given location."
|
|
45
|
+
purpose (str): When and why to use this tool.
|
|
46
|
+
Example: "When a user asks about the weather, including current conditions,
|
|
47
|
+
forecasts, or specific weather events."
|
|
48
|
+
api_endpoint (str): Web API endpoint where the tool sends its requests to
|
|
49
|
+
perform its task.
|
|
50
|
+
method_type (str): HTTP method type. Valid values: "Get", "Post", "Put", "Delete".
|
|
51
|
+
body_type (str): Type of the request body. Valid values: "Json", "XFormUrlEncoded", "None".
|
|
52
|
+
category (str): Category of the tool. Valid values: "Action", "Airia", "Mcp".
|
|
53
|
+
provider (str): Provider of the tool.
|
|
54
|
+
tool_type (str): Type of the tool. Valid values: "Custom", "Calculator", "MCP",
|
|
55
|
+
"LoadMemory", "StoreMemory", etc.
|
|
56
|
+
body (str): Body of the request that the tool sends to the API.
|
|
57
|
+
headers (list[dict]): List of headers required when making the API request.
|
|
58
|
+
Each header should be a dictionary with "key" and "value" fields.
|
|
59
|
+
Example: [{"key": "Content-Type", "value": "application/json"}]
|
|
60
|
+
parameters (list[dict]): Collection of parameters required by the tool
|
|
61
|
+
to execute its function.
|
|
62
|
+
request_timeout (int): Request timeout in seconds for tool execution.
|
|
63
|
+
route_through_acc (bool): Flag indicating whether the tool should route
|
|
64
|
+
through the ACC.
|
|
65
|
+
should_redirect (bool): Flag indicating whether the tool should redirect
|
|
66
|
+
with authorization header attached.
|
|
67
|
+
tool_credentials (dict): Tool credentials model.
|
|
68
|
+
acc_group (str, optional): ACC specific group name. If provided, the tool will
|
|
69
|
+
route through this ACC group.
|
|
70
|
+
documentation (str, optional): Documentation for the tool.
|
|
71
|
+
project_id (str, optional): Unique identifier of the project to which the tool
|
|
72
|
+
is associated.
|
|
73
|
+
tags (list[str], optional): List of tags for the tool.
|
|
74
|
+
tool_metadata (list[dict], optional): User provided metadata for the tool definition.
|
|
75
|
+
correlation_id (str, optional): A unique identifier for request tracing
|
|
76
|
+
and logging. If not provided, one will be automatically generated.
|
|
77
|
+
|
|
78
|
+
Returns:
|
|
79
|
+
CreateToolResponse: A response object containing the created tool details
|
|
80
|
+
including its ID, creation timestamp, configuration, credentials,
|
|
81
|
+
parameters, and all provided metadata.
|
|
82
|
+
|
|
83
|
+
Raises:
|
|
84
|
+
AiriaAPIError: If the API request fails, including cases where:
|
|
85
|
+
- Invalid parameters are provided (400)
|
|
86
|
+
- Authentication fails (401)
|
|
87
|
+
- Access is forbidden (403)
|
|
88
|
+
- Server errors (5xx)
|
|
89
|
+
|
|
90
|
+
Example:
|
|
91
|
+
```python
|
|
92
|
+
from airia import AiriaClient
|
|
93
|
+
|
|
94
|
+
client = AiriaClient(api_key="your_api_key")
|
|
95
|
+
|
|
96
|
+
# Create a weather tool with all required parameters
|
|
97
|
+
tool = client.tools.create_tool(
|
|
98
|
+
name="get_weather",
|
|
99
|
+
description="Use this tool to get the current weather in a given location.",
|
|
100
|
+
api_endpoint="https://api.weather.com/v1/current",
|
|
101
|
+
method_type="Get",
|
|
102
|
+
purpose="When a user asks about the weather, including current conditions.",
|
|
103
|
+
body_type="None",
|
|
104
|
+
category="Action",
|
|
105
|
+
provider="WeatherAPI",
|
|
106
|
+
tool_type="Custom",
|
|
107
|
+
body="",
|
|
108
|
+
headers=[],
|
|
109
|
+
parameters=[],
|
|
110
|
+
request_timeout=100,
|
|
111
|
+
route_through_acc=False,
|
|
112
|
+
should_redirect=False,
|
|
113
|
+
tool_credentials={}
|
|
114
|
+
)
|
|
115
|
+
print(f"Created tool: {tool.id}")
|
|
116
|
+
|
|
117
|
+
# Create an email tool with headers and optional parameters
|
|
118
|
+
tool = client.tools.create_tool(
|
|
119
|
+
name="send_email",
|
|
120
|
+
description="Send an email to a recipient.",
|
|
121
|
+
api_endpoint="https://api.email-service.com/v1/send",
|
|
122
|
+
method_type="Post",
|
|
123
|
+
purpose="When a user wants to send an email message.",
|
|
124
|
+
body_type="Json",
|
|
125
|
+
category="Action",
|
|
126
|
+
provider="EmailService",
|
|
127
|
+
tool_type="Custom",
|
|
128
|
+
body='{"to": "{{recipient}}", "subject": "{{subject}}", "body": "{{message}}"}',
|
|
129
|
+
headers=[
|
|
130
|
+
{"key": "Content-Type", "value": "application/json"},
|
|
131
|
+
{"key": "Authorization", "value": "Bearer {{api_key}}"}
|
|
132
|
+
],
|
|
133
|
+
parameters=[
|
|
134
|
+
{"name": "recipient", "type": "string", "required": True},
|
|
135
|
+
{"name": "subject", "type": "string", "required": True},
|
|
136
|
+
{"name": "message", "type": "string", "required": True}
|
|
137
|
+
],
|
|
138
|
+
request_timeout=120,
|
|
139
|
+
route_through_acc=False,
|
|
140
|
+
should_redirect=False,
|
|
141
|
+
tool_credentials={},
|
|
142
|
+
documentation="This tool sends emails using the Email Service API.",
|
|
143
|
+
tags=["email", "communication"]
|
|
144
|
+
)
|
|
145
|
+
print(f"Created email tool: {tool.id}")
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Note:
|
|
149
|
+
- Required parameters: name, description, api_endpoint, method_type, purpose,
|
|
150
|
+
body_type, category, provider, tool_type, body, headers, parameters,
|
|
151
|
+
request_timeout, route_through_acc, should_redirect, and tool_credentials.
|
|
152
|
+
- Optional parameters: acc_group, documentation, project_id, tags, and tool_metadata.
|
|
153
|
+
- The method_type must be one of: "Get", "Post", "Put", "Delete"
|
|
154
|
+
- The body_type must be one of: "Json", "XFormUrlEncoded", "None"
|
|
155
|
+
- The category must be one of: "Action", "Airia", "Mcp"
|
|
156
|
+
- The tool_type must be one of: "Custom", "Calculator", "MCP", "LoadMemory",
|
|
157
|
+
"StoreMemory", etc.
|
|
158
|
+
"""
|
|
159
|
+
request_data = self._pre_create_tool(
|
|
160
|
+
name=name,
|
|
161
|
+
description=description,
|
|
162
|
+
api_endpoint=api_endpoint,
|
|
163
|
+
method_type=method_type,
|
|
164
|
+
purpose=purpose,
|
|
165
|
+
body_type=body_type,
|
|
166
|
+
category=category,
|
|
167
|
+
provider=provider,
|
|
168
|
+
tool_type=tool_type,
|
|
169
|
+
body=body,
|
|
170
|
+
headers=headers,
|
|
171
|
+
parameters=parameters,
|
|
172
|
+
request_timeout=request_timeout,
|
|
173
|
+
route_through_acc=route_through_acc,
|
|
174
|
+
should_redirect=should_redirect,
|
|
175
|
+
tool_credentials=tool_credentials,
|
|
176
|
+
acc_group=acc_group,
|
|
177
|
+
documentation=documentation,
|
|
178
|
+
project_id=project_id,
|
|
179
|
+
tags=tags,
|
|
180
|
+
tool_metadata=tool_metadata,
|
|
181
|
+
correlation_id=correlation_id,
|
|
182
|
+
api_version=ApiVersion.V1.value,
|
|
183
|
+
)
|
|
184
|
+
resp = self._request_handler.make_request("POST", request_data)
|
|
185
|
+
|
|
186
|
+
return CreateToolResponse(**resp)
|
|
187
|
+
|
|
188
|
+
def delete_tool(
|
|
189
|
+
self,
|
|
190
|
+
tool_id: str,
|
|
191
|
+
correlation_id: Optional[str] = None,
|
|
192
|
+
) -> None:
|
|
193
|
+
"""
|
|
194
|
+
Delete a tool by its ID.
|
|
195
|
+
|
|
196
|
+
This method permanently removes a tool from the Airia platform.
|
|
197
|
+
This action cannot be undone.
|
|
198
|
+
|
|
199
|
+
Args:
|
|
200
|
+
tool_id (str): The unique identifier of the tool to delete.
|
|
201
|
+
correlation_id (str, optional): A unique identifier for request tracing
|
|
202
|
+
and logging. If not provided, one will be automatically generated.
|
|
203
|
+
|
|
204
|
+
Returns:
|
|
205
|
+
None: This method returns nothing upon successful deletion.
|
|
206
|
+
|
|
207
|
+
Raises:
|
|
208
|
+
AiriaAPIError: If the API request fails, including cases where:
|
|
209
|
+
- The tool_id doesn't exist (404)
|
|
210
|
+
- Authentication fails (401)
|
|
211
|
+
- Access is forbidden (403)
|
|
212
|
+
- Server errors (5xx)
|
|
213
|
+
|
|
214
|
+
Example:
|
|
215
|
+
```python
|
|
216
|
+
from airia import AiriaClient
|
|
217
|
+
|
|
218
|
+
client = AiriaClient(api_key="your_api_key")
|
|
219
|
+
|
|
220
|
+
# Delete a tool
|
|
221
|
+
client.tools.delete_tool(tool_id="tool_123")
|
|
222
|
+
print("Tool deleted successfully")
|
|
223
|
+
|
|
224
|
+
# Handle deletion errors
|
|
225
|
+
from airia.exceptions import AiriaAPIError
|
|
226
|
+
|
|
227
|
+
try:
|
|
228
|
+
client.tools.delete_tool(tool_id="nonexistent_id")
|
|
229
|
+
except AiriaAPIError as e:
|
|
230
|
+
if e.status_code == 404:
|
|
231
|
+
print("Tool not found")
|
|
232
|
+
else:
|
|
233
|
+
print(f"Error deleting tool: {e.message}")
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
Note:
|
|
237
|
+
This operation is permanent and cannot be undone. Make sure you have
|
|
238
|
+
the correct tool_id before calling this method.
|
|
239
|
+
"""
|
|
240
|
+
request_data = self._pre_delete_tool(
|
|
241
|
+
tool_id=tool_id,
|
|
242
|
+
correlation_id=correlation_id,
|
|
243
|
+
api_version=ApiVersion.V1.value,
|
|
244
|
+
)
|
|
245
|
+
self._request_handler.make_request("DELETE", request_data, return_json=False)
|
airia/types/api/__init__.py
CHANGED
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Pydantic models for tool management API responses.
|
|
3
|
+
|
|
4
|
+
This module defines data structures for tool operations including
|
|
5
|
+
creation and configuration within the Airia platform.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from typing import Optional, List
|
|
9
|
+
from datetime import datetime
|
|
10
|
+
|
|
11
|
+
from pydantic import BaseModel, Field
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class ToolHeader(BaseModel):
|
|
15
|
+
"""Key-value pair header for a tool definition.
|
|
16
|
+
|
|
17
|
+
Attributes:
|
|
18
|
+
key: The key of the header
|
|
19
|
+
value: The value of the header
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
key: str
|
|
23
|
+
value: str
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class ToolParameter(BaseModel):
|
|
27
|
+
"""Parameter definition for a tool.
|
|
28
|
+
|
|
29
|
+
Attributes:
|
|
30
|
+
name: Name of the parameter
|
|
31
|
+
type: Type of the parameter
|
|
32
|
+
description: Description of what the parameter does
|
|
33
|
+
default: Default value for the parameter
|
|
34
|
+
valid_options: List of valid options for the parameter
|
|
35
|
+
array_item_type: Type of items if this parameter is an array
|
|
36
|
+
parameters: Nested parameters for complex types
|
|
37
|
+
requirement: Whether the parameter is required or optional
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
name: str
|
|
41
|
+
type: str
|
|
42
|
+
description: str
|
|
43
|
+
default: Optional[str] = None
|
|
44
|
+
valid_options: Optional[List[str]] = Field(None, alias="validOptions")
|
|
45
|
+
array_item_type: Optional[str] = Field(None, alias="arrayItemType")
|
|
46
|
+
parameters: Optional[List["ToolParameter"]] = None
|
|
47
|
+
requirement: str
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class ToolCredentialSettings(BaseModel):
|
|
51
|
+
"""Settings for tool credentials.
|
|
52
|
+
|
|
53
|
+
Attributes:
|
|
54
|
+
available_credential_types: List of available credential types
|
|
55
|
+
default_value: Default credential value
|
|
56
|
+
platform_supported_oauth_types: List of OAuth types supported by the platform
|
|
57
|
+
"""
|
|
58
|
+
|
|
59
|
+
available_credential_types: List[str] = Field(alias="availableCredentialTypes")
|
|
60
|
+
default_value: Optional[str] = Field(None, alias="defaultValue")
|
|
61
|
+
platform_supported_oauth_types: List[str] = Field(
|
|
62
|
+
alias="platformSupportedOAuthTypes"
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
class ToolCredential(BaseModel):
|
|
67
|
+
"""Tool credential information.
|
|
68
|
+
|
|
69
|
+
Attributes:
|
|
70
|
+
id: Unique identifier for the credential
|
|
71
|
+
name: Name of the credential
|
|
72
|
+
display_identifier_name: Display name for the credential identifier
|
|
73
|
+
created_at: When the credential was created
|
|
74
|
+
project_id: ID of the project this credential belongs to
|
|
75
|
+
type: Type of credential
|
|
76
|
+
expired: Whether the credential has expired
|
|
77
|
+
expires_on: When the credential expires
|
|
78
|
+
administrative_scope: Scope of the credential (e.g., "Tenant")
|
|
79
|
+
user_id: ID of the user who owns the credential
|
|
80
|
+
"""
|
|
81
|
+
|
|
82
|
+
id: str
|
|
83
|
+
name: Optional[str] = None
|
|
84
|
+
display_identifier_name: Optional[str] = Field(None, alias="displayIdentifierName")
|
|
85
|
+
created_at: Optional[datetime] = Field(None, alias="createdAt")
|
|
86
|
+
project_id: Optional[str] = Field(None, alias="projectId")
|
|
87
|
+
type: str
|
|
88
|
+
expired: Optional[bool] = None
|
|
89
|
+
expires_on: Optional[datetime] = Field(None, alias="expiresOn")
|
|
90
|
+
administrative_scope: str = Field(alias="administrativeScope")
|
|
91
|
+
user_id: Optional[str] = Field(None, alias="userId")
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
class ToolCredentials(BaseModel):
|
|
95
|
+
"""Credentials configuration for a tool.
|
|
96
|
+
|
|
97
|
+
Attributes:
|
|
98
|
+
tool_credential_settings: Settings for tool credentials
|
|
99
|
+
tool_credentials: The actual credential object
|
|
100
|
+
tool_credentials_id: ID of the tool credentials
|
|
101
|
+
auth_required: Whether authentication is required
|
|
102
|
+
use_user_credentials: Whether to use user credentials
|
|
103
|
+
user_credential_connector_id: ID of the user credential connector
|
|
104
|
+
use_user_credentials_type: Type of user credentials to use
|
|
105
|
+
credentials_source_type: Source type of the credentials
|
|
106
|
+
use_airia_key_support: Whether Airia key support is enabled
|
|
107
|
+
"""
|
|
108
|
+
|
|
109
|
+
tool_credential_settings: ToolCredentialSettings = Field(
|
|
110
|
+
alias="toolCredentialSettings"
|
|
111
|
+
)
|
|
112
|
+
tool_credentials: Optional[ToolCredential] = Field(None, alias="toolCredentials")
|
|
113
|
+
tool_credentials_id: Optional[str] = Field(None, alias="toolCredentialsId")
|
|
114
|
+
auth_required: bool = Field(alias="authRequired")
|
|
115
|
+
use_user_credentials: bool = Field(alias="useUserCredentials")
|
|
116
|
+
user_credential_connector_id: Optional[str] = Field(
|
|
117
|
+
None, alias="userCredentialConnectorId"
|
|
118
|
+
)
|
|
119
|
+
use_user_credentials_type: str = Field(alias="useUserCredentialsType")
|
|
120
|
+
credentials_source_type: str = Field(alias="credentialsSourceType")
|
|
121
|
+
use_airia_key_support: bool = Field(alias="useAiriaKeySupport")
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
class ProjectReference(BaseModel):
|
|
125
|
+
"""Reference to a project.
|
|
126
|
+
|
|
127
|
+
Attributes:
|
|
128
|
+
id: Project ID
|
|
129
|
+
name: Project name
|
|
130
|
+
"""
|
|
131
|
+
|
|
132
|
+
id: str
|
|
133
|
+
name: str
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
class ToolMetadata(BaseModel):
|
|
137
|
+
"""Metadata key-value pair for a tool.
|
|
138
|
+
|
|
139
|
+
Attributes:
|
|
140
|
+
key: The metadata key
|
|
141
|
+
value: The metadata value
|
|
142
|
+
"""
|
|
143
|
+
|
|
144
|
+
key: str
|
|
145
|
+
value: str
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
class CreateToolResponse(BaseModel):
|
|
149
|
+
"""Response data for tool creation and retrieval operations.
|
|
150
|
+
|
|
151
|
+
This response contains complete information about a tool including
|
|
152
|
+
its configuration, credentials, parameters, and metadata.
|
|
153
|
+
|
|
154
|
+
Attributes:
|
|
155
|
+
id: Unique identifier for the tool
|
|
156
|
+
created_at: Timestamp when the tool was created
|
|
157
|
+
updated_at: Timestamp when the tool was last updated
|
|
158
|
+
tool_type: Type of the tool (e.g., "custom")
|
|
159
|
+
name: Name of the tool
|
|
160
|
+
standardized_name: Standardized version of the tool name
|
|
161
|
+
display_name: Display name of the tool (includes provider suffix for gateway tools)
|
|
162
|
+
origin: Origin of the tool
|
|
163
|
+
description: Brief description of what the tool does
|
|
164
|
+
method_type: HTTP method type (Get, Post, Put, Delete)
|
|
165
|
+
purpose: When and why to use this tool
|
|
166
|
+
api_endpoint: Web API endpoint where the tool sends requests
|
|
167
|
+
provider: Provider of the tool
|
|
168
|
+
tool_credentials: Credentials configuration for the tool
|
|
169
|
+
headers: Headers required when making API requests
|
|
170
|
+
body: Body of the request that the tool sends to the API
|
|
171
|
+
body_type: Type of the request body (Json, XFormUrlEncoded, None)
|
|
172
|
+
parameters: List of parameters the tool accepts
|
|
173
|
+
project_id: ID of the project this tool belongs to
|
|
174
|
+
project_name: Name of the project this tool belongs to
|
|
175
|
+
project: Project reference object
|
|
176
|
+
children: Child tool definitions
|
|
177
|
+
route_through_acc: Whether the tool should route through an ACC specific group
|
|
178
|
+
should_redirect: Whether the tool should redirect
|
|
179
|
+
acc_group: ACC specific group name
|
|
180
|
+
documentation: Documentation for the tool
|
|
181
|
+
tags: List of tags associated with the tool
|
|
182
|
+
tool_metadata: List of metadata key-value pairs
|
|
183
|
+
supports_pagination: Whether the tool supports pagination
|
|
184
|
+
category: Category of the tool (Action, Airia, Mcp)
|
|
185
|
+
request_timeout: Request timeout in seconds
|
|
186
|
+
"""
|
|
187
|
+
|
|
188
|
+
id: str
|
|
189
|
+
created_at: datetime = Field(alias="createdAt")
|
|
190
|
+
updated_at: datetime = Field(alias="updatedAt")
|
|
191
|
+
tool_type: str = Field(alias="toolType")
|
|
192
|
+
name: str
|
|
193
|
+
standardized_name: str = Field(alias="standardizedName")
|
|
194
|
+
display_name: Optional[str] = Field(None, alias="displayName")
|
|
195
|
+
origin: Optional[str] = None
|
|
196
|
+
description: str
|
|
197
|
+
method_type: str = Field(alias="methodType")
|
|
198
|
+
purpose: str
|
|
199
|
+
api_endpoint: str = Field(alias="apiEndpoint")
|
|
200
|
+
provider: str
|
|
201
|
+
tool_credentials: ToolCredentials = Field(alias="toolCredentials")
|
|
202
|
+
headers: List[ToolHeader]
|
|
203
|
+
body: str
|
|
204
|
+
body_type: str = Field(alias="bodyType")
|
|
205
|
+
parameters: List[ToolParameter]
|
|
206
|
+
project_id: Optional[str] = Field(None, alias="projectId")
|
|
207
|
+
project_name: Optional[str] = Field(None, alias="projectName")
|
|
208
|
+
project: Optional[ProjectReference] = None
|
|
209
|
+
children: Optional[List["CreateToolResponse"]] = None
|
|
210
|
+
route_through_acc: bool = Field(alias="routeThroughACC")
|
|
211
|
+
should_redirect: bool = Field(alias="shouldRedirect")
|
|
212
|
+
acc_group: Optional[str] = Field(None, alias="accGroup")
|
|
213
|
+
documentation: Optional[str] = None
|
|
214
|
+
tags: Optional[List[str]] = None
|
|
215
|
+
tool_metadata: Optional[List[ToolMetadata]] = Field(None, alias="toolMetadata")
|
|
216
|
+
supports_pagination: Optional[bool] = Field(None, alias="supportsPagination")
|
|
217
|
+
category: str
|
|
218
|
+
request_timeout: int = Field(alias="requestTimeout")
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
# Update forward references
|
|
222
|
+
ToolParameter.model_rebuild()
|
|
223
|
+
CreateToolResponse.model_rebuild()
|
|
@@ -3,9 +3,9 @@ airia/constants.py,sha256=oKABowOTsJPIQ1AgtVpNN73oKuhh1DekBC5axYSm8lY,647
|
|
|
3
3
|
airia/exceptions.py,sha256=l1FCKlWC6tONvAxSxv4YEAXjpHEM-eQQQ3mEtSkJvhc,1233
|
|
4
4
|
airia/logs.py,sha256=oHU8ByekHu-udBB-5abY39wUct_26t8io-A1Kcl7D3U,4538
|
|
5
5
|
airia/client/__init__.py,sha256=6gSQ9bl7j79q1HPE0o5py3IRdkwWWuU_7J4h05Dd2o8,127
|
|
6
|
-
airia/client/async_client.py,sha256=
|
|
6
|
+
airia/client/async_client.py,sha256=ueHaYuPgcdm8dI0m_6LIl7oMT4lZREqa0i8-WFPtsJw,7533
|
|
7
7
|
airia/client/base_client.py,sha256=ftyLi2E3Hb4CQFYfiknitJA0sWDTylCiUbde0qkWYhg,3182
|
|
8
|
-
airia/client/sync_client.py,sha256=
|
|
8
|
+
airia/client/sync_client.py,sha256=qJoSfSQH_4kSTLRQPjEtYAeLHkLVk78bkI-Hnr8rNiU,7342
|
|
9
9
|
airia/client/_request_handler/__init__.py,sha256=FOdJMfzjN0Tw0TeD8mDJwHgte70Fw_j08EljtfulCvw,157
|
|
10
10
|
airia/client/_request_handler/async_request_handler.py,sha256=yvPaGDTb6GZwU5V9-AuLv-z0XJ-NhOg974VKzD46vl4,11556
|
|
11
11
|
airia/client/_request_handler/base_request_handler.py,sha256=dObRK6e_V_cGslHzC3WrNQ5lZqmMamjxNhVpb7P1L_w,3516
|
|
@@ -43,9 +43,9 @@ airia/client/pipeline_import/async_pipeline_import.py,sha256=BC6HkkMNiU7_7H8vAhX
|
|
|
43
43
|
airia/client/pipeline_import/base_pipeline_import.py,sha256=_6AHf_bL3RABDaIQN3-ivL3Z8NR1l0J7A4S0ilJCluY,3844
|
|
44
44
|
airia/client/pipeline_import/sync_pipeline_import.py,sha256=SaF8uIWGFhk5i0e45JGY2WXLVNyJPq4WXwUA78m7Yv8,7000
|
|
45
45
|
airia/client/pipelines_config/__init__.py,sha256=Mjn3ie-bQo6zjayxrJDvoJG2vKis72yGt_CQkvtREw4,163
|
|
46
|
-
airia/client/pipelines_config/async_pipelines_config.py,sha256=
|
|
47
|
-
airia/client/pipelines_config/base_pipelines_config.py,sha256=
|
|
48
|
-
airia/client/pipelines_config/sync_pipelines_config.py,sha256=
|
|
46
|
+
airia/client/pipelines_config/async_pipelines_config.py,sha256=EP5qrNyrXDyHa_xjkQDqAoc9_aAnyQ9fwS-9byhLdYs,9398
|
|
47
|
+
airia/client/pipelines_config/base_pipelines_config.py,sha256=VjMBmHn8N11ZK5Kvqfc72nWIgfQcAxy5MOu7_iloVjU,5163
|
|
48
|
+
airia/client/pipelines_config/sync_pipelines_config.py,sha256=TNZk2tCLT_UbbkbVImySESO7foXwohzcxFo72Wohgb8,9265
|
|
49
49
|
airia/client/project/__init__.py,sha256=GGEGfxtNzSO_BMAJ8Wfo8ZTq8BIdR6MHf6gSwhPv9mE,113
|
|
50
50
|
airia/client/project/async_project.py,sha256=OrIiqopKSXAhkYJi6yjoR-YYVUxzll1ldDJkJW1rIBM,4534
|
|
51
51
|
airia/client/project/base_project.py,sha256=4vP_dKGAt17mdzp3eW3ER8E0C0XMQ9P7JAEH2EH0imE,2432
|
|
@@ -54,10 +54,14 @@ airia/client/store/__init__.py,sha256=-rbtYQ8PTaFA6Fs2dm7Db2C3RDNvagaK3iE4PpLRcj
|
|
|
54
54
|
airia/client/store/async_store.py,sha256=wlYbK2AlTuJCrk3otdpO68W208166xyKpZymtuA5PyA,13557
|
|
55
55
|
airia/client/store/base_store.py,sha256=RUIGkKb2KiKZfzmDJIiPrLSes_VAnJA4xouIqxkEazI,8106
|
|
56
56
|
airia/client/store/sync_store.py,sha256=DNBhTckdoVnTqTVwFp_J42l-XkSHX3sCKVR7J4b79RU,12578
|
|
57
|
+
airia/client/tools/__init__.py,sha256=9bRyvbHD_AthBZA8YXMG79ZYoQjoGCl6mVnu5kVH1Jo,101
|
|
58
|
+
airia/client/tools/async_tools.py,sha256=Qnh0aDT-QM0P_Au3G-ehBL4iSxbMMf58TsbBBqzF1ow,11231
|
|
59
|
+
airia/client/tools/base_tools.py,sha256=YFTLESJBwvm5Z4YiRiadOQis9PH8Cwz6QC4scf1hazw,5913
|
|
60
|
+
airia/client/tools/sync_tools.py,sha256=mFWkHwbcHPf95UB58TDtAgbBvDbpXylEC1S5fRXFhAE,10618
|
|
57
61
|
airia/types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
58
62
|
airia/types/_api_version.py,sha256=Uzom6O2ZG92HN_Z2h-lTydmO2XYX9RVs4Yi4DJmXytE,255
|
|
59
63
|
airia/types/_request_data.py,sha256=q8t7KfO2WvgbPVYPvPWiwYb8LyP0kovlOgHFhZIU6ns,1278
|
|
60
|
-
airia/types/api/__init__.py,sha256=
|
|
64
|
+
airia/types/api/__init__.py,sha256=hAkcgB07FFdYUqGAP9-7CUFTBTYUOn6DFRH4wMo2PoM,150
|
|
61
65
|
airia/types/api/attachments/__init__.py,sha256=zFSCwsmPr05I7NJRG6MCWME3AKhBpL0MhgOBOaF7rok,78
|
|
62
66
|
airia/types/api/attachments/upload_file.py,sha256=XBCm1lZJAloFxmyp_3fbtuJ9Y28O-mbAfwy6D0EvTgQ,457
|
|
63
67
|
airia/types/api/conversations/__init__.py,sha256=W6GlNVZCAY5eViJOoPl1bY9_etRBWeUnYZJJt7WHtfI,269
|
|
@@ -84,11 +88,13 @@ airia/types/api/project/get_projects.py,sha256=Ot8mq6VnXrGXZs7FQ0UuRYSyuCeER7YeC
|
|
|
84
88
|
airia/types/api/store/__init__.py,sha256=BgViwV_SHE9cxtilPnA2xWRk6MkAbxYxansmGeZR3nw,341
|
|
85
89
|
airia/types/api/store/get_file.py,sha256=Li3CpWUktQruNeoKSTlHJPXzNMaysG_Zy-fXGji8zs8,6174
|
|
86
90
|
airia/types/api/store/get_files.py,sha256=v22zmOuTSFqzrS73L5JL_FgBeF5a5wutv1nK4IHAoW0,700
|
|
91
|
+
airia/types/api/tools/__init__.py,sha256=r4jcHknQcLIb3jVkGR5lcmuapHqln7-rot3EBCNmZtI,146
|
|
92
|
+
airia/types/api/tools/_tools.py,sha256=M8nVRqhTpdbIzPs2z4Pi11BFtOnbgtNk3_RnDyViM_M,8348
|
|
87
93
|
airia/types/sse/__init__.py,sha256=KWnNTfsQnthfrU128pUX6ounvSS7DvjC-Y21FE-OdMk,1863
|
|
88
94
|
airia/types/sse/sse_messages.py,sha256=asq9KG5plT2XSgQMz-Nqo0WcKlXvE8UT3E-WLhCegPk,30244
|
|
89
95
|
airia/utils/sse_parser.py,sha256=XCTkuaroYWaVQOgBq8VpbseQYSAVruF69AvKUwZQKTA,4251
|
|
90
|
-
airia-0.1.
|
|
91
|
-
airia-0.1.
|
|
92
|
-
airia-0.1.
|
|
93
|
-
airia-0.1.
|
|
94
|
-
airia-0.1.
|
|
96
|
+
airia-0.1.27.dist-info/licenses/LICENSE,sha256=R3ClUMMKPRItIcZ0svzyj2taZZnFYw568YDNzN9KQ1Q,1066
|
|
97
|
+
airia-0.1.27.dist-info/METADATA,sha256=F_fbsYlh5Av4u2zFd10Yx3CFTYYeplBWx2tIZK9cdU8,4506
|
|
98
|
+
airia-0.1.27.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
99
|
+
airia-0.1.27.dist-info/top_level.txt,sha256=qUQEKfs_hdOYTwjKj1JZbRhS5YeXDNaKQaVTrzabS6w,6
|
|
100
|
+
airia-0.1.27.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|