Closed Hsgngr closed 8 months ago
π€
Hello,
The tools are not explicitly mentioned in the prompts when using AgentType.OPENAI_FUNCTIONS
because they are implicitly included in the form of function calls. The agent uses the tools as functions to generate responses.
In your first example, the agent didn't use any tool because it determined that it could answer the question without the need for any tool. In the second example, the agent decided to use the "Search" tool to answer the question about the NVIDIA share price. This is why you see a function call in the verbose output:
"function_call": {
"name": "Search",
"arguments": "{\n \"__arg1\": \"NVIDIA share price\"\n}"
}
This function call is the agent's way of using the "Search" tool. The agent doesn't include the tools in the prompt because it doesn't need to. It already knows what tools are available and decides which one to use based on the input.
As for forcing the use of a tool as a last resort, there isn't a straightforward way to do this with the current implementation of LangChain. The agent decides whether to use a tool based on the input and the capabilities of the tools. If you want to force the use of a tool, you might need to modify the agent's decision-making process.
I hope this answers your questions. If you have any more questions or need further clarification, feel free to ask.
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a π if this is helpful and π if it is irrelevant.
If you want to continue the conversation, start your reply with @dosu-bot.
Hi, @Hsgngr,
I'm helping the LangChain team manage their backlog and am marking this issue as stale. From what I understand, you raised an issue regarding the AgentType.OPENAI_FUNCTIONS not displaying the tools in the prompts as expected, even with langchain.debug set to True. Dosubot provided a detailed explanation, stating that the tools are implicitly included in the form of function calls and the agent decides which tool to use based on the input. Additionally, Dosubot mentioned that there isn't a straightforward way to force the use of a tool as a last resort with the current implementation of LangChain.
Could you please confirm if this issue is still relevant to the latest version of the LangChain repository? If it is, please let the LangChain team know by commenting on the issue. Otherwise, feel free to close the issue yourself or the issue will be automatically closed in 7 days.
Thank you!
System Info
langchain==0.0.287, MACOS
Who can help?
TLDR: Where are the tools in prompts ?
Hi everyone, I am experimenting with the AgentTypes and I found its not showing everything in the prompts.
My langchain.debug =True and I am expecting to see every detail about my prompts. However when I use
agent=AgentType.OPENAI_FUNCTIONS
I dont actually see the full prompt that is given to the OpenAI.Agent Configurations:
Example 1:
Results with debug verbose:
Questions: 1)Where are the tools in this prompt? 2)How can you force to use one of the tools as a last resort?
Btw I know that it has the tools because it sometimes uses.
Example 2:
Result:
How can see my tools in the prompt. This is needed because I would to create my custom Agent so I dont give the default prompts that is used in the each agent type.
Information
Related Components
Reproduction
Expected behavior
I was expecting to see the tools in my prompts as well.