[PR #2076] [CLOSED] fix: support response API stream object parse #2056

Closed
opened 2026-02-15 23:16:21 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/langsmith-sdk/pull/2076
Author: @EugeneJinXin
Created: 10/15/2025
Status: Closed

Base: mainHead: xin/fix-openai-wrapper-streaming-parser


📝 Commits (1)

  • 3ab8ea7 fix: support response API stream object parse

📊 Changes

1 file changed (+18 additions, -2 deletions)

View changed files

📝 python/langsmith/wrappers/_openai.py (+18 -2)

📄 Description

OpenAI Streaming Response Serialization Bug
When using OpenAI's streaming APIs (both chat.completions.create(stream=True) and responses.create(stream=True))
with LangSmith tracing via wrap_openai(), the trace output was being serialized as a string representation of the Stream object: "<openai.Stream object at 0x113355010>" instead of the actual response data.

The stream isn't really a pydantic model and won't have model_dump(), so Exception is caught, and {"output": response} is returned, When serialized to JSON for LangSmith, Python converts the Stream object to its string representation: "<openai.Stream object at 0x...>"


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langchain-ai/langsmith-sdk/pull/2076 **Author:** [@EugeneJinXin](https://github.com/EugeneJinXin) **Created:** 10/15/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `xin/fix-openai-wrapper-streaming-parser` --- ### 📝 Commits (1) - [`3ab8ea7`](https://github.com/langchain-ai/langsmith-sdk/commit/3ab8ea79cbeb539ebe2d7a4fb5cf909ddb8e5a81) fix: support response API stream object parse ### 📊 Changes **1 file changed** (+18 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `python/langsmith/wrappers/_openai.py` (+18 -2) </details> ### 📄 Description OpenAI Streaming Response Serialization Bug When using OpenAI's streaming APIs (both chat.completions.create(stream=True) and responses.create(stream=True)) with LangSmith tracing via wrap_openai(), the trace output was being serialized as a string representation of the Stream object: "<openai.Stream object at 0x113355010>" instead of the actual response data. The stream isn't really a pydantic model and won't have model_dump(), so Exception is caught, and {"output": response} is returned, When serialized to JSON for LangSmith, Python converts the Stream object to its string representation: "<openai.Stream object at 0x...>" --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-15 23:16:21 -05:00
yindo closed this issue 2026-02-15 23:16:21 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langsmith-sdk#2056