You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs(gepa): revise ReAct metric example to be general and extensible
Replace prescriptive 'minimize tool calls' example with educational progression
that shows users how to write effective metrics without forcing specific objectives.
Changes:
- Show simple metric first (just correctness feedback)
- Then show trajectory-based metric (accessing agent execution)
- Use clear for-loop instead of list comprehension for readability
- Follow DSPy docs conventions: answer_match variable, example/pred naming
- Remove 'minimize tool calls' directive - let users decide their objectives
- Add bullet points explaining what trajectory can reveal (tool selection,
reasoning quality, efficiency) without prescribing how to use it
- Rename section to 'Writing Metrics for ReAct Optimization' (more actionable)
This aligns with GEPA's philosophy: provide general, extensible patterns that
users can adapt to their specific needs. Detailed examples can be shown in
tutorials rather than API documentation.
Addresses PR comment #5 about prescriptive objectives in documentation.
Copy file name to clipboardExpand all lines: docs/docs/api/optimizers/GEPA/GEPA_Advanced.md
+45-24Lines changed: 45 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -507,41 +507,62 @@ class GenerateImprovedReActDescriptionsFromFeedback(dspy.Signature):
507
507
508
508
The reflection LM receives all current components and execution traces, then decides which components to improve. Tool-specific fields (`improved_tool_{name}_desc`, `improved_tool_{name}_arg_{param}_desc`) are generated dynamically for each tool and parameter.
509
509
510
-
**Example: Writing Effective Metrics**
510
+
**Writing Metrics for ReAct Optimization**
511
511
512
-
To help GEPA optimize ReAct modules, write metrics that provide trajectory feedback:
512
+
GEPA optimizes ReAct modules more effectively when metrics provide feedback about the agent's execution. Here's how to write metrics that help:
Correct Answer. Used 2 tool calls: web_search, summarize. Try to minimize tool calls.
541
-
Wrong Answer. Used 5 tool calls: web_search, web_search, read_file, web_search, read_file. Try to minimize tool calls.
542
-
```
559
+
The trajectory contains the agent's step-by-step execution. Use it to provide feedback about:
560
+
561
+
-**Tool selection**: Were appropriate tools chosen?
562
+
-**Reasoning quality**: Did the agent think through the problem?
563
+
-**Efficiency**: Were there unnecessary steps?
543
564
544
-
This feedback helps GEPA learn to reduce unnecessary tool calls while maintaining correct outputs. The reflection LM uses these insights to jointly improve react instructions, tool descriptions, and extraction logic.
565
+
The reflection LM uses your feedback to jointly improve react instructions, tool descriptions, and extraction logic.
0 commit comments