@promptbook/openai 0.71.0-13 → 0.71.0-15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/README.md +17 -6
  2. package/esm/index.es.js +1 -1
  3. package/esm/typings/src/_packages/node.index.d.ts +2 -0
  4. package/esm/typings/src/_packages/types.index.d.ts +2 -0
  5. package/esm/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +2 -2
  6. package/esm/typings/src/conversion/pipelineStringToJson.d.ts +1 -1
  7. package/esm/typings/src/execution/ExecutionTools.d.ts +12 -4
  8. package/esm/typings/src/execution/FilesystemTools.d.ts +9 -0
  9. package/esm/typings/src/execution/translation/automatic-translate/translateMessages.d.ts +1 -0
  10. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsFromEnv.d.ts +0 -1
  11. package/esm/typings/src/prepare/preparePipeline.d.ts +1 -1
  12. package/esm/typings/src/prepare/prepareTemplates.d.ts +1 -1
  13. package/esm/typings/src/scrapers/_common/prepareKnowledgePieces.d.ts +1 -1
  14. package/esm/typings/src/scrapers/_common/register/$provideFilesystemForNode.d.ts +11 -0
  15. package/esm/typings/src/scrapers/_common/register/$provideScrapersForNode.d.ts +1 -1
  16. package/esm/typings/src/scrapers/_common/utils/getScraperIntermediateSource.d.ts +1 -0
  17. package/esm/typings/src/scrapers/_common/utils/makeKnowledgeSourceHandler.d.ts +2 -4
  18. package/esm/typings/src/scrapers/document/DocumentScraper.d.ts +1 -1
  19. package/esm/typings/src/scrapers/document-legacy/LegacyDocumentScraper.d.ts +1 -1
  20. package/esm/typings/src/scrapers/website/WebsiteScraper.d.ts +1 -1
  21. package/esm/typings/src/storage/file-cache-storage/FileCacheStorage.d.ts +3 -1
  22. package/esm/typings/src/utils/files/{$isDirectoryExisting.d.ts → isDirectoryExisting.d.ts} +3 -4
  23. package/esm/typings/src/utils/files/isFileExisting.d.ts +13 -0
  24. package/esm/typings/src/utils/files/{$listAllFiles.d.ts → listAllFiles.d.ts} +3 -4
  25. package/package.json +2 -2
  26. package/umd/index.umd.js +1 -1
  27. package/esm/typings/src/utils/files/$isFileExisting.d.ts +0 -14
  28. /package/esm/typings/src/utils/files/{$isDirectoryExisting.test.d.ts → isDirectoryExisting.test.d.ts} +0 -0
  29. /package/esm/typings/src/utils/files/{$isFileExisting.test.d.ts → isFileExisting.test.d.ts} +0 -0
  30. /package/esm/typings/src/utils/files/{$listAllFiles.test.d.ts → listAllFiles.test.d.ts} +0 -0
package/README.md CHANGED
@@ -47,12 +47,16 @@ npm install @promptbook/openai
47
47
 
48
48
  ```typescript
49
49
  import { createPipelineExecutor, assertsExecutionSuccessful } from '@promptbook/core';
50
- import { createCollectionFromDirectory } from '@promptbook/node';
51
- import { $provideExecutionToolsForNode } from '@promptbook/node';
50
+ import {
51
+ createCollectionFromDirectory,
52
+ $provideExecutionToolsForNode,
53
+ $provideFilesystemForNode,
54
+ } from '@promptbook/node';
52
55
  import { JavascriptExecutionTools } from '@promptbook/execute-javascript';
53
56
  import { OpenAiExecutionTools } from '@promptbook/openai';
54
57
 
55
58
  // ▶ Prepare tools
59
+ const fs = $provideFilesystemForNode();
56
60
  const llm = new OpenAiExecutionTools(
57
61
  // <- TODO: [🧱] Implement in a functional (not new Class) way
58
62
  {
@@ -62,7 +66,8 @@ const llm = new OpenAiExecutionTools(
62
66
  );
63
67
  const tools = {
64
68
  llm,
65
- scrapers: await $provideScrapersForNode({ llm }),
69
+ fs,
70
+ scrapers: await $provideScrapersForNode({ fs, llm }),
66
71
  script: [new JavascriptExecutionTools()],
67
72
  };
68
73
 
@@ -97,6 +102,7 @@ You can just use `$provideExecutionToolsForNode` function to create all required
97
102
  import { createPipelineExecutor, createCollectionFromDirectory, assertsExecutionSuccessful } from '@promptbook/core';
98
103
  import { JavascriptExecutionTools } from '@promptbook/execute-javascript';
99
104
  import { $provideExecutionToolsForNode } from '@promptbook/node';
105
+ import { $provideFilesystemForNode } from '@promptbook/node';
100
106
 
101
107
  // ▶ Prepare tools
102
108
  const tools = await $provideExecutionToolsForNode();
@@ -130,14 +136,18 @@ You can use multiple LLM providers in one Promptbook execution. The best model w
130
136
 
131
137
  ```typescript
132
138
  import { createPipelineExecutor, assertsExecutionSuccessful } from '@promptbook/core';
133
- import { createCollectionFromDirectory } from '@promptbook/node';
134
- import { $provideExecutionToolsForNode } from '@promptbook/node';
139
+ import {
140
+ createCollectionFromDirectory,
141
+ $provideExecutionToolsForNode,
142
+ $provideFilesystemForNode,
143
+ } from '@promptbook/node';
135
144
  import { JavascriptExecutionTools } from '@promptbook/execute-javascript';
136
145
  import { OpenAiExecutionTools } from '@promptbook/openai';
137
146
  import { AnthropicClaudeExecutionTools } from '@promptbook/anthropic-claude';
138
147
  import { AzureOpenAiExecutionTools } from '@promptbook/azure-openai';
139
148
 
140
149
  // ▶ Prepare multiple tools
150
+ const fs = $provideFilesystemForNode();
141
151
  const llm = [
142
152
  // Note: You can use multiple LLM providers in one Promptbook execution.
143
153
  // The best model will be chosen automatically according to the prompt and the model's capabilities.
@@ -164,7 +174,8 @@ const llm = [
164
174
  ];
165
175
  const tools = {
166
176
  llm,
167
- scrapers: await $provideScrapersForNode({ llm }),
177
+ fs,
178
+ scrapers: await $provideScrapersForNode({ fs, llm }),
168
179
  script: [new JavascriptExecutionTools()],
169
180
  };
170
181
 
package/esm/index.es.js CHANGED
@@ -6,7 +6,7 @@ import spaceTrim$1, { spaceTrim } from 'spacetrim';
6
6
  /**
7
7
  * The version of the Promptbook library
8
8
  */
9
- var PROMPTBOOK_VERSION = '0.71.0-12';
9
+ var PROMPTBOOK_VERSION = '0.71.0-14';
10
10
  // TODO: [main] !!!! List here all the versions and annotate + put into script
11
11
 
12
12
  /*! *****************************************************************************
@@ -3,6 +3,7 @@ import { createCollectionFromDirectory } from '../collection/constructors/create
3
3
  import { $provideExecutionToolsForNode } from '../execution/utils/$provideExecutionToolsForNode';
4
4
  import { $provideLlmToolsConfigurationFromEnv } from '../llm-providers/_common/register/$provideLlmToolsConfigurationFromEnv';
5
5
  import { $provideLlmToolsFromEnv } from '../llm-providers/_common/register/$provideLlmToolsFromEnv';
6
+ import { $provideFilesystemForNode } from '../scrapers/_common/register/$provideFilesystemForNode';
6
7
  import { $provideScrapersForNode } from '../scrapers/_common/register/$provideScrapersForNode';
7
8
  import { FileCacheStorage } from '../storage/file-cache-storage/FileCacheStorage';
8
9
  import { $execCommand } from '../utils/execCommand/$execCommand';
@@ -12,6 +13,7 @@ export { createCollectionFromDirectory };
12
13
  export { $provideExecutionToolsForNode };
13
14
  export { $provideLlmToolsConfigurationFromEnv };
14
15
  export { $provideLlmToolsFromEnv };
16
+ export { $provideFilesystemForNode };
15
17
  export { $provideScrapersForNode };
16
18
  export { FileCacheStorage };
17
19
  export { $execCommand };
@@ -20,6 +20,7 @@ import type { CreatePipelineExecutorOptions } from '../execution/createPipelineE
20
20
  import type { CreatePipelineExecutorSettings } from '../execution/createPipelineExecutor/00-CreatePipelineExecutorSettings';
21
21
  import type { EmbeddingVector } from '../execution/EmbeddingVector';
22
22
  import type { ExecutionTools } from '../execution/ExecutionTools';
23
+ import type { FilesystemTools } from '../execution/FilesystemTools';
23
24
  import type { LlmExecutionTools } from '../execution/LlmExecutionTools';
24
25
  import type { LlmExecutionToolsConstructor } from '../execution/LlmExecutionToolsConstructor';
25
26
  import type { PipelineExecutor } from '../execution/PipelineExecutor';
@@ -259,6 +260,7 @@ export type { CreatePipelineExecutorOptions };
259
260
  export type { CreatePipelineExecutorSettings };
260
261
  export type { EmbeddingVector };
261
262
  export type { ExecutionTools };
263
+ export type { FilesystemTools };
262
264
  export type { LlmExecutionTools };
263
265
  export type { LlmExecutionToolsConstructor };
264
266
  export type { PipelineExecutor };
@@ -46,9 +46,9 @@ type CreatePipelineCollectionFromDirectoryOptions = Omit<PrepareAndScrapeOptions
46
46
  * @returns PipelineCollection
47
47
  * @public exported from `@promptbook/node`
48
48
  */
49
- export declare function createCollectionFromDirectory(path: string_dirname, tools?: Pick<ExecutionTools, 'llm' | 'scrapers'>, options?: CreatePipelineCollectionFromDirectoryOptions): Promise<PipelineCollection>;
49
+ export declare function createCollectionFromDirectory(path: string_dirname, tools?: Pick<ExecutionTools, 'llm' | 'fs' | 'scrapers'>, options?: CreatePipelineCollectionFromDirectoryOptions): Promise<PipelineCollection>;
50
50
  export {};
51
51
  /**
52
- * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
53
52
  * TODO: [🖇] What about symlinks? Maybe option isSymlinksFollowed
53
+ * TODO: Maybe move from `@promptbook/node` to `@promptbook/core` as we removes direct dependency on `fs`
54
54
  */
@@ -20,7 +20,7 @@ import type { PipelineString } from '../types/PipelineString';
20
20
  * @throws {ParseError} if the promptbook string is not valid
21
21
  * @public exported from `@promptbook/core`
22
22
  */
23
- export declare function pipelineStringToJson(pipelineString: PipelineString, tools?: Pick<ExecutionTools, 'llm' | 'scrapers'>, options?: PrepareAndScrapeOptions): Promise<PipelineJson>;
23
+ export declare function pipelineStringToJson(pipelineString: PipelineString, tools?: Pick<ExecutionTools, 'llm' | 'fs' | 'scrapers'>, options?: PrepareAndScrapeOptions): Promise<PipelineJson>;
24
24
  /**
25
25
  * TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
26
26
  * TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
@@ -1,5 +1,6 @@
1
1
  import type { Scraper } from '../scrapers/_common/Scraper';
2
2
  import type { Arrayable } from '../types/Arrayable';
3
+ import type { FilesystemTools } from './FilesystemTools';
3
4
  import type { LlmExecutionTools } from './LlmExecutionTools';
4
5
  import type { ScriptExecutionTools } from './ScriptExecutionTools';
5
6
  import type { UserInterfaceTools } from './UserInterfaceTools';
@@ -12,11 +13,19 @@ export type ExecutionTools = {
12
13
  /**
13
14
  * Tools for executing prompts in large language models
14
15
  *
15
- * Tip: Use `$provideLlmToolsFromEnv()` to use all available LLM providers you configured
16
+ * Tip: Use `$provideLlmToolsFromEnv` to use all available LLM providers you configured
16
17
  *
17
18
  * @default [] - If not provided, no LLM execution will be possible - it does not make sense in most cases
18
19
  */
19
20
  readonly llm?: Arrayable<LlmExecutionTools>;
21
+ /**
22
+ * Tools for filesystem operations
23
+ *
24
+ * Tip: Use `$provideFilesystemForNode` to use filesystem in Node.js
25
+ *
26
+ * @default undefined - If not provided, no filesystem operations will be possible
27
+ */
28
+ readonly fs?: FilesystemTools;
20
29
  /**
21
30
  * Scrapers for extracting knowledge from external sources
22
31
  *
@@ -30,7 +39,7 @@ export type ExecutionTools = {
30
39
  *
31
40
  * Note: You can pass multiple ScriptExecutionTools, they will be tried one by one until one of them supports the script
32
41
  * If none of them supports the script, an error is thrown
33
- * Tip: Use here `new JavascriptExecutionTools()`
42
+ * Tip: Use here `new JavascriptExecutionTools`
34
43
  *
35
44
  * @default [] - If not provided, no script execution will be possible
36
45
  */
@@ -43,6 +52,5 @@ export type ExecutionTools = {
43
52
  readonly userInterface?: UserInterfaceTools;
44
53
  };
45
54
  /**
46
- * TODO: [🍂] Maybe make llm = $provideLlmToolsFromEnv() without problem with bundle contaminated by only `@promptbook/node` and `@promptbook/cli` stuff
47
- * TODO: [🍂] Same with scrapers
55
+ * TODO: !!!!!! Move here also the executables and make $provideXxxxForNode
48
56
  */
@@ -0,0 +1,9 @@
1
+ /// <reference types="node" />
2
+ import type fs from 'fs/promises';
3
+ /**
4
+ * Container for all the tools needed to manipulate with filesystem
5
+ */
6
+ export type FilesystemTools = Pick<typeof fs, 'access' | 'constants' | 'readFile' | 'stat' | 'readdir'>;
7
+ /**
8
+ * TODO: Implement destroyable pattern to free resources
9
+ */
@@ -8,4 +8,5 @@ export declare function translateMessages({ automaticTranslator, from, to, }: {
8
8
  } & TranslatorOptions): Promise<void>;
9
9
  /**
10
10
  * TODO: [😶] Unite floder listing
11
+ * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
11
12
  */
@@ -23,5 +23,4 @@ export declare function $provideLlmToolsFromEnv(options?: CreateLlmToolsFromConf
23
23
  * TODO: [🥃] Allow `ptbk make` without llm tools
24
24
  * TODO: This should be maybe not under `_common` but under `utils`
25
25
  * TODO: [®] DRY Register logic
26
- * TODO: [🍂] Maybe make llm = $provideLlmToolsFromEnv() without problem with bundle contaminated by only `@promptbook/node` and `@promptbook/cli` stuff
27
26
  */
@@ -9,7 +9,7 @@ import type { PrepareAndScrapeOptions } from './PrepareAndScrapeOptions';
9
9
  * Note: When the pipeline is already prepared, it returns the same pipeline
10
10
  * @public exported from `@promptbook/core`
11
11
  */
12
- export declare function preparePipeline(pipeline: PipelineJson, tools: Pick<ExecutionTools, 'llm' | 'scrapers'>, options: PrepareAndScrapeOptions): Promise<PipelineJson>;
12
+ export declare function preparePipeline(pipeline: PipelineJson, tools: Pick<ExecutionTools, 'llm' | 'fs' | 'scrapers'>, options: PrepareAndScrapeOptions): Promise<PipelineJson>;
13
13
  /**
14
14
  * TODO: Write tests for `preparePipeline`
15
15
  * TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
@@ -19,7 +19,7 @@ type PreparedTemplates = {
19
19
  *
20
20
  * @public exported from `@promptbook/core`
21
21
  */
22
- export declare function prepareTemplates(pipeline: PrepareTemplateInput, tools: Pick<ExecutionTools, 'llm' | 'scrapers'>, options: PrepareAndScrapeOptions): Promise<PreparedTemplates>;
22
+ export declare function prepareTemplates(pipeline: PrepareTemplateInput, tools: Pick<ExecutionTools, 'llm' | 'fs' | 'scrapers'>, options: PrepareAndScrapeOptions): Promise<PreparedTemplates>;
23
23
  export {};
24
24
  /**
25
25
  * TODO: [🧠] Add context to each template (if missing)
@@ -8,7 +8,7 @@ import type { ExecutionTools } from '../../execution/ExecutionTools';
8
8
  * @see https://github.com/webgptorg/promptbook/discussions/41
9
9
  * @public exported from `@promptbook/core`
10
10
  */
11
- export declare function prepareKnowledgePieces(knowledgeSources: Array<KnowledgeSourceJson>, tools: Pick<ExecutionTools, 'llm' | 'scrapers'>, options: PrepareAndScrapeOptions): Promise<Array<Omit<KnowledgePiecePreparedJson, 'preparationIds'>>>;
11
+ export declare function prepareKnowledgePieces(knowledgeSources: Array<KnowledgeSourceJson>, tools: Pick<ExecutionTools, 'llm' | 'fs' | 'scrapers'>, options: PrepareAndScrapeOptions): Promise<Array<Omit<KnowledgePiecePreparedJson, 'preparationIds'>>>;
12
12
  /**
13
13
  * TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
14
14
  * Put `knowledgePieces` into `PrepareKnowledgeOptions`
@@ -0,0 +1,11 @@
1
+ import type { FilesystemTools } from '../../../execution/FilesystemTools';
2
+ import type { PrepareAndScrapeOptions } from '../../../prepare/PrepareAndScrapeOptions';
3
+ /**
4
+ * @@@
5
+ *
6
+ * @public exported from `@promptbook/node`
7
+ */
8
+ export declare function $provideFilesystemForNode(options?: Pick<PrepareAndScrapeOptions, 'isVerbose'>): FilesystemTools;
9
+ /**
10
+ * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
11
+ */
@@ -9,7 +9,7 @@ import type { Scraper } from '../Scraper';
9
9
  *
10
10
  * @public exported from `@promptbook/node`
11
11
  */
12
- export declare function $provideScrapersForNode(tools: Pick<ExecutionTools, 'llm'>, options?: PrepareAndScrapeOptions): Promise<Array<Scraper>>;
12
+ export declare function $provideScrapersForNode(tools: Pick<ExecutionTools, 'fs' | 'llm'>, options?: PrepareAndScrapeOptions): Promise<Array<Scraper>>;
13
13
  /**
14
14
  * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
15
15
  */
@@ -30,4 +30,5 @@ export {};
30
30
  * 1) Need to store more than serialized JSONs
31
31
  * 2) Need to switch between a `rootDirname` and `cacheDirname` <- TODO: !!!!
