forked from QuivrHQ/quivr
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: tests get default brain (QuivrHQ#593)
* feat: tests get default brain * feat: chains docs * feat: brains docs * fix: remove brain_id creation from fe * fix: docs categories
- Loading branch information
1 parent
72924b5
commit cf37666
Showing
7 changed files
with
139 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"label": "Brains", | ||
"position": 3, | ||
"link": { | ||
"type": "generated-index", | ||
"description": "What are brains?" | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
sidebar_position: 1 | ||
--- | ||
|
||
# Introduction to Brains | ||
|
||
Quivr has a concept of "Brains". They are ring fenced bodies of information that can be used to provide context to Large Language Models (LLMs) to answer questions on a particular topic. | ||
|
||
LLMs are trained on a large variety of data but to answer a question on a specific topic or to be used to make deductions around a specific topic, they need to be supplied with the context of that topic. | ||
|
||
Quivr uses brains as an intuitive way to provide that context. | ||
|
||
When a brain is selected in Quivr, the LLM will be provided with only the context of that brain. This allows users to build brains for specific topics and then use them to answer questions about that topic. | ||
|
||
In the future there will be the functionality to share brains with other users of Quivr. | ||
|
||
## How to use Brains | ||
|
||
To use a brain, simply select the menu from using the Brain icon in the header at the top right of the Quivr interface. | ||
|
||
You can create a new brain by clicking the "Create Brain" button. You will be prompted to enter a name for the brain. If you wish you can also just use the default brain for your account. | ||
|
||
To switch to a different brain, simply click on the brain name in the menu and select the brain you wish to use. | ||
|
||
If you have not chosen a brain, you can assume that any documentation you upload will be added to the default brain. | ||
|
||
**Note: If you are having problems with the chat functionality, try selecting a brain from the menu. The default brain is not always selected automatically and you will need a brain selected to use the chat functionality.** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"label": "Chains", | ||
"position": 4, | ||
"link": { | ||
"type": "generated-index", | ||
"description": "What are chains?" | ||
} | ||
} | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
sidebar_position: 1 | ||
--- | ||
|
||
# Introduction to Chains | ||
|
||
Quivr uses a framework called [Langchain](https://python.langchain.com/docs/get_started/introduction.html) for the majority of the interaction with the Large Language Models (LLMs). | ||
|
||
Langchain provides functionality to connect multiple components such as LLMs, document retrievers, and other components together to form a "chain" of components. | ||
|
||
They define a Chain very generically as a sequence of calls to components, which can include other chains. For example, a chain could be a sequence of calls to a document retriever, followed by a call to an LLM, followed by a call to a summarizer. | ||
|
||
## Conversational Retrieval Chains | ||
|
||
In Quivr we make use of the Conversational Retrieval Chain. These chains take in chat history and new questions and return an answer to the question. The algorithm for Conversational Retrieval Chains consists of three parts: | ||
|
||
1. Creating a standalone question: The chat history and new question are combined to create a standalone question. This is done to ensure that relevant context is included in the retrieval step without unnecessary information from the whole conversation. | ||
|
||
2. Retrieving relevant documents: The standalone question is passed to a retriever, which fetches relevant documents. | ||
|
||
3. Generating a final response: The retrieved documents are passed to a language model (LLM) along with either the new question or the original question and chat history. The LLM generates a final response based on this input. | ||
|
||
## OpenAI Functions | ||
|
||
Quivr also uses OpenAI Functions for the newer models. OpenAI Functions allow us to define out own version of a lightweight Conversational Retrieval Chain. In this case we ask the LLM if it can answer the question directly or if it needs either history or history and context. If it needs history and context, we pass the question and history to a retriever which performs a simple vector similarity search and then pass the retrieved documents to the LLM as context. | ||
|
||
Using this method we can get the simular results as the Conversational Retrieval Chain but with a much simpler implementation and less then 1/2 of the latency. | ||
|
||
See the diagram below for a visual representation: | ||
|
||
![OpenAI Functions](open_ai_functions_tree.jpg) |