Skip to content

Commit 78dd6d6

Browse files
committed
initial model article update
1 parent d205911 commit 78dd6d6

File tree

6 files changed

+80
-2
lines changed

6 files changed

+80
-2
lines changed

articles/ai-foundry/how-to/develop/get-started-projects-vs-code.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ content_well_notification:
88
- AI-contribution
99
ai-usage: ai-assisted
1010
ms.topic: how-to
11-
ms.date: 05/20/2025
11+
ms.date: 07/09/2025
1212
ms.reviewer: erichen
1313
ms.author: johalexander
1414
author: ms-johnalex
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
import os
2+
import base64
3+
from openai import AzureOpenAI
4+
from azure.identity import DefaultAzureCredential, get_bearer_token_provider
5+
6+
endpoint = os.getenv("ENDPOINT_URL", "https://ai-services-resource.openai.azure.com/")
7+
deployment = os.getenv("DEPLOYMENT_NAME", "gpt-4o-1")
8+
9+
# Initialize Azure OpenAI client with Entra ID authentication
10+
token_provider = get_bearer_token_provider(
11+
DefaultAzureCredential(),
12+
"https://cognitiveservices.azure.com/.default"
13+
)
14+
15+
client = AzureOpenAI(
16+
azure_endpoint=endpoint,
17+
azure_ad_token_provider=token_provider,
18+
api_version="2025-01-01-preview",
19+
)
20+
21+
22+
# IMAGE_PATH = "YOUR_IMAGE_PATH"
23+
# encoded_image = base64.b64encode(open(IMAGE_PATH, 'rb').read()).decode('ascii')
24+
chat_prompt = [
25+
{
26+
"role": "system",
27+
"content": [
28+
{
29+
"type": "text",
30+
"text": "You are an AI assistant that helps people find information."
31+
}
32+
]
33+
},
34+
{
35+
"role": "user",
36+
"content": [
37+
{
38+
"type": "text",
39+
"text": "I am going to Paris, what should I see?"
40+
}
41+
]
42+
},
43+
{
44+
"role": "assistant",
45+
"content": [
46+
{
47+
"type": "text",
48+
"text": "Paris, the capital of France, is known for its stunning architecture, art museums, historical landmarks, and romantic atmosphere. Here are some of the top attractions to see in Paris:\n\n1. The Eiffel Tower: The iconic Eiffel Tower is one of the most recognizable landmarks in the world and offers breathtaking views of the city.\n2. The Louvre Museum: The Louvre is one of the world's largest and most famous museums, housing an impressive collection of art and artifacts, including the Mona Lisa.\n3. Notre-Dame Cathedral: This beautiful cathedral is one of the most famous landmarks in Paris and is known for its Gothic architecture and stunning stained glass windows.\n\nThese are just a few of the many attractions that Paris has to offer. With so much to see and do, it's no wonder that Paris is one of the most popular tourist destinations in the world."
49+
}
50+
]
51+
},
52+
{
53+
"role": "user",
54+
"content": [
55+
{
56+
"type": "text",
57+
"text": "What is so great about #1?"
58+
}
59+
]
60+
}
61+
]
62+
63+
# Include speech result if speech is enabled
64+
messages = chat_prompt
65+
66+
completion = client.chat.completions.create(
67+
model=deployment,
68+
messages=messages,
69+
max_tokens=800,
70+
temperature=0.7,
71+
top_p=0.95,
72+
frequency_penalty=0,
73+
presence_penalty=0,
74+
stop=None,
75+
stream=False
76+
)
77+
78+
print(completion.to_json())

articles/ai-foundry/how-to/develop/vs-code-agents.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ content_well_notification:
88
- AI-contribution
99
ai-usage: ai-assisted
1010
ms.topic: how-to
11-
ms.date: 05/07/2025
11+
ms.date: 07/09/2025
1212
ms.reviewer: erichen
1313
ms.author: johalexander
1414
author: ms-johnalex
2.57 KB
Loading
51.6 KB
Loading
12.1 KB
Loading

0 commit comments

Comments
 (0)