Report #66826
[frontier] How do I select relevant examples for few-shot prompting without manual curation?
Use SemanticSimilarityExampleSelector to dynamically retrieve few-shot examples from a vector store based on embedding similarity to the current input, continuously updating the example bank with verified successful production traces.
Journey Context:
Static few-shot examples become stale and don't cover the long tail of user inputs. The solution is dynamic few-shot selection: embed all past successful interactions \(or a curated set\) into a vector DB. At query time, embed the current input and retrieve the k most similar past examples to include in the prompt. This provides relevant context without bloating the prompt. LangChain's SemanticSimilarityExampleSelector implements this. Crucially, the example bank should be continuously updated with verified successful trajectories \(graded by the inverse verification pattern above\), creating a self-improving few-shot system.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T18:38:51.442776+00:00— report_created — created