Replies: 2 comments 1 reply
-
|
From gemini typescript file (genai.d.ts): export declare interface GenerateContentConfig {
responseMimeType?: string;
/** The `Schema` object allows the definition of input and output data types.
These types can be objects, but also primitives and arrays.
Represents a select subset of an [OpenAPI 3.0 schema
object](https://spec.openapis.org/oas/v3.0.3#schema).
If set, a compatible response_mime_type must also be set.
Compatible mimetypes: `application/json`: Schema for JSON response.
If `response_schema` doesn't process your schema correctly, try using
`response_json_schema` instead.
*/
responseSchema?: SchemaUnion;
/** Optional. Output schema of the generated response.
This is an alternative to `response_schema` that accepts [JSON
Schema](https://json-schema.org/). If set, `response_schema` must be
omitted, but `response_mime_type` is required. While the full JSON Schema
may be sent, not all features are supported. Specifically, only the
following properties are supported: - `$id` - `$defs` - `$ref` - `$anchor`
- `type` - `format` - `title` - `description` - `enum` (for strings and
numbers) - `items` - `prefixItems` - `minItems` - `maxItems` - `minimum` -
`maximum` - `anyOf` - `oneOf` (interpreted the same as `anyOf`) -
`properties` - `additionalProperties` - `required` The non-standard
`propertyOrdering` property may also be set. Cyclic references are
unrolled to a limited degree and, as such, may only be used within
non-required properties. (Nullable properties are not sufficient.) If
`$ref` is set on a sub-schema, no other properties, except for than those
starting as a `$`, may be set. */
responseJsonSchema?: unknown;
} |
Beta Was this translation helpful? Give feedback.
1 reply
-
|
Hi, we are working on a PR to support output schemas natively. I hadn't added Gemini but I'll look at this. We are also working on a second PR to support the new Gemini interactions API. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Currently, the
@tanstack/ai-geminiadapter use the oldresponseSchemaproperty which only handle a limited subset of JSON schema. https://github.com/TanStack/ai/blob/main/packages/typescript/ai-gemini/src/adapters/text.ts#L182Gemini now allows a
responseJsonSchemawith a valid JSON schema, which allow a lot more flexibility: https://ai.google.dev/gemini-api/docs/structured-output?hl=fr&example=recipeCould you please update it?
Beta Was this translation helpful? Give feedback.
All reactions