docs: Update OpenAI functions agent (#15894)

Add info and a tip explaining when to use this agent.
pull/16049/head
Eugene Yurtsev 9 months ago committed by GitHub
parent beec7259c8
commit 7c57cfd8f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -19,9 +19,27 @@
"\n",
"Certain OpenAI models (like gpt-3.5-turbo-0613 and gpt-4-0613) have been fine-tuned to detect when a function should be called and respond with the inputs that should be passed to the function. In an API call, you can describe functions and have the model intelligently choose to output a JSON object containing arguments to call those functions. The goal of the OpenAI Function APIs is to more reliably return valid and useful function calls than a generic text completion or chat API.\n",
"\n",
"A number of open source models have adopted the same format for function calls and have also fine-tuned the model to detect when a function should be called.\n",
"\n",
"The OpenAI Functions Agent is designed to work with these models.\n",
"\n",
"Install `openai`, `tavily-python` packages which are required as the LangChain packages call them internally."
"Install `openai`, `tavily-python` packages which are required as the LangChain packages call them internally.\n",
"\n",
"\n",
":::info\n",
"\n",
"OpenAI API has deprecated `functions` in favor of `tools`. The difference between the two is that the `tools` API allows the model to request that multiple functions be invoked at once, which can reduce response times in some architectures. It's recommended to use the tools agent for OpenAI models.\n",
"\n",
"See the following links for more information:\n",
"\n",
"[OpenAI chat create](https://platform.openai.com/docs/api-reference/chat/create)\n",
"\n",
"[OpenAI function calling](https://platform.openai.com/docs/guides/function-calling)\n",
":::\n",
"\n",
":::tip\n",
"The `functions` format remains relevant for open source models and providers that have adopted it, and this agent is expected to work for such models.\n",
":::\n"
]
},
{
@ -260,7 +278,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.1"
"version": "3.11.4"
}
},
"nbformat": 4,

Loading…
Cancel
Save