Hi, I am developing an agent using the function calling. In my pipeline, the agent have a COT planning ability, which means it will call functions in a sequence that follow the plan generated by GPT-4. The latter one maybe use the output before it.
For example:
# the 1st calling is a text2sql
sql = text2sql(query)
# the 2nd function calling retrieve the data from a database
df = retrieve(sql)
# the 3rd one get the average for the retrieved results
avg = average(df)
Do you have some methods that could ensure the latter callings will have the correct input args? In my scenario, the current function calling only trigger one function without the previous calling.
When you are in complete control by using chat completions, you don’t have to initially offer the AI all the functions. You can add the dependent ones to “tools” only when the first is seen in chat history.
The key to good function use is quality descriptions of the function, which can be multi-line, and very instructive, talking about what the function does and returns, and what the AI must have obtained first in order to use it.
Try my tips!
It will take a bit more programming to have dynamic and dependent function specifications constructed for each API call based on history.