The rate of innovation in AI has been tremendous over a short period. Specifically, two innovations have opened up a plethora of possibilities for building apps centred around large language models (LLMs): Function calling and agents.
In this article, I demonstrate how you can utilise function calling and agents to perform searches on flight databases, enabling you to find cheap flights, short flights, long flights, or anything that suits your preference.
Please note — At the very least, you will require the following to make this work for yourself:
Now, let’s delve into the technical details.
Langchain has been at the forefront of the LLM-powered agent. It’s a simple, yet potent concept.
Essentially, you can equip an Agent with the “reasoning” capability of an LLM, in our case, this will be GPT-4.
You can grant agents access to a variety of tools. These can include a search engine, pandas, SQL, Wolfram Alpha, etc. The list is expanding every month with developers adding more tools.
The agent, powered by a large language model, employs analytical reasoning to determine how to leverage the tool to complete a task you assign.
A development by OpenAI, function calling allows you to parse arguments for a function from a natural language input.
This has significant implications for how users can interact with our app using natural language or even speech.
Function calls will become clearer later with the coded examples provided.
We can develop an app to query flights with natural language using just four components, excluding the front end.