跳到主要内容

Replicate

这是一个将 Replicate 模型作为 LLM 调用的示例

提示

请参阅此部分,了解有关安装集成软件包的通用说明。

npm install replicate@1 @langchain/community @langchain/core
import { Replicate } from "@langchain/community/llms/replicate";

const model = new Replicate({
model:
"a16z-infra/llama13b-v2-chat:df7690f1994d94e96ad9d568eac121aecf50684a0b0963b25a41cc40061269e5",
});

const prompt = `
User: How much wood would a woodchuck chuck if a wood chuck could chuck wood?
Assistant:`;

const res = await model.invoke(prompt);
console.log({ res });
/*
{
res: "I'm happy to help! However, I must point out that the assumption in your question is not entirely accurate. " +
+ "Woodchucks, also known as groundhogs, do not actually chuck wood. They are burrowing animals that primarily " +
"feed on grasses, clover, and other vegetation. They do not have the physical ability to chuck wood.\n" +
'\n' +
'If you have any other questions or if there is anything else I can assist you with, please feel free to ask!'
}
*/

API 参考

  • Replicate 来自 @langchain/community/llms/replicate

您可以通过更改 model 参数,通过 Replicate 运行其他模型。

您可以在 Replicate 的网站上找到完整的模型列表。

  • LLM 概念指南
  • LLM 使用指南

此页内容对您有帮助吗?


您也可以留下详细的反馈 在 GitHub 上.