Skip to content

OpenAI + LiteLLM: trace new decisions API #921

Description

OpenAI 3.26.0 added client.decisions.create (sync + async). It calls a model and returns usage, including cached, cache-write and reasoning tokens. LiteLLM 1.105.0 added matching litellm.decisions() / litellm.adecisions() (litellm/decisions/main.py).

Neither is traced today, so these calls produce no LLM spans.

Proposed change

  • py/src/braintrust/integrations/openai/: patch Decisions.create and AsyncDecisions.create to emit an LLM span, reusing the existing usage parsing.
  • py/src/braintrust/integrations/litellm/patchers.py: add patchers for decisions / adecisions.
  • Add cassette-backed tests for both, gated on the version that introduced the API (see integrations/versioning.py).

Found while reviewing the dependency bumps in #911 (openai 3.24.0 → 3.29.0, litellm 1.104.0 → 1.105.0).

Metadata

Metadata

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions