Skip to content

Dspy module#44

Open
lukewma-aws wants to merge 11 commits intoaws-samples:mainfrom
lukewma-aws:dspy-module
Open

Dspy module#44
lukewma-aws wants to merge 11 commits intoaws-samples:mainfrom
lukewma-aws:dspy-module

Conversation

@lukewma-aws
Copy link
Copy Markdown

@lukewma-aws lukewma-aws commented Apr 2, 2026

Issue #, if available:

Description of changes: introducing the dspy module for learning evals

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Shivi Ummat and others added 11 commits March 26, 2026 22:59
…s 10-15

- Replace meeting transcript dataset with city_pop.csv (shared across workshop)
- Rewrite sections 1-9: CityQA signature, numeric % error metric (5%/10% thresholds)
- Implement section 10: inspect optimized demos + full prompt
- Implement section 11: save/load optimized program as JSON artifact
- Implement section 12: ChainOfThought with reasoning field
- Implement section 13: CityExpert dspy.Module + optimize
- Implement section 14: LLM-as-judge faithfulness metric
- Implement section 15: comparison table across all approaches
- Remove meetings.json and generate_data.py
- Update README and requirements.txt
…ders, failure paths

Structural:
- Add 3-act structure + coda with explicit headers
- Move §10-11 into Act 2, mark §13-14 as stretch goals
- Add skepticism beat ('Trust, but verify') after optimization
- Add §8b metric debugging section with edge case demos
- Add optimizer failure warning

Tone:
- Rewrite all section headers to problem-statement format
- Apply problem → mechanism → name language pattern throughout
- Add 'Why not just write a prompt?' framing in intro
- New takeaway: 'Define what good looks like, measure it, and let the machine write the prompt for you'
- Inline cross-references to Module 02, 03, 05-03

Code fixes:
- Wrap all evaluator() calls with float() for EvaluationResult safety
- Consistent :.2f formatting on all score outputs
- Add round-trip assertion in save/load section
- Pin dspy>=3.1 in pip install and requirements.txt

42 cells (was 34): 25 markdown + 17 code
Blockers fixed:
- Add try/except with troubleshooting steps on Bedrock connection (§2)
- Add retry_on_throttle() helper with exponential backoff for ThrottlingException (§9, §13)
- Add super().__init__() to CityExpert module (§13)
- Add guard cell in §15 — gracefully handles skipped sections via globals()
- Show 3 predictions in §6 with error % and status markers
- Add failure analysis in §8 — shows worst failures with 'find errors, not scores'
- Document IAM permissions (bedrock-runtime:InvokeModel) in README

Improvements:
- Add cost + runtime estimates to §9, §13, §14 markdown
- Add Bedrock Evals vs DSPy Evaluate distinction in §8
- Add tradeoff table in §15 (accuracy/latency/cost/debuggability/portability)
- Add customer objection FAQ in conclusion (model updates, production use, Bedrock Prompt Mgmt)
- Add model compatibility note in §2 (Nova, Claude, Llama)

43 cells (was 42): 25 markdown + 18 code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant