Function Calling: The Most Significant AI Feature Since ChatGPT Itself?
Tags: ai, chatgpt, development, openai
Published: 2023-09-07 10:52:12

A few months ago, [Umain](https://www.umain.com/), the company I work for, organized a hackathon. The goal? To create tech products that harness the power of AI.

![umain tech accelerator hackathon](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z6pp1487i3f2alzrwfyw.png)

Although the hackathon yielded some promising results, it also revealed a fundamental obstacle stifling further breakthroughs in AI application development: the wide gap between unstructured and structured data.

To better cement the concepts of unstructured and structured data into memory, I will from now on refer to this as **Vague-Ass** stuff and **Hard-Ass** stuff.

First, I will clarify what I mean by **Vague-Ass** and **Hard-Ass**. Because grasping this dichotomy is crucial for the utility of Function Calling, a brand new feature from OpenAI that addresses all the challenges we faced during the hackathon.

## Vague-Ass Stuff

**Vague-Ass** stuff represents the nebulous, the immeasurable—things that can't be captured in algorithms or databases.

<figure>
  ![informal emotions](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7j6l2160xmzqwcyehf46.jpeg)
  <figcaption>I used a new AI product to expand the image in the middle out to the sides. The result turned out great.</figcaption>
</figure>

Here, you'll find:

- Human consciousness
- Emotions; desires and fears
- Social norms; cultural nuances
- The dreams of clients and stakeholders

In this realm, humans communicate using **natural language** — just everyday conversation.

## Hard-Ass Stuff

Conversely, **Hard-Ass** stuff is the domain governed by rules and structured methodologies.

![formal computers and robots](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cx4dz0pnhhatfp558ntf.jpeg)

This category includes:

- Mathematics & Logic
- Computation
- Machines

The language of choice here is **structured language**—code, logic, and equations.

## Bridging the Vague-Ass / Hard-Ass Gap (VHG)

Bridging the **Vague-Ass** / **Hard-Ass** Gap (VHG for short) has brought some revolutionary improvements for human civilization. It has enabled automation, economic growth, and improved connectivity, making life significantly better.

The point of many professions we have today—such as mathematicians, structural engineers, software developers—is to serve as mediators between these two realms.

In fact, I realized that what we developers actually do all day is transform **Vague-Ass** stuff into **Hard-Ass** stuff and then back into **Vague-Ass** stuff.

Let me show you:

![developer workflow](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5qk2l9c2m9xrtvs4quiq.png)

Information flows from the **Vague-Ass** dimension of unstructured feelings 
→ using some kind of form to collect **Hard-Ass** structured data 
→ doing something with that data 
→ and then handing it back to the **Vague-Ass** dimension where some value has hopefully been created, in terms of good feelings.

This is how developers have always worked. And the question we were trying to explore at the hackathon was how to integrate the new and transformative potential of AI into this workflow.

## The ChatGPT Challenge: A Dead-End at the VHG

So here I was, presenting our new AI code-smell-detector-app. Yet, something was nagging me: the limitations of using ChatGPT for _reliable_ VHG bridging.

![umain hackathon presentation](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3b1schlnbxeht1oc14j2.jpg)

What does that mean? ChatGPT deals in **Vague-Ass** stuff using natural language, and therefore it struggles when it attempts to interface with the strictly **Hard-Ass** stuff that our applications require to function correctly.

> Specifically, here is where we as developers are struggling:
> - Collect **Hard-Ass** structured data with ChatGPT
> - Extract **Hard-Ass** structured data from ChatGPT

Despite my team and colleagues creating some remarkable prototypes, we were often hamstrung by these limitations. No matter how nicely we asked and pleaded with the AI, it just wouldn't do what we needed it to in order to interact with our apps.

Well, maybe 90% or even 99% of the time it would actually do what we wanted. But when writing software, such odds are often not acceptable.

![human and robot struggling to connect](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fofaqccfhxwvi1cv119g.jpeg)

This significantly restricted the potential of every team at the hackathon. And ever since the release of ChatGPT, this has pretty much been the status quo for AI app development.

Until now...

## The Artificial Intelligence Bridge

In June 2023, OpenAI suddenly released Function Calling for ChatGPT. What does it do? Basically, it solves every single issue that I have been writing about up to this point.


![open-ai function calling bridge](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jk0ifeiu9qxobzte7apg.jpg)

That's why I believe it might be the most significant feature since ChatGPT itself was released. Bridging the gap between **Vague-Ass** stuff and **Hard-Ass** stuff means that we will be able to take everything we already excel at as developers, and plug it straight into the promising land of generative AI.

## So How Does It Work?

Contrary to what its name suggests, ChatGPT will never actually call your functions. In fact, for Function Calling to work there doesn't even have to _be_ any real functions!

Essentially, all it does is attempt to generate the parameters to _hypothetical_ or _potential_ functions, which you using a [JSON schema](https://json-schema.org/) describe to ChatGPT.

To break it down, this is what is now possible:

- Convert **Vague-Ass** natural language into **Hard-Ass** parameters. Once you have **Hard-Ass** parameters, you are able to do whatever you want inside your function and return it in whatever way you'd like.
- Summarize the **Hard-Ass** data you've generated inside your function back to the user in **Vague-Ass** natural language
- Extract **Hard-Ass** structured data from **Vague-Ass** ChatGPT computations. By describing exactly what kind of parameters you want (for example, an array of any length with objects), you can reliably return ChatGPT data in your desired format. How? By simply collecting the parameters and returning them.

To explain how Function Calling works using an example, I have made this illustration:

<figure>
![open-ai function calling example](https://i.ibb.co/t4rW5V6/Untitled-2023-08-23-1941-big.jpg)
  <figcaption>Please excuse the pinecone references, it is an internal joke. Pinecones are not actually an integral part of our corporate structure.</figcaption>
</figure>

[Here](https://excalidraw.com/#json=S1eyXovleUtX7Ie-svvYe,UucBIXmU9ChCOx3te_YKKQ) or [here](https://i.ibb.co/t4rW5V6/Untitled-2023-08-23-1941-big.jpg) or is a link to the actual illustration since the image above is too small.

## In Conclusion

The advent of Function Calling has some amazing implications for the future of AI apps. It stands as a powerful tool for developers to better serve as the bridge between **Hard-Ass** stuff and **Vague-Ass** stuff. 

This breakthrough not only addresses existing challenges but also opens new avenues for innovative applications.

---

Dawid Dahl is a full-stack developer at [UMAIN](https://www.umain.com/) | [ARC](https://arc.inc/). In his free time, he enjoys philosophy, analog synthesizers, consciousness, and being with friends and family.