Skip to main content
Simple Q&A agent powered by DSPy framework.

Code

How It Works

Instructions
  • Defines agent through DSPy Signature class
  • Provides clear and concise answers to questions
  • Uses structured prompting for consistent responses
  • Maintains helpful and informative tone
Tools
  • dspy.Signature: Typed prompt template for Q&A
  • dspy.Predict: Program execution framework
  • dspy.LM: Language model configuration
Model
  • gpt-4o-mini: Cost-effective model for Q&A
  • Via OpenAI-compatible API integration
  • Configurable through DSPy LM configuration

Dependencies

Environment Setup

Create .env file:

Run

Examples:
  • “What are the main benefits of using DSPy for prompting?”
  • “How do I create a DSPy signature for my function?”
  • “What are the key components of DSPy?”

Example API Calls

Frontend Setup

Open http://localhost:5173 and try to chat with the DSPy agent