-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ref: #69 Signed-off-by: Tomas Dvorak <[email protected]>
- Loading branch information
Showing
16 changed files
with
336 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { SlidingCache } from "bee-agent-framework/cache/slidingCache"; | ||
import { OllamaChatLLM } from "bee-agent-framework/adapters/ollama/chat"; | ||
import { BaseMessage } from "bee-agent-framework/llms/primitives/message"; | ||
|
||
const llm = new OllamaChatLLM({ | ||
modelId: "llama3.1", | ||
parameters: { | ||
temperature: 0, | ||
num_predict: 50, | ||
}, | ||
cache: new SlidingCache({ | ||
size: 50, | ||
}), | ||
}); | ||
|
||
console.info(await llm.cache.size()); // 0 | ||
const first = await llm.generate([BaseMessage.of({ role: "user", text: "Who was Alan Turing?" })]); | ||
// upcoming requests with the EXACTLY same input will be retrieved from the cache | ||
console.info(await llm.cache.size()); // 1 | ||
const second = await llm.generate([BaseMessage.of({ role: "user", text: "Who was Alan Turing?" })]); | ||
console.info(first === second); // true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.