Skip to content

Commit eb773ee

Browse files
committed
docs(migration): mention function renames
1 parent fdd6f66 commit eb773ee

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

MIGRATION.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,42 @@ If you were importing these classes at runtime, you'll need to switch to importi
382382
The deprecated `client.beta.chat.completions.runFunctions()` method and all of it's surrounding types have been removed, instead you should use
383383
`client.beta.chat.completions.runTools()`.
384384

385+
### `.runTools()` event / method names
386+
387+
To better align with the tool-based API, several event names in the ChatCompletionRunner have been renamed:
388+
389+
```ts
390+
// Before
391+
openai.beta.chat.completions
392+
.runTools({
393+
// ..
394+
})
395+
.on('functionCall', (functionCall) => console.log('functionCall', functionCall))
396+
.on('functionCallResult', (functionCallResult) => console.log('functionCallResult', functionCallResult))
397+
.on('finalFunctionCall', (functionCall) => console.log('finalFunctionCall', functionCall))
398+
.on('finalFunctionCallResult', (result) => console.log('finalFunctionCallResult', result));
399+
400+
// After
401+
openai.beta.chat.completions
402+
.runTools({
403+
// ..
404+
})
405+
.on('functionToolCall', (functionCall) => console.log('functionCall', functionCall))
406+
.on('functionToolCallResult', (functionCallResult) => console.log('functionCallResult', functionCallResult))
407+
.on('finalFunctionToolCall', (functionCall) => console.log('finalFunctionCall', functionCall))
408+
.on('finalFunctionToolCallResult', (result) => console.log('finalFunctionCallResult', result));
409+
```
410+
411+
The following event names have been changed:
412+
- `functionCall``functionToolCall`
413+
- `functionCallResult``functionToolCallResult`
414+
- `finalFunctionCall``finalFunctionToolCall`
415+
- `finalFunctionCallResult``finalFunctionToolCallResult`
416+
417+
Additionally, the following methods have been renamed:
418+
- `runner.finalFunctionCall()``runner.finalFunctionToolCall()`
419+
- `runner.finalFunctionCallResult()``runner.finalFunctionToolCallResult()`
420+
385421
### `openai/src` directory removed
386422

387423
Previously IDEs may have auto-completed imports from the `openai/src` directory, however this

0 commit comments

Comments
 (0)