Skip to content

Latest commit

 

History

History
37 lines (24 loc) · 1.07 KB

File metadata and controls

37 lines (24 loc) · 1.07 KB

Azure OpenAI JS Chatbot

This is a simple Node.js command-line application that demonstrates how to use the Azure OpenAI service with the openai JavaScript library.

Prerequisites

  • Node.js (v18+ recommended)
  • An Azure account with an active subscription.
  • An Azure OpenAI Service resource deployed with a model (e.g., gpt-35-turbo).

Setup

  1. Install dependencies:

    Using npm, install the required packages listed in package.json.

    npm install
  2. Configure Environment Variables:

    Create a .env file in the root of the project. This file will store your Azure OpenAI credentials. Add the following content to it, replacing the placeholder values with your specific details.

    AZURE_OPENAI_ENDPOINT="<YOUR_AZURE_OPENAI_ENDPOINT>"
    AZURE_OPENAI_API_KEY="<YOUR_AZURE_OPENAI_API_KEY>"
    MODEL_NAME="<YOUR_DEPLOYMENT_NAME>"

How to Run

Execute the script from your terminal using node. Pass your prompt as a command-line argument enclosed in quotes.

node run_model.js "Your prompt here"