openai-function-calling-tools  by JohannLai

JS/TS tools for OpenAI function calling

created 2 years ago
298 stars

Top 90.1% on sourcepulse

GitHubView on GitHub
Project Summary

This library provides JavaScript/TypeScript tools to simplify the integration of OpenAI's function calling capabilities into applications. It offers pre-built tools for common tasks like map display, geocoding, web searching, file system access, and code execution, enabling developers to build more interactive and capable AI agents.

How It Works

The library leverages OpenAI's function calling API by providing a set of utility functions that generate the necessary JSON schemas for various tools. These schemas are then passed to the OpenAI API during chat completion requests. When the model decides to use a tool, it returns a function call with arguments. The library includes wrappers to execute these functions and feed the results back into the conversation, facilitating a seamless tool-use workflow.

Quick Start & Requirements

  • Install via npm: npm install openai-function-calling-tools
  • Requires Node.js v16 or higher.
  • Supports Cloudflare Workers, Vercel/Next.js (Backend, Serverless, Edge), Supabase Edge Functions.
  • Browser support is available but marked as experimental.
  • Google Custom Search requires API keys and a Custom Search Engine ID.

Highlighted Details

  • Includes tools for map display (ShowPoisOnMap), reverse geocoding (ReverseGeocode), time (Clock), basic arithmetic (Calculator), Google/Bing/Serper web search, image search, file system access (fs), web browsing (webbrowser), SQL execution, and JavaScript interpretation.
  • Demonstrates schema extraction for building tree structures.
  • Designed for production use.

Maintenance & Community

  • Project inspired by LangChainAI.
  • No specific contributor or community links (Discord/Slack) are provided in the README.

Licensing & Compatibility

  • The README does not explicitly state a license.

Limitations & Caveats

  • Browser support is experimental.
  • The SQL tool requires a "detailed and correct SQL query" as input.
  • No explicit mention of error handling strategies for tool execution failures.
Health Check
Last commit

1 year ago

Responsiveness

1 day

Pull Requests (30d)
0
Issues (30d)
0
Star History
6 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.