From 600fe670dc5eb335079a5238756305aa5bc39252 Mon Sep 17 00:00:00 2001 From: Hannes Nel Date: Wed, 18 Sep 2024 10:38:11 -0700 Subject: [PATCH] Updated docs a bit to help guide through first run experience. (#46) * Updated docs a bit to help guide through first run experience. --- docs/running-deploying.md | 27 ++++++++++++++++++++------- http/chat-completions.http | 14 ++++++++++++++ 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/docs/running-deploying.md b/docs/running-deploying.md index 78cfb37..ae5a6a7 100644 --- a/docs/running-deploying.md +++ b/docs/running-deploying.md @@ -28,13 +28,26 @@ make install-requirements ## Running the Simulator Locally -Before running the Azure OpenAI API Simulator you should ensure that you have set up your local config. See [Azure OpenAI API Simulator Configuration Options](./config.md) for details on how to do this. - -To run the simulated API, use the following command from the repository root directory: - -```console -make run-simulated-api -``` +1. Before running the Azure OpenAI API Simulator you should ensure that you have set up your local config. See [Azure OpenAI API Simulator Configuration Options](./config.md) for details on how to do this. + + The minimum set of environment variables you'll need in your `.env` file to run the simulator locally are as follows: + + ```dotenv + SIMULATOR_API_KEY=my-test-key + TEST_OPENAI_ENDPOINT=http://localhost:8000/ + TEST_OPENAI_KEY=my-test-key + TEST_OPENAI_DEPLOYMENT=gpt-3.5-turbo-0613 + ``` + +2. Start the simulator by running the following command in your terminal from the repository root directory: + + ```console + make run-simulated-api + ``` + + Kill the process and run the command again to restart the simulator whenever you make changes to the config. +3. Now open the [http/chat-completions.http](../http/chat-completions.http) file, and send the first POST request. If you are using the rest-client extension, you may have to set the environment to `test`. Use the `>p rest client: switch environment` command in VS Code to do so. +4. You should receive an http `200` response with some generated completions. Check the terminal for any warnings or errors. ## Changing the Simulator Mode diff --git a/http/chat-completions.http b/http/chat-completions.http index 0e66ec6..f423639 100644 --- a/http/chat-completions.http +++ b/http/chat-completions.http @@ -13,6 +13,20 @@ POST {{aoai_endpoint}}/openai/deployments/{{aoai_deployment}}/chat/completions?a Content-Type: application/json api-key: {{aoai_key}} +{ + "messages": [{ + "role": "user", + "content": "Is this thing on?" + }], + "model": "gpt-5-turbo-1", + "max_tokens": 20 +} + +### +POST {{aoai_endpoint}}/openai/deployments/{{aoai_deployment}}/chat/completions?api-version=2024-02-15-preview +Content-Type: application/json +api-key: {{aoai_key}} + { "messages": [{ "role": "user",