Skip to content

DSPy Integration — Use TruLens Feedback as DSPy Metrics #2420

@joshreini1

Description

@joshreini1

Summary

DSPy is the most popular prompt/pipeline optimizer. TruLens feedback functions are a natural fit as DSPy metrics — users could use TruLens evals (groundedness, relevance, etc.) to drive DSPy's BootstrapFewShotWithRandomSearch, MIPROv2, or BayesianSignatureOptimizer. Today there's no bridge; users have to manually wrap TruLens feedback functions as DSPy metric callables.

What

Create a trulens-integrations-dspy package (or a module in src/feedback/) that provides:

  • TruLensMetric(feedback_fn) — a wrapper that adapts any TruLens feedback function into a DSPy-compatible metric (accepts example, prediction and returns a float)
  • A cookbook showing: define a DSPy module, use TruLens groundedness + relevance as optimization metrics, run BootstrapFewShotWithRandomSearch, compare before/after with the TruLens dashboard
  • Optional: record DSPy optimization traces as TruLens records so users can see which prompt variants were tried

Difficulty

Medium

Metadata

Metadata

Assignees

No one assigned

    Labels

    IntegrationsIntegrations with external tools and frameworksenhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions