Skip to content

Commit bbf50c5

Browse files
committed
Tweaks for cache
1 parent c23cc44 commit bbf50c5

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/class/SimpleTable.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ export default class SimpleTable extends Simple {
524524
*
525525
* On the other hand, if you have a business or professional account with high rate limits, you can set the `concurrent` option to process multiple requests concurrently and speed up the process.
526526
*
527-
* The `cache` option allows you to cache locally the results of each request, saving resources and time. The data is cached in the local hidden folder `.journalism` (because this method uses the `askAI` function from the [journalism library](https://github.com/nshiab/journalism)). So don't forget to add `.journalism` to your `.gitignore` file!
527+
* The `cache` option allows you to cache locally the results of each request, saving resources and time. The data is cached in the local hidden folder `.journalism-cache` (because this method uses the `askAI` function from the [journalism library](https://github.com/nshiab/journalism)). So don't forget to add `.journalism-cache` to your `.gitignore` file!
528528
*
529529
* Sometimes, the AI returns fewer items than the batch size, which throws an error. If you want to automatically retry the request, you can use the `retry` option. The method will retry the request up to the specified number of times.
530530
*
@@ -548,7 +548,7 @@ export default class SimpleTable extends Simple {
548548
* "city",
549549
* "country",
550550
* `Give me the country of the city.`,
551-
* // Don't forget to add .journalism to your .gitignore file!
551+
* // Don't forget to add .journalism-cache to your .gitignore file!
552552
* { cache: true, batchSize: 10, rateLimitPerMinute: 15, verbose: true },
553553
* );
554554
*
@@ -604,15 +604,15 @@ export default class SimpleTable extends Simple {
604604
*
605605
* The temperature is set to 0 to aim for reproducible results. However, to ensure consistent results in the future, it is recommended to copy the query and execute it manually using `await sdb.customQuery(query)` or to cache the query using the `cache` option.
606606
*
607-
* When the `cache` option is set to true, the generated query will be cached locally in the hidden folder `.journalism` (because this method uses the `askAI` function from the [journalism library](https://github.com/nshiab/journalism)), saving resources and time. So don't forget to add `.journalism` to your `.gitignore` file!
607+
* When the `cache` option is set to true, the generated query will be cached locally in the hidden folder `.journalism-cache` (because this method uses the `askAI` function from the [journalism library](https://github.com/nshiab/journalism)), saving resources and time. So don't forget to add `.journalism-cache` to your `.gitignore` file!
608608
*
609609
* @example
610610
* Basic usage with cache
611611
* ```ts
612612
* // The AI will generate a query that will be executed, and
613613
* // the result will replace the existing table.
614614
* // If run again, it will use the previous query from the cache.
615-
* // Don't forget to add .journalism to your .gitignore file!
615+
* // Don't forget to add .journalism-cache to your .gitignore file!
616616
* await table.aiQuery(
617617
* "Give me the average salary by department",
618618
* { cache: true, verbose: true }

test/unit/methods/aiQuery.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import { existsSync, rmSync } from "node:fs";
55

66
const aiKey = Deno.env.get("AI_KEY") ?? Deno.env.get("AI_PROJECT");
77
if (typeof aiKey === "string" && aiKey !== "") {
8-
if (existsSync("./.journalism")) {
9-
rmSync("./.journalism", { recursive: true });
8+
if (existsSync("./.journalism-cache")) {
9+
rmSync("./.journalism-cache", { recursive: true });
1010
}
1111

1212
Deno.test("should update a table with natural language", async () => {

test/unit/methods/aiRowByRow.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import { existsSync, rmSync } from "node:fs";
55

66
const aiKey = Deno.env.get("AI_KEY") ?? Deno.env.get("AI_PROJECT");
77
if (typeof aiKey === "string" && aiKey !== "") {
8-
if (existsSync("./.journalism")) {
9-
rmSync("./.journalism", { recursive: true });
8+
if (existsSync("./.journalism-cache")) {
9+
rmSync("./.journalism-cache", { recursive: true });
1010
}
1111

1212
// Deno.test("should iterate over rows with a prompt and a batch size", async () => {

0 commit comments

Comments
 (0)