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_responseBaseAPIResponse
Class●Since v0.8

BaseAPIResponse

Copy
BaseAPIResponse(
  self,
  *,
  raw: httpx.Response,
  cast_to: type[R],
  client: BaseClient

Bases

Generic[R]

Constructors

Attributes

View source on GitHub
[
Any
,
Any
]
,
stream
:
bool
,
stream_cls
:
type
[
Stream
[
Any
]
]
|
type
[
AsyncStream
[
Any
]
]
|
None
,
options
:
FinalRequestOptions
,
retries_taken
:
int
=
0
)
constructor
__init__
NameType
rawhttpx.Response
cast_totype[R]
clientBaseClient[Any, Any]
streambool
stream_clstype[Stream[Any]] | type[AsyncStream[Any]] | None
optionsFinalRequestOptions
retries_takenint
attribute
http_response: httpx.Response
attribute
retries_taken: int

The number of retries made. If no retries happened this will be 0

attribute
headers: httpx.Headers
attribute
http_request: httpx.Request

Returns the httpx Request instance associated with the current response.

attribute
status_code: int
attribute
url: httpx.URL

Returns the URL for which the request was made.

attribute
method: str
attribute
http_version: str
attribute
elapsed: datetime.timedelta

The time taken for the complete request/response cycle to complete.

attribute
is_closed: bool

Whether or not the response body has been closed.

If this is False then there is response data that has not been read yet. You must either fully consume the response body or call .close() before discarding the response to prevent resource leaks.