AsyncAPIResponse(
self,
*,
raw: httpx.Response,
cast_to: type[R],
client: BaseClientReturns the httpx Request instance associated with the current response.
Read and return the binary response content.
Read and decode the response content into a string.
Read and decode the JSON response content.
Close the response and release the connection.
Automatically called if the response body is read to completion.
A byte-iterator over the decoded response content.
This automatically handles gzip, deflate and brotli encoded responses.
A str-iterator over the decoded response content that handles both gzip, deflate, etc but also detects the content's string encoding.
Like iter_text() but will only yield chunks for each line
Returns the rich python representation of this response's data.
For lower-level control, see .read(), .json(), .iter_bytes().
You can customise the type that the response is parsed into through
the to argument, e.g.
from langsmith_api import BaseModel
class MyModel(BaseModel):
foo: str
obj = response.parse(to=MyModel)
print(obj.foo)