Skip to content

Commit 7b33b1c

Browse files
committed
Updated code
1 parent 61d0ebb commit 7b33b1c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ The following Python code sample uses a **ChatCompletionsClient** object to chat
2323
```python
2424
from azure.ai.projects import AIProjectClient
2525
from azure.identity import DefaultAzureCredential
26+
from azure.ai.inference.models import SystemMessage, UserMessage
2627

2728
try:
2829

@@ -42,8 +43,8 @@ try:
4243
response = chat.complete(
4344
model="phi-4-model",
4445
messages=[
45-
{"role": "system", "content": "You are a helpful AI assistant that answers questions."},
46-
{"role": "user", "content": user_prompt},
46+
SystemMessage("You are a helpful AI assistant that answers questions."),
47+
UserMessage(user_prompt)
4748
],
4849
)
4950
print(response.choices[0].message.content)
@@ -131,6 +132,8 @@ The following Python code sample uses the Azure AI Foundry and Azure OpenAI SDKs
131132
```python
132133
from azure.ai.projects import AIProjectClient
133134
from azure.identity import DefaultAzureCredential
135+
import openai
136+
134137

135138
try:
136139
# Initialize the project client

0 commit comments

Comments
 (0)