Bare bones LLM integration via Function Calling

Sean Ryan
5 min readApr 14, 2024

Larger LLMs can be integrated into an existing system (for example a Home Automation system) via Function Calling - via a bare bones approach without any extra Python libraries.

[Image generated by an AI — Adobe Firefly]

What is Function Calling: this is an approach for integrating an LLM into an existing system whilst minimizing coupling. Somewhat similar to Command Pattern, the LLM in its response does need to specify the ‘how’ of each generated element, but instead simply specifies the ‘what’ by listing the function calls to make (equivalent to a list of commands).

Example of a Function Calling system setup with functions to control a Home Automation system. The LLM does not control the Home Automation directly, but instead decides what functions should be called to match the user’s prompt. The application takes the LLM response and actually performs the function calls to tell the Home Automation system what changes to make.

The client in its request tells the LLM what functions are available and what parameters they need. So the LLMs responsibility is limited to deciding what functions to call, and in which order.

This approach keeps coupling low and allows the client to decide how to implement the details of the functions, and also to later change, add or remove functions with minimal effort.

The good news is that larger LLMs can already be used via Function Calling without any extra libraries or training.

Prompt engineering

--

--

Sean Ryan

Versatile and creative full stack developer, tackling UI and data challenges to delight the user. Passionate about UX, clean architecture and machine learning.