UNPKG

@paybyrd/ai-agent-openai

Version:

OpenAI integration for AI agent toolkit

22 lines (21 loc) 1.03 kB
import { type Configuration } from '@paybyrd/ai-agent-toolkit'; import type { ChatCompletionTool, ChatCompletionMessageToolCall, ChatCompletionToolMessageParam } from 'openai/resources'; declare class OpenAIAgentToolkit { private _paybyrd; tools: ChatCompletionTool[]; constructor({ authToken, configuration, }: { authToken: string; configuration: Configuration; }); getTools(): ChatCompletionTool[]; /** * Processes a single OpenAI tool call by executing the requested function. * * @param {ChatCompletionMessageToolCall} toolCall - The tool call object from OpenAI containing * function name, arguments, and ID. * @returns {Promise<ChatCompletionToolMessageParam>} A promise that resolves to a tool message * object containing the result of the tool execution with the proper format for the OpenAI API. */ handleToolCall(toolCall: ChatCompletionMessageToolCall): Promise<ChatCompletionToolMessageParam>; } export default OpenAIAgentToolkit;