Fix Python FastAPI middle tier demo for Azure backend #110
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.
Purpose
The original code force people to use Azure CLI to login, this PR add another option (using the API Key generated from Azure Portal)
The client.send_item expects the message to have an id attribute because it expects an Item type, so the current demo will raise an exception when user try to send a text message. Updating to UserMessageItem type has default id=None attribute.
Change the default voice to alloy, because coral voice also trigger a runtime exception.
The import order changes are from ruff linter & format, if you wish I can revert those.
Does this introduce a breaking change?
Pull Request Type
What kind of change does this Pull Request introduce?
How to Test
Other Information
I found another issue (not fixed by this PR): the
RTClient.generate_response
conflicts withRTClient.events
, because both will take theresponse.created
event. As a resultRTClient.generate_response
will be blocked forever, becauseresponse.created
is removed byRTClient.events
I am creating another issue for this: #111