Skip to content

Commit 1eafe3f

Browse files
committed
Updated code to latest SDK
1 parent a8b6ed2 commit 1eafe3f

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

learn-pr/wwl-data-ai/ai-foundry-sdk/includes/04-chat-client.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -195,13 +195,7 @@ namespace my_foundry_client
195195
var projectClient = new AIProjectClient(connectionString, new DefaultAzureCredential());
196196

197197
// Get an Azure OpenAI chat client
198-
ConnectionResponse connection = projectClient.GetConnectionsClient().GetDefaultConnection(ConnectionType.AzureOpenAI, withCredential: true);
199-
var connectionProperties = connection.Properties as ConnectionPropertiesApiKeyAuth;
200-
AzureOpenAIClient azureOpenAIClient = new(
201-
new Uri(connectionProperties.Target),
202-
new AzureKeyCredential(connectionProperties.Credentials.Key));
203-
204-
ChatClient chatClient = azureOpenAIClient.GetChatClient("gpt-4-model");
198+
ChatClient chatClient = projectClient.GetAzureOpenAIChatClient("gpt-4-model");
205199

206200
// Get a chat completion based on a user-provided prompt
207201
Console.WriteLine("Enter a question:");

0 commit comments

Comments
 (0)