Build with DSPy.rb

Choose the smallest execution shape that owns the task. Use Ruby for known sequencing and branches; use a bounded agent when the model has a useful choice among reviewed tools.

Compose a Program

  • Examples defines typed inputs and expected outputs used by composition, evaluation, and optimization.
  • Pipelines composes multiple inference stages with ordinary Ruby control flow.
  • RAG combines retrieval with typed generation.
  • Multimodal Inputs adds images to a typed signature.

Build an Agent

  • Toolsets groups reviewed Ruby operations for a bounded ReAct loop.
  • Stateful Agents keeps conversation state in application-owned storage.

Before choosing an execution shape, learn signatures, predictors, and modules. After the program works, evaluate its behavior.