-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Instrument wrapper for OpenAI structured outputs (#1373)
### Purpose Instrument tracing for OpenAI Structured Outputs ### Changes 1. Created openai parser wrapper for structured outputs beta method `client.beta.chat.completions.parse` 1. Added support for both sync and async tracing 1. Maintains backwards compatibility for clients that don't have beta parse methods ### Tests Added unit tests for parsing methods, and token counts. Tested locally to confirm parsing gets traced <img width="318" alt="Screenshot 2024-12-02 at 9 45 16 PM" src="https://github.com/user-attachments/assets/20300d05-65ff-4a8b-857d-e18e2e89f79d" /> > [!NOTE] > Parsing does not support streaming, so the `reduce_fn` is always set to None
- Loading branch information
1 parent
fffa5b5
commit 281dc10
Showing
2 changed files
with
152 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters