airia 0.1.37__tar.gz → 0.1.39__tar.gz
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-0.1.37 → airia-0.1.39}/PKG-INFO +1 -1
- {airia-0.1.37 → airia-0.1.39}/airia/client/async_client.py +2 -0
- airia-0.1.39/airia/client/attachments/async_attachments.py +105 -0
- {airia-0.1.37 → airia-0.1.39}/airia/client/attachments/base_attachments.py +39 -0
- airia-0.1.39/airia/client/attachments/sync_attachments.py +103 -0
- airia-0.1.39/airia/client/data_store/__init__.py +4 -0
- airia-0.1.39/airia/client/data_store/async_data_store.py +15 -0
- airia-0.1.39/airia/client/data_store/store/async_store.py +114 -0
- airia-0.1.39/airia/client/data_store/store/base_store.py +73 -0
- airia-0.1.39/airia/client/data_store/store/sync_store.py +115 -0
- airia-0.1.39/airia/client/data_store/sync_data_store.py +15 -0
- {airia-0.1.37 → airia-0.1.39}/airia/client/data_vector_search/base_data_vector_search.py +3 -1
- {airia-0.1.37 → airia-0.1.39}/airia/client/pipelines_config/async_pipelines_config.py +6 -2
- {airia-0.1.37 → airia-0.1.39}/airia/client/pipelines_config/base_pipelines_config.py +3 -1
- {airia-0.1.37 → airia-0.1.39}/airia/client/pipelines_config/sync_pipelines_config.py +3 -1
- airia-0.1.39/airia/client/store/__init__.py +4 -0
- {airia-0.1.37 → airia-0.1.39}/airia/client/sync_client.py +2 -0
- {airia-0.1.37 → airia-0.1.39}/airia/types/api/__init__.py +1 -0
- airia-0.1.39/airia/types/api/attachments/__init__.py +4 -0
- airia-0.1.39/airia/types/api/attachments/get_file_url.py +19 -0
- airia-0.1.39/airia/types/api/data_store/__init__.py +3 -0
- airia-0.1.39/airia/types/api/data_store/store/__init__.py +11 -0
- airia-0.1.39/airia/types/api/data_store/store/_get_files_and_folders.py +84 -0
- {airia-0.1.37 → airia-0.1.39}/airia/types/api/library/__init__.py +1 -1
- {airia-0.1.37 → airia-0.1.39}/airia/types/api/models/list_models.py +3 -1
- {airia-0.1.37 → airia-0.1.39}/airia/types/api/pipelines_config/export_pipeline_definition.py +42 -36
- {airia-0.1.37 → airia-0.1.39}/airia/types/api/tools/_tools.py +3 -1
- {airia-0.1.37 → airia-0.1.39}/airia.egg-info/PKG-INFO +1 -1
- {airia-0.1.37 → airia-0.1.39}/airia.egg-info/SOURCES.txt +11 -0
- {airia-0.1.37 → airia-0.1.39}/pyproject.toml +1 -1
- airia-0.1.37/airia/client/attachments/async_attachments.py +0 -52
- airia-0.1.37/airia/client/attachments/sync_attachments.py +0 -52
- airia-0.1.37/airia/types/api/attachments/__init__.py +0 -3
- {airia-0.1.37 → airia-0.1.39}/LICENSE +0 -0
- {airia-0.1.37 → airia-0.1.39}/README.md +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/__init__.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/client/__init__.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/client/_request_handler/__init__.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/client/_request_handler/async_request_handler.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/client/_request_handler/base_request_handler.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/client/_request_handler/sync_request_handler.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/client/attachments/__init__.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/client/base_client.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/client/conversations/__init__.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/client/conversations/async_conversations.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/client/conversations/base_conversations.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/client/conversations/sync_conversations.py +0 -0
- {airia-0.1.37/airia/client → airia-0.1.39/airia/client/data_store}/store/__init__.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/client/data_vector_search/__init__.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/client/data_vector_search/async_data_vector_search.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/client/data_vector_search/sync_data_vector_search.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/client/deployments/__init__.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/client/deployments/async_deployments.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/client/deployments/base_deployments.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/client/deployments/sync_deployments.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/client/library/__init__.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/client/library/async_library.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/client/library/base_library.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/client/library/sync_library.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/client/models/__init__.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/client/models/async_models.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/client/models/base_models.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/client/models/sync_models.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/client/pipeline_execution/__init__.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/client/pipeline_execution/async_pipeline_execution.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/client/pipeline_execution/base_pipeline_execution.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/client/pipeline_execution/sync_pipeline_execution.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/client/pipeline_import/__init__.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/client/pipeline_import/async_pipeline_import.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/client/pipeline_import/base_pipeline_import.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/client/pipeline_import/sync_pipeline_import.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/client/pipelines_config/__init__.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/client/project/__init__.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/client/project/async_project.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/client/project/base_project.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/client/project/sync_project.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/client/store/async_store.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/client/store/base_store.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/client/store/sync_store.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/client/tools/__init__.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/client/tools/async_tools.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/client/tools/base_tools.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/client/tools/sync_tools.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/constants.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/exceptions.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/logs.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/types/__init__.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/types/_api_version.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/types/_request_data.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/types/_structured_output.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/types/api/attachments/upload_file.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/types/api/conversations/__init__.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/types/api/conversations/_conversations.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/types/api/data_vector_search/__init__.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/types/api/data_vector_search/get_file_chunks.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/types/api/deployments/__init__.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/types/api/deployments/get_deployment.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/types/api/deployments/get_deployments.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/types/api/library/_library_models.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/types/api/models/__init__.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/types/api/pipeline_execution/__init__.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/types/api/pipeline_execution/_pipeline_execution.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/types/api/pipeline_execution/get_pipeline_execution.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/types/api/pipeline_import/__init__.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/types/api/pipeline_import/create_agent_from_pipeline_definition.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/types/api/pipelines_config/__init__.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/types/api/pipelines_config/get_pipeline_config.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/types/api/pipelines_config/get_pipelines_config.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/types/api/project/__init__.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/types/api/project/get_projects.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/types/api/store/__init__.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/types/api/store/get_file.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/types/api/store/get_files.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/types/api/tools/__init__.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/types/sse/__init__.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/types/sse/sse_messages.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia/utils/sse_parser.py +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia.egg-info/dependency_links.txt +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia.egg-info/requires.txt +0 -0
- {airia-0.1.37 → airia-0.1.39}/airia.egg-info/top_level.txt +0 -0
- {airia-0.1.37 → airia-0.1.39}/setup.cfg +0 -0
|
@@ -11,6 +11,7 @@ from ._request_handler import AsyncRequestHandler
|
|
|
11
11
|
from .attachments import AsyncAttachments
|
|
12
12
|
from .base_client import AiriaBaseClient
|
|
13
13
|
from .conversations import AsyncConversations
|
|
14
|
+
from .data_store import AsyncDataStore
|
|
14
15
|
from .data_vector_search import AsyncDataVectorSearch
|
|
15
16
|
from .deployments import AsyncDeployments
|
|
16
17
|
from .library import AsyncLibrary
|
|
@@ -70,6 +71,7 @@ class AiriaAsyncClient(AiriaBaseClient):
|
|
|
70
71
|
self.project = AsyncProject(self._request_handler)
|
|
71
72
|
self.conversations = AsyncConversations(self._request_handler)
|
|
72
73
|
self.store = AsyncStore(self._request_handler)
|
|
74
|
+
self.data_store = AsyncDataStore(self._request_handler)
|
|
73
75
|
self.deployments = AsyncDeployments(self._request_handler)
|
|
74
76
|
self.data_vector_search = AsyncDataVectorSearch(self._request_handler)
|
|
75
77
|
self.library = AsyncLibrary(self._request_handler)
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
from ...types._api_version import ApiVersion
|
|
4
|
+
from ...types.api.attachments import AttachmentResponse, GetFileUrlResponse
|
|
5
|
+
from .._request_handler import AsyncRequestHandler
|
|
6
|
+
from .base_attachments import BaseAttachments
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class AsyncAttachments(BaseAttachments):
|
|
10
|
+
def __init__(self, request_handler: AsyncRequestHandler):
|
|
11
|
+
super().__init__(request_handler)
|
|
12
|
+
|
|
13
|
+
async def upload_file(
|
|
14
|
+
self,
|
|
15
|
+
file_path: str,
|
|
16
|
+
correlation_id: Optional[str] = None,
|
|
17
|
+
) -> AttachmentResponse:
|
|
18
|
+
"""
|
|
19
|
+
Upload a file and get attachment information.
|
|
20
|
+
|
|
21
|
+
Args:
|
|
22
|
+
file_path: Path to the file on disk
|
|
23
|
+
correlation_id: Optional correlation ID for request tracing. If not provided,
|
|
24
|
+
one will be generated automatically.
|
|
25
|
+
|
|
26
|
+
Returns:
|
|
27
|
+
AttachmentResponse: Response containing the attachment ID and URL.
|
|
28
|
+
|
|
29
|
+
Raises:
|
|
30
|
+
AiriaAPIError: If the API request fails with details about the error.
|
|
31
|
+
aiohttp.ClientError: For other request-related errors.
|
|
32
|
+
|
|
33
|
+
Example:
|
|
34
|
+
```python
|
|
35
|
+
async_client = AiriaAsyncClient(api_key="your_api_key")
|
|
36
|
+
|
|
37
|
+
# Upload a file
|
|
38
|
+
response = await async_client.attachments.upload_file(
|
|
39
|
+
file_path="example.jpg"
|
|
40
|
+
)
|
|
41
|
+
print(f"Uploaded attachment ID: {response.id}")
|
|
42
|
+
print(f"Attachment URL: {response.image_url}")
|
|
43
|
+
```
|
|
44
|
+
"""
|
|
45
|
+
request_data = self._pre_upload_file(
|
|
46
|
+
file_path=file_path,
|
|
47
|
+
correlation_id=correlation_id,
|
|
48
|
+
api_version=ApiVersion.V1.value,
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
resp = await self._request_handler.make_request_multipart("POST", request_data)
|
|
52
|
+
return AttachmentResponse(**resp)
|
|
53
|
+
|
|
54
|
+
async def get_file_url(
|
|
55
|
+
self,
|
|
56
|
+
file_id: str,
|
|
57
|
+
correlation_id: Optional[str] = None,
|
|
58
|
+
) -> GetFileUrlResponse:
|
|
59
|
+
"""
|
|
60
|
+
Get a refreshed signed URL for an existing attachment.
|
|
61
|
+
|
|
62
|
+
This method retrieves a new time-limited signed URL for accessing
|
|
63
|
+
an attachment that was previously uploaded. Useful when the original
|
|
64
|
+
signed URL has expired or is about to expire.
|
|
65
|
+
|
|
66
|
+
Args:
|
|
67
|
+
file_id: The unique identifier of the attachment
|
|
68
|
+
correlation_id: Optional correlation ID for request tracing. If not provided,
|
|
69
|
+
one will be generated automatically.
|
|
70
|
+
|
|
71
|
+
Returns:
|
|
72
|
+
GetFileUrlResponse: Response containing the attachment ID and refreshed signed URL.
|
|
73
|
+
|
|
74
|
+
Raises:
|
|
75
|
+
AiriaAPIError: If the API request fails with details about the error.
|
|
76
|
+
aiohttp.ClientError: For other request-related errors.
|
|
77
|
+
|
|
78
|
+
Example:
|
|
79
|
+
```python
|
|
80
|
+
async_client = AiriaAsyncClient(api_key="your_api_key")
|
|
81
|
+
|
|
82
|
+
# First, upload a file
|
|
83
|
+
upload_response = await async_client.attachments.upload_file(
|
|
84
|
+
file_path="example.jpg"
|
|
85
|
+
)
|
|
86
|
+
file_id = upload_response.id
|
|
87
|
+
|
|
88
|
+
# Later, get a refreshed URL for the same file
|
|
89
|
+
url_response = await async_client.attachments.get_file_url(
|
|
90
|
+
file_id=file_id
|
|
91
|
+
)
|
|
92
|
+
print(f"Attachment ID: {url_response.id}")
|
|
93
|
+
print(f"Refreshed URL: {url_response.signed_url}")
|
|
94
|
+
```
|
|
95
|
+
"""
|
|
96
|
+
request_data = self._pre_get_file_url(
|
|
97
|
+
file_id=file_id,
|
|
98
|
+
correlation_id=correlation_id,
|
|
99
|
+
api_version=ApiVersion.V1.value,
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
resp = await self._request_handler.make_request(
|
|
103
|
+
"GET", request_data, return_json=True
|
|
104
|
+
)
|
|
105
|
+
return GetFileUrlResponse(**resp)
|
|
@@ -52,3 +52,42 @@ class BaseAttachments:
|
|
|
52
52
|
)
|
|
53
53
|
|
|
54
54
|
return request_data
|
|
55
|
+
|
|
56
|
+
def _pre_get_file_url(
|
|
57
|
+
self,
|
|
58
|
+
file_id: str,
|
|
59
|
+
correlation_id: Optional[str] = None,
|
|
60
|
+
api_version: str = ApiVersion.V1.value,
|
|
61
|
+
):
|
|
62
|
+
"""
|
|
63
|
+
Prepare request data for get file URL endpoint.
|
|
64
|
+
|
|
65
|
+
This internal method constructs the URL for refreshing a file's signed URL,
|
|
66
|
+
validating the API version and preparing all request components.
|
|
67
|
+
|
|
68
|
+
Args:
|
|
69
|
+
file_id: The unique identifier of the file
|
|
70
|
+
correlation_id: Optional correlation ID for tracing
|
|
71
|
+
api_version: API version to use for the request
|
|
72
|
+
|
|
73
|
+
Returns:
|
|
74
|
+
RequestData: Prepared request data for the get file URL endpoint
|
|
75
|
+
|
|
76
|
+
Raises:
|
|
77
|
+
ValueError: If an invalid API version is provided
|
|
78
|
+
"""
|
|
79
|
+
if api_version not in ApiVersion.as_list():
|
|
80
|
+
raise ValueError(
|
|
81
|
+
f"Invalid API version: {api_version}. Valid versions are: {', '.join(ApiVersion.as_list())}"
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
url = urljoin(
|
|
85
|
+
self._request_handler.base_url,
|
|
86
|
+
f"{api_version}/upload/refresh/{file_id}",
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
request_data = self._request_handler.prepare_request(
|
|
90
|
+
url=url, payload=None, correlation_id=correlation_id
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
return request_data
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
from ...types._api_version import ApiVersion
|
|
4
|
+
from ...types.api.attachments import AttachmentResponse, GetFileUrlResponse
|
|
5
|
+
from .._request_handler import RequestHandler
|
|
6
|
+
from .base_attachments import BaseAttachments
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class Attachments(BaseAttachments):
|
|
10
|
+
def __init__(self, request_handler: RequestHandler):
|
|
11
|
+
super().__init__(request_handler)
|
|
12
|
+
|
|
13
|
+
def upload_file(
|
|
14
|
+
self,
|
|
15
|
+
file_path: str,
|
|
16
|
+
correlation_id: Optional[str] = None,
|
|
17
|
+
) -> AttachmentResponse:
|
|
18
|
+
"""
|
|
19
|
+
Upload a file and get attachment information.
|
|
20
|
+
|
|
21
|
+
Args:
|
|
22
|
+
file_path: Path to the file on disk
|
|
23
|
+
correlation_id: Optional correlation ID for request tracing. If not provided,
|
|
24
|
+
one will be generated automatically.
|
|
25
|
+
|
|
26
|
+
Returns:
|
|
27
|
+
AttachmentResponse: Response containing the attachment ID and URL.
|
|
28
|
+
|
|
29
|
+
Raises:
|
|
30
|
+
AiriaAPIError: If the API request fails with details about the error.
|
|
31
|
+
requests.RequestException: For other request-related errors.
|
|
32
|
+
|
|
33
|
+
Example:
|
|
34
|
+
```python
|
|
35
|
+
client = AiriaClient(api_key="your_api_key")
|
|
36
|
+
|
|
37
|
+
# Upload a file
|
|
38
|
+
response = client.attachments.upload_file(
|
|
39
|
+
file_path="example.jpg"
|
|
40
|
+
)
|
|
41
|
+
print(f"Uploaded attachment ID: {response.id}")
|
|
42
|
+
print(f"Attachment URL: {response.image_url}")
|
|
43
|
+
```
|
|
44
|
+
"""
|
|
45
|
+
request_data = self._pre_upload_file(
|
|
46
|
+
file_path=file_path,
|
|
47
|
+
correlation_id=correlation_id,
|
|
48
|
+
api_version=ApiVersion.V1.value,
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
resp = self._request_handler.make_request_multipart("POST", request_data)
|
|
52
|
+
return AttachmentResponse(**resp)
|
|
53
|
+
|
|
54
|
+
def get_file_url(
|
|
55
|
+
self,
|
|
56
|
+
file_id: str,
|
|
57
|
+
correlation_id: Optional[str] = None,
|
|
58
|
+
) -> GetFileUrlResponse:
|
|
59
|
+
"""
|
|
60
|
+
Get a refreshed signed URL for an existing attachment.
|
|
61
|
+
|
|
62
|
+
This method retrieves a new time-limited signed URL for accessing
|
|
63
|
+
an attachment that was previously uploaded. Useful when the original
|
|
64
|
+
signed URL has expired or is about to expire.
|
|
65
|
+
|
|
66
|
+
Args:
|
|
67
|
+
file_id: The unique identifier of the attachment
|
|
68
|
+
correlation_id: Optional correlation ID for request tracing. If not provided,
|
|
69
|
+
one will be generated automatically.
|
|
70
|
+
|
|
71
|
+
Returns:
|
|
72
|
+
GetFileUrlResponse: Response containing the attachment ID and refreshed signed URL.
|
|
73
|
+
|
|
74
|
+
Raises:
|
|
75
|
+
AiriaAPIError: If the API request fails with details about the error.
|
|
76
|
+
requests.RequestException: For other request-related errors.
|
|
77
|
+
|
|
78
|
+
Example:
|
|
79
|
+
```python
|
|
80
|
+
client = AiriaClient(api_key="your_api_key")
|
|
81
|
+
|
|
82
|
+
# First, upload a file
|
|
83
|
+
upload_response = client.attachments.upload_file(
|
|
84
|
+
file_path="example.jpg"
|
|
85
|
+
)
|
|
86
|
+
file_id = upload_response.id
|
|
87
|
+
|
|
88
|
+
# Later, get a refreshed URL for the same file
|
|
89
|
+
url_response = client.attachments.get_file_url(
|
|
90
|
+
file_id=file_id
|
|
91
|
+
)
|
|
92
|
+
print(f"Attachment ID: {url_response.id}")
|
|
93
|
+
print(f"Refreshed URL: {url_response.signed_url}")
|
|
94
|
+
```
|
|
95
|
+
"""
|
|
96
|
+
request_data = self._pre_get_file_url(
|
|
97
|
+
file_id=file_id,
|
|
98
|
+
correlation_id=correlation_id,
|
|
99
|
+
api_version=ApiVersion.V1.value,
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
resp = self._request_handler.make_request("GET", request_data, return_json=True)
|
|
103
|
+
return GetFileUrlResponse(**resp)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from .._request_handler import AsyncRequestHandler
|
|
2
|
+
from .store import AsyncStore
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class AsyncDataStore:
|
|
6
|
+
"""Async Data Store client for browsing files and folders in store connectors."""
|
|
7
|
+
|
|
8
|
+
def __init__(self, request_handler: AsyncRequestHandler):
|
|
9
|
+
"""
|
|
10
|
+
Initialize the AsyncDataStore client.
|
|
11
|
+
|
|
12
|
+
Args:
|
|
13
|
+
request_handler: The async request handler for making API calls
|
|
14
|
+
"""
|
|
15
|
+
self.store = AsyncStore(request_handler)
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
from ....types.api.data_store.store import GetFilesAndFoldersResponse
|
|
4
|
+
from ..._request_handler import AsyncRequestHandler
|
|
5
|
+
from .base_store import BaseStore
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class AsyncStore(BaseStore):
|
|
9
|
+
"""Async Store client for browsing files and folders."""
|
|
10
|
+
|
|
11
|
+
def __init__(self, request_handler: AsyncRequestHandler):
|
|
12
|
+
super().__init__(request_handler)
|
|
13
|
+
|
|
14
|
+
async def get_files_and_folders(
|
|
15
|
+
self,
|
|
16
|
+
store_connector_id: str,
|
|
17
|
+
project_id: str,
|
|
18
|
+
folder_id: Optional[str] = None,
|
|
19
|
+
page_number: Optional[int] = None,
|
|
20
|
+
page_size: Optional[int] = None,
|
|
21
|
+
sort_by: Optional[str] = None,
|
|
22
|
+
sort_order: Optional[str] = None,
|
|
23
|
+
filter_by: Optional[str] = None,
|
|
24
|
+
filter_value: Optional[str] = None,
|
|
25
|
+
correlation_id: Optional[str] = None,
|
|
26
|
+
) -> GetFilesAndFoldersResponse:
|
|
27
|
+
"""
|
|
28
|
+
Retrieve files and folders from a store connector in the Airia data store.
|
|
29
|
+
|
|
30
|
+
This method retrieves information about files and folders in the specified
|
|
31
|
+
store connector, with optional navigation into specific folders and support
|
|
32
|
+
for pagination, sorting, and filtering.
|
|
33
|
+
|
|
34
|
+
Args:
|
|
35
|
+
store_connector_id: The unique identifier of the store connector (GUID format)
|
|
36
|
+
project_id: The unique identifier of the project (GUID format)
|
|
37
|
+
folder_id: Optional folder ID to browse within a specific folder (GUID format).
|
|
38
|
+
If not provided, retrieves items from the root level.
|
|
39
|
+
page_number: Page number for pagination (1-indexed)
|
|
40
|
+
page_size: Number of items per page
|
|
41
|
+
sort_by: Field to sort by (e.g., "lastSyncAt", "name")
|
|
42
|
+
sort_order: Sort order ("ASC" or "DESC")
|
|
43
|
+
filter_by: Field to filter by
|
|
44
|
+
filter_value: Value to filter by
|
|
45
|
+
correlation_id: Optional correlation ID for request tracing
|
|
46
|
+
|
|
47
|
+
Returns:
|
|
48
|
+
GetFilesAndFoldersResponse: List of files and folders with metadata and total count
|
|
49
|
+
|
|
50
|
+
Raises:
|
|
51
|
+
AiriaAPIError: If the API request fails, including cases where:
|
|
52
|
+
- The store_connector_id doesn't exist (404)
|
|
53
|
+
- The project_id doesn't exist (404)
|
|
54
|
+
- The folder_id is invalid (404)
|
|
55
|
+
- Authentication fails (401)
|
|
56
|
+
- Access is forbidden (403)
|
|
57
|
+
- Server errors (5xx)
|
|
58
|
+
ValueError: If required parameters are missing or invalid
|
|
59
|
+
|
|
60
|
+
Example:
|
|
61
|
+
```python
|
|
62
|
+
from airia import AiriaAsyncClient
|
|
63
|
+
|
|
64
|
+
async with AiriaAsyncClient(api_key="your_api_key") as client:
|
|
65
|
+
# Get files and folders from root level
|
|
66
|
+
response = await client.data_store.store.get_files_and_folders(
|
|
67
|
+
store_connector_id="02b2ef8b-8bff-42c3-9ddb-e325c893176e",
|
|
68
|
+
project_id="0196162b-1553-71b2-8ebf-44594717936e"
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
# Browse a specific folder with pagination and sorting
|
|
72
|
+
response = await client.data_store.store.get_files_and_folders(
|
|
73
|
+
store_connector_id="02b2ef8b-8bff-42c3-9ddb-e325c893176e",
|
|
74
|
+
project_id="0196162b-1553-71b2-8ebf-44594717936e",
|
|
75
|
+
folder_id="3292db69-f365-4bb6-a2b6-a017a187fb77",
|
|
76
|
+
page_number=1,
|
|
77
|
+
page_size=50,
|
|
78
|
+
sort_by="lastSyncAt",
|
|
79
|
+
sort_order="DESC"
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
# Access the results
|
|
83
|
+
if response.files_and_folders:
|
|
84
|
+
for item in response.files_and_folders:
|
|
85
|
+
print(f"{item.name} ({item.type})")
|
|
86
|
+
if item.type == "folder":
|
|
87
|
+
print(f" Contains {item.file_count} files, {item.folder_count} folders")
|
|
88
|
+
|
|
89
|
+
print(f"Total items: {response.total_count}")
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Note:
|
|
93
|
+
The response includes:
|
|
94
|
+
- files_and_folders: List of file and folder objects with metadata
|
|
95
|
+
- total_count: Total number of items (useful for pagination)
|
|
96
|
+
"""
|
|
97
|
+
request_data = self._pre_get_files_and_folders(
|
|
98
|
+
store_connector_id=store_connector_id,
|
|
99
|
+
project_id=project_id,
|
|
100
|
+
folder_id=folder_id,
|
|
101
|
+
page_number=page_number,
|
|
102
|
+
page_size=page_size,
|
|
103
|
+
sort_by=sort_by,
|
|
104
|
+
sort_order=sort_order,
|
|
105
|
+
filter_by=filter_by,
|
|
106
|
+
filter_value=filter_value,
|
|
107
|
+
correlation_id=correlation_id,
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
response = await self._request_handler.make_request(
|
|
111
|
+
"GET", request_data, return_json=True
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
return GetFilesAndFoldersResponse(**response)
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
from typing import Optional, Union
|
|
2
|
+
from urllib.parse import urljoin
|
|
3
|
+
|
|
4
|
+
from ..._request_handler import AsyncRequestHandler, RequestHandler
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class BaseStore:
|
|
8
|
+
def __init__(self, request_handler: Union[RequestHandler, AsyncRequestHandler]):
|
|
9
|
+
self._request_handler = request_handler
|
|
10
|
+
|
|
11
|
+
def _pre_get_files_and_folders(
|
|
12
|
+
self,
|
|
13
|
+
store_connector_id: str,
|
|
14
|
+
project_id: str,
|
|
15
|
+
folder_id: Optional[str] = None,
|
|
16
|
+
page_number: Optional[int] = None,
|
|
17
|
+
page_size: Optional[int] = None,
|
|
18
|
+
sort_by: Optional[str] = None,
|
|
19
|
+
sort_order: Optional[str] = None,
|
|
20
|
+
filter_by: Optional[str] = None,
|
|
21
|
+
filter_value: Optional[str] = None,
|
|
22
|
+
correlation_id: Optional[str] = None,
|
|
23
|
+
):
|
|
24
|
+
"""
|
|
25
|
+
Prepare request data for get files and folders endpoint.
|
|
26
|
+
|
|
27
|
+
This internal method constructs the URL and query parameters for
|
|
28
|
+
retrieving files and folders from a store connector.
|
|
29
|
+
|
|
30
|
+
Args:
|
|
31
|
+
store_connector_id: ID of the store connector
|
|
32
|
+
project_id: ID of the project
|
|
33
|
+
folder_id: Optional folder ID to browse within a specific folder
|
|
34
|
+
page_number: Page number for pagination
|
|
35
|
+
page_size: Number of items per page
|
|
36
|
+
sort_by: Field to sort by
|
|
37
|
+
sort_order: Sort order (ASC or DESC)
|
|
38
|
+
filter_by: Field to filter by
|
|
39
|
+
filter_value: Value to filter by
|
|
40
|
+
correlation_id: Optional correlation ID for tracing
|
|
41
|
+
|
|
42
|
+
Returns:
|
|
43
|
+
RequestData: Prepared request data for the get files and folders endpoint
|
|
44
|
+
"""
|
|
45
|
+
# Build URL with optional folder_id
|
|
46
|
+
if folder_id:
|
|
47
|
+
url_path = f"datastore/v1/store/{store_connector_id}/folders/{folder_id}"
|
|
48
|
+
else:
|
|
49
|
+
url_path = f"datastore/v1/store/{store_connector_id}/folders/"
|
|
50
|
+
|
|
51
|
+
url = urljoin(self._request_handler.base_url, url_path)
|
|
52
|
+
|
|
53
|
+
# Build query parameters
|
|
54
|
+
params = {"projectId": project_id}
|
|
55
|
+
|
|
56
|
+
if page_number is not None:
|
|
57
|
+
params["pagingParameters.pageNumber"] = page_number
|
|
58
|
+
if page_size is not None:
|
|
59
|
+
params["pagingParameters.pageSize"] = page_size
|
|
60
|
+
if sort_by is not None:
|
|
61
|
+
params["sortingParameters.sortBy"] = sort_by
|
|
62
|
+
if sort_order is not None:
|
|
63
|
+
params["sortingParameters.sortOrder"] = sort_order
|
|
64
|
+
if filter_by is not None:
|
|
65
|
+
params["filteringParameters.filterBy"] = filter_by
|
|
66
|
+
if filter_value is not None:
|
|
67
|
+
params["filteringParameters.filterValue"] = filter_value
|
|
68
|
+
|
|
69
|
+
request_data = self._request_handler.prepare_request(
|
|
70
|
+
url, params=params, payload=None, correlation_id=correlation_id
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
return request_data
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
from ....types.api.data_store.store import GetFilesAndFoldersResponse
|
|
4
|
+
from ..._request_handler import RequestHandler
|
|
5
|
+
from .base_store import BaseStore
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class Store(BaseStore):
|
|
9
|
+
"""Store client for browsing files and folders."""
|
|
10
|
+
|
|
11
|
+
def __init__(self, request_handler: RequestHandler):
|
|
12
|
+
super().__init__(request_handler)
|
|
13
|
+
|
|
14
|
+
def get_files_and_folders(
|
|
15
|
+
self,
|
|
16
|
+
store_connector_id: str,
|
|
17
|
+
project_id: str,
|
|
18
|
+
folder_id: Optional[str] = None,
|
|
19
|
+
page_number: Optional[int] = None,
|
|
20
|
+
page_size: Optional[int] = None,
|
|
21
|
+
sort_by: Optional[str] = None,
|
|
22
|
+
sort_order: Optional[str] = None,
|
|
23
|
+
filter_by: Optional[str] = None,
|
|
24
|
+
filter_value: Optional[str] = None,
|
|
25
|
+
correlation_id: Optional[str] = None,
|
|
26
|
+
) -> GetFilesAndFoldersResponse:
|
|
27
|
+
"""
|
|
28
|
+
Retrieve files and folders from a store connector in the Airia data store.
|
|
29
|
+
|
|
30
|
+
This method retrieves information about files and folders in the specified
|
|
31
|
+
store connector, with optional navigation into specific folders and support
|
|
32
|
+
for pagination, sorting, and filtering.
|
|
33
|
+
|
|
34
|
+
Args:
|
|
35
|
+
store_connector_id: The unique identifier of the store connector (GUID format)
|
|
36
|
+
project_id: The unique identifier of the project (GUID format)
|
|
37
|
+
folder_id: Optional folder ID to browse within a specific folder (GUID format).
|
|
38
|
+
If not provided, retrieves items from the root level.
|
|
39
|
+
page_number: Page number for pagination (1-indexed)
|
|
40
|
+
page_size: Number of items per page
|
|
41
|
+
sort_by: Field to sort by (e.g., "lastSyncAt", "name")
|
|
42
|
+
sort_order: Sort order ("ASC" or "DESC")
|
|
43
|
+
filter_by: Field to filter by
|
|
44
|
+
filter_value: Value to filter by
|
|
45
|
+
correlation_id: Optional correlation ID for request tracing
|
|
46
|
+
|
|
47
|
+
Returns:
|
|
48
|
+
GetFilesAndFoldersResponse: List of files and folders with metadata and total count
|
|
49
|
+
|
|
50
|
+
Raises:
|
|
51
|
+
AiriaAPIError: If the API request fails, including cases where:
|
|
52
|
+
- The store_connector_id doesn't exist (404)
|
|
53
|
+
- The project_id doesn't exist (404)
|
|
54
|
+
- The folder_id is invalid (404)
|
|
55
|
+
- Authentication fails (401)
|
|
56
|
+
- Access is forbidden (403)
|
|
57
|
+
- Server errors (5xx)
|
|
58
|
+
ValueError: If required parameters are missing or invalid
|
|
59
|
+
|
|
60
|
+
Example:
|
|
61
|
+
```python
|
|
62
|
+
from airia import AiriaClient
|
|
63
|
+
|
|
64
|
+
client = AiriaClient(api_key="your_api_key")
|
|
65
|
+
|
|
66
|
+
# Get files and folders from root level
|
|
67
|
+
response = client.data_store.store.get_files_and_folders(
|
|
68
|
+
store_connector_id="02b2ef8b-8bff-42c3-9ddb-e325c893176e",
|
|
69
|
+
project_id="0196162b-1553-71b2-8ebf-44594717936e"
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
# Browse a specific folder with pagination and sorting
|
|
73
|
+
response = client.data_store.store.get_files_and_folders(
|
|
74
|
+
store_connector_id="02b2ef8b-8bff-42c3-9ddb-e325c893176e",
|
|
75
|
+
project_id="0196162b-1553-71b2-8ebf-44594717936e",
|
|
76
|
+
folder_id="3292db69-f365-4bb6-a2b6-a017a187fb77",
|
|
77
|
+
page_number=1,
|
|
78
|
+
page_size=50,
|
|
79
|
+
sort_by="lastSyncAt",
|
|
80
|
+
sort_order="DESC"
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
# Access the results
|
|
84
|
+
if response.files_and_folders:
|
|
85
|
+
for item in response.files_and_folders:
|
|
86
|
+
print(f"{item.name} ({item.type})")
|
|
87
|
+
if item.type == "folder":
|
|
88
|
+
print(f" Contains {item.file_count} files, {item.folder_count} folders")
|
|
89
|
+
|
|
90
|
+
print(f"Total items: {response.total_count}")
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Note:
|
|
94
|
+
The response includes:
|
|
95
|
+
- files_and_folders: List of file and folder objects with metadata
|
|
96
|
+
- total_count: Total number of items (useful for pagination)
|
|
97
|
+
"""
|
|
98
|
+
request_data = self._pre_get_files_and_folders(
|
|
99
|
+
store_connector_id=store_connector_id,
|
|
100
|
+
project_id=project_id,
|
|
101
|
+
folder_id=folder_id,
|
|
102
|
+
page_number=page_number,
|
|
103
|
+
page_size=page_size,
|
|
104
|
+
sort_by=sort_by,
|
|
105
|
+
sort_order=sort_order,
|
|
106
|
+
filter_by=filter_by,
|
|
107
|
+
filter_value=filter_value,
|
|
108
|
+
correlation_id=correlation_id,
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
response = self._request_handler.make_request(
|
|
112
|
+
"GET", request_data, return_json=True
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
return GetFilesAndFoldersResponse(**response)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from .._request_handler import RequestHandler
|
|
2
|
+
from .store import Store
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class DataStore:
|
|
6
|
+
"""Data Store client for browsing files and folders in store connectors."""
|
|
7
|
+
|
|
8
|
+
def __init__(self, request_handler: RequestHandler):
|
|
9
|
+
"""
|
|
10
|
+
Initialize the DataStore client.
|
|
11
|
+
|
|
12
|
+
Args:
|
|
13
|
+
request_handler: The request handler for making API calls
|
|
14
|
+
"""
|
|
15
|
+
self.store = Store(request_handler)
|
|
@@ -48,7 +48,9 @@ class BaseDataVectorSearch:
|
|
|
48
48
|
)
|
|
49
49
|
|
|
50
50
|
request_data = self._request_handler.prepare_request(
|
|
51
|
-
url,
|
|
51
|
+
url,
|
|
52
|
+
correlation_id=correlation_id,
|
|
53
|
+
params={"pageNumber": page_number, "pageSize": page_size},
|
|
52
54
|
)
|
|
53
55
|
|
|
54
56
|
return request_data
|
|
@@ -133,7 +133,9 @@ class AsyncPipelinesConfig(BasePipelinesConfig):
|
|
|
133
133
|
sort_direction: Optional[Literal["ASC", "DESC"]] = None,
|
|
134
134
|
filter: Optional[str] = None,
|
|
135
135
|
project_id: Optional[str] = None,
|
|
136
|
-
model_credential_source_type: Optional[
|
|
136
|
+
model_credential_source_type: Optional[
|
|
137
|
+
Literal["UserProvided", "Library"]
|
|
138
|
+
] = None,
|
|
137
139
|
correlation_id: Optional[str] = None,
|
|
138
140
|
) -> GetPipelinesConfigResponse:
|
|
139
141
|
"""
|
|
@@ -267,4 +269,6 @@ class AsyncPipelinesConfig(BasePipelinesConfig):
|
|
|
267
269
|
correlation_id=correlation_id,
|
|
268
270
|
api_version=ApiVersion.V1.value,
|
|
269
271
|
)
|
|
270
|
-
await self._request_handler.make_request(
|
|
272
|
+
await self._request_handler.make_request(
|
|
273
|
+
"DELETE", request_data, return_json=False
|
|
274
|
+
)
|
|
@@ -85,7 +85,9 @@ class BasePipelinesConfig:
|
|
|
85
85
|
sort_direction: Optional[Literal["ASC", "DESC"]] = None,
|
|
86
86
|
filter: Optional[str] = None,
|
|
87
87
|
project_id: Optional[str] = None,
|
|
88
|
-
model_credential_source_type: Optional[
|
|
88
|
+
model_credential_source_type: Optional[
|
|
89
|
+
Literal["UserProvided", "Library"]
|
|
90
|
+
] = None,
|
|
89
91
|
correlation_id: Optional[str] = None,
|
|
90
92
|
api_version: str = ApiVersion.V1.value,
|
|
91
93
|
):
|
|
@@ -133,7 +133,9 @@ class PipelinesConfig(BasePipelinesConfig):
|
|
|
133
133
|
sort_direction: Optional[Literal["ASC", "DESC"]] = None,
|
|
134
134
|
filter: Optional[str] = None,
|
|
135
135
|
project_id: Optional[str] = None,
|
|
136
|
-
model_credential_source_type: Optional[
|
|
136
|
+
model_credential_source_type: Optional[
|
|
137
|
+
Literal["UserProvided", "Library"]
|
|
138
|
+
] = None,
|
|
137
139
|
correlation_id: Optional[str] = None,
|
|
138
140
|
) -> GetPipelinesConfigResponse:
|
|
139
141
|
"""
|