@@ -151,13 +151,13 @@ class RunnerListener {
151
151
. on ( 'content' , ( content ) => this . contents . push ( content ) )
152
152
. on ( 'message' , ( message ) => this . messages . push ( message ) )
153
153
. on ( 'chatCompletion' , ( completion ) => this . chatCompletions . push ( completion ) )
154
- . on ( 'functionCall ' , ( functionCall ) => this . functionCalls . push ( functionCall ) )
155
- . on ( 'functionCallResult ' , ( result ) => this . functionCallResults . push ( result ) )
154
+ . on ( 'functionToolCall ' , ( functionCall ) => this . functionCalls . push ( functionCall ) )
155
+ . on ( 'functionToolCallResult ' , ( result ) => this . functionCallResults . push ( result ) )
156
156
. on ( 'finalContent' , ( content ) => ( this . finalContent = content ) )
157
157
. on ( 'finalMessage' , ( message ) => ( this . finalMessage = message ) )
158
158
. on ( 'finalChatCompletion' , ( completion ) => ( this . finalChatCompletion = completion ) )
159
- . on ( 'finalFunctionCall ' , ( functionCall ) => ( this . finalFunctionCall = functionCall ) )
160
- . on ( 'finalFunctionCallResult ' , ( result ) => ( this . finalFunctionCallResult = result ) )
159
+ . on ( 'finalFunctionToolCall ' , ( functionCall ) => ( this . finalFunctionCall = functionCall ) )
160
+ . on ( 'finalFunctionToolCallResult ' , ( result ) => ( this . finalFunctionCallResult = result ) )
161
161
. on ( 'totalUsage' , ( usage ) => ( this . totalUsage = usage ) )
162
162
. on ( 'error' , ( error ) => ( this . error = error ) )
163
163
. on ( 'abort' , ( error ) => ( ( this . error = error ) , ( this . gotAbort = true ) ) )
@@ -175,8 +175,8 @@ class RunnerListener {
175
175
await expect ( this . runner . finalChatCompletion ( ) ) . rejects . toThrow ( error ) ;
176
176
await expect ( this . runner . finalMessage ( ) ) . rejects . toThrow ( error ) ;
177
177
await expect ( this . runner . finalContent ( ) ) . rejects . toThrow ( error ) ;
178
- await expect ( this . runner . finalFunctionCall ( ) ) . rejects . toThrow ( error ) ;
179
- await expect ( this . runner . finalFunctionCallResult ( ) ) . rejects . toThrow ( error ) ;
178
+ await expect ( this . runner . finalFunctionToolCall ( ) ) . rejects . toThrow ( error ) ;
179
+ await expect ( this . runner . finalFunctionToolCallResult ( ) ) . rejects . toThrow ( error ) ;
180
180
await expect ( this . runner . totalUsage ( ) ) . rejects . toThrow ( error ) ;
181
181
await expect ( this . runner . done ( ) ) . rejects . toThrow ( error ) ;
182
182
} else {
@@ -214,11 +214,11 @@ class RunnerListener {
214
214
expect ( this . finalChatCompletion ) . toEqual ( this . chatCompletions [ this . chatCompletions . length - 1 ] ) ;
215
215
expect ( await this . runner . finalChatCompletion ( ) ) . toEqual ( this . finalChatCompletion ) ;
216
216
expect ( this . finalFunctionCall ) . toEqual ( this . functionCalls [ this . functionCalls . length - 1 ] ) ;
217
- expect ( await this . runner . finalFunctionCall ( ) ) . toEqual ( this . finalFunctionCall ) ;
217
+ expect ( await this . runner . finalFunctionToolCall ( ) ) . toEqual ( this . finalFunctionCall ) ;
218
218
expect ( this . finalFunctionCallResult ) . toEqual (
219
219
this . functionCallResults [ this . functionCallResults . length - 1 ] ,
220
220
) ;
221
- expect ( await this . runner . finalFunctionCallResult ( ) ) . toEqual ( this . finalFunctionCallResult ) ;
221
+ expect ( await this . runner . finalFunctionToolCallResult ( ) ) . toEqual ( this . finalFunctionCallResult ) ;
222
222
expect ( this . chatCompletions ) . toEqual ( this . runner . allChatCompletions ( ) ) ;
223
223
expect ( this . messages ) . toEqual ( this . runner . messages . slice ( - this . messages . length ) ) ;
224
224
if ( this . chatCompletions . some ( ( c ) => c . usage ) ) {
@@ -266,13 +266,13 @@ class StreamingRunnerListener {
266
266
. on ( 'content' , ( delta , snapshot ) => this . eventContents . push ( [ delta , snapshot ] ) )
267
267
. on ( 'message' , ( message ) => this . eventMessages . push ( message ) )
268
268
. on ( 'chatCompletion' , ( completion ) => this . eventChatCompletions . push ( completion ) )
269
- . on ( 'functionCall ' , ( functionCall ) => this . eventFunctionCalls . push ( functionCall ) )
270
- . on ( 'functionCallResult ' , ( result ) => this . eventFunctionCallResults . push ( result ) )
269
+ . on ( 'functionToolCall ' , ( functionCall ) => this . eventFunctionCalls . push ( functionCall ) )
270
+ . on ( 'functionToolCallResult ' , ( result ) => this . eventFunctionCallResults . push ( result ) )
271
271
. on ( 'finalContent' , ( content ) => ( this . finalContent = content ) )
272
272
. on ( 'finalMessage' , ( message ) => ( this . finalMessage = message ) )
273
273
. on ( 'finalChatCompletion' , ( completion ) => ( this . finalChatCompletion = completion ) )
274
- . on ( 'finalFunctionCall ' , ( functionCall ) => ( this . finalFunctionCall = functionCall ) )
275
- . on ( 'finalFunctionCallResult ' , ( result ) => ( this . finalFunctionCallResult = result ) )
274
+ . on ( 'finalFunctionToolCall ' , ( functionCall ) => ( this . finalFunctionCall = functionCall ) )
275
+ . on ( 'finalFunctionToolCallResult ' , ( result ) => ( this . finalFunctionCallResult = result ) )
276
276
. on ( 'error' , ( error ) => ( this . error = error ) )
277
277
. on ( 'abort' , ( abort ) => ( this . error = abort ) )
278
278
. on ( 'end' , ( ) => ( this . gotEnd = true ) ) ;
@@ -285,8 +285,8 @@ class StreamingRunnerListener {
285
285
await expect ( this . runner . finalChatCompletion ( ) ) . rejects . toThrow ( error ) ;
286
286
await expect ( this . runner . finalMessage ( ) ) . rejects . toThrow ( error ) ;
287
287
await expect ( this . runner . finalContent ( ) ) . rejects . toThrow ( error ) ;
288
- await expect ( this . runner . finalFunctionCall ( ) ) . rejects . toThrow ( error ) ;
289
- await expect ( this . runner . finalFunctionCallResult ( ) ) . rejects . toThrow ( error ) ;
288
+ await expect ( this . runner . finalFunctionToolCall ( ) ) . rejects . toThrow ( error ) ;
289
+ await expect ( this . runner . finalFunctionToolCallResult ( ) ) . rejects . toThrow ( error ) ;
290
290
await expect ( this . runner . done ( ) ) . rejects . toThrow ( error ) ;
291
291
} else {
292
292
expect ( this . error ) . toBeUndefined ( ) ;
@@ -318,11 +318,11 @@ class StreamingRunnerListener {
318
318
expect ( this . finalChatCompletion ) . toEqual ( this . eventChatCompletions [ this . eventChatCompletions . length - 1 ] ) ;
319
319
expect ( await this . runner . finalChatCompletion ( ) ) . toEqual ( this . finalChatCompletion ) ;
320
320
expect ( this . finalFunctionCall ) . toEqual ( this . eventFunctionCalls [ this . eventFunctionCalls . length - 1 ] ) ;
321
- expect ( await this . runner . finalFunctionCall ( ) ) . toEqual ( this . finalFunctionCall ) ;
321
+ expect ( await this . runner . finalFunctionToolCall ( ) ) . toEqual ( this . finalFunctionCall ) ;
322
322
expect ( this . finalFunctionCallResult ) . toEqual (
323
323
this . eventFunctionCallResults [ this . eventFunctionCallResults . length - 1 ] ,
324
324
) ;
325
- expect ( await this . runner . finalFunctionCallResult ( ) ) . toEqual ( this . finalFunctionCallResult ) ;
325
+ expect ( await this . runner . finalFunctionToolCallResult ( ) ) . toEqual ( this . finalFunctionCallResult ) ;
326
326
expect ( this . eventChatCompletions ) . toEqual ( this . runner . allChatCompletions ( ) ) ;
327
327
expect ( this . eventMessages ) . toEqual ( this . runner . messages . slice ( - this . eventMessages . length ) ) ;
328
328
if ( error ) {
@@ -1603,7 +1603,7 @@ describe('resource completions', () => {
1603
1603
} ,
1604
1604
{ signal : controller . signal } ,
1605
1605
) ;
1606
- runner . on ( 'functionCallResult ' , ( ) => controller . abort ( ) ) ;
1606
+ runner . on ( 'functionToolCallResult ' , ( ) => controller . abort ( ) ) ;
1607
1607
const listener = new StreamingRunnerListener ( runner ) ;
1608
1608
1609
1609
await handleRequest ( async function * ( request ) : AsyncIterable < OpenAI . Chat . ChatCompletionChunk > {
0 commit comments