-
-
Notifications
You must be signed in to change notification settings - Fork 669
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
Support for OpenAI's structured output via json_schema
in the response_format
#1084
Comments
I'm having similar problem, but for latest Ollama (0.5.1). |
@DarkCaster ohh! please share the link if you don't mind! i'd love to see how you did that. thank you so much! |
@yaylinda sure. So, here is my mitm-http client implementation: https://github.com/DarkCaster/Perpetual/blob/main/llm/mitmHTTPClient.go
SchemaToInject is a map[string]interface{} object, that produce JSON-schema when serialized, like that: The logic of mitmHTTPClient::RoundTrip is the following:
I think you can use similar approach with OpenAI provider, according to documentation it also use schema from request body ("response_format" field): https://openai.com/index/introducing-structured-outputs-in-the-api , https://platform.openai.com/docs/guides/structured-outputs |
I would like to use OpenAI's structured output and pass my
json_schema
in theresponse_format
when I callGenerateResponse
(not usingtools
or function calls).I came across this unit test that accomplishes this and uses
ResponseFormatJSONSchema
andResponseFormatJSONSchemaProperty
types within theResponseFormat
object.However, the publicly exposed
ResponseFormat
struct only has theType
field, andResponseFormatJSONSchema
andResponseFormatJSONSchemaProperty
types are not exposed at all.Could those structs be exposed so that we can construct a
ResponseFormat
like the one in your unit test?Thank you!
The text was updated successfully, but these errors were encountered: