@google/adk 0.2.4 → 0.2.5
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/agents/base_agent.js +9 -3
- package/dist/cjs/agents/invocation_context.js +3 -1
- package/dist/cjs/agents/llm_agent.js +129 -75
- package/dist/cjs/agents/loop_agent.js +16 -5
- package/dist/cjs/agents/parallel_agent.js +17 -3
- package/dist/cjs/agents/readonly_context.js +4 -1
- package/dist/cjs/agents/sequential_agent.js +34 -12
- package/dist/cjs/code_executors/base_code_executor.js +12 -2
- package/dist/cjs/code_executors/built_in_code_executor.js +15 -3
- package/dist/cjs/common.js +41 -0
- package/dist/cjs/examples/base_example_provider.js +18 -2
- package/dist/cjs/examples/example_util.js +1 -1
- package/dist/cjs/index.js +11 -11
- package/dist/cjs/index.js.map +4 -4
- package/dist/cjs/plugins/base_plugin.js +59 -49
- package/dist/cjs/plugins/security_plugin.js +4 -1
- package/dist/cjs/runner/runner.js +34 -24
- package/dist/cjs/tools/agent_tool.js +18 -9
- package/dist/cjs/tools/base_tool.js +16 -6
- package/dist/cjs/tools/function_tool.js +14 -5
- package/dist/cjs/tools/google_search_tool.js +8 -3
- package/dist/cjs/tools/tool_context.js +4 -9
- package/dist/cjs/utils/gemini_schema_util.js +1 -0
- package/dist/cjs/version.js +1 -1
- package/dist/esm/agents/base_agent.js +9 -3
- package/dist/esm/agents/invocation_context.js +3 -1
- package/dist/esm/agents/llm_agent.js +165 -83
- package/dist/esm/agents/loop_agent.js +14 -4
- package/dist/esm/agents/parallel_agent.js +15 -2
- package/dist/esm/agents/readonly_context.js +4 -1
- package/dist/esm/agents/sequential_agent.js +33 -12
- package/dist/esm/code_executors/base_code_executor.js +10 -1
- package/dist/esm/code_executors/built_in_code_executor.js +13 -2
- package/dist/esm/common.js +53 -10
- package/dist/esm/examples/base_example_provider.js +16 -1
- package/dist/esm/examples/example_util.js +4 -2
- package/dist/esm/index.js +11 -11
- package/dist/esm/index.js.map +4 -4
- package/dist/esm/plugins/base_plugin.js +59 -49
- package/dist/esm/plugins/security_plugin.js +4 -1
- package/dist/esm/runner/runner.js +43 -27
- package/dist/esm/tools/agent_tool.js +17 -9
- package/dist/esm/tools/base_tool.js +14 -5
- package/dist/esm/tools/function_tool.js +13 -7
- package/dist/esm/tools/google_search_tool.js +9 -3
- package/dist/esm/tools/tool_context.js +4 -9
- package/dist/esm/utils/gemini_schema_util.js +1 -0
- package/dist/esm/version.js +1 -1
- package/dist/types/agents/base_agent.d.ts +14 -3
- package/dist/types/agents/invocation_context.d.ts +4 -2
- package/dist/types/agents/llm_agent.d.ts +42 -30
- package/dist/types/agents/loop_agent.d.ts +16 -0
- package/dist/types/agents/parallel_agent.d.ts +16 -0
- package/dist/types/agents/sequential_agent.d.ts +17 -1
- package/dist/types/auth/auth_schemes.d.ts +5 -2
- package/dist/types/code_executors/base_code_executor.d.ts +14 -0
- package/dist/types/code_executors/built_in_code_executor.d.ts +19 -0
- package/dist/types/common.d.ts +38 -14
- package/dist/types/examples/base_example_provider.d.ts +16 -0
- package/dist/types/plugins/base_plugin.d.ts +50 -40
- package/dist/types/runner/runner.d.ts +17 -9
- package/dist/types/tools/agent_tool.d.ts +14 -0
- package/dist/types/tools/base_tool.d.ts +14 -0
- package/dist/types/tools/function_tool.d.ts +14 -1
- package/dist/types/tools/google_search_tool.d.ts +3 -4
- package/dist/types/tools/tool_context.d.ts +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/web/agents/base_agent.js +9 -3
- package/dist/web/agents/invocation_context.js +3 -1
- package/dist/web/agents/llm_agent.js +165 -83
- package/dist/web/agents/loop_agent.js +14 -4
- package/dist/web/agents/parallel_agent.js +15 -2
- package/dist/web/agents/readonly_context.js +4 -1
- package/dist/web/agents/sequential_agent.js +33 -12
- package/dist/web/code_executors/base_code_executor.js +10 -1
- package/dist/web/code_executors/built_in_code_executor.js +13 -2
- package/dist/web/common.js +53 -10
- package/dist/web/examples/base_example_provider.js +16 -1
- package/dist/web/examples/example_util.js +4 -2
- package/dist/web/index.js +1 -1
- package/dist/web/index.js.map +4 -4
- package/dist/web/plugins/base_plugin.js +59 -49
- package/dist/web/plugins/security_plugin.js +4 -1
- package/dist/web/runner/runner.js +44 -28
- package/dist/web/tools/agent_tool.js +17 -9
- package/dist/web/tools/base_tool.js +14 -5
- package/dist/web/tools/function_tool.js +13 -7
- package/dist/web/tools/google_search_tool.js +9 -3
- package/dist/web/tools/tool_context.js +4 -9
- package/dist/web/utils/gemini_schema_util.js +1 -0
- package/dist/web/version.js +1 -1
- package/package.json +2 -2
|
@@ -24,8 +24,8 @@ export type InstructionProvider = (context: ReadonlyContext) => string | Promise
|
|
|
24
24
|
/**
|
|
25
25
|
* A callback that runs before a request is sent to the model.
|
|
26
26
|
*
|
|
27
|
-
* @param context The current callback context.
|
|
28
|
-
* @param request The raw model request. Callback can mutate the request.
|
|
27
|
+
* @param params.context The current callback context.
|
|
28
|
+
* @param params.request The raw model request. Callback can mutate the request.
|
|
29
29
|
* @returns The content to return to the user. When present, the model call
|
|
30
30
|
* will be skipped and the provided content will be returned to user.
|
|
31
31
|
*/
|
|
@@ -43,8 +43,8 @@ export type BeforeModelCallback = SingleBeforeModelCallback | SingleBeforeModelC
|
|
|
43
43
|
/**
|
|
44
44
|
* A callback that runs after a response is received from the model.
|
|
45
45
|
*
|
|
46
|
-
* @param context The current callback context.
|
|
47
|
-
* @param response The actual model response.
|
|
46
|
+
* @param params.context The current callback context.
|
|
47
|
+
* @param params.response The actual model response.
|
|
48
48
|
* @returns The content to return to the user. When present, the actual model
|
|
49
49
|
* response will be ignored and the provided content will be returned to
|
|
50
50
|
* user.
|
|
@@ -60,24 +60,20 @@ export type SingleAfterModelCallback = (params: {
|
|
|
60
60
|
order they are listed until a callback does not return None.
|
|
61
61
|
*/
|
|
62
62
|
export type AfterModelCallback = SingleAfterModelCallback | SingleAfterModelCallback[];
|
|
63
|
-
/** A generic dictionary type. */
|
|
64
|
-
export type Dict = {
|
|
65
|
-
[key: string]: unknown;
|
|
66
|
-
};
|
|
67
63
|
/**
|
|
68
64
|
* A callback that runs before a tool is called.
|
|
69
65
|
*
|
|
70
|
-
* @param tool The tool to be called.
|
|
71
|
-
* @param args The arguments to the tool.
|
|
72
|
-
* @param
|
|
66
|
+
* @param params.tool The tool to be called.
|
|
67
|
+
* @param params.args The arguments to the tool.
|
|
68
|
+
* @param params.context ToolContext for the tool call.
|
|
73
69
|
* @returns The tool response. When present, the returned tool response will
|
|
74
70
|
* be used and the framework will skip calling the actual tool.
|
|
75
71
|
*/
|
|
76
72
|
export type SingleBeforeToolCallback = (params: {
|
|
77
73
|
tool: BaseTool;
|
|
78
|
-
args:
|
|
74
|
+
args: Record<string, unknown>;
|
|
79
75
|
context: ToolContext;
|
|
80
|
-
}) =>
|
|
76
|
+
}) => Record<string, unknown> | undefined | Promise<Record<string, unknown> | undefined>;
|
|
81
77
|
/**
|
|
82
78
|
* A single callback or a list of callbacks.
|
|
83
79
|
*
|
|
@@ -88,18 +84,18 @@ export type BeforeToolCallback = SingleBeforeToolCallback | SingleBeforeToolCall
|
|
|
88
84
|
/**
|
|
89
85
|
* A callback that runs after a tool is called.
|
|
90
86
|
*
|
|
91
|
-
* @param tool The tool to be called.
|
|
92
|
-
* @param args The arguments to the tool.
|
|
93
|
-
* @param
|
|
94
|
-
* @param
|
|
95
|
-
* @returns When present, the returned
|
|
87
|
+
* @param params.tool The tool to be called.
|
|
88
|
+
* @param params.args The arguments to the tool.
|
|
89
|
+
* @param params.context ToolContext for the tool call.
|
|
90
|
+
* @param params.response The response from the tool.
|
|
91
|
+
* @returns When present, the returned record will be used as tool result.
|
|
96
92
|
*/
|
|
97
93
|
export type SingleAfterToolCallback = (params: {
|
|
98
94
|
tool: BaseTool;
|
|
99
|
-
args:
|
|
95
|
+
args: Record<string, unknown>;
|
|
100
96
|
context: ToolContext;
|
|
101
|
-
response:
|
|
102
|
-
}) =>
|
|
97
|
+
response: Record<string, unknown>;
|
|
98
|
+
}) => Record<string, unknown> | undefined | Promise<Record<string, unknown> | undefined>;
|
|
103
99
|
/**
|
|
104
100
|
* A single callback or a list of callbacks.
|
|
105
101
|
*
|
|
@@ -111,6 +107,9 @@ export type AfterToolCallback = SingleAfterToolCallback | SingleAfterToolCallbac
|
|
|
111
107
|
export type ExamplesUnion = Example[] | BaseExampleProvider;
|
|
112
108
|
/** A union of tool types that can be provided to an agent. */
|
|
113
109
|
export type ToolUnion = BaseTool | BaseToolset;
|
|
110
|
+
/**
|
|
111
|
+
* The configuration options for creating an LLM-based agent.
|
|
112
|
+
*/
|
|
114
113
|
export interface LlmAgentConfig extends BaseAgentConfig {
|
|
115
114
|
/**
|
|
116
115
|
* The model to use for the agent.
|
|
@@ -228,10 +227,23 @@ declare class CodeExecutionResponseProcessor implements BaseLlmResponseProcessor
|
|
|
228
227
|
* The exported response processor instance.
|
|
229
228
|
*/
|
|
230
229
|
export declare const responseProcessor: CodeExecutionResponseProcessor;
|
|
230
|
+
/**
|
|
231
|
+
* A unique symbol to identify ADK agent classes.
|
|
232
|
+
* Defined once and shared by all LlmAgent instances.
|
|
233
|
+
*/
|
|
234
|
+
declare const LLM_AGENT_SIGNATURE_SYMBOL: unique symbol;
|
|
235
|
+
/**
|
|
236
|
+
* Type guard to check if an object is an instance of LlmAgent.
|
|
237
|
+
* @param obj The object to check.
|
|
238
|
+
* @returns True if the object is an instance of LlmAgent, false otherwise.
|
|
239
|
+
*/
|
|
240
|
+
export declare function isLlmAgent(obj: unknown): obj is LlmAgent;
|
|
231
241
|
/**
|
|
232
242
|
* An agent that uses a large language model to generate responses.
|
|
233
243
|
*/
|
|
234
244
|
export declare class LlmAgent extends BaseAgent {
|
|
245
|
+
/** A unique symbol to identify ADK LLM agent class. */
|
|
246
|
+
readonly [LLM_AGENT_SIGNATURE_SYMBOL] = true;
|
|
235
247
|
model?: string | BaseLlm;
|
|
236
248
|
instruction: string | InstructionProvider;
|
|
237
249
|
globalInstruction: string | InstructionProvider;
|
|
@@ -258,30 +270,30 @@ export declare class LlmAgent extends BaseAgent {
|
|
|
258
270
|
*/
|
|
259
271
|
get canonicalModel(): BaseLlm;
|
|
260
272
|
/**
|
|
261
|
-
* The resolved
|
|
273
|
+
* The resolved instruction field to construct instruction for this
|
|
262
274
|
* agent.
|
|
263
275
|
*
|
|
264
276
|
* This method is only for use by Agent Development Kit.
|
|
265
277
|
* @param context The context to retrieve the session state.
|
|
266
|
-
* @returns The resolved
|
|
278
|
+
* @returns The resolved instruction field.
|
|
267
279
|
*/
|
|
268
280
|
canonicalInstruction(context: ReadonlyContext): Promise<{
|
|
269
281
|
instruction: string;
|
|
270
282
|
requireStateInjection: boolean;
|
|
271
283
|
}>;
|
|
272
284
|
/**
|
|
273
|
-
* The resolved
|
|
285
|
+
* The resolved globalInstruction field to construct global instruction.
|
|
274
286
|
*
|
|
275
287
|
* This method is only for use by Agent Development Kit.
|
|
276
288
|
* @param context The context to retrieve the session state.
|
|
277
|
-
* @returns The resolved
|
|
289
|
+
* @returns The resolved globalInstruction field.
|
|
278
290
|
*/
|
|
279
291
|
canonicalGlobalInstruction(context: ReadonlyContext): Promise<{
|
|
280
292
|
instruction: string;
|
|
281
293
|
requireStateInjection: boolean;
|
|
282
294
|
}>;
|
|
283
295
|
/**
|
|
284
|
-
* The resolved
|
|
296
|
+
* The resolved tools field as a list of BaseTool based on the context.
|
|
285
297
|
*
|
|
286
298
|
* This method is only for use by Agent Development Kit.
|
|
287
299
|
*/
|
|
@@ -294,28 +306,28 @@ export declare class LlmAgent extends BaseAgent {
|
|
|
294
306
|
*/
|
|
295
307
|
private static normalizeCallbackArray;
|
|
296
308
|
/**
|
|
297
|
-
* The resolved
|
|
309
|
+
* The resolved beforeModelCallback field as a list of
|
|
298
310
|
* SingleBeforeModelCallback.
|
|
299
311
|
*
|
|
300
312
|
* This method is only for use by Agent Development Kit.
|
|
301
313
|
*/
|
|
302
314
|
get canonicalBeforeModelCallbacks(): SingleBeforeModelCallback[];
|
|
303
315
|
/**
|
|
304
|
-
* The resolved
|
|
316
|
+
* The resolved afterModelCallback field as a list of
|
|
305
317
|
* SingleAfterModelCallback.
|
|
306
318
|
*
|
|
307
319
|
* This method is only for use by Agent Development Kit.
|
|
308
320
|
*/
|
|
309
321
|
get canonicalAfterModelCallbacks(): SingleAfterModelCallback[];
|
|
310
322
|
/**
|
|
311
|
-
* The resolved
|
|
323
|
+
* The resolved beforeToolCallback field as a list of
|
|
312
324
|
* BeforeToolCallback.
|
|
313
325
|
*
|
|
314
326
|
* This method is only for use by Agent Development Kit.
|
|
315
327
|
*/
|
|
316
328
|
get canonicalBeforeToolCallbacks(): SingleBeforeToolCallback[];
|
|
317
329
|
/**
|
|
318
|
-
* The resolved
|
|
330
|
+
* The resolved afterToolCallback field as a list of AfterToolCallback.
|
|
319
331
|
*
|
|
320
332
|
* This method is only for use by Agent Development Kit.
|
|
321
333
|
*/
|
|
@@ -17,6 +17,17 @@ export interface LoopAgentConfig extends BaseAgentConfig {
|
|
|
17
17
|
*/
|
|
18
18
|
maxIterations?: number;
|
|
19
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* A unique symbol to identify ADK agent classes.
|
|
22
|
+
* Defined once and shared by all LoopAgent instances.
|
|
23
|
+
*/
|
|
24
|
+
declare const LOOP_AGENT_SIGNATURE_SYMBOL: unique symbol;
|
|
25
|
+
/**
|
|
26
|
+
* Type guard to check if an object is an instance of LoopAgent.
|
|
27
|
+
* @param obj The object to check.
|
|
28
|
+
* @returns True if the object is an instance of LoopAgent, false otherwise.
|
|
29
|
+
*/
|
|
30
|
+
export declare function isLoopAgent(obj: unknown): obj is LoopAgent;
|
|
20
31
|
/**
|
|
21
32
|
* A shell agent that run its sub-agents in a loop.
|
|
22
33
|
*
|
|
@@ -24,8 +35,13 @@ export interface LoopAgentConfig extends BaseAgentConfig {
|
|
|
24
35
|
* reached, the loop agent will stop.
|
|
25
36
|
*/
|
|
26
37
|
export declare class LoopAgent extends BaseAgent {
|
|
38
|
+
/**
|
|
39
|
+
* A unique symbol to identify ADK loop agent class.
|
|
40
|
+
*/
|
|
41
|
+
readonly [LOOP_AGENT_SIGNATURE_SYMBOL] = true;
|
|
27
42
|
private readonly maxIterations;
|
|
28
43
|
constructor(config: LoopAgentConfig);
|
|
29
44
|
protected runAsyncImpl(context: InvocationContext): AsyncGenerator<Event, void, void>;
|
|
30
45
|
protected runLiveImpl(context: InvocationContext): AsyncGenerator<Event, void, void>;
|
|
31
46
|
}
|
|
47
|
+
export {};
|
|
@@ -6,6 +6,17 @@
|
|
|
6
6
|
import { Event } from '../events/event.js';
|
|
7
7
|
import { BaseAgent } from './base_agent.js';
|
|
8
8
|
import { InvocationContext } from './invocation_context.js';
|
|
9
|
+
/**
|
|
10
|
+
* A unique symbol to identify ADK agent classes.
|
|
11
|
+
* Defined once and shared by all ParallelAgent instances.
|
|
12
|
+
*/
|
|
13
|
+
declare const PARALLEL_AGENT_SIGNATURE_SYMBOL: unique symbol;
|
|
14
|
+
/**
|
|
15
|
+
* Type guard to check if an object is an instance of ParallelAgent.
|
|
16
|
+
* @param obj The object to check.
|
|
17
|
+
* @returns True if the object is an instance of ParallelAgent, false otherwise.
|
|
18
|
+
*/
|
|
19
|
+
export declare function isParallelAgent(obj: unknown): obj is ParallelAgent;
|
|
9
20
|
/**
|
|
10
21
|
* A shell agent that run its sub-agents in parallel in isolated manner.
|
|
11
22
|
*
|
|
@@ -16,6 +27,11 @@ import { InvocationContext } from './invocation_context.js';
|
|
|
16
27
|
* - Generating multiple responses for review by a subsequent evaluation agent.
|
|
17
28
|
*/
|
|
18
29
|
export declare class ParallelAgent extends BaseAgent {
|
|
30
|
+
/**
|
|
31
|
+
* A unique symbol to identify ADK parallel agent class.
|
|
32
|
+
*/
|
|
33
|
+
readonly [PARALLEL_AGENT_SIGNATURE_SYMBOL] = true;
|
|
19
34
|
protected runAsyncImpl(context: InvocationContext): AsyncGenerator<Event, void, void>;
|
|
20
35
|
protected runLiveImpl(context: InvocationContext): AsyncGenerator<Event, void, void>;
|
|
21
36
|
}
|
|
37
|
+
export {};
|
|
@@ -6,10 +6,25 @@
|
|
|
6
6
|
import { Event } from '../events/event.js';
|
|
7
7
|
import { BaseAgent } from './base_agent.js';
|
|
8
8
|
import { InvocationContext } from './invocation_context.js';
|
|
9
|
+
/**
|
|
10
|
+
* A unique symbol to identify ADK agent classes.
|
|
11
|
+
* Defined once and shared by all SequentialAgent instances.
|
|
12
|
+
*/
|
|
13
|
+
declare const SEQUENTIAL_AGENT_SIGNATURE_SYMBOL: unique symbol;
|
|
14
|
+
/**
|
|
15
|
+
* Type guard to check if an object is an instance of SequentialAgent.
|
|
16
|
+
* @param obj The object to check.
|
|
17
|
+
* @returns True if the object is an instance of SequentialAgent, false otherwise.
|
|
18
|
+
*/
|
|
19
|
+
export declare function isSequentialAgent(obj: unknown): obj is SequentialAgent;
|
|
9
20
|
/**
|
|
10
21
|
* A shell agent that runs its sub-agents in a sequential order.
|
|
11
22
|
*/
|
|
12
23
|
export declare class SequentialAgent extends BaseAgent {
|
|
24
|
+
/**
|
|
25
|
+
* A unique symbol to identify ADK sequential agent class.
|
|
26
|
+
*/
|
|
27
|
+
readonly [SEQUENTIAL_AGENT_SIGNATURE_SYMBOL] = true;
|
|
13
28
|
protected runAsyncImpl(context: InvocationContext): AsyncGenerator<Event, void, void>;
|
|
14
29
|
/**
|
|
15
30
|
* Implementation for live SequentialAgent.
|
|
@@ -20,7 +35,8 @@ export declare class SequentialAgent extends BaseAgent {
|
|
|
20
35
|
* the model can call this function to signal that it's finished the task and
|
|
21
36
|
* we can move on to the next agent.
|
|
22
37
|
*
|
|
23
|
-
* @param context
|
|
38
|
+
* @param context The invocation context of the agent.
|
|
24
39
|
*/
|
|
25
40
|
protected runLiveImpl(context: InvocationContext): AsyncGenerator<Event, void, void>;
|
|
26
41
|
}
|
|
42
|
+
export {};
|
|
@@ -5,8 +5,11 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { OpenAPIV3 } from 'openapi-types';
|
|
7
7
|
type Oauth2Flow = OpenAPIV3.OAuth2SecurityScheme['flows'];
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
/**
|
|
9
|
+
* OpenIdConnectWithConfig extends OpenIdSecurityScheme with additional
|
|
10
|
+
* configuration options.
|
|
11
|
+
*/
|
|
12
|
+
export interface OpenIdConnectWithConfig extends OpenAPIV3.OpenIdSecurityScheme {
|
|
10
13
|
authorizationEndpoint: string;
|
|
11
14
|
tokenEndpoint: string;
|
|
12
15
|
userinfoEndpoint?: string;
|
|
@@ -14,11 +14,24 @@ export interface ExecuteCodeParams {
|
|
|
14
14
|
/** The input of the code execution. */
|
|
15
15
|
codeExecutionInput: CodeExecutionInput;
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* A unique symbol to identify BaseCodeExecutor classes.
|
|
19
|
+
* Defined once and shared by all BaseCodeExecutor instances.
|
|
20
|
+
*/
|
|
21
|
+
declare const BASE_CODE_EXECUTOR_SIGNATURE_SYMBOL: unique symbol;
|
|
22
|
+
/**
|
|
23
|
+
* Type guard to check if an object is an instance of BaseCodeExecutor.
|
|
24
|
+
* @param obj The object to check.
|
|
25
|
+
* @returns True if the object is an instance of BaseCodeExecutor, false otherwise.
|
|
26
|
+
*/
|
|
27
|
+
export declare function isBaseCodeExecutor(obj: unknown): obj is BaseCodeExecutor;
|
|
17
28
|
/**
|
|
18
29
|
* The code executor allows the agent to execute code blocks from model
|
|
19
30
|
* responses and incorporate the execution results into the final response.
|
|
20
31
|
*/
|
|
21
32
|
export declare abstract class BaseCodeExecutor {
|
|
33
|
+
/** A unique symbol to identify BaseCodeExecutor class. */
|
|
34
|
+
readonly [BASE_CODE_EXECUTOR_SIGNATURE_SYMBOL] = true;
|
|
22
35
|
/**
|
|
23
36
|
* If true, extract and process data files from the model request
|
|
24
37
|
* and attach them to the code executor.
|
|
@@ -58,3 +71,4 @@ export declare abstract class BaseCodeExecutor {
|
|
|
58
71
|
*/
|
|
59
72
|
abstract executeCode(params: ExecuteCodeParams): Promise<CodeExecutionResult>;
|
|
60
73
|
}
|
|
74
|
+
export {};
|
|
@@ -1,6 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
1
6
|
import { LlmRequest } from '../models/llm_request.js';
|
|
2
7
|
import { BaseCodeExecutor, ExecuteCodeParams } from './base_code_executor.js';
|
|
3
8
|
import { CodeExecutionResult } from './code_execution_utils.js';
|
|
9
|
+
/**
|
|
10
|
+
* A unique symbol to identify BuiltInCodeExecutor classes.
|
|
11
|
+
* Defined once and shared by all BuiltInCodeExecutor instances.
|
|
12
|
+
*/
|
|
13
|
+
declare const BUILT_IN_CODE_EXECUTOR_SIGNATURE_SYMBOL: unique symbol;
|
|
14
|
+
/**
|
|
15
|
+
* Type guard to check if an object is an instance of BuiltInCodeExecutor.
|
|
16
|
+
* @param obj The object to check.
|
|
17
|
+
* @returns True if the object is an instance of BuiltInCodeExecutor, false otherwise.
|
|
18
|
+
*/
|
|
19
|
+
export declare function isBuiltInCodeExecutor(obj: unknown): obj is BuiltInCodeExecutor;
|
|
4
20
|
/**
|
|
5
21
|
* A code executor that uses the Model's built-in code executor.
|
|
6
22
|
*
|
|
@@ -8,6 +24,9 @@ import { CodeExecutionResult } from './code_execution_utils.js';
|
|
|
8
24
|
* other models.
|
|
9
25
|
*/
|
|
10
26
|
export declare class BuiltInCodeExecutor extends BaseCodeExecutor {
|
|
27
|
+
/** A unique symbol to identify BuiltInCodeExecutor class. */
|
|
28
|
+
readonly [BUILT_IN_CODE_EXECUTOR_SIGNATURE_SYMBOL] = true;
|
|
11
29
|
executeCode(params: ExecuteCodeParams): Promise<CodeExecutionResult>;
|
|
12
30
|
processLlmRequest(llmRequest: LlmRequest): void;
|
|
13
31
|
}
|
|
32
|
+
export {};
|
package/dist/types/common.d.ts
CHANGED
|
@@ -3,27 +3,45 @@
|
|
|
3
3
|
* Copyright 2025 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
+
export { ActiveStreamingTool } from './agents/active_streaming_tool.js';
|
|
7
|
+
export type { ActiveStreamingToolParams } from './agents/active_streaming_tool.js';
|
|
6
8
|
export { BaseAgent, isBaseAgent } from './agents/base_agent.js';
|
|
9
|
+
export type { AfterAgentCallback, BaseAgentConfig, BeforeAgentCallback, SingleAgentCallback, } from './agents/base_agent.js';
|
|
10
|
+
export { BaseLlmRequestProcessor, BaseLlmResponseProcessor, } from './agents/base_llm_processor.js';
|
|
7
11
|
export { CallbackContext } from './agents/callback_context.js';
|
|
8
12
|
export { functionsExportedForTestingOnly } from './agents/functions.js';
|
|
9
13
|
export { InvocationContext } from './agents/invocation_context.js';
|
|
14
|
+
export type { InvocationContextParams } from './agents/invocation_context.js';
|
|
10
15
|
export { LiveRequestQueue } from './agents/live_request_queue.js';
|
|
11
16
|
export type { LiveRequest } from './agents/live_request_queue.js';
|
|
12
|
-
export { LlmAgent } from './agents/llm_agent.js';
|
|
13
|
-
export type { AfterModelCallback, AfterToolCallback, BeforeModelCallback, BeforeToolCallback, SingleAfterModelCallback, SingleAfterToolCallback, SingleBeforeModelCallback, SingleBeforeToolCallback } from './agents/llm_agent.js';
|
|
14
|
-
export { LoopAgent } from './agents/loop_agent.js';
|
|
15
|
-
export {
|
|
16
|
-
export
|
|
17
|
+
export { LlmAgent, isLlmAgent } from './agents/llm_agent.js';
|
|
18
|
+
export type { AfterModelCallback, AfterToolCallback, BeforeModelCallback, BeforeToolCallback, InstructionProvider, LlmAgentConfig, SingleAfterModelCallback, SingleAfterToolCallback, SingleBeforeModelCallback, SingleBeforeToolCallback, ToolUnion, } from './agents/llm_agent.js';
|
|
19
|
+
export { LoopAgent, isLoopAgent } from './agents/loop_agent.js';
|
|
20
|
+
export type { LoopAgentConfig } from './agents/loop_agent.js';
|
|
21
|
+
export { ParallelAgent, isParallelAgent } from './agents/parallel_agent.js';
|
|
22
|
+
export { ReadonlyContext } from './agents/readonly_context.js';
|
|
17
23
|
export { StreamingMode } from './agents/run_config.js';
|
|
18
|
-
export {
|
|
24
|
+
export type { RunConfig } from './agents/run_config.js';
|
|
25
|
+
export { SequentialAgent, isSequentialAgent } from './agents/sequential_agent.js';
|
|
26
|
+
export type { TranscriptionEntry } from './agents/transcription_entry.js';
|
|
19
27
|
export { InMemoryArtifactService } from './artifacts/in_memory_artifact_service.js';
|
|
28
|
+
export { AuthCredentialTypes } from './auth/auth_credential.js';
|
|
29
|
+
export type { AuthCredential, HttpAuth, HttpCredentials, OAuth2Auth, ServiceAccount, ServiceAccountCredential, } from './auth/auth_credential.js';
|
|
30
|
+
export type { AuthScheme, OpenIdConnectWithConfig } from './auth/auth_schemes.js';
|
|
31
|
+
export type { AuthConfig } from './auth/auth_tool.js';
|
|
20
32
|
export type { BaseCredentialService } from './auth/credential_service/base_credential_service.js';
|
|
33
|
+
export { BaseCodeExecutor } from './code_executors/base_code_executor.js';
|
|
34
|
+
export type { ExecuteCodeParams } from './code_executors/base_code_executor.js';
|
|
21
35
|
export { BuiltInCodeExecutor } from './code_executors/built_in_code_executor.js';
|
|
22
|
-
export {
|
|
36
|
+
export type { CodeExecutionInput, CodeExecutionResult, File, } from './code_executors/code_execution_utils.js';
|
|
37
|
+
export { createEvent, getFunctionCalls, getFunctionResponses, hasTrailingCodeExecutionResult, isFinalResponse, stringifyContent, } from './events/event.js';
|
|
23
38
|
export type { Event } from './events/event.js';
|
|
24
|
-
export type { EventActions } from './events/event_actions.js';
|
|
25
39
|
export { createEventActions } from './events/event_actions.js';
|
|
40
|
+
export type { EventActions } from './events/event_actions.js';
|
|
41
|
+
export { BaseExampleProvider, isBaseExampleProvider, } from './examples/base_example_provider.js';
|
|
42
|
+
export type { Example } from './examples/example.js';
|
|
26
43
|
export { InMemoryMemoryService } from './memory/in_memory_memory_service.js';
|
|
44
|
+
export type { MemoryEntry } from './memory/memory_entry.js';
|
|
27
45
|
export { BaseLlm, isBaseLlm } from './models/base_llm.js';
|
|
28
46
|
export type { BaseLlmConnection } from './models/base_llm_connection.js';
|
|
29
47
|
export { Gemini } from './models/google_llm.js';
|
|
@@ -31,28 +49,34 @@ export type { GeminiParams } from './models/google_llm.js';
|
|
|
31
49
|
export type { LlmRequest } from './models/llm_request.js';
|
|
32
50
|
export type { LlmResponse } from './models/llm_response.js';
|
|
33
51
|
export { LLMRegistry } from './models/registry.js';
|
|
52
|
+
export type { BaseLlmType } from './models/registry.js';
|
|
34
53
|
export { BasePlugin } from './plugins/base_plugin.js';
|
|
35
54
|
export { LoggingPlugin } from './plugins/logging_plugin.js';
|
|
36
55
|
export { PluginManager } from './plugins/plugin_manager.js';
|
|
37
|
-
export {
|
|
38
|
-
export type { BasePolicyEngine, PolicyCheckResult, ToolCallPolicyContext } from './plugins/security_plugin.js';
|
|
56
|
+
export { InMemoryPolicyEngine, PolicyOutcome, REQUEST_CONFIRMATION_FUNCTION_CALL_NAME, SecurityPlugin, getAskUserConfirmationFunctionCalls, } from './plugins/security_plugin.js';
|
|
57
|
+
export type { BasePolicyEngine, PolicyCheckResult, ToolCallPolicyContext, } from './plugins/security_plugin.js';
|
|
39
58
|
export { InMemoryRunner } from './runner/in_memory_runner.js';
|
|
40
59
|
export { Runner } from './runner/runner.js';
|
|
60
|
+
export type { RunnerConfig } from './runner/runner.js';
|
|
41
61
|
export { InMemorySessionService } from './sessions/in_memory_session_service.js';
|
|
42
62
|
export { createSession } from './sessions/session.js';
|
|
43
63
|
export type { Session } from './sessions/session.js';
|
|
44
64
|
export { State } from './sessions/state.js';
|
|
45
|
-
export { AgentTool } from './tools/agent_tool.js';
|
|
46
|
-
export {
|
|
65
|
+
export { AgentTool, isAgentTool } from './tools/agent_tool.js';
|
|
66
|
+
export type { AgentToolConfig } from './tools/agent_tool.js';
|
|
67
|
+
export { BaseTool, isBaseTool } from './tools/base_tool.js';
|
|
47
68
|
export { BaseToolset } from './tools/base_toolset.js';
|
|
48
|
-
export {
|
|
49
|
-
export {
|
|
69
|
+
export type { ToolPredicate } from './tools/base_toolset.js';
|
|
70
|
+
export { FunctionTool, isFunctionTool } from './tools/function_tool.js';
|
|
71
|
+
export type { ToolExecuteArgument, ToolExecuteFunction, ToolInputParameters, ToolOptions, } from './tools/function_tool.js';
|
|
72
|
+
export { GOOGLE_SEARCH, GoogleSearchTool } from './tools/google_search_tool.js';
|
|
50
73
|
export { LongRunningFunctionTool } from './tools/long_running_tool.js';
|
|
51
74
|
export { ToolConfirmation } from './tools/tool_confirmation.js';
|
|
52
75
|
export { ToolContext } from './tools/tool_context.js';
|
|
53
76
|
export { LogLevel, setLogLevel } from './utils/logger.js';
|
|
54
77
|
export { isGemini2OrAbove } from './utils/model_name.js';
|
|
55
78
|
export { zodObjectToSchema } from './utils/simple_zod_to_json.js';
|
|
79
|
+
export { GoogleLLMVariant } from './utils/variant_utils.js';
|
|
56
80
|
export { version } from './version.js';
|
|
57
81
|
export * from './artifacts/base_artifact_service.js';
|
|
58
82
|
export * from './memory/base_memory_service.js';
|
|
@@ -4,12 +4,27 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { Example } from './example.js';
|
|
7
|
+
/**
|
|
8
|
+
* A unique symbol to identify ADK agent classes.
|
|
9
|
+
* Defined once and shared by all BaseExampleProvider instances.
|
|
10
|
+
*/
|
|
11
|
+
declare const BASE_EXAMPLE_PROVIDER_SIGNATURE_SYMBOL: unique symbol;
|
|
12
|
+
/**
|
|
13
|
+
* Type guard to check if an object is an instance of BaseExampleProvider.
|
|
14
|
+
* @param obj The object to check.
|
|
15
|
+
* @returns True if the object is an instance of BaseExampleProvider, false otherwise.
|
|
16
|
+
*/
|
|
17
|
+
export declare function isBaseExampleProvider(obj: unknown): obj is BaseExampleProvider;
|
|
7
18
|
/**
|
|
8
19
|
* Base class for example providers.
|
|
9
20
|
*
|
|
10
21
|
* This class defines the interface for providing examples for a given query.
|
|
11
22
|
*/
|
|
12
23
|
export declare abstract class BaseExampleProvider {
|
|
24
|
+
/**
|
|
25
|
+
* A unique symbol to identify ADK example provider classes.
|
|
26
|
+
*/
|
|
27
|
+
readonly [BASE_EXAMPLE_PROVIDER_SIGNATURE_SYMBOL] = true;
|
|
13
28
|
/**
|
|
14
29
|
* Returns a list of examples for a given query.
|
|
15
30
|
*
|
|
@@ -18,3 +33,4 @@ export declare abstract class BaseExampleProvider {
|
|
|
18
33
|
*/
|
|
19
34
|
abstract getExamples(query: string): Example[];
|
|
20
35
|
}
|
|
36
|
+
export {};
|