dspy-labeled-few-shot

Installation
SKILL.md

Hand-Picked Demonstrations with dspy.LabeledFewShot

Guide the user through using dspy.LabeledFewShot -- the simplest DSPy optimizer. It takes labeled examples you provide and attaches them as few-shot demonstrations to your program's predictors. No bootstrapping, no metric, no LM calls during optimization.

Step 1 — Gather context

Before writing code, ask:

  1. How many hand-picked examples do you have? This sets a good k value — typically 25-50% of trainset size, capped at the default of 16.
  2. Are these examples hand-curated or programmatically generated? If generated, dspy.BootstrapFewShot may be better — it evaluates examples against a metric and keeps only the ones that help.
  3. Does your program have multiple predictors with different signatures? Every predictor gets the same demos, so all fields across all signatures must exist in the training examples.
  4. Have you measured zero-shot accuracy yet? Useful to know the baseline before adding demonstrations.

What is LabeledFewShot

dspy.LabeledFewShot is an optimizer that takes a set of labeled training examples and injects them directly as few-shot demonstrations into every predictor in your DSPy program.

Installs
7
GitHub Stars
11
First Seen
Mar 17, 2026
dspy-labeled-few-shot — lebsral/dspy-programming-not-prompting-lms-skills