44
55import httpx
66from pydantic import Field , TypeAdapter
7- from typing_extensions import deprecated
87
98from ..._utils import Endpoint , RequestSpec , header_folder , resource_override
109from ..._utils ._ssl_context import get_httpx_client_kwargs
3938 BucketSourceConfig ,
4039 ConfluenceDataSource ,
4140 ConfluenceSourceConfig ,
41+ CreateEphemeralIndexPayload ,
4242 CreateIndexPayload ,
43- CreateJitIndexPayload ,
4443 DropboxDataSource ,
4544 DropboxSourceConfig ,
4645 GoogleDriveDataSource ,
@@ -279,31 +278,19 @@ async def retrieve_async(
279278 raise Exception ("ContextGroundingIndex not found" ) from e
280279
281280 @traced (name = "contextgrounding_retrieve_by_id" , run_type = "uipath" )
282- @deprecated ("Use retrieve instead" )
283- def retrieve_by_id (
284- self ,
285- id : str ,
286- folder_key : Optional [str ] = None ,
287- folder_path : Optional [str ] = None ,
288- ) -> Any :
281+ def retrieve_by_id (self , id : str ) -> Any :
289282 """Retrieve context grounding index information by its ID.
290283
291284 This method provides direct access to a context index using its unique
292285 identifier, which can be more efficient than searching by name.
293286
294287 Args:
295288 id (str): The unique identifier of the context index.
296- folder_key (Optional[str]): The key of the folder where the index resides.
297- folder_path (Optional[str]): The path of the folder where the index resides.
298289
299290 Returns:
300291 Any: The index information, including its configuration and metadata.
301292 """
302- spec = self ._retrieve_by_id_spec (
303- id ,
304- folder_key = folder_key ,
305- folder_path = folder_path ,
306- )
293+ spec = self ._retrieve_by_id_spec (id )
307294
308295 return self .request (
309296 spec .method ,
@@ -312,31 +299,19 @@ def retrieve_by_id(
312299 ).json ()
313300
314301 @traced (name = "contextgrounding_retrieve_by_id" , run_type = "uipath" )
315- @deprecated ("Use retrieve_async instead" )
316- async def retrieve_by_id_async (
317- self ,
318- id : str ,
319- folder_key : Optional [str ] = None ,
320- folder_path : Optional [str ] = None ,
321- ) -> Any :
302+ async def retrieve_by_id_async (self , id : str ) -> Any :
322303 """Retrieve asynchronously context grounding index information by its ID.
323304
324305 This method provides direct access to a context index using its unique
325306 identifier, which can be more efficient than searching by name.
326307
327308 Args:
328309 id (str): The unique identifier of the context index.
329- folder_key (Optional[str]): The key of the folder where the index resides.
330- folder_path (Optional[str]): The path of the folder where the index resides.
331310
332311 Returns:
333312 Any: The index information, including its configuration and metadata.
334313 """
335- spec = self ._retrieve_by_id_spec (
336- id ,
337- folder_key = folder_key ,
338- folder_path = folder_path ,
339- )
314+ spec = self ._retrieve_by_id_spec (id )
340315
341316 response = await self .request_async (
342317 spec .method ,
@@ -402,20 +377,16 @@ def create_index(
402377 return ContextGroundingIndex .model_validate (response .json ())
403378
404379 @resource_override (resource_type = "index" )
405- @traced (name = "contextgrounding_create_jit_index " , run_type = "uipath" )
406- def create_jit_index (
380+ @traced (name = "contextgrounding_create_ephemeral_index " , run_type = "uipath" )
381+ def create_ephemeral_index (
407382 self ,
408383 usage : str ,
409384 attachments : list [uuid .UUID ],
410- folder_key : Optional [str ] = None ,
411- folder_path : Optional [str ] = None ,
412385 ) -> ContextGroundingIndex :
413- """Create a new context jit grounding index."""
414- spec = self ._create_jit_spec (
386+ """Create a new context ephemeral grounding index."""
387+ spec = self ._create_ephemeral_spec (
415388 usage ,
416389 attachments ,
417- folder_path = folder_path ,
418- folder_key = folder_key ,
419390 )
420391
421392 response = self .request (
@@ -1226,19 +1197,15 @@ def _create_spec(
12261197 },
12271198 )
12281199
1229- def _create_jit_spec (
1200+ def _create_ephemeral_spec (
12301201 self ,
12311202 usage : str ,
12321203 attachments : list [uuid .UUID ] = None ,
1233- folder_key : Optional [str ] = None ,
1234- folder_path : Optional [str ] = None ,
12351204 ) -> RequestSpec :
12361205 """Create request spec for index creation."""
1237- folder_key = self ._resolve_folder_key ( folder_key , folder_path )
1206+ data_source_dict = self ._build_ephemeral_data_source ( attachments )
12381207
1239- data_source_dict = self ._build_jit_data_source (attachments )
1240-
1241- payload = CreateJitIndexPayload (
1208+ payload = CreateEphemeralIndexPayload (
12421209 usage = usage ,
12431210 data_source = data_source_dict ,
12441211 )
@@ -1247,12 +1214,12 @@ def _create_jit_spec(
12471214 method = "POST" ,
12481215 endpoint = Endpoint ("/ecs_/v2/indexes/createephemeral" ),
12491216 json = payload .model_dump (by_alias = True , exclude_none = True ),
1250- headers = {
1251- ** header_folder (folder_key , None ),
1252- },
1217+ headers = {},
12531218 )
12541219
1255- def _build_jit_data_source (self , attachments : list [uuid .UUID ]) -> Dict [str , Any ]:
1220+ def _build_ephemeral_data_source (
1221+ self , attachments : list [uuid .UUID ]
1222+ ) -> Dict [str , Any ]:
12561223 data_source : AttachmentsDataSource
12571224 data_source = AttachmentsDataSource (attachments = attachments )
12581225 return data_source .model_dump (
@@ -1329,20 +1296,11 @@ def _build_data_source(self, source: SourceConfig) -> Dict[str, Any]:
13291296
13301297 return data_source .model_dump (by_alias = True , exclude_none = True )
13311298
1332- def _retrieve_by_id_spec (
1333- self ,
1334- id : str ,
1335- folder_key : Optional [str ] = None ,
1336- folder_path : Optional [str ] = None ,
1337- ) -> RequestSpec :
1338- folder_key = self ._resolve_folder_key (folder_key , folder_path )
1339-
1299+ def _retrieve_by_id_spec (self , id : str ) -> RequestSpec :
13401300 return RequestSpec (
13411301 method = "GET" ,
13421302 endpoint = Endpoint (f"/ecs_/v2/indexes/{ id } " ),
1343- headers = {
1344- ** header_folder (folder_key , None ),
1345- },
1303+ headers = {},
13461304 )
13471305
13481306 def _delete_by_id_spec (
0 commit comments