Open dmakhervaks opened 1 month ago
modify the 'http_client' to have custom Limits.
I cannot reproduce this part, passing in a custom HTTP client with different limits does get propagated
import httpx
from openai import AsyncOpenAI
client = AsyncOpenAI(
http_client=httpx.AsyncClient(
limits=httpx.Limits(
max_connections=1,
)
)
)
print(client._client._transport._pool._max_connections)
This prints 1
for me. Is it different for you?
Separately it is intentional that you can't pass limits
directly to OpenAI()
, the code you linked to is left-over from the original implementation and we haven't removed that yet.
The intended path for customizing limits is by passing your own HTTP client instance directly.
Confirm this is an issue with the Python library and not an underlying OpenAI API
Describe the bug
It seems as though when initializing an openAI client like so:
since you cannot pass in the limits argument as a parameter, it will always default to the DEFAULT value here:
https://github.com/openai/openai-python/blob/aa6818997468b753546d55365d8142e2bb1c6640/src/openai/_base_client.py#L1127
openai.AsyncClient(())
To Reproduce
Code snippets
OS
linux
Python version
3.9.12
Library version
1.50.0