airia 0.1.36__py3-none-any.whl → 0.1.37__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.
@@ -95,6 +95,74 @@ class AsyncModels(BaseModels):
95
95
 
96
96
  return [ModelItem(**item) for item in resp["items"]]
97
97
 
98
+ async def get_model(
99
+ self,
100
+ model_id: str,
101
+ correlation_id: Optional[str] = None,
102
+ ) -> ModelItem:
103
+ """
104
+ Retrieve a model by its ID.
105
+
106
+ This method fetches detailed information about a specific model, including
107
+ its configuration, pricing, capabilities, and associated project details.
108
+
109
+ Args:
110
+ model_id (str): The unique identifier of the model to retrieve.
111
+ correlation_id (str, optional): A unique identifier for request tracing
112
+ and logging. If not provided, one will be automatically generated.
113
+
114
+ Returns:
115
+ ModelItem: A ModelItem object containing comprehensive model information
116
+ including configuration, pricing, capabilities, and project associations.
117
+
118
+ Raises:
119
+ AiriaAPIError: If the API request fails, including cases where:
120
+ - Model not found (404)
121
+ - Authentication fails (401)
122
+ - Access is forbidden (403)
123
+ - Server errors (5xx)
124
+
125
+ Example:
126
+ ```python
127
+ from airia import AiriaAsyncClient
128
+
129
+ client = AiriaAsyncClient(api_key="your_api_key")
130
+
131
+ # Get a specific model
132
+ model = await client.models.get_model(
133
+ model_id="447589d8-f82f-4a0c-ad15-215a2eaee7b8"
134
+ )
135
+
136
+ print(f"Model: {model.display_name}")
137
+ print(f"Provider: {model.provider}")
138
+ print(f"Model Name: {model.model_name}")
139
+ print(f"Has tool support: {model.has_tool_support}")
140
+ print(f"Has stream support: {model.has_stream_support}")
141
+
142
+ # Access pricing information
143
+ if model.user_provided_details:
144
+ print(f"Input token price: {model.user_provided_details.input_token_price}")
145
+ print(f"Output token price: {model.user_provided_details.output_token_price}")
146
+
147
+ # Get model with correlation ID for tracking
148
+ model = await client.models.get_model(
149
+ model_id="447589d8-f82f-4a0c-ad15-215a2eaee7b8",
150
+ correlation_id="my-correlation-id"
151
+ )
152
+ ```
153
+
154
+ Note:
155
+ The model must be accessible to the authenticated user. Users will only
156
+ be able to retrieve models they have been granted access to.
157
+ """
158
+ request_data = self._pre_get_model(
159
+ model_id=model_id,
160
+ correlation_id=correlation_id,
161
+ api_version=ApiVersion.V1.value,
162
+ )
163
+ resp = await self._request_handler.make_request("GET", request_data)
164
+ return ModelItem(**resp)
165
+
98
166
  async def delete_model(
99
167
  self,
100
168
  model_id: str,
@@ -67,6 +67,40 @@ class BaseModels:
67
67
 
68
68
  return request_data
69
69
 
70
+ def _pre_get_model(
71
+ self,
72
+ model_id: str,
73
+ correlation_id: Optional[str] = None,
74
+ api_version: str = ApiVersion.V1.value,
75
+ ):
76
+ """
77
+ Prepare request data for retrieving a single model.
78
+
79
+ Args:
80
+ model_id: The ID of the model to retrieve
81
+ correlation_id: Optional correlation ID for tracing
82
+ api_version: API version to use for the request
83
+
84
+ Returns:
85
+ RequestData: Prepared request data for the get endpoint
86
+
87
+ Raises:
88
+ ValueError: If an invalid API version is provided
89
+ """
90
+ if api_version not in ApiVersion.as_list():
91
+ raise ValueError(
92
+ f"Invalid API version: {api_version}. Valid versions are: {', '.join(ApiVersion.as_list())}"
93
+ )
94
+
95
+ url = urljoin(
96
+ self._request_handler.base_url,
97
+ f"{api_version}/Models/{model_id}",
98
+ )
99
+ request_data = self._request_handler.prepare_request(
100
+ url, correlation_id=correlation_id
101
+ )
102
+ return request_data
103
+
70
104
  def _pre_delete_model(
71
105
  self,
72
106
  model_id: str,
@@ -95,6 +95,74 @@ class Models(BaseModels):
95
95
 
96
96
  return [ModelItem(**item) for item in resp["items"]]
97
97
 
98
+ def get_model(
99
+ self,
100
+ model_id: str,
101
+ correlation_id: Optional[str] = None,
102
+ ) -> ModelItem:
103
+ """
104
+ Retrieve a model by its ID.
105
+
106
+ This method fetches detailed information about a specific model, including
107
+ its configuration, pricing, capabilities, and associated project details.
108
+
109
+ Args:
110
+ model_id (str): The unique identifier of the model to retrieve.
111
+ correlation_id (str, optional): A unique identifier for request tracing
112
+ and logging. If not provided, one will be automatically generated.
113
+
114
+ Returns:
115
+ ModelItem: A ModelItem object containing comprehensive model information
116
+ including configuration, pricing, capabilities, and project associations.
117
+
118
+ Raises:
119
+ AiriaAPIError: If the API request fails, including cases where:
120
+ - Model not found (404)
121
+ - Authentication fails (401)
122
+ - Access is forbidden (403)
123
+ - Server errors (5xx)
124
+
125
+ Example:
126
+ ```python
127
+ from airia import AiriaClient
128
+
129
+ client = AiriaClient(api_key="your_api_key")
130
+
131
+ # Get a specific model
132
+ model = client.models.get_model(
133
+ model_id="447589d8-f82f-4a0c-ad15-215a2eaee7b8"
134
+ )
135
+
136
+ print(f"Model: {model.display_name}")
137
+ print(f"Provider: {model.provider}")
138
+ print(f"Model Name: {model.model_name}")
139
+ print(f"Has tool support: {model.has_tool_support}")
140
+ print(f"Has stream support: {model.has_stream_support}")
141
+
142
+ # Access pricing information
143
+ if model.user_provided_details:
144
+ print(f"Input token price: {model.user_provided_details.input_token_price}")
145
+ print(f"Output token price: {model.user_provided_details.output_token_price}")
146
+
147
+ # Get model with correlation ID for tracking
148
+ model = client.models.get_model(
149
+ model_id="447589d8-f82f-4a0c-ad15-215a2eaee7b8",
150
+ correlation_id="my-correlation-id"
151
+ )
152
+ ```
153
+
154
+ Note:
155
+ The model must be accessible to the authenticated user. Users will only
156
+ be able to retrieve models they have been granted access to.
157
+ """
158
+ request_data = self._pre_get_model(
159
+ model_id=model_id,
160
+ correlation_id=correlation_id,
161
+ api_version=ApiVersion.V1.value,
162
+ )
163
+ resp = self._request_handler.make_request("GET", request_data)
164
+ return ModelItem(**resp)
165
+
98
166
  def delete_model(
99
167
  self,
100
168
  model_id: str,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: airia
3
- Version: 0.1.36
3
+ Version: 0.1.37
4
4
  Summary: Python SDK for Airia API
5
5
  Author-email: Airia LLC <support@airia.com>
6
6
  License: MIT
@@ -31,9 +31,9 @@ airia/client/library/async_library.py,sha256=fRG3eUxZkXDMnDTAt18KxD1LQMC5VB6cssW
31
31
  airia/client/library/base_library.py,sha256=VkcWr25fp2es2sRB97tORQmtAi59NZ6YRzwLymlQHIk,4664
32
32
  airia/client/library/sync_library.py,sha256=u_oBscUTYRNcsDbxCgpx_UvY5UAGgum2DW7eWt8y_i8,4191
33
33
  airia/client/models/__init__.py,sha256=YbxGLwMb7RQKfPo_2L_O_W9j8Szwnb0vtWiUNxkScfs,107
34
- airia/client/models/async_models.py,sha256=gwW3tWwzSZ9_3JmGlwryY48w9KrFXoLET6Jpsj0hX0I,5853
35
- airia/client/models/base_models.py,sha256=FchsA7P-Fc7fxzlN88jJ3BEVXPWDcIHSzci6wtSArqg,3439
36
- airia/client/models/sync_models.py,sha256=FQLM4xCoxcBk1NuLf6z7jVVejlDKx5KpMRBz2tQm71o,5748
34
+ airia/client/models/async_models.py,sha256=GihX15MjqH-XUUl141aae0fbHG-FVH9SdNenIAY9mFU,8505
35
+ airia/client/models/base_models.py,sha256=NNe24dcCirraVzpWJR5nNdPA3_nGwj98Ga1bk1f-TMI,4522
36
+ airia/client/models/sync_models.py,sha256=36-ejKBLJ6FCB4RWXCSdBy84VpOmVYaK9PdoUJMVgCg,8366
37
37
  airia/client/pipeline_execution/__init__.py,sha256=7qEZsPRTLySC71zlwYioBuJs6B4BwRCgFL3TQyFWXmc,175
38
38
  airia/client/pipeline_execution/async_pipeline_execution.py,sha256=EH9EexSYjhSxWAB5kOLQSh5Sfl5Qn5lQGyJrU72wFLw,23824
39
39
  airia/client/pipeline_execution/base_pipeline_execution.py,sha256=8x99rm8cPq-i9-UA97-XLNo1qAwdEPkmZ815fRSceFE,11168
@@ -95,8 +95,8 @@ airia/types/api/tools/_tools.py,sha256=PSJYFok7yQdE4it55iQmbryFzKN54nT6N161X1Rkp
95
95
  airia/types/sse/__init__.py,sha256=KWnNTfsQnthfrU128pUX6ounvSS7DvjC-Y21FE-OdMk,1863
96
96
  airia/types/sse/sse_messages.py,sha256=asq9KG5plT2XSgQMz-Nqo0WcKlXvE8UT3E-WLhCegPk,30244
97
97
  airia/utils/sse_parser.py,sha256=XCTkuaroYWaVQOgBq8VpbseQYSAVruF69AvKUwZQKTA,4251
98
- airia-0.1.36.dist-info/licenses/LICENSE,sha256=R3ClUMMKPRItIcZ0svzyj2taZZnFYw568YDNzN9KQ1Q,1066
99
- airia-0.1.36.dist-info/METADATA,sha256=y-Qw5v6SJTdKg1-5E1hmSay-dhoIqE0Dpxctm48Ju7E,4949
100
- airia-0.1.36.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
101
- airia-0.1.36.dist-info/top_level.txt,sha256=qUQEKfs_hdOYTwjKj1JZbRhS5YeXDNaKQaVTrzabS6w,6
102
- airia-0.1.36.dist-info/RECORD,,
98
+ airia-0.1.37.dist-info/licenses/LICENSE,sha256=R3ClUMMKPRItIcZ0svzyj2taZZnFYw568YDNzN9KQ1Q,1066
99
+ airia-0.1.37.dist-info/METADATA,sha256=JIQioSlT7ZRhwTVDMaVEtdncWYlZhODaWScapoYJdfY,4949
100
+ airia-0.1.37.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
101
+ airia-0.1.37.dist-info/top_level.txt,sha256=qUQEKfs_hdOYTwjKj1JZbRhS5YeXDNaKQaVTrzabS6w,6
102
+ airia-0.1.37.dist-info/RECORD,,
File without changes