Personal tools
Skip to content. | Skip to navigation
langchain-google-vertexai This package contains the LangChain integrations for Google Cloud generative models. Installation pip install -U langchain-google-vertexai Chat Models ChatVertexAI class exposes models such as gemini-pro and chat-bison. To use, you should have Google Cloud project with APIs enabled, and configured credentials. Initialize the model as: from langchain_google_vertexai import ChatVertexAI llm = ChatVertexAI(model_name="gemini-pro") llm.invoke("Sing a ballad of LangChain.") You can use other models, e.g. chat-bison: from langchain_google_vertexai import ChatVertexAI llm = ChatVertexAI(model_name="chat-bison", temperature=0.3) llm.invoke("Sing a ballad of LangChain.") Multimodal inputs Gemini vision model supports image inputs when providing a single chat message. Example: from langchain_core.messages import HumanMessage from langchain_google_vertexai import ChatVertexAI llm = ChatVertexAI(model_name="gemini-pro-vision") message = HumanMessage( c
LangChain Graph Retriever LangChain Graph Retriever is a Python library that supports traversing a document graph on top of vector-based similarity search. It works seamlessly with LangChain's retriever framework and supports various graph traversal strategies for efficient document discovery. Features Vector Search: Perform similarity searches using vector embeddings. Graph Traversal: Apply traversal strategies such as breadth-first (Eager) or Maximal Marginal Relevance (MMR) to explore document relationships. Customizable Strategies: Easily extend and configure traversal strategies to meet your specific use case. Multiple Adapters: Support for various vector stores, including AstraDB, Cassandra, Chroma, OpenSearch, and in-memory storage. Synchronous and Asynchronous Retrieval: Supports both sync and async workflows for flexibility in different applications. Installation Install the library via pip: pip install langchain-graph-retriever Getting Started Here is an example of how to
langchain-groq 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: Achieve uncompromised low latency and performance for real-time AI and HPC inferences 🔥 Know the exact performance and compute time for any given workload 🔮 Take advantage of our cutting-edge technology to stay ahead of the competition 💪 Want more Groq? Check out our website for more resources and join our Discord community to connect with our developers!
langchain-ibm This package provides the integration between LangChain and IBM watsonx.ai through the ibm-watsonx-ai SDK. Installation To use the langchain-ibm package, follow these installation steps: pip install langchain-ibm Usage Setting up To use IBM's models, you must have an IBM Cloud user API key. Here's how to obtain and set up your API key: Obtain an API Key: For more details on how to create and manage an API key, refer to IBM's documentation. Set the API Key as an Environment Variable: For security reasons, it's recommended to not hard-code your API key directly in your scripts. Instead, set it up as an environment variable. You can use the following code to prompt for the API key and set it as an environment variable: import os from getpass import getpass watsonx_api_key = getpass() os.environ["WATSONX_APIKEY"] = watsonx_api_key In alternative, you can set the environment variable in your terminal. Linux/macOS: Open your terminal and execute the following command: ex
langchain-milvus This is a library integration with Milvus and Zilliz Cloud. Installation pip install -U langchain-milvus Milvus vector database See a usage example from langchain_milvus import Milvus Milvus hybrid search See a usage example. from langchain_milvus import MilvusCollectionHybridSearchRetriever Zilliz Cloud vector database from langchain_milvus import Zilliz Zilliz Cloud Pipeline Retriever from langchain_milvus import ZillizCloudPipelineRetriever
langchain-mistralai This package contains the LangChain integrations for MistralAI through their mistralai SDK. Installation pip install -U langchain-mistralai Chat Models This package contains the ChatMistralAI class, which is the recommended way to interface with MistralAI models. To use, install the requirements, and configure your environment. export MISTRAL_API_KEY=your-api-key Then initialize from langchain_core.messages import HumanMessage from langchain_mistralai.chat_models import ChatMistralAI chat = ChatMistralAI(model="mistral-small") messages = [HumanMessage(content="say a brief hello")] chat.invoke(messages) ChatMistralAI also supports async and streaming functionality: await chat.ainvoke(messages) for chunk in chat.stream(messages): print(chunk.content, end="", flush=True) Embeddings With MistralAIEmbeddings, you can directly use the default model 'mistral-embed', or set a different one if available. Choose model embedding.mode
langchain-mongodb Installation pip install -U langchain-mongodb Usage See Getting Started with the LangChain Integration for a walkthrough on using your first LangChain implementation with MongoDB Atlas. Using MongoDBAtlasVectorSearch from langchain_mongodb import MongoDBAtlasVectorSearch MONGODB_ATLAS_CLUSTER_URI = os.environ.get("MONGODB_ATLAS_CLUSTER_URI") DB_NAME = "langchain_db" COLLECTION_NAME = "test" ATLAS_VECTOR_SEARCH_INDEX_NAME = "index_name" MONGODB_COLLECTION = client[DB_NAME][COLLECTION_NAME] vector_search = MongoDBAtlasVectorSearch.from_connection_string( MONGODB_ATLAS_CLUSTER_URI, DB_NAME + "." + COLLECTION_NAME, OpenAIEmbeddings(disallowed_special=()), index_name=ATLAS_VECTOR_SEARCH_INDEX_NAME, ) client = MongoClient(MONGODB_ATLAS_CLUSTER_URI) vector_search_2 =
NVIDIA NIM Microservices The langchain-nvidia-ai-endpoints package contains LangChain integrations for chat models and embeddings powered by NVIDIA AI Foundation Models, and hosted on NVIDIA API Catalog. NVIDIA AI Foundation models are community and NVIDIA-built models and are NVIDIA-optimized to deliver the best performance on NVIDIA accelerated infrastructure. Using the API, you can query live endpoints available on the NVIDIA API Catalog to get quick results from a DGX-hosted cloud compute environment. All models are source-accessible and can be deployed on your own compute cluster using NVIDIA NIM™ microservices which is part of NVIDIA AI Enterprise. Models can be exported from NVIDIA’s API catalog with NVIDIA NIM, which is included with the NVIDIA AI Enterprise license, and run them on-premises, giving Enterprises ownership of their customizations and full control of their IP and AI application. NIM microservices are packaged as container images on a per model/model family basis
langchain-ollama This package contains the LangChain integration with Ollama Installation pip install -U langchain-ollama You will also need to run the Ollama server locally. You can download it here. Chat Models ChatOllama class exposes chat models from Ollama. from langchain_ollama import ChatOllama llm = ChatOllama(model="llama3-groq-tool-use") llm.invoke("Sing a ballad of LangChain.") Embeddings OllamaEmbeddings class exposes embeddings from Ollama. from langchain_ollama import OllamaEmbeddings embeddings = OllamaEmbeddings(model="llama3") embeddings.embed_query("What is the meaning of life?") LLMs OllamaLLM class exposes LLMs from Ollama. from langchain_ollama import OllamaLLM llm = OllamaLLM(model="llama3") llm.invoke("The meaning of life is")
langchain-openai This package contains the LangChain integrations for OpenAI through their openai SDK. Installation and Setup Install the LangChain partner package pip install langchain-openai Get an OpenAI api key and set it as an environment variable (OPENAI_API_KEY) LLM See a usage example. from langchain_openai import OpenAI If you are using a model hosted on Azure, you should use different wrapper for that: from langchain_openai import AzureOpenAI For a more detailed walkthrough of the Azure wrapper, see here Chat model from langchain_openai import ChatOpenAI from langchain_openai import AzureChatOpenAI Text Embedding Model See a usage example from langchain_openai import OpenAIEmbeddings from langchain_openai import AzureOpenAIEmbeddings