donobu
Version:
Create browser automations with an LLM agent and replay them as Playwright scripts.
46 lines • 1.87 kB
TypeScript
import type { z } from 'zod/v4';
import type { GptConfig } from '../models/GptConfig';
import type { AssistantMessage, GptMessage, ProposedToolCallsMessage, StructuredOutputMessage } from '../models/GptMessage';
/** A lightweight type representing a valid tool choice for the `getToolCalls` method. */
export type ToolOption = {
name: string;
description: string;
inputSchema: z.ZodSchema;
};
/** Generic client interface for talking to GPT providers. */
export declare abstract class GptClient {
readonly config: GptConfig;
constructor(config: GptConfig);
/**
* Attempts to communicate with the GPT using a minimal valid request.
*/
abstract ping(options?: {
signal?: AbortSignal;
}): Promise<void>;
/**
* Simple prompt and response, does not support tool calling, etc.
*/
abstract getMessage(messages: GptMessage[], options?: {
signal?: AbortSignal;
}): Promise<AssistantMessage>;
/**
* Have the GPT return a structured output from the given message history. The latest message must
* come last.
*/
abstract getStructuredOutput<T>(messages: GptMessage[], zodSchema: z.ZodSchema<T>, options?: {
signal?: AbortSignal;
}): Promise<StructuredOutputMessage<T>>;
/**
* Have the GPT propose tool calls from the given message history. The latest message must come
* last.
*
* @param messages An ordered message history.
* @param tools The set of tools the GPT can choose from.
* @returns The proposed tool calls given the message history.
*/
abstract getToolCalls(messages: GptMessage[], tools: ToolOption[], options?: {
signal?: AbortSignal;
}): Promise<ProposedToolCallsMessage>;
}
export declare function parseOrLogAndThrow<T>(obj: any, zodSchema: z.ZodSchema<T>): T;
//# sourceMappingURL=GptClient.d.ts.map