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
PythonlangsmithclientClientrequest_with_retries
Method●Since v0.0

request_with_retries

Copy
request_with_retries(
  self,
  ,
  method: Literal['GET', 'POST', 'PUT', 'PATCH', 'DELETE'],
  
View source on GitHub
pathname
:
str
,
*
,
request_kwargs
:
Optional
[
Mapping
]
=
None
,
stop_after_attempt
:
int
=
1
,
retry_on
:
Optional
[
Sequence
[
type
[
BaseException
]
]
]
=
None
,
to_ignore
:
Optional
[
Sequence
[
type
[
BaseException
]
]
]
=
None
,
handle_response
:
Optional
[
Callable
[
[
requests
.
Response
,
int
]
,
Any
]
]
=
None
,
_context
:
str
=
''
,
**
kwargs
:
Any
=
{
}
)
->
requests
.
Response

Parameters

NameTypeDescription
method*Literal['GET', 'POST', 'PUT', 'PATCH', 'DELETE']

The HTTP request method.

pathname*str

The pathname of the request URL. Will be appended to the API URL.

request_kwargsOptional[Mapping]
Default:None
stop_after_attemptint
Default:1
retry_onOptional[Sequence[type[BaseException]]]
Default:None
to_ignoreOptional[Sequence[type[BaseException]]]
Default:None
handle_responseOptional[Callable[[requests.Response, int], Any]]
Default:None
_contextstr
Default:''
**kwargsAny
Default:{}

Send a request with retries.

Additional request parameters.

The number of attempts to make.

The exceptions to retry on.

In addition to: [LangSmithConnectionError, LangSmithAPIError].

The exceptions to ignore / pass on.

A function to handle the response and return whether to continue retrying.

The context of the request.

Additional keyword arguments to pass to the request.