-
Notifications
You must be signed in to change notification settings - Fork 975
feat(ai): Add method to send function responses in a live session #9272
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
Conversation
🦋 Changeset detectedLatest commit: e182238 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Changeset File Check ✅
|
Size Report 1Affected Products
Test Logs |
Size Analysis Report 1Affected Products
Test Logs |
.changeset/lazy-donuts-agree.md
Outdated
|
||
Added a `sendFunctionResponses` method to `LiveSession`, allowing function responses to be sent during realtime sessions. | ||
Fixes an issue where function responses during audio conversations caused the WebSocket connection to close. See [GitHub Issue #9264](https://github.com/firebase/firebase-js-sdk/issues/9264). | ||
- **Breaking Change**: `StartAudioConversationOptions`' `functionCallingHandler` must now return a `Promise<FunctionResponse>`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- **Breaking Change**: `StartAudioConversationOptions`' `functionCallingHandler` must now return a `Promise<FunctionResponse>`. | |
- **Breaking Change**: Changed `StartAudioConversationOptions` and `functionCallingHandler` so that they must now return a `Promise<FunctionResponse>`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
functionCallingHandler
is what changed, and it is a property of StartAudioConversationOptions
.
Updated this to be:
- **Breaking Change**: Changed the `functionCallingHandler` property in `StartAudioConversationOptions` so that it now must return a `Promise<FunctionResponse>`.
This breaking change is allowed in a minor release since the Live API is in Public Preview.
wdyt?
* docs: Fix docgen script to clean out package temp folders first (#9250) * Version Packages (#9258) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Expose setUserProperties from internal analytics instance (#9263) * feat(ai): add support for URL context (#9254) * docs(ai): tag code execution with "beta" tag (public preview) (#9274) * fix(ai): Handle empty parts when streaming (#9262) * feat(ai): Add method to send function responses in a live session (#9272) * Update ai model name used for e2e tests (#9282) --------- Co-authored-by: Google Open Source Bot <[email protected]> Co-authored-by: Christina Holland <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Daniel La Rocque <[email protected]>
Adds
LiveSession.sendFunctionResponses
, which sends function responses to the server in the realtime message format. This message format is required by the Google AI backend to enable function calling during a realtime audio conversation.Since we used the non-realtime message format to send function call responses returned from
StartAudioConversationOptions.functionCallingHandler
, function calling during realtime audio conversations caused the WebSocket connection to close when using thestartAudioConversation
happy path.Breaking Change:
StartAudioConversationOptions.functionCallingHandler
now must return aPromise<FunctionResponse>
, instead of aPromise<Part>
. I made this change because thePart
needed to be aFunctionResponsePart
for this feature to work, andFunctionResponse
is the only property inFunctionResponsePart
. So this just simplifies things by removing the additional layers of types. This breaking change does not break our semantic versioning policy since this API is in Public Preview.This fixes #9264