32
32
  * TODO: [🐱‍🐉][🧠] Make some smart crop
33
+ * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
33
34
  */
@@ -1,4 +1,5 @@
1
1
  import type { SetOptional } from 'type-fest';
2
+ import type { ExecutionTools } from '../../../execution/ExecutionTools';
2
3
  import type { PrepareAndScrapeOptions } from '../../../prepare/PrepareAndScrapeOptions';
3
4
  import type { KnowledgeSourceJson } from '../../../types/PipelineJson/KnowledgeSourceJson';
4
5
  import type { ScraperSourceHandler } from '../Scraper';
@@ -7,7 +8,4 @@ import type { ScraperSourceHandler } from '../Scraper';
7
8
  *
8
9
  * @private for scraper utilities
9
10
  */
10
- export declare function makeKnowledgeSourceHandler(knowledgeSource: SetOptional<KnowledgeSourceJson, 'name'>, options?: Pick<PrepareAndScrapeOptions, 'rootDirname' | 'isVerbose'>): Promise<ScraperSourceHandler>;
11
- /**
12
- * TODO: !!!!!!! Maybe constrain to @promptbook/node bundle
13
- */
11
+ export declare function makeKnowledgeSourceHandler(knowledgeSource: SetOptional<KnowledgeSourceJson, 'name'>, tools: Pick<ExecutionTools, 'fs'>, options?: Pick<PrepareAndScrapeOptions, 'rootDirname' | 'isVerbose'>): Promise<ScraperSourceHandler>;
@@ -23,7 +23,7 @@ export declare class DocumentScraper implements Converter, Scraper {
23
23
  * Markdown scraper is used internally
24
24
  */
25
25
  private readonly markdownScraper;
26
- constructor(tools: Pick<ExecutionTools, 'llm'>, options: PrepareAndScrapeOptions);
26
+ constructor(tools: Pick<ExecutionTools, 'fs' | 'llm'>, options: PrepareAndScrapeOptions);
27
27
  /**
28
28
  * Convert the `.docx` or `.odt` to `.md` file and returns intermediate source
29
29
  *
@@ -23,7 +23,7 @@ export declare class LegacyDocumentScraper implements Converter, Scraper {
23
23
  * Document scraper is used internally
24
24
  */
25
25
  private readonly documentScraper;
26
- constructor(tools: Pick<ExecutionTools, 'llm'>, options: PrepareAndScrapeOptions);
26
+ constructor(tools: Pick<ExecutionTools, 'fs' | 'llm'>, options: PrepareAndScrapeOptions);
27
27
  /**
28
28
  * Convert the `.doc` or `.rtf` to `.doc` file and returns intermediate source
29
29
  *
@@ -24,7 +24,7 @@ export declare class WebsiteScraper implements Converter, Scraper {
24
24
  * Markdown scraper is used internally
25
25
  */
26
26
  private readonly markdownScraper;
27
- constructor(tools: Pick<ExecutionTools, 'llm'>, options: PrepareAndScrapeOptions);
27
+ constructor(tools: Pick<ExecutionTools, 'fs' | 'llm'>, options: PrepareAndScrapeOptions);
28
28
  /**
29
29
  * Convert the website to `.md` file and returns intermediate source
30
30
  *
@@ -1,3 +1,4 @@
1
+ import type { ExecutionTools } from '../../execution/ExecutionTools';
1
2
  import type { PromptbookStorage } from '../_common/PromptbookStorage';
2
3
  import type { FileCacheStorageOptions } from './FileCacheStorageOptions';
3
4
  /**
@@ -6,8 +7,9 @@ import type { FileCacheStorageOptions } from './FileCacheStorageOptions';
6
7
  * @public exported from `@promptbook/node`
7
8
  */
8
9
  export declare class FileCacheStorage<TItem> implements PromptbookStorage<TItem> {
10
+ private readonly tools;
9
11
  private readonly options;
10
- constructor(options: FileCacheStorageOptions);
12
+ constructor(tools: Required<Pick<ExecutionTools, 'fs'>>, options: FileCacheStorageOptions);
11
13
  /**
12
14
  * @@@
13
15
  */
@@ -1,14 +1,13 @@
1
+ import type { FilesystemTools } from '../../execution/FilesystemTools';
1
2
  import type { string_dirname } from '../../types/typeAliases';
2
3
  /**
3
4
  * Checks if the directory exists
4
5
  *
5
- * Note: `$` is used to indicate that this function is not a pure function - it looks at the filesystem
6
- *
7
6
  * @private within the repository
8
7
  */
9
- export declare function $isDirectoryExisting(directoryPath: string_dirname): Promise<boolean>;
8
+ export declare function isDirectoryExisting(directoryPath: string_dirname, fs: FilesystemTools): Promise<boolean>;
10
9
  /**
11
- * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
10
+ * Note: Not [~🟢~] because it is not directly dependent on `fs
12
11
  * TODO: [🐠] This can be a validator - with variants that return true/false and variants that throw errors with meaningless messages
13
12
  * TODO: [🧠][📂] "directory" vs "folder"
14
13
  * TODO: [🖇] What about symlinks?
@@ -0,0 +1,13 @@
1
+ import type { FilesystemTools } from '../../execution/FilesystemTools';
2
+ import type { string_filename } from '../../types/typeAliases';
3
+ /**
4
+ * Checks if the file exists
5
+ *
6
+ * @private within the repository
7
+ */
8
+ export declare function isFileExisting(filename: string_filename, fs: FilesystemTools): Promise<boolean>;
9
+ /**
10
+ * Note: Not [~🟢~] because it is not directly dependent on `fs
11
+ * TODO: [🐠] This can be a validator - with variants that return true/false and variants that throw errors with meaningless messages
12
+ * TODO: [🖇] What about symlinks?
13
+ */
@@ -1,18 +1,17 @@
1
+ import type { FilesystemTools } from '../../execution/FilesystemTools';
1
2
  import type { string_dirname } from '../../types/typeAliases';
2
3
  import type { string_filename } from '../../types/typeAliases';
3
4
  /**
4
5
  * Reads all files in the directory
5
6
  *
6
- * Note: `$` is used to indicate that this function is not a pure function - it looks at the filesystem
7
- *
8
7
  * @param path
9
8
  * @param isRecursive
10
9
  * @returns List of all files in the directory
11
10
  * @private internal function of `createCollectionFromDirectory`
12
11
  */
13
- export declare function $listAllFiles(path: string_dirname, isRecursive: boolean): Promise<Array<string_filename>>;
12
+ export declare function listAllFiles(path: string_dirname, isRecursive: boolean, fs: FilesystemTools): Promise<Array<string_filename>>;
14
13
  /**
15
14
  * TODO: [😶] Unite floder listing
16
- * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
15
+ * Note: Not [~🟢~] because it is not directly dependent on `fs
17
16
  * TODO: [🖇] What about symlinks?
18
17
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/openai",
3
- "version": "0.71.0-13",
3
+ "version": "0.71.0-15",
4
4
  "description": "Supercharge your use of large language models",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -51,7 +51,7 @@
51
51
  "module": "./esm/index.es.js",
52
52
  "typings": "./esm/typings/src/_packages/openai.index.d.ts",
53
53
  "peerDependencies": {
54
- "@promptbook/core": "0.71.0-13"
54
+ "@promptbook/core": "0.71.0-15"
55
55
  },
56
56
  "dependencies": {
57
57
  "colors": "1.4.0",
package/umd/index.umd.js CHANGED
@@ -14,7 +14,7 @@
14
14
  /**
15
15
  * The version of the Promptbook library
16
16
  */
17
- var PROMPTBOOK_VERSION = '0.71.0-12';
17
+ var PROMPTBOOK_VERSION = '0.71.0-14';
18
18
  // TODO: [main] !!!! List here all the versions and annotate + put into script
19
19
 
20
20
  /*! *****************************************************************************
@@ -1,14 +0,0 @@
1
- import type { string_filename } from '../../types/typeAliases';
2
- /**
3
- * Checks if the file exists
4
- *
5
- * Note: `$` is used to indicate that this function is not a pure function - it looks at the filesystem
6
- *
7
- * @private within the repository
8
- */
9
- export declare function $isFileExisting(filename: string_filename): Promise<boolean>;
10
- /**
11
- * Note: [🟢 !!!!!! After fix makeKnowledgeSourceHandler] Code in this file should never be published outside of `@promptbook/node` and `@promptbook/cli`
12
- * TODO: [🐠] This can be a validator - with variants that return true/false and variants that throw errors with meaningless messages
13
- * TODO: [🖇] What about symlinks?
14
- */