forked from i-am-bee/bee-agent-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlangchain.ts
26 lines (23 loc) · 828 Bytes
/
langchain.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// NOTE: ensure you have installed following packages
// - @langchain/core
// - @langchain/cohere (or any other provider related package that you would like to use)
// List of available providers: https://js.langchain.com/v0.2/docs/integrations/chat/
import { BaseMessage } from "bee-agent-framework/llms/primitives/message";
import { LangChainChatLLM } from "bee-agent-framework/adapters/langchain/llms/chat";
// @ts-expect-error package not installed
import { ChatCohere } from "@langchain/cohere";
console.info("===CHAT===");
const llm = new LangChainChatLLM(
new ChatCohere({
model: "command-r-plus",
temperature: 0,
}),
);
const response = await llm.generate([
BaseMessage.of({
role: "user",
text: "Hello world!",
}),
]);
console.info(response.messages);
console.info(response.getTextContent());