Conversation
Owner
Author
|
I have this working with Azure, using a deployment I created named Example app: import openai
from shiny import App, Inputs, Outputs, Session, ui
import chatstream
openai.api_type = "azure"
openai.api_base = "https://winstontest.openai.azure.com/"
openai.api_version = "2023-03-15-preview"
app_ui = ui.page_fixed(
chatstream.chat_ui("mychat"),
)
def server(input: Inputs, output: Outputs, session: Session):
chatstream.chat_server(
"mychat",
api_key=os.getenv("OPENAI_API_KEY"),
model="gpt-3.5-turbo",
azure_deployment_id="my-gpt-35-turbo",
debug=True,
)
app = App(app_ui, server)Note that you must create a deployment with a custom name. In this case, it is Also note that this is created within an Azure resource named |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This adds a new
endpoint_typeparameter tochat_server. To use with Azure:Note that to use Azure, you will also probably need to set some values at the top of your app, as described in https://learn.microsoft.com/en-us/azure/cognitive-services/openai/how-to/switching-endpoints :
I currently do not have access to Azure OpenAI, so I can't test this myself. It can be installed with: