mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-29 09:58:44 +00:00
docs: (minor) updates to voyage ai documentation (#19819)
**Description:** Updates to Voyage AI documentation **Issue:** Not Applicable **Dependencies:** None
This commit is contained in:
parent
ed49cca191
commit
b8271bbc4a
@ -77,7 +77,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "6fa3d916",
|
"id": "36b283af",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"jp-MarkdownHeadingCollapsed": true,
|
"jp-MarkdownHeadingCollapsed": true,
|
||||||
"tags": []
|
"tags": []
|
||||||
@ -310,13 +310,13 @@
|
|||||||
"from langchain_community.document_loaders import TextLoader\n",
|
"from langchain_community.document_loaders import TextLoader\n",
|
||||||
"from langchain_community.vectorstores import FAISS\n",
|
"from langchain_community.vectorstores import FAISS\n",
|
||||||
"from langchain_text_splitters import RecursiveCharacterTextSplitter\n",
|
"from langchain_text_splitters import RecursiveCharacterTextSplitter\n",
|
||||||
"from langchain_voyageai import VoyageEmbeddings\n",
|
"from langchain_voyageai import VoyageAIEmbeddings\n",
|
||||||
"\n",
|
"\n",
|
||||||
"documents = TextLoader(\"../../modules/state_of_the_union.txt\").load()\n",
|
"documents = TextLoader(\"../../modules/state_of_the_union.txt\").load()\n",
|
||||||
"text_splitter = RecursiveCharacterTextSplitter(chunk_size=500, chunk_overlap=100)\n",
|
"text_splitter = RecursiveCharacterTextSplitter(chunk_size=500, chunk_overlap=100)\n",
|
||||||
"texts = text_splitter.split_documents(documents)\n",
|
"texts = text_splitter.split_documents(documents)\n",
|
||||||
"retriever = FAISS.from_documents(\n",
|
"retriever = FAISS.from_documents(\n",
|
||||||
" texts, VoyageEmbeddings(model=\"voyage-2\")\n",
|
" texts, VoyageAIEmbeddings(model=\"voyage-2\")\n",
|
||||||
").as_retriever(search_kwargs={\"k\": 20})\n",
|
").as_retriever(search_kwargs={\"k\": 20})\n",
|
||||||
"\n",
|
"\n",
|
||||||
"query = \"What did the president say about Ketanji Brown Jackson\"\n",
|
"query = \"What did the president say about Ketanji Brown Jackson\"\n",
|
||||||
@ -326,11 +326,11 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "b7648612",
|
"id": "28f5da35",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"## Doing reranking with VoyageAIRerank\n",
|
"## Doing reranking with VoyageAIRerank\n",
|
||||||
"Now let's wrap our base retriever with a `ContextualCompressionRetriever`. We'll add an `VoyageAIRerank`, uses the Voyage AI rerank endpoint to rerank the returned results."
|
"Now let's wrap our base retriever with a `ContextualCompressionRetriever`. We'll use the Voyage AI reranker to rerank the returned results."
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -390,7 +390,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "b83dfedb",
|
"id": "aa8f3d24",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"You can of course use this retriever within a QA pipeline"
|
"You can of course use this retriever within a QA pipeline"
|
||||||
@ -457,7 +457,7 @@
|
|||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.11.3"
|
"version": "3.9.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nbformat": 4,
|
"nbformat": 4,
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
All functionality related to VoyageAI
|
All functionality related to VoyageAI
|
||||||
|
|
||||||
>[VoyageAI](https://www.voyageai.com/) Voyage AI builds embedding models, customized for your domain and company, for better retrieval quality.
|
>[VoyageAI](https://www.voyageai.com/) Voyage AI builds embedding models, customized for your domain and company, for better retrieval quality.
|
||||||
> customized for your domain and company, for better retrieval quality.
|
|
||||||
|
|
||||||
## Installation and Setup
|
## Installation and Setup
|
||||||
|
|
||||||
@ -12,7 +11,7 @@ Install the integration package with
|
|||||||
pip install langchain-voyageai
|
pip install langchain-voyageai
|
||||||
```
|
```
|
||||||
|
|
||||||
Get an VoyageAI api key and set it as an environment variable (`VOYAGE_API_KEY`)
|
Get a VoyageAI API key and set it as an environment variable (`VOYAGE_API_KEY`)
|
||||||
|
|
||||||
|
|
||||||
## Text Embedding Model
|
## Text Embedding Model
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
"\n",
|
"\n",
|
||||||
">[Voyage AI](https://www.voyageai.com/) provides cutting-edge embedding/vectorizations models.\n",
|
">[Voyage AI](https://www.voyageai.com/) provides cutting-edge embedding/vectorizations models.\n",
|
||||||
"\n",
|
"\n",
|
||||||
"Let's load the Voyage Embedding class. (Install the LangChain partner package with `pip install langchain-voyageai`)"
|
"Let's load the Voyage AI Embedding class. (Install the LangChain partner package with `pip install langchain-voyageai`)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -219,7 +219,7 @@
|
|||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.10.12"
|
"version": "3.9.6"
|
||||||
},
|
},
|
||||||
"vscode": {
|
"vscode": {
|
||||||
"interpreter": {
|
"interpreter": {
|
||||||
|
Loading…
Reference in New Issue
Block a user