UNPKG

openai-agents

Version:

A TypeScript library extending the OpenAI Node.js SDK for building highly customizable agents and simplifying 'function calling'. Easily create and manage tools to extend LLM capabilities.

35 lines 1.61 kB
import { AgentTools, ToolChoices } from '../types'; /** * @class ToolsRegistry * @description Singleton class for managing the tools registry. Holds the currently loaded tools. */ export declare class ToolsRegistry { private static instance; static toolsDirPath: string | null; /** * Gets the current instance of the tools registry. */ static getInstance(): AgentTools | null; /** * Sets the instance of the tools registry. */ static setInstance(tools: AgentTools): void; } /** * Loads tool files (both definitions and implementations) from a specified directory. * * @param {string} dirPath - The path to the directory containing tool files. * @returns {Promise<AgentTools>} A promise that resolves to the loaded agent tools. * @throws {DirectoryAccessError | FileReadError | FileImportError | InvalidToolError | ToolNotFoundError} If an error occurs during loading. */ export declare const loadToolsDirFunctions: (dirPath: string) => Promise<AgentTools>; /** * Imports and returns specific tool functions based on their names. * Loads tools from the directory if they haven't been loaded yet. * * @param {string[]} toolNames - An array of tool names to import. * @returns {Promise<ToolChoices>} A promise that resolves to the imported tool functions and choices. * @throws {ValidationError | ToolNotFoundError | InvalidToolError} If the tools directory path is not set or if any requested tools are missing. */ export declare const importToolFunctions: (toolNames: string[]) => Promise<ToolChoices>; //# sourceMappingURL=tools-registry.d.ts.map