Provide a way to input JSON schema that's encoded in a raw form - so instead of having to
model := client.GenerativeModel("gemini-1.5-pro-002")
model.ResponseSchema = &genai.Schema{
Type: genai.TypeString,
}
I'd like to be able to
model := client.GenerativeModel("gemini-1.5-pro-002")
schema, err := genai.ParseRawSchema(`{"type": "string"}`)
if err != nil {
return fmt.Errorf("incompatible or incorrect JSON schema: %w", err)
}
model.ResponseSchema = schema
I can think of following ways to solve this, but I think this would be the easiest one.
What problem are you trying to solve with this feature?
There are following usecases in which it's useful to have the response schema as raw JSON:
It's a part of OpenAPI definition
It leverages schema registry (e.g. kafka schema registry)
It is used in other services supporting JSON schema - one major example can be GCP's own Data Stores
One wants to experiment with given schema in the chat UI. In that case, thay can paste the schema in the chat settings. Currently this would involve manually translating in-code schema definition to JSON schema defintion.
One wants to generate their types definitions based on schema using one of existing JSON Schema -> go types generators.
One wants to additionally validate response against schema using existing tooling
Description of the feature request:
Provide a way to input JSON schema that's encoded in a raw form - so instead of having to
I'd like to be able to
I can think of following ways to solve this, but I think this would be the easiest one.
What problem are you trying to solve with this feature?
There are following usecases in which it's useful to have the response schema as raw JSON:
Any other information you'd like to share?
No response