|
11 | 11 | "The optimization process uses a multi-agent approach with specialized AI agents collaborating to analyze and rewrite prompts. The system automatically identifies and addresses several types of common issues:\n",
|
12 | 12 | "\n",
|
13 | 13 | "- **Contradictions** in the prompt instructions\n",
|
14 |
| - "- **Missing or unclear format specifications**\n", |
| 14 | + "- Missing or unclear **format specifications**\n", |
15 | 15 | "- **Inconsistencies** between the prompt and few-shot examples\n",
|
16 | 16 | "\n",
|
17 | 17 | "---\n",
|
18 | 18 | "\n",
|
19 |
| - "**Objective**: This notebook demonstrates best practices of creating a useful and robust agent system and can help you develop more effective prompts for your applications.\n", |
| 19 | + "**Objective**: This notebook demonstrates best practices for creating a useful and robust agent system and can help you develop more effective prompts for your applications.\n", |
20 | 20 | "\n",
|
21 | 21 | "**Cookbook Structure** \n",
|
22 | 22 | "This notebook follows this structure:\n",
|
23 | 23 | "\n",
|
24 |
| - "- [Step 1. System Overview](#1.-system-overview) - Learn how the prompt optimization system works \n", |
25 |
| - "- [Step 2. Data Models](#2.-data-models) - Understand the data structures used by the system\n", |
26 |
| - "- [Step 3. Defining the Agents](#3.-defining-the-agents) - Look at agents that analyze and improve prompts\n", |
27 |
| - "- [Step 4. Run Optimization Workflow](#4.run-optimization-workflow) - See how the system processes prompts\n", |
28 |
| - "- [Step 5. Examples](#5.-examples) - Explore real-world examples of prompt optimization\n", |
| 24 | + "- [Step 1. System Overview](#1-system-overview) - Learn how the prompt optimization system works \n", |
| 25 | + "- [Step 2. Data Models](#2-data-models) - Understand the data structures used by the system\n", |
| 26 | + "- [Step 3. Defining the Agents](#3-defining-the-agents) - Look at agents that analyze and improve prompts\n", |
| 27 | + "- [Step 4. Run Optimization Workflow](#4-run-optimization-workflow) - See how the workflow hands off the prompts\n", |
| 28 | + "- [Step 5. Examples](#5-examples) - Explore real-world examples of prompt optimization\n", |
29 | 29 | "\n",
|
30 | 30 | "**Prerequisites**\n",
|
31 | 31 | "- The `openai` Python package \n",
|
32 | 32 | "- The `openai-agents` package\n",
|
33 |
| - "- An OpenAI API key set as `OPENAI_API_KEY` environment variable" |
| 33 | + "- An OpenAI API key set as `OPENAI_API_KEY` in your environment variables" |
34 | 34 | ]
|
35 | 35 | },
|
36 | 36 | {
|
|
39 | 39 | "source": [
|
40 | 40 | "## 1. System Overview\n",
|
41 | 41 | "\n",
|
42 |
| - "The prompt optimization system uses a collaborative multi-agent approach to analyze and improve prompts. Each agent specializes in detecting a specific type of issue:\n", |
| 42 | + "The prompt optimization system uses a collaborative multi-agent approach to analyze and improve prompts. Each agent specializes in detecting or rewriting a specific type of issue:\n", |
43 | 43 | "\n",
|
44 | 44 | "1. **Dev-Contradiction-Checker**: Scans the prompt for logical contradictions or impossible instructions, like \"only use positive numbers\" and \"include negative examples\" in the same prompt.\n",
|
45 | 45 | "\n",
|
|
373 | 373 | "cell_type": "markdown",
|
374 | 374 | "metadata": {},
|
375 | 375 | "source": [
|
376 |
| - "## 4.Run Optimization Workflow\n", |
| 376 | + "## 4. Run Optimization Workflow\n", |
377 | 377 | "\n",
|
378 | 378 | "Let's dive into how the optimization system actually works. The core workflow consists of multiple runs of the agents in parallel to efficiently process and optimize prompts."
|
379 | 379 | ]
|
|
600 | 600 | "cell_type": "markdown",
|
601 | 601 | "metadata": {},
|
602 | 602 | "source": [
|
603 |
| - "This demonstrates how the system can detect and resolve critical contradictions that could lead to inconsistent outputs or confusion for the AI model. " |
| 603 | + "This demonstrates how the system can detect and resolve critical contradictions that could lead to inconsistent outputs or confusion for the model. " |
604 | 604 | ]
|
605 | 605 | },
|
606 | 606 | {
|
|
678 | 678 | "cell_type": "markdown",
|
679 | 679 | "metadata": {},
|
680 | 680 | "source": [
|
681 |
| - "This is particularly important because few-shot examples have a strong influence on how models respond. If examples don't follow the stated rules, the model may learn to ignore those rules in favor of mimicking the examples. By ensuring consistency between the prompt instructions and examples, the optimization system created a more reliable prompt." |
| 681 | + "This is particularly important because few-shot examples have a strong influence on how models respond. If examples don't follow the stated rules, the model may learn to ignore those rules in favor of mimicking the examples. By ensuring consistency between the prompt instructions and examples, the optimization system creats a more reliable prompt." |
682 | 682 | ]
|
683 | 683 | },
|
684 | 684 | {
|
|
0 commit comments