Skip to content

Context Grounding

ContextGroundingService

Service for managing semantic automation contexts in UiPath.

Context Grounding is a feature that helps in understanding and managing the semantic context in which automation processes operate. It provides capabilities for indexing, retrieving, and searching through contextual information that can be used to enhance AI-enabled automation.

This service requires a valid folder key to be set in the environment, as context grounding operations are always performed within a specific folder context.

add_to_index

add_to_index(
    name,
    content_type,
    blob_file_path,
    content=None,
    source_path=None,
    folder_key=None,
    folder_path=None,
)

Add content to the index.

Parameters:

Name Type Description Default
name str

The name of the index to add content to.

required
content_type str

The type of content being added.

required
blob_file_path str

The path where the blob will be stored in the storage bucket.

required
content Optional[Union[str, bytes]]

The content to be added, either as a string or bytes.

None
source_path Optional[str]

The source path of the content if it is being uploaded from a file.

None
folder_key Optional[str]

The key of the folder where the index resides.

None
folder_path Optional[str]

The path of the folder where the index resides.

None

Raises:

Type Description
ValueError

If neither content nor source_path is provided, or if both are provided.

add_to_index_async async

add_to_index_async(
    name,
    content_type,
    blob_file_path,
    content=None,
    source_path=None,
    folder_key=None,
    folder_path=None,
)

Asynchronously add content to the index.

Parameters:

Name Type Description Default
name str

The name of the index to add content to.

required
content_type str

The type of content being added.

required
blob_file_path str

The path where the blob will be stored in the storage bucket.

required
content Optional[Union[str, bytes]]

The content to be added, either as a string or bytes.

None
source_path Optional[str]

The source path of the content if it is being uploaded from a file.

None
folder_key Optional[str]

The key of the folder where the index resides.

None
folder_path Optional[str]

The path of the folder where the index resides.

None

Raises:

Type Description
ValueError

If neither content nor source_path is provided, or if both are provided.

delete_index

delete_index(index, folder_key=None, folder_path=None)

Delete a context grounding index.

This method removes the specified context grounding index from Orchestrator.

Parameters:

Name Type Description Default
index ContextGroundingIndex

The context grounding index to delete.

required
folder_key Optional[str]

The key of the folder where the index resides.

None
folder_path Optional[str]

The path of the folder where the index resides.

None

delete_index_async async

delete_index_async(
    index, folder_key=None, folder_path=None
)

Asynchronously delete a context grounding index.

This method removes the specified context grounding index from Orchestrator.

Parameters:

Name Type Description Default
index ContextGroundingIndex

The context grounding index to delete.

required
folder_key Optional[str]

The key of the folder where the index resides.

None
folder_path Optional[str]

The path of the folder where the index resides.

None

ingest_data

ingest_data(index, folder_key=None, folder_path=None)

Ingest data into the context grounding index.

Parameters:

Name Type Description Default
index ContextGroundingIndex

The context grounding index to perform data ingestion.

required
folder_key Optional[str]

The key of the folder where the index resides.

None
folder_path Optional[str]

The path of the folder where the index resides.

None

ingest_data_async async

ingest_data_async(index, folder_key=None, folder_path=None)

Asynchronously ingest data into the context grounding index.

Parameters:

Name Type Description Default
index ContextGroundingIndex

The context grounding index to perform data ingestion.

required
folder_key Optional[str]

The key of the folder where the index resides.

None
folder_path Optional[str]

The path of the folder where the index resides.

None

retrieve

retrieve(name, folder_key=None, folder_path=None)

Retrieve context grounding index information by its name.

Parameters:

Name Type Description Default
name str

The name of the context index to retrieve.

required
folder_key Optional[str]

The key of the folder where the index resides.

None
folder_path Optional[str]

The path of the folder where the index resides.

None

Returns:

Name Type Description
ContextGroundingIndex ContextGroundingIndex

The index information, including its configuration and metadata if found.

Raises:

Type Description
Exception

If no index with the given name is found.

retrieve_async async

retrieve_async(name, folder_key=None, folder_path=None)

Asynchronously retrieve context grounding index information by its name.

Parameters:

Name Type Description Default
name str

The name of the context index to retrieve.

required
folder_key Optional[str]

The key of the folder where the index resides.

None
folder_path Optional[str]

The path of the folder where the index resides.

None

Returns:

Name Type Description
ContextGroundingIndex ContextGroundingIndex

The index information, including its configuration and metadata if found.

Raises:

Type Description
Exception

If no index with the given name is found.

retrieve_by_id

retrieve_by_id(id, folder_key=None, folder_path=None)

Retrieve context grounding index information by its ID.

This method provides direct access to a context index using its unique identifier, which can be more efficient than searching by name.

Parameters:

Name Type Description Default
id str

The unique identifier of the context index.

required
folder_key Optional[str]

The key of the folder where the index resides.

None
folder_path Optional[str]

The path of the folder where the index resides.

None

Returns:

Name Type Description
Any Any

The index information, including its configuration and metadata.

retrieve_by_id_async async

retrieve_by_id_async(id, folder_key=None, folder_path=None)

Retrieve asynchronously context grounding index information by its ID.

This method provides direct access to a context index using its unique identifier, which can be more efficient than searching by name.

Parameters:

Name Type Description Default
id str

The unique identifier of the context index.

required
folder_key Optional[str]

The key of the folder where the index resides.

None
folder_path Optional[str]

The path of the folder where the index resides.

None

Returns:

Name Type Description
Any Any

The index information, including its configuration and metadata.

search

search(
    name,
    query,
    number_of_results=10,
    folder_key=None,
    folder_path=None,
)

Search for contextual information within a specific index.

This method performs a semantic search against the specified context index, helping to find relevant information that can be used in automation processes. The search is powered by AI and understands natural language queries.

Parameters:

Name Type Description Default
name str

The name of the context index to search in.

required
query str

The search query in natural language.

required
number_of_results int

Maximum number of results to return. Defaults to 10.

10

Returns:

Type Description
List[ContextGroundingQueryResponse]

List[ContextGroundingQueryResponse]: A list of search results, each containing relevant contextual information and metadata.

search_async async

search_async(
    name,
    query,
    number_of_results=10,
    folder_key=None,
    folder_path=None,
)

Search asynchronously for contextual information within a specific index.

This method performs a semantic search against the specified context index, helping to find relevant information that can be used in automation processes. The search is powered by AI and understands natural language queries.

Parameters:

Name Type Description Default
name str

The name of the context index to search in.

required
query str

The search query in natural language.

required
number_of_results int

Maximum number of results to return. Defaults to 10.

10

Returns:

Type Description
List[ContextGroundingQueryResponse]

List[ContextGroundingQueryResponse]: A list of search results, each containing relevant contextual information and metadata.