< All Topics
Print

Azure OpenAI Service (ChatGPT, GPT-4, embeddings, etc.)


  • Steps:
    1. Go to Azure Portal.
    2. Create a resource → search for Azure OpenAI → select Create.
    3. Choose region, pricing tier, and resource group.
    4. Once deployed, go to the resource → Keys and Endpoint.
    5. Use the REST API or SDK (Python, C#, JavaScript) to send prompts and receive responses.
    6. Secure access with Azure Entra ID and role-based access control (RBAC).
  • Common use cases: chatbots, text summarization, code generation, semantic search.

2. Azure AI Services (prebuilt APIs)

  • These are “ready-made” AI APIs you can call without training models.
  • Categories include:
    • Vision (image recognition, OCR, face detection).
    • Language (translation, sentiment analysis, summarization).
    • Speech (text-to-speech, speech-to-text, translation).
    • Decision (anomaly detection, personalizers).
  • Steps:
    1. In the Azure portal, search for Azure AI Services.
    2. Create a multi-service resource or a single API (e.g., Language Service).
    3. Copy endpoint & keys → call via REST or SDK.

3. Azure Machine Learning (custom AI models)

If you want to train your own ML/AI models:

  • Steps:
    1. Create an Azure Machine Learning workspace in the portal.
    2. Configure compute resources (CPU/GPU clusters).
    3. Upload or connect your dataset.
    4. Use:
      • AutoML → automatically trains models.
      • Designer (drag-and-drop) → no-code model training.
      • Notebooks (Python, R) → full control over ML pipelines.
    5. Deploy the trained model as a web service in Azure (real-time or batch).
  • Integrations: works with Azure Data Lake, Databricks, Synapse.

4. AI Orchestration & Security

  • Use Azure AI Studio to combine OpenAI + search + your data.
  • Secure with:
    • Azure Entra ID (authentication).
    • Private Endpoints (network security).
    • Managed Identities (avoid hardcoding keys).
  • Monitor with Azure Monitor + Application Insights.

Quick Example – Calling Azure OpenAI in Python

import openai

openai.api_key = "YOUR_KEY"
openai.api_base = "https://YOUR-RESOURCE-NAME.openai.azure.com/"
openai.api_type = "azure"
openai.api_version = "2023-05-15"

response = openai.ChatCompletion.create(
    engine="gpt-4",
    messages=[{"role":"system","content":"You are an assistant."},
              {"role":"user","content":"Summarize Azure AI services."}]
)

print(response['choices'][0]['message']['content'])