Skip to content

Support OpenAI raw response#80

Open
ViaDézo1er / cedric (viadezo1er) wants to merge 1 commit intomainfrom
cedric/support-openai-raw-response
Open

Support OpenAI raw response#80
ViaDézo1er / cedric (viadezo1er) wants to merge 1 commit intomainfrom
cedric/support-openai-raw-response

Conversation

@viadezo1er
Copy link
Contributor

fix #36
openai.Client().responses.with_raw_response now has tracing.

PR seems to be very large but most of it is due to the VCR (and a bit of formatting).

3 new classes in oai.py to support raw responses, and slightly adapting other functions to recognize raw responses and use the correct classes.

When returning a raw response and streaming it, _TracedStream and _AsyncTracedStream are used to wrap a traced generator while preserving the OpenAI methods of the original OpenAI stream object, otherwise a python generator gen() would be returned.
Can be removed if deemed not necessary.

fix #36
openai.Client().responses.with_raw_response now has tracing
Test added with respective VCR, very similar to the tests for the non raw responses
Deals with the create and parse methods
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add tracing support for with_raw_response in Python wrap_openai

1 participant