openllmetry icon indicating copy to clipboard operation
openllmetry copied to clipboard

Feature: Instrument OpenAI's new Responses API #2782

Open tongyu0924 opened this issue 11 months ago • 3 comments

  • [ ] I have added tests that cover my changes.
  • [ ] If adding a new instrumentation or changing an existing one, I've added screenshots from some observability platform showing the change.
  • [x] PR name follows conventional commits format: feat(instrumentation): ... or fix(instrumentation): ....
  • [ ] (If applicable) I have updated the documentation accordingly.

[!IMPORTANT] Add responses_retrieve_wrapper for OpenAI response retrieval and enhance tracing in assistant_wrappers.py.

  • Behavior:
    • Add responses_retrieve_wrapper to handle Responses.retrieve in __init__.py and assistant_wrappers.py.
    • Update messages_list_wrapper to include LLM_SYSTEM and LLM_USAGE_PROMPT_TOKENS attributes.
    • Modify runs_create_wrapper to store run_id in runs dictionary.
  • Instrumentation:
    • Add span attributes for response ID and content in responses_retrieve_wrapper.
    • Update messages_list_wrapper to handle message roles and content more precisely.
  • Misc:
    • Rename index variables in messages_list_wrapper for clarity.

This description was created by Ellipsis for c8858fa584a2eb3bb109300044d7d03bdd50aa71. It will automatically update as commits are pushed.

tongyu0924 avatar Mar 18 '25 07:03 tongyu0924

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

CLAassistant avatar Mar 18 '25 07:03 CLAassistant

Hey @tongyu0924 are you working on this still or we can pick it up and continue? (cc @dinmukhamedm)

nirga avatar Mar 25 '25 18:03 nirga

Hey @tongyu0924 are you working on this still or we can pick it up and continue? (cc @dinmukhamedm)

Thanks for checking @nirga ! I haven’t had time to continue – feel free to pick it up and go ahead.

tongyu0924 avatar Mar 25 '25 18:03 tongyu0924

Achieved partially in #3052

dinmukhamedm avatar Jul 14 '25 10:07 dinmukhamedm