57 lines
2.6 KiB
Text
57 lines
2.6 KiB
Text
import Admonition from "@theme/Admonition";
|
|
|
|
# Multiple Vector Stores
|
|
|
|
The example below shows an agent operating with two vector stores built upon different data sources.
|
|
|
|
The `TextLoader` loads a TXT file, while the `WebBaseLoader` pulls text from webpages into a document format to accessed downstream. The `Chroma` vector stores are created analogous to what we have demonstrated in our [CSV Loader](/examples/csv-loader.mdx) example. Finally, the `VectorStoreRouterAgent` constructs an agent that routes between the vector stores.
|
|
|
|
<Admonition type="info">
|
|
Get the TXT file used
|
|
[here](https://github.com/hwchase17/chat-your-data/blob/master/state_of_the_union.txt).
|
|
</Admonition>
|
|
|
|
URL used by the `WebBaseLoader`:
|
|
|
|
```text
|
|
https://pt.wikipedia.org/wiki/Harry_Potter
|
|
```
|
|
|
|
<Admonition type="tip">
|
|
When you build the flow, request information about one of the sources. The
|
|
agent should be able to use the correct source to generate a response.
|
|
</Admonition>
|
|
|
|
<Admonition type="info">
|
|
Learn more about Multiple Vector Stores
|
|
[here](https://python.langchain.com/docs/modules/agents/toolkits/vectorstore?highlight=Multiple%20Vector%20Stores#multiple-vectorstores).
|
|
</Admonition>
|
|
|
|
## ⛓️ Langflow Example
|
|
|
|
import ThemedImage from "@theme/ThemedImage";
|
|
import useBaseUrl from "@docusaurus/useBaseUrl";
|
|
import ZoomableImage from "/src/theme/ZoomableImage.js";
|
|
|
|
<ZoomableImage
|
|
alt="Docusaurus themed image"
|
|
sources={{
|
|
light: "img/multiple-vectorstores.png",
|
|
}}
|
|
/>
|
|
|
|
#### <a target="\_blank" href="json_files/Multiple_Vector_Stores.json" download>Download Flow</a>
|
|
|
|
<Admonition type="note" title="LangChain Components 🦜🔗">
|
|
|
|
- [`WebBaseLoader`](https://python.langchain.com/docs/modules/data_connection/document_loaders/integrations/web_base)
|
|
- [`TextLoader`](https://python.langchain.com/docs/modules/data_connection/document_loaders/integrations/unstructured_file)
|
|
- [`CharacterTextSplitter`](https://python.langchain.com/docs/modules/data_connection/document_transformers/text_splitters/character_text_splitter)
|
|
- [`OpenAIEmbedding`](https://python.langchain.com/docs/modules/data_connection/text_embedding/integrations/openai)
|
|
- [`Chroma`](https://python.langchain.com/docs/modules/data_connection/vectorstores/integrations/chroma)
|
|
- [`VectorStoreInfo`](https://python.langchain.com/docs/modules/data_connection/vectorstores/)
|
|
- [`OpenAI`](https://python.langchain.com/docs/modules/model_io/models/llms/integrations/openai)
|
|
- [`VectorStoreRouterToolkit`](https://python.langchain.com/docs/modules/agents/toolkits/vectorstore)
|
|
- [`VectorStoreRouterAgent`](https://python.langchain.com/docs/modules/agents/toolkits/vectorstore)
|
|
|
|
</Admonition>
|