Correct way to build agents?

Hello! Got a little confused after finishing this course.
Harrison discussed creating agents with the help of OpenAI functions. Is it more recent and stable way to create agents, does it have any advantages?
Because, earlier when I learned about agents in langchain they were build using very long prompts with tool description and different initialisation via agent type: ZERO SHOT REACT and others.
Did I understand correctly that it is better to build them using OpenAI functions? Or both methods have different use cases?

3 Likes

Iā€™d also like to understand if using OpenAI function call agent is better than ReAct, as ReAct has ā€œobservation:ā€ outputted by the LLM allowing it space to think (i.e. COT).
OpenAI Function Agent is likely better at returning stuctured outputs as its a finetuned model, but it doesnā€™t have anywhere to output itā€™s thoughts. I worry it may be worse at reasoning which function to call and reasoning the arguments to pass to the function. The function arguments could perhaps be mitigated by returning a reasoning/COT property as the first input to the function, but itā€™s less clear how to get reasoning on what tool to select before it outputs the function to call.

Just wanted to ask the same. Is there a way to output the thought process?
In this course it looks like this:

> Entering new AgentExecutor chain...
Hello Bob! How can I assist you today?

> Finished chain.

In a previous short course on langchain it looked like:

> Entering new AgentExecutor chain...
I need to import the necessary libraries for generating data and plotting. Then, I need to create a function that generates linearly separable data and plots it. Finally, I need to plot the data again with colors for the groups.
Action: [Python_REPL]
Action Input:
import numpy as np
import matplotlib.pyplot as plt
...

Welcome artificial_feelings,

Youā€™ve posed an insightful question. Both the OpenAI function calling and the Langchain-native agent aim to achieve the same goal: facilitating iterations of reasoning and actions.

Before the introduction of OpenAIā€™s function calling feature, Langchain-native agents were the primary method to realize this mechanism. However, with OpenAIā€™s release of a fine-tuned model specifically optimized for the ā€˜reasoning and actionsā€™ approach, many believe that the OpenAI function calling offers certain advantages when creating agents.

Based on my own experiments, agents built with OpenAI function calls tend to deliver results slightly faster. As for the quality of the outputs, they are largely comparable between the two methods.