Repository navigation
feat: expose turnComplete for live content - #1381
copybara-service[bot] merged 1 commit into
Conversation
|
Hi @YuqiGuo105, thank you for your contribution! We appreciate you taking the time to submit this pull request. Currently this PR is under review by our team, we will keep you posted if any additional information is required. thank you. |
| @JsonProperty("turnComplete") | ||
| public abstract Optional<Boolean> turnComplete(); |
There was a problem hiding this comment.
MEDIUM: ADK Python and ADK Kotlin already ship this flag as partial, a boolean defaulting to false:
- Python:
LiveRequest.partialandsend_content(content, partial=False) - Kotlin:
sendContent(content, partial = false)andLiveConnection.sendContent(content, partial)
To keep the ports consistent, could you use the same name and polarity here (partial, JSON key partial, default false) as well as in LiveRequestQueue.content(Content, boolean) and BaseLlmConnection.sendContent(Content, boolean)? GeminiLlmConnection would then send turnComplete(!partial), matching Python and Kotlin. Renaming after a release would break callers, so it is easier to settle before merge.
There was a problem hiding this comment.
Thanks for pointing this out! Addressed in 2e6f166.
Updated LiveRequest (including the JSON key and builder), LiveRequestQueue, and BaseLlmConnection to use partial, defaulting to false. BaseLlmFlow forwards the flag unchanged, and GeminiLlmConnection now maps it to turnComplete(!partial).
Existing single-argument calls still complete the turn, and pure function-response content retains its existing tool-response behavior.
Added regression coverage for defaults, both boolean values, JSON round-trips and missing fields, flow propagation, Gemini conversion, and legacy connection implementations.
Validation:
- Re-ran the 54 focused tests successfully.
./mvnw -o -pl core testalso passed (main suite: 1,728 tests, 24 skipped, no failures or errors).
Could you please take another look when you have a chance?
damianmomotgoogle
left a comment
There was a problem hiding this comment.
Please rebase and squash all commits into a single one with "feat:" convenationa commit message - matching PR title.
2e6f166 to
857ee63
Compare
|
Thanks @damianmomotgoogle! Updated in 857ee63.
The full Could you please take another look when you have a chance? |
Summary
turnCompleteon queued Live content requestsLiveRequestQueue.content(Content, boolean)while preserving the existing default behaviorBaseLlmFlowandBaseLlmConnectionLiveSendClientContentParametersfalse, and JSON round-trip behaviorMotivation
Gemini Live supports sending multiple content messages as one user turn. A caller can send intermediate content with
turnComplete=false, then mark the final content withturnComplete=true.ADK Java did not expose this capability.
LiveRequesthad no turn-completion field,BaseLlmFlowcalled onlysendContent(Content), andGeminiLlmConnectionalways setturnComplete(true). As a result, applications could not append content to an open Live turn without asking the model to process a completed turn.Implementation
LiveRequestnow carries an optionalturnCompletevalue.LiveRequestQueueprovides an additive overload:The existing method remains equivalent to
content(content, true), so current callers keep the same behavior.BaseLlmConnectionadds a defaultsendContent(Content, boolean)overload that delegates to the original method. This allows existing custom connection implementations to continue compiling and running.GeminiLlmConnectionoverrides the overload and forwards the value to the lower-level Live API.Pure
FunctionResponsecontent continues to use the existing tool-response path; the new flag applies to normal client content.User impact
Applications can now send multiple content messages within one Live user turn:
Existing
requestQueue.content(content)calls remain unchanged.Validation
./mvnw -pl core -Dtest=LiveRequestQueueTest test./mvnw testCloses #1200.