Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Python FastAPI middle tier demo for Azure backend #110

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

kingychiu
Copy link

@kingychiu kingychiu commented Dec 24, 2024

Purpose

  1. The original code force people to use Azure CLI to login, this PR add another option (using the API Key generated from Azure Portal)

  2. 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.

  3. Change the default voice to alloy, because coral voice also trigger a runtime exception.

  4. The import order changes are from ruff linter & format, if you wish I can revert those.

Does this introduce a breaking change?

[ ] Yes
[X] No

Pull Request Type

What kind of change does this Pull Request introduce?

[X] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Documentation content changes
[ ] Other... Please describe:

How to Test

  • Setup and start the backend under: samples/middle-tier/python-fastapi
  • Setup and start the frontend under: samples/middle-tier/generic-frontend
  • Send a text message for a response.

Other Information

I found another issue (not fixed by this PR): the RTClient.generate_response conflicts with RTClient.events, because both will take the response.created event. As a result

  • RTClient.generate_response will be blocked forever, because response.created is removed by RTClient.events
  • In the demo here, we cannot send text messages more than once, because the first text message will block the process.

I am creating another issue for this: #111

@kingychiu
Copy link
Author

@kingychiu please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"

Contributor License Agreement

@microsoft-github-policy-service agree

@ElliotRoe
Copy link

Please merge 🙏 I am also have these troubles with the Python middle tier

@ElliotRoe
Copy link

@kingychiu are you maintaining an updated version of the rtclient package? I'd be happy to contribute if so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants