Skip to content

[Feature] Asynchronous Batch API support #9102

@rayanehmi

Description

@rayanehmi

What feature would you like to see?

My use-case involves using a GEPA-optimized DSPy module to do tabular prediction. Since I'm independent (and not rich), I'd like to be able to use Asynchronous Batch endpoints (ex. OpenAI Batch API) natively from DSPy to reduce costs on large datasets.

LiteLLM supports using Batch API endpoints (link to docs). I think it would be nice to have something like a module.abatch() method directly from DSPy to be able to use those Batch endpoints.

Pros:

  • Reduce costs for various tasks like pure inference, evaluation and optimization.
  • Bypass rate limits for some providers.

Cons:

  • Variable inference time (15s to a few minutes on my tests).
  • Tricky to do for complex / multi-call modules...

Would you like to contribute?

  • Yes, I'd like to help implement this.
  • No, I just want to request it.

Additional Context

I do have a bloated-but-working implementation (from 5.1-Codex) on my fork along with a demo notebook. It only works for single-call modules as of writing this.

Would absolutely love to contribute to a proper implementation with some guidance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions