airia 0.1.13__py3-none-any.whl → 0.1.14__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.
Files changed (53) hide show
  1. airia/client/_request_handler/__init__.py +4 -0
  2. airia/client/_request_handler/async_request_handler.py +272 -0
  3. airia/client/_request_handler/base_request_handler.py +108 -0
  4. airia/client/_request_handler/sync_request_handler.py +255 -0
  5. airia/client/async_client.py +25 -678
  6. airia/client/base_client.py +2 -368
  7. airia/client/conversations/__init__.py +4 -0
  8. airia/client/conversations/async_conversations.py +187 -0
  9. airia/client/conversations/base_conversations.py +135 -0
  10. airia/client/conversations/sync_conversations.py +182 -0
  11. airia/client/pipeline_execution/__init__.py +4 -0
  12. airia/client/pipeline_execution/async_pipeline_execution.py +178 -0
  13. airia/client/pipeline_execution/base_pipeline_execution.py +96 -0
  14. airia/client/pipeline_execution/sync_pipeline_execution.py +178 -0
  15. airia/client/pipelines_config/__init__.py +4 -0
  16. airia/client/pipelines_config/async_pipelines_config.py +127 -0
  17. airia/client/pipelines_config/base_pipelines_config.py +76 -0
  18. airia/client/pipelines_config/sync_pipelines_config.py +127 -0
  19. airia/client/project/__init__.py +4 -0
  20. airia/client/project/async_project.py +122 -0
  21. airia/client/project/base_project.py +74 -0
  22. airia/client/project/sync_project.py +120 -0
  23. airia/client/store/__init__.py +4 -0
  24. airia/client/store/async_store.py +377 -0
  25. airia/client/store/base_store.py +243 -0
  26. airia/client/store/sync_store.py +352 -0
  27. airia/client/sync_client.py +25 -656
  28. airia/constants.py +1 -1
  29. airia/exceptions.py +8 -8
  30. airia/logs.py +9 -9
  31. airia/types/_request_data.py +11 -4
  32. airia/types/api/__init__.py +0 -27
  33. airia/types/api/conversations/__init__.py +3 -0
  34. airia/types/api/{conversations.py → conversations/_conversations.py} +49 -12
  35. airia/types/api/pipeline_execution/__init__.py +13 -0
  36. airia/types/api/{pipeline_execution.py → pipeline_execution/_pipeline_execution.py} +30 -13
  37. airia/types/api/pipelines_config/__init__.py +3 -0
  38. airia/types/api/pipelines_config/get_pipeline_config.py +401 -0
  39. airia/types/api/project/__init__.py +3 -0
  40. airia/types/api/{get_projects.py → project/get_projects.py} +16 -4
  41. airia/types/api/store/__init__.py +4 -0
  42. airia/types/api/store/get_file.py +145 -0
  43. airia/types/api/store/get_files.py +21 -0
  44. airia/types/sse/__init__.py +1 -0
  45. airia/types/sse/sse_messages.py +55 -21
  46. airia/utils/sse_parser.py +5 -4
  47. {airia-0.1.13.dist-info → airia-0.1.14.dist-info}/METADATA +4 -2
  48. airia-0.1.14.dist-info/RECORD +55 -0
  49. airia/types/api/get_pipeline_config.py +0 -214
  50. airia-0.1.13.dist-info/RECORD +0 -24
  51. {airia-0.1.13.dist-info → airia-0.1.14.dist-info}/WHEEL +0 -0
  52. {airia-0.1.13.dist-info → airia-0.1.14.dist-info}/licenses/LICENSE +0 -0
  53. {airia-0.1.13.dist-info → airia-0.1.14.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,178 @@
1
+ from typing import Any, Dict, List, Literal, Optional, Union, overload
2
+
3
+ from ...types._api_version import ApiVersion
4
+ from ...types.api.pipeline_execution import (
5
+ PipelineExecutionDebugResponse,
6
+ PipelineExecutionResponse,
7
+ PipelineExecutionStreamedResponse,
8
+ )
9
+ from .._request_handler import RequestHandler
10
+ from .base_pipeline_execution import BasePipelineExecution
11
+
12
+
13
+ class PipelineExecution(BasePipelineExecution):
14
+ def __init__(self, request_handler: RequestHandler):
15
+ super().__init__(request_handler)
16
+
17
+ @overload
18
+ def execute_pipeline(
19
+ self,
20
+ pipeline_id: str,
21
+ user_input: str,
22
+ debug: Literal[False] = False,
23
+ user_id: Optional[str] = None,
24
+ conversation_id: Optional[str] = None,
25
+ async_output: Literal[False] = False,
26
+ include_tools_response: bool = False,
27
+ images: Optional[List[str]] = None,
28
+ files: Optional[List[str]] = None,
29
+ data_source_folders: Optional[Dict[str, Any]] = None,
30
+ data_source_files: Optional[Dict[str, Any]] = None,
31
+ in_memory_messages: Optional[List[Dict[str, str]]] = None,
32
+ current_date_time: Optional[str] = None,
33
+ save_history: bool = True,
34
+ additional_info: Optional[List[Any]] = None,
35
+ prompt_variables: Optional[Dict[str, Any]] = None,
36
+ correlation_id: Optional[str] = None,
37
+ ) -> PipelineExecutionResponse: ...
38
+
39
+ @overload
40
+ def execute_pipeline(
41
+ self,
42
+ pipeline_id: str,
43
+ user_input: str,
44
+ debug: Literal[True] = True,
45
+ user_id: Optional[str] = None,
46
+ conversation_id: Optional[str] = None,
47
+ async_output: Literal[False] = False,
48
+ include_tools_response: bool = False,
49
+ images: Optional[List[str]] = None,
50
+ files: Optional[List[str]] = None,
51
+ data_source_folders: Optional[Dict[str, Any]] = None,
52
+ data_source_files: Optional[Dict[str, Any]] = None,
53
+ in_memory_messages: Optional[List[Dict[str, str]]] = None,
54
+ current_date_time: Optional[str] = None,
55
+ save_history: bool = True,
56
+ additional_info: Optional[List[Any]] = None,
57
+ prompt_variables: Optional[Dict[str, Any]] = None,
58
+ correlation_id: Optional[str] = None,
59
+ ) -> PipelineExecutionDebugResponse: ...
60
+
61
+ @overload
62
+ def execute_pipeline(
63
+ self,
64
+ pipeline_id: str,
65
+ user_input: str,
66
+ debug: bool = False,
67
+ user_id: Optional[str] = None,
68
+ conversation_id: Optional[str] = None,
69
+ async_output: Literal[True] = True,
70
+ include_tools_response: bool = False,
71
+ images: Optional[List[str]] = None,
72
+ files: Optional[List[str]] = None,
73
+ data_source_folders: Optional[Dict[str, Any]] = None,
74
+ data_source_files: Optional[Dict[str, Any]] = None,
75
+ in_memory_messages: Optional[List[Dict[str, str]]] = None,
76
+ current_date_time: Optional[str] = None,
77
+ save_history: bool = True,
78
+ additional_info: Optional[List[Any]] = None,
79
+ prompt_variables: Optional[Dict[str, Any]] = None,
80
+ correlation_id: Optional[str] = None,
81
+ ) -> PipelineExecutionStreamedResponse: ...
82
+
83
+ def execute_pipeline(
84
+ self,
85
+ pipeline_id: str,
86
+ user_input: str,
87
+ debug: bool = False,
88
+ user_id: Optional[str] = None,
89
+ conversation_id: Optional[str] = None,
90
+ async_output: bool = False,
91
+ include_tools_response: bool = False,
92
+ images: Optional[List[str]] = None,
93
+ files: Optional[List[str]] = None,
94
+ data_source_folders: Optional[Dict[str, Any]] = None,
95
+ data_source_files: Optional[Dict[str, Any]] = None,
96
+ in_memory_messages: Optional[List[Dict[str, str]]] = None,
97
+ current_date_time: Optional[str] = None,
98
+ save_history: bool = True,
99
+ additional_info: Optional[List[Any]] = None,
100
+ prompt_variables: Optional[Dict[str, Any]] = None,
101
+ correlation_id: Optional[str] = None,
102
+ ) -> Union[
103
+ PipelineExecutionDebugResponse,
104
+ PipelineExecutionResponse,
105
+ PipelineExecutionStreamedResponse,
106
+ ]:
107
+ """
108
+ Execute a pipeline with the provided input.
109
+
110
+ Args:
111
+ pipeline_id: The ID of the pipeline to execute.
112
+ user_input: input text to process.
113
+ debug: Whether debug mode execution is enabled. Default is False.
114
+ user_id: Optional ID of the user making the request (guid).
115
+ conversation_id: Optional conversation ID (guid).
116
+ async_output: Whether to stream the response. Default is False.
117
+ include_tools_response: Whether to return the initial LLM tool result. Default is False.
118
+ images: Optional list of images formatted as base64 strings.
119
+ files: Optional list of files formatted as base64 strings.
120
+ data_source_folders: Optional data source folders information.
121
+ data_source_files: Optional data source files information.
122
+ in_memory_messages: Optional list of in-memory messages, each with a role and message.
123
+ current_date_time: Optional current date and time in ISO format.
124
+ save_history: Whether to save the userInput and output to conversation history. Default is True.
125
+ additional_info: Optional additional information.
126
+ prompt_variables: Optional variables to be used in the prompt.
127
+ correlation_id: Optional correlation ID for request tracing. If not provided,
128
+ one will be generated automatically.
129
+
130
+ Returns:
131
+ Response containing the result of the execution.
132
+
133
+ Raises:
134
+ AiriaAPIError: If the API request fails with details about the error.
135
+ requests.RequestException: For other request-related errors.
136
+
137
+ Example:
138
+ ```python
139
+ client = AiriaClient(api_key="your_api_key")
140
+ response = client.pipeline_execution.execute_pipeline(
141
+ pipeline_id="pipeline_123",
142
+ user_input="Tell me about quantum computing"
143
+ )
144
+ print(response.result)
145
+ ```
146
+ """
147
+ request_data = self._pre_execute_pipeline(
148
+ pipeline_id=pipeline_id,
149
+ user_input=user_input,
150
+ debug=debug,
151
+ user_id=user_id,
152
+ conversation_id=conversation_id,
153
+ async_output=async_output,
154
+ include_tools_response=include_tools_response,
155
+ images=images,
156
+ files=files,
157
+ data_source_folders=data_source_folders,
158
+ data_source_files=data_source_files,
159
+ in_memory_messages=in_memory_messages,
160
+ current_date_time=current_date_time,
161
+ save_history=save_history,
162
+ additional_info=additional_info,
163
+ prompt_variables=prompt_variables,
164
+ correlation_id=correlation_id,
165
+ api_version=ApiVersion.V2.value,
166
+ )
167
+ resp = (
168
+ self._request_handler.make_request_stream("POST", request_data)
169
+ if async_output
170
+ else self._request_handler.make_request("POST", request_data)
171
+ )
172
+
173
+ if not async_output:
174
+ if not debug:
175
+ return PipelineExecutionResponse(**resp)
176
+ return PipelineExecutionDebugResponse(**resp)
177
+
178
+ return PipelineExecutionStreamedResponse(stream=resp)
@@ -0,0 +1,4 @@
1
+ from .sync_pipelines_config import PipelinesConfig
2
+ from .async_pipelines_config import AsyncPipelinesConfig
3
+
4
+ __all__ = ["PipelinesConfig", "AsyncPipelinesConfig"]
@@ -0,0 +1,127 @@
1
+ from typing import List, Optional
2
+
3
+ from ...types._api_version import ApiVersion
4
+ from ...types.api.pipelines_config import GetPipelineConfigResponse
5
+ from .._request_handler import AsyncRequestHandler
6
+ from .base_pipelines_config import BasePipelinesConfig
7
+
8
+
9
+ class AsyncPipelinesConfig(BasePipelinesConfig):
10
+ def __init__(self, request_handler: AsyncRequestHandler):
11
+ super().__init__(request_handler)
12
+
13
+ async def get_active_pipelines_ids(
14
+ self, project_id: Optional[str] = None, correlation_id: Optional[str] = None
15
+ ) -> List[str]:
16
+ """
17
+ Retrieve a list of active pipeline IDs.
18
+
19
+ This method fetches the IDs of all active pipelines, optionally filtered by project.
20
+ Active pipelines are those that are currently deployed and available for execution.
21
+
22
+ Args:
23
+ project_id (str, optional): The unique identifier of the project to filter
24
+ pipelines by. If not provided, returns active pipelines from all projects
25
+ accessible to the authenticated user.
26
+ correlation_id (str, optional): A unique identifier for request tracing
27
+ and logging. If not provided, one will be automatically generated.
28
+
29
+ Returns:
30
+ List[str]: A list of pipeline IDs that are currently active. Returns an
31
+ empty list if no active pipelines are found.
32
+
33
+ Raises:
34
+ AiriaAPIError: If the API request fails, including cases where:
35
+ - The project_id doesn't exist (404)
36
+ - Authentication fails (401)
37
+ - Access is forbidden (403)
38
+ - Server errors (5xx)
39
+
40
+ Example:
41
+ ```python
42
+ from airia import AiriaAsyncClient
43
+
44
+ client = AiriaAsyncClient(api_key="your_api_key")
45
+
46
+ # Get all active pipeline IDs
47
+ pipeline_ids = await client.pipelines_config.get_active_pipelines_ids()
48
+ print(f"Found {len(pipeline_ids)} active pipelines")
49
+
50
+ # Get active pipeline IDs for a specific project
51
+ project_pipelines = await client.pipelines_config.get_active_pipelines_ids(
52
+ project_id="your_project_id"
53
+ )
54
+ print(f"Project has {len(project_pipelines)} active pipelines")
55
+ ```
56
+
57
+ Note:
58
+ Only pipelines with active versions are returned. Inactive or archived
59
+ pipelines are not included in the results.
60
+ """
61
+ request_data = self._pre_get_active_pipelines_ids(
62
+ project_id=project_id,
63
+ correlation_id=correlation_id,
64
+ api_version=ApiVersion.V1.value,
65
+ )
66
+ resp = await self._request_handler.make_request("GET", request_data)
67
+
68
+ if "items" not in resp or len(resp["items"]) == 0:
69
+ return []
70
+
71
+ pipeline_ids = [r["activeVersion"]["pipelineId"] for r in resp["items"]]
72
+
73
+ return pipeline_ids
74
+
75
+ async def get_pipeline_config(
76
+ self, pipeline_id: str, correlation_id: Optional[str] = None
77
+ ) -> GetPipelineConfigResponse:
78
+ """
79
+ Retrieve configuration details for a specific pipeline.
80
+
81
+ This method fetches comprehensive information about a pipeline including its
82
+ deployment details, execution statistics, version information, and metadata.
83
+
84
+ Args:
85
+ pipeline_id (str): The unique identifier of the pipeline to retrieve
86
+ configuration for.
87
+ correlation_id (str, optional): A unique identifier for request tracing
88
+ and logging. If not provided, one will be automatically generated.
89
+
90
+ Returns:
91
+ GetPipelineConfigResponse: A response object containing the pipeline
92
+ configuration.
93
+
94
+ Raises:
95
+ AiriaAPIError: If the API request fails, including cases where:
96
+ - The pipeline_id doesn't exist (404)
97
+ - Authentication fails (401)
98
+ - Access is forbidden (403)
99
+ - Server errors (5xx)
100
+
101
+ Example:
102
+ ```python
103
+ from airia import AiriaAsyncClient
104
+
105
+ client = AiriaAsyncClient(api_key="your_api_key")
106
+
107
+ # Get pipeline configuration
108
+ config = await client.pipelines_config.get_pipeline_config(
109
+ pipeline_id="your_pipeline_id"
110
+ )
111
+
112
+ print(f"Pipeline: {config.agent.name}")
113
+ print(f"Description: {config.agent.agent_description}")
114
+ ```
115
+
116
+ Note:
117
+ This method only retrieves configuration information and does not
118
+ execute the pipeline. Use execute_pipeline() to run the pipeline.
119
+ """
120
+ request_data = self._pre_get_pipeline_config(
121
+ pipeline_id=pipeline_id,
122
+ correlation_id=correlation_id,
123
+ api_version=ApiVersion.V1.value,
124
+ )
125
+ resp = await self._request_handler.make_request("GET", request_data)
126
+
127
+ return GetPipelineConfigResponse(**resp)
@@ -0,0 +1,76 @@
1
+ from typing import 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 BasePipelinesConfig:
9
+ def __init__(self, request_handler: Union[RequestHandler, AsyncRequestHandler]):
10
+ self._request_handler = request_handler
11
+
12
+ def _pre_get_active_pipelines_ids(
13
+ self,
14
+ project_id: Optional[str] = None,
15
+ correlation_id: Optional[str] = None,
16
+ api_version: str = ApiVersion.V1.value,
17
+ ):
18
+ """
19
+ Prepare request data for getting active pipelines IDs.
20
+
21
+ Args:
22
+ project_id: ID of the project to get configuration for
23
+ correlation_id: Optional correlation ID for tracing
24
+ api_version: API version to use for the request
25
+
26
+ Returns:
27
+ RequestData: Prepared request data for the pipeline config endpoint
28
+
29
+ Raises:
30
+ ValueError: If an invalid API version is provided
31
+ """
32
+ if api_version not in ApiVersion.as_list():
33
+ raise ValueError(
34
+ f"Invalid API version: {api_version}. Valid versions are: {', '.join(ApiVersion.as_list())}"
35
+ )
36
+ url = urljoin(self._request_handler.base_url, f"{api_version}/PipelinesConfig")
37
+ params = {"projectId": project_id} if project_id is not None else None
38
+ request_data = self._request_handler.prepare_request(
39
+ url, params=params, correlation_id=correlation_id
40
+ )
41
+
42
+ return request_data
43
+
44
+ def _pre_get_pipeline_config(
45
+ self,
46
+ pipeline_id: str,
47
+ correlation_id: Optional[str] = None,
48
+ api_version: str = ApiVersion.V1.value,
49
+ ):
50
+ """
51
+ Prepare request data for getting pipeline configuration endpoint.
52
+
53
+ Args:
54
+ pipeline_id: ID of the pipeline to get configuration for
55
+ correlation_id: Optional correlation ID for tracing
56
+ api_version: API version to use for the request
57
+
58
+ Returns:
59
+ RequestData: Prepared request data for the pipeline config endpoint
60
+
61
+ Raises:
62
+ ValueError: If an invalid API version is provided
63
+ """
64
+ if api_version not in ApiVersion.as_list():
65
+ raise ValueError(
66
+ f"Invalid API version: {api_version}. Valid versions are: {', '.join(ApiVersion.as_list())}"
67
+ )
68
+ url = urljoin(
69
+ self._request_handler.base_url,
70
+ f"{api_version}/PipelinesConfig/export/{pipeline_id}",
71
+ )
72
+ request_data = self._request_handler.prepare_request(
73
+ url, correlation_id=correlation_id
74
+ )
75
+
76
+ return request_data
@@ -0,0 +1,127 @@
1
+ from typing import List, Optional
2
+
3
+ from ...types._api_version import ApiVersion
4
+ from ...types.api.pipelines_config import GetPipelineConfigResponse
5
+ from .._request_handler import RequestHandler
6
+ from .base_pipelines_config import BasePipelinesConfig
7
+
8
+
9
+ class PipelinesConfig(BasePipelinesConfig):
10
+ def __init__(self, request_handler: RequestHandler):
11
+ super().__init__(request_handler)
12
+
13
+ def get_active_pipelines_ids(
14
+ self, project_id: Optional[str] = None, correlation_id: Optional[str] = None
15
+ ) -> List[str]:
16
+ """
17
+ Retrieve a list of active pipeline IDs.
18
+
19
+ This method fetches the IDs of all active pipelines, optionally filtered by project.
20
+ Active pipelines are those that are currently deployed and available for execution.
21
+
22
+ Args:
23
+ project_id (str, optional): The unique identifier of the project to filter
24
+ pipelines by. If not provided, returns active pipelines from all projects
25
+ accessible to the authenticated user.
26
+ correlation_id (str, optional): A unique identifier for request tracing
27
+ and logging. If not provided, one will be automatically generated.
28
+
29
+ Returns:
30
+ List[str]: A list of pipeline IDs that are currently active. Returns an
31
+ empty list if no active pipelines are found.
32
+
33
+ Raises:
34
+ AiriaAPIError: If the API request fails, including cases where:
35
+ - The project_id doesn't exist (404)
36
+ - Authentication fails (401)
37
+ - Access is forbidden (403)
38
+ - Server errors (5xx)
39
+
40
+ Example:
41
+ ```python
42
+ from airia import AiriaClient
43
+
44
+ client = AiriaClient(api_key="your_api_key")
45
+
46
+ # Get all active pipeline IDs
47
+ pipeline_ids = client.pipelines_config.get_active_pipelines_ids()
48
+ print(f"Found {len(pipeline_ids)} active pipelines")
49
+
50
+ # Get active pipeline IDs for a specific project
51
+ project_pipelines = client.pipelines_config.get_active_pipelines_ids(
52
+ project_id="your_project_id"
53
+ )
54
+ print(f"Project has {len(project_pipelines)} active pipelines")
55
+ ```
56
+
57
+ Note:
58
+ Only pipelines with active versions are returned. Inactive or archived
59
+ pipelines are not included in the results.
60
+ """
61
+ request_data = self._pre_get_active_pipelines_ids(
62
+ project_id=project_id,
63
+ correlation_id=correlation_id,
64
+ api_version=ApiVersion.V1.value,
65
+ )
66
+ resp = self._request_handler.make_request("GET", request_data)
67
+
68
+ if "items" not in resp or len(resp["items"]) == 0:
69
+ return []
70
+
71
+ pipeline_ids = [r["activeVersion"]["pipelineId"] for r in resp["items"]]
72
+
73
+ return pipeline_ids
74
+
75
+ def get_pipeline_config(
76
+ self, pipeline_id: str, correlation_id: Optional[str] = None
77
+ ) -> GetPipelineConfigResponse:
78
+ """
79
+ Retrieve configuration details for a specific pipeline.
80
+
81
+ This method fetches comprehensive information about a pipeline including its
82
+ deployment details, execution statistics, version information, and metadata.
83
+
84
+ Args:
85
+ pipeline_id (str): The unique identifier of the pipeline to retrieve
86
+ configuration for.
87
+ correlation_id (str, optional): A unique identifier for request tracing
88
+ and logging. If not provided, one will be automatically generated.
89
+
90
+ Returns:
91
+ GetPipelineConfigResponse: A response object containing the pipeline
92
+ configuration.
93
+
94
+ Raises:
95
+ AiriaAPIError: If the API request fails, including cases where:
96
+ - The pipeline_id doesn't exist (404)
97
+ - Authentication fails (401)
98
+ - Access is forbidden (403)
99
+ - Server errors (5xx)
100
+
101
+ Example:
102
+ ```python
103
+ from airia import AiriaClient
104
+
105
+ client = AiriaClient(api_key="your_api_key")
106
+
107
+ # Get pipeline configuration
108
+ config = client.pipelines_config.get_pipeline_config(
109
+ pipeline_id="your_pipeline_id"
110
+ )
111
+
112
+ print(f"Pipeline: {config.agent.name}")
113
+ print(f"Description: {config.agent.agent_description}")
114
+ ```
115
+
116
+ Note:
117
+ This method only retrieves configuration information and does not
118
+ execute the pipeline. Use execute_pipeline() to run the pipeline.
119
+ """
120
+ request_data = self._pre_get_pipeline_config(
121
+ pipeline_id=pipeline_id,
122
+ correlation_id=correlation_id,
123
+ api_version=ApiVersion.V1.value,
124
+ )
125
+ resp = self._request_handler.make_request("GET", request_data)
126
+
127
+ return GetPipelineConfigResponse(**resp)
@@ -0,0 +1,4 @@
1
+ from .sync_project import Project
2
+ from .async_project import AsyncProject
3
+
4
+ __all__ = ["Project", "AsyncProject"]
@@ -0,0 +1,122 @@
1
+ from typing import List, Optional
2
+
3
+ from ...types._api_version import ApiVersion
4
+ from ...types.api.project import ProjectItem
5
+ from .._request_handler import AsyncRequestHandler
6
+ from .base_project import BaseProject
7
+
8
+
9
+ class AsyncProject(BaseProject):
10
+ def __init__(self, request_handler: AsyncRequestHandler):
11
+ super().__init__(request_handler)
12
+
13
+ async def get_projects(
14
+ self, correlation_id: Optional[str] = None
15
+ ) -> List[ProjectItem]:
16
+ """
17
+ Retrieve a list of all projects accessible to the authenticated user.
18
+
19
+ This method fetches comprehensive information about all projects that the
20
+ current user has access to, including project metadata, creation details,
21
+ and status information.
22
+
23
+ Args:
24
+ correlation_id (str, optional): A unique identifier for request tracing
25
+ and logging. If not provided, one will be automatically generated.
26
+
27
+ Returns:
28
+ List[ProjectItem]: A list of ProjectItem objects containing project
29
+ information. Returns an empty list if no projects are accessible
30
+ or found.
31
+
32
+ Raises:
33
+ AiriaAPIError: If the API request fails, including cases where:
34
+ - Authentication fails (401)
35
+ - Access is forbidden (403)
36
+ - Server errors (5xx)
37
+
38
+ Example:
39
+ ```python
40
+ from airia import AiriaAsyncClient
41
+
42
+ client = AiriaAsyncClient(api_key="your_api_key")
43
+
44
+ # Get all accessible projects
45
+ projects = await client.project.get_projects()
46
+
47
+ for project in projects:
48
+ print(f"Project: {project.name}")
49
+ print(f"ID: {project.id}")
50
+ print(f"Description: {project.description}")
51
+ print(f"Created: {project.created_at}")
52
+ print("---")
53
+ ```
54
+
55
+ Note:
56
+ The returned projects are filtered based on the authenticated user's
57
+ permissions. Users will only see projects they have been granted
58
+ access to.
59
+ """
60
+ request_data = self._pre_get_projects(
61
+ correlation_id=correlation_id, api_version=ApiVersion.V1.value
62
+ )
63
+ resp = await self._request_handler.make_request("GET", request_data)
64
+
65
+ if "items" not in resp or len(resp["items"]) == 0:
66
+ return []
67
+
68
+ return [ProjectItem(**item) for item in resp["items"]]
69
+
70
+ async def get_project(
71
+ self, project_id: str, correlation_id: Optional[str] = None
72
+ ) -> ProjectItem:
73
+ """
74
+ Retrieve detailed information for a specific project.
75
+
76
+ This method fetches comprehensive information about a single project,
77
+ including all associated resources, metadata, and configuration details.
78
+
79
+ Args:
80
+ project_id (str): The unique identifier (GUID) of the project to retrieve.
81
+ correlation_id (str, optional): A unique identifier for request tracing
82
+ and logging. If not provided, one will be automatically generated.
83
+
84
+ Returns:
85
+ ProjectItem: A ProjectItem object containing complete project
86
+ information including pipelines, models, data sources, and metadata.
87
+
88
+ Raises:
89
+ AiriaAPIError: If the API request fails, including cases where:
90
+ - Project not found (404)
91
+ - Authentication fails (401)
92
+ - Access is forbidden (403)
93
+ - Server errors (5xx)
94
+
95
+ Example:
96
+ ```python
97
+ from airia import AiriaAsyncClient
98
+
99
+ client = AiriaAsyncClient(api_key="your_api_key")
100
+
101
+ # Get a specific project by ID
102
+ project = await client.project.get_project("12345678-1234-1234-1234-123456789abc")
103
+
104
+ print(f"Project: {project.name}")
105
+ print(f"Description: {project.description}")
106
+ print(f"Pipelines: {len(project.pipelines)}")
107
+ print(f"Created: {project.created_at}")
108
+ ```
109
+
110
+ Note:
111
+ The project must be accessible to the authenticated user.
112
+ Users will only be able to retrieve projects they have been granted
113
+ access to.
114
+ """
115
+ request_data = self._pre_get_project(
116
+ project_id=project_id,
117
+ correlation_id=correlation_id,
118
+ api_version=ApiVersion.V1.value,
119
+ )
120
+ resp = await self._request_handler.make_request("GET", request_data)
121
+
122
+ return ProjectItem(**resp)