ChatSambaNovaCloud
This will help you getting started with SambaNovaCloud chat models. For detailed documentation of all ChatSambaNovaCloud features and configurations head to the API reference.
SambaNova's SambaNova Cloud is a platform for performing inference with open-source models
Overview
Integration details
Class | Package | Local | Serializable | JS support | Package downloads | Package latest |
---|---|---|---|---|---|---|
ChatSambaNovaCloud | langchain-community | ❌ | ❌ | ❌ |
Model features
Tool calling | Structured output | JSON mode | Image input | Audio input | Video input | Token-level streaming | Native async | Token usage | Logprobs |
---|---|---|---|---|---|---|---|---|---|
❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ | ✅ | ✅ | ❌ |
Setup
To access ChatSambaNovaCloud models you will need to create a SambaNovaCloud account, get an API key, install the langchain_community
integration package, and install the SSEClient
Package.
pip install langchain-community
pip install sseclient-py
Credentials
Get an API Key from cloud.sambanova.ai and add it to your environment variables:
export SAMBANOVA_API_KEY="your-api-key-here"
import getpass
import os
if not os.getenv("SAMBANOVA_API_KEY"):
os.environ["SAMBANOVA_API_KEY"] = getpass.getpass(
"Enter your SambaNova Cloud API key: "
)
If you want to get automated tracing of your model calls you can also set your LangSmith API key by uncommenting below:
# os.environ["LANGCHAIN_TRACING_V2"] = "true"
# os.environ["LANGCHAIN_API_KEY"] = getpass.getpass("Enter your LangSmith API key: ")
Installation
The LangChain SambaNovaCloud integration lives in the langchain_community
package:
%pip install -qU langchain-community
%pip install -qu sseclient-py
Instantiation
Now we can instantiate our model object and generate chat completions:
from langchain_community.chat_models.sambanova import ChatSambaNovaCloud
llm = ChatSambaNovaCloud(
model="llama3-405b", max_tokens=1024, temperature=0.7, top_k=1, top_p=0.01
)