airia 0.1.23__py3-none-any.whl → 0.1.24__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/library/__init__.py +5 -0
- airia/client/library/async_library.py +100 -0
- airia/client/library/base_library.py +110 -0
- airia/client/library/sync_library.py +100 -0
- airia/client/pipeline_execution/async_pipeline_execution.py +207 -29
- airia/client/pipeline_execution/base_pipeline_execution.py +109 -0
- airia/client/pipeline_execution/sync_pipeline_execution.py +212 -33
- airia/client/sync_client.py +2 -0
- airia/types/api/library/__init__.py +11 -0
- airia/types/api/library/_library_models.py +208 -0
- airia/types/api/pipeline_execution/__init__.py +13 -3
- airia/types/api/pipeline_execution/_pipeline_execution.py +116 -17
- {airia-0.1.23.dist-info → airia-0.1.24.dist-info}/METADATA +1 -1
- {airia-0.1.23.dist-info → airia-0.1.24.dist-info}/RECORD +18 -12
- {airia-0.1.23.dist-info → airia-0.1.24.dist-info}/WHEEL +0 -0
- {airia-0.1.23.dist-info → airia-0.1.24.dist-info}/licenses/LICENSE +0 -0
- {airia-0.1.23.dist-info → airia-0.1.24.dist-info}/top_level.txt +0 -0
|
@@ -112,3 +112,112 @@ class BasePipelineExecution:
|
|
|
112
112
|
)
|
|
113
113
|
|
|
114
114
|
return request_data
|
|
115
|
+
|
|
116
|
+
def _pre_execute_temporary_assistant(
|
|
117
|
+
self,
|
|
118
|
+
model_parameters: Dict[str, Any],
|
|
119
|
+
user_input: str,
|
|
120
|
+
assistant_name: str = "",
|
|
121
|
+
prompt_parameters: Dict[str, Any] = {},
|
|
122
|
+
async_output: bool = False,
|
|
123
|
+
include_tools_response: bool = False,
|
|
124
|
+
save_history: bool = True,
|
|
125
|
+
voice_enabled: bool = False,
|
|
126
|
+
debug: bool = False,
|
|
127
|
+
additional_info: Optional[List[Any]] = None,
|
|
128
|
+
conversation_id: Optional[str] = None,
|
|
129
|
+
current_date_time: Optional[str] = None,
|
|
130
|
+
data_source_files: Optional[Dict[str, List[str]]] = None,
|
|
131
|
+
data_source_folders: Optional[Dict[str, List[str]]] = None,
|
|
132
|
+
data_store_parameters: Optional[Dict[str, Any]] = None,
|
|
133
|
+
external_user_id: Optional[str] = None,
|
|
134
|
+
files: Optional[List[str]] = None,
|
|
135
|
+
images: Optional[List[str]] = None,
|
|
136
|
+
in_memory_messages: Optional[List[Dict[str, Any]]] = None,
|
|
137
|
+
output_configuration: Optional[Dict[str, Any]] = None,
|
|
138
|
+
prompt_variables: Optional[Dict[str, Any]] = None,
|
|
139
|
+
user_id: Optional[str] = None,
|
|
140
|
+
user_input_id: Optional[str] = None,
|
|
141
|
+
variables: Optional[Dict[str, Any]] = None,
|
|
142
|
+
correlation_id: Optional[str] = None,
|
|
143
|
+
):
|
|
144
|
+
"""
|
|
145
|
+
Prepare request data for temporary assistant execution endpoint.
|
|
146
|
+
|
|
147
|
+
This internal method constructs the URL and payload for temporary assistant execution
|
|
148
|
+
requests, validating parameters and preparing all request components.
|
|
149
|
+
|
|
150
|
+
Args:
|
|
151
|
+
model_parameters: model parameters
|
|
152
|
+
user_input: Optional user input text
|
|
153
|
+
assistant_name: Name of the temporary assistant
|
|
154
|
+
prompt_parameters: Parameters for prompt configuration (required)
|
|
155
|
+
async_output: Whether to stream the response. Default is False
|
|
156
|
+
include_tools_response: Whether to return initial LLM tool result. Default is False
|
|
157
|
+
save_history: Whether to save input and output to conversation history. Default is True
|
|
158
|
+
voice_enabled: Whether voice output is enabled. Default is False
|
|
159
|
+
debug: Whether debug mode execution is enabled. Default is False
|
|
160
|
+
additional_info: Optional additional information array
|
|
161
|
+
conversation_id: Optional conversation identifier (GUID string or UUID)
|
|
162
|
+
current_date_time: Optional current date and time in ISO format
|
|
163
|
+
data_source_files: Optional dictionary mapping data source GUIDs to file GUID arrays
|
|
164
|
+
data_source_folders: Optional dictionary mapping data source GUIDs to folder GUID arrays
|
|
165
|
+
data_store_parameters: Optional DataStore parameters
|
|
166
|
+
external_user_id: Optional external user identifier
|
|
167
|
+
files: Optional list of file identifiers
|
|
168
|
+
images: Optional list of image identifiers
|
|
169
|
+
in_memory_messages: Optional list of in-memory messages
|
|
170
|
+
output_configuration: Optional output configuration
|
|
171
|
+
prompt_variables: Optional prompt variables dictionary
|
|
172
|
+
user_id: Optional user identifier (GUID string or UUID)
|
|
173
|
+
user_input_id: Optional unique identifier for user input (GUID string or UUID)
|
|
174
|
+
variables: Optional variables dictionary
|
|
175
|
+
correlation_id: Optional correlation ID for request tracing
|
|
176
|
+
|
|
177
|
+
Returns:
|
|
178
|
+
RequestData: Prepared request data for the temporary assistant execution endpoint
|
|
179
|
+
|
|
180
|
+
Raises:
|
|
181
|
+
ValueError: If required parameters are missing or invalid
|
|
182
|
+
"""
|
|
183
|
+
# Prepare the request URL
|
|
184
|
+
url = urljoin(
|
|
185
|
+
self._request_handler.base_url,
|
|
186
|
+
f"{ApiVersion.V2.value}/PipelineExecution/TemporaryAssistant",
|
|
187
|
+
)
|
|
188
|
+
|
|
189
|
+
# Create the request payload
|
|
190
|
+
payload = {
|
|
191
|
+
"additionalInfo": additional_info,
|
|
192
|
+
"assistantName": assistant_name,
|
|
193
|
+
"asyncOutput": async_output,
|
|
194
|
+
"conversationId": conversation_id,
|
|
195
|
+
"currentDateTime": current_date_time,
|
|
196
|
+
"dataSourceFiles": data_source_files,
|
|
197
|
+
"dataSourceFolders": data_source_folders,
|
|
198
|
+
"dataStoreParameters": data_store_parameters,
|
|
199
|
+
"debug": debug,
|
|
200
|
+
"externalUserId": external_user_id,
|
|
201
|
+
"files": files,
|
|
202
|
+
"images": images,
|
|
203
|
+
"includeToolsResponse": include_tools_response,
|
|
204
|
+
"inMemoryMessages": in_memory_messages,
|
|
205
|
+
"modelParameters": model_parameters,
|
|
206
|
+
"outputConfiguration": output_configuration,
|
|
207
|
+
"promptParameters": prompt_parameters,
|
|
208
|
+
"promptVariables": prompt_variables,
|
|
209
|
+
"saveHistory": save_history,
|
|
210
|
+
"userId": user_id,
|
|
211
|
+
"userInput": user_input,
|
|
212
|
+
"userInputId": user_input_id,
|
|
213
|
+
"variables": variables,
|
|
214
|
+
"voiceEnabled": voice_enabled,
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
request_data = self._request_handler.prepare_request(
|
|
218
|
+
url=url,
|
|
219
|
+
payload=payload,
|
|
220
|
+
correlation_id=correlation_id,
|
|
221
|
+
)
|
|
222
|
+
|
|
223
|
+
return request_data
|
|
@@ -2,9 +2,10 @@ from typing import Any, Dict, List, Literal, Optional, Union, overload
|
|
|
2
2
|
|
|
3
3
|
from ...types._api_version import ApiVersion
|
|
4
4
|
from ...types.api.pipeline_execution import (
|
|
5
|
-
PipelineExecutionDebugResponse,
|
|
6
5
|
PipelineExecutionResponse,
|
|
7
6
|
PipelineExecutionStreamedResponse,
|
|
7
|
+
TemporaryAssistantResponse,
|
|
8
|
+
TemporaryAssistantStreamedResponse,
|
|
8
9
|
)
|
|
9
10
|
from .._request_handler import RequestHandler
|
|
10
11
|
from .base_pipeline_execution import BasePipelineExecution
|
|
@@ -64,7 +65,7 @@ class PipelineExecution(BasePipelineExecution):
|
|
|
64
65
|
self,
|
|
65
66
|
pipeline_id: str,
|
|
66
67
|
user_input: str,
|
|
67
|
-
debug:
|
|
68
|
+
debug: bool = False,
|
|
68
69
|
user_id: Optional[str] = None,
|
|
69
70
|
conversation_id: Optional[str] = None,
|
|
70
71
|
async_output: Literal[False] = False,
|
|
@@ -82,29 +83,6 @@ class PipelineExecution(BasePipelineExecution):
|
|
|
82
83
|
correlation_id: Optional[str] = None,
|
|
83
84
|
) -> PipelineExecutionResponse: ...
|
|
84
85
|
|
|
85
|
-
@overload
|
|
86
|
-
def execute_pipeline(
|
|
87
|
-
self,
|
|
88
|
-
pipeline_id: str,
|
|
89
|
-
user_input: str,
|
|
90
|
-
debug: Literal[True] = True,
|
|
91
|
-
user_id: Optional[str] = None,
|
|
92
|
-
conversation_id: Optional[str] = None,
|
|
93
|
-
async_output: Literal[False] = False,
|
|
94
|
-
include_tools_response: bool = False,
|
|
95
|
-
images: Optional[List[str]] = None,
|
|
96
|
-
files: Optional[List[str]] = None,
|
|
97
|
-
data_source_folders: Optional[Dict[str, Any]] = None,
|
|
98
|
-
data_source_files: Optional[Dict[str, Any]] = None,
|
|
99
|
-
in_memory_messages: Optional[List[Dict[str, str]]] = None,
|
|
100
|
-
current_date_time: Optional[str] = None,
|
|
101
|
-
save_history: bool = True,
|
|
102
|
-
additional_info: Optional[List[Any]] = None,
|
|
103
|
-
prompt_variables: Optional[Dict[str, Any]] = None,
|
|
104
|
-
voice_enabled: bool = False,
|
|
105
|
-
correlation_id: Optional[str] = None,
|
|
106
|
-
) -> PipelineExecutionDebugResponse: ...
|
|
107
|
-
|
|
108
86
|
@overload
|
|
109
87
|
def execute_pipeline(
|
|
110
88
|
self,
|
|
@@ -148,11 +126,7 @@ class PipelineExecution(BasePipelineExecution):
|
|
|
148
126
|
prompt_variables: Optional[Dict[str, Any]] = None,
|
|
149
127
|
voice_enabled: bool = False,
|
|
150
128
|
correlation_id: Optional[str] = None,
|
|
151
|
-
) -> Union[
|
|
152
|
-
PipelineExecutionDebugResponse,
|
|
153
|
-
PipelineExecutionResponse,
|
|
154
|
-
PipelineExecutionStreamedResponse,
|
|
155
|
-
]:
|
|
129
|
+
) -> Union[PipelineExecutionResponse, PipelineExecutionStreamedResponse]:
|
|
156
130
|
"""
|
|
157
131
|
Execute a pipeline with the provided input.
|
|
158
132
|
|
|
@@ -233,8 +207,213 @@ class PipelineExecution(BasePipelineExecution):
|
|
|
233
207
|
)
|
|
234
208
|
|
|
235
209
|
if not async_output:
|
|
236
|
-
|
|
237
|
-
return PipelineExecutionResponse(**resp)
|
|
238
|
-
return PipelineExecutionDebugResponse(**resp)
|
|
210
|
+
return PipelineExecutionResponse(**resp)
|
|
239
211
|
|
|
240
212
|
return PipelineExecutionStreamedResponse(stream=resp)
|
|
213
|
+
|
|
214
|
+
@overload
|
|
215
|
+
def execute_temporary_assistant(
|
|
216
|
+
self,
|
|
217
|
+
model_parameters: Dict[str, Any],
|
|
218
|
+
user_input: str,
|
|
219
|
+
assistant_name: str = "",
|
|
220
|
+
prompt_parameters: Dict[str, Any] = {"prompt": ""},
|
|
221
|
+
async_output: Literal[False] = False,
|
|
222
|
+
include_tools_response: bool = False,
|
|
223
|
+
save_history: bool = True,
|
|
224
|
+
voice_enabled: bool = False,
|
|
225
|
+
debug: bool = False,
|
|
226
|
+
additional_info: Optional[List[Any]] = None,
|
|
227
|
+
conversation_id: Optional[str] = None,
|
|
228
|
+
current_date_time: Optional[str] = None,
|
|
229
|
+
data_source_files: Optional[Dict[str, List[str]]] = None,
|
|
230
|
+
data_source_folders: Optional[Dict[str, List[str]]] = None,
|
|
231
|
+
data_store_parameters: Optional[Dict[str, Any]] = None,
|
|
232
|
+
external_user_id: Optional[str] = None,
|
|
233
|
+
files: Optional[List[str]] = None,
|
|
234
|
+
images: Optional[List[str]] = None,
|
|
235
|
+
in_memory_messages: Optional[List[Dict[str, Any]]] = None,
|
|
236
|
+
output_configuration: Optional[Dict[str, Any]] = None,
|
|
237
|
+
prompt_variables: Optional[Dict[str, Any]] = None,
|
|
238
|
+
user_id: Optional[str] = None,
|
|
239
|
+
user_input_id: Optional[str] = None,
|
|
240
|
+
variables: Optional[Dict[str, Any]] = None,
|
|
241
|
+
correlation_id: Optional[str] = None,
|
|
242
|
+
) -> TemporaryAssistantResponse: ...
|
|
243
|
+
|
|
244
|
+
@overload
|
|
245
|
+
def execute_temporary_assistant(
|
|
246
|
+
self,
|
|
247
|
+
model_parameters: Dict[str, Any],
|
|
248
|
+
user_input: str,
|
|
249
|
+
assistant_name: str = "",
|
|
250
|
+
prompt_parameters: Dict[str, Any] = {"prompt": ""},
|
|
251
|
+
async_output: Literal[True] = True,
|
|
252
|
+
include_tools_response: bool = False,
|
|
253
|
+
save_history: bool = True,
|
|
254
|
+
voice_enabled: bool = False,
|
|
255
|
+
debug: bool = False,
|
|
256
|
+
additional_info: Optional[List[Any]] = None,
|
|
257
|
+
conversation_id: Optional[str] = None,
|
|
258
|
+
current_date_time: Optional[str] = None,
|
|
259
|
+
data_source_files: Optional[Dict[str, List[str]]] = None,
|
|
260
|
+
data_source_folders: Optional[Dict[str, List[str]]] = None,
|
|
261
|
+
data_store_parameters: Optional[Dict[str, Any]] = None,
|
|
262
|
+
external_user_id: Optional[str] = None,
|
|
263
|
+
files: Optional[List[str]] = None,
|
|
264
|
+
images: Optional[List[str]] = None,
|
|
265
|
+
in_memory_messages: Optional[List[Dict[str, Any]]] = None,
|
|
266
|
+
output_configuration: Optional[Dict[str, Any]] = None,
|
|
267
|
+
prompt_variables: Optional[Dict[str, Any]] = None,
|
|
268
|
+
user_id: Optional[str] = None,
|
|
269
|
+
user_input_id: Optional[str] = None,
|
|
270
|
+
variables: Optional[Dict[str, Any]] = None,
|
|
271
|
+
correlation_id: Optional[str] = None,
|
|
272
|
+
) -> TemporaryAssistantStreamedResponse: ...
|
|
273
|
+
|
|
274
|
+
def execute_temporary_assistant(
|
|
275
|
+
self,
|
|
276
|
+
model_parameters: Dict[str, Any],
|
|
277
|
+
user_input: str,
|
|
278
|
+
assistant_name: str = "",
|
|
279
|
+
prompt_parameters: Dict[str, Any] = {"prompt": ""},
|
|
280
|
+
async_output: bool = False,
|
|
281
|
+
include_tools_response: bool = False,
|
|
282
|
+
save_history: bool = True,
|
|
283
|
+
voice_enabled: bool = False,
|
|
284
|
+
debug: bool = False,
|
|
285
|
+
additional_info: Optional[List[Any]] = None,
|
|
286
|
+
conversation_id: Optional[str] = None,
|
|
287
|
+
current_date_time: Optional[str] = None,
|
|
288
|
+
data_source_files: Optional[Dict[str, List[str]]] = None,
|
|
289
|
+
data_source_folders: Optional[Dict[str, List[str]]] = None,
|
|
290
|
+
data_store_parameters: Optional[Dict[str, Any]] = None,
|
|
291
|
+
external_user_id: Optional[str] = None,
|
|
292
|
+
files: Optional[List[str]] = None,
|
|
293
|
+
images: Optional[List[str]] = None,
|
|
294
|
+
in_memory_messages: Optional[List[Dict[str, Any]]] = None,
|
|
295
|
+
output_configuration: Optional[Dict[str, Any]] = None,
|
|
296
|
+
prompt_variables: Optional[Dict[str, Any]] = None,
|
|
297
|
+
user_id: Optional[str] = None,
|
|
298
|
+
user_input_id: Optional[str] = None,
|
|
299
|
+
variables: Optional[Dict[str, Any]] = None,
|
|
300
|
+
correlation_id: Optional[str] = None,
|
|
301
|
+
) -> Union[
|
|
302
|
+
TemporaryAssistantResponse,
|
|
303
|
+
TemporaryAssistantStreamedResponse,
|
|
304
|
+
]:
|
|
305
|
+
"""
|
|
306
|
+
Execute a temporary assistant with the provided parameters.
|
|
307
|
+
|
|
308
|
+
This method creates and executes a temporary AI assistant with custom configuration,
|
|
309
|
+
allowing for flexible assistant behavior without creating a persistent pipeline.
|
|
310
|
+
|
|
311
|
+
Args:
|
|
312
|
+
model_parameters: Model parameters (required). Must include libraryModelId,
|
|
313
|
+
projectModelId, modelIdentifierType, and modelIsAvailableinProject
|
|
314
|
+
user_input: User input text (required)
|
|
315
|
+
assistant_name: Name of the temporary assistant. Default is ""
|
|
316
|
+
prompt_parameters: Parameters for prompt configuration. Default is {"prompt": ""}
|
|
317
|
+
async_output: Whether to stream the response. Default is False
|
|
318
|
+
include_tools_response: Whether to return initial LLM tool result. Default is False
|
|
319
|
+
save_history: Whether to save input and output to conversation history. Default is True
|
|
320
|
+
voice_enabled: Whether voice output is enabled. Default is False
|
|
321
|
+
debug: Whether debug mode execution is enabled. Default is False
|
|
322
|
+
additional_info: Optional additional information array
|
|
323
|
+
conversation_id: Optional conversation identifier (GUID string or UUID)
|
|
324
|
+
current_date_time: Optional current date and time in ISO format
|
|
325
|
+
data_source_files: Optional dictionary mapping data source GUIDs to file GUID arrays
|
|
326
|
+
data_source_folders: Optional dictionary mapping data source GUIDs to folder GUID arrays
|
|
327
|
+
data_store_parameters: Optional DataStore parameters
|
|
328
|
+
external_user_id: Optional external user identifier
|
|
329
|
+
files: Optional list of file identifiers
|
|
330
|
+
images: Optional list of image identifiers
|
|
331
|
+
in_memory_messages: Optional list of in-memory messages
|
|
332
|
+
output_configuration: Optional output configuration
|
|
333
|
+
prompt_variables: Optional prompt variables dictionary
|
|
334
|
+
user_id: Optional user identifier (GUID string or UUID)
|
|
335
|
+
user_input_id: Optional unique identifier for user input (GUID string or UUID)
|
|
336
|
+
variables: Optional variables dictionary
|
|
337
|
+
correlation_id: Optional correlation ID for request tracing. If not provided,
|
|
338
|
+
one will be generated automatically.
|
|
339
|
+
|
|
340
|
+
Returns:
|
|
341
|
+
Response containing the result of the temporary assistant execution.
|
|
342
|
+
|
|
343
|
+
Raises:
|
|
344
|
+
AiriaAPIError: If the API request fails with details about the error.
|
|
345
|
+
requests.RequestException: For other request-related errors.
|
|
346
|
+
ValueError: If required parameters are missing or invalid.
|
|
347
|
+
|
|
348
|
+
Example:
|
|
349
|
+
```python
|
|
350
|
+
client = AiriaClient(api_key="your_api_key")
|
|
351
|
+
response = client.pipeline_execution.execute_temporary_assistant(
|
|
352
|
+
model_parameters={
|
|
353
|
+
"libraryModelId": "library-model-id",
|
|
354
|
+
"projectModelId": None,
|
|
355
|
+
"modelIdentifierType": "Library",
|
|
356
|
+
"modelIsAvailableinProject": True,
|
|
357
|
+
},
|
|
358
|
+
user_input="say double bubble bath ten times fast",
|
|
359
|
+
)
|
|
360
|
+
print(response.result)
|
|
361
|
+
```
|
|
362
|
+
"""
|
|
363
|
+
# Validate required parameters
|
|
364
|
+
if not user_input:
|
|
365
|
+
raise ValueError("user_input cannot be empty")
|
|
366
|
+
|
|
367
|
+
if not model_parameters:
|
|
368
|
+
raise ValueError("model_parameters cannot be empty")
|
|
369
|
+
|
|
370
|
+
# Handle file and image uploads (local files are uploaded, URLs are passed through)
|
|
371
|
+
image_urls = None
|
|
372
|
+
file_urls = None
|
|
373
|
+
|
|
374
|
+
if images or files:
|
|
375
|
+
file_urls, image_urls = self._upload_files(files or [], images or [])
|
|
376
|
+
|
|
377
|
+
# Convert UUID objects to strings for API compatibility
|
|
378
|
+
conversation_id_str = str(conversation_id) if conversation_id else conversation_id
|
|
379
|
+
user_id_str = str(user_id) if user_id else user_id
|
|
380
|
+
user_input_id_str = str(user_input_id) if user_input_id else user_input_id
|
|
381
|
+
|
|
382
|
+
request_data = self._pre_execute_temporary_assistant(
|
|
383
|
+
model_parameters=model_parameters,
|
|
384
|
+
user_input=user_input,
|
|
385
|
+
assistant_name=assistant_name,
|
|
386
|
+
prompt_parameters=prompt_parameters,
|
|
387
|
+
async_output=async_output,
|
|
388
|
+
include_tools_response=include_tools_response,
|
|
389
|
+
save_history=save_history,
|
|
390
|
+
voice_enabled=voice_enabled,
|
|
391
|
+
debug=debug,
|
|
392
|
+
additional_info=additional_info,
|
|
393
|
+
conversation_id=conversation_id_str,
|
|
394
|
+
current_date_time=current_date_time,
|
|
395
|
+
data_source_files=data_source_files,
|
|
396
|
+
data_source_folders=data_source_folders,
|
|
397
|
+
data_store_parameters=data_store_parameters,
|
|
398
|
+
external_user_id=external_user_id,
|
|
399
|
+
files=file_urls,
|
|
400
|
+
images=image_urls,
|
|
401
|
+
in_memory_messages=in_memory_messages,
|
|
402
|
+
output_configuration=output_configuration,
|
|
403
|
+
prompt_variables=prompt_variables,
|
|
404
|
+
user_id=user_id_str,
|
|
405
|
+
user_input_id=user_input_id_str,
|
|
406
|
+
variables=variables,
|
|
407
|
+
correlation_id=correlation_id,
|
|
408
|
+
)
|
|
409
|
+
|
|
410
|
+
resp = (
|
|
411
|
+
self._request_handler.make_request_stream("POST", request_data)
|
|
412
|
+
if async_output
|
|
413
|
+
else self._request_handler.make_request("POST", request_data)
|
|
414
|
+
)
|
|
415
|
+
|
|
416
|
+
if async_output:
|
|
417
|
+
return TemporaryAssistantStreamedResponse(stream=resp)
|
|
418
|
+
|
|
419
|
+
return TemporaryAssistantResponse(**resp)
|
airia/client/sync_client.py
CHANGED
|
@@ -14,6 +14,7 @@ from .base_client import AiriaBaseClient
|
|
|
14
14
|
from .conversations import Conversations
|
|
15
15
|
from .data_vector_search import DataVectorSearch
|
|
16
16
|
from .deployments import Deployments
|
|
17
|
+
from .library import Library
|
|
17
18
|
from .pipeline_execution import PipelineExecution
|
|
18
19
|
from .pipelines_config import PipelinesConfig
|
|
19
20
|
from .project import Project
|
|
@@ -68,6 +69,7 @@ class AiriaClient(AiriaBaseClient):
|
|
|
68
69
|
self.store = Store(self._request_handler)
|
|
69
70
|
self.deployments = Deployments(self._request_handler)
|
|
70
71
|
self.data_vector_search = DataVectorSearch(self._request_handler)
|
|
72
|
+
self.library = Library(self._request_handler)
|
|
71
73
|
|
|
72
74
|
@classmethod
|
|
73
75
|
def with_openai_gateway(
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
from typing import List, Optional
|
|
3
|
+
from uuid import UUID
|
|
4
|
+
|
|
5
|
+
from pydantic import BaseModel, Field
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class TokenPriceConversion(BaseModel):
|
|
9
|
+
"""
|
|
10
|
+
Common conversion values for token prices.
|
|
11
|
+
|
|
12
|
+
Attributes:
|
|
13
|
+
input_token_price_1k: Cost per 1,000 input tokens in USD. Pre-calculated for convenience when comparing pricing across models.
|
|
14
|
+
output_token_price_1k: Cost per 1,000 output tokens in USD. Pre-calculated for convenience when comparing pricing across models.
|
|
15
|
+
input_token_price_1m: Cost per 1 million input tokens in USD. Useful for large-scale usage estimation and enterprise planning.
|
|
16
|
+
output_token_price_1m: Cost per 1 million output tokens in USD. Useful for large-scale usage estimation and enterprise planning.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
input_token_price_1k: Optional[str] = Field(
|
|
20
|
+
None, alias="inputTokenPrice1K", description="Gets or sets the input token cost."
|
|
21
|
+
)
|
|
22
|
+
output_token_price_1k: Optional[str] = Field(
|
|
23
|
+
None,
|
|
24
|
+
alias="outputTokenPrice1K",
|
|
25
|
+
description="Gets or sets the output token cost.",
|
|
26
|
+
)
|
|
27
|
+
input_token_price_1m: Optional[str] = Field(
|
|
28
|
+
None,
|
|
29
|
+
alias="inputTokenPrice1M",
|
|
30
|
+
description="Gets or sets the input token cost per million tokens.",
|
|
31
|
+
)
|
|
32
|
+
output_token_price_1m: Optional[str] = Field(
|
|
33
|
+
None,
|
|
34
|
+
alias="outputTokenPrice1M",
|
|
35
|
+
description="Gets or sets the output token cost per million tokens.",
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class LibraryModel(BaseModel):
|
|
40
|
+
"""
|
|
41
|
+
Models response for the library.
|
|
42
|
+
|
|
43
|
+
Attributes:
|
|
44
|
+
credentials_id: UUID of the required credentials to use this model. None if no specific credentials needed.
|
|
45
|
+
id: Unique identifier for the library model. Used in API calls to specify which model to use.
|
|
46
|
+
category: Model category (e.g., "Multimodal", "NLP", "ComputerVision"). Helps classify model capabilities.
|
|
47
|
+
description: Detailed description of the model's purpose, capabilities, and use cases.
|
|
48
|
+
downloads: Number of times this model has been downloaded. Indicates popularity and usage.
|
|
49
|
+
type: Input type the model accepts (e.g., "text", "image", "audio", "video").
|
|
50
|
+
languages: List of languages the model supports. Important for international applications.
|
|
51
|
+
license_type: License under which the model is distributed (e.g., "MIT", "Apache20", "Commercial").
|
|
52
|
+
name: Internal name of the model. Used for identification and API references.
|
|
53
|
+
display_name: Human-readable name for display in UIs. More user-friendly than internal name.
|
|
54
|
+
price: General pricing information as a string. May include currency and billing details.
|
|
55
|
+
input_token_price: Cost per input token. Used for precise cost calculation.
|
|
56
|
+
output_token_price: Cost per output token. Used for precise cost calculation.
|
|
57
|
+
price_type: Type of pricing model (e.g., "AITextOutputModelPrice", "AIImageOutputModelPrice").
|
|
58
|
+
prompt_id: UUID of associated prompt template if applicable.
|
|
59
|
+
url: URL to model documentation, homepage, or additional information.
|
|
60
|
+
provider: Company or organization that provides the model (e.g., "OpenAI", "Anthropic", "Google").
|
|
61
|
+
rating: Average user rating of the model (typically 1-5 scale). Indicates user satisfaction.
|
|
62
|
+
tags: List of descriptive tags for categorization and search. Helps discovery and filtering.
|
|
63
|
+
available: Whether the model is currently available for use. False if deprecated or temporarily unavailable.
|
|
64
|
+
token_price_conversion: Pre-calculated pricing conversions for different token quantities.
|
|
65
|
+
allow_airia_credentials: Whether the model can be used with Airia-managed credentials.
|
|
66
|
+
allow_byok_credentials: Whether the model supports Bring Your Own Key (BYOK) credentials.
|
|
67
|
+
author: Person or organization who created or maintains the model.
|
|
68
|
+
license_link: Direct URL to the full license text or terms of service.
|
|
69
|
+
released_at: Date when the model was first released or made available.
|
|
70
|
+
deprecated_at: Date when the model was deprecated. None if still active.
|
|
71
|
+
is_open_source: Whether the model is open source. Important for compliance and transparency.
|
|
72
|
+
chat_specialized: Whether the model is optimized for conversational/chat use cases.
|
|
73
|
+
industry: Primary industry or domain the model is designed for.
|
|
74
|
+
commercial_use: Whether the model can be used for commercial purposes.
|
|
75
|
+
certifications: List of compliance certifications (e.g., "SOC2", "HIPAA", "ISO 27001").
|
|
76
|
+
has_tool_support: Whether the model supports tool calling/function calling capabilities.
|
|
77
|
+
has_stream_support: Whether the model supports streaming responses for real-time output.
|
|
78
|
+
context_window: Maximum number of tokens the model can process in a single request.
|
|
79
|
+
max_output_tokens: Maximum number of tokens the model can generate in a single response.
|
|
80
|
+
state: Current operational state of the model (e.g., "active", "deprecated", "beta").
|
|
81
|
+
"""
|
|
82
|
+
|
|
83
|
+
credentials_id: Optional[UUID] = Field(
|
|
84
|
+
None,
|
|
85
|
+
alias="credentialsId",
|
|
86
|
+
description="Gets or sets the required Credentials ID for the model.",
|
|
87
|
+
)
|
|
88
|
+
id: Optional[UUID] = Field(
|
|
89
|
+
None, description="Gets or sets the library model identifier."
|
|
90
|
+
)
|
|
91
|
+
category: Optional[str] = Field(None, description="Gets or sets the category.")
|
|
92
|
+
description: Optional[str] = Field(
|
|
93
|
+
None, description="Gets or sets the description of the library model."
|
|
94
|
+
)
|
|
95
|
+
downloads: int = Field(
|
|
96
|
+
description="Gets or sets the number of times this model has been downloaded."
|
|
97
|
+
)
|
|
98
|
+
type: str = Field(description="Gets the input type of the model.")
|
|
99
|
+
languages: List[str] = Field(
|
|
100
|
+
description="Gets or sets the languages this model supports."
|
|
101
|
+
)
|
|
102
|
+
license_type: Optional[str] = Field(
|
|
103
|
+
None, alias="licenseType", description="Gets or sets the license of this model."
|
|
104
|
+
)
|
|
105
|
+
name: Optional[str] = Field(
|
|
106
|
+
None,
|
|
107
|
+
description="Gets the name of the library model.",
|
|
108
|
+
examples=["CHATGPT-4o, CHATGPT-4Turbo."],
|
|
109
|
+
)
|
|
110
|
+
display_name: Optional[str] = Field(
|
|
111
|
+
None, alias="displayName", description="Gets the display name of the library model."
|
|
112
|
+
)
|
|
113
|
+
price: str = Field(description="Gets or sets the price.")
|
|
114
|
+
input_token_price: Optional[str] = Field(
|
|
115
|
+
None, alias="inputTokenPrice", description="Gets or sets the input token cost."
|
|
116
|
+
)
|
|
117
|
+
output_token_price: Optional[str] = Field(
|
|
118
|
+
None, alias="outputTokenPrice", description="Gets or sets the output token cost."
|
|
119
|
+
)
|
|
120
|
+
price_type: str = Field(alias="priceType", description="Gets the price type.")
|
|
121
|
+
prompt_id: Optional[UUID] = Field(
|
|
122
|
+
None, alias="promptId", description="Gets the PromptId."
|
|
123
|
+
)
|
|
124
|
+
url: Optional[str] = Field(None, description="Gets the Url.")
|
|
125
|
+
provider: Optional[str] = Field(
|
|
126
|
+
None, description="Gets the provider of the model."
|
|
127
|
+
)
|
|
128
|
+
rating: int = Field(description="Gets or sets the average user rating of the model.")
|
|
129
|
+
tags: List[str] = Field(description="Gets or sets the related tags.")
|
|
130
|
+
available: bool = Field(
|
|
131
|
+
description="Gets or sets a value indicating whether the model is available."
|
|
132
|
+
)
|
|
133
|
+
token_price_conversion: Optional[TokenPriceConversion] = Field(
|
|
134
|
+
None,
|
|
135
|
+
alias="tokenPriceConversion",
|
|
136
|
+
description="Gets or sets common token price conversion values.",
|
|
137
|
+
)
|
|
138
|
+
allow_airia_credentials: bool = Field(
|
|
139
|
+
alias="allowAiriaCredentials",
|
|
140
|
+
description="Gets or sets a value indicating whether the model is allowed to use the Airia Credentials.",
|
|
141
|
+
)
|
|
142
|
+
allow_byok_credentials: bool = Field(
|
|
143
|
+
alias="allowBYOKCredentials",
|
|
144
|
+
description="Gets or sets a value indicating whether the model is allowed to use BYOK Credentials.",
|
|
145
|
+
)
|
|
146
|
+
author: str = Field(description="Gets or sets the author of the model.")
|
|
147
|
+
license_link: Optional[str] = Field(
|
|
148
|
+
None,
|
|
149
|
+
alias="licenseLink",
|
|
150
|
+
description="Gets or sets a direct link to the license for the model.",
|
|
151
|
+
)
|
|
152
|
+
released_at: Optional[datetime] = Field(
|
|
153
|
+
None, alias="releasedAt", description="Gets or sets the date the model was released."
|
|
154
|
+
)
|
|
155
|
+
deprecated_at: Optional[datetime] = Field(
|
|
156
|
+
None,
|
|
157
|
+
alias="deprecatedAt",
|
|
158
|
+
description="Gets or sets the date the model was deprecated.",
|
|
159
|
+
)
|
|
160
|
+
is_open_source: bool = Field(
|
|
161
|
+
alias="isOpenSource",
|
|
162
|
+
description="Gets or sets a value indicating whether the model is open source.",
|
|
163
|
+
)
|
|
164
|
+
chat_specialized: bool = Field(
|
|
165
|
+
alias="chatSpecialized",
|
|
166
|
+
description="Gets or sets a value indicating whether the model is chat specialized.",
|
|
167
|
+
)
|
|
168
|
+
industry: str = Field(description="Gets or sets the industry.")
|
|
169
|
+
commercial_use: bool = Field(
|
|
170
|
+
alias="commercialUse",
|
|
171
|
+
description="Gets or sets a value indicating whether the model is for commercial use.",
|
|
172
|
+
)
|
|
173
|
+
certifications: Optional[List[str]] = Field(
|
|
174
|
+
None, description="Gets or sets the certifications."
|
|
175
|
+
)
|
|
176
|
+
has_tool_support: bool = Field(
|
|
177
|
+
alias="hasToolSupport",
|
|
178
|
+
description="Gets a value indicating whether the model has tool support.",
|
|
179
|
+
)
|
|
180
|
+
has_stream_support: bool = Field(
|
|
181
|
+
alias="hasStreamSupport",
|
|
182
|
+
description="Gets a value indicating whether the model supports response streaming.",
|
|
183
|
+
)
|
|
184
|
+
context_window: int = Field(
|
|
185
|
+
alias="contextWindow", description="Gets the context window size for this model."
|
|
186
|
+
)
|
|
187
|
+
max_output_tokens: int = Field(
|
|
188
|
+
alias="maxOutputTokens",
|
|
189
|
+
description="Gets the maximum number of tokens that can be generated by the model.",
|
|
190
|
+
)
|
|
191
|
+
state: str = Field(description="Gets or sets the state of the model.")
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
class GetLibraryModelsResponse(BaseModel):
|
|
195
|
+
"""
|
|
196
|
+
A response for getting library models.
|
|
197
|
+
|
|
198
|
+
Attributes:
|
|
199
|
+
models: List of LibraryModel objects containing detailed information about each available model.
|
|
200
|
+
total_count: Total number of models matching the query criteria, useful for pagination calculations.
|
|
201
|
+
"""
|
|
202
|
+
|
|
203
|
+
models: List[LibraryModel] = Field(
|
|
204
|
+
description="Gets or sets Models that the library allows provisioning."
|
|
205
|
+
)
|
|
206
|
+
total_count: int = Field(
|
|
207
|
+
alias="totalCount", description="Gets or sets the total count of models in the library."
|
|
208
|
+
)
|
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
from ._pipeline_execution import (
|
|
2
|
+
AgentBaseStepResult,
|
|
2
3
|
PipelineExecutionAsyncStreamedResponse,
|
|
3
|
-
PipelineExecutionDebugResponse,
|
|
4
4
|
PipelineExecutionResponse,
|
|
5
5
|
PipelineExecutionStreamedResponse,
|
|
6
|
+
PipelineStepResult,
|
|
7
|
+
TemporaryAssistantAsyncStreamedResponse,
|
|
8
|
+
TemporaryAssistantResponse,
|
|
9
|
+
TemporaryAssistantStreamedResponse,
|
|
10
|
+
TimeTrackingData,
|
|
6
11
|
)
|
|
7
12
|
|
|
8
13
|
__all__ = [
|
|
9
|
-
"
|
|
14
|
+
"AgentBaseStepResult",
|
|
15
|
+
"PipelineExecutionAsyncStreamedResponse",
|
|
10
16
|
"PipelineExecutionResponse",
|
|
11
17
|
"PipelineExecutionStreamedResponse",
|
|
12
|
-
"
|
|
18
|
+
"PipelineStepResult",
|
|
19
|
+
"TemporaryAssistantAsyncStreamedResponse",
|
|
20
|
+
"TemporaryAssistantResponse",
|
|
21
|
+
"TemporaryAssistantStreamedResponse",
|
|
22
|
+
"TimeTrackingData",
|
|
13
23
|
]
|