|
3 | 3 | // Code generated by Microsoft (R) TypeSpec Code Generator.
|
4 | 4 | package com.azure.ai.openai;
|
5 | 5 |
|
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; |
7 | 7 |
|
8 | 8 | import com.azure.ai.openai.implementation.NonAzureOpenAIClientImpl;
|
9 | 9 | import com.azure.ai.openai.implementation.OpenAIClientImpl;
|
@@ -333,7 +333,7 @@ private HttpPipeline createHttpPipeline() {
|
333 | 333 | private NonAzureOpenAIClientImpl buildInnerNonAzureOpenAIClient() {
|
334 | 334 | HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline();
|
335 | 335 | NonAzureOpenAIClientImpl client
|
336 |
| - = new NonAzureOpenAIClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter()); |
| 336 | + = new NonAzureOpenAIClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); |
337 | 337 | return client;
|
338 | 338 | }
|
339 | 339 |
|
@@ -362,11 +362,11 @@ public OpenAIClient buildClient() {
|
362 | 362 | private static final ClientLogger LOGGER = new ClientLogger(OpenAIClientBuilder.class);
|
363 | 363 |
|
364 | 364 | /**
|
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". |
367 | 367 | */
|
368 | 368 | private boolean useNonAzureOpenAIService() {
|
369 |
| - return endpoint == null || endpoint.startsWith(OPEN_AI_ENDPOINT); |
| 369 | + return endpoint == null || OPEN_AI_ENDPOINT_PATTERN.matcher(endpoint).matches(); |
370 | 370 | }
|
371 | 371 |
|
372 | 372 | private void validateClient() {
|
|
0 commit comments