Skip to content

Commit 6fb5386

Browse files
MarkDaoustcopybara-github
authored andcommitted
fix: Steps is not optional
PiperOrigin-RevId: 914062002
1 parent 32b4abe commit 6fb5386

9 files changed

Lines changed: 14 additions & 18 deletions

sdk-samples/interactions_function_calling_client_state.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,9 @@ async function createInteractionsFromMLDev() {
6363
});
6464

6565
// add model response back to history
66-
if (response.steps) {
67-
fcConversationHistory.push(...response.steps);
68-
}
66+
fcConversationHistory.push(...response.steps);
6967

70-
for (const step of response.steps ?? []) {
68+
for (const step of response.steps) {
7169
if (step.type == 'function_call') {
7270
console.log(
7371
`Function call: ${step.name} with arguments ${JSON.stringify(

sdk-samples/interactions_function_calling_server_state.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ async function createInteractionsFromMLDev() {
5151
],
5252
});
5353

54-
for (const step of response.steps ?? []) {
54+
for (const step of response.steps) {
5555
if (step.type == 'function_call') {
5656
console.log(
5757
`Function call: ${step.name} with arguments ${JSON.stringify(

sdk-samples/interactions_multimodal_response_audio.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ async function createInteractionsFromMLDev() {
2121
},
2222
});
2323

24-
interaction.steps?.forEach((step, index) => {
24+
interaction.steps.forEach((step, index) => {
2525
if (step.type === 'model_output') {
2626
step.content?.forEach((content) => {
2727
if (content.type === 'audio') {

sdk-samples/interactions_multimodal_response_audio_with_generate_content.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ async function createInteractionsFromMLDev() {
2323
},
2424
});
2525

26-
interaction.steps?.forEach((step, index) => {
26+
interaction.steps.forEach((step, index) => {
2727
if (step.type === 'model_output') {
2828
step.content?.forEach((content) => {
2929
if (content.type === 'audio') {

sdk-samples/interactions_multimodal_response_image.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ async function createInteractionsFromMLDev() {
1818
input: 'Generate an image of a futuristic cityscape at sunset.',
1919
});
2020

21-
interaction.steps?.forEach((step, index) => {
21+
interaction.steps.forEach((step, index) => {
2222
if (step.type === 'model_output') {
2323
step.content?.forEach((content) => {
2424
if (content.type === 'image') {

sdk-samples/interactions_multimodal_response_image_with_generate_content.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ async function createInteractionsFromMLDev() {
2020
input: 'Generate an image of a futuristic cityscape at sunset.',
2121
});
2222

23-
interaction.steps?.forEach((step, index) => {
23+
interaction.steps.forEach((step, index) => {
2424
if (step.type === 'model_output') {
2525
step.content?.forEach((content) => {
2626
if (content.type === 'image') {

sdk-samples/interactions_stateless.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ async function createInteractionsFromMLDev() {
3333
});
3434
console.log('Model: ', response1);
3535

36-
if (response1.steps) {
37-
conversationHistory.push(...response1.steps);
38-
}
36+
conversationHistory.push(...response1.steps);
3937

4038
conversationHistory.push({
4139
type: 'user_input',

sdk-samples/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/interactions/resources/interactions.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,6 +1035,11 @@ export interface Interaction {
10351035
*/
10361036
status: 'in_progress' | 'requires_action' | 'completed' | 'failed' | 'cancelled' | 'incomplete';
10371037

1038+
/**
1039+
* Required. Output only. The steps that make up the interaction.
1040+
*/
1041+
steps: Array<Step>;
1042+
10381043
/**
10391044
* Required. Output only. The time at which the response was last updated in ISO
10401045
* 8601 format (YYYY-MM-DDThh:mm:ssZ).
@@ -1110,11 +1115,6 @@ export interface Interaction {
11101115
*/
11111116
service_tier?: 'flex' | 'standard' | 'priority';
11121117

1113-
/**
1114-
* Output only. The steps that make up the interaction.
1115-
*/
1116-
steps?: Array<Step>;
1117-
11181118
/**
11191119
* System instruction for the interaction.
11201120
*/

0 commit comments

Comments
 (0)