File tree Expand file tree Collapse file tree 2 files changed +6
-49
lines changed
openai-java-example/src/main/java/com/openai/example Expand file tree Collapse file tree 2 files changed +6
-49
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -12,22 +12,16 @@ public final class AzureEntraIdExample {
1212 private AzureEntraIdExample () {}
1313
1414 public static void main (String [] args ) {
15- OpenAIOkHttpClient .Builder clientBuilder = OpenAIOkHttpClient .builder ();
16-
17- /* Azure-specific code starts here */
18- // You can either set 'endpoint' directly in the builder.
19- // or set the env var "AZURE_OPENAI_ENDPOINT" and use fromEnv() method instead
20- clientBuilder
21- .baseUrl (System .getenv ("AZURE_OPENAI_ENDPOINT" ))
15+ OpenAIClient client = OpenAIOkHttpClient .builder ()
16+ // Gets the API key from the `AZURE_OPENAI_KEY` environment variable
17+ .fromEnv ()
2218 // Set the Azure Entra ID
2319 .credential (BearerTokenCredential .create (AuthenticationUtil .getBearerTokenSupplier (
24- new DefaultAzureCredentialBuilder ().build (), "https://cognitiveservices.azure.com/.default" )));
25- /* Azure-specific code ends here */
26-
27- OpenAIClient client = clientBuilder .build ();
20+ new DefaultAzureCredentialBuilder ().build (), "https://cognitiveservices.azure.com/.default" )))
21+ .build ();
2822
2923 ChatCompletionCreateParams createParams = ChatCompletionCreateParams .builder ()
30- .model (ChatModel .GPT_4O )
24+ .model (ChatModel .GPT_3_5_TURBO )
3125 .maxCompletionTokens (2048 )
3226 .addDeveloperMessage ("Make sure you mention Stainless!" )
3327 .addUserMessage ("Tell me a story about building the best SDK!" )
You can’t perform that action at this time.
0 commit comments