adk-typescript
Version:
TypeScript port of Google's Agent Development Kit (ADK)
109 lines (108 loc) • 2.82 kB
TypeScript
import { Event, SessionInterface as Session, SessionsList } from './types';
import { BaseSessionService, ListEventsResponse } from './BaseSessionService';
interface VertexAiClient {
request(options: {
httpMethod: string;
path: string;
requestDict: Record<string, any>;
}): Promise<any>;
}
interface GenAiClient {
_apiClient: VertexAiClient;
}
/**
* Connects to the managed Vertex AI Session Service
*/
export declare class VertexAiSessionService extends BaseSessionService {
private project;
private location;
private apiClient;
/**
* Creates a new VertexAiSessionService
*
* @param project - The Google Cloud project ID
* @param location - The Google Cloud location/region
* @param client - Optional GenAi client to use for API calls
*/
constructor(options: {
project?: string;
location?: string;
client?: GenAiClient;
});
/**
* Creates a new session in Vertex AI
*/
createSession(options: {
appName: string;
userId: string;
sessionId?: string;
state?: Record<string, any>;
}): Promise<Session>;
/**
* Gets a session by its ID
*/
getSession(options: {
appName: string;
userId: string;
sessionId: string;
}): Promise<Session | null>;
/**
* Lists all sessions for a user in an app
*/
listSessions(options: {
appName: string;
userId: string;
}): Promise<SessionsList>;
/**
* Deletes a session
*/
deleteSession(options: {
appName: string;
userId: string;
sessionId: string;
}): Promise<void>;
/**
* Lists events in a session
*/
listEvents(options: {
appName: string;
userId: string;
sessionId: string;
}): Promise<ListEventsResponse>;
/**
* Appends an event to a session
*/
appendEvent(options: {
session: Session;
event: Event;
}): Promise<void>;
/**
* Updates a session's state.
*/
updateSessionState(appName: string, userId: string, sessionId: string, stateDelta: Record<string, any>): Promise<Session>;
/**
* Parses a reasoning engine ID from an app name
*/
private parseReasoningEngineId;
/**
* Converts an Event object to a JSON object for the API
*/
private convertEventToJson;
/**
* Converts a Content object to a JSON object for the API
*/
private convertContentToJson;
/**
* Converts a Part object to a JSON object for the API
*/
private convertPartToJson;
/**
* Converts an API event to an Event object
*/
private fromApiEvent;
/**
* Parses content from the API
*/
private parseContent;
}
export {};