Skip to content
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

Model seems to ignore .optional() fields, and instead uses nullary values, empty strings etc' #1180

Open
1 task done
uriva opened this issue Nov 11, 2024 · 1 comment
Open
1 task done
Labels
bug Something isn't working

Comments

@uriva
Copy link

uriva commented Nov 11, 2024

Confirm this is a Node library issue and not an underlying OpenAI API issue

  • This is an issue with the Node library

Describe the bug

Model seems to ignore .optional() fields, and instead uses nullary values, empty strings etc'

I'm not sure if it's a library issue or chatgpt model issue.

To Reproduce

I suspect this is a KI or an upstream problem, but let me know if not I'll send a repro

Code snippets

No response

OS

ubuntu

Node version

22.7.0

Library version

4.57.0

@uriva uriva added the bug Something isn't working label Nov 11, 2024
@uriva
Copy link
Author

uriva commented Nov 12, 2024

According to the docs, the model treats all fields as required, but it is recommended to use a union with null to achieve this: https://platform.openai.com/docs/guides/structured-outputs#all-fields-must-be-required

This sounds like zod's .optional should be interperted like that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant