dspy-advanced-module-composition

Solid

This skill should be used when the user asks to "compose DSPy modules", "use Ensemble optimizer", "combine multiple programs", "use dspy.MultiChainComparison", mentions "ensemble voting", "module composition", "sequential pipelines", or needs to build complex multi-module DSPy programs with ensemble patterns or multi-chain comparison.

AI & Automation 78 stars 10 forks Updated 1 weeks ago MIT

Install

View on GitHub

Quality Score: 90/100

Stars 20%
63
Recency 20%
90
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# DSPy Advanced Module Composition ## Goal Compose complex DSPy programs using the Ensemble optimizer, MultiChainComparison for reasoning synthesis, and sequential module patterns. ## When to Use - Need consensus from multiple approaches - Comparing different reasoning strategies - Building robust pipelines with fallbacks - Complex multi-step workflows with branching - Ensemble methods for improved accuracy ## Related Skills - Design modules: [dspy-custom-module-design](../dspy-custom-module-design/SKILL.md) - Define signatures: [dspy-signature-designer](../dspy-signature-designer/SKILL.md) - Evaluate performance: [dspy-evaluation-suite](../dspy-evaluation-suite/SKILL.md) ## Inputs | Input | Type | Description | |-------|------|-------------| | `modules` | `list[dspy.Module]` | Modules to compose | | `composition_type` | `str` | "ensemble", "sequential", "comparison" | ## Outputs | Output | Type | Description | |--------|------|-------------| | `composed_program` | `dspy.Module` | Composed multi-module program | ## Workflow ### Phase 1: Ensemble Voting Combine multiple programs using the Ensemble optimizer: ```python import dspy from dspy.teleprompt import Ensemble dspy.configure(lm=dspy.LM("openai/gpt-4o-mini")) # Define a signature for the task class BasicQA(dspy.Signature): """Answer questions with short factoid answers.""" question = dspy.InputField() answer = dspy.OutputField() # Create multiple program instances (should be optimized/compiled...

Details

Author
OmidZamani
Repository
OmidZamani/dspy-skills
Created
5 months ago
Last Updated
1 weeks ago
Language
Python
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category