Interaction.outputText() always returns Optional.empty() (SDK-computed field is never populated)
メンテナーはふだん 1 日以内に返信
@hemasekhar-p がすでに取り組んでいます。
2026年10月5日 から。
評価
この issue はまだ評価されていません。
説明
Environment details
- SDK version:
com.google.genai:google-genai:1.73.0(also reproducible onmain) - Java version: 21 / 25
Problem description
com.google.genai.gaos.models.interactions.Interaction.outputText() is documented as an SDK-populated convenience property:
/**
* Concatenated text from the last model output in response to the current request.
*
* <p>Note: this is added by the SDK.
*/
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("output_text")
private String outputText;
However, the Gemini Interactions REST API does not return an "output_text" field in the JSON response payload (text blocks are returned inside steps -> ModelOutputStep -> TextContent). Because Interaction.java is generated by Speakeasy as a plain Jackson POJO and no SDK hook or getter computes outputText from steps, interaction.outputText() always returns Optional.empty().
(The same appears to apply to outputAudio(), outputImage(), and outputVideo() on Interaction.)
Steps to reproduce
import com.google.genai.Client;
import com.google.genai.gaos.models.interactions.CreateModelInteraction;
import com.google.genai.gaos.models.interactions.Interaction;
import com.google.genai.gaos.models.interactions.InteractionsInput;
import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;
public class Repro {
public static void main(String[] args) {
try (Client client = new Client()) {
CreateModelInteraction request =
CreateModelInteraction.builder()
.model("gemini-2.5-flash")
.input(InteractionsInput.of("Tell me a short joke."))
.build();
Interaction interaction =
client.interactions
.create(CreateInteractionRequestBody.of(request))
.interaction()
.orElseThrow();
// Prints Optional.empty even though interaction.steps() contains a ModelOutputStep with TextContent
System.out.println("outputText: " + interaction.outputText());
}
}
}
Current workaround
Callers have to manually traverse interaction.steps(), unwrap Step.value(), match ModelOutputStep, iterate its content(), unwrap Content.value(), and concatenate TextContent.text():
StringBuilder sb = new StringBuilder();
interaction.steps().ifPresent(steps -> {
for (var step : steps) {
if (step.value() instanceof ModelOutputStep modelOutput) {
modelOutput.content().ifPresent(contents -> {
for (var content : contents) {
if (content.value() instanceof TextContent textContent) {
textContent.text().ifPresent(sb::append);
}
}
});
}
}
});
Expected behavior
interaction.outputText() should return the concatenated text from the last ModelOutputStep in interaction.steps() (either computed lazily in Interaction.outputText() when this.outputText == null, or populated via a Speakeasy AfterSuccess hook in SDKHooks), matching the Javadoc contract ("Concatenated text from the last model output in response to the current request. Note: this is added by the SDK.").
- 主要言語
- Java
- スター
- 398
- フォーク
- 126
- 平均マージ
- 1日 12時間
- マージ済み PR(30日)
- 71
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
googleapis/java-genai のほかの issue
-
ResponseStream.close() can block on the reader lock before closing the HTTP response対応中かも @hirematha が 1 日前に担当しました。 オープンpriority: p2 type: bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
googleapis/java-genai#1372 ·
メンテナーはふだん 1 日以内に返信
-
Interactions API: GaosClientException.getMessage() only returns "400 . API error occurred" and omits the server error details対応中かも @hemasekhar-p が 25 日前に担当しました。 オープンpriority: p2 type: bug
googleapis/java-genai#1282 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
Interactions API: store(false) omits "id", breaking Interaction and InteractionCompletedEvent deserialization対応中かも @hemasekhar-p が 25 日前に担当しました。 オープンpriority: p2 type: bug
googleapis/java-genai#1281 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
Gen AI with structured output - `propertyOrdering` in Python vs. Java implementations対応中かも @hemasekhar-p が 79 日前に担当しました。 オープンpriority: p3 type: feature request
googleapis/java-genai#1169 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
Live API: no way to observe session close or connection errors after setup対応中かも @hemasekhar-p が 88 日前に担当しました。 オープンpriority: p3 type: feature request
googleapis/java-genai#1153 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
googleapis/java-genai の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
documentation good first issue priority: low
難易度 1/5 1〜3時間 初心者へのやさしさ 78/100
Gautam-aman/CODOVYN#52 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
ControlSystemStudio/phoebus#3998 ·
メンテナーはふだん 1 日以内に返信
-
bug/错误
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
FCL-Team/FoldCraftLauncher#1982 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信