How DSPy components work
mainDSPy provides several core abstractions for building language model programs:
- Signature: Defines the input/output schema for a task. It enables structured data handling and supports type hints and documentation.
- Predict: A simple prediction interface for direct question-answering with minimal configuration.
- ChainOfThought: Used for complex reasoning tasks. It breaks problems down into steps and provides a transparent reasoning process.
- ReAct: Combines reasoning and actions, allowing for the integration of custom tools (useful for interactive tasks).
- Prediction: An object that stores and manages LLM response outputs. It provides access to step-by-step reasoning, intermediate thoughts, final answers, and multiple model completions.
- MultiChainComparison: Compares multiple reasoning attempts and aggregates different model outputs to provide robust final answers.
- Parallel: Enables concurrent processing of tasks with configurable thread counts, error handling, and progress tracking.