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
Thanks for this great library. I’m trying to get a normal JSON response (not a structured schema-based response, just raw JSON like { title, description, tags, ... }).
I noticed there’s a method called usingStructuredMode() that accepts one of the StructuredMode enums (Auto, Json, Structured). However, this is only available when using structured mode, and to use that, I need to provide a schema—which I don’t want to do.
I simply want to receive a plain JSON response from the OpenAI model (e.g., by formatting the prompt properly and instructing the model to return JSON), but I’m unsure how to do that through this library.
My questions are:
1. If I’m not using structured mode, and just using text() mode, how can I set the response_format to return JSON?
2. Is there a way to use the structured mode without providing a schema?
3. Is there an example or recommendation for generating JSON responses without going full structured/schema mode?
I’ve checked the docs, but haven’t found any example for normal Json response, it's either text or structured!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone,
Thanks for this great library. I’m trying to get a normal JSON response (not a structured schema-based response, just raw JSON like { title, description, tags, ... }).
I noticed there’s a method called
usingStructuredMode()
that accepts one of the StructuredMode enums (Auto, Json, Structured). However, this is only available when using structured mode, and to use that, I need to provide a schema—which I don’t want to do.I simply want to receive a plain JSON response from the OpenAI model (e.g., by formatting the prompt properly and instructing the model to return JSON), but I’m unsure how to do that through this library.
My questions are:
1. If I’m not using structured mode, and just using text() mode, how can I set the
response_format
to return JSON?2. Is there a way to use the structured mode without providing a schema?
3. Is there an example or recommendation for generating JSON responses without going full structured/schema mode?
I’ve checked the docs, but haven’t found any example for normal Json response, it's either text or structured!
Beta Was this translation helpful? Give feedback.
All reactions