You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Confirm this is a feature request for the Python library and not the underlying OpenAI API.
This is a feature request for the Python library
Describe the feature or improvement you're requesting
After streaming a chat completion response it is often necessary to recombine the streamed chunks into a message. Two examples are
in the https://github.com/pydantic/logfire observability platform, when a streamed response has ended the final Assistant message could be displayed nicely in the UI.
in https://github.com/jackmpcollins/magentic , parallel tool calls are streamed to call these during the generation, and inserting the outputs back into messages requires also creating an Assistant message from the streamed chunks.
Currently the internal class ChatCompletionStreamState makes this easy, but it is private which indicates it should not be relied on. Would it be possible to make this or similar functionality a supported part of the public API?
The current feature set of ChatCompletionStreamState is ideal:
get a ChatCompletion at any point during the stream (current_completion_snapshot). This allows logging a partial stream response in case of error, including if max_tokens was reached.
parse the chunks into correct pydantic BaseModels for the tools/response_format (get_final_completion())
Confirm this is a feature request for the Python library and not the underlying OpenAI API.
Describe the feature or improvement you're requesting
After streaming a chat completion response it is often necessary to recombine the streamed chunks into a message. Two examples are
messages
requires also creating an Assistant message from the streamed chunks.Currently the internal class
ChatCompletionStreamState
makes this easy, but it is private which indicates it should not be relied on. Would it be possible to make this or similar functionality a supported part of the public API?The current feature set of
ChatCompletionStreamState
is ideal:ChatCompletion
at any point during the stream (current_completion_snapshot
). This allows logging a partial stream response in case of error, including if max_tokens was reached.get_final_completion()
)Example usage of the existing class
Additional context
No response
The text was updated successfully, but these errors were encountered: