mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-16 23:13:31 +00:00
[Integration] NVIDIA AI Playground (#14648)
Description: Added NVIDIA AI Playground Initial support for a selection of models (Llama models, Mistral, etc.) Dependencies: These models do depend on the AI Playground services in NVIDIA NGC. API keys with a significant amount of trial compute are available (10K queries as of the time of writing). H/t to @VKudlay
This commit is contained in:
921
docs/docs/integrations/chat/nv_aiplay.ipynb
Normal file
921
docs/docs/integrations/chat/nv_aiplay.ipynb
Normal file
File diff suppressed because one or more lines are too long
39
docs/docs/integrations/providers/nv_aiplay.mdx
Normal file
39
docs/docs/integrations/providers/nv_aiplay.mdx
Normal file
@@ -0,0 +1,39 @@
|
||||
# NVIDIA AI Playground
|
||||
|
||||
> [NVIDIA AI Playground](https://www.nvidia.com/en-us/research/ai-playground/) gives users easy access to hosted endpoints for generative AI models like Llama-2, Mistral, etc. This example demonstrates how to use LangChain to interact with supported AI Playground models.
|
||||
|
||||
These models are provided via the `langchain-nvidia-aiplay` package.
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
pip install -U langchain-nvidia-aiplay
|
||||
```
|
||||
|
||||
## Setup and Authentication
|
||||
|
||||
- Create a free account at [NVIDIA GPU Cloud](https://catalog.ngc.nvidia.com/).
|
||||
- Navigate to `Catalog > AI Foundation Models > (Model with API endpoint)`.
|
||||
- Select `API` and generate the key `NVIDIA_API_KEY`.
|
||||
|
||||
```bash
|
||||
export NVIDIA_API_KEY=nvapi-XXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
```
|
||||
|
||||
```python
|
||||
from langchain_nvidia_aiplay import ChatNVAIPlay
|
||||
|
||||
llm = ChatNVAIPlay(model="mixtral_8x7b")
|
||||
result = llm.invoke("Write a ballad about LangChain.")
|
||||
print(result.content)
|
||||
```
|
||||
|
||||
## Using NVIDIA AI Playground Models
|
||||
|
||||
A selection of NVIDIA AI Playground models are supported directly in LangChain with familiar APIs.
|
||||
|
||||
The active models which are supported can be found [in NGC](https://catalog.ngc.nvidia.com/orgs/nvidia/teams/ai-foundation/). In addition, a selection of models can be retrieved from `langchain.<llms/chat_models>.nv_aiplay` which pull in default model options based on their use cases.
|
||||
|
||||
**The following may be useful examples to help you get started:**
|
||||
- **[`ChatNVAIPlay` Model](/docs/integrations/chat/nv_aiplay).**
|
||||
- **[`NVAIPlayEmbedding` Model for RAG Workflows](/docs/integrations/text_embeddings/nv_aiplay).**
|
556
docs/docs/integrations/text_embedding/nv_aiplay.ipynb
Normal file
556
docs/docs/integrations/text_embedding/nv_aiplay.ipynb
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user