mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-23 15:19:33 +00:00
docs: Use voyage-law-2 in the examples (#20784)
Thank you for contributing to LangChain! - [x] **PR title**: "package: description" - Where "package" is whichever of langchain, community, core, experimental, etc. is being modified. Use "docs: ..." for purely docs changes, "templates: ..." for template changes, "infra: ..." for CI changes. - Example: "community: add foobar LLM" **Description:** In VoyageAI text-embedding examples use voyage-law-2 model - [x] **Add tests and docs**: If you're adding a new integration, please include 1. a test for the integration, preferably unit tests that do not rely on network access, 2. an example notebook showing its use. It lives in `docs/docs/integrations` directory. - [x] **Lint and test**: Run `make format`, `make lint` and `make test` from the root of the package(s) you've modified. See contribution guidelines for more: https://python.langchain.com/docs/contributing/ Additional guidelines: - Make sure optional dependencies are imported within a function. - Please do not add dependencies to pyproject.toml files (even optional ones) unless they are required for unit tests. - Most PRs should not touch more than one package. - Changes should be backwards compatible. - If you are adding something to community, do not re-import it in langchain. If no one reviews your PR within a few days, please @-mention one of baskaryan, efriis, eyurtsev, hwchase17.
This commit is contained in:
parent
eca3640af7
commit
a6b8ff23bd
@ -84,7 +84,13 @@
|
|||||||
},
|
},
|
||||||
"source": [
|
"source": [
|
||||||
"## Set up the base vector store retriever\n",
|
"## Set up the base vector store retriever\n",
|
||||||
"Let's start by initializing a simple vector store retriever and storing the 2023 State of the Union speech (in chunks). We can set up the retriever to retrieve a high number (20) of docs."
|
"Let's start by initializing a simple vector store retriever and storing the 2023 State of the Union speech (in chunks). We can set up the retriever to retrieve a high number (20) of docs. You can use any of the following Embeddings models: ([source](https://docs.voyageai.com/docs/embeddings)):\n",
|
||||||
|
"\n",
|
||||||
|
"- `voyage-large-2` (default)\n",
|
||||||
|
"- `voyage-code-2`\n",
|
||||||
|
"- `voyage-2`\n",
|
||||||
|
"- `voyage-law-2`\n",
|
||||||
|
"- `voyage-lite-02-instruct`"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -316,7 +322,7 @@
|
|||||||
"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, VoyageAIEmbeddings(model=\"voyage-2\")\n",
|
" texts, VoyageAIEmbeddings(model=\"voyage-law-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",
|
||||||
|
@ -27,7 +27,13 @@
|
|||||||
"id": "137cfde9-b88c-409a-9394-a9e31a6bf30d",
|
"id": "137cfde9-b88c-409a-9394-a9e31a6bf30d",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"Voyage AI utilizes API keys to monitor usage and manage permissions. To obtain your key, create an account on our [homepage](https://www.voyageai.com). Then, create a VoyageEmbeddings model with your API key. Please refer to the documentation for further details on the available models: https://docs.voyageai.com/embeddings/"
|
"Voyage AI utilizes API keys to monitor usage and manage permissions. To obtain your key, create an account on our [homepage](https://www.voyageai.com). Then, create a VoyageEmbeddings model with your API key. You can use any of the following models: ([source](https://docs.voyageai.com/docs/embeddings)):\n",
|
||||||
|
"\n",
|
||||||
|
"- `voyage-large-2` (default)\n",
|
||||||
|
"- `voyage-code-2`\n",
|
||||||
|
"- `voyage-2`\n",
|
||||||
|
"- `voyage-law-2`\n",
|
||||||
|
"- `voyage-lite-02-instruct`"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -38,7 +44,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"embeddings = VoyageAIEmbeddings(\n",
|
"embeddings = VoyageAIEmbeddings(\n",
|
||||||
" voyage_api_key=\"[ Your Voyage API key ]\", model=\"voyage-2\"\n",
|
" voyage_api_key=\"[ Your Voyage API key ]\", model=\"voyage-law-2\"\n",
|
||||||
")"
|
")"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user