@@ -361,6 +361,62 @@ async def retrieve_async(
361361 except StopIteration as e :
362362 raise Exception ("ContextGroundingIndex not found" ) from e
363363
364+ @traced (name = "contextgrounding_list" , run_type = "uipath" )
365+ def list (
366+ self ,
367+ folder_key : Optional [str ] = None ,
368+ folder_path : Optional [str ] = None ,
369+ ) -> List [ContextGroundingIndex ]:
370+ """List all context grounding indexes in a folder.
371+
372+ Args:
373+ folder_key (Optional[str]): The key of the folder to list indexes from.
374+ folder_path (Optional[str]): The path of the folder to list indexes from.
375+
376+ Returns:
377+ List[ContextGroundingIndex]: All indexes in the folder.
378+ """
379+ folder_key = self ._resolve_folder_key (folder_key , folder_path )
380+ response = self .request (
381+ "GET" ,
382+ Endpoint ("/ecs_/v2/indexes" ),
383+ params = {"$expand" : "dataSource" },
384+ headers = {** header_folder (folder_key , None )},
385+ ).json ()
386+ return [
387+ ContextGroundingIndex .model_validate (item )
388+ for item in response .get ("value" , [])
389+ ]
390+
391+ @traced (name = "contextgrounding_list" , run_type = "uipath" )
392+ async def list_async (
393+ self ,
394+ folder_key : Optional [str ] = None ,
395+ folder_path : Optional [str ] = None ,
396+ ) -> List [ContextGroundingIndex ]:
397+ """Asynchronously list all context grounding indexes in a folder.
398+
399+ Args:
400+ folder_key (Optional[str]): The key of the folder to list indexes from.
401+ folder_path (Optional[str]): The path of the folder to list indexes from.
402+
403+ Returns:
404+ List[ContextGroundingIndex]: All indexes in the folder.
405+ """
406+ folder_key = self ._resolve_folder_key (folder_key , folder_path )
407+ response = (
408+ await self .request_async (
409+ "GET" ,
410+ Endpoint ("/ecs_/v2/indexes" ),
411+ params = {"$expand" : "dataSource" },
412+ headers = {** header_folder (folder_key , None )},
413+ )
414+ ).json ()
415+ return [
416+ ContextGroundingIndex .model_validate (item )
417+ for item in response .get ("value" , [])
418+ ]
419+
364420 @traced (name = "contextgrounding_retrieve_by_id" , run_type = "uipath" )
365421 def retrieve_by_id (
366422 self ,
@@ -542,7 +598,7 @@ async def create_index_async(
542598 @resource_override (resource_type = "index" )
543599 @traced (name = "contextgrounding_create_ephemeral_index" , run_type = "uipath" )
544600 def create_ephemeral_index (
545- self , usage : EphemeralIndexUsage , attachments : list [str ]
601+ self , usage : EphemeralIndexUsage , attachments : List [str ]
546602 ) -> ContextGroundingIndex :
547603 """Create a new ephemeral context grounding index.
548604
@@ -570,7 +626,7 @@ def create_ephemeral_index(
570626 @resource_override (resource_type = "index" )
571627 @traced (name = "contextgrounding_create_ephemeral_index" , run_type = "uipath" )
572628 async def create_ephemeral_index_async (
573- self , usage : EphemeralIndexUsage , attachments : list [str ]
629+ self , usage : EphemeralIndexUsage , attachments : List [str ]
574630 ) -> ContextGroundingIndex :
575631 """Create a new ephemeral context grounding index.
576632
@@ -661,7 +717,7 @@ def start_batch_transform(
661717 self ,
662718 name : str ,
663719 prompt : Annotated [str , Field (max_length = 250000 )],
664- output_columns : list [BatchTransformOutputColumn ],
720+ output_columns : List [BatchTransformOutputColumn ],
665721 storage_bucket_folder_path_prefix : Annotated [
666722 str | None , Field (max_length = 512 )
667723 ] = None ,
@@ -737,7 +793,7 @@ async def start_batch_transform_async(
737793 self ,
738794 name : str ,
739795 prompt : Annotated [str , Field (max_length = 250000 )],
740- output_columns : list [BatchTransformOutputColumn ],
796+ output_columns : List [BatchTransformOutputColumn ],
741797 storage_bucket_folder_path_prefix : Annotated [
742798 str | None , Field (max_length = 512 )
743799 ] = None ,
@@ -813,7 +869,7 @@ async def start_batch_transform_ephemeral(
813869 self ,
814870 name : str ,
815871 prompt : Annotated [str , Field (max_length = 250000 )],
816- output_columns : list [BatchTransformOutputColumn ],
872+ output_columns : List [BatchTransformOutputColumn ],
817873 storage_bucket_folder_path_prefix : Annotated [
818874 str | None , Field (max_length = 512 )
819875 ] = None ,
@@ -859,7 +915,7 @@ async def start_batch_transform_ephemeral_async(
859915 self ,
860916 name : str ,
861917 prompt : Annotated [str , Field (max_length = 250000 )],
862- output_columns : list [BatchTransformOutputColumn ],
918+ output_columns : List [BatchTransformOutputColumn ],
863919 storage_bucket_folder_path_prefix : Annotated [
864920 str | None , Field (max_length = 512 )
865921 ] = None ,
@@ -1741,7 +1797,7 @@ def _create_spec(
17411797 def _create_ephemeral_spec (
17421798 self ,
17431799 usage : str ,
1744- attachments : list [str ],
1800+ attachments : List [str ],
17451801 ) -> RequestSpec :
17461802 """Create request spec for ephemeral index creation.
17471803
@@ -1834,7 +1890,7 @@ def _build_data_source(self, source: SourceConfig) -> Dict[str, Any]:
18341890
18351891 return data_source .model_dump (by_alias = True , exclude_none = True )
18361892
1837- def _build_ephemeral_data_source (self , attachments : list [str ]) -> Dict [str , Any ]:
1893+ def _build_ephemeral_data_source (self , attachments : List [str ]) -> Dict [str , Any ]:
18381894 """Build data source configuration from typed source config.
18391895
18401896 Args:
@@ -2002,7 +2058,7 @@ def _batch_transform_creation_spec(
20022058 index_id : str ,
20032059 name : str ,
20042060 enable_web_search_grounding : bool ,
2005- output_columns : list [BatchTransformOutputColumn ],
2061+ output_columns : List [BatchTransformOutputColumn ],
20062062 storage_bucket_folder_path_prefix : str | None ,
20072063 target_file_name : str | None ,
20082064 prompt : str ,
@@ -2052,7 +2108,7 @@ def _batch_transform_ephemeral_creation_spec(
20522108 index_id : str | None ,
20532109 name : str ,
20542110 enable_web_search_grounding : bool ,
2055- output_columns : list [BatchTransformOutputColumn ],
2111+ output_columns : List [BatchTransformOutputColumn ],
20562112 storage_bucket_folder_path_prefix : str | None ,
20572113 prompt : str ,
20582114 ) -> RequestSpec :
0 commit comments