I’m working on integrating LangChain.js with SambaNova Cloud but haven’t found any examples or showcases demonstrating this in JavaScript. I’ve encountered multiple errors while attempting the setup. Has anyone successfully managed this integration? If so, I’d appreciate any insights or guidance on resolving common issues. Alternatively, if there’s no support for this, please let me know
2 Likes
Good question. Definitely something we need to build out. If you can post the examples where you are running into issues, that would help the team investigate and prioritize creating more content to help in this direction.
Yes, please do share some more specifics of how you’re trying to use it and what you’re running into. While we do not yet have LangChain.js examples, we are happy to support your use case and you do have a couple options to build this.
Since the Cloud API is backward-compatible with conventions of OpenAI API, you could use that LangChain integration with a customBaseURL.
Try this code (thanks to @jorge.piedrahita):
import { ChatOpenAI } from "@langchain/openai";
const SambaNovaCloudBaseURL = "https://api.sambanova.ai/v1";
const apiKey = "*******************";
const SambaNovaCloudChatModel = new ChatOpenAI({
temperature: 0.9,
model: "Meta-Llama-3.1-70B-Instruct",
configuration: {
baseURL: SambaNovaCloudBaseURL,
apiKey: apiKey,
},
});
const response = await SambaNovaCloudChatModel.invoke("Hi there, tell me a joke!");
console.log(response.content);
Please message us if you run into any issues!
2 Likes