-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
++Enable caching for LLM requests with configurable cache names #677
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,13 +7,21 @@ | |
--- | ||
|
||
import { FileTree } from "@astrojs/starlight/components" | ||
|
||
Check warning on line 10 in docs/src/content/docs/reference/scripts/cache.mdx GitHub Actions / build
|
||
LLM requests are cached by default. This means that if a script generates the same prompt for the same model, the cache may be used. | ||
LLM requests are **NOT** cached by default. However, you can turn on LLM request caching from `script` metadata or the CLI arguments. | ||
|
||
- the `temperature` is less than 0.5 | ||
- the `top_p` is less than 0.5 | ||
- no [functions](./functions.md) are used as they introduce randomness | ||
- `seed` is not used | ||
```js "cache: true" | ||
script({ | ||
..., | ||
cache: true | ||
}) | ||
``` | ||
|
||
or | ||
|
||
```sh "--cache" | ||
npx genaiscript run ... --cache | ||
``` | ||
Check warning on line 24 in docs/src/content/docs/reference/scripts/cache.mdx GitHub Actions / build
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. New content has been added to explain how to enable LLM request caching. This includes a JavaScript code snippet and a shell command. Ensure that these instructions are correct and clear for users.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. New code examples have been added to illustrate how to enable LLM request caching. Ensure these examples are correct and clear to the reader.
|
||
|
||
The cache is stored in the `.genaiscript/cache/chat.jsonl` file. You can delete this file to clear the cache. | ||
This file is excluded from git by default. | ||
|
@@ -25,24 +33,7 @@ | |
- chat.jsonl | ||
|
||
</FileTree> | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The section on disabling the cache has been removed. If this information is still relevant and useful, consider adding it back to the documentation.
|
||
## Disabling | ||
|
||
You can always disable the cache using the `cache` option in `script`. | ||
|
||
```js | ||
script({ | ||
..., | ||
cache: false // always off | ||
}) | ||
``` | ||
|
||
Or using the `--no-cache` flag in the CLI. | ||
|
||
```sh | ||
npx genaiscript run .... --no-cache | ||
``` | ||
|
||
## Custom cache file | ||
|
||
Use the `cacheName` option to specify a custom cache file name. | ||
|
@@ -50,8 +41,8 @@ | |
|
||
```js | ||
script({ | ||
..., | ||
Check warning on line 44 in docs/src/content/docs/reference/scripts/cache.mdx GitHub Actions / build
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The property name in the JavaScript code snippet has been changed from 'cacheName' to 'cache'. This could potentially confuse users if not properly explained in the surrounding text.
|
||
cacheName: "summary" | ||
cache: "summary" | ||
}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The section on disabling the cache has been removed. If this information is still relevant, it should be included in the documentation.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The section on disabling the cache has been removed. This information might be important for users who want to disable caching. Consider adding it back or providing an alternative way to disable caching.
|
||
``` | ||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The statement about LLM requests caching has been changed. It was previously stated that LLM requests are cached by default, but the updated content states that they are not cached by default. This is a significant change and should be verified for accuracy.