You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Insert in any Typescript("typescript": "^5.2.2") environment to immediately see the issue | Run example in Node.js
Code snippets
importOpenAIfrom'openai';constclient=newOpenAI();asyncfunctionmain(){construnner=client.beta.chat.completions.runFunctions({model: 'gpt-3.5-turbo',messages: [{role: 'user',content: 'How is the weather this week?'}],functions: [{function: getCurrentLocation,description: 'This function gets the current location.',/*missing property*/parameters: {type: 'object',properties: {}},},{function: getWeather,parse: JSON.parse,// or use a validation library like zod for typesafe parsing.description: 'This function gets the weather for a given location.',/*missing property*/parameters: {type: 'object',properties: {location: {type: 'string'},},},},],}).on('message',(message)=>console.log(message));constfinalContent=awaitrunner.finalContent();console.log();console.log('Final content:',finalContent);}asyncfunctiongetCurrentLocation(){return'Boston';// Simulate lookup}asyncfunctiongetWeather(args: {location: string}){const{ location }=args;// … do lookup …return{ temperature, precipitation };}main();
OS
macOS
Node version
Node v21.1.0
Library version
OpenAI 4.20.1
The text was updated successfully, but these errors were encountered:
Confirm this is a Node library issue and not an underlying OpenAI API issue
Describe the bug
The
description
property is missing in theRunnableFunctionWithParse<any>
type on bothgetWeather
andgetCurrentLocation
.The description property is a string that describes what the function does, and are required under any
RunnableFunction
orParsedFunction
type:To fix this, we just simply need to add a
description
property to thegetWeather
andgetCurrentLocation
function objects in the Readme example.https://github.com/openai/openai-node/blob/master/README.md#automated-function-calls
To Reproduce
Code snippets
OS
macOS
Node version
Node v21.1.0
Library version
OpenAI 4.20.1
The text was updated successfully, but these errors were encountered: