forked from i-am-bee/bee-agent-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbam.ts
32 lines (26 loc) · 778 Bytes
/
bam.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
27
28
29
30
31
32
import { BaseMessage } from "bee-agent-framework/llms/primitives/message";
import { BAMLLM } from "bee-agent-framework/adapters/bam/llm";
import { BAMChatLLM } from "bee-agent-framework/adapters/bam/chat";
{
console.info("===RAW===");
const llm = new BAMLLM({
modelId: "google/flan-ul2",
});
console.info("Meta", await llm.meta());
const response = await llm.generate("Hello world!", {
stream: true,
});
console.info(response.finalResult);
}
{
console.info("===CHAT===");
const llm = BAMChatLLM.fromPreset("meta-llama/llama-3-1-70b-instruct");
console.info("Meta", await llm.meta());
const response = await llm.generate([
BaseMessage.of({
role: "user",
text: "Hello world!",
}),
]);
console.info(response.messages);
}