LangChain
LangChain is a software framework for developing applications powered by (large language models) LLMs. This document describes how to use LangChain to interact with SambaNova models.
View the following resources for more information:
Follow the example below to see how you can directly instantiate a ChatSambaNovaCloud model from LangChain and prompt it.
Setup
Do the following to access ChatSambaNovaCloud models:
-
Create a SambaNovaCloud account and get an API key.
-
Run the command below to install the
langchain-sambanova
integration package.
Credentials
Run the commands below to register the API key you received from cloud.sambanova.ai as an environment variable.
Instantiation
Now you can instantiate a ChatSambaNovaCloud model object and generate chat completions, as shown in the example below. The example below uses Meta’s Llama 3.1 70B.
Invocation
You can invoke the model using the command below.
You should see an output similar to the one below.
Chaining
You can chain the model with a prompt template, as shown in the example below.
You should see an output similar to the one below.