Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use Azure custom deployment due to fixed URL path #195

Closed
lihenggui opened this issue Jun 1, 2023 · 1 comment · Fixed by #196
Closed

Cannot use Azure custom deployment due to fixed URL path #195

lihenggui opened this issue Jun 1, 2023 · 1 comment · Fixed by #196
Labels
enhancement New feature or request

Comments

@lihenggui
Copy link

lihenggui commented Jun 1, 2023

Description

I'm uncertain whether this is a bug or a feature request.

In this pull request (https://github.com/aallam/openai-kotlin/pull/102/files), it is stated that the library now supports custom deployments, including Azure. But we are currently unable to directly fetch data from Azure using this library due to a difference in the URL format.

According to the reference documentation (https://learn.microsoft.com/en-us/azure/cognitive-services/openai/reference), the correct URL format for retrieving embeddings from Azure is as follows: https://{your-resource-name}.openai.azure.com/openai/deployments/{deployment-id}/embeddings?api-version={api-version}.

Unfortunately, there is a hardcoded URL (v1/) in the code file that hinders the use of Azure services (https://github.com/aallam/openai-kotlin/blob/main/openai-client/src/commonMain/kotlin/com.aallam.openai.client/internal/api/EmbeddingsApi.kt#L31).

My suggestion is to consider relocating the URL path v1 to a configuration file, similar to the OpenAIHost, to allow users to easily modify it and ensure compatibility with Azure deployments.

Steps to Reproduce

  1. Import the library to a project
  2. Use Azure OpenAI deployment
  3. Check the error message
HttpClient: RESPONSE: 404 Resource Not Found
METHOD: HttpMethod(value=POST)
FROM: https://{your-resource-name}.openai.azure.com/openai/deployments/{deployment-id}/v1/embeddings

Environment

  • openai-kotlin version: 3.2.4
  • Kotlin version: 1.8.10
  • OS: MacOS ventrua
@aallam aallam added the enhancement New feature or request label Jun 2, 2023
@aallam
Copy link
Owner

aallam commented Jun 2, 2023

Hello @lihenggui, I will think of a way of making this work and make a PR for it, thanks for your feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants