Skip to content

Commit 51870e8

Browse files
nagkumar91Nagkumar ArkalgudNagkumar ArkalgudNagkumar Arkalgud
authored
Simulator task free mode (Azure#38858)
* Update task_query_response.prompty remove required keys * Update task_simulate.prompty * Update task_query_response.prompty * Update task_simulate.prompty * Fix the api_key needed * Update for release * Black fix for file * Add original text in global context * Update test * Update the indirect attack simulator * Black suggested fixes * Update simulator prompty * Update adversarial scenario enum to exclude XPIA * Update changelog * Black fixes * Remove duplicate import * Fix the mypy error * Mypy please be happy * Updates to non adv simulator * accept context from assistant messages, exclude them when using them for conversation * update changelog * pylint fixes * pylint fixes * remove redundant quotes * Fix typo * pylint fix * Update broken tests * Include the grounding json in the manifest * Fix typo * Come on package * Release 1.0.0b5 * Notice from Chang * Remove adv_conv template parameters from the outputs * Update chanagelog * Experimental tags on adv scenarios * Readme fix onbreaking change * Add the category and both user and assistant context to the response of qr_json_lines * Update changelog * Rename _kwargs to _options * _options as prefix * update troubleshooting for simulator * Rename according to suggestions * Clean up readme * more links * Bugfix: zip_longest created null parameters * Updated changelog * zip does the job * remove ununsed import * Update simulator to work with task free mode * Update changelog * black fixes --------- Co-authored-by: Nagkumar Arkalgud <[email protected]> Co-authored-by: Nagkumar Arkalgud <[email protected]> Co-authored-by: Nagkumar Arkalgud <[email protected]>
1 parent 8c18f91 commit 51870e8

File tree

2 files changed

+24
-13
lines changed

2 files changed

+24
-13
lines changed

sdk/evaluation/azure-ai-evaluation/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
### Breaking Changes
88

99
### Bugs Fixed
10+
- Removed `[remote]` extra. This is no longer needed when tracking results in Azure AI Studio.
11+
- Fixed `AttributeError: 'NoneType' object has no attribute 'get'` while running simulator with 1000+ results
12+
- Fixed the non adversarial simulator to run in task-free mode
1013

1114
### Other Changes
1215

sdk/evaluation/azure-ai-evaluation/azure/ai/evaluation/simulator/_simulator.py

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ async def __call__(
157157
f"You have specified 'num_queries' < len('tasks') ({num_queries} < {len(tasks)}). "
158158
f"Only the first {num_queries} lines of the specified tasks will be simulated."
159159
)
160-
num_queries = min(num_queries, len(tasks))
160+
161161
max_conversation_turns *= 2 # account for both user and assistant turns
162162

163163
prompty_model_config = self.model_config
@@ -586,7 +586,10 @@ async def _create_conversations_from_query_responses(
586586
for i, query_response_pair in enumerate(query_responses):
587587
query = query_response_pair["q"]
588588
response = query_response_pair["r"]
589-
task = tasks[i]
589+
try:
590+
task = tasks[i]
591+
except IndexError:
592+
task = None
590593

591594
conversation = await self._complete_conversation(
592595
conversation_starter=query,
@@ -621,7 +624,7 @@ async def _complete_conversation(
621624
*,
622625
conversation_starter: str,
623626
max_conversation_turns: int,
624-
task: str,
627+
task: Optional[str],
625628
user_simulator_prompty: Optional[str],
626629
user_simulator_prompty_options: Dict[str, Any],
627630
target: Callable,
@@ -659,16 +662,21 @@ async def _complete_conversation(
659662
user_simulator_prompty_options=user_simulator_prompty_options,
660663
)
661664
if len(conversation_history) == 0:
662-
conversation_starter_from_simulated_user = await user_flow(
663-
task=task,
664-
conversation_history=[
665-
{
666-
"role": "assistant",
667-
"content": conversation_starter,
668-
}
669-
],
670-
action="rewrite the assistant's message as you have to accomplish the task by asking the right questions. Make sure the original question is not lost in your rewrite.",
671-
)
665+
if task:
666+
conversation_starter_from_simulated_user = await user_flow(
667+
task=task,
668+
conversation_history=[
669+
{
670+
"role": "assistant",
671+
"content": conversation_starter,
672+
}
673+
],
674+
action="rewrite the assistant's message as you have to accomplish the task by asking the right questions. Make sure the original question is not lost in your rewrite.",
675+
)
676+
else:
677+
conversation_starter_from_simulated_user = {
678+
"content": conversation_starter,
679+
}
672680
else:
673681
conversation_starter_from_simulated_user = await user_flow(
674682
task=task,

0 commit comments

Comments
 (0)