Dishing Up AI Excellence
How Function Calling Bridges the Culinary Artistry and Fast-Food Precision in Automation
AUTOMATIONAIOPENAIPROGRAMMINGLLMS
Today, whispering a quick command to Amazon's Alexa, Apple's Siri, or Google's Home can lead to instantaneous responses to simple requests — you can set alarms, play specific music, order pizza, control your home lighting, or even make a donation to your favorite charity. Within these tasks, these basic AI assistants lack the eye-popping, high-level machine "intelligence" of Large Language Models (LLMs) like OpenAI's GPT series, yet they magically manifest your wishes.
And yet why have state-of-the-art LLMs, despite their vastly superior ability to understand and communicate with humans, continued to struggle to replicate this ability to take simple actions?
Enter function calling - a fundamental concept in programming that allows tasks to be performed efficiently and elegantly without needing to rewrite the same code time and again. Let's think of functions more like the line cooks of programming. A cook can meticulously prepare a specific meal when provided with the right ingredients and recipe. Similarly, functions are blocks of prewritten code that execute specific tasks when they are 'called' or activated. The inputs, or 'arguments', are fed into a function much like ingredients are provided to the cook. The output, like the cook's masterfully prepared dish, is the successfully completed task. So, when you ask Siri to play your favorite playlist, you're essentially using your voice to call a function that's been coded to interact with your music app. Despite Siri's inability to write a sonnet like GPT-4, these function calls enable her to affect concrete actions in the real world — a realm of application where highly-evolved language learning models are still mastering their skills.
Think of LLMs like GPT-4 as akin to a skilled private chef, creatively and intuitively responding to a client's specific palette of needs and preferences. They effortlessly observe, interpret, and deliver, taking into account the comprehensive picture — much like a chef creating a unique dish that is carefully adjusted based on the available ingredients and the tastes of the guest.
Now, consider the realm of function calling as similar to operating in a fast-food kitchen like McDonald's. Here, the operation hinges on precision, consistency, and direct responses to specific orders. It's less about the art of cooking and more about executing precise functions effectively. When a customer requests a Big Mac, there's a set procedure to be followed, with no nuance or improvisation involved. The process is akin to calling a predefined function in a program — it's expected to perform the same sequence of operations every time and produce the exact output as planned.
For an LLM like GPT-4, stepping into function calling is like asking the gourmet chef to switch their toque blanche for a fast-food cap. Both involve 'serving a dish', but the approach, the nuances, the flexibility, and the expected outcome are worlds apart. It requires not just a broadening of skills, but also an understanding of how to alternate between these two roles when necessary, which is currently one of the frontiers of AI development.
In what could be likened to our gourmet chef skillfully balancing the toque blanche and fast-food cap, a recent leap forward in the realm of artificial intelligence brings a fascinating development to the fore: the Function Calling feature in OpenAI's Assistants API.
The ingenious blend of the artful creativity analogous to both the gourmet private chef and the rigorous precision of the fast-food cook is embodied in this feature. With OpenAI's latest models — gpt-3.5-turbo-1106 and gpt-4-1106-preview — the API can now describe functions and have the model judiciously generate a JSON object containing arguments to call one or more functions.
It's like having a conversation with our gourmet chef about what you'd like for dinner, and the chef, turning into a fast-food operator, presents you with a step-by-step breakdown of the exact ingredients and method to prepare the dish, which you could easily then hand over to a novice cook. The model intelligently chooses to output structured data that could be used to perform various tasks without the API itself calling the function.
The applications are diverse: creating AI assistants that answer questions by calling external APIs, akin to ChatGPT Plugins, or converting natural language into API calls, such as turning "Who are my top customers?" into a call to get_customers(min_revenue: int, created_before: string, limit: int). It could also extract structured data from text and do much more. This versatility gives businesses the ability to transform interactions from natural language into actionable, structured, and procedurally-governed function calls.
However, with great power comes great responsibility. While the model can now generate a JSON to call functions, it's crucial to ensure safeguard measures are in place, especially for functions that have real-world consequences, such as sending an email or completing a purchase. OpenAI recommends building user confirmation flows before taking such impactful actions.
(There is also a similar development for open-source models like LLAMA, called Functionary.)
This development highlights the impressive strides AI is taking towards achieving a delicate yet powerful balance, where advanced language model intelligence dovetails with precise function execution. It signifies a harmonious marriage of the artful chef and the efficient fast food cook, promising a future of AI assistants that can fluidly navigate both complexities of linguistics and precision of procedures.
Bridging the divide between intuitive language processing and precise functional execution might seem overwhelming, but this is where MythoTech steps up to the plate. No stranger to the convergence of complex technologies, we understand the intricacies of both the gourmet chef's creative realm and the fast-food cook's procedural world. Herding these expressions and applications of AI together, we create robust and smart solutions for your business needs, employing the immense potential of function calling with LLMs.
At MythoTech, we recognize the wave of transformation that brand new features combining the powers of AI and Automation will bring. We're poised on the front lines of this exciting innovation, ready to help you harness its powerful implications. Our knowledgeable team can guide your business to utilize this cutting-edge technology effectively, ensuring that the delicate balance between AI's linguistic dexterity and automation's procedural efficiency is perfectly maintained.
We don't just provide a navigation chart to the uncharted lands of advanced automation. We're your crew, setting sail alongside you, braving the winds of innovation. With MythoTech, your business can ride the wave of the Fourth Industrial Revolution, seize the potential of evolving AI capabilities, and equip itself with the tools and skills of both the creative chef and the efficient cook.

