diff --git a/docs/docs/get_started/quickstart.mdx b/docs/docs/get_started/quickstart.mdx index 9279c62a67..fa0937ae2c 100644 --- a/docs/docs/get_started/quickstart.mdx +++ b/docs/docs/get_started/quickstart.mdx @@ -221,25 +221,24 @@ embeddings = OllamaEmbeddings() Now, we can use this embedding model to ingest documents into a vectorstore. -We will use a simple local vectorstore, [DocArray InMemorySearch](/docs/integrations/vectorstores/docarray_in_memory), for simplicity's sake. +We will use a simple local vectorstore, [FAISS](/docs/integrations/vectorstores/faiss), for simplicity's sake. First we need to install the required packages for that: ```shell -pip install docarray -pip install tiktoken +pip install faiss-cpu ``` Then we can build our index: ```python -from langchain_community.vectorstores import DocArrayInMemorySearch +from langchain_community.vectorstores import FAISS from langchain.text_splitter import RecursiveCharacterTextSplitter text_splitter = RecursiveCharacterTextSplitter() documents = text_splitter.split_documents(docs) -vector = DocArrayInMemorySearch.from_documents(documents, embeddings) +vector = FAISS.from_documents(documents, embeddings) ``` Now that we have this data indexed in a vectorstore, we will create a retrieval chain. @@ -483,7 +482,7 @@ from langchain_core.prompts import ChatPromptTemplate from langchain_openai import ChatOpenAI from langchain_community.document_loaders import WebBaseLoader from langchain_openai import OpenAIEmbeddings -from langchain_community.vectorstores import DocArrayInMemorySearch +from langchain_community.vectorstores import FAISS from langchain.text_splitter import RecursiveCharacterTextSplitter from langchain.tools.retriever import create_retriever_tool from langchain_community.tools.tavily_search import TavilySearchResults @@ -501,7 +500,7 @@ docs = loader.load() text_splitter = RecursiveCharacterTextSplitter() documents = text_splitter.split_documents(docs) embeddings = OpenAIEmbeddings() -vector = DocArrayInMemorySearch.from_documents(documents, embeddings) +vector = FAISS.from_documents(documents, embeddings) retriever = vector.as_retriever() # 2. Create Tools diff --git a/docs/docs/modules/agents/quick_start.ipynb b/docs/docs/modules/agents/quick_start.ipynb index 65e5e2aa30..bcdf9adaff 100644 --- a/docs/docs/modules/agents/quick_start.ipynb +++ b/docs/docs/modules/agents/quick_start.ipynb @@ -85,8 +85,10 @@ { "data": { "text/plain": [ - "[{'url': 'https://weather.com/weather/tenday/l/San Francisco CA USCA0987:1:US',\n", - " 'content': 'recents Specialty Forecasts 10 Day Weather-San Francisco, CA Today Mon 18 | Day Fri 22 Fri 22 | Day Foggy early, then partly cloudy later in the day. High around 60F. Winds W at 10 to 15 mph. High 59F. Winds SSW at 10 to 15 mph. Chance of rain 60%. Considerable cloudiness with occasional rain showers. High 59F. Winds SSE at 5 to 10 mph. Chance of rain 50%.San Francisco, CA 10-Day Weather Forecast - The Weather Channel | Weather.com 10 Day Weather - San Francisco, CA As of 12:09 pm PST Today 60°/ 54° 23% Tue 19 | Day 60° 23% S 12 mph More...'}]" + "[{'url': 'https://www.whereandwhen.net/when/north-america/california/san-francisco-ca/january/',\n", + " 'content': 'Best time to go to San Francisco? Weather in San Francisco in january 2024 How was the weather last january? Here is the day by day recorded weather in San Francisco in january 2023: 8% 46% 29% 12% 8% Evolution of daily average temperature and precipitation in San Francisco in january Seasonal average climate and temperature of San Francisco in januaryWeather in San Francisco in january 2024. The weather in San Francisco in january comes from statistical datas on the past years. You can view the weather statistics the entire month, but also by using the tabs for the beginning, the middle and the end of the month. ... 08-01-2023 52°F to 58°F. 09-01-2023 54°F to 61°F. 10-01-2023 52°F to ...'},\n", + " {'url': 'https://en.climate-data.org/north-america/united-states-of-america/california/san-francisco-385/t/january-1/',\n", + " 'content': 'San Francisco Weather in January Data: 1999 - 2019: avg. Sun hours San Francisco weather and climate for further months San Francisco weather in January San Francisco weather by month // weather averages 9.6 (49.2) 6.2 (43.2) 14 (57.3) 113 you can find all information about the weather in San Francisco in January:Data: 1991 - 2021 Min. Temperature °C (°F), Max. Temperature °C (°F), Precipitation / Rainfall mm (in), Humidity, Rainy days. Data: 1999 - 2019: avg. Sun hours San Francisco weather and climate for further months San Francisco in February San Francisco in March San Francisco in April San Francisco in May San Francisco in June San Francisco in July'}]" ] }, "execution_count": 3, @@ -117,7 +119,7 @@ "source": [ "from langchain.text_splitter import RecursiveCharacterTextSplitter\n", "from langchain_community.document_loaders import WebBaseLoader\n", - "from langchain_community.vectorstores import DocArrayInMemorySearch\n", + "from langchain_community.vectorstores import FAISS\n", "from langchain_openai import OpenAIEmbeddings\n", "\n", "loader = WebBaseLoader(\"https://docs.smith.langchain.com/overview\")\n", @@ -125,7 +127,7 @@ "documents = RecursiveCharacterTextSplitter(\n", " chunk_size=1000, chunk_overlap=200\n", ").split_documents(docs)\n", - "vector = DocArrayInMemorySearch.from_documents(documents, OpenAIEmbeddings())\n", + "vector = FAISS.from_documents(documents, OpenAIEmbeddings())\n", "retriever = vector.as_retriever()" ] }, @@ -686,7 +688,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.1" + "version": "3.10.1" } }, "nbformat": 4,