Skip to main content
DSPy is a framework for programming language models rather than relying on static prompts. It enables you to build modular AI systems with code instead of hand-crafted prompting, and it offers methods to automatically optimize these systems. Features
  • Programmatic approach to LLM interactions through Python
  • Modular components for building complex AI pipelines
  • Self-improvement algorithms that optimize prompts and weights
  • Support for various applications from simple classifiers to RAG systems and agent loops

Installing Libraries

Set your Together AI API key:

Example

Setup and connect DSPy to LLMs on Together AI
Now we can set up a DSPy module, like dspy.ReAct with a task-specific signature. For example, question -> answer: float tells the module to take a question and to produce a floating point number answer below.

Next Steps

DSPy - Together AI Notebook

Learn more about building agents using DSPy with Together AI in our notebook.