Cloudflare

Embedded function calling in Workers AI: easier, smarter, faster

Jun 27, 2024Harley Turan, Dhravya Shah, Michelle Chen
Embedded function calling in Workers AI: easier, smarter, faster
SummaryAI, from the source post

Introduces embedded function calling in Workers AI, where LLM inference and function execution occur in the same runtime, eliminating network round-trips. This is facilitated by the new `ai-utils` npm package, which includes the `runWithTools` method for executing functions and handling complex agentic chains, and `createToolsFromOpenAPISpec` for dynamically generating tools from OpenAPI specifications. The `autoTrimTools` helper function is also introduced to optimize token usage by intelligently selecting relevant tools.

More from the Artificial Intelligence Integration & Impact trail