yjchun626 / azure-openai-sdk-proxy

This provides a proxy server application of Azure OpenAI Service API that round-robins multiple Azure OpenAI Service instances.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Azure OpenAI Service Proxy

This provides a proxy server application of Azure OpenAI Service API that round-robins multiple Azure OpenAI Service instances.

Prerequisites

Getting Started

  1. Login to Azure and GitHub.

    # Login to Azure Dev CLI
    azd auth login
    
    # Login to Azure CLI
    az login
    
    # Login to GitHub
    gh auth login
  2. Check login status.

    # Azure Dev CLI
    azd auth login --check-status
    
    # Azure CLI
    az account show
    
    # GitHub CLI
    gh auth status
  3. Fork this repository to your account and clone the forked repository to your local machine.

    gh repo fork aliencube/azure-openai-sdk-proxy --clone --default-branch-only
  4. Run the following commands in order to provision and deploy the app.

    # zsh/bash
    AZURE_ENV_NAME="proxy$((RANDOM%9000+1000))"
    azd init -e $AZURE_ENV_NAME
    azd up
    
    # PowerShell
    $AZURE_ENV_NAME = "proxy$(Get-Random -Minimum 1000 -Maximum 9999)"
    azd init -e $AZURE_ENV_NAME
    azd up

    NOTE: The AZURE_ENV_NAME variable is an arbitrary name for the Azure environment. You can change it to your preferred one.

  5. Run the following command to provision Azure resources that are required for the app.

    # zsh/bash
    AZURE_RESOURCE_GROUP="rg-$AZURE_ENV_NAME"
    AZURE_LOCATION=$(azd env get-value AZURE_LOCATION)
    az deployment group create \
        -g $AZURE_RESOURCE_GROUP \
        --template-file ./infra/aspire.bicep \
        --parameters environmentName=$AZURE_ENV_NAME \
        --parameters location=$AZURE_LOCATION
    
    # PowerShell
    $AZURE_RESOURCE_GROUP = "rg-$AZURE_ENV_NAME"
    $AZURE_LOCATION = azd env get-value AZURE_LOCATION
    az deployment group create `
        -g $AZURE_RESOURCE_GROUP `
        --template-file ./infra/aspire.bicep `
        --parameters environmentName=$AZURE_ENV_NAME `
        --parameters location=$AZURE_LOCATION

Unit Testing & Integration Testing & Linting OpenAPI Document

  1. Run the following command to run both unit tests and integration tests at once on your local machine.

    # zsh/bash
    ./scripts/run-tests.sh -c Debug -k || ./scripts/run-tests.sh -c Debug
    
    # PowerShell
    ./scripts/Run-Tests.ps1 -Configuration Debug -KillPorts

About

This provides a proxy server application of Azure OpenAI Service API that round-robins multiple Azure OpenAI Service instances.

License:MIT License


Languages

Language:C# 78.3%Language:PowerShell 10.1%Language:HTML 6.2%Language:CSS 2.4%Language:Bicep 1.7%Language:Shell 1.2%Language:Dockerfile 0.1%