UNPKG

donobu

Version:

Create browser automations with an LLM agent and replay them as Playwright scripts.

43 lines 1.97 kB
import { GptClient, ToolOption } from './GptClient'; import { JSONSchema7 } from 'json-schema'; import { GptMessage, AssistantMessage, StructuredOutputMessage, ProposedToolCallsMessage } from '../models/GptMessage'; import { OpenApiConfig } from '../models/GptConfig'; /** * A GPT client implemented using the OpenAI API. * @see https://platform.openai.com/docs/api-reference/chat */ export declare class OpenAiGptClient extends GptClient { private readonly openAiConfig; private static readonly API_URL; private static readonly REQUEST_TIMEOUT_MILLISECONDS; private readonly headers; /** * Create a new instance. * @param apiKey The OpenAI API key to use for all requests with this client. * @param modelName See https://platform.openai.com/docs/models for the list of models. * @param apiUrl The URL of the API to use for all requests with this client. */ constructor(openAiConfig: OpenApiConfig); ping(): Promise<void>; getMessage(messages: GptMessage[]): Promise<AssistantMessage>; getStructuredOutput(messages: GptMessage[], jsonSchema: JSONSchema7): Promise<StructuredOutputMessage>; getToolCalls(messages: GptMessage[], tools: ToolOption[]): Promise<ProposedToolCallsMessage>; private chatRequestMessageFromGptMessage; private toolChoiceFromTool; private parseAssistantMessage; private parseStructuredOutputMessage; private parseProposedToolCallsMessage; private mapErrorResponseToDonobuException; /** * Makes an HTTP request to the OpenAI API with standard configuration. */ private makeRequest; /** * Creates a new JSON schema compatible with OpenAI's API by: * - Adding additionalProperties: false to all objects. * - Making all properties required (but nullable if necessary). * - Removing unsupported keywords. */ private static createOpenAiCompatibleJsonSchema; } //# sourceMappingURL=OpenAiGptClient.d.ts.map