Skip to main content

ChatPrem

Setup

  1. Create a Prem AI account and get your API key here.
  2. Export or set your API key inline. The ChatPrem class defaults to process.env.PREM_API_KEY.
export PREM_API_KEY=your-api-key

You can use models provided by Prem AI as follows:

npm install @langchain/community
import { ChatPrem } from "@langchain/community/chat_models/premai";
import { HumanMessage } from "@langchain/core/messages";

const model = new ChatPrem({
// In Node.js defaults to process.env.PREM_API_KEY
apiKey: "YOUR-API-KEY",
// In Node.js defaults to process.env.PREM_PROJECT_ID
project_id: "YOUR-PROJECT_ID",
});

console.log(await model.invoke([new HumanMessage("Hello there!")]));

API Reference:


Was this page helpful?


You can also leave detailed feedback on GitHub.