@waldzellai/adk-typescript
Version:
TypeScript SDK for Google Agent Development Kit (ADK) - A comprehensive framework for building AI agents
152 lines (151 loc) • 3.77 kB
TypeScript
import { Content } from '../models/base_llm';
import { EventActions } from './event_actions';
export interface FunctionCallPart {
functionCall?: {
id?: string;
name: string;
args: Record<string, unknown>;
};
functionResponse?: {
name: string;
response: Record<string, unknown>;
};
}
export interface CodeExecutionResult {
output?: string;
error?: string;
}
/**
* Represents an event in a conversation between agents and users.
*
* It is used to store the content of the conversation, as well as the actions
* taken by the agents like function calls, etc.
*/
export declare class Event {
private id;
private invocationId;
private author;
private branch;
private timestamp;
private partial;
private content;
private actions;
private longRunningToolIds;
/**
* Creates a new Event instance
*
* @param options Event configuration options
*/
constructor(options: {
id?: string;
invocationId?: string;
author: string;
branch?: string | null;
content?: Content | null;
actions?: EventActions;
timestamp?: number;
partial?: boolean;
longRunningToolIds?: Set<string> | null;
});
/**
* Gets the event ID
*
* @returns The event ID
*/
getId(): string;
/**
* Gets the invocation ID
*
* @returns The invocation ID
*/
getInvocationId(): string;
/**
* Gets the event author
*
* @returns The author of the event
*/
getAuthor(): string;
/**
* Gets the event branch
*
* @returns The branch of the event
*/
getBranch(): string | null;
/**
* Gets the event timestamp
*
* @returns The timestamp of the event
*/
getTimestamp(): number;
/**
* Checks if the event is partial
*
* @returns Whether the event is partial
*/
isPartial(): boolean;
/**
* Gets the event content
*
* @returns The content of the event
*/
getContent(): Content | null;
/**
* Gets the event actions
*
* @returns The actions of the event
*/
getActions(): EventActions;
/**
* Gets the long running tool IDs
*
* @returns The long running tool IDs
*/
getLongRunningToolIds(): Set<string> | null;
/**
* Checks if the event is a final response
*
* @returns Whether the event is a final response
*/
isFinalResponse(): boolean;
/**
* Gets function calls from the event content
*
* @returns The function calls in the event
*/
getFunctionCalls(): FunctionCallPart[];
/**
* Gets function responses from the event content
*
* @returns The function responses in the event
*/
getFunctionResponses(): FunctionCallPart[];
/**
* Checks if the event has a trailing code execution result
*
* @returns Whether the event has a trailing code execution result
*/
hasTrailingCodeExecutionResult(): boolean;
/**
* Creates a copy of this event with modifications
*
* @param modifications The modifications to apply to the event
* @returns A new event with the modifications applied
*/
withModifications(modifications: Partial<{
id: string;
invocationId: string;
author: string;
branch: string | null;
timestamp: number;
partial: boolean;
content: Content | null;
actions: EventActions;
longRunningToolIds: Set<string> | null;
}>): Event;
/**
* Generates a new random ID for an event
*
* @returns A new random ID
*/
static newId(): string;
}