LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • Client
  • AsyncClient
  • Run Helpers
  • Run Trees
  • Evaluation
  • Schemas
  • Utilities
  • Wrappers
  • Anonymizer
  • Testing
  • Expect API
  • Middleware
  • Pytest Plugin
  • Deployment SDK
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

OverviewClientAsyncClientRun HelpersRun TreesEvaluationSchemasUtilitiesWrappersAnonymizerTestingExpect APIMiddlewarePytest PluginDeployment SDK
Language
Theme
Pythonlangsmith_openapi_client_responseStreamAlreadyConsumed
Class●Since v0.8

StreamAlreadyConsumed

Copy
StreamAlreadyConsumed(
    self,
)

Bases

LangsmithError

Constructors

View source on GitHub
constructor
__init__

Attempted to read or stream content, but the content has already been streamed.

This can happen if you use a method like .iter_lines() and then attempt to read th entire response body afterwards, e.g.

response = await client.post(...)
async for line in response.iter_lines():
    ...  # do something with `line`

content = await response.read()
# ^ error

If you want this behaviour you'll need to either manually accumulate the response content or call await response.read() before iterating over the stream.