langsmith.client.Client.request_with_retries#

Client.request_with_retries(method: Literal['GET', 'POST', 'PUT', 'PATCH', 'DELETE'], pathname: str, *, request_kwargs: Mapping | None = None, stop_after_attempt: int = 1, retry_on: Sequence[Type[BaseException]] | None = None, to_ignore: Sequence[Type[BaseException]] | None = None, handle_response: Callable[[Response, int], Any] | None = None, _context: str = '', **kwargs: Any) Response[source]#

Send a request with retries.

Parameters:
  • request_method (str) – The HTTP request method.

  • pathname (str) – The pathname of the request URL. Will be appended to the API URL.

  • request_kwargs (Mapping) – Additional request parameters.

  • stop_after_attempt (int, default=1) – The number of attempts to make.

  • retry_on (Sequence[Type[BaseException]] or None, default=None) – The exceptions to retry on. In addition to: [LangSmithConnectionError, LangSmithAPIError].

  • to_ignore (Sequence[Type[BaseException]] or None, default=None) – The exceptions to ignore / pass on.

  • handle_response (Callable[[requests.Response, int], Any] or None, default=None) – A function to handle the response and return whether to continue retrying.

  • **kwargs (Any) – Additional keyword arguments to pass to the request.

  • Returns

  • -------

  • Response – The response object.

  • Raises

  • ------

  • LangSmithAPIError – If a server error occurs.

  • LangSmithUserError – If the request fails.

  • LangSmithConnectionError – If a connection error occurs.

  • LangSmithError – If the request fails.

  • method (Literal['GET', 'POST', 'PUT', 'PATCH', 'DELETE']) –

  • _context (str) –

  • **kwargs

Return type:

Response