donobu
Version:
Create browser automations with an LLM agent and replay them as Playwright scripts.
37 lines • 1.58 kB
TypeScript
import { GptMessage, AssistantMessage, ProposedToolCallsMessage, StructuredOutputMessage } from '../models/GptMessage';
import { JSONSchema7 } from 'json-schema';
import { GptConfig } from '../models/GptConfig';
/** A lightweight type representing a valid tool choice for the `getToolCalls` method. */
export type ToolOption = {
name: string;
description: string;
inputSchema: JSONSchema7;
};
/** 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(): Promise<void>;
/**
* Simple prompt and response, does not support tool calling, etc.
*/
abstract getMessage(messages: GptMessage[]): Promise<AssistantMessage>;
/**
* Have the GPT return a structured output from the given message history. The latest message must
* come last.
*/
abstract getStructuredOutput(messages: GptMessage[], jsonSchema: JSONSchema7): Promise<StructuredOutputMessage>;
/**
* 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[]): Promise<ProposedToolCallsMessage>;
}
//# sourceMappingURL=GptClient.d.ts.map