Skip to content

Commit 0d15ea5

Browse files
Zyysurelyyingyingzhaozyying
authored andcommitted
[fix] optimization agents responses sample (#550)
* [fix] optimization agents responses sample * fix more --------- Co-authored-by: zyysurely <yingyingzhao@microsoft.com>
1 parent 7919a20 commit 0d15ea5

9 files changed

Lines changed: 32 additions & 38 deletions

File tree

Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
model: gpt-4.1-mini
21
instruction_file: instructions.md
3-
skill_dir: ../../skills
2+
skill_dir: ../../skills

samples/python/hosted-agents/bring-your-own/responses/optimization-customer-support/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,11 @@ This sample ships with `eval.yaml` and `eval.jsonl` — run optimization out of
125125
azd ai agent optimize
126126
```
127127

128+
The interactive flow prompts you to select:
129+
130+
- **Eval model** — the model deployment used to score evaluation results (e.g., `gpt-4.1-mini`).
131+
- **Optimization model** — the model deployment used to generate improved candidates (e.g., `gpt-5.4`).
132+
128133
### Monitor progress
129134

130135
```bash
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
{"name": "return_request", "prompt": "I bought a Smart Thermostat two weeks ago and it keeps disconnecting from my WiFi every few hours. I want to return it.", "criteria": [{"name": "mentions_30_day_window", "instruction": "Response must mention that returns are accepted within 30 days of purchase"}, {"name": "empathetic_opening", "instruction": "Response must acknowledge the frustration with the WiFi disconnection issue before discussing the return process"}, {"name": "explains_return_process", "instruction": "Agent must explain the return process including how to ship the item back or return in store"}]}
2-
{"name": "complaint_handling", "prompt": "This is ridiculous. I paid $300 for your Laptop Pro and the battery barely lasts 2 hours. This is completely unacceptable and I want a full refund NOW.", "criteria": [{"name": "empathetic_response", "instruction": "Agent must open with empathy — acknowledging the frustration and validating that 2-hour battery life is not acceptable for a $300 device"}, {"name": "does_not_argue", "instruction": "Agent must NOT argue with the customer, dismiss their concern, or make excuses. Must not say things like 'that's normal' or 'all laptops do that'"}, {"name": "offers_resolution_options", "instruction": "Agent must offer concrete resolution options: refund (within policy), replacement, or technical investigation of the battery issue"}]}
3-
{"name": "out_of_scope_electrical", "prompt": "My Smart Thermostat is making a buzzing noise from the wall wiring behind it. Can you tell me how to fix the wiring?", "criteria": [{"name": "declines_electrical_advice", "instruction": "Agent must NOT provide instructions for working with electrical wiring. Must explicitly decline to give electrical repair guidance"}, {"name": "explains_safety_reason", "instruction": "Agent must explain WHY it cannot help with wiring — because electrical work is a safety hazard that requires a licensed professional"}, {"name": "suggests_professional", "instruction": "Agent must recommend contacting a licensed electrician for the wiring issue"}]}
1+
{"name": "return_request", "query": "I bought a Smart Thermostat two weeks ago and it keeps disconnecting from my WiFi every few hours. I want to return it.", "criteria": [{"name": "mentions_30_day_window", "instruction": "Response must mention that returns are accepted within 30 days of purchase"}, {"name": "empathetic_opening", "instruction": "Response must acknowledge the frustration with the WiFi disconnection issue before discussing the return process"}, {"name": "explains_return_process", "instruction": "Agent must explain the return process including how to ship the item back or return in store"}]}
2+
{"name": "complaint_handling", "query": "This is ridiculous. I paid $300 for your Laptop Pro and the battery barely lasts 2 hours. This is completely unacceptable and I want a full refund NOW.", "criteria": [{"name": "empathetic_response", "instruction": "Agent must open with empathy — acknowledging the frustration and validating that 2-hour battery life is not acceptable for a $300 device"}, {"name": "does_not_argue", "instruction": "Agent must NOT argue with the customer, dismiss their concern, or make excuses. Must not say things like 'that's normal' or 'all laptops do that'"}, {"name": "offers_resolution_options", "instruction": "Agent must offer concrete resolution options: refund (within policy), replacement, or technical investigation of the battery issue"}]}
3+
{"name": "out_of_scope_electrical", "query": "My Smart Thermostat is making a buzzing noise from the wall wiring behind it. Can you tell me how to fix the wiring?", "criteria": [{"name": "declines_electrical_advice", "instruction": "Agent must NOT provide instructions for working with electrical wiring. Must explicitly decline to give electrical repair guidance"}, {"name": "explains_safety_reason", "instruction": "Agent must explain WHY it cannot help with wiring — because electrical work is a safety hazard that requires a licensed professional"}, {"name": "suggests_professional", "instruction": "Agent must recommend contacting a licensed electrician for the wiring issue"}]}

samples/python/hosted-agents/bring-your-own/responses/optimization-customer-support/eval.jsonl

Lines changed: 10 additions & 10 deletions
Large diffs are not rendered by default.
Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
name: customer-support-eval
2-
agent:
3-
name: optimization-customer-support-python-responses
4-
kind: hosted
5-
version: "1"
6-
config: .agent_configs/baseline/metadata.yaml
7-
dataset_file: eval.jsonl
2+
dataset:
3+
local_uri: ./eval.jsonl
84
evaluators:
95
- builtin.task_adherence
10-
options:
11-
eval_model: gpt-4.1-mini
12-
optimization_model: gpt-5.4
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
model: gpt-4.1-mini
2-
instruction_file: instructions.md
1+
instruction_file: instructions.md

samples/python/hosted-agents/bring-your-own/responses/optimization-hello-world/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,11 @@ This sample ships with `eval.yaml` and `eval.jsonl` — everything needed to opt
104104
azd ai agent optimize
105105
```
106106

107+
The interactive flow prompts you to select:
108+
109+
- **Eval model** — the model deployment used to score evaluation results (e.g., `gpt-4.1-mini`).
110+
- **Optimization model** — the model deployment used to generate improved candidates (e.g., `gpt-5.4`).
111+
107112
### Monitor progress
108113

109114
```bash
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
{"name": "explain_rest_api", "prompt": "Explain what a REST API is in simple terms", "criteria": [{"name": "clear_explanation", "instruction": "Response must provide a clear, jargon-free explanation of what a REST API is"}, {"name": "uses_examples", "instruction": "Response must include an analogy or real-world example"}, {"name": "mentions_http", "instruction": "Response must mention HTTP methods (GET, POST, etc.)"}]}
2-
{"name": "version_control_benefits", "prompt": "What are the benefits of using version control?", "criteria": [{"name": "lists_benefits", "instruction": "Response must list at least 3 distinct benefits"}, {"name": "mentions_collaboration", "instruction": "Response must mention how version control helps team collaboration"}, {"name": "mentions_history", "instruction": "Response must mention the ability to track and revert changes"}]}
3-
{"name": "python_error_handling", "prompt": "How do I handle errors in Python?", "criteria": [{"name": "mentions_try_except", "instruction": "Response must explain try/except syntax"}, {"name": "code_example", "instruction": "Response must include a code example"}, {"name": "best_practices", "instruction": "Response must mention when to use exceptions vs other error handling patterns"}]}
1+
{"name": "explain_rest_api", "query": "Explain what a REST API is in simple terms", "criteria": [{"name": "clear_explanation", "instruction": "Response must provide a clear, jargon-free explanation of what a REST API is"}, {"name": "uses_examples", "instruction": "Response must include an analogy or real-world example"}, {"name": "mentions_http", "instruction": "Response must mention HTTP methods (GET, POST, etc.)"}]}
2+
{"name": "version_control_benefits", "query": "What are the benefits of using version control?", "criteria": [{"name": "lists_benefits", "instruction": "Response must list at least 3 distinct benefits"}, {"name": "mentions_collaboration", "instruction": "Response must mention how version control helps team collaboration"}, {"name": "mentions_history", "instruction": "Response must mention the ability to track and revert changes"}]}
3+
{"name": "python_error_handling", "query": "How do I handle errors in Python?", "criteria": [{"name": "mentions_try_except", "instruction": "Response must explain try/except syntax"}, {"name": "code_example", "instruction": "Response must include a code example"}, {"name": "best_practices", "instruction": "Response must mention when to use exceptions vs other error handling patterns"}]}
Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
name: hello-world-eval
2-
agent:
3-
name: optimization-hello-world-python-responses
4-
kind: hosted
5-
version: "1"
6-
config: .agent_configs/baseline/metadata.yaml
7-
dataset_file: eval.jsonl
2+
dataset:
3+
local_uri: ./eval.jsonl
84
evaluators:
95
- builtin.task_adherence
10-
options:
11-
eval_model: gpt-4.1-mini
12-
optimization_model: gpt-5.4

0 commit comments

Comments
 (0)