langchain-nvidia-ai-endpoints: 0.2.2#

LangChain NVIDIA AI Foundation Model Playground Integration

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:

  1. 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.

  2. 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:

`python pip install langchain-nvidia-ai-endpoints `

## Utilizing Chat Models:

After setting up the environment, interact with NVIDIA AI Foundation models: ```python 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:

```python from langchain_nvidia_ai_endpoints import NVIDIAEmbeddings

embed_model = NVIDIAEmbeddings(model=”nvolveqa_40k”) embedding_output = embed_model.embed_query(“Exploring AI capabilities.”) ```

callbacks#

Classes

callbacks.UsageCallbackHandler()

Callback Handler that tracks OpenAI info.

Functions

callbacks.get_token_cost_for_model(...[, ...])

Get the cost in USD for a given model and number of tokens.

callbacks.get_usage_callback([price_map, ...])

Get the OpenAI callback handler in a context manager.

callbacks.standardize_model_name(model_name)

Standardize the model name to a format that can be used in the OpenAI API.

chat_models#

Classes

chat_models.ChatNVIDIA

NVIDIA chat model.

embeddings#

Classes

embeddings.NVIDIAEmbeddings

Client to NVIDIA embeddings models.

llm#

Classes

llm.NVIDIA

LangChain LLM that uses the Completions API with NVIDIA NIMs.

reranking#

Classes

reranking.NVIDIARerank

LangChain Document Compressor that uses the NVIDIA NeMo Retriever Reranking API.

reranking.Ranking

Create a new model by parsing and validating input data from keyword arguments.

tools#

Classes