Skip to content

Latest commit

 

History

History
326 lines (227 loc) · 12.6 KB

File metadata and controls

326 lines (227 loc) · 12.6 KB

How to Save and Reuse Parameter Settings in Azure OpenAI & AI Studio Variants

Costa Rica

GitHub Cloud2BR OSS - Learning Hub

Last updated: 2026-01-29


List of References (Click to expand)
Table of Contents (Click to expand)

GUI approach over Azure OpenAI

You can use the export option:

image

Which will look like this:

{
    "systemPrompt": "You are an AI assistant that helps people find information.",
    "fewShotExamples": [],
    "chatParameters": {
        "deploymentName": "gpt-4o-mini",
        "maxResponseLength": 800,
        "temperature": 0.7,
        "topProbablities": 0.95,
        "stopSequences": [],
        "pastMessagesToInclude": 10,
        "frequencyPenalty": 0,
        "presencePenalty": 0
    }
}

Import the configuration:

image

Variants Approach over Azure OpenAI

graph TD
    A[Create Azure OpenAI Resource] --> B[Configure Environment Variables]
    B --> C[Prepare Data]
    C --> D[Create Index in AI Studio]
    D --> E[Index Data]
    E --> F[Deploy Model in AI Studio]
    F --> G[Configure Variants]
    G --> H[Run and Evaluate Variants]
    H --> I[Interact with Model]
    I --> J[Monitor and Adjust]

    subgraph Indexing Phase
        direction TB
        C[Prepare Data]
        noteC[Ensure your data is in a suitable format and upload it to a supported storage service.]
        D[Create Index in AI Studio]
        noteD[Set up the index with parameters like chunk size, embedding model, and search type.]
        E[Index Data]
        noteE[Use the configured settings to index your data, creating embeddings.]
    end

    subgraph Deployment Phase
        direction TB
        F[Deploy Model in AI Studio]
        noteF[Set up your model deployment with parameters like model version, temperature, and top_p.]
        G[Configure Variants]
        noteG[Create and manage different versions of your prompt settings for fine-tuning.]
        H[Run and Evaluate Variants]
        noteH[Test different variants to determine the best configuration.]
        I[Interact with Model]
        noteI[Use the model with the selected variant settings.]
        J[Monitor and Adjust]
        noteJ[Continuously monitor performance and make adjustments as needed.]
    end

    subgraph Environment Configuration
        direction TB
        B[Configure Environment Variables]
        noteB[Set up your environment variables for your key and endpoint. This can be done in your development environment or directly in Azure AI Studio.]
    end
Loading

Create an Azure OpenAI Resource

  • Go to the Azure portal.

  • Navigate to Create a resource and search for Azure OpenAI.

  • Follow the prompts to create your resource.

    image image

Setup your project

  • Navigate to Azure AI Studio: Go to the Azure AI Studio and open your project.

    image
  • Create a project:

    image

Indexing Your Data

  • Prepare Your Data:

    • Ensure your data is in a suitable format (e.g., text, PDF).
    • Upload your data to Azure Blob Storage or another supported storage service.

    If you don't have any yet see steps below:

    image image image
  • Index Your Data:

    • Use the configured settings to index your data.
    • This process will break down your documents into smaller chunks and create embeddings.

    Use AI Search directly:

    image image

    Create a new connection if it's required, for e.g you can use Access key or SAS (Shared Access Signature):

    image

    Follow the process:

    image

    In Azure AI Studio:

    • Navigate to the Indexes section.
    • Select Create Index and configure the parameters such as chunk size, embedding model, and search type.
    • Save these settings for future use.
    image image

Deploy a Model

  • In Azure AI Studio, go to the Deployments section.

  • Select Create Deployment and choose your model (e.g., GPT-4).

    image
  • Configure deployment parameters like model version, temperature, and top_p.

  • Save these deployment settings.

    image
  • Add your index data to the model:

    image

Configure the prompt flow

From the chat playground

image

Or you can:

  • Go to the Prompt flow section within your project.

  • Click on Create to start a new flow.

    image

Add an LLM Node

Note

If you used Prompt flow section within your project, you need to add the LLM model but if you add the prompt flow from the chat playground you will see the LLM added, and other required elements as base for you.

How to add the LLM:

  • In the flow creation wizard, add an LLM (Large Language Model) node.

  • Configure the initial settings for this node, such as the prompt and connection settings.

    image image

How it looks from giving starting point:

image

Configuring Variants in Azure AI Studio

Note

Set up your environment variables for your key and endpoint. This can be done in your development environment or directly in Azure AI Studio.

Using the approach of AI Studio

  • Show Variants: Once your LLM node is set up, click on the Show variants button at the top right of the node. This will allow you to create and manage different variants of your prompt.

    image

Create Variants

This allows you to fine-tune and test different configurations.

  • The existing LLM node will be labeled as variant_0 by default.

  • Click on the Clone button on variant_0 to generate variant_1.

    image
  • Configure variant_1 with different parameters or update the prompt as needed.

  • Repeat this step to create additional variants (e.g., variant_2, variant_3, etc.).

    image

Configure Parameters for Each Variant

  • For each variant, you can adjust parameters such as temperature, top_p, and the prompt content.
  • Example configurations:
    • Variant 0: Temperature = 1, Prompt: "Summarize the following text: {{input_text}}"
    • Variant 1: Temperature = 0.7, Prompt: "Summarize the following text: {{input_text}}"
    • Variant 2: Temperature = 1, Prompt: "What is the main point of this article? {{input_text}}"
    • Variant 3: Temperature = 0.7, Prompt: "What is the main point of this article? {{input_text}}"

Run and Evaluate Variants

  • After configuring your variants, use Azure AI Studio or API calls to interact with your deployed model. You can run the flow with different inputs to test how each variant performs.
  • Use the "Run" button to execute the flow and select the LLM node with variants to test.
  • Evaluate the outputs to determine which variant produces the best results for your use case.

Monitor and Adjust

  • Continuously monitor the performance of each variant.
  • Make adjustments as needed based on the results to optimize your prompt configurations.

Example Code Snippet

Here’s a simple example of how you might set up and use these settings programmatically:

import openai

# Set up your environment variables
openai.api_key = "your-api-key"
endpoint = "https://your-endpoint.openai.azure.com/"

# Define your index settings
index_settings = {
    "chunk_size": 1024,
    "embedding_model": "text-embedding-ada-002",
    "search_type": "semantic"
}

# Define your deployment settings
deployment_settings = {
    "model": "gpt-4",
    "temperature": 0.7,
    "top_p": 0.9
}

# Save these settings for reuse
def save_settings(settings, filename):
    with open(filename, 'w') as file:
        json.dump(settings, file)

save_settings(index_settings, 'index_settings.json')
save_settings(deployment_settings, 'deployment_settings.json')

# Load and use the settings
def load_settings(filename):
    with open(filename, 'r') as file:
        return json.load(file)

index_settings = load_settings('index_settings.json')
deployment_settings = load_settings('deployment_settings.json')

# Use the settings in your API calls
response = openai.Completion.create(
    engine=deployment_settings["model"],
    prompt="Your prompt here",
    temperature=deployment_settings["temperature"],
    top_p=deployment_settings["top_p"]
)

print(response.choices[0].text)
Total views

Refresh Date: 2026-04-07