OER·harvester

← Back to the library
GitHub NOTEBOOK resource

Githubmodels Assignment Simple

Repository 21 Lessons, Get Started Building with Generative AI

Licence
OPEN MIT
Authors
Microsoft (microsoft)
Updated
2026-07-16 · GitHub
Language
en
Length
125 words
Open original ↗
{ }
Jupyter notebook Converted to a read-only view · code is not executed

Source: Githubmodels Assignment Simple · GitHub · microsoft/generative-ai-for-beginners Authors: Microsoft (microsoft) Licence: MIT — https://spdx.org/licenses/MIT.html

In [1]
import os
from azure.ai.inference import ChatCompletionsClient
from azure.ai.inference.models import SystemMessage, UserMessage
from azure.core.credentials import AzureKeyCredential

# Get these from your Microsoft Foundry project's "Overview" page
# (GitHub Models is retiring end of July 2026 - see https://ai.azure.com/catalog/models)
token = os.environ["AZURE_INFERENCE_CREDENTIAL"]
endpoint = os.environ["AZURE_INFERENCE_ENDPOINT"]

client = ChatCompletionsClient(
    endpoint=endpoint,
    credential=AzureKeyCredential(token),
)

model_name = "gpt-5-mini"
In [2]
# Create your first prompt
text_prompt = " My foot hurts, what can be wrong?"

response = client.complete(
  model=model_name,
  messages = [
      {"role":"system", "content":"I'm a doctor, specialist on surgery"},
      {"role":"user","content":text_prompt},])

response.choices[0].message.content

Disclaimer: This document has been translated using AI translation service Co-op Translator. While we strive for accuracy, please be aware that automated translations may contain errors or inaccuracies. The original document in its native language should be considered the authoritative source. For critical information, professional human translation is recommended. We are not liable for any misunderstandings or misinterpretations arising from the use of this translation.