Doesn't always look up documents in the retrieval system. Sometimes, this isn't needed! If the user is just saying "hi", you shouldn't have to look things up
并不总是在检索系统中查找文件。有时候,这是不需要的!如果用户只是说“嗨”,你不应该去查找东西
Can do multiple retrieval steps. In ConversationalRetrievalQA, one retrieval step is done ahead of time. If that retrieval step returns bad results, then you're out of luck! But with an agent you can try a different search query to see if that yields better results
With this new type of memory, you can maybe avoid retrieval steps! This is because it remembers ai <-> tool interactions, and therefore remembers previous retrieval results. If a follow-up question the user asks can be answered by those, there's no need to do another retrieval step!
有了这种新型的记忆,你也许可以避免检索步骤!这是因为它记住了 ai <-> tool 交互,因此记住了以前的检索结果。如果用户提出的后续问题可以通过这些来回答,则不需要执行另一个检索步骤!
Better support for meta-questions about the conversation - "how many questions have I asked?", etc. Because the old chain dereferences questions to be "standalone" and independent of the conversation history in order to query the vector store effectively, it struggles with this type of question.
With agents, they can occasionally spiral out of control. That's why we've added controls to our AgentExecutor to cap them at a certain max amount of steps. It's also worth noting that this is a VERY focused agent, in that it's only given one tool (and a pretty simple tool at that). In general, the fewer (and simpler) tools an agent is given, the more likely it is to be reliable.
对于agents来说,他们偶尔会失控。这就是为什么我们在AgentExecutor中添加了控件,以将其限制在某个最大步骤数。同样值得注意的是,这是一个非常专注的代理,因为它只提供了一个工具(而且是一个非常简单的工具)。一般来说,给代理的工具越少(和越简单),它就越有可能是可靠的。
By remembering ai <-> tool interactions, that can hog the context window occasionally. That's why we've included a flag to disable that type of memory, and more generally have made memory pretty plug-and-play.
通过记住 ai <-> tool 交互,这可能会偶尔占据上下文窗口。这就是为什么我们包含了一个标志来禁用这种类型的内存,并且更一般地使内存非常即插即用。
ref: https://blog.langchain.dev/conversational-retrieval-agents/
key code: https://github.com/hwchase17/conversational-retrieval-agent/blob/8200b32265a89c598a1748b5ebbf717cf6d50221/streamlit.py#L32-L50
Let's compare this to the ConversationalRetrievalQA chain that most people use. The benefits that a conversational retrieval agent has are:
Note, that there are some downsides/dangers: