Interaction.outputText() always returns Optional.empty() (SDK-computed field is never populated)
Maintainer thường phản hồi trong vòng 1 ngày
@hemasekhar-p đang làm issue này rồi.
Từ ngày 5/10/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
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.").
- Ngôn ngữ chính
- Java
- Star
- 398
- Fork
- 126
- Merge trung bình
- 1 ngày 12 giờ
- Pull request đã merge (30 ngày)
- 71
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của googleapis/java-genai
-
ResponseStream.close() can block on the reader lock before closing the HTTP responseCó thể đã có người làm @hirematha đã nhận 2 ngày trước. Đang mởpriority: p2 type: bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
googleapis/java-genai#1372 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Interactions API: GaosClientException.getMessage() only returns "400 . API error occurred" and omits the server error detailsCó thể đã có người làm @hemasekhar-p đã nhận 26 ngày trước. Đang mởpriority: p2 type: bug
googleapis/java-genai#1282 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Interactions API: store(false) omits "id", breaking Interaction and InteractionCompletedEvent deserializationCó thể đã có người làm @hemasekhar-p đã nhận 26 ngày trước. Đang mởpriority: p2 type: bug
googleapis/java-genai#1281 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Gen AI with structured output - `propertyOrdering` in Python vs. Java implementationsCó thể đã có người làm @hemasekhar-p đã nhận 80 ngày trước. Đang mởpriority: p3 type: feature request
googleapis/java-genai#1169 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Live API: no way to observe session close or connection errors after setupCó thể đã có người làm @hemasekhar-p đã nhận 89 ngày trước. Đang mởpriority: p3 type: feature request
googleapis/java-genai#1153 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của googleapis/java-genai
Issue tương tự
-
Documentation
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
OWASP/SecurityShepherd#1097 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Dans-Plugins/Medieval-Roleplay-Engine#392 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Invalid If-Modified-Since or If-Unmodified-Since header results in 500 with Request.evaluatePreconditions()Có thể đã có người làm @pschaub đã nhận hôm nay. Đang mởkind/bug triage/needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 70/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Vakore/ZappierGames#236 ·