langchain-nvidia-ai-endpoints: 0.3.13#
LangChain NVIDIA AI Foundation Model Playground Integration
Note
You can import langchain_nvidia
instead.
This comprehensive module integrates NVIDIA’s state-of-the-art AI Foundation Models, featuring advanced models for conversational AI and semantic embeddings, into the LangChain framework. It provides robust classes for seamless interaction with NVIDIA’s AI models, particularly tailored for enriching conversational experiences and enhancing semantic understanding in various applications.
Features
Chat Models (
ChatNVIDIA
): This class serves as the primary interface for interacting with NVIDIA’s Foundation chat models. Users can effortlessly utilize NVIDIA’s advanced models like ‘Mistral’ to engage in rich, context-aware conversations, applicable across diverse domains from customer support to interactive storytelling.Semantic Embeddings (
NVIDIAEmbeddings
): The module offers capabilities to generate sophisticated embeddings using NVIDIA’s AI models. These embeddings are instrumental for tasks like semantic analysis, text similarity assessments, and contextual understanding, significantly enhancing the depth of NLP applications.
Installation
Install this module easily using pip:
pip install langchain-nvidia-ai-endpoints
Utilizing Chat Models
After setting up the environment, interact with NVIDIA AI Foundation models:
from langchain_nvidia_ai_endpoints import ChatNVIDIA
ai_chat_model = ChatNVIDIA(model="meta/llama2-70b")
response = ai_chat_model.invoke("Tell me about the LangChain integration.")
Generating Semantic Embeddings
Use NVIDIA’s models for creating embeddings, useful in various NLP tasks:
from langchain_nvidia_ai_endpoints import NVIDIAEmbeddings
embed_model = NVIDIAEmbeddings(model="nvolveqa_40k")
embedding_output = embed_model.embed_query("Exploring AI capabilities.")
callbacks#
Classes
Callback Handler that tracks OpenAI info. |
Functions
|
Get the cost in USD for a given model and number of tokens. |
|
Get the OpenAI callback handler in a context manager. |
|
Standardize the model name to a format that can be used in the OpenAI API. |
chat_models#
Classes
NVIDIA chat model. |
embeddings#
Classes
Client to NVIDIA embeddings models. |
llm#
Classes
LangChain LLM that uses the Completions API with NVIDIA NIMs. |
reranking#
Classes
LangChain Document Compressor that uses the NVIDIA NeMo Retriever Reranking API. |
|
Create a new model by parsing and validating input data from keyword arguments. |