seansullivan/Langchain-Docs huggingface dataset:
This page covers how to use the `Dataherald API` within LangChain.

There exists a DataheraldAPIWrapper utility which wraps this API. To import this utility:

```
from langchain_community.utilities.dataherald import DataheraldAPIWrapperfrom langchain_community.tools.dataherald.tool import DataheraldTextToSQLfrom langchain_openai import ChatOpenAIfrom langchain import hubfrom langchain.agents import AgentExecutor, create_react_agent, load_toolsapi_wrapper = DataheraldAPIWrapper(db_connection_id="<db_connection_id>")tool = DataheraldTextToSQL(api_wrapper=api_wrapper)llm = ChatOpenAI(model="gpt-3.5-turbo", temperature=0)prompt = hub.pull("hwchase17/react")agent = create_react_agent(llm, tools, prompt)agent_executor = AgentExecutor(agent=agent, tools=tools, verbose=True)agent_executor.invoke({"input":"Return the sql for this question: How many employees are in the company?"})
```
This page covers how to use the [DeepSparse](https://github.com/neuralmagic/deepsparse) inference runtime within LangChain. It is broken into two parts: installation and setup, and then examples of DeepSparse usage.

```
config = {'max_generated_tokens': 256}llm = DeepSparse(model='zoo:nlg/text_generation/codegen_mono-350m/pytorch/huggingface/bigpython_bigquery_thepile/base-none', config=config)
```
GROBID is a machine learning library for extracting, parsing, and re-structuring raw documents.

It is designed and expected to be used to parse academic papers, where it works particularly well.

_Note_: if the articles supplied to Grobid are large documents (e.g. dissertations) exceeding a certain number of elements, they might not be processed.

This page covers how to use the Grobid to parse articles for LangChain.

Once grobid is installed and up and running (you can check by accessing it http://localhost:8070), you're ready to go.

```
from langchain_community.document_loaders.parsers import GrobidParserfrom langchain_community.document_loaders.generic import GenericLoader#Produce chunks from article paragraphsloader = GenericLoader.from_filesystem(    "/Users/31treehaus/Desktop/Papers/",    glob="*",    suffixes=[".pdf"],    parser= GrobidParser(segment_sentences=False))docs = loader.load()#Produce chunks from article sentencesloader = GenericLoader.from_filesystem(    "/Users/31treehaus/Desktop/Papers/",    glob="*",    suffixes=[".pdf"],    parser= GrobidParser(segment_sentences=True))docs = loader.load()
```
[Diffbot](https://docs.diffbot.com/docs) is a service to read web pages. Unlike traditional web scraping tools, `Diffbot` doesn't require any rules to read the content on a page. It starts with computer vision, which classifies a page into one of 20 possible types. Content is then interpreted by a machine learning model trained to identify the key attributes on a page based on its type. The result is a website transformed into clean-structured data (like JSON or CSV), ready for your application.

```
from langchain_community.document_loaders import DiffbotLoader
```
Welcome to Groq! 🚀 At Groq, we've developed the world's first Language Processing Unit™, or LPU. The Groq LPU has a deterministic, single core streaming architecture that sets the standard for GenAI inference speed with predictable and repeatable performance for any given workload.

Beyond the architecture, our software is designed to empower developers like you with the tools you need to create innovative, powerful AI applications. With Groq as your engine, you can:

Want more Groq? Check out our [website](https://groq.com/) for more resources and join our [Discord community](https://discord.gg/JvNsBDKeCG) to connect with our developers!

```
pip install langchain-groq
```
[Discord](https://discord.com/) is a VoIP and instant messaging social platform. Users have the ability to communicate with voice calls, video calls, text messaging, media and files in private chats or as part of communities called "servers". A server is a collection of persistent chat rooms and voice channels which can be accessed via invite links.

It might take 30 days for you to receive your data. You'll receive an email at the address which is registered with Discord. That email will have a download button using which you would be able to download your personal Discord data.

**NOTE:** The `DiscordChatLoader` is not the `ChatLoader` but a `DocumentLoader`. It is used to load the data from the `Discord` data dump. For the `ChatLoader` see Chat Loader section below.

```
from langchain_community.document_loaders import DiscordChatLoader
```
[DocArray](https://docarray.jina.ai/) is a library for nested, unstructured, multimodal data in transit, including text, image, audio, video, 3D mesh, etc. It allows deep-learning engineers to efficiently process, embed, search, recommend, store, and transfer multimodal data with a Pythonic API.

We need to install `docarray` python package.

LangChain provides an access to the `In-memory` and `HNSW` vector stores from the `DocArray` library.

```
from langchain_community.vectorstores DocArrayHnswSearch
```
[Doctran](https://github.com/psychic-api/doctran) is a python package. It uses LLMs and open-source NLP libraries to transform raw text into clean, structured, information-dense documents that are optimized for vector space retrieval. You can think of `Doctran` as a black box where messy strings go in and nice, clean, labelled strings come out.

```
from langchain_community.document_loaders import DoctranQATransformer
```
## Hacker News

> [Hacker News](https://en.wikipedia.org/wiki/Hacker_News) (sometimes abbreviated as `HN`) is a social news website focusing on computer science and entrepreneurship. It is run by the investment fund and startup incubator `Y Combinator`. In general, content that can be submitted is defined as "anything that gratifies one's intellectual curiosity."

## Installation and Setup[​](#installation-and-setup "Direct link to Installation and Setup")

There isn't any special setup for it.

## Document Loader[​](#document-loader "Direct link to Document Loader")

See a [usage example](https://python.langchain.com/docs/integrations/document_loaders/hacker_news/).

```
from langchain_community.document_loaders import HNLoader
```

* * *

#### Help us out by providing feedback on this documentation page:
Helicone is an [open-source](https://github.com/Helicone/helicone) observability platform that proxies your OpenAI traffic and provides you key insights into your spend, latency and usage.

With your LangChain environment you can just add the following parameter.

Now head over to [helicone.ai](https://www.helicone.ai/signup) to create your account, and add your OpenAI API key within our dashboard to view your logs.

```
from langchain_openai import OpenAIimport openaiopenai.api_base = "https://oai.hconeai.com/v1"llm = OpenAI(temperature=0.9, headers={        "Helicone-Property-Session": "24",        "Helicone-Property-Conversation": "support_issue_2",        "Helicone-Property-App": "mobile",      })text = "What is a helicone?"print(llm(text))
```
## Docugami

> [Docugami](https://docugami.com/) converts business documents into a Document XML Knowledge Graph, generating forests of XML semantic trees representing entire documents. This is a rich representation that includes the semantic and structural characteristics of various chunks in the document as an XML tree.

## Installation and Setup[​](#installation-and-setup "Direct link to Installation and Setup")

```
pip install dgml-utilspip install docugami-langchain
```

## Document Loader[​](#document-loader "Direct link to Document Loader")

See a [usage example](https://python.langchain.com/docs/integrations/document_loaders/docugami/).

```
from docugami_langchain.document_loaders import DocugamiLoader
```

* * *

#### Help us out by providing feedback on this documentation page:
This page covers how to use the Hazy Research ecosystem within LangChain. It is broken into two parts: installation and setup, and then references to specific Hazy Research wrappers.

There exists an LLM wrapper around Hazy Research's `manifest` library. `manifest` is a python library which is itself a wrapper around many model providers, and adds in caching, history, and more.

```
from langchain_community.llms.manifest import ManifestWrapper
```
## Docusaurus

> [Docusaurus](https://docusaurus.io/) is a static-site generator which provides out-of-the-box documentation features.

## Installation and Setup[​](#installation-and-setup "Direct link to Installation and Setup")

```
pip install -U beautifulsoup4 lxml
```

## Document Loader[​](#document-loader "Direct link to Document Loader")

See a [usage example](https://python.langchain.com/docs/integrations/document_loaders/docusaurus/).

```
from langchain_community.document_loaders import DocusaurusLoader
```

* * *

#### Help us out by providing feedback on this documentation page:
[Hologres](https://www.alibabacloud.com/help/en/hologres/latest/introduction) is a unified real-time data warehousing service developed by Alibaba Cloud. You can use Hologres to write, update, process, and analyze large amounts of data in real time. `Hologres` supports standard `SQL` syntax, is compatible with `PostgreSQL`, and supports most PostgreSQL functions. Hologres supports online analytical processing (OLAP) and ad hoc analysis for up to petabytes of data, and provides high-concurrency and low-latency online data services.

```
pip install hologres-vector
```
## Dropbox

> [Dropbox](https://en.wikipedia.org/wiki/Dropbox) is a file hosting service that brings everything-traditional files, cloud content, and web shortcuts together in one place.

## Installation and Setup[​](#installation-and-setup "Direct link to Installation and Setup")

See the detailed [installation guide](https://python.langchain.com/docs/integrations/document_loaders/dropbox/#prerequisites).

## Document Loader[​](#document-loader "Direct link to Document Loader")

See a [usage example](https://python.langchain.com/docs/integrations/document_loaders/dropbox/).

```
from langchain_community.document_loaders import DropboxLoader
```

* * *

#### Help us out by providing feedback on this documentation page:
## Huawei

> [Huawei Technologies Co., Ltd.](https://www.huawei.com/) is a Chinese multinational digital communications technology corporation.
> 
> [Huawei Cloud](https://www.huaweicloud.com/intl/en-us/product/) provides a comprehensive suite of global cloud computing services.

## Installation and Setup[​](#installation-and-setup "Direct link to Installation and Setup")

To access the `Huawei Cloud`, you need an access token.

You also have to install a python library:

```
pip install -U esdk-obs-python
```

## Document Loader[​](#document-loader "Direct link to Document Loader")

### Huawei OBS Directory[​](#huawei-obs-directory "Direct link to Huawei OBS Directory")

See a [usage example](https://python.langchain.com/docs/integrations/document_loaders/huawei_obs_directory/).

```
from langchain_community.document_loaders import OBSDirectoryLoader
```

### Huawei OBS File[​](#huawei-obs-file "Direct link to Huawei OBS File")

See a [usage example](https://python.langchain.com/docs/integrations/document_loaders/huawei_obs_file/).

```
from langchain_community.document_loaders.obs_file import OBSFileLoader
```

* * *

#### Help us out by providing feedback on this documentation page:
## IBM

The `LangChain` integrations related to [IBM watsonx.ai](https://www.ibm.com/products/watsonx-ai) platform.

IBM® watsonx.ai™ AI studio is part of the IBM [watsonx](https://www.ibm.com/watsonx)™ AI and data platform, bringing together new generative AI capabilities powered by [foundation models](https://www.ibm.com/products/watsonx-ai/foundation-models) and traditional machine learning (ML) into a powerful studio spanning the AI lifecycle. Tune and guide models with your enterprise data to meet your needs with easy-to-use tools for building and refining performant prompts. With watsonx.ai, you can build AI applications in a fraction of the time and with a fraction of the data. Watsonx.ai offers:

*   **Multi-model variety and flexibility:** Choose from IBM-developed, open-source and third-party models, or build your own model.
*   **Differentiated client protection:** IBM stands behind IBM-developed models and indemnifies the client against third-party IP claims.
*   **End-to-end AI governance:** Enterprises can scale and accelerate the impact of AI with trusted data across the business, using data wherever it resides.
*   **Hybrid, multi-cloud deployments:** IBM provides the flexibility to integrate and deploy your AI workloads into your hybrid-cloud stack of choice.

## Installation and Setup[​](#installation-and-setup "Direct link to Installation and Setup")

Install the integration package with

```
pip install -qU langchain-ibm
```

Get an IBM watsonx.ai api key and set it as an environment variable (`WATSONX_APIKEY`)

```
import osos.environ["WATSONX_APIKEY"] = "your IBM watsonx.ai api key"
```

## LLMs[​](#llms "Direct link to LLMs")

### WatsonxLLM[​](#watsonxllm "Direct link to WatsonxLLM")

See a [usage example](https://python.langchain.com/docs/integrations/llms/ibm_watsonx/).

```
from langchain_ibm import WatsonxLLM
```

## Embedding Models[​](#embedding-models "Direct link to Embedding Models")

### WatsonxEmbeddings[​](#watsonxembeddings "Direct link to WatsonxEmbeddings")

See a [usage example](https://python.langchain.com/docs/integrations/text_embedding/ibm_watsonx/).

```
from langchain_ibm import WatsonxEmbeddings
```
## iFixit

> [iFixit](https://www.ifixit.com/) is the largest, open repair community on the web. The site contains nearly 100k repair manuals, 200k Questions & Answers on 42k devices, and all the data is licensed under `CC-BY-NC-SA 3.0`.

## Installation and Setup[​](#installation-and-setup "Direct link to Installation and Setup")

There isn't any special setup for it.

## Document Loader[​](#document-loader "Direct link to Document Loader")

See a [usage example](https://python.langchain.com/docs/integrations/document_loaders/ifixit/).

```
from langchain_community.document_loaders import IFixitLoader
```
Exa’s search integration exists in its own [partner package](https://pypi.org/project/langchain-exa/). You can install it with:

```
%pip install -qU langchain-exa
```

In order to use the package, you will also need to set the `EXA_API_KEY` environment variable to your Exa API key.

You can use the [`ExaSearchRetriever`](https://python.langchain.com/docs/integrations/tools/exa_search/#using-exasearchretriever) in a standard retrieval pipeline. You can import it as follows
## Eden AI

> [Eden AI](https://docs.edenai.co/docs/getting-started-with-eden-ai) user interface (UI) is designed for handling the AI projects. With `Eden AI Portal`, you can perform no-code AI using the best engines for the market.

## Installation and Setup[​](#installation-and-setup "Direct link to Installation and Setup")

Accessing the Eden AI API requires an API key, which you can get by [creating an account](https://app.edenai.run/user/register) and heading [here](https://app.edenai.run/admin/account/settings).

## LLMs[​](#llms "Direct link to LLMs")

See a [usage example](https://python.langchain.com/docs/integrations/llms/edenai/).

```
from langchain_community.llms import EdenAI
```

## Chat models[​](#chat-models "Direct link to Chat models")

See a [usage example](https://python.langchain.com/docs/integrations/chat/edenai/).

```
from langchain_community.chat_models.edenai import ChatEdenAI
```

## Embedding models[​](#embedding-models "Direct link to Embedding models")

See a [usage example](https://python.langchain.com/docs/integrations/text_embedding/edenai/).

```
from langchain_community.embeddings.edenai import EdenAiEmbeddings
```

Eden AI provides a list of tools that grants your Agent the ability to do multiple tasks, such as:

*   speech to text
*   text to speech
*   text explicit content detection
*   image explicit content detection
*   object detection
*   OCR invoice parsing
*   OCR ID parsing

See a [usage example](https://python.langchain.com/docs/integrations/tools/edenai_tools/).

```
from langchain_community.tools.edenai import (    EdenAiExplicitImageTool,    EdenAiObjectDetectionTool,    EdenAiParsingIDTool,    EdenAiParsingInvoiceTool,    EdenAiSpeechToTextTool,    EdenAiTextModerationTool,    EdenAiTextToSpeechTool,)
```

* * *

#### Help us out by providing feedback on this documentation page:
[ElevenLabs](https://elevenlabs.io/about) is a voice AI research & deployment company with a mission to make content universally accessible in any language & voice.

`ElevenLabs` creates the most realistic, versatile and contextually-aware AI audio, providing the ability to generate speech in hundreds of new and existing voices in 29 languages.

First, you need to set up an ElevenLabs account. You can follow the [instructions here](https://docs.elevenlabs.io/welcome/introduction).

```
from langchain_community.tools import ElevenLabsText2SpeechTool
```
This page covers how to use [Epsilla](https://github.com/epsilla-cloud/vectordb) within LangChain. It is broken into two parts: installation and setup, and then references to specific Epsilla wrappers.

There exists a wrapper around Epsilla vector databases, allowing you to use it as a vectorstore, whether for semantic search or example selection.

```
from langchain_community.vectorstores import Epsilla
```
## Elasticsearch

> [Elasticsearch](https://www.elastic.co/elasticsearch/) is a distributed, RESTful search and analytics engine. It provides a distributed, multi-tenant-capable full-text search engine with an HTTP web interface and schema-free JSON documents.

## Installation and Setup[​](#installation-and-setup "Direct link to Installation and Setup")

There are two ways to get started with Elasticsearch:

#### Install Elasticsearch on your local machine via docker[​](#install-elasticsearch-on-your-local-machine-via-docker "Direct link to Install Elasticsearch on your local machine via docker")

Example: Run a single-node Elasticsearch instance with security disabled. This is not recommended for production use.

```
    docker run -p 9200:9200 -e "discovery.type=single-node" -e "xpack.security.enabled=false" -e "xpack.security.http.ssl.enabled=false" docker.elastic.co/elasticsearch/elasticsearch:8.9.0
```

#### Deploy Elasticsearch on Elastic Cloud[​](#deploy-elasticsearch-on-elastic-cloud "Direct link to Deploy Elasticsearch on Elastic Cloud")

Elastic Cloud is a managed Elasticsearch service. Signup for a [free trial](https://cloud.elastic.co/registration?utm_source=langchain&utm_content=documentation).

### Install Client[​](#install-client "Direct link to Install Client")

```
pip install elasticsearchpip install langchain-elasticsearch
```

## Embedding models[​](#embedding-models "Direct link to Embedding models")

See a [usage example](https://python.langchain.com/docs/integrations/text_embedding/elasticsearch/).

```
from langchain_elasticsearch.embeddings import ElasticsearchEmbeddings
```

## Vector store[​](#vector-store "Direct link to Vector store")

See a [usage example](https://python.langchain.com/docs/integrations/vectorstores/elasticsearch/).

```
from langchain_elasticsearch.vectorstores import ElasticsearchStore
```

## Memory[​](#memory "Direct link to Memory")

See a [usage example](https://python.langchain.com/docs/integrations/memory/elasticsearch_chat_message_history/).

```
from langchain_elasticsearch.chat_history import ElasticsearchChatMessageHistory
```

* * *

#### Help us out by providing feedback on this documentation page:
## IMSDb

> [IMSDb](https://imsdb.com/) is the `Internet Movie Script Database`.
> 
> ## Installation and Setup[​](#installation-and-setup "Direct link to Installation and Setup")

There isn't any special setup for it.

## Document Loader[​](#document-loader "Direct link to Document Loader")

See a [usage example](https://python.langchain.com/docs/integrations/document_loaders/imsdb/).

```
from langchain_community.document_loaders import IMSDbLoader
```

* * *

#### Help us out by providing feedback on this documentation page:
## Etherscan

> [Etherscan](https://docs.etherscan.io/) is the leading blockchain explorer, search, API and analytics platform for `Ethereum`, a decentralized smart contracts platform.

## Installation and Setup[​](#installation-and-setup "Direct link to Installation and Setup")

See the detailed [installation guide](https://python.langchain.com/docs/integrations/document_loaders/etherscan/).

## Document Loader[​](#document-loader "Direct link to Document Loader")

See a [usage example](https://python.langchain.com/docs/integrations/document_loaders/etherscan/).

```
from langchain_community.document_loaders import EtherscanLoader
```

* * *

#### Help us out by providing feedback on this documentation page:
## Fiddler

> [Fiddler](https://www.fiddler.ai/) provides a unified platform to monitor, explain, analyze, and improve ML deployments at an enterprise scale.

## Installation and Setup[​](#installation-and-setup "Direct link to Installation and Setup")

Set up your model [with Fiddler](https://demo.fiddler.ai/):

*   The URL you're using to connect to Fiddler
*   Your organization ID
*   Your authorization token

Install the Python package:

```
pip install fiddler-client
```

## Callbacks[​](#callbacks "Direct link to Callbacks")

```
from langchain_community.callbacks.fiddler_callback import FiddlerCallbackHandler
```

See an [example](https://python.langchain.com/docs/integrations/callbacks/fiddler/).

* * *

#### Help us out by providing feedback on this documentation page:
## Fireworks

This page covers how to use [Fireworks](https://fireworks.ai/) models within Langchain.

## Installation and setup[​](#installation-and-setup "Direct link to Installation and setup")

*   Install the Fireworks integration package.
    
    ```
    pip install langchain-fireworks
    ```
    
*   Get a Fireworks API key by signing up at [fireworks.ai](https://fireworks.ai/).
    
*   Authenticate by setting the FIREWORKS\_API\_KEY environment variable.
    

## Authentication[​](#authentication "Direct link to Authentication")

There are two ways to authenticate using your Fireworks API key:

1.  Setting the `FIREWORKS_API_KEY` environment variable.
    
    ```
    os.environ["FIREWORKS_API_KEY"] = "<KEY>"
    ```
    
2.  Setting `api_key` field in the Fireworks LLM module.
    
    ```
    llm = Fireworks(api_key="<KEY>")
    ```
    

## Using the Fireworks LLM module[​](#using-the-fireworks-llm-module "Direct link to Using the Fireworks LLM module")

Fireworks integrates with Langchain through the LLM module. In this example, we will work the mixtral-8x7b-instruct model.

```
from langchain_fireworks import Fireworks llm = Fireworks(    api_key="<KEY>",    model="accounts/fireworks/models/mixtral-8x7b-instruct",    max_tokens=256)llm("Name 3 sports.")
```

For a more detailed walkthrough, see [here](https://python.langchain.com/docs/integrations/llms/Fireworks/).
This page describes how to use Jaguar vector database within LangChain. It contains three sections: introduction, installation and setup, and Jaguar API.

You can run JaguarDB in docker container; or download the software and run on-cloud or off-cloud.

```
export OPENAI_API_KEY="......"export JAGUAR_API_KEY="......"
```

Together with LangChain, a Jaguar client class is provided by importing it in Python:
## Infinity

> [Infinity](https://github.com/michaelfeil/infinity) allows the creation of text embeddings.

## Text Embedding Model[​](#text-embedding-model "Direct link to Text Embedding Model")

There exists an infinity Embedding model, which you can access with

```
from langchain_community.embeddings import InfinityEmbeddings
```

For a more detailed walkthrough of this, see [this notebook](https://python.langchain.com/docs/integrations/text_embedding/infinity/)

* * *

#### Help us out by providing feedback on this documentation page:
## Javelin AI Gateway

[The Javelin AI Gateway](https://www.getjavelin.io/) service is a high-performance, enterprise grade API Gateway for AI applications.  
It is designed to streamline the usage and access of various large language model (LLM) providers, such as OpenAI, Cohere, Anthropic and custom large language models within an organization by incorporating robust access security for all interactions with LLMs.

Javelin offers a high-level interface that simplifies the interaction with LLMs by providing a unified endpoint to handle specific LLM related requests.

See the Javelin AI Gateway [documentation](https://docs.getjavelin.io/) for more details.  
[Javelin Python SDK](https://www.github.com/getjavelin/javelin-python) is an easy to use client library meant to be embedded into AI Applications

## Installation and Setup[​](#installation-and-setup "Direct link to Installation and Setup")

Install `javelin_sdk` to interact with Javelin AI Gateway:

```
pip install 'javelin_sdk'
```

Set the Javelin's API key as an environment variable:

```
export JAVELIN_API_KEY=...
```

## Completions Example[​](#completions-example "Direct link to Completions Example")

```
from langchain.chains import LLMChainfrom langchain_community.llms import JavelinAIGatewayfrom langchain_core.prompts import PromptTemplateroute_completions = "eng_dept03"gateway = JavelinAIGateway(    gateway_uri="http://localhost:8000",    route=route_completions,    model_name="text-davinci-003",)llmchain = LLMChain(llm=gateway, prompt=prompt)result = llmchain.run("podcast player")print(result)
```

## Embeddings Example[​](#embeddings-example "Direct link to Embeddings Example")

```
from langchain_community.embeddings import JavelinAIGatewayEmbeddingsfrom langchain_openai import OpenAIEmbeddingsembeddings = JavelinAIGatewayEmbeddings(    gateway_uri="http://localhost:8000",    route="embeddings",)print(embeddings.embed_query("hello"))print(embeddings.embed_documents(["hello"]))
```

## Chat Example[​](#chat-example "Direct link to Chat Example")

```
from langchain_community.chat_models import ChatJavelinAIGatewayfrom langchain_core.messages import HumanMessage, SystemMessagemessages = [    SystemMessage(        content="You are a helpful assistant that translates English to French."    ),    HumanMessage(        content="Artificial Intelligence has the power to transform humanity and make the world a better place"    ),]chat = ChatJavelinAIGateway(    gateway_uri="http://localhost:8000",    route="mychatbot_route",    model_name="gpt-3.5-turbo"    params={        "temperature": 0.1    })print(chat(messages))
```
This page covers how to use the Jina Embeddings within LangChain. It is broken into two parts: installation and setup, and then references to specific Jina wrappers.

```
from langchain_community.embeddings import JinaEmbeddings# you can pas jina_api_key, if none is passed it will be taken from `JINA_API_TOKEN` environment variableembeddings = JinaEmbeddings(jina_api_key='jina_**', model_name='jina-embeddings-v2-base-en')
```
[KDB.AI](https://kdb.ai/) is a powerful knowledge-based vector database and search engine that allows you to build scalable, reliable AI applications, using real-time data, by providing advanced search, recommendation and personalization.

There exists a wrapper around KDB.AI indexes, allowing you to use it as a vectorstore, whether for semantic search or example selection.

```
from langchain_community.vectorstores import KDBAI
```
This page covers how to use [LanceDB](https://github.com/lancedb/lancedb) within LangChain. It is broken into two parts: installation and setup, and then references to specific LanceDB wrappers.

There exists a wrapper around LanceDB databases, allowing you to use it as a vectorstore, whether for semantic search or example selection.

```
from langchain_community.vectorstores import LanceDB
```
[Kinetica](https://www.kinetica.com/) is a real-time database purpose built for enabling analytics and generative AI on time-series & spatial data.

The Kinetica LLM wrapper uses the [Kinetica SqlAssist LLM](https://docs.kinetica.com/7.2/sql-gpt/concepts/) to transform natural language into SQL to simplify the process of data retrieval.

```
from langchain_community.chat_models.kinetica import ChatKinetica
```

The Kinetca vectorstore wrapper leverages Kinetica's native support for [vector similarity search](https://docs.kinetica.com/7.2/vector_search/).
## Label Studio

> [Label Studio](https://labelstud.io/guide/get_started) is an open-source data labeling platform that provides LangChain with flexibility when it comes to labeling data for fine-tuning large language models (LLMs). It also enables the preparation of custom training data and the collection and evaluation of responses through human feedback.

## Installation and Setup[​](#installation-and-setup "Direct link to Installation and Setup")

See the [Label Studio installation guide](https://labelstud.io/guide/install) for installation options.

We need to install the `label-studio` and `label-studio-sdk-python` Python packages:

```
pip install label-studio label-studio-sdk
```

## Callbacks[​](#callbacks "Direct link to Callbacks")

See a [usage example](https://python.langchain.com/docs/integrations/callbacks/labelstudio/).

```
from langchain.callbacks import LabelStudioCallbackHandler
```

* * *

#### Help us out by providing feedback on this documentation page:
## LLMonitor

> [LLMonitor](https://llmonitor.com/?utm_source=langchain&utm_medium=py&utm_campaign=docs) is an open-source observability platform that provides cost and usage analytics, user tracking, tracing and evaluation tools.

## Installation and Setup[​](#installation-and-setup "Direct link to Installation and Setup")

Create an account on [llmonitor.com](https://llmonitor.com/?utm_source=langchain&utm_medium=py&utm_campaign=docs), then copy your new app's `tracking id`.

Once you have it, set it as an environment variable by running:

```
export LLMONITOR_APP_ID="..."
```

## Callbacks[​](#callbacks "Direct link to Callbacks")

See a [usage example](https://python.langchain.com/docs/integrations/callbacks/llmonitor/).

```
from langchain.callbacks import LLMonitorCallbackHandler
```

* * *

#### Help us out by providing feedback on this documentation page:
Log10 is an [open-source](https://github.com/log10-io/log10) proxiless LLM data management and application development platform that lets you log, debug and tag your Langchain calls.

Integration with log10 is a simple one-line `log10_callback` integration as shown below:

```
from langchain_openai import ChatOpenAIfrom langchain_core.messages import HumanMessagefrom log10.langchain import Log10Callbackfrom log10.llm import Log10Configlog10_callback = Log10Callback(log10_config=Log10Config())messages = [    HumanMessage(content="You are a ping pong machine"),    HumanMessage(content="Ping?"),]llm = ChatOpenAI(model="gpt-3.5-turbo", callbacks=[log10_callback])
```

```
from langchain_openai import OpenAIfrom langchain_community.chat_models import ChatAnthropicfrom langchain_openai import ChatOpenAIfrom langchain_core.messages import HumanMessagefrom log10.langchain import Log10Callbackfrom log10.llm import Log10Configlog10_callback = Log10Callback(log10_config=Log10Config())messages = [    HumanMessage(content="You are a ping pong machine"),    HumanMessage(content="Ping?"),]llm = ChatOpenAI(model="gpt-3.5-turbo", callbacks=[log10_callback], temperature=0.5, tags=["test"])completion = llm.predict_messages(messages, tags=["foobar"])print(completion)llm = ChatAnthropic(model="claude-2", callbacks=[log10_callback], temperature=0.7, tags=["baz"])llm.predict_messages(messages)print(completion)llm = OpenAI(model_name="gpt-3.5-turbo-instruct", callbacks=[log10_callback], temperature=0.5)completion = llm.predict("You are a ping pong machine.\nPing?\n")print(completion)
```

```
import osfrom log10.load import log10, log10_sessionimport openaifrom langchain_openai import OpenAIlog10(openai)with log10_session(tags=["foo", "bar"]):    # Log a direct OpenAI call    response = openai.Completion.create(        model="text-ada-001",        prompt="Where is the Eiffel Tower?",        temperature=0,        max_tokens=1024,        top_p=1,        frequency_penalty=0,        presence_penalty=0,    )    print(response)    # Log a call via Langchain    llm = OpenAI(model_name="text-ada-001", temperature=0.5)    response = llm.predict("You are a ping pong machine.\nPing?\n")    print(response)
```
## Marqo

This page covers how to use the Marqo ecosystem within LangChain.

### **What is Marqo?**[​](#what-is-marqo "Direct link to what-is-marqo")

Marqo is a tensor search engine that uses embeddings stored in in-memory HNSW indexes to achieve cutting edge search speeds. Marqo can scale to hundred-million document indexes with horizontal index sharding and allows for async and non-blocking data upload and search. Marqo uses the latest machine learning models from PyTorch, Huggingface, OpenAI and more. You can start with a pre-configured model or bring your own. The built in ONNX support and conversion allows for faster inference and higher throughput on both CPU and GPU.

Because Marqo include its own inference your documents can have a mix of text and images, you can bring Marqo indexes with data from your other systems into the langchain ecosystem without having to worry about your embeddings being compatible.

Deployment of Marqo is flexible, you can get started yourself with our docker image or [contact us about our managed cloud offering!](https://www.marqo.ai/pricing)

To run Marqo locally with our docker image, [see our getting started.](https://docs.marqo.ai/latest/)

## Installation and Setup[​](#installation-and-setup "Direct link to Installation and Setup")

*   Install the Python SDK with `pip install marqo`

## Wrappers[​](#wrappers "Direct link to Wrappers")

### VectorStore[​](#vectorstore "Direct link to VectorStore")

There exists a wrapper around Marqo indexes, allowing you to use them within the vectorstore framework. Marqo lets you select from a range of models for generating embeddings and exposes some preprocessing configurations.

The Marqo vectorstore can also work with existing multimodel indexes where your documents have a mix of images and text, for more information refer to [our documentation](https://docs.marqo.ai/latest/#multi-modal-and-cross-modal-search). Note that instaniating the Marqo vectorstore with an existing multimodal index will disable the ability to add any new documents to it via the langchain vectorstore `add_texts` method.

To import this vectorstore:

```
from langchain_community.vectorstores import Marqo
```

For a more detailed walkthrough of the Marqo wrapper and some of its unique features, see [this notebook](https://python.langchain.com/docs/integrations/vectorstores/marqo/)
[MediaWiki XML Dumps](https://www.mediawiki.org/wiki/Manual:Importing_XML_dumps) contain the content of a wiki (wiki pages with all their revisions), without the site-related data. A XML dump does not create a full backup of the wiki database, the dump does not contain user accounts, images, edit logs, etc.

We need to install several python packages.

The `mediawiki-utilities` supports XML schema 0.11 in unmerged branches.

The `mediawiki-utilities mwxml` has a bug, fix PR pending.

```
pip install -qU git+https://github.com/gdedrouas/python-mwxml@xml_format_0.11pip install -qU mwparserfromhell
```
Metal is a managed retrieval & memory platform built for production. Easily index your data into `Metal` and run semantic search and retrieval on it.

Then, you can easily take advantage of the `MetalRetriever` class to start retrieving your data for semantic search, prompting context, etc. This class takes a `Metal` instance and a dictionary of parameters to pass to the Metal API.

```
from langchain.retrievers import MetalRetrieverfrom metal_sdk.metal import Metalmetal = Metal("API_KEY", "CLIENT_ID", "INDEX_ID");retriever = MetalRetriever(metal, params={"limit": 2})docs = retriever.get_relevant_documents("search term")
```
Get a [Minimax api key](https://api.minimax.chat/user-center/basic-information/interface-key) and set it as an environment variable (`MINIMAX_API_KEY`) Get a [Minimax group id](https://api.minimax.chat/user-center/basic-information) and set it as an environment variable (`MINIMAX_GROUP_ID`)

There exists a Minimax LLM wrapper, which you can access with See a [usage example](https://python.langchain.com/docs/integrations/llms/minimax/).

```
from langchain_community.llms import Minimax
```
First, you need to install `duckdb` python package.

After that, you should set up a connection string - we mostly integrate with Motherduck through SQLAlchemy. The connection string is likely in the form:

You can use the SQLChain to query data in your Motherduck instance in natural language.

```
from langchain_openai import OpenAIfrom langchain_community.utilities import SQLDatabasefrom langchain_experimental.sql import SQLDatabaseChaindb = SQLDatabase.from_uri(conn_str)db_chain = SQLDatabaseChain.from_llm(OpenAI(temperature=0), db, verbose=True)
```

You can also easily use Motherduck to cache LLM requests. Once again this is done through the SQLAlchemy wrapper.
## MongoDB Atlas

> [MongoDB Atlas](https://www.mongodb.com/docs/atlas/) is a fully-managed cloud database available in AWS, Azure, and GCP. It now has support for native Vector Search on the MongoDB document data.

## Installation and Setup[​](#installation-and-setup "Direct link to Installation and Setup")

See [detail configuration instructions](https://python.langchain.com/docs/integrations/vectorstores/mongodb_atlas/).

We need to install `langchain-mongodb` python package.

```
pip install langchain-mongodb
```

## Vector Store[​](#vector-store "Direct link to Vector Store")

See a [usage example](https://python.langchain.com/docs/integrations/vectorstores/mongodb_atlas/).

```
from langchain_mongodb import MongoDBAtlasVectorSearch
```

## LLM Caches[​](#llm-caches "Direct link to LLM Caches")

### MongoDBCache[​](#mongodbcache "Direct link to MongoDBCache")

An abstraction to store a simple cache in MongoDB. This does not use Semantic Caching, nor does it require an index to be made on the collection before generation.

To import this cache:

```
from langchain_mongodb.cache import MongoDBCache
```

To use this cache with your LLMs:

```
from langchain_core.globals import set_llm_cache# use any embedding provider...from tests.integration_tests.vectorstores.fake_embeddings import FakeEmbeddingsmongodb_atlas_uri = "<YOUR_CONNECTION_STRING>"COLLECTION_NAME="<YOUR_CACHE_COLLECTION_NAME>"DATABASE_NAME="<YOUR_DATABASE_NAME>"set_llm_cache(MongoDBCache(    connection_string=mongodb_atlas_uri,    collection_name=COLLECTION_NAME,    database_name=DATABASE_NAME,))
```

### MongoDBAtlasSemanticCache[​](#mongodbatlassemanticcache "Direct link to MongoDBAtlasSemanticCache")

Semantic caching allows users to retrieve cached prompts based on semantic similarity between the user input and previously cached results. Under the hood it blends MongoDBAtlas as both a cache and a vectorstore. The MongoDBAtlasSemanticCache inherits from `MongoDBAtlasVectorSearch` and needs an Atlas Vector Search Index defined to work. Please look at the [usage example](https://python.langchain.com/docs/integrations/vectorstores/mongodb_atlas/) on how to set up the index.

To import this cache:

```
from langchain_mongodb.cache import MongoDBAtlasSemanticCache
```

To use this cache with your LLMs:

```
from langchain_core.globals import set_llm_cache# use any embedding provider...from tests.integration_tests.vectorstores.fake_embeddings import FakeEmbeddingsmongodb_atlas_uri = "<YOUR_CONNECTION_STRING>"COLLECTION_NAME="<YOUR_CACHE_COLLECTION_NAME>"DATABASE_NAME="<YOUR_DATABASE_NAME>"set_llm_cache(MongoDBAtlasSemanticCache(    embedding=FakeEmbeddings(),    connection_string=mongodb_atlas_uri,    collection_name=COLLECTION_NAME,    database_name=DATABASE_NAME,))
```

\`\`
## Momento

> [Momento Cache](https://docs.momentohq.com/) is the world's first truly serverless caching service, offering instant elasticity, scale-to-zero capability, and blazing-fast performance.
> 
> [Momento Vector Index](https://docs.momentohq.com/vector-index) stands out as the most productive, easiest-to-use, fully serverless vector index.
> 
> For both services, simply grab the SDK, obtain an API key, input a few lines into your code, and you're set to go. Together, they provide a comprehensive solution for your LLM data needs.

This page covers how to use the [Momento](https://gomomento.com/) ecosystem within LangChain.

## Installation and Setup[​](#installation-and-setup "Direct link to Installation and Setup")

*   Sign up for a free account [here](https://console.gomomento.com/) to get an API key
*   Install the Momento Python SDK with `pip install momento`

## Cache[​](#cache "Direct link to Cache")

Use Momento as a serverless, distributed, low-latency cache for LLM prompts and responses. The standard cache is the primary use case for Momento users in any environment.

To integrate Momento Cache into your application:

```
from langchain.cache import MomentoCache
```

Then, set it up with the following code:

```
from datetime import timedeltafrom momento import CacheClient, Configurations, CredentialProviderfrom langchain.globals import set_llm_cache# Instantiate the Momento clientcache_client = CacheClient(    Configurations.Laptop.v1(),    CredentialProvider.from_environment_variable("MOMENTO_API_KEY"),    default_ttl=timedelta(days=1))# Choose a Momento cache name of your choicecache_name = "langchain"# Instantiate the LLM cacheset_llm_cache(MomentoCache(cache_client, cache_name))
```

## Memory[​](#memory "Direct link to Memory")

Momento can be used as a distributed memory store for LLMs.

See [this notebook](https://python.langchain.com/docs/integrations/memory/momento_chat_message_history/) for a walkthrough of how to use Momento as a memory store for chat message history.

```
from langchain.memory import MomentoChatMessageHistory
```

## Vector Store[​](#vector-store "Direct link to Vector Store")

Momento Vector Index (MVI) can be used as a vector store.

See [this notebook](https://python.langchain.com/docs/integrations/vectorstores/momento_vector_index/) for a walkthrough of how to use MVI as a vector store.

```
from langchain_community.vectorstores import MomentoVectorIndex
```
## Motörhead

> [Motörhead](https://github.com/getmetal/motorhead) is a memory server implemented in Rust. It automatically handles incremental summarization in the background and allows for stateless applications.

## Installation and Setup[​](#installation-and-setup "Direct link to Installation and Setup")

See instructions at [Motörhead](https://github.com/getmetal/motorhead) for running the server locally.

## Memory[​](#memory "Direct link to Memory")

See a [usage example](https://python.langchain.com/docs/integrations/memory/motorhead_memory/).

```
from langchain.memory import MotorheadMemory
```

* * *

#### Help us out by providing feedback on this documentation page:
This page covers how to use the Modal ecosystem to run LangChain custom LLMs. It is broken into two parts:

You must include a prompt. There is a rigid response structure:

```
from pydantic import BaseModelimport modalCACHE_PATH = "/root/model_cache"class Item(BaseModel):    prompt: strstub = modal.Stub(name="example-get-started-with-langchain")def download_model():    from transformers import GPT2Tokenizer, GPT2LMHeadModel    tokenizer = GPT2Tokenizer.from_pretrained('gpt2')    model = GPT2LMHeadModel.from_pretrained('gpt2')    tokenizer.save_pretrained(CACHE_PATH)    model.save_pretrained(CACHE_PATH)# Define a container image for the LLM function below, which# downloads and stores the GPT-2 model.image = modal.Image.debian_slim().pip_install(    "tokenizers", "transformers", "torch", "accelerate").run_function(download_model)@stub.function(    gpu="any",    image=image,    retries=3,)def run_gpt2(text: str):    from transformers import GPT2Tokenizer, GPT2LMHeadModel    tokenizer = GPT2Tokenizer.from_pretrained(CACHE_PATH)    model = GPT2LMHeadModel.from_pretrained(CACHE_PATH)    encoded_input = tokenizer(text, return_tensors='pt').input_ids    output = model.generate(encoded_input, max_length=50, do_sample=True)    return tokenizer.decode(output[0], skip_special_tokens=True)@stub.function()@modal.web_endpoint(method="POST")def get_text(item: Item):    return {"prompt": run_gpt2.call(item.prompt)}
```

Deploy the web endpoint to Modal cloud with the [`modal deploy`](https://modal.com/docs/reference/cli/deploy) CLI command. Your web endpoint will acquire a persistent URL under the `modal.run` domain.

The `Modal` LLM wrapper class which will accept your deployed web endpoint's URL.

```
from langchain_community.llms import Modalendpoint_url = "https://ecorp--custom-llm-endpoint.modal.run"  # REPLACE ME with your deployed Modal web endpoint's URLllm = Modal(endpoint_url=endpoint_url)llm_chain = LLMChain(prompt=prompt, llm=llm)question = "What NFL team won the Super Bowl in the year Justin Beiber was born?"llm_chain.run(question)
```
## MyScale

This page covers how to use MyScale vector database within LangChain. It is broken into two parts: installation and setup, and then references to specific MyScale wrappers.

With MyScale, you can manage both structured and unstructured (vectorized) data, and perform joint queries and analytics on both types of data using SQL. Plus, MyScale's cloud-native OLAP architecture, built on top of ClickHouse, enables lightning-fast data processing even on massive datasets.

## Introduction[​](#introduction "Direct link to Introduction")

[Overview to MyScale and High performance vector search](https://docs.myscale.com/en/overview/)

You can now register on our SaaS and [start a cluster now!](https://docs.myscale.com/en/quickstart/)

If you are also interested in how we managed to integrate SQL and vector, please refer to [this document](https://docs.myscale.com/en/vector-reference/) for further syntax reference.

We also deliver with live demo on huggingface! Please checkout our [huggingface space](https://huggingface.co/myscale)! They search millions of vector within a blink!

## Installation and Setup[​](#installation-and-setup "Direct link to Installation and Setup")

*   Install the Python SDK with `pip install clickhouse-connect`

### Setting up environments[​](#setting-up-environments "Direct link to Setting up environments")

There are two ways to set up parameters for myscale index.

1.  Environment Variables
    
    Before you run the app, please set the environment variable with `export`: `export MYSCALE_HOST='<your-endpoints-url>' MYSCALE_PORT=<your-endpoints-port> MYSCALE_USERNAME=<your-username> MYSCALE_PASSWORD=<your-password> ...`
    
    You can easily find your account, password and other info on our SaaS. For details please refer to [this document](https://docs.myscale.com/en/cluster-management/) Every attributes under `MyScaleSettings` can be set with prefix `MYSCALE_` and is case insensitive.
    
2.  Create `MyScaleSettings` object with parameters
    

````
```pythonfrom langchain_community.vectorstores import MyScale, MyScaleSettingsconfig = MyScaleSetting(host="<your-backend-url>", port=8443, ...)index = MyScale(embedding_function, config)index.add_documents(...)```
````

## Wrappers[​](#wrappers "Direct link to Wrappers")

supported functions:

*   `add_texts`
*   `add_documents`
*   `from_texts`
*   `from_documents`
*   `similarity_search`
*   `asimilarity_search`
*   `similarity_search_by_vector`
*   `asimilarity_search_by_vector`
*   `similarity_search_with_relevance_scores`
*   `delete`

### VectorStore[​](#vectorstore "Direct link to VectorStore")

There exists a wrapper around MyScale database, allowing you to use it as a vectorstore, whether for semantic search or similar example retrieval.

To import this vectorstore:

```
from langchain_community.vectorstores import MyScale
```

For a more detailed walkthrough of the MyScale wrapper, see [this notebook](https://python.langchain.com/docs/integrations/vectorstores/myscale/)