fix: DefaultFinalizer return assistant message#1036
Open
mrh997 wants to merge 83 commits into
Open
Conversation
feat(agentic_model): - format print - support agentic chat template - support to compose agentic odel&agentic tools node - support agentic tool node - support agentic message concat
#882) feat(adk): add agentmd middleware for auto-injecting Agents.md into model input Change-Id: I34add4f925a23c6d6821925c482a21f6cddfddd4
… UntilIdleFor from canceling agent (#972)
… and clean up internal terminology (#979)
feat(adk): add MultiModalRead with custom FileContentPart types - Define FileContentPartType, FileContentPart in filesystem package to replace direct schema.ToolOutputPart dependency, supporting only Image (bytes) and File (bytes) types - Add MultiModalReader interface and MultiModalReadRequest with Pages field - Add multiModalReadFileArgs extending readFileArgs with PDF pages param - Convert FileContentPart to schema.ToolOutputPart with base64 encoding in middleware layer - Guard against nil FileContent returned from Backend.Read and MultiModalRead; return human-readable fallback instead of panicking - Reuse base64 encoding buffer across multimodal parts via base64Encoder - Add tests for image, file, unsupported type, pages passthrough, schema fields, custom desc, empty data error, nil result, and routing
…es to BeforeModelRewriteState (#984)
* feat(adk): validate pages parameter in MultiModalReadFileTool - Add validatePages function to check format (must be "N" or "N-M") - Reject invalid formats such as "1-", "-5", non-numeric values - Enforce end >= start and max 20 pages per request - Return validation error as ToolResult so the model can self-correct * test(adk): add unit tests for validatePages function - Cover valid formats: single page, range, same start/end, max boundary - Cover invalid formats: trailing dash, leading dash, non-numeric, zero - Cover logic errors: end < start, range exceeds 20 pages
…terToolCallsHook option (#985)
Replace FunctionToolResult.Result string field with Blocks
[]*FunctionToolResultBlock to uniformly represent all tool results
(text-only and multimodal) as structured content blocks.
- Add FunctionToolResultBlock type supporting text, image, audio,
video, and file content with String() method
- Remove FunctionToolResult.Result field; text results are now
wrapped as FunctionToolResultBlock{Text: ...}
- Update FunctionToolResultAgenticMessage to accept blocks parameter
- Convert MessageInputPart to FunctionToolResultBlock in compose layer
- Update concatFunctionToolResults to merge via Blocks append
- Add comprehensive tests for multimodal and streaming tool results
…xt, and DeepAgent for AgenticMessage support (#988)
…1004) refactor(adk): build ToolsNodeConfig via shallow copy + field override Replace explicit field-by-field struct literals with a shallow copy of the source ToolsNodeConfig followed by overriding only the fields that need per-run isolation (Tools and ToolCallMiddlewares). New fields added to compose.ToolsNodeConfig in the future will be forwarded automatically instead of being silently dropped. - applyBeforeAgent: reuse the already-cloned toolsNodeConf local instead of rebuilding the struct - prepareExecContext: shallow-copy a.toolsConfig.ToolsNodeConfig then cloneSlice the Tools/ToolCallMiddlewares that will be appended to No behavior change: every field is assigned the same value as before.
…base Swap handler positions in InnermostGetsOriginalOutput subtests to match the forward-iteration semantics from #1000. The tests assumed the old reverse-iteration order where handlers[0] was innermost. Change-Id: Ib319b3ea687870db9f69c4c93e1ee69369ea2fe8
…eep-copy (#1007) fix(serialization): ensure pointer-receiver MarshalJSON is invoked in InternalSerializer When InternalSerializer marshals a struct value that implements json.Marshaler via pointer receiver (e.g. *ToolInfo), rv.Interface() produces a non-addressable copy. json.Marshal then cannot call the pointer method and falls back to default struct encoding, which skips unexported fields — causing ParamsOneOf data loss after deepCopyState during interrupt/resume. Fix: pass a pointer to json.Marshal by using rv.Addr() when addressable, or copying into reflect.New() otherwise.
feat(schema): refactor FunctionToolResult types and add streaming merge - Rename FunctionToolResultBlock to FunctionToolResultContentBlock - Rename FunctionToolResultBlockType constants (drop "Type" infix) - Rename Result field to Content across FunctionToolResult, ServerToolResult, and MCPToolResult - Remove NewXxxFunctionToolResultBlock constructor functions - Add streaming merge logic in concatFunctionToolResults: aggregate content blocks by StreamingMeta index with fail-fast consistency check - Text blocks with same index are concatenated; non-text blocks with duplicate index return an error - Merge Extra fields via internal.ConcatItems for text aggregation
…are (#1016) * feat(adk): optimize default token estimation in summarization middleware Refactor the default token counter to be role-aware and type-specific: - Split into estimateMessageTokens and estimateAgenticMessageTokens for accurate per-field token estimation instead of using generic .String() - Leverage assistant message's TokenUsage.TotalTokens as baseline, only estimate incremental messages after the last assistant response - Handle multimodal content (image/audio/video/file) as fixed 2000 tokens - Properly account for ReasoningContent, ToolCalls, ToolSearchResult, and FunctionToolResult in token estimation - Rename getMsgTextContent to getUserMsgTextContent to clarify intent - Inline model response text extraction in finalizeSummary
* fix: concat agentic response meta * feat: define Summarize method
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## alpha/09 #1036 +/- ##
===========================================
Coverage ? 82.97%
===========================================
Files ? 162
Lines ? 23088
Branches ? 0
===========================================
Hits ? 19158
Misses ? 2674
Partials ? 1256 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
Check the PR title.
(Optional) Translate the PR title into Chinese.
(Optional) More detailed description for this PR(en: English/zh: Chinese).
en:
zh(optional):
(Optional) Which issue(s) this PR fixes:
(optional) The PR that updates user documentation: