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

feat(azure): support for the Realtime API #1963

Merged
merged 6 commits into from
Dec 19, 2024

Conversation

kristapratico
Copy link
Contributor

@kristapratico kristapratico commented Dec 18, 2024

  • I understand that this repository is auto-generated and my pull request may not be merged

Changes being requested

Ensure we configure the websocket connection with the right configuration for Azure.

Additional context & links

@kristapratico kristapratico requested a review from a team as a code owner December 18, 2024 21:06
@RobertCraigie RobertCraigie changed the title patch azure to support realtime feat(azure): support for the Realtime API Dec 19, 2024
Copy link
Collaborator

@RobertCraigie RobertCraigie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM after the configure_azure_realtime change!

return isinstance(client, AsyncAzureOpenAI)


def configure_azure_realtime(client: AzureOpenAI, model: str, extra_query: Query) -> tuple[Query, dict[str, str]]:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: is the reason the configure_azure_realtime and configure_azure_realtime_async functions are in _utils.py because of circular imports?

I think it'd be cleaner to define these as private methods on the client classes themselves, then the __aenter__ method changes are just

if is_async_azure_client(self.__client):
  extra_query, auth_headers = await self.__client._configure_realtime(self.__model, extra_query)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call, that's a lot cleaner. Updated!

@RobertCraigie RobertCraigie changed the base branch from main to next December 19, 2024 17:26
@RobertCraigie RobertCraigie merged commit 9fda141 into openai:next Dec 19, 2024
2 checks passed
@RobertCraigie
Copy link
Collaborator

Would probably be a good idea to add an Azure specific example script as well?

@stainless-app stainless-app bot mentioned this pull request Dec 19, 2024
@kristapratico
Copy link
Contributor Author

Would probably be a good idea to add an Azure specific example script as well?

Sorry I just saw this. Added a simple example here: #1967

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