Skip to content

fix(client): consider cognitiveservices.azure.com as azure #470

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

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion openai-java-core/src/main/kotlin/com/openai/core/Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,11 @@ internal fun Any?.contentToString(): String {
internal fun isAzureEndpoint(baseUrl: String): Boolean {
// Azure Endpoint should be in the format of `https://<region>.openai.azure.com`.
// Or `https://<region>.azure-api.net` for Azure OpenAI Management URL.
// Or `<user>-random-<region>.cognitiveservices.azure.com`.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Or `<user>-random-<region>.cognitiveservices.azure.com`.
// Or `<user>-random-<region>.cognitiveservices.azure.com` for deployments across regions.

this is my best guess regarding the reason that I got this URL for this deployment, but I cannot know for sure, if reason is optional I would prefer leaving it empty

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Or `<user>-random-<region>.cognitiveservices.azure.com`.
// Or `<user>-random-<region>.cognitiveservices.azure.com` for Azure AI services deployments.

It might also be that reason, my openai deployment has the openai.azure.com url, but my azure ai service deployment has cognitiveservices.azure.com

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will try to get more details on this, but I think that it's probably okay to not qualify this documentation addition.

val trimmedBaseUrl = baseUrl.trim().trimEnd('/')
return trimmedBaseUrl.endsWith(".openai.azure.com", true) ||
trimmedBaseUrl.endsWith(".azure-api.net", true)
trimmedBaseUrl.endsWith(".azure-api.net", true) ||
trimmedBaseUrl.endsWith(".cognitiveservices.azure.com", true)
}

internal interface Enum