diff --git a/docs/docs/integrations/vectorstores/astradb.ipynb b/docs/docs/integrations/vectorstores/astradb.ipynb index 22db0166a85..812fbe29b38 100644 --- a/docs/docs/integrations/vectorstores/astradb.ipynb +++ b/docs/docs/integrations/vectorstores/astradb.ipynb @@ -455,68 +455,13 @@ "id": "734e683a", "metadata": {}, "source": [ - "## Chain usage\n", + "## Usage for retrieval-augmented generation\n", "\n", - "The code below shows how to use the vector store as a retriever in a simple RAG chain:\n", + "For guides on how to use this vector store for retrieval-augmented generation (RAG), see the following sections:\n", "\n", - "```{=mdx}\n", - "import ChatModelTabs from \"@theme/ChatModelTabs\";\n", - "\n", - "\n", - "```" - ] - }, - { - "cell_type": "code", - "execution_count": 25, - "id": "9b3cc97b", - "metadata": {}, - "outputs": [], - "source": [ - "# | output: false\n", - "# | echo: false\n", - "from langchain_openai import ChatOpenAI\n", - "\n", - "llm = ChatOpenAI(model=\"gpt-4o-mini\")" - ] - }, - { - "cell_type": "code", - "execution_count": 21, - "id": "08401498", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "'LangGraph is used for building stateful, agentic applications. It provides a framework that facilitates the development of such applications. Its capabilities make it a preferred choice for developers in this domain.'" - ] - }, - "execution_count": 21, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "from langchain import hub\n", - "from langchain_core.output_parsers import StrOutputParser\n", - "from langchain_core.runnables import RunnablePassthrough\n", - "\n", - "prompt = hub.pull(\"rlm/rag-prompt\")\n", - "\n", - "\n", - "def format_docs(docs):\n", - " return \"\\n\\n\".join(doc.page_content for doc in docs)\n", - "\n", - "\n", - "rag_chain = (\n", - " {\"context\": retriever | format_docs, \"question\": RunnablePassthrough()}\n", - " | prompt\n", - " | llm\n", - " | StrOutputParser()\n", - ")\n", - "\n", - "rag_chain.invoke(\"What is LangGraph used for?\")" + "- [Tutorials: working with external knowledge](https://python.langchain.com/v0.2/docs/tutorials/#working-with-external-knowledge)\n", + "- [How-to: Question and answer with RAG](https://python.langchain.com/v0.2/docs/how_to/#qa-with-rag)\n", + "- [Retrieval conceptual docs](https://python.langchain.com/v0.2/docs/concepts/#retrieval)" ] }, { diff --git a/docs/docs/integrations/vectorstores/chroma.ipynb b/docs/docs/integrations/vectorstores/chroma.ipynb index d5fafe18825..8ca17147d0c 100644 --- a/docs/docs/integrations/vectorstores/chroma.ipynb +++ b/docs/docs/integrations/vectorstores/chroma.ipynb @@ -459,68 +459,13 @@ "id": "a2b7b73c", "metadata": {}, "source": [ - "## Chain usage\n", + "## Usage for retrieval-augmented generation\n", "\n", - "The code below shows how to use the vector store as a retriever in a simple RAG chain:\n", + "For guides on how to use this vector store for retrieval-augmented generation (RAG), see the following sections:\n", "\n", - "```{=mdx}\n", - "import ChatModelTabs from \"@theme/ChatModelTabs\";\n", - "\n", - "\n", - "```" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "id": "9aad065b", - "metadata": {}, - "outputs": [], - "source": [ - "# | output: false\n", - "# | echo: false\n", - "from langchain_openai import ChatOpenAI\n", - "\n", - "llm = ChatOpenAI(model=\"gpt-4o-mini\")" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "id": "84a19f48", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "'LangGraph is used for building stateful, agentic applications. It provides a framework that supports the development of such applications efficiently.'" - ] - }, - "execution_count": 15, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "from langchain import hub\n", - "from langchain_core.output_parsers import StrOutputParser\n", - "from langchain_core.runnables import RunnablePassthrough\n", - "\n", - "prompt = hub.pull(\"rlm/rag-prompt\")\n", - "\n", - "\n", - "def format_docs(docs):\n", - " return \"\\n\\n\".join(doc.page_content for doc in docs)\n", - "\n", - "\n", - "rag_chain = (\n", - " {\"context\": retriever | format_docs, \"question\": RunnablePassthrough()}\n", - " | prompt\n", - " | llm\n", - " | StrOutputParser()\n", - ")\n", - "\n", - "rag_chain.invoke(\"What is LangGraph used for?\")" + "- [Tutorials: working with external knowledge](https://python.langchain.com/v0.2/docs/tutorials/#working-with-external-knowledge)\n", + "- [How-to: Question and answer with RAG](https://python.langchain.com/v0.2/docs/how_to/#qa-with-rag)\n", + "- [Retrieval conceptual docs](https://python.langchain.com/v0.2/docs/concepts/#retrieval)" ] }, { diff --git a/docs/docs/integrations/vectorstores/clickhouse.ipynb b/docs/docs/integrations/vectorstores/clickhouse.ipynb index f3de48038c1..51367182053 100644 --- a/docs/docs/integrations/vectorstores/clickhouse.ipynb +++ b/docs/docs/integrations/vectorstores/clickhouse.ipynb @@ -356,57 +356,13 @@ "id": "57fade30", "metadata": {}, "source": [ - "## Chain usage\n", + "## Usage for retrieval-augmented generation\n", "\n", - "The code below shows how to use the vector store as a retriever in a simple RAG chain:\n", + "For guides on how to use this vector store for retrieval-augmented generation (RAG), see the following sections:\n", "\n", - "```{=mdx}\n", - "import ChatModelTabs from \"@theme/ChatModelTabs\";\n", - "\n", - "\n", - "```" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "8a7fec6b", - "metadata": {}, - "outputs": [], - "source": [ - "# | output: false\n", - "# | echo: false\n", - "from langchain_openai import ChatOpenAI\n", - "\n", - "llm = ChatOpenAI(model=\"gpt-4o-mini\")" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "ae6871dc", - "metadata": {}, - "outputs": [], - "source": [ - "from langchain import hub\n", - "from langchain_core.output_parsers import StrOutputParser\n", - "from langchain_core.runnables import RunnablePassthrough\n", - "\n", - "prompt = hub.pull(\"rlm/rag-prompt\")\n", - "\n", - "\n", - "def format_docs(docs):\n", - " return \"\\n\\n\".join(doc.page_content for doc in docs)\n", - "\n", - "\n", - "rag_chain = (\n", - " {\"context\": retriever | format_docs, \"question\": RunnablePassthrough()}\n", - " | prompt\n", - " | llm\n", - " | StrOutputParser()\n", - ")\n", - "\n", - "rag_chain.invoke(\"What is LangGraph used for?\")" + "- [Tutorials: working with external knowledge](https://python.langchain.com/v0.2/docs/tutorials/#working-with-external-knowledge)\n", + "- [How-to: Question and answer with RAG](https://python.langchain.com/v0.2/docs/how_to/#qa-with-rag)\n", + "- [Retrieval conceptual docs](https://python.langchain.com/v0.2/docs/concepts/#retrieval)" ] }, { diff --git a/docs/docs/integrations/vectorstores/couchbase.ipynb b/docs/docs/integrations/vectorstores/couchbase.ipynb index e783d4dc4cd..a762de72ab0 100644 --- a/docs/docs/integrations/vectorstores/couchbase.ipynb +++ b/docs/docs/integrations/vectorstores/couchbase.ipynb @@ -674,57 +674,13 @@ "id": "28ab35ec", "metadata": {}, "source": [ - "## Chain usage\n", + "## Usage for retrieval-augmented generation\n", "\n", - "The code below shows how to use the vector store as a retriever in a simple RAG chain:\n", + "For guides on how to use this vector store for retrieval-augmented generation (RAG), see the following sections:\n", "\n", - "```{=mdx}\n", - "import ChatModelTabs from \"@theme/ChatModelTabs\";\n", - "\n", - "\n", - "```" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "a6a849aa", - "metadata": {}, - "outputs": [], - "source": [ - "# | output: false\n", - "# | echo: false\n", - "from langchain_openai import ChatOpenAI\n", - "\n", - "llm = ChatOpenAI(model=\"gpt-4o-mini\")" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "e34c9e3a", - "metadata": {}, - "outputs": [], - "source": [ - "from langchain import hub\n", - "from langchain_core.output_parsers import StrOutputParser\n", - "from langchain_core.runnables import RunnablePassthrough\n", - "\n", - "prompt = hub.pull(\"rlm/rag-prompt\")\n", - "\n", - "\n", - "def format_docs(docs):\n", - " return \"\\n\\n\".join(doc.page_content for doc in docs)\n", - "\n", - "\n", - "rag_chain = (\n", - " {\"context\": retriever | format_docs, \"question\": RunnablePassthrough()}\n", - " | prompt\n", - " | llm\n", - " | StrOutputParser()\n", - ")\n", - "\n", - "rag_chain.invoke(\"What is LangGraph used for?\")" + "- [Tutorials: working with external knowledge](https://python.langchain.com/v0.2/docs/tutorials/#working-with-external-knowledge)\n", + "- [How-to: Question and answer with RAG](https://python.langchain.com/v0.2/docs/how_to/#qa-with-rag)\n", + "- [Retrieval conceptual docs](https://python.langchain.com/v0.2/docs/concepts/#retrieval)" ] }, { diff --git a/docs/docs/integrations/vectorstores/elasticsearch.ipynb b/docs/docs/integrations/vectorstores/elasticsearch.ipynb index ff4c11fc187..99065abdcc1 100644 --- a/docs/docs/integrations/vectorstores/elasticsearch.ipynb +++ b/docs/docs/integrations/vectorstores/elasticsearch.ipynb @@ -469,68 +469,13 @@ "id": "17b509ae", "metadata": {}, "source": [ - "## Chain usage\n", + "## Usage for retrieval-augmented generation\n", "\n", - "The code below shows how to use the vector store as a retriever in a simple RAG chain:\n", + "For guides on how to use this vector store for retrieval-augmented generation (RAG), see the following sections:\n", "\n", - "```{=mdx}\n", - "import ChatModelTabs from \"@theme/ChatModelTabs\";\n", - "\n", - "\n", - "```" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "id": "58e17804", - "metadata": {}, - "outputs": [], - "source": [ - "# | output: false\n", - "# | echo: false\n", - "from langchain_openai import ChatOpenAI\n", - "\n", - "llm = ChatOpenAI(model=\"gpt-4o-mini\")" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "id": "01dac420", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "'LanGraph is used for building stateful, agentic applications. It serves as a framework to facilitate the development of exciting new projects.'" - ] - }, - "execution_count": 15, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "from langchain import hub\n", - "from langchain_core.output_parsers import StrOutputParser\n", - "from langchain_core.runnables import RunnablePassthrough\n", - "\n", - "prompt = hub.pull(\"rlm/rag-prompt\")\n", - "\n", - "\n", - "def format_docs(docs):\n", - " return \"\\n\\n\".join(doc.page_content for doc in docs)\n", - "\n", - "\n", - "rag_chain = (\n", - " {\"context\": retriever | format_docs, \"question\": RunnablePassthrough()}\n", - " | prompt\n", - " | llm\n", - " | StrOutputParser()\n", - ")\n", - "\n", - "rag_chain.invoke(\"What is LanGraph used for?\")" + "- [Tutorials: working with external knowledge](https://python.langchain.com/v0.2/docs/tutorials/#working-with-external-knowledge)\n", + "- [How-to: Question and answer with RAG](https://python.langchain.com/v0.2/docs/how_to/#qa-with-rag)\n", + "- [Retrieval conceptual docs](https://python.langchain.com/v0.2/docs/concepts/#retrieval)" ] }, { diff --git a/docs/docs/integrations/vectorstores/faiss.ipynb b/docs/docs/integrations/vectorstores/faiss.ipynb index 175ed8060b0..f0aca8d0181 100644 --- a/docs/docs/integrations/vectorstores/faiss.ipynb +++ b/docs/docs/integrations/vectorstores/faiss.ipynb @@ -360,68 +360,13 @@ "id": "5edd1909", "metadata": {}, "source": [ - "## Chain usage\n", + "## Usage for retrieval-augmented generation\n", "\n", - "The code below shows how to use the vector store as a retriever in a simple RAG chain:\n", + "For guides on how to use this vector store for retrieval-augmented generation (RAG), see the following sections:\n", "\n", - "```{=mdx}\n", - "import ChatModelTabs from \"@theme/ChatModelTabs\";\n", - "\n", - "\n", - "```" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "id": "6b792eaa", - "metadata": {}, - "outputs": [], - "source": [ - "# | output: false\n", - "# | echo: false\n", - "from langchain_openai import ChatOpenAI\n", - "\n", - "llm = ChatOpenAI(model=\"gpt-4o-mini\")" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "id": "1aca9435", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "'LangGraph is used for building stateful, agentic applications. It provides a framework that facilitates the development of these types of applications.'" - ] - }, - "execution_count": 10, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "from langchain import hub\n", - "from langchain_core.output_parsers import StrOutputParser\n", - "from langchain_core.runnables import RunnablePassthrough\n", - "\n", - "prompt = hub.pull(\"rlm/rag-prompt\")\n", - "\n", - "\n", - "def format_docs(docs):\n", - " return \"\\n\\n\".join(doc.page_content for doc in docs)\n", - "\n", - "\n", - "rag_chain = (\n", - " {\"context\": retriever | format_docs, \"question\": RunnablePassthrough()}\n", - " | prompt\n", - " | llm\n", - " | StrOutputParser()\n", - ")\n", - "\n", - "rag_chain.invoke(\"What is LangGraph used for?\")" + "- [Tutorials: working with external knowledge](https://python.langchain.com/v0.2/docs/tutorials/#working-with-external-knowledge)\n", + "- [How-to: Question and answer with RAG](https://python.langchain.com/v0.2/docs/how_to/#qa-with-rag)\n", + "- [Retrieval conceptual docs](https://python.langchain.com/v0.2/docs/concepts/#retrieval)" ] }, { diff --git a/docs/docs/integrations/vectorstores/milvus.ipynb b/docs/docs/integrations/vectorstores/milvus.ipynb index b6c806e637b..0f4f1b378f0 100644 --- a/docs/docs/integrations/vectorstores/milvus.ipynb +++ b/docs/docs/integrations/vectorstores/milvus.ipynb @@ -393,68 +393,13 @@ "id": "8ac953f1", "metadata": {}, "source": [ - "## Chain usage\n", + "## Usage for retrieval-augmented generation\n", "\n", - "The code below shows how to use the vector store as a retriever in a simple RAG chain:\n", + "For guides on how to use this vector store for retrieval-augmented generation (RAG), see the following sections:\n", "\n", - "```{=mdx}\n", - "import ChatModelTabs from \"@theme/ChatModelTabs\";\n", - "\n", - "\n", - "```" - ] - }, - { - "cell_type": "code", - "execution_count": 35, - "id": "d17118c2", - "metadata": {}, - "outputs": [], - "source": [ - "# | output: false\n", - "# | echo: false\n", - "from langchain_openai import ChatOpenAI\n", - "\n", - "llm = ChatOpenAI(model=\"gpt-4o-mini\")" - ] - }, - { - "cell_type": "code", - "execution_count": 36, - "id": "7bbe3b95", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "'LangGraph is used for building stateful, agentic applications. It provides a framework that facilitates the development of such applications effectively.'" - ] - }, - "execution_count": 36, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "from langchain import hub\n", - "from langchain_core.output_parsers import StrOutputParser\n", - "from langchain_core.runnables import RunnablePassthrough\n", - "\n", - "prompt = hub.pull(\"rlm/rag-prompt\")\n", - "\n", - "\n", - "def format_docs(docs):\n", - " return \"\\n\\n\".join(doc.page_content for doc in docs)\n", - "\n", - "\n", - "rag_chain = (\n", - " {\"context\": retriever | format_docs, \"question\": RunnablePassthrough()}\n", - " | prompt\n", - " | llm\n", - " | StrOutputParser()\n", - ")\n", - "\n", - "rag_chain.invoke(\"What is LangGraph used for?\")" + "- [Tutorials: working with external knowledge](https://python.langchain.com/v0.2/docs/tutorials/#working-with-external-knowledge)\n", + "- [How-to: Question and answer with RAG](https://python.langchain.com/v0.2/docs/how_to/#qa-with-rag)\n", + "- [Retrieval conceptual docs](https://python.langchain.com/v0.2/docs/concepts/#retrieval)" ] }, { diff --git a/docs/docs/integrations/vectorstores/mongodb_atlas.ipynb b/docs/docs/integrations/vectorstores/mongodb_atlas.ipynb index c71fbd6526c..f158b17f3a3 100644 --- a/docs/docs/integrations/vectorstores/mongodb_atlas.ipynb +++ b/docs/docs/integrations/vectorstores/mongodb_atlas.ipynb @@ -457,68 +457,13 @@ "id": "72312657", "metadata": {}, "source": [ - "## Chain usage\n", + "## Usage for retrieval-augmented generation\n", "\n", - "The code below shows how to use the vector store as a retriever in a simple RAG chain:\n", + "For guides on how to use this vector store for retrieval-augmented generation (RAG), see the following sections:\n", "\n", - "```{=mdx}\n", - "import ChatModelTabs from \"@theme/ChatModelTabs\";\n", - "\n", - "\n", - "```" - ] - }, - { - "cell_type": "code", - "execution_count": 66, - "id": "a42da723", - "metadata": {}, - "outputs": [], - "source": [ - "# | output: false\n", - "# | echo: false\n", - "from langchain_openai import ChatOpenAI\n", - "\n", - "llm = ChatOpenAI(model=\"gpt-4o-mini\")" - ] - }, - { - "cell_type": "code", - "execution_count": 67, - "id": "80c1130f", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "'LangGraph is used for building stateful, agentic applications. It provides a framework that facilitates the development of such applications.'" - ] - }, - "execution_count": 67, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "from langchain import hub\n", - "from langchain_core.output_parsers import StrOutputParser\n", - "from langchain_core.runnables import RunnablePassthrough\n", - "\n", - "prompt = hub.pull(\"rlm/rag-prompt\")\n", - "\n", - "\n", - "def format_docs(docs):\n", - " return \"\\n\\n\".join(doc.page_content for doc in docs)\n", - "\n", - "\n", - "rag_chain = (\n", - " {\"context\": retriever | format_docs, \"question\": RunnablePassthrough()}\n", - " | prompt\n", - " | llm\n", - " | StrOutputParser()\n", - ")\n", - "\n", - "rag_chain.invoke(\"What is LangGraph used for?\")" + "- [Tutorials: working with external knowledge](https://python.langchain.com/v0.2/docs/tutorials/#working-with-external-knowledge)\n", + "- [How-to: Question and answer with RAG](https://python.langchain.com/v0.2/docs/how_to/#qa-with-rag)\n", + "- [Retrieval conceptual docs](https://python.langchain.com/v0.2/docs/concepts/#retrieval)" ] }, { diff --git a/docs/docs/integrations/vectorstores/pgvector.ipynb b/docs/docs/integrations/vectorstores/pgvector.ipynb index d88add2147c..5dd27467269 100644 --- a/docs/docs/integrations/vectorstores/pgvector.ipynb +++ b/docs/docs/integrations/vectorstores/pgvector.ipynb @@ -434,68 +434,13 @@ "id": "7ecd77a0", "metadata": {}, "source": [ - "## Chain usage\n", + "## Usage for retrieval-augmented generation\n", "\n", - "The code below shows how to use the vector store as a retriever in a simple RAG chain:\n", + "For guides on how to use this vector store for retrieval-augmented generation (RAG), see the following sections:\n", "\n", - "```{=mdx}\n", - "import ChatModelTabs from \"@theme/ChatModelTabs\";\n", - "\n", - "\n", - "```" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "id": "f0b14168", - "metadata": {}, - "outputs": [], - "source": [ - "# | output: false\n", - "# | echo: false\n", - "from langchain_openai import ChatOpenAI\n", - "\n", - "llm = ChatOpenAI(model=\"gpt-4o-mini\")" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "id": "a4eba12c", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "'There are cats in the pond right now.'" - ] - }, - "execution_count": 8, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "from langchain import hub\n", - "from langchain_core.output_parsers import StrOutputParser\n", - "from langchain_core.runnables import RunnablePassthrough\n", - "\n", - "prompt = hub.pull(\"rlm/rag-prompt\")\n", - "\n", - "\n", - "def format_docs(docs):\n", - " return \"\\n\\n\".join(doc.page_content for doc in docs)\n", - "\n", - "\n", - "rag_chain = (\n", - " {\"context\": retriever | format_docs, \"question\": RunnablePassthrough()}\n", - " | prompt\n", - " | llm\n", - " | StrOutputParser()\n", - ")\n", - "\n", - "rag_chain.invoke(\"Who is at the pond right now?\")" + "- [Tutorials: working with external knowledge](https://python.langchain.com/v0.2/docs/tutorials/#working-with-external-knowledge)\n", + "- [How-to: Question and answer with RAG](https://python.langchain.com/v0.2/docs/how_to/#qa-with-rag)\n", + "- [Retrieval conceptual docs](https://python.langchain.com/v0.2/docs/concepts/#retrieval)" ] }, { diff --git a/docs/docs/integrations/vectorstores/pinecone.ipynb b/docs/docs/integrations/vectorstores/pinecone.ipynb index 66416950652..29365946d4c 100644 --- a/docs/docs/integrations/vectorstores/pinecone.ipynb +++ b/docs/docs/integrations/vectorstores/pinecone.ipynb @@ -408,68 +408,13 @@ "id": "72990cb5", "metadata": {}, "source": [ - "## Chain usage\n", + "## Usage for retrieval-augmented generation\n", "\n", - "The code below shows how to use the vector store as a retriever in a simple RAG chain:\n", + "For guides on how to use this vector store for retrieval-augmented generation (RAG), see the following sections:\n", "\n", - "```{=mdx}\n", - "import ChatModelTabs from \"@theme/ChatModelTabs\";\n", - "\n", - "\n", - "```" - ] - }, - { - "cell_type": "code", - "execution_count": 20, - "id": "f12560cb", - "metadata": {}, - "outputs": [], - "source": [ - "# | output: false\n", - "# | echo: false\n", - "from langchain_openai import ChatOpenAI\n", - "\n", - "llm = ChatOpenAI(model=\"gpt-4o-mini\")" - ] - }, - { - "cell_type": "code", - "execution_count": 21, - "id": "262651fc", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "'LangGraph is used for building stateful, agentic applications. It provides a framework that facilitates the development of these types of applications.'" - ] - }, - "execution_count": 21, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "from langchain import hub\n", - "from langchain_core.output_parsers import StrOutputParser\n", - "from langchain_core.runnables import RunnablePassthrough\n", - "\n", - "prompt = hub.pull(\"rlm/rag-prompt\")\n", - "\n", - "\n", - "def format_docs(docs):\n", - " return \"\\n\\n\".join(doc.page_content for doc in docs)\n", - "\n", - "\n", - "rag_chain = (\n", - " {\"context\": retriever | format_docs, \"question\": RunnablePassthrough()}\n", - " | prompt\n", - " | llm\n", - " | StrOutputParser()\n", - ")\n", - "\n", - "rag_chain.invoke(\"What is LangGraph used for?\")" + "- [Tutorials: working with external knowledge](https://python.langchain.com/v0.2/docs/tutorials/#working-with-external-knowledge)\n", + "- [How-to: Question and answer with RAG](https://python.langchain.com/v0.2/docs/how_to/#qa-with-rag)\n", + "- [Retrieval conceptual docs](https://python.langchain.com/v0.2/docs/concepts/#retrieval)" ] }, { diff --git a/docs/docs/integrations/vectorstores/qdrant.ipynb b/docs/docs/integrations/vectorstores/qdrant.ipynb index c0ccbe4f08e..fe5544e7e82 100644 --- a/docs/docs/integrations/vectorstores/qdrant.ipynb +++ b/docs/docs/integrations/vectorstores/qdrant.ipynb @@ -713,68 +713,13 @@ "id": "6ac07288", "metadata": {}, "source": [ - "## Chain usage\n", + "## Usage for retrieval-augmented generation\n", "\n", - "The code below shows how to use the vector store as a retriever in a simple RAG chain:\n", + "For guides on how to use this vector store for retrieval-augmented generation (RAG), see the following sections:\n", "\n", - "```{=mdx}\n", - "import ChatModelTabs from \"@theme/ChatModelTabs\";\n", - "\n", - "\n", - "```" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "id": "07bd9785", - "metadata": {}, - "outputs": [], - "source": [ - "# | output: false\n", - "# | echo: false\n", - "from langchain_openai import ChatOpenAI\n", - "\n", - "llm = ChatOpenAI(model=\"gpt-4o-mini\")" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "id": "d97f0c91", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "'LangGraph is used for building stateful, agentic applications. It provides a framework that facilitates the development of such applications.'" - ] - }, - "execution_count": 17, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "from langchain import hub\n", - "from langchain_core.output_parsers import StrOutputParser\n", - "from langchain_core.runnables import RunnablePassthrough\n", - "\n", - "prompt = hub.pull(\"rlm/rag-prompt\")\n", - "\n", - "\n", - "def format_docs(docs):\n", - " return \"\\n\\n\".join(doc.page_content for doc in docs)\n", - "\n", - "\n", - "rag_chain = (\n", - " {\"context\": retriever | format_docs, \"question\": RunnablePassthrough()}\n", - " | prompt\n", - " | llm\n", - " | StrOutputParser()\n", - ")\n", - "\n", - "rag_chain.invoke(\"What is LangGraph used for?\")" + "- [Tutorials: working with external knowledge](https://python.langchain.com/v0.2/docs/tutorials/#working-with-external-knowledge)\n", + "- [How-to: Question and answer with RAG](https://python.langchain.com/v0.2/docs/how_to/#qa-with-rag)\n", + "- [Retrieval conceptual docs](https://python.langchain.com/v0.2/docs/concepts/#retrieval)" ] }, { diff --git a/docs/docs/integrations/vectorstores/redis.ipynb b/docs/docs/integrations/vectorstores/redis.ipynb index d2565beab59..6230bff240a 100644 --- a/docs/docs/integrations/vectorstores/redis.ipynb +++ b/docs/docs/integrations/vectorstores/redis.ipynb @@ -930,66 +930,13 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Chain usage\n", + "## Usage for retrieval-augmented generation\n", "\n", - "The code below shows how to use the vector store as a retriever in a simple RAG chain:\n", + "For guides on how to use this vector store for retrieval-augmented generation (RAG), see the following sections:\n", "\n", - "```{=mdx}\n", - "import ChatModelTabs from \"@theme/ChatModelTabs\";\n", - "\n", - "\n", - "```" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "metadata": {}, - "outputs": [], - "source": [ - "# | output: false\n", - "# | echo: false\n", - "from langchain_openai import ChatOpenAI\n", - "\n", - "llm = ChatOpenAI(model=\"gpt-4o-mini\")" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "'LangGraph is used for building stateful, agentic applications. It provides a framework to facilitate the development of such applications.'" - ] - }, - "execution_count": 18, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "from langchain import hub\n", - "from langchain_core.output_parsers import StrOutputParser\n", - "from langchain_core.runnables import RunnablePassthrough\n", - "\n", - "prompt = hub.pull(\"rlm/rag-prompt\")\n", - "\n", - "\n", - "def format_docs(docs):\n", - " return \"\\n\\n\".join(doc.page_content for doc in docs)\n", - "\n", - "\n", - "rag_chain = (\n", - " {\"context\": retriever | format_docs, \"question\": RunnablePassthrough()}\n", - " | prompt\n", - " | llm\n", - " | StrOutputParser()\n", - ")\n", - "\n", - "rag_chain.invoke(\"What is LangGraph used for?\")" + "- [Tutorials: working with external knowledge](https://python.langchain.com/v0.2/docs/tutorials/#working-with-external-knowledge)\n", + "- [How-to: Question and answer with RAG](https://python.langchain.com/v0.2/docs/how_to/#qa-with-rag)\n", + "- [Retrieval conceptual docs](https://python.langchain.com/v0.2/docs/concepts/#retrieval)" ] }, { diff --git a/libs/cli/langchain_cli/integration_template/docs/vectorstores.ipynb b/libs/cli/langchain_cli/integration_template/docs/vectorstores.ipynb index c78091133fb..f259710b093 100644 --- a/libs/cli/langchain_cli/integration_template/docs/vectorstores.ipynb +++ b/libs/cli/langchain_cli/integration_template/docs/vectorstores.ipynb @@ -288,45 +288,13 @@ "id": "901c75dc", "metadata": {}, "source": [ - "## Chain usage\n", + "## Usage for retrieval-augmented generation\n", "\n", - "The code below shows how to use the vector store as a retriever in a simple RAG chain:\n", + "For guides on how to use this vector store for retrieval-augmented generation (RAG), see the following sections:\n", "\n", - "```{=mdx}\n", - "import ChatModelTabs from \"@theme/ChatModelTabs\";\n", - "\n", - "\n", - "```" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "619b5ef6", - "metadata": {}, - "outputs": [], - "source": [ - "from langchain_openai import ChatOpenAI\n", - "from langchain import hub\n", - "from langchain_core.output_parsers import StrOutputParser\n", - "from langchain_core.runnables import RunnablePassthrough\n", - "\n", - "\n", - "llm = ChatOpenAI(model=\"gpt-3.5-turbo-0125\")\n", - "\n", - "prompt = hub.pull(\"rlm/rag-prompt\")\n", - "\n", - "def format_docs(docs):\n", - " return \"\\n\\n\".join(doc.page_content for doc in docs)\n", - "\n", - "rag_chain = (\n", - " {\"context\": retriever | format_docs, \"question\": RunnablePassthrough()}\n", - " | prompt\n", - " | llm\n", - " | StrOutputParser()\n", - ")\n", - "\n", - "rag_chain.invoke(\"thud\")" + "- [Tutorials: working with external knowledge](https://python.langchain.com/v0.2/docs/tutorials/#working-with-external-knowledge)\n", + "- [How-to: Question and answer with RAG](https://python.langchain.com/v0.2/docs/how_to/#qa-with-rag)\n", + "- [Retrieval conceptual docs](https://python.langchain.com/v0.2/docs/concepts/#retrieval)" ] }, {