From 44a7074292b2fb38a2633ac73f19f0b97bd7249c Mon Sep 17 00:00:00 2001 From: Chester Hu <hcp199242@gmail.com> Date: Mon, 10 Jun 2024 10:40:20 -0700 Subject: [PATCH] Update the streaming API from str to bool based on API backend update --- .../Azure_API_example/azure_api_example.ipynb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/recipes/llama_api_providers/Azure_API_example/azure_api_example.ipynb b/recipes/llama_api_providers/Azure_API_example/azure_api_example.ipynb index 103cf8da..2b8b3617 100644 --- a/recipes/llama_api_providers/Azure_API_example/azure_api_example.ipynb +++ b/recipes/llama_api_providers/Azure_API_example/azure_api_example.ipynb @@ -96,7 +96,7 @@ "Streaming allows the generated tokens to be sent as data-only server-sent events whenever they become available. \n", "This is extremely important for interactive applications such as chatbots, so the user is always engaged. \n", "\n", - "To use streaming, simply set `\"stream\":\"True\"` as part of the request payload. \n", + "To use streaming, simply set `\"stream\":True` as part of the request payload. \n", "In the streaming mode, the REST API response will be different from non-streaming mode.\n", "\n", "Here is an example: " @@ -108,7 +108,7 @@ "metadata": {}, "outputs": [], "source": [ - "!curl -X POST -L https://your-endpoint.inference.ai.azure.com/v1/chat/completions -H 'Content-Type: application/json' -H 'Authorization: your-auth-key' -d '{\"messages\":[{\"content\":\"You are a helpful assistant.\",\"role\":\"system\"},{\"content\":\"Who wrote the book Innovators dilemma?\",\"role\":\"user\"}], \"max_tokens\": 500, \"stream\": \"True\"}'" + "!curl -X POST -L https://your-endpoint.inference.ai.azure.com/v1/chat/completions -H 'Content-Type: application/json' -H 'Authorization: your-auth-key' -d '{\"messages\":[{\"content\":\"You are a helpful assistant.\",\"role\":\"system\"},{\"content\":\"Who wrote the book Innovators dilemma?\",\"role\":\"user\"}], \"max_tokens\": 500, \"stream\": True}'" ] }, { @@ -170,7 +170,7 @@ " {\"role\":\"user\", \"content\":\"Who wrote the book Innovators dilemma?\"}], \n", " \"max_tokens\": 500,\n", " \"temperature\": 0.9,\n", - " \"stream\": \"True\",\n", + " \"stream\": True,\n", "}\n", "\n", "body = str.encode(json.dumps(data))\n", @@ -230,7 +230,7 @@ " {\"role\":\"user\", \"content\":\"Who wrote the book Innovators dilemma?\"}],\n", " \"max_tokens\": 500,\n", " \"temperature\": 0.9,\n", - " \"stream\": \"True\"\n", + " \"stream\": True\n", "}\n", "\n", "\n", -- GitLab