mirror of
https://github.com/wshobson/agents.git
synced 2026-03-18 17:47:16 +00:00
style: format all files with prettier
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
## Systematic Refinement Process
|
||||
|
||||
### 1. Baseline Establishment
|
||||
|
||||
```python
|
||||
def establish_baseline(prompt, test_cases):
|
||||
results = {
|
||||
@@ -26,6 +27,7 @@ def establish_baseline(prompt, test_cases):
|
||||
```
|
||||
|
||||
### 2. Iterative Refinement Workflow
|
||||
|
||||
```
|
||||
Initial Prompt → Test → Analyze Failures → Refine → Test → Repeat
|
||||
```
|
||||
@@ -64,6 +66,7 @@ class PromptOptimizer:
|
||||
```
|
||||
|
||||
### 3. A/B Testing Framework
|
||||
|
||||
```python
|
||||
class PromptABTest:
|
||||
def __init__(self, variant_a, variant_b):
|
||||
@@ -116,6 +119,7 @@ class PromptABTest:
|
||||
## Optimization Strategies
|
||||
|
||||
### Token Reduction
|
||||
|
||||
```python
|
||||
def optimize_for_tokens(prompt):
|
||||
optimizations = [
|
||||
@@ -144,6 +148,7 @@ def optimize_for_tokens(prompt):
|
||||
```
|
||||
|
||||
### Latency Reduction
|
||||
|
||||
```python
|
||||
def optimize_for_latency(prompt):
|
||||
strategies = {
|
||||
@@ -167,6 +172,7 @@ def optimize_for_latency(prompt):
|
||||
```
|
||||
|
||||
### Accuracy Improvement
|
||||
|
||||
```python
|
||||
def improve_accuracy(prompt, failure_cases):
|
||||
improvements = []
|
||||
@@ -194,6 +200,7 @@ def improve_accuracy(prompt, failure_cases):
|
||||
## Performance Metrics
|
||||
|
||||
### Core Metrics
|
||||
|
||||
```python
|
||||
class PromptMetrics:
|
||||
@staticmethod
|
||||
@@ -230,6 +237,7 @@ class PromptMetrics:
|
||||
```
|
||||
|
||||
### Automated Evaluation
|
||||
|
||||
```python
|
||||
def evaluate_prompt_comprehensively(prompt, test_suite):
|
||||
results = {
|
||||
@@ -274,6 +282,7 @@ def evaluate_prompt_comprehensively(prompt, test_suite):
|
||||
## Failure Analysis
|
||||
|
||||
### Categorizing Failures
|
||||
|
||||
```python
|
||||
class FailureAnalyzer:
|
||||
def categorize_failures(self, test_results):
|
||||
@@ -326,6 +335,7 @@ class FailureAnalyzer:
|
||||
## Versioning and Rollback
|
||||
|
||||
### Prompt Version Control
|
||||
|
||||
```python
|
||||
class PromptVersionControl:
|
||||
def __init__(self, storage_path):
|
||||
@@ -381,24 +391,28 @@ class PromptVersionControl:
|
||||
## Common Optimization Patterns
|
||||
|
||||
### Pattern 1: Add Structure
|
||||
|
||||
```
|
||||
Before: "Analyze this text"
|
||||
After: "Analyze this text for:\n1. Main topic\n2. Key arguments\n3. Conclusion"
|
||||
```
|
||||
|
||||
### Pattern 2: Add Examples
|
||||
|
||||
```
|
||||
Before: "Extract entities"
|
||||
After: "Extract entities\\n\\nExample:\\nText: Apple released iPhone\\nEntities: {company: Apple, product: iPhone}"
|
||||
```
|
||||
|
||||
### Pattern 3: Add Constraints
|
||||
|
||||
```
|
||||
Before: "Summarize this"
|
||||
After: "Summarize in exactly 3 bullet points, 15 words each"
|
||||
```
|
||||
|
||||
### Pattern 4: Add Verification
|
||||
|
||||
```
|
||||
Before: "Calculate..."
|
||||
After: "Calculate... Then verify your calculation is correct before responding."
|
||||
|
||||
Reference in New Issue
Block a user