Closed hari4698 closed 2 weeks ago
I am looking to add support for the strict
json schema too.
instructor-go currently gives a similar experience as the python API provides, and in place for Pydantic it use Go struct tags and jsonschema. Adding the API support will improve the performance of the model generating the correct format.
Great news.
I'm not sure how you will approach implementing the actual json schema definition within the request but consider allowing for different implementations of the actual json schema creation. I started with field tags, as in instructor-go, but have since moved away from that approach and think field tags are too limiting.
For instructor, JSON tags has been sufficient.
I have been struggling to convert the json schema to the currently defined struct here.
I think it would be great to optionally pass a raw schema to response_format
.
For example, the current struct does not support defs, which are crucial, especially with complex data types. The OpenAI API supports this: https://platform.openai.com/docs/guides/structured-outputs/supported-schemas.
This enhancement would be great!
Looks like this issue is resolved? https://github.com/sashabaranov/go-openai/pull/813
My issue above is resolved: for those wanting to use their own schema string, and not use the go-openai/jsonschema
, you can do the following:
JSONSchema: &openai.ChatCompletionResponseFormatJSONSchema{
Name: "my-name",
Schema: json.RawMessage(schemaJSONString),
Strict: true,
}
Support added for Structured Output. #813
I was wondering if there will support in the future for Structured Outputs. Open AI released this feature on August 6th.
Python example from the Open API docs: