Conversation retriever chain
Last updated
Last updated
The Retrieval Conversation Chain is an important extension based on the conversation chain.
As is known to all, LLM has many limitations when answering questions, such as it can only understand events that occurred before a specific time.
For example, it doesn't understand some private data. So what if you want the model to learn your private data and use the private data to communicate with you?
At this time, you should use Conversational Retrieval QA. In addition to the three elements contained in the conversation chain, it has two other important configurations.
The model is the core of any AI process. The model receives message inputs, uses them as parameters in the prompts, and outputs results. You can use models from several different providers:
OpenAI: Provides models such as gpt-3.5-turbo, gpt-4, etc. By clicking on more operations, you can alter other complex parameters such as temperature, completion length, or flow.
We will continuously integrate models from other providers, so stay tuned.
The prompt is an AI cue, a method of using natural language to guide or inspire AI models to complete specific tasks.
You can take some courses to improve the effectiveness of the prompts.
The model itself does not save internal states, many applications need to track previous interactions with the model as part of the interface (for example, chatbots).
For this, you can add memory when setting up the Conversation chain. Memory allows you to chat with AI as if the AI has memory of previous conversations.
Human: hi i am bob
AI: Hello Bob! It's nice to meet you. How can I assist you today?
Human: what's my name?
AI: Your name is Bob, as you mentioned earlier.
The retriever is an interface that returns documents based on unstructured queries. It is more general than vector storage. The retriever doesn't need to be able to store documents, just return (or retrieve) them. Vector storage can be used as the backbone of the retriever, but there are also other types of retrievers.
We have previously detailed in our articles how to upload datasets, so here you can add the datasets that have been uploaded. You can choose to upload multiple datasets.
Its operating principle is:
firstly, the chat record (explicitly entered or retrieved from the provided memory) and the question are combined into an independent question, then the relevant documents are searched from the retriever, and finally these documents and the question are passed to the Q&A chain to return a response.