From 4c48732f946b562918def70b3988b4bc93d19276 Mon Sep 17 00:00:00 2001 From: Leonid Ganeline Date: Mon, 13 May 2024 08:54:51 -0700 Subject: [PATCH] docs: `providers` updates 1 (#20256) - Proviers pages: added missed integrations; fixed format - `mistralai` converted from notebook to .mdx format --- .../docs/integrations/platforms/anthropic.mdx | 53 ++++++------- docs/docs/integrations/platforms/aws.mdx | 23 ++++++ .../docs/integrations/platforms/microsoft.mdx | 18 +++++ docs/docs/integrations/providers/ai21.mdx | 27 ++++++- docs/docs/integrations/providers/baidu.mdx | 8 ++ .../integrations/providers/google_serper.mdx | 1 + .../integrations/providers/mistralai.ipynb | 78 ------------------- .../docs/integrations/providers/mistralai.mdx | 34 ++++++++ docs/docs/integrations/providers/nuclia.mdx | 53 +++++++++++-- 9 files changed, 184 insertions(+), 111 deletions(-) delete mode 100644 docs/docs/integrations/providers/mistralai.ipynb create mode 100644 docs/docs/integrations/providers/mistralai.mdx diff --git a/docs/docs/integrations/platforms/anthropic.mdx b/docs/docs/integrations/platforms/anthropic.mdx index c6dda145e56..456b158d133 100644 --- a/docs/docs/integrations/platforms/anthropic.mdx +++ b/docs/docs/integrations/platforms/anthropic.mdx @@ -1,43 +1,44 @@ # Anthropic -All functionality related to Anthropic models. +>[Anthropic](https://www.anthropic.com/) is an AI safety and research company, and is the creator of `Claude`. +This page covers all integrations between `Anthropic` models and `LangChain`. -[Anthropic](https://www.anthropic.com/) is an AI safety and research company, and is the creator of Claude. -This page covers all integrations between Anthropic models and LangChain. +## Installation and Setup -## Installation +To use `Anthropic` models, you need to install a python package: -To use Anthropic models, you will need to install the `langchain-anthropic` package. -You can do this with the following command: - -``` -pip install langchain-anthropic +```bash +pip install -U langchain-anthropic ``` -## Environment Setup - -To use Anthropic models, you will need to set the `ANTHROPIC_API_KEY` environment variable. +You need to set the `ANTHROPIC_API_KEY` environment variable. You can get an Anthropic API key [here](https://console.anthropic.com/settings/keys) -## `ChatAnthropic` +## LLMs -`ChatAnthropic` is a subclass of LangChain's `ChatModel`. -You can import this wrapper with the following code: +### [Legacy] AnthropicLLM -``` -from langchain_anthropic import ChatAnthropic -model = ChatAnthropic(model='claude-3-opus-20240229') -``` +**NOTE**: `AnthropicLLM` only supports legacy `Claude 2` models. +To use the newest `Claude 3` models, please use `ChatAnthropic` instead. -Read more in the [ChatAnthropic documentation](/docs/integrations/chat/anthropic). - -## [Legacy] `AnthropicLLM` - -`AnthropicLLM` is a subclass of LangChain's `LLM`. It is a wrapper around Anthropic's -text-based completion endpoints. +See a [usage example](/docs/integrations/llms/anthropic). ```python from langchain_anthropic import AnthropicLLM model = AnthropicLLM(model='claude-2.1') -``` \ No newline at end of file +``` + +## Chat Models + +### ChatAnthropic + +See a [usage example](/docs/integrations/chat/anthropic). + +```python +from langchain_anthropic import ChatAnthropic + +model = ChatAnthropic(model='claude-3-opus-20240229') +``` + + diff --git a/docs/docs/integrations/platforms/aws.mdx b/docs/docs/integrations/platforms/aws.mdx index 8f83e388e59..785819dfba7 100644 --- a/docs/docs/integrations/platforms/aws.mdx +++ b/docs/docs/integrations/platforms/aws.mdx @@ -268,6 +268,29 @@ See a [usage example](/docs/integrations/memory/aws_dynamodb). from langchain.memory import DynamoDBChatMessageHistory ``` +## Graphs + +### Amazon Neptune with Cypher + +See a [usage example](/docs/integrations/graphs/amazon_neptune_open_cypher). + +```python +from langchain_community.graphs import NeptuneGraph +from langchain_community.graphs import NeptuneAnalyticsGraph +from langchain.chains import NeptuneOpenCypherQAChain +``` + +### Amazon Neptune with SPARQL + +See a [usage example](/docs/integrations/graphs/amazon_neptune_sparql). + +```python +from langchain_community.graphs import NeptuneRdfGraph +from langchain.chains.graph_qa.neptune_sparql import NeptuneSparqlQAChain +``` + + + ## Callbacks ### SageMaker Tracking diff --git a/docs/docs/integrations/platforms/microsoft.mdx b/docs/docs/integrations/platforms/microsoft.mdx index bec5df40502..10364c07328 100644 --- a/docs/docs/integrations/platforms/microsoft.mdx +++ b/docs/docs/integrations/platforms/microsoft.mdx @@ -317,6 +317,24 @@ from langchain_community.agent_toolkits import PowerBIToolkit from langchain_community.utilities.powerbi import PowerBIDataset ``` + +## Graphs + +### Azure Cosmos DB for Apache Gremlin + +We need to install a python package. + +```bash +pip install gremlinpython +``` + +See a [usage example](/docs/integrations/graphs/azure_cosmosdb_gremlin). + +```python +from langchain_community.graphs import GremlinGraph +from langchain_community.graphs.graph_document import GraphDocument, Node, Relationship +``` + ## Utilities ### Bing Search API diff --git a/docs/docs/integrations/providers/ai21.mdx b/docs/docs/integrations/providers/ai21.mdx index 6218095e45b..60a925363b1 100644 --- a/docs/docs/integrations/providers/ai21.mdx +++ b/docs/docs/integrations/providers/ai21.mdx @@ -19,13 +19,26 @@ pip install langchain-ai21 See a [usage example](/docs/integrations/llms/ai21). +### AI21 LLM + ```python -from langchain_community.llms import AI21 +from langchain_ai21 import AI21LLM +``` + +### AI21 Contextual Answer + +You can use AI21’s contextual answers model to receive text or document, +serving as a context, and a question and return an answer based entirely on this context. + +```python +from langchain_ai21 import AI21ContextualAnswers ``` ## Chat models +### AI21 Chat + See a [usage example](/docs/integrations/chat/ai21). ```python @@ -34,9 +47,21 @@ from langchain_ai21 import ChatAI21 ## Embedding models +### AI21 Embeddings + See a [usage example](/docs/integrations/text_embedding/ai21). ```python from langchain_ai21 import AI21Embeddings ``` +## Text splitters + +### AI21 Semantic Text Splitter + +See a [usage example](/docs/integrations/document_transformers/ai21_semantic_text_splitter). + +```python +from langchain_ai21 import AI21SemanticTextSplitter +``` + diff --git a/docs/docs/integrations/providers/baidu.mdx b/docs/docs/integrations/providers/baidu.mdx index 20cc3a5c763..f39ce57bf54 100644 --- a/docs/docs/integrations/providers/baidu.mdx +++ b/docs/docs/integrations/providers/baidu.mdx @@ -48,3 +48,11 @@ See a [usage example](/docs/integrations/vectorstores/baiducloud_vector_search). ```python from langchain_community.vectorstores import BESVectorStore ``` + +### Baidu VectorDB + +See a [usage example](/docs/integrations/vectorstores/baiduvectordb). + +```python +from langchain_community.vectorstores import BaiduVectorDB +``` diff --git a/docs/docs/integrations/providers/google_serper.mdx b/docs/docs/integrations/providers/google_serper.mdx index f097a833fc3..535b0871709 100644 --- a/docs/docs/integrations/providers/google_serper.mdx +++ b/docs/docs/integrations/providers/google_serper.mdx @@ -4,6 +4,7 @@ This page covers how to use the [Serper](https://serper.dev) Google Search API w It is broken into two parts: setup, and then references to the specific Google Serper wrapper. ## Setup + - Go to [serper.dev](https://serper.dev) to sign up for a free account - Get the api key and set it as an environment variable (`SERPER_API_KEY`) diff --git a/docs/docs/integrations/providers/mistralai.ipynb b/docs/docs/integrations/providers/mistralai.ipynb deleted file mode 100644 index 561751f20c5..00000000000 --- a/docs/docs/integrations/providers/mistralai.ipynb +++ /dev/null @@ -1,78 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# MistralAI\n", - "\n", - "Mistral AI is a platform that offers hosting for their powerful open source models.\n", - "\n", - "You can access them via their [API](https://docs.mistral.ai/api/).\n", - "\n", - "A valid [API key](https://console.mistral.ai/users/api-keys/) is needed to communicate with the API.\n", - "\n", - "You will also need the `langchain-mistralai` package:" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "%pip install -qU langchain-core langchain-mistralai" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "id": "y8ku6X96sebl" - }, - "outputs": [], - "source": [ - "from langchain_mistralai import ChatMistralAI, MistralAIEmbeddings" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "See the docs for their\n", - "\n", - "- [Chat Model](/docs/integrations/chat/mistralai)\n", - "- [Embeddings Model](/docs/integrations/text_embedding/mistralai)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [] - } - ], - "metadata": { - "colab": { - "provenance": [] - }, - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.10.11" - } - }, - "nbformat": 4, - "nbformat_minor": 1 -} diff --git a/docs/docs/integrations/providers/mistralai.mdx b/docs/docs/integrations/providers/mistralai.mdx new file mode 100644 index 00000000000..ba6790aabfc --- /dev/null +++ b/docs/docs/integrations/providers/mistralai.mdx @@ -0,0 +1,34 @@ +# MistralAI + +>[Mistral AI](https://docs.mistral.ai/api/) is a platform that offers hosting for their powerful open source models. + + +## Installation and Setup + +A valid [API key](https://console.mistral.ai/users/api-keys/) is needed to communicate with the API. + +You will also need the `langchain-mistralai` package: + +```bash +pip install langchain-mistralai +``` + +## Chat models + +### ChatMistralAI + +See a [usage example](/docs/integrations/chat/mistralai). + +```python +from langchain_mistralai.chat_models import ChatMistralAI +``` + +## Embedding models + +### MistralAIEmbeddings + +See a [usage example](/docs/integrations/text_embedding/mistralai). + +```python +from langchain_mistralai import MistralAIEmbeddings +``` diff --git a/docs/docs/integrations/providers/nuclia.mdx b/docs/docs/integrations/providers/nuclia.mdx index 412f683f707..91daeb6a5a2 100644 --- a/docs/docs/integrations/providers/nuclia.mdx +++ b/docs/docs/integrations/providers/nuclia.mdx @@ -4,21 +4,28 @@ > and external source, providing optimized search results and generative answers. > It can handle video and audio transcription, image content extraction, and document parsing. ->`Nuclia Understanding API` document transformer splits text into paragraphs and sentences, -> identifies entities, provides a summary of the text and generates embeddings for all the sentences. ## Installation and Setup -We need to install the `nucliadb-protos` package to use the `Nuclia Understanding API`. +We need to install the `nucliadb-protos` package to use the `Nuclia Understanding API` + ```bash pip install nucliadb-protos ``` -To use the `Nuclia Understanding API`, we need to have a `Nuclia account`. +We need to have a `Nuclia account`. We can create one for free at [https://nuclia.cloud](https://nuclia.cloud), and then [create a NUA key](https://docs.nuclia.dev/docs/docs/using/understanding/intro). + +## Document Transformer + +### Nuclia + +>`Nuclia Understanding API` document transformer splits text into paragraphs and sentences, +> identifies entities, provides a summary of the text and generates embeddings for all the sentences. + To use the Nuclia document transformer, we need to instantiate a `NucliaUnderstandingAPI` tool with `enable_ml` set to `True`: @@ -28,10 +35,44 @@ from langchain_community.tools.nuclia import NucliaUnderstandingAPI nua = NucliaUnderstandingAPI(enable_ml=True) ``` -## Document Transformer - See a [usage example](/docs/integrations/document_transformers/nuclia_transformer). ```python from langchain_community.document_transformers.nuclia_text_transform import NucliaTextTransformer ``` + +## Document Loaders + +### Nuclea loader + +See a [usage example](/docs/integrations/document_loaders/nuclia). + +```python +from langchain_community.document_loaders.nuclia import NucliaLoader +``` + +## Vector store + +### NucliaDB + +We need to install a python package: + +```bash +pip install nuclia +``` + +See a [usage example](/docs/integrations/vectorstores/nucliadb). + +```python +from langchain_community.vectorstores.nucliadb import NucliaDB +``` + +## Tools + +### Nuclia Understanding + +See a [usage example](/docs/integrations/tools/nuclia). + +```python +from langchain_community.tools.nuclia import NucliaUnderstandingAPI +```