Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions sdk-samples/interactions_structured_output_json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ async function createInteractionsFromMLDev() {
const response = await ai.interactions.create({
model: 'gemini-2.5-flash',
input: 'Which are the colors of a rainbow',
response_mime_type: 'application/json',
response_format: {type: 'array', description: 'A list of colors'},
response_format: {
type: 'text',
mime_type: 'application/json',
schema: {type: 'array', description: 'A list of colors'},
},
});

console.debug(response);
Expand Down
19 changes: 11 additions & 8 deletions sdk-samples/interactions_tool_call_with_mime_type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,19 @@ async function createInteractionsFromMLDev() {
},
],
response_format: {
type: 'object',
properties: {
location: {type: 'string'},
temperature: {type: 'number'},
condition: {type: 'string'},
recommendation: {type: 'string'},
type: 'text',
mime_type: 'application/json',
schema: {
type: 'object',
properties: {
location: {type: 'string'},
temperature: {type: 'number'},
condition: {type: 'string'},
recommendation: {type: 'string'},
},
required: ['location', 'temperature', 'condition', 'recommendation'],
},
required: ['location', 'temperature', 'condition', 'recommendation'],
},
response_mime_type: 'application/json',
});

console.debug(response);
Expand Down
3 changes: 1 addition & 2 deletions src/gaos/models/interactions/response-format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@ export type ResponseFormat =
| AudioResponseFormat
| ImageResponseFormat
| TextResponseFormat
| VideoResponseFormat
| { [k: string]: any };
| VideoResponseFormat;
Loading