-
Notifications
You must be signed in to change notification settings - Fork 278
Description
AgentScope-Java is an open-source project. To involve a broader community, we recommend asking your questions in English.
Is your feature request related to a problem? Please describe.
I am encountering a 404 error when using the OpenAIClient to interact with Azure OpenAI models, even after correctly configuring the Azure deployment name and API key. The root cause is that the OpenAIClient currently does not support passing the api-version parameter, which is a mandatory requirement for Azure OpenAI API requests. This issue blocks the integration of Azure OpenAI models into projects using AgentScope-Java.
Describe the solution you'd like
Add an apiVersion configuration field (e.g., String type) to the OpenAIClient's configuration class (e.g., OpenAIClientConfig), allowing users to specify the Azure OpenAI API version (e.g., "2024-02-15-preview").
Modify the request URL construction logic in OpenAIClient: when Azure OpenAI is enabled, automatically append the api-version parameter (with the user-configured value) to the request URL as a query parameter.
Ensure backward compatibility: the apiVersion parameter should only take effect for Azure OpenAI requests and not impact existing interactions with the standard OpenAI API.
Describe alternatives you've considered
Manual URL modification: Temporarily hardcode the api-version parameter into the request URL by modifying the source code of OpenAIClient. However, this approach is not maintainable and will be overwritten during project updates.
Using a separate Azure OpenAI client: Integrating an independent Azure OpenAI SDK, but this increases project dependencies and breaks the unified client usage experience provided by AgentScope-Java.
Additional context
Azure OpenAI API documentation explicitly requires the api-version parameter in all requests (reference: https://learn.microsoft.com/en-us/azure/ai-services/openai/reference#completions).
Example of a valid Azure OpenAI request URL with the parameter: https://{azure-resource-name}.openai.azure.com/openai/deployments/{deployment-name}/completions?api-version=2024-02-15-preview.
Without the api-version parameter, Azure's API gateway returns a 404 error because it cannot route the request to the correct API version endpoint.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status