sheer / src /lib /chat /chat-hf.ts
barreloflube's picture
feat: add Hugging Face and Clerk integrations with enhanced configuration
136f9cf
raw
history blame
421 Bytes
import { ChatOpenAI } from "@langchain/openai";
export const ChatHFInference = ({
modelName,
apiKey
}: {
modelName: string;
apiKey: string;
}) => {
if (!apiKey) {
throw new Error("Hugging Face API token is required");
}
return new ChatOpenAI(
{
model: modelName,
apiKey: apiKey,
configuration: {
baseURL: "https://api-inference.huggingface.co/v1/"
}
},
);
}