From a6b8ff23bd4618911490e441c9a954ee89f641c2 Mon Sep 17 00:00:00 2001 From: fzowl <160063452+fzowl@users.noreply.github.com> Date: Thu, 25 Apr 2024 19:41:36 +0200 Subject: [PATCH] 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. --- .../document_transformers/voyageai-reranker.ipynb | 10 ++++++++-- docs/docs/integrations/text_embedding/voyageai.ipynb | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/docs/docs/integrations/document_transformers/voyageai-reranker.ipynb b/docs/docs/integrations/document_transformers/voyageai-reranker.ipynb index 0ffd6afb0d..8e32d3997b 100644 --- a/docs/docs/integrations/document_transformers/voyageai-reranker.ipynb +++ b/docs/docs/integrations/document_transformers/voyageai-reranker.ipynb @@ -84,7 +84,13 @@ }, "source": [ "## 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", "texts = text_splitter.split_documents(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", "\n", "query = \"What did the president say about Ketanji Brown Jackson\"\n", diff --git a/docs/docs/integrations/text_embedding/voyageai.ipynb b/docs/docs/integrations/text_embedding/voyageai.ipynb index 83cc9f38c1..adc53b7403 100644 --- a/docs/docs/integrations/text_embedding/voyageai.ipynb +++ b/docs/docs/integrations/text_embedding/voyageai.ipynb @@ -27,7 +27,13 @@ "id": "137cfde9-b88c-409a-9394-a9e31a6bf30d", "metadata": {}, "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": [], "source": [ "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", ")" ] },