You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the section in Chapter 6 entitled "Dealing with Many Tools", we don't add any new tools, and don't limit the retriever, so the point of the section is a bit lost.
But if we simply modify the retriever definition to: tools_retriever = InMemoryVectorStore.from_documents([Document(tool.description, metadata={"name":tool.name}) for tool in ourTools], embeddingsModel).as_retriever(search_kwargs={"k": 1, "fetch_k": 2})
We'll force the agent to choose the best single tool to answer the prompt.
We can then cycle through three prompts:
"When was Calvin Coolidge born?" (only search will be selected)
"2+2=" (only calculator will be selected)
"How old was the 30th president of the US when he died?" (search will be selected)