File tree Expand file tree Collapse file tree 3 files changed +11
-13
lines changed Expand file tree Collapse file tree 3 files changed +11
-13
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ import {
23
23
LiveServerContent ,
24
24
LiveServerToolCall ,
25
25
LiveServerToolCallCancellation ,
26
- ResponseModality ,
26
+ ResponseModality
27
27
} from '../src' ;
28
28
import { liveTestConfigs } from './constants' ;
29
29
import { HELLO_AUDIO_PCM_BASE64 } from './sample-data/hello-audio' ;
@@ -177,12 +177,6 @@ describe('Live', function () {
177
177
} ) ;
178
178
179
179
it ( 'should send multiple audio chunks in a single batch call' , async ( ) => {
180
- // Sending more than one mediaChunk in a message to Google AI results in the server
181
- // closing the WebSocket connection with 'Request Contains an Invalid Argument.'.
182
- // Skip this test for Google AI.
183
- if ( testConfig . ai . backend . backendType === BackendType . GOOGLE_AI ) {
184
- return ;
185
- }
186
180
const model = getLiveGenerativeModel ( testConfig . ai , {
187
181
model : testConfig . model ,
188
182
generationConfig : textLiveGenerationConfig
@@ -241,7 +235,7 @@ describe('Live', function () {
241
235
* These tests are currently very unreliable. Their behavior seems to change frequently.
242
236
* Skipping them for now.
243
237
*/
244
- /**
238
+ /*
245
239
describe('function calling', () => {
246
240
// When this tests runs against the Google AI backend, the first message we get back
247
241
// has an `executableCode` part, and then
Original file line number Diff line number Diff line change 41
41
"test:browser" : " yarn testsetup && karma start" ,
42
42
"test:node" : " TS_NODE_COMPILER_OPTIONS='{\" module\" :\" commonjs\" }' mocha --require ts-node/register --require src/index.node.ts 'src/**/*.test.ts' --config ../../config/mocharc.node.js" ,
43
43
"test:integration" : " karma start --integration" ,
44
- "test:integration:node" : " TS_NODE_COMPILER_OPTIONS='{\" module\" :\" commonjs\" }' mocha integration/live .test.ts --config ../../config/mocharc.node.js" ,
44
+ "test:integration:node" : " TS_NODE_COMPILER_OPTIONS='{\" module\" :\" commonjs\" }' mocha integration/**/* .test.ts --config ../../config/mocharc.node.js" ,
45
45
"api-report" : " api-extractor run --local --verbose" ,
46
46
"typings:public" : " node ../../scripts/build/use_typings.js ./dist/ai-public.d.ts" ,
47
47
"trusted-type-check" : " tsec -p tsconfig.json --noEmit"
Original file line number Diff line number Diff line change @@ -101,10 +101,14 @@ export class LiveSession {
101
101
) ;
102
102
}
103
103
104
- const message : _LiveClientRealtimeInput = {
105
- realtimeInput : { mediaChunks }
106
- } ;
107
- this . webSocketHandler . send ( JSON . stringify ( message ) ) ;
104
+ // The backend does not support sending more than one mediaChunk in one message.
105
+ // Work around this limitation by sending mediaChunks in separate messages.
106
+ mediaChunks . forEach ( mediaChunk => {
107
+ const message : _LiveClientRealtimeInput = {
108
+ realtimeInput : { mediaChunks : [ mediaChunk ] }
109
+ } ;
110
+ this . webSocketHandler . send ( JSON . stringify ( message ) ) ;
111
+ } ) ;
108
112
}
109
113
110
114
/**
You can’t perform that action at this time.
0 commit comments