-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Description
What happened?
Describe the bug
When using company's customized model, if we do not pass the http_client parameter, the endpoint will reject our access
To Reproduce
Using the simple code:
def load_config(file_path: str = os.path.join(os.path.dirname(file), "model_config.yaml")):
with open(file_path, "r") as file:
if file_path.endswith('.json'):
config_data = json.load(file)
elif file_path.endswith('.yaml'):
config_data = yaml.safe_load(file)
if len(config_data['config'].get("api_key", "")) == 0:
config_data['config']['api_key'] = os.getenv("AZURE_API_KEY")
if config_data['config']['model'].startswith("gemini-"):
config_data['config']["http_client"] = httpx.AsyncClient(verify=False)
return config_data
model_config = load_config()
model_client = OpenAIChatCompletionClient(**model_config['config'])
Expected behavior
We can pass http_client property to AsyncOpenAI(http_client=xxx)
Screenshots
N/A
Additional context
Add http_client to BaseOpenAIClientConfiguration,such as:
class BaseOpenAIClientConfiguration(CreateArguments, total=False):
model: str
api_key: str
timeout: Union[float, None]
......
http_client: AsyncClient | None
Which packages was the bug in?
Python Extensions (autogen-ext)
AutoGen library version.
Python 0.7.5
Other library version.
No response
Model used
gemini-2.5-pro
Model provider
Azure OpenAI
Other model provider
No response
Python version
3.12
.NET version
None
Operating system
None