-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.