ChatPrem
Setup
- Create a Prem AI account and get your API key here.
- 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
- Yarn
- pnpm
npm install @langchain/community
yarn add @langchain/community
pnpm add @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:
- ChatPrem from
@langchain/community/chat_models/premai
- HumanMessage from
@langchain/core/messages