@google/adk 2.2.1 → 2.4.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/a2a_remote_agent.js +4 -1
- package/dist/cjs/a2a/agent_card.js +102 -26
- package/dist/cjs/a2a/agent_to_a2a.js +1 -1
- package/dist/cjs/agents/agent_engine_client.js +172 -0
- package/dist/cjs/agents/base_agent.js +20 -4
- package/dist/cjs/agents/functions.js +227 -25
- package/dist/cjs/agents/instructions.js +6 -2
- package/dist/cjs/agents/invocation_context.js +26 -4
- package/dist/cjs/agents/langgraph_agent.js +152 -0
- package/dist/cjs/agents/llm_agent.js +194 -107
- package/dist/cjs/agents/processors/basic_llm_request_processor.js +1 -1
- package/dist/cjs/agents/processors/code_execution_request_processor.js +18 -6
- package/dist/cjs/agents/processors/content_processor_utils.js +38 -10
- package/dist/cjs/agents/processors/content_request_processor.js +34 -2
- package/dist/cjs/agents/processors/instructions_llm_request_processor.js +1 -1
- package/dist/cjs/agents/processors/nl_planning_processor.js +12 -3
- package/dist/cjs/artifacts/in_memory_artifact_service.js +14 -0
- package/dist/cjs/auth/auth_handler.js +37 -5
- package/dist/cjs/auth/auth_schemes.js +9 -0
- package/dist/cjs/cli/cli_eval.js +532 -0
- package/dist/cjs/cli/utils/envs.js +116 -0
- package/dist/cjs/cli/utils/evals.js +137 -0
- package/dist/cjs/cli/utils/logs.js +150 -0
- package/dist/cjs/code_executors/agent_engine_sandbox_code_executor.js +7 -2
- package/dist/cjs/code_executors/code_execution_utils.js +48 -16
- package/dist/cjs/code_executors/code_executor_context.js +6 -2
- package/dist/cjs/code_executors/container_code_executor.js +27 -16
- package/dist/cjs/code_executors/unsafe_local_code_executor.js +6 -1
- package/dist/cjs/common.js +61 -0
- package/dist/cjs/context/summarizers/llm_summarizer.js +12 -10
- package/dist/cjs/context/token_based_context_compactor.js +2 -1
- package/dist/cjs/errors/input_validation_error.js +3 -2
- package/dist/cjs/events/event.js +4 -2
- package/dist/cjs/examples/example_util.js +23 -2
- package/dist/cjs/flows/llm_flows/audio_transcriber.js +170 -0
- package/dist/cjs/index.js +104 -1
- package/dist/cjs/integrations/agent_registry/helpers.js +1 -1
- package/dist/cjs/models/gemini_llm_connection.js +16 -8
- package/dist/cjs/models/google_llm.js +13 -16
- package/dist/cjs/models/llm_response.js +9 -1
- package/dist/cjs/models/registry.js +1 -1
- package/dist/cjs/models/routed_llm.js +9 -8
- package/dist/cjs/planners/plan_re_act_planner.js +1 -1
- package/dist/cjs/plugins/base_plugin.js +13 -23
- package/dist/cjs/runner/in_memory_runner.js +6 -11
- package/dist/cjs/runner/runner.js +105 -33
- package/dist/cjs/sessions/base_session_service.js +14 -8
- package/dist/cjs/sessions/database_session_service.js +50 -28
- package/dist/cjs/sessions/db/operations.js +1 -1
- package/dist/cjs/sessions/in_memory_session_service.js +3 -1
- package/dist/cjs/sessions/stale_session_error.js +59 -0
- package/dist/cjs/sessions/state.js +8 -4
- package/dist/cjs/sessions/vertex_ai_session_service.js +34 -15
- package/dist/cjs/skills/loader.js +52 -18
- package/dist/cjs/telemetry/setup.js +0 -1
- package/dist/cjs/telemetry/tracing.js +147 -73
- package/dist/cjs/tools/agent_tool.js +44 -0
- package/dist/cjs/tools/apihub_tool/apihub_toolset.js +137 -0
- package/dist/cjs/tools/apihub_tool/clients/apihub_client.js +272 -0
- package/dist/cjs/tools/apihub_tool/clients/secret_client.js +148 -0
- package/dist/cjs/tools/apihub_tool/clients/service_account.js +48 -0
- package/dist/cjs/tools/application_integration_tool/application_integration_toolset.js +263 -0
- package/dist/cjs/tools/application_integration_tool/clients/cloud_request.js +133 -0
- package/dist/cjs/tools/application_integration_tool/clients/connections_client.js +671 -0
- package/dist/cjs/tools/application_integration_tool/clients/integration_client.js +223 -0
- package/dist/cjs/tools/application_integration_tool/integration_connector_tool.js +184 -0
- package/dist/cjs/tools/example_tool.js +10 -0
- package/dist/cjs/tools/function_tool.js +319 -0
- package/dist/cjs/tools/google_api_tool/google_api_tool.js +100 -0
- package/dist/cjs/tools/google_api_tool/google_api_toolset.js +173 -0
- package/dist/cjs/tools/google_api_tool/google_api_toolsets.js +124 -0
- package/dist/cjs/tools/google_api_tool/googleapi_to_openapi_converter.js +440 -0
- package/dist/cjs/tools/google_api_tool/index.js +61 -0
- package/dist/cjs/tools/load_artifacts_tool.js +12 -6
- package/dist/cjs/tools/load_memory_tool.js +12 -10
- package/dist/cjs/tools/mcp/index.js +12 -0
- package/dist/cjs/tools/mcp/mcp_session_manager.js +25 -0
- package/dist/cjs/tools/mcp/mcp_toolset.js +1 -14
- package/dist/cjs/tools/openapi_tool/auth/auth_helpers.js +1 -2
- package/dist/cjs/tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.js +46 -2
- package/dist/cjs/tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.js +4 -3
- package/dist/cjs/tools/openapi_tool/auth/credential_exchangers/service_account_exchanger.js +94 -10
- package/dist/cjs/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.js +20 -6
- package/dist/cjs/tools/openapi_tool/openapi_spec_parser/operation_parser.js +17 -6
- package/dist/cjs/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.js +14 -2
- package/dist/cjs/tools/openapi_tool/openapi_toolset.js +7 -13
- package/dist/cjs/tools/openapi_tool/rest_api_tool.js +17 -1
- package/dist/cjs/tools/retrieval/base_retrieval_tool.js +18 -3
- package/dist/cjs/tools/toolbox_toolset.js +174 -0
- package/dist/cjs/tools/webmcp/webmcp_toolset.js +1 -14
- package/dist/cjs/utils/client_labels.js +19 -2
- package/dist/cjs/utils/env_aware_utils.js +6 -8
- package/dist/cjs/utils/error_utils.js +11 -11
- package/dist/cjs/utils/failover_utils.js +1 -1
- package/dist/cjs/utils/file_extension_utils.js +11 -0
- package/dist/cjs/utils/file_utils.js +2 -24
- package/dist/cjs/utils/gemini_schema_util.js +28 -7
- package/dist/cjs/utils/json_utils.js +49 -0
- package/dist/cjs/utils/live_connection_utils.js +4 -5
- package/dist/cjs/utils/logger_node.js +11 -1
- package/dist/cjs/utils/object_notation_utils.js +6 -3
- package/dist/cjs/utils/output_schema_utils.js +5 -2
- package/dist/cjs/utils/streaming_utils.js +12 -12
- package/dist/cjs/utils/task.js +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/a2a/a2a_remote_agent.js +4 -1
- package/dist/esm/a2a/agent_card.js +103 -27
- package/dist/esm/a2a/agent_to_a2a.js +5 -2
- package/dist/esm/agents/agent_engine_client.js +144 -0
- package/dist/esm/agents/base_agent.js +20 -4
- package/dist/esm/agents/functions.js +226 -25
- package/dist/esm/agents/instructions.js +6 -2
- package/dist/esm/agents/invocation_context.js +24 -4
- package/dist/esm/agents/langgraph_agent.js +123 -0
- package/dist/esm/agents/llm_agent.js +204 -110
- package/dist/esm/agents/processors/basic_llm_request_processor.js +1 -1
- package/dist/esm/agents/processors/code_execution_request_processor.js +21 -8
- package/dist/esm/agents/processors/content_processor_utils.js +38 -10
- package/dist/esm/agents/processors/content_request_processor.js +34 -2
- package/dist/esm/agents/processors/instructions_llm_request_processor.js +1 -1
- package/dist/esm/agents/processors/nl_planning_processor.js +12 -3
- package/dist/esm/artifacts/in_memory_artifact_service.js +14 -0
- package/dist/esm/auth/auth_handler.js +37 -5
- package/dist/esm/auth/auth_schemes.js +8 -0
- package/dist/esm/cli/cli_eval.js +510 -0
- package/dist/esm/cli/utils/envs.js +78 -0
- package/dist/esm/cli/utils/evals.js +109 -0
- package/dist/esm/cli/utils/logs.js +111 -0
- package/dist/esm/code_executors/agent_engine_sandbox_code_executor.js +7 -2
- package/dist/esm/code_executors/code_execution_utils.js +46 -16
- package/dist/esm/code_executors/code_executor_context.js +5 -2
- package/dist/esm/code_executors/container_code_executor.js +27 -16
- package/dist/esm/code_executors/unsafe_local_code_executor.js +6 -1
- package/dist/esm/common.js +65 -4
- package/dist/esm/context/summarizers/llm_summarizer.js +12 -10
- package/dist/esm/context/token_based_context_compactor.js +2 -1
- package/dist/esm/errors/input_validation_error.js +3 -2
- package/dist/esm/events/event.js +4 -2
- package/dist/esm/examples/example_util.js +21 -1
- package/dist/esm/flows/llm_flows/audio_transcriber.js +142 -0
- package/dist/esm/index.js +114 -2
- package/dist/esm/integrations/agent_registry/helpers.js +1 -1
- package/dist/esm/models/gemini_llm_connection.js +16 -8
- package/dist/esm/models/google_llm.js +14 -17
- package/dist/esm/models/llm_response.js +9 -1
- package/dist/esm/models/registry.js +1 -1
- package/dist/esm/models/routed_llm.js +9 -8
- package/dist/esm/planners/plan_re_act_planner.js +1 -1
- package/dist/esm/plugins/base_plugin.js +13 -23
- package/dist/esm/runner/in_memory_runner.js +6 -11
- package/dist/esm/runner/runner.js +105 -33
- package/dist/esm/sessions/base_session_service.js +12 -7
- package/dist/esm/sessions/database_session_service.js +49 -28
- package/dist/esm/sessions/db/operations.js +1 -1
- package/dist/esm/sessions/in_memory_session_service.js +3 -1
- package/dist/esm/sessions/stale_session_error.js +31 -0
- package/dist/esm/sessions/state.js +8 -4
- package/dist/esm/sessions/vertex_ai_session_service.js +34 -15
- package/dist/esm/skills/loader.js +51 -17
- package/dist/esm/telemetry/setup.js +1 -2
- package/dist/esm/telemetry/tracing.js +151 -74
- package/dist/esm/tools/agent_tool.js +44 -0
- package/dist/esm/tools/apihub_tool/apihub_toolset.js +101 -0
- package/dist/esm/tools/apihub_tool/clients/apihub_client.js +244 -0
- package/dist/esm/tools/apihub_tool/clients/secret_client.js +132 -0
- package/dist/esm/tools/apihub_tool/clients/service_account.js +21 -0
- package/dist/esm/tools/application_integration_tool/application_integration_toolset.js +245 -0
- package/dist/esm/tools/application_integration_tool/clients/cloud_request.js +103 -0
- package/dist/esm/tools/application_integration_tool/clients/connections_client.js +629 -0
- package/dist/esm/tools/application_integration_tool/clients/integration_client.js +219 -0
- package/dist/esm/tools/application_integration_tool/integration_connector_tool.js +158 -0
- package/dist/esm/tools/example_tool.js +13 -1
- package/dist/esm/tools/function_tool.js +316 -0
- package/dist/esm/tools/google_api_tool/google_api_tool.js +73 -0
- package/dist/esm/tools/google_api_tool/google_api_toolset.js +146 -0
- package/dist/esm/tools/google_api_tool/google_api_toolsets.js +94 -0
- package/dist/esm/tools/google_api_tool/googleapi_to_openapi_converter.js +393 -0
- package/dist/esm/tools/google_api_tool/index.js +31 -0
- package/dist/esm/tools/load_artifacts_tool.js +10 -5
- package/dist/esm/tools/load_memory_tool.js +12 -10
- package/dist/esm/tools/mcp/index.js +6 -0
- package/dist/esm/tools/mcp/mcp_session_manager.js +25 -0
- package/dist/esm/tools/mcp/mcp_toolset.js +1 -14
- package/dist/esm/tools/openapi_tool/auth/auth_helpers.js +1 -2
- package/dist/esm/tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.js +50 -3
- package/dist/esm/tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.js +4 -3
- package/dist/esm/tools/openapi_tool/auth/credential_exchangers/service_account_exchanger.js +94 -10
- package/dist/esm/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.js +20 -6
- package/dist/esm/tools/openapi_tool/openapi_spec_parser/operation_parser.js +17 -6
- package/dist/esm/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.js +15 -2
- package/dist/esm/tools/openapi_tool/openapi_toolset.js +6 -12
- package/dist/esm/tools/openapi_tool/rest_api_tool.js +17 -1
- package/dist/esm/tools/retrieval/base_retrieval_tool.js +16 -2
- package/dist/esm/tools/toolbox_toolset.js +148 -0
- package/dist/esm/tools/webmcp/webmcp_toolset.js +1 -14
- package/dist/esm/utils/client_labels.js +19 -2
- package/dist/esm/utils/env_aware_utils.js +6 -8
- package/dist/esm/utils/error_utils.js +9 -10
- package/dist/esm/utils/failover_utils.js +1 -1
- package/dist/esm/utils/file_extension_utils.js +11 -0
- package/dist/esm/utils/file_utils.js +2 -23
- package/dist/esm/utils/gemini_schema_util.js +27 -7
- package/dist/esm/utils/json_utils.js +21 -0
- package/dist/esm/utils/live_connection_utils.js +4 -5
- package/dist/esm/utils/logger_node.js +11 -1
- package/dist/esm/utils/object_notation_utils.js +4 -2
- package/dist/esm/utils/output_schema_utils.js +5 -2
- package/dist/esm/utils/streaming_utils.js +11 -11
- package/dist/esm/utils/task.js +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/types/a2a/a2a_remote_agent.d.ts +9 -0
- package/dist/types/a2a/agent_card.d.ts +44 -1
- package/dist/types/a2a/agent_to_a2a.d.ts +9 -0
- package/dist/types/a2a/index.d.ts +1 -0
- package/dist/types/agents/agent_engine_client.d.ts +37 -0
- package/dist/types/agents/base_agent.d.ts +12 -0
- package/dist/types/agents/functions.d.ts +33 -1
- package/dist/types/agents/invocation_context.d.ts +20 -1
- package/dist/types/agents/langgraph_agent.d.ts +153 -0
- package/dist/types/agents/llm_agent.d.ts +5 -1
- package/dist/types/agents/processors/content_processor_utils.d.ts +4 -2
- package/dist/types/agents/processors/nl_planning_processor.d.ts +2 -1
- package/dist/types/auth/auth_handler.d.ts +28 -1
- package/dist/types/auth/auth_schemes.d.ts +13 -0
- package/dist/types/cli/cli_eval.d.ts +173 -0
- package/dist/types/cli/utils/envs.d.ts +23 -0
- package/dist/types/cli/utils/evals.d.ts +47 -0
- package/dist/types/cli/utils/logs.d.ts +38 -0
- package/dist/types/code_executors/code_execution_utils.d.ts +39 -0
- package/dist/types/code_executors/code_executor_context.d.ts +1 -0
- package/dist/types/code_executors/container_code_executor.d.ts +17 -5
- package/dist/types/common.d.ts +24 -5
- package/dist/types/errors/input_validation_error.d.ts +2 -1
- package/dist/types/events/event.d.ts +4 -0
- package/dist/types/examples/example_util.d.ts +17 -0
- package/dist/types/flows/llm_flows/audio_transcriber.d.ts +85 -0
- package/dist/types/index.d.ts +19 -2
- package/dist/types/models/gemini_llm_connection.d.ts +6 -7
- package/dist/types/models/routed_llm.d.ts +1 -1
- package/dist/types/plugins/base_plugin.d.ts +0 -10
- package/dist/types/runner/in_memory_runner.d.ts +2 -1
- package/dist/types/runner/runner.d.ts +34 -0
- package/dist/types/sessions/base_session_service.d.ts +5 -0
- package/dist/types/sessions/database_session_service.d.ts +17 -1
- package/dist/types/sessions/stale_session_error.d.ts +21 -0
- package/dist/types/sessions/state.d.ts +5 -1
- package/dist/types/sessions/vertex_ai_session_service.d.ts +8 -0
- package/dist/types/skills/loader.d.ts +3 -2
- package/dist/types/skills/skill.d.ts +1 -1
- package/dist/types/telemetry/tracing.d.ts +20 -4
- package/dist/types/tools/apihub_tool/apihub_toolset.d.ts +115 -0
- package/dist/types/tools/apihub_tool/clients/apihub_client.d.ts +142 -0
- package/dist/types/tools/apihub_tool/clients/secret_client.d.ts +55 -0
- package/dist/types/tools/apihub_tool/clients/service_account.d.ts +11 -0
- package/dist/types/tools/application_integration_tool/application_integration_toolset.d.ts +109 -0
- package/dist/types/tools/application_integration_tool/clients/cloud_request.d.ts +53 -0
- package/dist/types/tools/application_integration_tool/clients/connections_client.d.ts +229 -0
- package/dist/types/tools/application_integration_tool/clients/integration_client.d.ts +72 -0
- package/dist/types/tools/application_integration_tool/integration_connector_tool.d.ts +70 -0
- package/dist/types/tools/base_toolset.d.ts +6 -5
- package/dist/types/tools/example_tool.d.ts +10 -0
- package/dist/types/tools/function_tool.d.ts +32 -0
- package/dist/types/tools/google_api_tool/google_api_tool.d.ts +37 -0
- package/dist/types/tools/google_api_tool/google_api_toolset.d.ts +55 -0
- package/dist/types/tools/google_api_tool/google_api_toolsets.d.ts +48 -0
- package/dist/types/tools/google_api_tool/googleapi_to_openapi_converter.d.ts +165 -0
- package/dist/types/tools/google_api_tool/index.d.ts +10 -0
- package/dist/types/tools/load_artifacts_tool.d.ts +14 -1
- package/dist/types/tools/load_memory_tool.d.ts +23 -1
- package/dist/types/tools/mcp/index.d.ts +3 -0
- package/dist/types/tools/mcp/mcp_session_manager.d.ts +34 -1
- package/dist/types/tools/mcp/mcp_toolset.d.ts +15 -0
- package/dist/types/tools/openapi_tool/auth/auth_helpers.d.ts +19 -0
- package/dist/types/tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.d.ts +18 -1
- package/dist/types/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.d.ts +12 -0
- package/dist/types/tools/openapi_tool/openapi_spec_parser/operation_parser.d.ts +8 -0
- package/dist/types/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.d.ts +2 -1
- package/dist/types/tools/openapi_tool/openapi_toolset.d.ts +5 -0
- package/dist/types/tools/openapi_tool/rest_api_tool.d.ts +10 -0
- package/dist/types/tools/retrieval/base_retrieval_tool.d.ts +15 -0
- package/dist/types/tools/toolbox_toolset.d.ts +159 -0
- package/dist/types/utils/client_labels.d.ts +2 -1
- package/dist/types/utils/env_aware_utils.d.ts +18 -2
- package/dist/types/utils/error_utils.d.ts +7 -0
- package/dist/types/utils/file_utils.d.ts +6 -1
- package/dist/types/utils/gemini_schema_util.d.ts +9 -2
- package/dist/types/utils/json_utils.d.ts +11 -0
- package/dist/types/utils/object_notation_utils.d.ts +7 -0
- package/dist/types/utils/output_schema_utils.d.ts +3 -2
- package/dist/types/utils/simple_zod_to_json.d.ts +1 -2
- package/dist/types/utils/streaming_utils.d.ts +11 -4
- package/dist/types/version.d.ts +1 -1
- package/dist/web/index_web.js +117 -110
- package/dist/web/index_web.js.map +4 -4
- package/package.json +38 -26
- package/dist/cjs/models/gemini_continuation.js +0 -232
- package/dist/esm/models/gemini_continuation.js +0 -205
- package/dist/types/models/gemini_continuation.d.ts +0 -59
package/dist/cjs/index.js
CHANGED
|
@@ -25,59 +25,104 @@ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "defau
|
|
|
25
25
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
26
26
|
var index_exports = {};
|
|
27
27
|
__export(index_exports, {
|
|
28
|
+
APIHubClient: () => import_apihub_client.APIHubClient,
|
|
29
|
+
APIHubToolset: () => import_apihub_toolset.APIHubToolset,
|
|
28
30
|
AgentEngineSandboxCodeExecutor: () => import_agent_engine_sandbox_code_executor.AgentEngineSandboxCodeExecutor,
|
|
31
|
+
ApplicationIntegrationToolset: () => import_application_integration_toolset.ApplicationIntegrationToolset,
|
|
29
32
|
AuthCredentialMissingError: () => import_base_auth_credential_exchanger.AuthCredentialMissingError,
|
|
30
33
|
AutoAuthCredentialExchanger: () => import_auto_auth_credential_exchanger.AutoAuthCredentialExchanger,
|
|
31
34
|
BaseAuthCredentialExchanger: () => import_base_auth_credential_exchanger.BaseAuthCredentialExchanger,
|
|
35
|
+
CONNECTOR_BASE_SPEC: () => import_connections_client.CONNECTOR_BASE_SPEC,
|
|
32
36
|
CodeExecutionLanguage: () => import_code_execution_utils.CodeExecutionLanguage,
|
|
37
|
+
ConnectionsClient: () => import_connections_client.ConnectionsClient,
|
|
33
38
|
ContainerCodeExecutor: () => import_container_code_executor.ContainerCodeExecutor,
|
|
39
|
+
DEFAULT_CRITERIA: () => import_cli_eval.DEFAULT_CRITERIA,
|
|
34
40
|
DatabaseSessionService: () => import_database_session_service.DatabaseSessionService,
|
|
41
|
+
DebugLoggingPlugin: () => import_debug_logging_plugin.DebugLoggingPlugin,
|
|
42
|
+
EVAL_SESSION_ID_PREFIX: () => import_cli_eval.EVAL_SESSION_ID_PREFIX,
|
|
43
|
+
EvalStatus: () => import_cli_eval.EvalStatus,
|
|
35
44
|
FileArtifactService: () => import_file_artifact_service.FileArtifactService,
|
|
36
45
|
FilesRetrieval: () => import_files_retrieval.FilesRetrieval,
|
|
37
46
|
GCPSkillRegistry: () => import_gcp_skill_registry.GCPSkillRegistry,
|
|
38
47
|
GcsArtifactService: () => import_gcs_artifact_service.GcsArtifactService,
|
|
39
48
|
INTERNAL_AUTH_PREFIX: () => import_auth_helpers.INTERNAL_AUTH_PREFIX,
|
|
49
|
+
IntegrationClient: () => import_integration_client.IntegrationClient,
|
|
50
|
+
IntegrationConnectorTool: () => import_integration_connector_tool.IntegrationConnectorTool,
|
|
40
51
|
InvocationContext: () => import_invocation_context.InvocationContext,
|
|
41
52
|
LOAD_WEB_PAGE: () => import_load_web_page.LOAD_WEB_PAGE,
|
|
53
|
+
LOGGING_FORMAT: () => import_logs.LOGGING_FORMAT,
|
|
42
54
|
LoadSkillResourceTool: () => import_load_skill_resource_tool.LoadSkillResourceTool,
|
|
43
55
|
LocalEnvironment: () => import_local_environment.LocalEnvironment,
|
|
56
|
+
MISSING_EVAL_DEPENDENCIES_MESSAGE: () => import_cli_eval.MISSING_EVAL_DEPENDENCIES_MESSAGE,
|
|
44
57
|
OAuth2BearerExchanger: () => import_oauth2_exchanger.OAuth2BearerExchanger,
|
|
45
58
|
OpenAPIToolset: () => import_openapi_toolset.OpenAPIToolset,
|
|
46
59
|
OpenApiSpecParser: () => import_openapi_spec_parser.OpenApiSpecParser,
|
|
47
60
|
OperationParser: () => import_operation_parser.OperationParser,
|
|
61
|
+
RESPONSE_EVALUATION_SCORE_KEY: () => import_cli_eval.RESPONSE_EVALUATION_SCORE_KEY,
|
|
62
|
+
RESPONSE_MATCH_SCORE_KEY: () => import_cli_eval.RESPONSE_MATCH_SCORE_KEY,
|
|
48
63
|
RestApiTool: () => import_rest_api_tool.RestApiTool,
|
|
49
64
|
RunSkillInlineScriptErrorCode: () => import_run_skill_inline_script_tool.RunSkillInlineScriptErrorCode,
|
|
50
65
|
RunSkillInlineScriptTool: () => import_run_skill_inline_script_tool.RunSkillInlineScriptTool,
|
|
51
66
|
RunSkillScriptTool: () => import_run_skill_script_tool.RunSkillScriptTool,
|
|
67
|
+
SecretManagerClient: () => import_secret_client.SecretManagerClient,
|
|
52
68
|
ServiceAccountCredentialExchanger: () => import_service_account_exchanger.ServiceAccountCredentialExchanger,
|
|
53
69
|
SkillToolset: () => import_skill_toolset.SkillToolset,
|
|
70
|
+
StaleSessionError: () => import_database_session_service.StaleSessionError,
|
|
71
|
+
TOOL_TRAJECTORY_SCORE_KEY: () => import_cli_eval.TOOL_TRAJECTORY_SCORE_KEY,
|
|
54
72
|
ToolAuthHandler: () => import_tool_auth_handler.ToolAuthHandler,
|
|
55
73
|
ToolContextCredentialStore: () => import_tool_auth_handler.ToolContextCredentialStore,
|
|
56
74
|
UnsafeLocalCodeExecutor: () => import_unsafe_local_code_executor.UnsafeLocalCodeExecutor,
|
|
57
75
|
VertexAiMemoryBankService: () => import_vertex_ai_memory_bank_service.VertexAiMemoryBankService,
|
|
58
76
|
VertexAiRagMemoryService: () => import_vertex_ai_rag_memory_service.VertexAiRagMemoryService,
|
|
59
77
|
VertexAiSessionService: () => import_vertex_ai_session_service.VertexAiSessionService,
|
|
78
|
+
actionRequest: () => import_connections_client.actionRequest,
|
|
79
|
+
actionResponse: () => import_connections_client.actionResponse,
|
|
80
|
+
connectorPayload: () => import_connections_client.connectorPayload,
|
|
60
81
|
createApiParameter: () => import_common.createApiParameter,
|
|
82
|
+
createOperation: () => import_connections_client.createOperation,
|
|
83
|
+
createOperationRequest: () => import_connections_client.createOperationRequest,
|
|
61
84
|
createRestApiTool: () => import_rest_api_tool.createRestApiTool,
|
|
62
85
|
createRestApiToolFromJson: () => import_rest_api_tool.createRestApiToolFromJson,
|
|
63
86
|
credentialToParam: () => import_auth_helpers.credentialToParam,
|
|
87
|
+
deleteOperation: () => import_connections_client.deleteOperation,
|
|
88
|
+
deleteOperationRequest: () => import_connections_client.deleteOperationRequest,
|
|
64
89
|
dictToAuthScheme: () => import_auth_helpers.dictToAuthScheme,
|
|
65
90
|
exchangeCredential: () => import_oauth2_exchanger.exchangeCredential,
|
|
91
|
+
executeCustomQueryRequest: () => import_connections_client.executeCustomQueryRequest,
|
|
92
|
+
generateAuthToken: () => import_oauth2_exchanger.generateAuthToken,
|
|
66
93
|
generateParamDoc: () => import_common.generateParamDoc,
|
|
67
94
|
generateReturnDoc: () => import_common.generateReturnDoc,
|
|
95
|
+
getActionOperation: () => import_connections_client.getActionOperation,
|
|
68
96
|
getArtifactServiceFromUri: () => import_registry.getArtifactServiceFromUri,
|
|
97
|
+
getEvaluationCriteriaOrDefault: () => import_cli_eval.getEvaluationCriteriaOrDefault,
|
|
98
|
+
getOperation: () => import_connections_client.getOperation,
|
|
99
|
+
getOperationRequest: () => import_connections_client.getOperationRequest,
|
|
100
|
+
getRootAgent: () => import_cli_eval.getRootAgent,
|
|
69
101
|
getSessionServiceFromUri: () => import_registry2.getSessionServiceFromUri,
|
|
70
102
|
getTypeHint: () => import_common.getTypeHint,
|
|
103
|
+
isDebugLoggingPlugin: () => import_debug_logging_plugin.isDebugLoggingPlugin,
|
|
104
|
+
isStaleSessionError: () => import_database_session_service.isStaleSessionError,
|
|
105
|
+
listOperation: () => import_connections_client.listOperation,
|
|
106
|
+
listOperationRequest: () => import_connections_client.listOperationRequest,
|
|
71
107
|
loadAllSkillsInDir: () => import_loader.loadAllSkillsInDir,
|
|
108
|
+
loadDotenvForAgent: () => import_envs.loadDotenvForAgent,
|
|
72
109
|
loadSkillFromDir: () => import_loader.loadSkillFromDir,
|
|
73
110
|
loadSkillFromZipBuffer: () => import_loader.loadSkillFromZipBuffer,
|
|
74
111
|
loadWebPage: () => import_load_web_page.loadWebPage,
|
|
112
|
+
logToTmpFolder: () => import_logs.logToTmpFolder,
|
|
75
113
|
openidDictToSchemeCredential: () => import_auth_helpers.openidDictToSchemeCredential,
|
|
76
114
|
openidUrlToSchemeCredential: () => import_auth_helpers.openidUrlToSchemeCredential,
|
|
115
|
+
parseAndGetEvalsToRun: () => import_cli_eval.parseAndGetEvalsToRun,
|
|
116
|
+
runEvals: () => import_cli_eval.runEvals,
|
|
77
117
|
serviceAccountDictToSchemeCredential: () => import_auth_helpers.serviceAccountDictToSchemeCredential,
|
|
78
118
|
serviceAccountSchemeCredential: () => import_auth_helpers.serviceAccountSchemeCredential,
|
|
119
|
+
setupAdkLogger: () => import_logs.setupAdkLogger,
|
|
79
120
|
tokenToSchemeCredential: () => import_auth_helpers.tokenToSchemeCredential,
|
|
80
|
-
|
|
121
|
+
tryGetResetFunc: () => import_cli_eval.tryGetResetFunc,
|
|
122
|
+
updateOperation: () => import_connections_client.updateOperation,
|
|
123
|
+
updateOperationRequest: () => import_connections_client.updateOperationRequest,
|
|
124
|
+
validateSkillDir: () => import_loader.validateSkillDir,
|
|
125
|
+
walkToRootUntilFound: () => import_envs.walkToRootUntilFound
|
|
81
126
|
});
|
|
82
127
|
module.exports = __toCommonJS(index_exports);
|
|
83
128
|
var import_logger_node = require("./utils/logger_node.js");
|
|
@@ -94,11 +139,19 @@ __reExport(index_exports, require("./common.js"), module.exports);
|
|
|
94
139
|
var import_local_environment = require("./environment/local_environment.js");
|
|
95
140
|
var import_vertex_ai_memory_bank_service = require("./memory/vertex_ai_memory_bank_service.js");
|
|
96
141
|
var import_vertex_ai_rag_memory_service = require("./memory/vertex_ai_rag_memory_service.js");
|
|
142
|
+
var import_debug_logging_plugin = require("./plugins/debug_logging_plugin.js");
|
|
97
143
|
var import_database_session_service = require("./sessions/database_session_service.js");
|
|
98
144
|
var import_registry2 = require("./sessions/registry.js");
|
|
99
145
|
var import_vertex_ai_session_service = require("./sessions/vertex_ai_session_service.js");
|
|
100
146
|
var import_gcp_skill_registry = require("./skills/gcp_skill_registry.js");
|
|
101
147
|
var import_loader = require("./skills/loader.js");
|
|
148
|
+
var import_apihub_toolset = require("./tools/apihub_tool/apihub_toolset.js");
|
|
149
|
+
var import_apihub_client = require("./tools/apihub_tool/clients/apihub_client.js");
|
|
150
|
+
var import_secret_client = require("./tools/apihub_tool/clients/secret_client.js");
|
|
151
|
+
var import_application_integration_toolset = require("./tools/application_integration_tool/application_integration_toolset.js");
|
|
152
|
+
var import_connections_client = require("./tools/application_integration_tool/clients/connections_client.js");
|
|
153
|
+
var import_integration_client = require("./tools/application_integration_tool/clients/integration_client.js");
|
|
154
|
+
var import_integration_connector_tool = require("./tools/application_integration_tool/integration_connector_tool.js");
|
|
102
155
|
var import_load_web_page = require("./tools/load_web_page.js");
|
|
103
156
|
var import_auth_helpers = require("./tools/openapi_tool/auth/auth_helpers.js");
|
|
104
157
|
var import_auto_auth_credential_exchanger = require("./tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.js");
|
|
@@ -119,6 +172,10 @@ var import_skill_toolset = require("./tools/skill/skill_toolset.js");
|
|
|
119
172
|
__reExport(index_exports, require("./integrations/agent_registry/agent_registry.js"), module.exports);
|
|
120
173
|
__reExport(index_exports, require("./telemetry/google_cloud.js"), module.exports);
|
|
121
174
|
__reExport(index_exports, require("./telemetry/setup.js"), module.exports);
|
|
175
|
+
__reExport(index_exports, require("./tools/google_api_tool/index.js"), module.exports);
|
|
176
|
+
var import_cli_eval = require("./cli/cli_eval.js");
|
|
177
|
+
var import_envs = require("./cli/utils/envs.js");
|
|
178
|
+
var import_logs = require("./cli/utils/logs.js");
|
|
122
179
|
__reExport(index_exports, require("./tools/mcp/index.js"), module.exports);
|
|
123
180
|
/**
|
|
124
181
|
* @license
|
|
@@ -128,63 +185,109 @@ __reExport(index_exports, require("./tools/mcp/index.js"), module.exports);
|
|
|
128
185
|
(0, import_logger_node.installNodeLogger)();
|
|
129
186
|
// Annotate the CommonJS export names for ESM import in node:
|
|
130
187
|
0 && (module.exports = {
|
|
188
|
+
APIHubClient,
|
|
189
|
+
APIHubToolset,
|
|
131
190
|
AgentEngineSandboxCodeExecutor,
|
|
191
|
+
ApplicationIntegrationToolset,
|
|
132
192
|
AuthCredentialMissingError,
|
|
133
193
|
AutoAuthCredentialExchanger,
|
|
134
194
|
BaseAuthCredentialExchanger,
|
|
195
|
+
CONNECTOR_BASE_SPEC,
|
|
135
196
|
CodeExecutionLanguage,
|
|
197
|
+
ConnectionsClient,
|
|
136
198
|
ContainerCodeExecutor,
|
|
199
|
+
DEFAULT_CRITERIA,
|
|
137
200
|
DatabaseSessionService,
|
|
201
|
+
DebugLoggingPlugin,
|
|
202
|
+
EVAL_SESSION_ID_PREFIX,
|
|
203
|
+
EvalStatus,
|
|
138
204
|
FileArtifactService,
|
|
139
205
|
FilesRetrieval,
|
|
140
206
|
GCPSkillRegistry,
|
|
141
207
|
GcsArtifactService,
|
|
142
208
|
INTERNAL_AUTH_PREFIX,
|
|
209
|
+
IntegrationClient,
|
|
210
|
+
IntegrationConnectorTool,
|
|
143
211
|
InvocationContext,
|
|
144
212
|
LOAD_WEB_PAGE,
|
|
213
|
+
LOGGING_FORMAT,
|
|
145
214
|
LoadSkillResourceTool,
|
|
146
215
|
LocalEnvironment,
|
|
216
|
+
MISSING_EVAL_DEPENDENCIES_MESSAGE,
|
|
147
217
|
OAuth2BearerExchanger,
|
|
148
218
|
OpenAPIToolset,
|
|
149
219
|
OpenApiSpecParser,
|
|
150
220
|
OperationParser,
|
|
221
|
+
RESPONSE_EVALUATION_SCORE_KEY,
|
|
222
|
+
RESPONSE_MATCH_SCORE_KEY,
|
|
151
223
|
RestApiTool,
|
|
152
224
|
RunSkillInlineScriptErrorCode,
|
|
153
225
|
RunSkillInlineScriptTool,
|
|
154
226
|
RunSkillScriptTool,
|
|
227
|
+
SecretManagerClient,
|
|
155
228
|
ServiceAccountCredentialExchanger,
|
|
156
229
|
SkillToolset,
|
|
230
|
+
StaleSessionError,
|
|
231
|
+
TOOL_TRAJECTORY_SCORE_KEY,
|
|
157
232
|
ToolAuthHandler,
|
|
158
233
|
ToolContextCredentialStore,
|
|
159
234
|
UnsafeLocalCodeExecutor,
|
|
160
235
|
VertexAiMemoryBankService,
|
|
161
236
|
VertexAiRagMemoryService,
|
|
162
237
|
VertexAiSessionService,
|
|
238
|
+
actionRequest,
|
|
239
|
+
actionResponse,
|
|
240
|
+
connectorPayload,
|
|
163
241
|
createApiParameter,
|
|
242
|
+
createOperation,
|
|
243
|
+
createOperationRequest,
|
|
164
244
|
createRestApiTool,
|
|
165
245
|
createRestApiToolFromJson,
|
|
166
246
|
credentialToParam,
|
|
247
|
+
deleteOperation,
|
|
248
|
+
deleteOperationRequest,
|
|
167
249
|
dictToAuthScheme,
|
|
168
250
|
exchangeCredential,
|
|
251
|
+
executeCustomQueryRequest,
|
|
252
|
+
generateAuthToken,
|
|
169
253
|
generateParamDoc,
|
|
170
254
|
generateReturnDoc,
|
|
255
|
+
getActionOperation,
|
|
171
256
|
getArtifactServiceFromUri,
|
|
257
|
+
getEvaluationCriteriaOrDefault,
|
|
258
|
+
getOperation,
|
|
259
|
+
getOperationRequest,
|
|
260
|
+
getRootAgent,
|
|
172
261
|
getSessionServiceFromUri,
|
|
173
262
|
getTypeHint,
|
|
263
|
+
isDebugLoggingPlugin,
|
|
264
|
+
isStaleSessionError,
|
|
265
|
+
listOperation,
|
|
266
|
+
listOperationRequest,
|
|
174
267
|
loadAllSkillsInDir,
|
|
268
|
+
loadDotenvForAgent,
|
|
175
269
|
loadSkillFromDir,
|
|
176
270
|
loadSkillFromZipBuffer,
|
|
177
271
|
loadWebPage,
|
|
272
|
+
logToTmpFolder,
|
|
178
273
|
openidDictToSchemeCredential,
|
|
179
274
|
openidUrlToSchemeCredential,
|
|
275
|
+
parseAndGetEvalsToRun,
|
|
276
|
+
runEvals,
|
|
180
277
|
serviceAccountDictToSchemeCredential,
|
|
181
278
|
serviceAccountSchemeCredential,
|
|
279
|
+
setupAdkLogger,
|
|
182
280
|
tokenToSchemeCredential,
|
|
281
|
+
tryGetResetFunc,
|
|
282
|
+
updateOperation,
|
|
283
|
+
updateOperationRequest,
|
|
183
284
|
validateSkillDir,
|
|
285
|
+
walkToRootUntilFound,
|
|
184
286
|
...require("./a2a/index.js"),
|
|
185
287
|
...require("./common.js"),
|
|
186
288
|
...require("./integrations/agent_registry/agent_registry.js"),
|
|
187
289
|
...require("./telemetry/google_cloud.js"),
|
|
188
290
|
...require("./telemetry/setup.js"),
|
|
291
|
+
...require("./tools/google_api_tool/index.js"),
|
|
189
292
|
...require("./tools/mcp/index.js")
|
|
190
293
|
});
|
|
@@ -37,7 +37,7 @@ module.exports = __toCommonJS(helpers_exports);
|
|
|
37
37
|
function isGoogleApi(url) {
|
|
38
38
|
try {
|
|
39
39
|
const parsed = new URL(url);
|
|
40
|
-
return parsed.hostname === "googleapis.com" || parsed.hostname.endsWith(".googleapis.com");
|
|
40
|
+
return parsed.protocol === "https:" && (parsed.hostname === "googleapis.com" || parsed.hostname.endsWith(".googleapis.com"));
|
|
41
41
|
} catch {
|
|
42
42
|
return false;
|
|
43
43
|
}
|
|
@@ -140,26 +140,34 @@ const _GeminiLlmConnection = class _GeminiLlmConnection {
|
|
|
140
140
|
this.geminiSession.sendRealtimeInput({ activityEnd: {} });
|
|
141
141
|
}
|
|
142
142
|
/**
|
|
143
|
-
*
|
|
143
|
+
* Receives the model responses for one model turn.
|
|
144
144
|
*
|
|
145
|
-
* The
|
|
146
|
-
*
|
|
145
|
+
* The generator ends after the message that completes the turn has been
|
|
146
|
+
* processed, or when the server closes the connection. Call `receive()`
|
|
147
|
+
* again to read the next turn; it continues from the next server message.
|
|
147
148
|
*
|
|
148
|
-
* @
|
|
149
|
-
* @param isThought Whether the text is a thought.
|
|
150
|
-
* @param groundingMetadata The grounding metadata to include.
|
|
151
|
-
* @returns An LlmResponse containing the full text.
|
|
149
|
+
* @returns A generator of the LlmResponses of one model turn.
|
|
152
150
|
*/
|
|
153
151
|
async *receive() {
|
|
152
|
+
var _a, _b;
|
|
154
153
|
if (!this.messageQueue) {
|
|
155
154
|
throw new Error("Message queue is not initialized.");
|
|
156
155
|
}
|
|
156
|
+
(_a = this.messageIterator) != null ? _a : this.messageIterator = this.messageQueue[Symbol.asyncIterator]();
|
|
157
157
|
const aggregator = new import_live_connection_utils.LiveResponseAggregator(this.modelVersion);
|
|
158
|
-
|
|
158
|
+
while (true) {
|
|
159
|
+
const next = await this.messageIterator.next();
|
|
160
|
+
if (next.done) {
|
|
161
|
+
break;
|
|
162
|
+
}
|
|
163
|
+
const message = next.value;
|
|
159
164
|
import_logger.logger.debug("Got LLM Live message:", message);
|
|
160
165
|
for (const response of aggregator.processMessage(message)) {
|
|
161
166
|
yield response;
|
|
162
167
|
}
|
|
168
|
+
if ((_b = message.serverContent) == null ? void 0 : _b.turnComplete) {
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
163
171
|
}
|
|
164
172
|
for (const response of aggregator.close()) {
|
|
165
173
|
yield response;
|
|
@@ -101,7 +101,7 @@ const _Gemini = class _Gemini extends (_b = import_base_llm.BaseLlm, _a = GEMINI
|
|
|
101
101
|
* metadata and no `content`; only a stream with neither ends silently.
|
|
102
102
|
*/
|
|
103
103
|
async *generateContentAsync(llmRequest, stream = false, abortSignal) {
|
|
104
|
-
var _a2, _b2
|
|
104
|
+
var _a2, _b2;
|
|
105
105
|
if (this.useInteractionsApi) {
|
|
106
106
|
yield* (0, import_interactions_utils.generateContentViaInteractions)(this.apiClient, llmRequest, stream);
|
|
107
107
|
return;
|
|
@@ -123,28 +123,23 @@ const _Gemini = class _Gemini extends (_b = import_base_llm.BaseLlm, _a = GEMINI
|
|
|
123
123
|
if (abortSignal) {
|
|
124
124
|
llmRequest.config.abortSignal = abortSignal;
|
|
125
125
|
}
|
|
126
|
+
const params = {
|
|
127
|
+
model: (_b2 = llmRequest.model) != null ? _b2 : this.model,
|
|
128
|
+
contents: llmRequest.contents,
|
|
129
|
+
config: llmRequest.config
|
|
130
|
+
};
|
|
126
131
|
if (stream) {
|
|
127
|
-
const streamResult = await this.apiClient.models.generateContentStream(
|
|
128
|
-
|
|
129
|
-
contents: llmRequest.contents,
|
|
130
|
-
config: llmRequest.config
|
|
131
|
-
});
|
|
132
|
-
const aggregator = new import_streaming_utils.StreamingResponseAggregator();
|
|
132
|
+
const streamResult = await this.apiClient.models.generateContentStream(params);
|
|
133
|
+
const aggregator = new import_streaming_utils.GeminiStreamingResponseAggregator();
|
|
133
134
|
for await (const response of streamResult) {
|
|
134
|
-
|
|
135
|
-
yield llmResponse;
|
|
136
|
-
}
|
|
135
|
+
yield* aggregator.processResponse(response);
|
|
137
136
|
}
|
|
138
137
|
const finalResponse = aggregator.close();
|
|
139
138
|
if (finalResponse) {
|
|
140
139
|
yield finalResponse;
|
|
141
140
|
}
|
|
142
141
|
} else {
|
|
143
|
-
const response = await this.apiClient.models.generateContent(
|
|
144
|
-
model: (_c = llmRequest.model) != null ? _c : this.model,
|
|
145
|
-
contents: llmRequest.contents,
|
|
146
|
-
config: llmRequest.config
|
|
147
|
-
});
|
|
142
|
+
const response = await this.apiClient.models.generateContent(params);
|
|
148
143
|
yield (0, import_llm_response.createLlmResponse)(response);
|
|
149
144
|
}
|
|
150
145
|
}
|
|
@@ -164,6 +159,7 @@ const _Gemini = class _Gemini extends (_b = import_base_llm.BaseLlm, _a = GEMINI
|
|
|
164
159
|
});
|
|
165
160
|
} else {
|
|
166
161
|
this._apiClient = new import_genai.GoogleGenAI({
|
|
162
|
+
vertexai: false,
|
|
167
163
|
apiKey: this.apiKey,
|
|
168
164
|
httpOptions: this.getHttpOptions()
|
|
169
165
|
});
|
|
@@ -199,6 +195,7 @@ const _Gemini = class _Gemini extends (_b = import_base_llm.BaseLlm, _a = GEMINI
|
|
|
199
195
|
});
|
|
200
196
|
} else {
|
|
201
197
|
this._liveApiClient = new import_genai.GoogleGenAI({
|
|
198
|
+
vertexai: false,
|
|
202
199
|
apiKey: this.apiKey,
|
|
203
200
|
httpOptions: this.getLiveHttpOptions()
|
|
204
201
|
});
|
|
@@ -305,7 +302,7 @@ function geminiInitParams({
|
|
|
305
302
|
}) {
|
|
306
303
|
const params = { model, vertexai, project, location, apiKey };
|
|
307
304
|
params.vertexai = !!vertexai;
|
|
308
|
-
if (
|
|
305
|
+
if (vertexai === void 0 && !(0, import_env_aware_utils.isBrowser)()) {
|
|
309
306
|
params.vertexai = (0, import_env_aware_utils.isEnterpriseModeEnabled)();
|
|
310
307
|
}
|
|
311
308
|
if (params.vertexai) {
|
|
@@ -33,9 +33,17 @@ module.exports = __toCommonJS(llm_response_exports);
|
|
|
33
33
|
* Copyright 2025 Google LLC
|
|
34
34
|
* SPDX-License-Identifier: Apache-2.0
|
|
35
35
|
*/
|
|
36
|
+
function withOwnInitialPromptTokenCount(usage) {
|
|
37
|
+
const initialPromptTokenCount = usage == null ? void 0 : usage.initialPromptTokenCount;
|
|
38
|
+
if (!usage || initialPromptTokenCount === void 0 || initialPromptTokenCount === usage.promptTokenCount || Object.prototype.propertyIsEnumerable.call(usage, "initialPromptTokenCount")) {
|
|
39
|
+
return usage;
|
|
40
|
+
}
|
|
41
|
+
return { ...usage, initialPromptTokenCount };
|
|
42
|
+
}
|
|
43
|
+
__name(withOwnInitialPromptTokenCount, "withOwnInitialPromptTokenCount");
|
|
36
44
|
function createLlmResponse(response) {
|
|
37
45
|
var _a;
|
|
38
|
-
const usageMetadata = response.usageMetadata;
|
|
46
|
+
const usageMetadata = withOwnInitialPromptTokenCount(response.usageMetadata);
|
|
39
47
|
if (response.candidates && response.candidates.length > 0) {
|
|
40
48
|
const candidate = response.candidates[0];
|
|
41
49
|
if (((_a = candidate.content) == null ? void 0 : _a.parts) && candidate.content.parts.length > 0) {
|
|
@@ -101,7 +101,7 @@ const _LLMRegistry = class _LLMRegistry {
|
|
|
101
101
|
}
|
|
102
102
|
for (const [regex, llmClass] of _LLMRegistry.llmRegistryDict.entries()) {
|
|
103
103
|
const pattern = new RegExp(
|
|
104
|
-
|
|
104
|
+
`^(?:${regex instanceof RegExp ? regex.source : regex})$`,
|
|
105
105
|
regex instanceof RegExp ? regex.flags : void 0
|
|
106
106
|
);
|
|
107
107
|
if (pattern.test(model)) {
|
|
@@ -54,14 +54,12 @@ const _RoutedLlm = class _RoutedLlm extends import_base_llm.BaseLlm {
|
|
|
54
54
|
/**
|
|
55
55
|
* Generates content by delegating to the selected model.
|
|
56
56
|
*/
|
|
57
|
-
async *generateContentAsync(llmRequest, stream) {
|
|
57
|
+
async *generateContentAsync(llmRequest, stream, abortSignal) {
|
|
58
58
|
import_logger.logger.info(`Routing request via ${this.model}`);
|
|
59
|
-
yield* (0, import_failover_utils.runWithRouting)(
|
|
60
|
-
|
|
61
|
-
llmRequest,
|
|
62
|
-
|
|
63
|
-
(model) => model.generateContentAsync(llmRequest, stream)
|
|
64
|
-
);
|
|
59
|
+
yield* (0, import_failover_utils.runWithRouting)(this.models, llmRequest, this.router, (model) => {
|
|
60
|
+
llmRequest.model = model.model;
|
|
61
|
+
return model.generateContentAsync(llmRequest, stream, abortSignal);
|
|
62
|
+
});
|
|
65
63
|
}
|
|
66
64
|
/**
|
|
67
65
|
* Creates a live connection to the LLM by delegating to the selected model.
|
|
@@ -73,7 +71,10 @@ const _RoutedLlm = class _RoutedLlm extends import_base_llm.BaseLlm {
|
|
|
73
71
|
this.models,
|
|
74
72
|
llmRequest,
|
|
75
73
|
this.router,
|
|
76
|
-
(model) =>
|
|
74
|
+
(model) => {
|
|
75
|
+
llmRequest.model = model.model;
|
|
76
|
+
return model.connect(llmRequest);
|
|
77
|
+
}
|
|
77
78
|
);
|
|
78
79
|
const result = await generator.next();
|
|
79
80
|
if (result.done || result.value === void 0) {
|
|
@@ -67,7 +67,7 @@ const _PlanReActPlanner = class _PlanReActPlanner extends import_base_planner.Ba
|
|
|
67
67
|
}
|
|
68
68
|
handleNonFunctionCallPart(part, preservedParts);
|
|
69
69
|
}
|
|
70
|
-
if (firstFcPartIndex
|
|
70
|
+
if (firstFcPartIndex >= 0) {
|
|
71
71
|
for (let j = firstFcPartIndex + 1; j < responseParts.length; j++) {
|
|
72
72
|
if (!responseParts[j].functionCall) {
|
|
73
73
|
break;
|
|
@@ -272,29 +272,19 @@ const _BasePlugin = class _BasePlugin {
|
|
|
272
272
|
return;
|
|
273
273
|
}
|
|
274
274
|
/**
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
* potentially providing alternative responses or recovery mechanisms.
|
|
289
|
-
*
|
|
290
|
-
* @param _params.tool The tool instance that encountered an error.
|
|
291
|
-
* @param _params.toolArgs The arguments that were passed to the tool.
|
|
292
|
-
* @param _params.toolContext The context specific to the tool execution.
|
|
293
|
-
* @param _params.error The exception that was raised during tool execution.
|
|
294
|
-
* @returns An optional dictionary. If a dictionary is returned, it will be
|
|
295
|
-
* used as the tool response instead of propagating the error. Returning
|
|
296
|
-
* `undefined` allows the original error to be raised.
|
|
297
|
-
*/
|
|
275
|
+
* Callback executed when a tool call encounters an error.
|
|
276
|
+
*
|
|
277
|
+
* This callback provides an opportunity to handle tool errors gracefully,
|
|
278
|
+
* potentially providing alternative responses or recovery mechanisms.
|
|
279
|
+
*
|
|
280
|
+
* @param _params.tool The tool instance that encountered an error.
|
|
281
|
+
* @param _params.toolArgs The arguments that were passed to the tool.
|
|
282
|
+
* @param _params.toolContext The context specific to the tool execution.
|
|
283
|
+
* @param _params.error The exception that was raised during tool execution.
|
|
284
|
+
* @returns An optional dictionary. If a dictionary is returned, it will be
|
|
285
|
+
* used as the tool response instead of propagating the error. Returning
|
|
286
|
+
* `undefined` allows the original error to be raised.
|
|
287
|
+
*/
|
|
298
288
|
async onToolErrorCallback(_params) {
|
|
299
289
|
return;
|
|
300
290
|
}
|
|
@@ -44,28 +44,23 @@ const _InMemoryRunner = class _InMemoryRunner extends import_runner.Runner {
|
|
|
44
44
|
* @param params The configuration for the runner.
|
|
45
45
|
* @param params.app An optional application instance to run.
|
|
46
46
|
* @param params.agent The root agent to run.
|
|
47
|
-
* @param params.appName The application name. Defaults to `
|
|
47
|
+
* @param params.appName The application name. Defaults to `app.name` when
|
|
48
|
+
* `app` is provided, or `'InMemoryRunner'` otherwise.
|
|
48
49
|
* @param params.plugins An optional list of plugins.
|
|
49
50
|
* @param params.resumabilityConfig An optional resumability configuration.
|
|
50
51
|
*/
|
|
51
52
|
constructor(params) {
|
|
52
|
-
var _a;
|
|
53
|
-
const {
|
|
54
|
-
agent,
|
|
55
|
-
appName = "InMemoryRunner",
|
|
56
|
-
plugins = [],
|
|
57
|
-
app,
|
|
58
|
-
resumabilityConfig
|
|
59
|
-
} = params;
|
|
53
|
+
var _a, _b;
|
|
54
|
+
const { agent, appName, plugins = [], app, resumabilityConfig } = params;
|
|
60
55
|
super({
|
|
61
56
|
app,
|
|
62
|
-
appName,
|
|
57
|
+
appName: (_a = appName != null ? appName : app == null ? void 0 : app.name) != null ? _a : "InMemoryRunner",
|
|
63
58
|
agent,
|
|
64
59
|
plugins,
|
|
65
60
|
artifactService: new import_in_memory_artifact_service.InMemoryArtifactService(),
|
|
66
61
|
sessionService: new import_in_memory_session_service.InMemorySessionService(),
|
|
67
62
|
memoryService: new import_in_memory_memory_service.InMemoryMemoryService(),
|
|
68
|
-
resumabilityConfig: (
|
|
63
|
+
resumabilityConfig: (_b = app == null ? void 0 : app.resumabilityConfig) != null ? _b : resumabilityConfig
|
|
69
64
|
});
|
|
70
65
|
}
|
|
71
66
|
};
|