@google/adk 2.1.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/a2a/agent_card.js +8 -0
- package/dist/cjs/a2a/agent_executor.js +8 -3
- package/dist/cjs/agents/llm_agent.js +15 -1
- package/dist/cjs/agents/processors/content_processor_utils.js +10 -2
- package/dist/cjs/agents/processors/nl_planning_processor.js +114 -0
- package/dist/cjs/artifacts/gcs_artifact_service.js +13 -7
- package/dist/cjs/auth/auth_credential.js +12 -2
- package/dist/cjs/code_executors/code_execution_utils.js +3 -3
- package/dist/cjs/common.js +45 -0
- package/dist/cjs/examples/example.js +92 -0
- package/dist/cjs/examples/example_util.js +28 -4
- package/dist/cjs/examples/index.js +39 -0
- package/dist/cjs/examples/vertex_ai_example_store.js +39 -0
- package/dist/cjs/index.js +46 -0
- package/dist/cjs/memory/vertex_ai_memory_bank_service.js +17 -5
- package/dist/cjs/models/base_llm.js +1 -6
- package/dist/cjs/models/chrome_prompt_llm.js +16 -2
- package/dist/cjs/models/chrome_prompt_utils.js +54 -2
- package/dist/cjs/models/gemini_llm_connection.js +5 -4
- package/dist/cjs/planners/base_planner.js +56 -0
- package/dist/cjs/planners/built_in_planner.js +85 -0
- package/dist/cjs/planners/plan_re_act_planner.js +172 -0
- package/dist/cjs/plugins/base_plugin.js +46 -61
- package/dist/cjs/tools/example_tool.js +1 -1
- package/dist/cjs/tools/mcp/mcp_session_manager.js +14 -8
- package/dist/cjs/tools/openapi_tool/auth/auth_helpers.js +281 -2
- package/dist/cjs/tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.js +15 -1
- package/dist/cjs/tools/openapi_tool/auth/credential_exchangers/base_auth_credential_exchanger.js +70 -0
- package/dist/cjs/tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.js +120 -0
- package/dist/cjs/tools/openapi_tool/auth/credential_exchangers/service_account_exchanger.js +10 -10
- package/dist/cjs/tools/openapi_tool/common/common.js +139 -0
- package/dist/cjs/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.js +11 -6
- package/dist/cjs/tools/openapi_tool/openapi_spec_parser/operation_parser.js +73 -13
- package/dist/cjs/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.js +146 -34
- package/dist/cjs/tools/openapi_tool/openapi_toolset.js +14 -2
- package/dist/cjs/tools/openapi_tool/rest_api_tool.js +90 -28
- package/dist/cjs/tools/skill/skill_toolset.js +2 -0
- package/dist/cjs/tools/tool_context.js +41 -0
- package/dist/cjs/tools/webmcp/index.js +37 -0
- package/dist/cjs/tools/webmcp/webmcp_tool.js +156 -0
- package/dist/cjs/tools/webmcp/webmcp_toolset.js +116 -0
- package/dist/cjs/tools/webmcp/webmcp_types.js +50 -0
- package/dist/cjs/utils/case_utils.js +52 -2
- package/dist/cjs/utils/client_labels.js +67 -0
- package/dist/cjs/utils/gemini_schema_util.js +103 -3
- package/dist/cjs/utils/hash_utils.js +73 -0
- package/dist/cjs/utils/live_connection_utils.js +10 -9
- package/dist/cjs/utils/model_name.js +17 -2
- package/dist/cjs/utils/simple_zod_to_json.js +5 -0
- package/dist/cjs/version.js +1 -1
- package/dist/esm/a2a/agent_card.js +8 -0
- package/dist/esm/a2a/agent_executor.js +8 -3
- package/dist/esm/agents/llm_agent.js +18 -1
- package/dist/esm/agents/processors/content_processor_utils.js +10 -2
- package/dist/esm/agents/processors/nl_planning_processor.js +87 -0
- package/dist/esm/artifacts/gcs_artifact_service.js +13 -7
- package/dist/esm/auth/auth_credential.js +11 -1
- package/dist/esm/code_executors/code_execution_utils.js +3 -3
- package/dist/esm/common.js +38 -2
- package/dist/esm/examples/example.js +85 -0
- package/dist/esm/examples/example_util.js +25 -3
- package/dist/esm/examples/index.js +11 -0
- package/dist/esm/examples/vertex_ai_example_store.js +11 -0
- package/dist/esm/index.js +51 -1
- package/dist/esm/memory/vertex_ai_memory_bank_service.js +17 -5
- package/dist/esm/models/base_llm.js +2 -7
- package/dist/esm/models/chrome_prompt_llm.js +20 -3
- package/dist/esm/models/chrome_prompt_utils.js +51 -2
- package/dist/esm/models/gemini_llm_connection.js +6 -5
- package/dist/esm/planners/base_planner.js +28 -0
- package/dist/esm/planners/built_in_planner.js +57 -0
- package/dist/esm/planners/plan_re_act_planner.js +145 -0
- package/dist/esm/plugins/base_plugin.js +46 -61
- package/dist/esm/tools/example_tool.js +1 -1
- package/dist/esm/tools/mcp/mcp_session_manager.js +14 -8
- package/dist/esm/tools/openapi_tool/auth/auth_helpers.js +272 -1
- package/dist/esm/tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.js +15 -1
- package/dist/esm/tools/openapi_tool/auth/credential_exchangers/base_auth_credential_exchanger.js +43 -0
- package/dist/esm/tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.js +93 -0
- package/dist/esm/tools/openapi_tool/auth/credential_exchangers/service_account_exchanger.js +10 -12
- package/dist/esm/tools/openapi_tool/common/common.js +112 -0
- package/dist/esm/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.js +11 -6
- package/dist/esm/tools/openapi_tool/openapi_spec_parser/operation_parser.js +80 -13
- package/dist/esm/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.js +146 -33
- package/dist/esm/tools/openapi_tool/openapi_toolset.js +14 -2
- package/dist/esm/tools/openapi_tool/rest_api_tool.js +89 -28
- package/dist/esm/tools/skill/skill_toolset.js +2 -0
- package/dist/esm/tools/tool_context.js +15 -0
- package/dist/esm/tools/webmcp/index.js +10 -0
- package/dist/esm/tools/webmcp/webmcp_tool.js +131 -0
- package/dist/esm/tools/webmcp/webmcp_toolset.js +89 -0
- package/dist/esm/tools/webmcp/webmcp_types.js +22 -0
- package/dist/esm/utils/case_utils.js +49 -1
- package/dist/esm/utils/client_labels.js +65 -0
- package/dist/esm/utils/gemini_schema_util.js +102 -3
- package/dist/esm/utils/hash_utils.js +45 -0
- package/dist/esm/utils/live_connection_utils.js +11 -10
- package/dist/esm/utils/model_name.js +15 -2
- package/dist/esm/utils/simple_zod_to_json.js +5 -0
- package/dist/esm/version.js +1 -1
- package/dist/types/agents/llm_agent.d.ts +12 -1
- package/dist/types/agents/processors/nl_planning_processor.d.ts +30 -0
- package/dist/types/auth/auth_credential.d.ts +9 -0
- package/dist/types/common.d.ts +16 -4
- package/dist/types/examples/base_example_provider.d.ts +2 -2
- package/dist/types/examples/example.d.ts +75 -0
- package/dist/types/examples/example_util.d.ts +13 -2
- package/dist/types/examples/index.d.ts +18 -0
- package/dist/types/examples/vertex_ai_example_store.d.ts +7 -0
- package/dist/types/index.d.ts +12 -3
- package/dist/types/memory/memory_entry.d.ts +15 -0
- package/dist/types/memory/vertex_ai_memory_bank_service.d.ts +9 -0
- package/dist/types/models/chrome_prompt_utils.d.ts +29 -0
- package/dist/types/planners/base_planner.d.ts +50 -0
- package/dist/types/planners/built_in_planner.d.ts +53 -0
- package/dist/types/planners/plan_re_act_planner.d.ts +21 -0
- package/dist/types/plugins/base_plugin.d.ts +52 -52
- package/dist/types/skills/skill_registry.d.ts +8 -0
- package/dist/types/tools/openapi_tool/auth/auth_helpers.d.ts +110 -1
- package/dist/types/tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.d.ts +32 -2
- package/dist/types/tools/openapi_tool/auth/credential_exchangers/base_auth_credential_exchanger.d.ts +35 -0
- package/dist/types/tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.d.ts +54 -0
- package/dist/types/tools/openapi_tool/common/common.d.ts +60 -0
- package/dist/types/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.d.ts +7 -0
- package/dist/types/tools/openapi_tool/openapi_spec_parser/operation_parser.d.ts +56 -2
- package/dist/types/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.d.ts +73 -5
- package/dist/types/tools/openapi_tool/openapi_toolset.d.ts +11 -0
- package/dist/types/tools/openapi_tool/rest_api_tool.d.ts +42 -8
- package/dist/types/tools/tool_context.d.ts +19 -0
- package/dist/types/tools/webmcp/index.d.ts +12 -0
- package/dist/types/tools/webmcp/webmcp_tool.d.ts +47 -0
- package/dist/types/tools/webmcp/webmcp_toolset.d.ts +67 -0
- package/dist/types/tools/webmcp/webmcp_types.d.ts +69 -0
- package/dist/types/utils/case_utils.d.ts +36 -0
- package/dist/types/utils/client_labels.d.ts +33 -0
- package/dist/types/utils/gemini_schema_util.d.ts +13 -0
- package/dist/types/utils/hash_utils.d.ts +25 -0
- package/dist/types/utils/logger.d.ts +10 -2
- package/dist/types/utils/model_name.d.ts +30 -2
- package/dist/types/version.d.ts +1 -1
- package/dist/web/index_web.js +112 -79
- package/dist/web/index_web.js.map +4 -4
- package/package.json +8 -2
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import {createRequire as topLevelCreateRequire} from 'module';
|
|
2
|
+
const require = topLevelCreateRequire(import.meta.url);
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
+
/**
|
|
6
|
+
* @license
|
|
7
|
+
* Copyright 2026 Google LLC
|
|
8
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
9
|
+
*/
|
|
10
|
+
import { appendInstructions } from "../../models/llm_request.js";
|
|
11
|
+
import { isBasePlanner } from "../../planners/base_planner.js";
|
|
12
|
+
import { isBuiltInPlanner } from "../../planners/built_in_planner.js";
|
|
13
|
+
import { Context } from "../context.js";
|
|
14
|
+
import { isLlmAgent } from "../llm_agent.js";
|
|
15
|
+
import { ReadonlyContext } from "../readonly_context.js";
|
|
16
|
+
import {
|
|
17
|
+
BaseLlmRequestProcessor,
|
|
18
|
+
BaseLlmResponseProcessor
|
|
19
|
+
} from "./base_llm_processor.js";
|
|
20
|
+
function getPlanner(invocationContext) {
|
|
21
|
+
const agent = invocationContext.agent;
|
|
22
|
+
if (!isLlmAgent(agent) || !isBasePlanner(agent.planner)) {
|
|
23
|
+
return void 0;
|
|
24
|
+
}
|
|
25
|
+
return agent.planner;
|
|
26
|
+
}
|
|
27
|
+
__name(getPlanner, "getPlanner");
|
|
28
|
+
function removeThought(part) {
|
|
29
|
+
const { thought: _thought, ...rest } = part;
|
|
30
|
+
return rest;
|
|
31
|
+
}
|
|
32
|
+
__name(removeThought, "removeThought");
|
|
33
|
+
function removeThoughtFromContents(contents) {
|
|
34
|
+
return contents.map(
|
|
35
|
+
(content) => content.parts ? { ...content, parts: content.parts.map(removeThought) } : content
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
__name(removeThoughtFromContents, "removeThoughtFromContents");
|
|
39
|
+
const _NlPlanningRequestProcessor = class _NlPlanningRequestProcessor extends BaseLlmRequestProcessor {
|
|
40
|
+
// eslint-disable-next-line require-yield -- this processor only mutates the request and has no event to emit
|
|
41
|
+
async *runAsync(invocationContext, llmRequest) {
|
|
42
|
+
const planner = getPlanner(invocationContext);
|
|
43
|
+
if (!planner) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
if (isBuiltInPlanner(planner)) {
|
|
47
|
+
planner.applyThinkingConfig(llmRequest);
|
|
48
|
+
}
|
|
49
|
+
const planningInstruction = planner.buildPlanningInstruction(
|
|
50
|
+
new ReadonlyContext(invocationContext),
|
|
51
|
+
llmRequest
|
|
52
|
+
);
|
|
53
|
+
if (planningInstruction) {
|
|
54
|
+
appendInstructions(llmRequest, [planningInstruction]);
|
|
55
|
+
}
|
|
56
|
+
llmRequest.contents = removeThoughtFromContents(llmRequest.contents);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
__name(_NlPlanningRequestProcessor, "NlPlanningRequestProcessor");
|
|
60
|
+
let NlPlanningRequestProcessor = _NlPlanningRequestProcessor;
|
|
61
|
+
const _NlPlanningResponseProcessor = class _NlPlanningResponseProcessor extends BaseLlmResponseProcessor {
|
|
62
|
+
// eslint-disable-next-line require-yield -- this processor only rewrites the response and has no event to emit
|
|
63
|
+
async *runAsync(invocationContext, llmResponse) {
|
|
64
|
+
var _a, _b;
|
|
65
|
+
const planner = getPlanner(invocationContext);
|
|
66
|
+
if (!planner || !((_b = (_a = llmResponse.content) == null ? void 0 : _a.parts) == null ? void 0 : _b.length)) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const processedParts = planner.processPlanningResponse(
|
|
70
|
+
new Context({ invocationContext }),
|
|
71
|
+
llmResponse.content.parts
|
|
72
|
+
);
|
|
73
|
+
if (processedParts !== void 0) {
|
|
74
|
+
llmResponse.content = { ...llmResponse.content, parts: processedParts };
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
__name(_NlPlanningResponseProcessor, "NlPlanningResponseProcessor");
|
|
79
|
+
let NlPlanningResponseProcessor = _NlPlanningResponseProcessor;
|
|
80
|
+
const NL_PLANNING_REQUEST_PROCESSOR = new NlPlanningRequestProcessor();
|
|
81
|
+
const NL_PLANNING_RESPONSE_PROCESSOR = new NlPlanningResponseProcessor();
|
|
82
|
+
export {
|
|
83
|
+
NL_PLANNING_REQUEST_PROCESSOR,
|
|
84
|
+
NL_PLANNING_RESPONSE_PROCESSOR,
|
|
85
|
+
NlPlanningRequestProcessor,
|
|
86
|
+
NlPlanningResponseProcessor
|
|
87
|
+
};
|
|
@@ -67,9 +67,7 @@ const _GcsArtifactService = class _GcsArtifactService {
|
|
|
67
67
|
version
|
|
68
68
|
})
|
|
69
69
|
);
|
|
70
|
-
const customMetadata =
|
|
71
|
-
...request.customMetadata
|
|
72
|
-
};
|
|
70
|
+
const customMetadata = stringifyMetadataValues(request.customMetadata);
|
|
73
71
|
if (request.artifact.inlineData) {
|
|
74
72
|
if (request.artifact.inlineData.displayName) {
|
|
75
73
|
customMetadata[GCS_DISPLAY_NAME_METADATA_KEY] = request.artifact.inlineData.displayName;
|
|
@@ -193,10 +191,9 @@ const _GcsArtifactService = class _GcsArtifactService {
|
|
|
193
191
|
const [files] = await bucket.getFiles({ prefix: searchPrefix });
|
|
194
192
|
const versions = [];
|
|
195
193
|
for (const file of files) {
|
|
196
|
-
const
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
versions.push(v);
|
|
194
|
+
const suffix = file.name.slice(searchPrefix.length);
|
|
195
|
+
if (/^\d+$/.test(suffix)) {
|
|
196
|
+
versions.push(Number(suffix));
|
|
200
197
|
}
|
|
201
198
|
}
|
|
202
199
|
return versions.sort((a, b) => a - b);
|
|
@@ -262,6 +259,15 @@ function getFileName({
|
|
|
262
259
|
return version !== void 0 ? `${prefix}/${version}` : prefix;
|
|
263
260
|
}
|
|
264
261
|
__name(getFileName, "getFileName");
|
|
262
|
+
function stringifyMetadataValues(customMetadata) {
|
|
263
|
+
return Object.fromEntries(
|
|
264
|
+
Object.entries(customMetadata != null ? customMetadata : {}).map(([key, value]) => [
|
|
265
|
+
key,
|
|
266
|
+
String(value)
|
|
267
|
+
])
|
|
268
|
+
);
|
|
269
|
+
}
|
|
270
|
+
__name(stringifyMetadataValues, "stringifyMetadataValues");
|
|
265
271
|
function extractArtifactKeys(files, fileNamePrefix, keyPrefix = "") {
|
|
266
272
|
const keys = /* @__PURE__ */ new Set();
|
|
267
273
|
for (const file of files) {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import {createRequire as topLevelCreateRequire} from 'module';
|
|
2
2
|
const require = topLevelCreateRequire(import.meta.url);
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
5
|
/**
|
|
4
6
|
* @license
|
|
5
7
|
* Copyright 2025 Google LLC
|
|
@@ -13,6 +15,14 @@ var AuthCredentialTypes = /* @__PURE__ */ ((AuthCredentialTypes2) => {
|
|
|
13
15
|
AuthCredentialTypes2["SERVICE_ACCOUNT"] = "serviceAccount";
|
|
14
16
|
return AuthCredentialTypes2;
|
|
15
17
|
})(AuthCredentialTypes || {});
|
|
18
|
+
const AUTH_CREDENTIAL_TYPES = new Set(
|
|
19
|
+
Object.values(AuthCredentialTypes)
|
|
20
|
+
);
|
|
21
|
+
function isAuthCredential(value) {
|
|
22
|
+
return typeof value === "object" && value !== null && "authType" in value && AUTH_CREDENTIAL_TYPES.has(value.authType);
|
|
23
|
+
}
|
|
24
|
+
__name(isAuthCredential, "isAuthCredential");
|
|
16
25
|
export {
|
|
17
|
-
AuthCredentialTypes
|
|
26
|
+
AuthCredentialTypes,
|
|
27
|
+
isAuthCredential
|
|
18
28
|
};
|
|
@@ -116,9 +116,9 @@ function convertCodeExecutionParts(content, codeBlockDelimiter, executionResultD
|
|
|
116
116
|
text: codeBlockDelimiter[0] + (lastPart.executableCode.code || "") + codeBlockDelimiter[1]
|
|
117
117
|
};
|
|
118
118
|
} else if (content.parts.length == 1 && lastPart.codeExecutionResult) {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
};
|
|
119
|
+
const output = lastPart.codeExecutionResult.output;
|
|
120
|
+
const text = output == null ? "" : executionResultDelimiters[0] + output + executionResultDelimiters[1];
|
|
121
|
+
content.parts[content.parts.length - 1] = { text };
|
|
122
122
|
content.role = "user";
|
|
123
123
|
}
|
|
124
124
|
}
|
package/dist/esm/common.js
CHANGED
|
@@ -49,7 +49,7 @@ import { createResumabilityConfig } from "./apps/resumability_config.js";
|
|
|
49
49
|
import { InMemoryArtifactService } from "./artifacts/in_memory_artifact_service.js";
|
|
50
50
|
import { ScopedArtifactService } from "./artifacts/scoped_artifact_service.js";
|
|
51
51
|
import { isSessionArtifactService } from "./artifacts/session_artifact_service.js";
|
|
52
|
-
import { AuthCredentialTypes } from "./auth/auth_credential.js";
|
|
52
|
+
import { AuthCredentialTypes, isAuthCredential } from "./auth/auth_credential.js";
|
|
53
53
|
import { AuthHandler } from "./auth/auth_handler.js";
|
|
54
54
|
import { AUTH_PREPROCESSOR, AuthPreprocessor } from "./auth/auth_preprocessor.js";
|
|
55
55
|
import { AuthProviderRegistry } from "./auth/auth_provider_registry.js";
|
|
@@ -100,6 +100,7 @@ import {
|
|
|
100
100
|
BaseExampleProvider,
|
|
101
101
|
isBaseExampleProvider
|
|
102
102
|
} from "./examples/base_example_provider.js";
|
|
103
|
+
import { VertexAiExampleStore } from "./examples/example.js";
|
|
103
104
|
import { InMemoryMemoryService } from "./memory/in_memory_memory_service.js";
|
|
104
105
|
import { ApigeeLlm } from "./models/apigee_llm.js";
|
|
105
106
|
import { BaseLlm, isBaseLlm } from "./models/base_llm.js";
|
|
@@ -111,6 +112,9 @@ import {
|
|
|
111
112
|
import { Gemini, geminiInitParams } from "./models/google_llm.js";
|
|
112
113
|
import { LLMRegistry } from "./models/registry.js";
|
|
113
114
|
import { RoutedLlm } from "./models/routed_llm.js";
|
|
115
|
+
import { BasePlanner, isBasePlanner } from "./planners/base_planner.js";
|
|
116
|
+
import { BuiltInPlanner, isBuiltInPlanner } from "./planners/built_in_planner.js";
|
|
117
|
+
import { PlanReActPlanner } from "./planners/plan_re_act_planner.js";
|
|
114
118
|
import {
|
|
115
119
|
GLOBAL_SCOPE_KEY,
|
|
116
120
|
REFLECT_AND_RETRY_RESPONSE_TYPE,
|
|
@@ -190,19 +194,33 @@ import {
|
|
|
190
194
|
ToolConfirmation,
|
|
191
195
|
isIntentMismatchError
|
|
192
196
|
} from "./tools/tool_confirmation.js";
|
|
197
|
+
import { CallbackContext, ToolContext } from "./tools/tool_context.js";
|
|
193
198
|
import { URL_CONTEXT, UrlContextTool } from "./tools/url_context_tool.js";
|
|
194
199
|
import { VertexAiSearchTool } from "./tools/vertex_ai_search_tool.js";
|
|
195
200
|
import { VertexRagRetrievalTool } from "./tools/vertex_rag_retrieval_tool.js";
|
|
201
|
+
import { WebMCPTool } from "./tools/webmcp/webmcp_tool.js";
|
|
202
|
+
import { WebMCPToolset } from "./tools/webmcp/webmcp_toolset.js";
|
|
203
|
+
import {
|
|
204
|
+
getModelContext,
|
|
205
|
+
isWebMCPSupported
|
|
206
|
+
} from "./tools/webmcp/webmcp_types.js";
|
|
196
207
|
import { AsyncQueue } from "./utils/async_queue.js";
|
|
208
|
+
import { renameReservedKeywords, toSnakeCaseName } from "./utils/case_utils.js";
|
|
197
209
|
import { getClientLabels, runWithClientLabel } from "./utils/client_labels.js";
|
|
198
210
|
import {
|
|
199
211
|
LogLevel,
|
|
200
212
|
getLogger,
|
|
213
|
+
logger,
|
|
201
214
|
resetLogger,
|
|
202
215
|
setLogLevel,
|
|
203
216
|
setLogger
|
|
204
217
|
} from "./utils/logger.js";
|
|
205
|
-
import {
|
|
218
|
+
import {
|
|
219
|
+
isGemini2OrAbove,
|
|
220
|
+
isGemini35LiveTranslate,
|
|
221
|
+
isGemini3xFlashLive,
|
|
222
|
+
isGemini3xLive
|
|
223
|
+
} from "./utils/model_name.js";
|
|
206
224
|
import { zodObjectToSchema } from "./utils/simple_zod_to_json.js";
|
|
207
225
|
import { Task } from "./utils/task.js";
|
|
208
226
|
import { GoogleLLMVariant } from "./utils/variant_utils.js";
|
|
@@ -283,6 +301,7 @@ export {
|
|
|
283
301
|
BaseLlmRequestProcessor,
|
|
284
302
|
BaseLlmResponseProcessor,
|
|
285
303
|
BaseNode,
|
|
304
|
+
BasePlanner,
|
|
286
305
|
BasePlugin,
|
|
287
306
|
BaseRetrievalTool,
|
|
288
307
|
BaseSessionService,
|
|
@@ -290,8 +309,10 @@ export {
|
|
|
290
309
|
BaseToolset,
|
|
291
310
|
BranchPath,
|
|
292
311
|
BuiltInCodeExecutor,
|
|
312
|
+
BuiltInPlanner,
|
|
293
313
|
BuiltInTool,
|
|
294
314
|
CONTENT_REQUEST_PROCESSOR,
|
|
315
|
+
CallbackContext,
|
|
295
316
|
ChromeBuiltInLlm,
|
|
296
317
|
ChromeModelUnavailableError,
|
|
297
318
|
CodeExecutionLanguage,
|
|
@@ -366,6 +387,7 @@ export {
|
|
|
366
387
|
PRELOAD_MEMORY,
|
|
367
388
|
ParallelAgent,
|
|
368
389
|
ParallelWorker,
|
|
390
|
+
PlanReActPlanner,
|
|
369
391
|
PluginManager,
|
|
370
392
|
PolicyOutcome,
|
|
371
393
|
PreloadMemoryTool,
|
|
@@ -395,6 +417,7 @@ export {
|
|
|
395
417
|
Task,
|
|
396
418
|
TokenBasedContextCompactor,
|
|
397
419
|
ToolConfirmation,
|
|
420
|
+
ToolContext,
|
|
398
421
|
ToolErrorType,
|
|
399
422
|
ToolExecutionError,
|
|
400
423
|
ToolNode,
|
|
@@ -403,8 +426,11 @@ export {
|
|
|
403
426
|
TruncatingContextCompactor,
|
|
404
427
|
URL_CONTEXT,
|
|
405
428
|
UrlContextTool,
|
|
429
|
+
VertexAiExampleStore,
|
|
406
430
|
VertexAiSearchTool,
|
|
407
431
|
VertexRagRetrievalTool,
|
|
432
|
+
WebMCPTool,
|
|
433
|
+
WebMCPToolset,
|
|
408
434
|
Workflow,
|
|
409
435
|
WorkflowNode,
|
|
410
436
|
asRunnableRoot,
|
|
@@ -428,6 +454,7 @@ export {
|
|
|
428
454
|
getFunctionCalls,
|
|
429
455
|
getFunctionResponses,
|
|
430
456
|
getLogger,
|
|
457
|
+
getModelContext,
|
|
431
458
|
getPendingUserInputRequests,
|
|
432
459
|
getUserChoiceTool,
|
|
433
460
|
getUserInputRequests,
|
|
@@ -435,16 +462,21 @@ export {
|
|
|
435
462
|
hasTrailingCodeExecutionResult,
|
|
436
463
|
isAgentTool,
|
|
437
464
|
isApp,
|
|
465
|
+
isAuthCredential,
|
|
438
466
|
isBaseAgent,
|
|
439
467
|
isBaseExampleProvider,
|
|
440
468
|
isBaseLlm,
|
|
469
|
+
isBasePlanner,
|
|
441
470
|
isBaseTool,
|
|
442
471
|
isBaseToolset,
|
|
472
|
+
isBuiltInPlanner,
|
|
443
473
|
isCompactedEvent,
|
|
444
474
|
isFinalResponse,
|
|
445
475
|
isFunctionTool,
|
|
446
476
|
isGemini2OrAbove,
|
|
477
|
+
isGemini35LiveTranslate,
|
|
447
478
|
isGemini3xFlashLive,
|
|
479
|
+
isGemini3xLive,
|
|
448
480
|
isIntentMismatchError,
|
|
449
481
|
isLlmAgent,
|
|
450
482
|
isLoopAgent,
|
|
@@ -464,12 +496,15 @@ export {
|
|
|
464
496
|
isSessionArtifactService,
|
|
465
497
|
isStateSchemaError,
|
|
466
498
|
isToolNotFound,
|
|
499
|
+
isWebMCPSupported,
|
|
467
500
|
isWorkflow,
|
|
501
|
+
logger,
|
|
468
502
|
node,
|
|
469
503
|
normalizeRetryExceptions,
|
|
470
504
|
populateClientFunctionCallId,
|
|
471
505
|
prepareRetryConfig,
|
|
472
506
|
pruneThoughts,
|
|
507
|
+
renameReservedKeywords,
|
|
473
508
|
requestInputTool,
|
|
474
509
|
requireAgent,
|
|
475
510
|
requiresUserInput,
|
|
@@ -480,6 +515,7 @@ export {
|
|
|
480
515
|
setLogger,
|
|
481
516
|
stringifyContent,
|
|
482
517
|
stripAdkIdentityPreamble,
|
|
518
|
+
toSnakeCaseName,
|
|
483
519
|
toStructuredEvents,
|
|
484
520
|
validateAppName,
|
|
485
521
|
version,
|
|
@@ -1,7 +1,92 @@
|
|
|
1
1
|
import {createRequire as topLevelCreateRequire} from 'module';
|
|
2
2
|
const require = topLevelCreateRequire(import.meta.url);
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
5
|
/**
|
|
4
6
|
* @license
|
|
5
7
|
* Copyright 2025 Google LLC
|
|
6
8
|
* SPDX-License-Identifier: Apache-2.0
|
|
7
9
|
*/
|
|
10
|
+
import { BaseExampleProvider } from "./base_example_provider.js";
|
|
11
|
+
const SIMILARITY_SCORE_THRESHOLD = 0.5;
|
|
12
|
+
const DEFAULT_TOP_K = 10;
|
|
13
|
+
const _VertexAiExampleStore = class _VertexAiExampleStore extends BaseExampleProvider {
|
|
14
|
+
/**
|
|
15
|
+
* Initializes the VertexAiExampleStore.
|
|
16
|
+
*
|
|
17
|
+
* @param examplesStoreName The resource name of the vertex example store, in
|
|
18
|
+
* the format of
|
|
19
|
+
* `projects/{project}/locations/{location}/exampleStores/{example_store}`.
|
|
20
|
+
* @param apiClient A client that reaches the Vertex AI Example Store API.
|
|
21
|
+
* adk-js does not bundle the `vertexai` dependency the Python SDK relies
|
|
22
|
+
* on, so the caller supplies this client.
|
|
23
|
+
*/
|
|
24
|
+
constructor(examplesStoreName, apiClient) {
|
|
25
|
+
super();
|
|
26
|
+
this.examplesStoreName = examplesStoreName;
|
|
27
|
+
this.apiClient = apiClient;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Retrieves relevant examples from the Vertex AI Example Store for the given
|
|
31
|
+
* query.
|
|
32
|
+
*/
|
|
33
|
+
async getExamples(query) {
|
|
34
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
35
|
+
const request = {
|
|
36
|
+
storedContentsExampleParameters: {
|
|
37
|
+
contentSearchKey: {
|
|
38
|
+
contents: [{ role: "user", parts: [{ text: query }] }],
|
|
39
|
+
searchKeyGenerationMethod: { lastEntry: {} }
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
topK: DEFAULT_TOP_K,
|
|
43
|
+
exampleStore: this.examplesStoreName
|
|
44
|
+
};
|
|
45
|
+
const response = await this.apiClient.searchExamples(request);
|
|
46
|
+
const returnedExamples = [];
|
|
47
|
+
for (const result of (_a = response.results) != null ? _a : []) {
|
|
48
|
+
if (((_b = result.similarityScore) != null ? _b : 0) < SIMILARITY_SCORE_THRESHOLD) {
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
const storedExample = (_c = result.example) == null ? void 0 : _c.storedContentsExample;
|
|
52
|
+
const expectedContents = ((_e = (_d = storedExample == null ? void 0 : storedExample.contentsExample) == null ? void 0 : _d.expectedContents) != null ? _e : []).map((entry) => entry.content).filter((content) => content !== void 0);
|
|
53
|
+
const expectedOutput = [];
|
|
54
|
+
for (const content of expectedContents) {
|
|
55
|
+
const expectedParts = [];
|
|
56
|
+
for (const part of (_f = content.parts) != null ? _f : []) {
|
|
57
|
+
if (part.text) {
|
|
58
|
+
expectedParts.push({ text: part.text });
|
|
59
|
+
} else if (part.functionCall) {
|
|
60
|
+
expectedParts.push({
|
|
61
|
+
functionCall: {
|
|
62
|
+
name: part.functionCall.name,
|
|
63
|
+
args: { ...(_g = part.functionCall.args) != null ? _g : {} }
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
} else if (part.functionResponse) {
|
|
67
|
+
expectedParts.push({
|
|
68
|
+
functionResponse: {
|
|
69
|
+
name: part.functionResponse.name,
|
|
70
|
+
response: { ...(_h = part.functionResponse.response) != null ? _h : {} }
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
expectedOutput.push({ role: content.role, parts: expectedParts });
|
|
76
|
+
}
|
|
77
|
+
returnedExamples.push({
|
|
78
|
+
input: {
|
|
79
|
+
role: "user",
|
|
80
|
+
parts: [{ text: (_i = storedExample == null ? void 0 : storedExample.searchKey) != null ? _i : "" }]
|
|
81
|
+
},
|
|
82
|
+
output: expectedOutput
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
return returnedExamples;
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
__name(_VertexAiExampleStore, "VertexAiExampleStore");
|
|
89
|
+
let VertexAiExampleStore = _VertexAiExampleStore;
|
|
90
|
+
export {
|
|
91
|
+
VertexAiExampleStore
|
|
92
|
+
};
|
|
@@ -7,6 +7,8 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
7
7
|
* Copyright 2025 Google LLC
|
|
8
8
|
* SPDX-License-Identifier: Apache-2.0
|
|
9
9
|
*/
|
|
10
|
+
import { getFunctionResponses } from "../events/event.js";
|
|
11
|
+
import { logger } from "../utils/logger.js";
|
|
10
12
|
import {
|
|
11
13
|
isBaseExampleProvider
|
|
12
14
|
} from "./base_example_provider.js";
|
|
@@ -68,17 +70,37 @@ function convertExamplesToText(examples, model) {
|
|
|
68
70
|
return `${EXAMPLES_INTRO}${examplesStr}${EXAMPLES_END}`;
|
|
69
71
|
}
|
|
70
72
|
__name(convertExamplesToText, "convertExamplesToText");
|
|
71
|
-
function
|
|
73
|
+
function getLatestMessageFromUser(session) {
|
|
74
|
+
var _a, _b;
|
|
75
|
+
const events = session.events;
|
|
76
|
+
if (!events || events.length === 0) {
|
|
77
|
+
return "";
|
|
78
|
+
}
|
|
79
|
+
const event = events[events.length - 1];
|
|
80
|
+
if (event.author === "user" && getFunctionResponses(event).length === 0) {
|
|
81
|
+
if (((_a = event.content) == null ? void 0 : _a.parts) && ((_b = event.content.parts[0]) == null ? void 0 : _b.text)) {
|
|
82
|
+
return event.content.parts[0].text;
|
|
83
|
+
} else {
|
|
84
|
+
logger.warn("No message from user for fetching example.");
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return "";
|
|
88
|
+
}
|
|
89
|
+
__name(getLatestMessageFromUser, "getLatestMessageFromUser");
|
|
90
|
+
const _getLatestMessageFromUser = getLatestMessageFromUser;
|
|
91
|
+
async function buildExampleSi(examples, query, model) {
|
|
72
92
|
if (Array.isArray(examples)) {
|
|
73
93
|
return convertExamplesToText(examples, model);
|
|
74
94
|
}
|
|
75
95
|
if (isBaseExampleProvider(examples)) {
|
|
76
|
-
return convertExamplesToText(examples.getExamples(query), model);
|
|
96
|
+
return convertExamplesToText(await examples.getExamples(query), model);
|
|
77
97
|
}
|
|
78
98
|
throw new Error("Invalid example configuration");
|
|
79
99
|
}
|
|
80
100
|
__name(buildExampleSi, "buildExampleSi");
|
|
81
101
|
export {
|
|
102
|
+
_getLatestMessageFromUser,
|
|
82
103
|
buildExampleSi,
|
|
83
|
-
convertExamplesToText
|
|
104
|
+
convertExamplesToText,
|
|
105
|
+
getLatestMessageFromUser
|
|
84
106
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {createRequire as topLevelCreateRequire} from 'module';
|
|
2
|
+
const require = topLevelCreateRequire(import.meta.url);
|
|
3
|
+
/**
|
|
4
|
+
* @license
|
|
5
|
+
* Copyright 2025 Google LLC
|
|
6
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
7
|
+
*/
|
|
8
|
+
export * from "./base_example_provider.js";
|
|
9
|
+
export * from "./example.js";
|
|
10
|
+
export * from "./example_util.js";
|
|
11
|
+
export * from "./vertex_ai_example_store.js";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {createRequire as topLevelCreateRequire} from 'module';
|
|
2
|
+
const require = topLevelCreateRequire(import.meta.url);
|
|
3
|
+
/**
|
|
4
|
+
* @license
|
|
5
|
+
* Copyright 2025 Google LLC
|
|
6
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
7
|
+
*/
|
|
8
|
+
import { VertexAiExampleStore } from "./example.js";
|
|
9
|
+
export {
|
|
10
|
+
VertexAiExampleStore
|
|
11
|
+
};
|
package/dist/esm/index.js
CHANGED
|
@@ -37,12 +37,42 @@ import {
|
|
|
37
37
|
validateSkillDir
|
|
38
38
|
} from "./skills/loader.js";
|
|
39
39
|
import { LOAD_WEB_PAGE, loadWebPage } from "./tools/load_web_page.js";
|
|
40
|
+
import {
|
|
41
|
+
credentialToParam,
|
|
42
|
+
dictToAuthScheme,
|
|
43
|
+
INTERNAL_AUTH_PREFIX,
|
|
44
|
+
openidDictToSchemeCredential,
|
|
45
|
+
openidUrlToSchemeCredential,
|
|
46
|
+
serviceAccountDictToSchemeCredential,
|
|
47
|
+
serviceAccountSchemeCredential,
|
|
48
|
+
tokenToSchemeCredential
|
|
49
|
+
} from "./tools/openapi_tool/auth/auth_helpers.js";
|
|
50
|
+
import { AutoAuthCredentialExchanger } from "./tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.js";
|
|
51
|
+
import {
|
|
52
|
+
AuthCredentialMissingError,
|
|
53
|
+
BaseAuthCredentialExchanger
|
|
54
|
+
} from "./tools/openapi_tool/auth/credential_exchangers/base_auth_credential_exchanger.js";
|
|
55
|
+
import {
|
|
56
|
+
exchangeCredential,
|
|
57
|
+
OAuth2BearerExchanger
|
|
58
|
+
} from "./tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.js";
|
|
59
|
+
import { ServiceAccountCredentialExchanger } from "./tools/openapi_tool/auth/credential_exchangers/service_account_exchanger.js";
|
|
60
|
+
import {
|
|
61
|
+
createApiParameter,
|
|
62
|
+
generateParamDoc,
|
|
63
|
+
generateReturnDoc,
|
|
64
|
+
getTypeHint
|
|
65
|
+
} from "./tools/openapi_tool/common/common.js";
|
|
40
66
|
import { OpenApiSpecParser } from "./tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.js";
|
|
41
67
|
import { OperationParser } from "./tools/openapi_tool/openapi_spec_parser/operation_parser.js";
|
|
42
|
-
import {
|
|
68
|
+
import {
|
|
69
|
+
ToolAuthHandler,
|
|
70
|
+
ToolContextCredentialStore
|
|
71
|
+
} from "./tools/openapi_tool/openapi_spec_parser/tool_auth_handler.js";
|
|
43
72
|
import { OpenAPIToolset } from "./tools/openapi_tool/openapi_toolset.js";
|
|
44
73
|
import {
|
|
45
74
|
createRestApiTool,
|
|
75
|
+
createRestApiToolFromJson,
|
|
46
76
|
RestApiTool
|
|
47
77
|
} from "./tools/openapi_tool/rest_api_tool.js";
|
|
48
78
|
import { FilesRetrieval } from "./tools/retrieval/files_retrieval.js";
|
|
@@ -59,6 +89,9 @@ export * from "./telemetry/setup.js";
|
|
|
59
89
|
export * from "./tools/mcp/index.js";
|
|
60
90
|
export {
|
|
61
91
|
AgentEngineSandboxCodeExecutor,
|
|
92
|
+
AuthCredentialMissingError,
|
|
93
|
+
AutoAuthCredentialExchanger,
|
|
94
|
+
BaseAuthCredentialExchanger,
|
|
62
95
|
CodeExecutionLanguage,
|
|
63
96
|
ContainerCodeExecutor,
|
|
64
97
|
DatabaseSessionService,
|
|
@@ -66,10 +99,12 @@ export {
|
|
|
66
99
|
FilesRetrieval,
|
|
67
100
|
GCPSkillRegistry,
|
|
68
101
|
GcsArtifactService,
|
|
102
|
+
INTERNAL_AUTH_PREFIX,
|
|
69
103
|
InvocationContext,
|
|
70
104
|
LOAD_WEB_PAGE,
|
|
71
105
|
LoadSkillResourceTool,
|
|
72
106
|
LocalEnvironment,
|
|
107
|
+
OAuth2BearerExchanger,
|
|
73
108
|
OpenAPIToolset,
|
|
74
109
|
OpenApiSpecParser,
|
|
75
110
|
OperationParser,
|
|
@@ -77,18 +112,33 @@ export {
|
|
|
77
112
|
RunSkillInlineScriptErrorCode,
|
|
78
113
|
RunSkillInlineScriptTool,
|
|
79
114
|
RunSkillScriptTool,
|
|
115
|
+
ServiceAccountCredentialExchanger,
|
|
80
116
|
SkillToolset,
|
|
81
117
|
ToolAuthHandler,
|
|
118
|
+
ToolContextCredentialStore,
|
|
82
119
|
UnsafeLocalCodeExecutor,
|
|
83
120
|
VertexAiMemoryBankService,
|
|
84
121
|
VertexAiRagMemoryService,
|
|
85
122
|
VertexAiSessionService,
|
|
123
|
+
createApiParameter,
|
|
86
124
|
createRestApiTool,
|
|
125
|
+
createRestApiToolFromJson,
|
|
126
|
+
credentialToParam,
|
|
127
|
+
dictToAuthScheme,
|
|
128
|
+
exchangeCredential,
|
|
129
|
+
generateParamDoc,
|
|
130
|
+
generateReturnDoc,
|
|
87
131
|
getArtifactServiceFromUri,
|
|
88
132
|
getSessionServiceFromUri,
|
|
133
|
+
getTypeHint,
|
|
89
134
|
loadAllSkillsInDir,
|
|
90
135
|
loadSkillFromDir,
|
|
91
136
|
loadSkillFromZipBuffer,
|
|
92
137
|
loadWebPage,
|
|
138
|
+
openidDictToSchemeCredential,
|
|
139
|
+
openidUrlToSchemeCredential,
|
|
140
|
+
serviceAccountDictToSchemeCredential,
|
|
141
|
+
serviceAccountSchemeCredential,
|
|
142
|
+
tokenToSchemeCredential,
|
|
93
143
|
validateSkillDir
|
|
94
144
|
};
|
|
@@ -40,7 +40,7 @@ const ENABLE_CONSOLIDATION_KEY = "enable_consolidation";
|
|
|
40
40
|
const MAX_DIRECT_MEMORIES_PER_GENERATE_CALL = 5;
|
|
41
41
|
function shouldFilterOutEvent(content) {
|
|
42
42
|
return !((content == null ? void 0 : content.parts) || []).some(
|
|
43
|
-
(p) => p.text || p.inlineData || p.fileData
|
|
43
|
+
(p) => p.text || p.inlineData || p.fileData || p.functionCall || p.functionResponse || p.executableCode || p.codeExecutionResult || p.toolCall || p.toolResponse
|
|
44
44
|
);
|
|
45
45
|
}
|
|
46
46
|
__name(shouldFilterOutEvent, "shouldFilterOutEvent");
|
|
@@ -126,6 +126,15 @@ const _VertexAiMemoryBankService = class _VertexAiMemoryBankService {
|
|
|
126
126
|
}
|
|
127
127
|
/**
|
|
128
128
|
* Adds explicit memory items using Vertex Memory Bank.
|
|
129
|
+
*
|
|
130
|
+
* When a `MemoryEntry.id` is set, it is forwarded as the `memoryId` of the
|
|
131
|
+
* created memory, so the caller picks the last component of the memory
|
|
132
|
+
* resource name instead of letting the service generate one. An explicit
|
|
133
|
+
* `customMetadata['memoryId']` takes precedence over `MemoryEntry.id`.
|
|
134
|
+
*
|
|
135
|
+
* The id is forwarded unvalidated, so an id the API rejects fails the create
|
|
136
|
+
* call. Vertex accepts up to 63 characters from `[a-z0-9-]`, starting with a
|
|
137
|
+
* letter and ending with a letter or number.
|
|
129
138
|
*/
|
|
130
139
|
async addMemory(request) {
|
|
131
140
|
if (isConsolidationEnabled(request.customMetadata)) {
|
|
@@ -201,7 +210,8 @@ const _VertexAiMemoryBankService = class _VertexAiMemoryBankService {
|
|
|
201
210
|
const memoryRevisionLabels = revisionLabelsForMemory(memory);
|
|
202
211
|
const config = buildCreateMemoryConfig({
|
|
203
212
|
customMetadata: memoryMetadata,
|
|
204
|
-
memoryRevisionLabels
|
|
213
|
+
memoryRevisionLabels,
|
|
214
|
+
memoryId: memory.id
|
|
205
215
|
});
|
|
206
216
|
const params = {
|
|
207
217
|
name: `reasoningEngines/${this.agentEngineId}`,
|
|
@@ -302,6 +312,9 @@ function buildCreateMemoryConfig(params) {
|
|
|
302
312
|
};
|
|
303
313
|
}
|
|
304
314
|
}
|
|
315
|
+
if (params.memoryId !== void 0 && config["memoryId"] === void 0) {
|
|
316
|
+
config["memoryId"] = params.memoryId;
|
|
317
|
+
}
|
|
305
318
|
const revisionLabels = {
|
|
306
319
|
...customRevisionLabels,
|
|
307
320
|
...params.memoryRevisionLabels
|
|
@@ -435,9 +448,8 @@ function mergeCustomMetadataForMemory(params) {
|
|
|
435
448
|
if (params.customMetadata) {
|
|
436
449
|
Object.assign(mergedMetadata, params.customMetadata);
|
|
437
450
|
}
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
Object.assign(mergedMetadata, memoryWithMetadata.customMetadata);
|
|
451
|
+
if (params.memory.customMetadata) {
|
|
452
|
+
Object.assign(mergedMetadata, params.memory.customMetadata);
|
|
441
453
|
}
|
|
442
454
|
if (Object.keys(mergedMetadata).length === 0) {
|
|
443
455
|
return void 0;
|
|
@@ -8,7 +8,7 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
8
8
|
* SPDX-License-Identifier: Apache-2.0
|
|
9
9
|
*/
|
|
10
10
|
var _a;
|
|
11
|
-
import {
|
|
11
|
+
import { getTrackingHeaders } from "../utils/client_labels.js";
|
|
12
12
|
const BASE_MODEL_SYMBOL = /* @__PURE__ */ Symbol.for("google.adk.baseModel");
|
|
13
13
|
function isBaseLlm(obj) {
|
|
14
14
|
return typeof obj === "object" && obj !== null && BASE_MODEL_SYMBOL in obj && obj[BASE_MODEL_SYMBOL] === true;
|
|
@@ -30,12 +30,7 @@ const _BaseLlm = class _BaseLlm {
|
|
|
30
30
|
this.model = model;
|
|
31
31
|
}
|
|
32
32
|
get trackingHeaders() {
|
|
33
|
-
|
|
34
|
-
const headerValue = labels.join(" ");
|
|
35
|
-
return {
|
|
36
|
-
"x-goog-api-client": headerValue,
|
|
37
|
-
"user-agent": headerValue
|
|
38
|
-
};
|
|
33
|
+
return getTrackingHeaders();
|
|
39
34
|
}
|
|
40
35
|
/**
|
|
41
36
|
* Appends a user content, so that model can continue to output.
|