FunctionsAgents
Api2Ai
ai-research-agent / agents/api2ai
Generate
convertOpenAPIToLangChainTools()
function convertOpenAPIToLangChainTools(fileContents: string): string;Defined in: src/agents/api2ai.js:22
API2AI
Translates any website's OpenAPI.yml file to LLM agent tool format with Zod schemas for validation, and returns the content of a tools.js file that exports these tools
List of public apis public apis
Parameters
| Parameter | Type | Description |
|---|---|---|
|
| OpenAPI YAML file contents |
Returns
string
Content of tools.js file with exported tools
Example
const fileContents = fs.readFileSync(yamlPath, 'utf8');
const toolsFileContent = convertOpenAPIToAgentTools(fileContents);
fs.writeFileSync('tools.js', toolsFileContent);