Share via


AdversarialSimulator Class

Note

This is an experimental class, and may change at any time. Please see https://aka.ms/azuremlexperimental for more information.

Initializes the adversarial simulator with a project scope.

Constructor.

Constructor

AdversarialSimulator(*, azure_ai_project: dict, credential)

Parameters

Name Description
azure_ai_project
Required

The scope of the Azure AI project. It contains subscription id, resource group, and project name.

credential
Required

The credential for connecting to Azure AI project.

Keyword-Only Parameters

Name Description
azure_ai_project
Required
credential
Required

Methods

call_sync

Call the adversarial simulator synchronously. :keyword scenario: Enum value specifying the adversarial scenario used for generating inputs. .. admonition:: Example

  • <xref:azure.ai.evaluation.simulator.adversarial_scenario.AdversarialScenario.ADVERSARIAL_QA>

  • <xref:azure.ai.evaluation.simulator.adversarial_scenario.AdversarialScenario.ADVERSARIAL_CONVERSATION>

call_sync

Call the adversarial simulator synchronously. :keyword scenario: Enum value specifying the adversarial scenario used for generating inputs. .. admonition:: Example

  • <xref:azure.ai.evaluation.simulator.adversarial_scenario.AdversarialScenario.ADVERSARIAL_QA>

  • <xref:azure.ai.evaluation.simulator.adversarial_scenario.AdversarialScenario.ADVERSARIAL_CONVERSATION>

call_sync(*, scenario: AdversarialScenario, max_conversation_turns: int, max_simulation_results: int, target: Callable, api_call_retry_limit: int, api_call_retry_sleep_sec: int, api_call_delay_sec: int, concurrent_async_task: int) -> List[Dict[str, Any]]

Keyword-Only Parameters

Name Description
max_conversation_turns
int

The maximum number of conversation turns to simulate.

max_simulation_results
int

The maximum number of simulation results to return.

target

The target function to simulate adversarial inputs against.

api_call_retry_limit
int

The maximum number of retries for each API call within the simulation.

api_call_retry_sleep_sec
int

The sleep duration (in seconds) between retries for API calls.

api_call_delay_sec
int

The delay (in seconds) before making an API call.

concurrent_async_task
int

The number of asynchronous tasks to run concurrently during the simulation.

scenario
Required

Returns

Type Description

A list of dictionaries, each representing a simulated conversation.