From b4b1d59d78ab4a05cbb0afe027459ad402ca3bf9 Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Thu, 18 Jul 2024 16:53:42 +0000 Subject: [PATCH] chore(docs): document how to do per-request http client customization --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 7edc346272..8102ea9673 100644 --- a/README.md +++ b/README.md @@ -485,6 +485,12 @@ client = OpenAI( ) ``` +You can also customize the client on a per-request basis by using `with_options()`: + +```python +client.with_options(http_client=DefaultHttpxClient(...)) +``` + ### Managing HTTP resources By default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting.