Skip to content

Commit 39d2a3c

Browse files
committed
Introduce identical changes to upstream PR
This PR contains the same exact changes as my PR targeting the upstream repo[1], but consolidated into a single commit for convenience. 1: Azure#43228
1 parent 4c7c69e commit 39d2a3c

File tree

3 files changed

+128
-59
lines changed

3 files changed

+128
-59
lines changed

sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/OpenAIClientBuilder.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// Code generated by Microsoft (R) TypeSpec Code Generator.
44
package com.azure.ai.openai;
55

6-
import static com.azure.ai.openai.implementation.NonAzureOpenAIClientImpl.OPEN_AI_ENDPOINT;
6+
import static com.azure.ai.openai.implementation.NonAzureOpenAIClientImpl.OPEN_AI_ENDPOINT_PATTERN;
77

88
import com.azure.ai.openai.implementation.NonAzureOpenAIClientImpl;
99
import com.azure.ai.openai.implementation.OpenAIClientImpl;
@@ -333,7 +333,7 @@ private HttpPipeline createHttpPipeline() {
333333
private NonAzureOpenAIClientImpl buildInnerNonAzureOpenAIClient() {
334334
HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline();
335335
NonAzureOpenAIClientImpl client
336-
= new NonAzureOpenAIClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter());
336+
= new NonAzureOpenAIClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint);
337337
return client;
338338
}
339339

@@ -362,11 +362,11 @@ public OpenAIClient buildClient() {
362362
private static final ClientLogger LOGGER = new ClientLogger(OpenAIClientBuilder.class);
363363

364364
/**
365-
* OpenAI service can be used by either not setting the endpoint or by setting the endpoint to start with
366-
* "https://api.openai.com/"
365+
* OpenAI service can be used by either not setting the endpoint or by setting the endpoint to a
366+
* URL like "https://api.openai.com/v1" or "https://eu.api.openai.com/v1".
367367
*/
368368
private boolean useNonAzureOpenAIService() {
369-
return endpoint == null || endpoint.startsWith(OPEN_AI_ENDPOINT);
369+
return endpoint == null || OPEN_AI_ENDPOINT_PATTERN.matcher(endpoint).matches();
370370
}
371371

372372
private void validateClient() {

0 commit comments

Comments
 (0)