Is This the End of LangChain?
Last week, OpenAI released a slew of updates. Of these, function calling in the Chat Completions API was the most important. The feature uses external APIs and tools with OpenAI’s API. This, surprisingly, has a striking resemblance with LangChain, which also performs similar action, bringing us to question its relevance when building autonomous agents. Machine learning expert Santiago said that using function calling, we can define custom functions the model can use to answer questions. “For example, we can now have GPT solve queries requiring real-time data like stock prices, weather information, or match results,” he added. He said that previously this new ‘calling function’ feature was only possible using LangChain, but now it is natively available as part of the API. In other words, with this new update, users now have the choice to bypass the third party (i.e. LangChain) and directly built using OpenAI’s API – which is available for its GPT-3.5-Turbo and GPT-4 models. Relevance of LangChain LLM expert Derek Haynes said, “Pretty stoked with OpenAI’s function calling. My previously massive ReAct-based agent prompt has been reduced to this. It’s a fine-tuned GPT for agents … and makes me wonder if LangChain is worth the complexity?” In his blog post, Haynes explained the need for LangChain and the role of ‘calling function’ update introduced by OpenAI. He said that ReAct presents an approach where LLMs like GPT-3.5-Turbo and GPT-4 can use external tools to perform tasks, observe the outcomes, and use those outcomes to inform the next actions. For example, a model can use Zapier to search unopened emails and OpenAI’s models to summarise them. However, using this approach requires users to do considerable work, including listing available tools in a format that the LLM understands, applying custom code to parse the response and extract useful data, and guiding the LLM to perform tasks accurately. Haynes believes that this process can result in complex, brittle string parsing code. He said, that is where LangChain comes into the picture, bringing structure to this process, but this in turn can make the code less readable. A user, who goes by the name ‘fbrncci’ on HackerNews, said that the deeper and more complex the application becomes, the more of a risk LangChain seems to become to keeping it maintainable. Enters function calling On their website, OpenAI provided examples and applications of the update. (as seen below) “Function calling within your own applications is one of the interesting waves that we’re seeing with language models, which is increasing their capabilities outside of just normal text generation,” said AI expert Greg Kamradt, in an explainer video – Function Calling via ChatGPT API – First Look With LangChain. He said a lot of systems need to make decisions as well and when you use a language model as a reasoning engine, freeform text isn’t the best way to talk to other computers. It’s better if you can do it in a JSON format and that’s what function calling is a step towards. Here’s a quick glimpse on how function calling works: On a sprint mode Within an hour of OpenAI’s new update, LangChain responded with support. While users are free to choose between the two, it would be easier to use with its variety of features and plugins. And they aren’t the only one offering these services, with Hugging Face keeping up as well. But, one question remains: did OpenAI steal LangChain‘s limelight. “Yes, OpenAI took this from LangChain,” said Santiago. He, however, said that this will not kill LangChain. “There’s much more functionality there,” he added, questioning OpenAI’s plans of syphoning off from them and integrating it natively on its API.
With OpenAI’s new function calling API update, users have the choice to bypass Langchain and directly built using OpenAI’s API
With OpenAI's new function calling API update, users have the choice to bypass LangChain and directly built using OpenAI's API
[]
["Go", "ChatGPT", "Hugging Face", "machine learning", "API", "OpenAI", "AI", "autonomous agents", "LangChain", "R"]
["AI", "machine learning", "ChatGPT", "OpenAI", "LangChain", "Hugging Face", "autonomous agents", "R", "Go", "API"]
K L Krithika is a tech journalist at AIM. Apart from writing tech news, she enjoys reading sci-fi and pondering the impossible technologies, trying not to confuse it with reality.