Resources

Resources

Comprehensive collection of tools, examples, and learning materials for dspy-go.


Official Resources

Documentation

Tools


Examples

Core Examples

Quick Start

Advanced Features

Multimodal

  • Multimodal Processing - Image analysis and vision Q&A
    • Image analysis with questions
    • Vision question answering
    • Multimodal chat
    • Streaming multimodal content
    • Multiple image comparison

Optimizers

Agent Patterns

  • Agent Examples - Various agent implementations
    • ReAct pattern
    • Orchestrator pattern
    • Memory management

Production Applications

Maestro - Code Review Agent

GitHub: XiaoConstantine/maestro

A production code review and question-answering agent built with dspy-go. Demonstrates:

  • RAG pipeline implementation
  • Tool integration (MCP)
  • Smart tool registry usage
  • Production deployment patterns

Key Features

  • πŸ” Automated code review
  • πŸ’¬ Natural language Q&A about codebases
  • πŸ”§ MCP tool integration
  • πŸ“Š Performance optimization with MIPRO

Learning Materials

Video Tutorials

Coming soon! Check the GitHub repository for announcements.

Blog Posts & Articles

  • Introduction to DSPy - Original DSPy paper
  • Building LLM Applications with Go (coming soon)
  • Prompt Optimization Strategies (coming soon)

Community Examples

Check GitHub Discussions for community-contributed examples and patterns.


Datasets

Built-in Dataset Support

dspy-go includes automatic downloading and management for popular datasets:

GSM8K - Grade School Math

import "github.com/XiaoConstantine/dspy-go/pkg/datasets"

// Automatically downloads if not present
gsm8kPath, err := datasets.EnsureDataset("gsm8k")
dataset, err := datasets.LoadGSM8K(gsm8kPath)

Use for: Math reasoning, chain-of-thought, optimization

HotPotQA - Multi-hop Question Answering

hotpotPath, err := datasets.EnsureDataset("hotpotqa")
dataset, err := datasets.LoadHotPotQA(hotpotPath)

Use for: Multi-step reasoning, RAG pipelines, complex Q&A

Custom Datasets

// Create in-memory dataset
dataset := datasets.NewInMemoryDataset()
dataset.AddExample(map[string]interface{}{
    "question": "What is the capital of France?",
    "answer": "Paris",
})

LLM Provider Setup

Google Gemini

export GEMINI_API_KEY="your-api-key"
  • βœ… Multimodal support (images)
  • βœ… Fast responses
  • βœ… Good for prototyping

Get API Key β†’

OpenAI

export OPENAI_API_KEY="your-api-key"
  • βœ… GPT-4, GPT-3.5
  • βœ… Reliable performance
  • βœ… Well-documented

Get API Key β†’

Anthropic Claude

export ANTHROPIC_API_KEY="your-api-key"
  • βœ… Long context windows
  • βœ… Strong reasoning
  • βœ… Safety features

Get API Key β†’

Ollama (Local)

# Install Ollama
curl -fsSL https://ollama.com/install.sh | sh

# Pull a model
ollama pull llama2

# Set base URL
export OLLAMA_BASE_URL="http://localhost:11434"
  • βœ… Free, local execution
  • βœ… Privacy (no data leaves your machine)
  • βœ… No API costs

Install Ollama β†’


Development Tools

IDE Extensions

Testing & Debugging

// Enable detailed tracing
ctx = core.WithExecutionState(context.Background())

// Execute your program
result, err := program.Execute(ctx, inputs)

// Inspect trace
executionState := core.GetExecutionState(ctx)
steps := executionState.GetSteps("moduleId")
for _, step := range steps {
    fmt.Printf("Duration: %s\n", step.Duration)
    fmt.Printf("Prompt: %s\n", step.Prompt)
    fmt.Printf("Response: %s\n", step.Response)
}

Monitoring

import "github.com/XiaoConstantine/dspy-go/pkg/logging"

// Configure logging
logger := logging.NewLogger(logging.Config{
    Severity: logging.DEBUG,
    Outputs:  []logging.Output{logging.NewConsoleOutput(true)},
})
logging.SetLogger(logger)

Community & Support

Get Help

Contributing

Stay Updated


MCP (Model Context Protocol)

DSPy Ecosystem


Benchmarks & Performance

Compatibility Results

dspy-go maintains compatibility with Python DSPy implementations. See:

Performance Metrics

  • Parallel processing can improve throughput by 3-4x
  • Smart Tool Registry adds < 50ms overhead
  • Optimization times vary by optimizer (see Optimizers Guide)

Tips & Best Practices

Getting Started

  1. βœ… Start with BootstrapFewShot optimizer
  2. βœ… Use clear, detailed field descriptions
  3. βœ… Test with small datasets first
  4. βœ… Enable logging during development

Production Readiness

  1. βœ… Use train/validation splits
  2. βœ… Monitor performance metrics
  3. βœ… Implement error handling
  4. βœ… Cache results where possible
  5. βœ… Use Parallel module for batches

Optimization

  1. βœ… Aim for 50+ training examples
  2. βœ… Balance dataset (don’t skew toward one class)
  3. βœ… Start simple, then optimize
  4. βœ… Validate on held-out data

Next Steps