-
Notifications
You must be signed in to change notification settings - Fork 14
add description and required control #32
base: master
Are you sure you want to change the base?
Conversation
src/schema-builder.ts
Outdated
switch (typeof value) { | ||
case 'number': | ||
if (Number.isInteger(value)) { | ||
return { type: ValueType.Integer }; | ||
return description ? { type: ValueType.Integer, description } : { type: ValueType.Integer }; |
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.
description should be added to schema only if description is not null.
if (!options?.noRequired) { | ||
schema.required = keys; | ||
if(obj["excludeFromRequired"]){ |
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.
special, reserved function. Use to specify which properties should be excluded from the required
of specific object schema. terurns array of names of properties that should not be included in required
array
src/schema-builder.ts
Outdated
let description : string | undefined = undefined; | ||
|
||
if(obj["addDescriptionOfProperty"]){ | ||
description= obj["addDescriptionOfProperty"](key); |
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.
special, reserved function. function takes property name and returns description or undefined
Intention of this PR is to upgrade this library to be easier to use with OpenAI function calling
https://openai.com/blog/function-calling-and-other-api-updates
OpenAI function calling utilize heavily not required
description
schema property and also works better if you can exclude some properties fromrequired
array.