Skip to content

Latest commit

 

History

History
245 lines (181 loc) · 6.76 KB

File metadata and controls

245 lines (181 loc) · 6.76 KB

OpenChat Playground with Upstage

This page describes how to run OpenChat Playground (OCP) with Upstage Solar models integration.

Get the repository root

  1. Get the repository root.

    # bash/zsh
    REPOSITORY_ROOT=$(git rev-parse --show-toplevel)
    # PowerShell
    $REPOSITORY_ROOT = git rev-parse --show-toplevel

Run on local machine

  1. Make sure you are at the repository root.

    cd $REPOSITORY_ROOT
  2. Add Upstage API Key for Upstage Solar connection. Make sure you should replace {{UPSTAGE_API_KEY}} with your Upstage API key.

    # bash/zsh
    dotnet user-secrets --project $REPOSITORY_ROOT/src/OpenChat.PlaygroundApp \
        set Upstage:ApiKey "{{UPSTAGE_API_KEY}}"
    # PowerShell
    dotnet user-secrets --project $REPOSITORY_ROOT/src/OpenChat.PlaygroundApp `
        set Upstage:ApiKey "{{UPSTAGE_API_KEY}}"

    For more details about Upstage API Keys, refer to the doc, Upstage API key.

  3. Run the app. The default model OCP uses is solar-mini.

    # bash/zsh
    dotnet run --project $REPOSITORY_ROOT/src/OpenChat.PlaygroundApp -- \
        --connector-type Upstage
    # PowerShell
    dotnet run --project $REPOSITORY_ROOT/src/OpenChat.PlaygroundApp -- `
        --connector-type Upstage

    Alternatively, if you want to run with a different model, say solar-pro2, other than the default one, you can specify it as an argument:

    # bash/zsh
    dotnet run --project $REPOSITORY_ROOT/src/OpenChat.PlaygroundApp -- \
        --connector-type Upstage \
        --model solar-pro2
    # PowerShell
    dotnet run --project $REPOSITORY_ROOT/src/OpenChat.PlaygroundApp -- `
        --connector-type Upstage `
        --model solar-pro2
  4. Open your web browser, navigate to http://localhost:5280, and enter prompts.

Run in local container

  1. Make sure you are at the repository root.

    cd $REPOSITORY_ROOT
  2. Build a container.

    docker build -f Dockerfile -t openchat-playground:latest .
  3. Get Upstage API Key.

    # bash/zsh
    API_KEY=$(dotnet user-secrets --project ./src/OpenChat.PlaygroundApp list --json | \
              sed -n '/^\/\//d; p' | jq -r '."Upstage:ApiKey"')
    # PowerShell
    $API_KEY = (dotnet user-secrets --project ./src/OpenChat.PlaygroundApp list --json | `
                Select-String -NotMatch '^//(BEGIN|END)' | ConvertFrom-Json).'Upstage:ApiKey'
  4. Run the app. The default model OCP uses is solar-mini.

    # bash/zsh - from locally built container
    docker run -i --rm -p 8080:8080 openchat-playground:latest \
        --connector-type Upstage \
        --api-key $API_KEY
    # PowerShell - from locally built container
    docker run -i --rm -p 8080:8080 openchat-playground:latest `
        --connector-type Upstage `
        --api-key $API_KEY
    # bash/zsh - from GitHub Container Registry
    docker run -i --rm -p 8080:8080 ghcr.io/aliencube/open-chat-playground/openchat-playground:latest \
        --connector-type Upstage \
        --api-key $API_KEY
    # PowerShell - from GitHub Container Registry
    docker run -i --rm -p 8080:8080 ghcr.io/aliencube/open-chat-playground/openchat-playground:latest `
        --connector-type Upstage `
        --api-key $API_KEY

    Alternatively, if you want to run with a different model, say solar-pro2, other than the default one, you can specify it as an argument:

    # bash/zsh - from locally built container
    docker run -i --rm -p 8080:8080 openchat-playground:latest \
        --connector-type Upstage \
        --api-key $API_KEY \
        --model solar-pro2
    # PowerShell - from locally built container
    docker run -i --rm -p 8080:8080 openchat-playground:latest `
        --connector-type Upstage `
        --api-key $API_KEY `
        --model solar-pro2
    # bash/zsh - from GitHub Container Registry
    docker run -i --rm -p 8080:8080 ghcr.io/aliencube/open-chat-playground/openchat-playground:latest \
        --connector-type Upstage \
        --api-key $API_KEY \
        --model solar-pro2
    # PowerShell - from GitHub Container Registry
    docker run -i --rm -p 8080:8080 ghcr.io/aliencube/open-chat-playground/openchat-playground:latest `
        --connector-type Upstage `
        --api-key $API_KEY `
        --model solar-pro2
  5. Open your web browser, navigate to http://localhost:8080, and enter prompts.

Run on Azure

  1. Make sure you are at the repository root.

    cd $REPOSITORY_ROOT
  2. Login to Azure.

    azd auth login
  3. Check login status.

    azd auth login --check-status
  4. Initialize azd template.

    azd init

    NOTE: You will be asked to provide environment name for provisioning.

  5. Get Upstage API Key.

    # bash/zsh
    API_KEY=$(dotnet user-secrets --project ./src/OpenChat.PlaygroundApp list --json | \
              sed -n '/^\/\//d; p' | jq -r '."Upstage:ApiKey"')
    # PowerShell
    $API_KEY = (dotnet user-secrets --project ./src/OpenChat.PlaygroundApp list --json | `
                Select-String -NotMatch '^//(BEGIN|END)' | ConvertFrom-Json).'Upstage:ApiKey'
  6. Set Upstage API Key to azd environment variables.

    azd env set UPSTAGE_API_KEY $API_KEY

    The default model OCP uses is solar-mini. If you want to run with a different model, say solar-pro2, other than the default one, add it to azd environment variables.

    azd env set UPSTAGE_MODEL "solar-pro2"
  7. Set the connector type to Upstage.

    azd env set CONNECTOR_TYPE "Upstage"
  8. Run the following commands in order to provision and deploy the app.

    azd up

    NOTE: You will be asked to provide Azure subscription and location for deployment.

    Once deployed, you will be able to see the deployed OCP app URL.

  9. Open your web browser, navigate to the OCP app URL, and enter prompts.

  10. Clean up all the resources.

    azd down --force --purge