@promptbook/node 0.65.0 → 0.66.0-0

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.
@@ -10,7 +10,11 @@ import { extractBlock } from '../postprocessing/utils/extractBlock';
10
10
  import { clonePipeline } from '../utils/clonePipeline';
11
11
  import { $currentDate } from '../utils/currentDate';
12
12
  import { deepClone } from '../utils/deepClone';
13
- import { deepFreeze } from '../utils/deepFreeze';
13
+ import { $deepFreeze } from '../utils/deepFreeze';
14
+ import { $getGlobalScope } from '../utils/environment/getGlobalScope';
15
+ import { $isRunningInBrowser } from '../utils/environment/isRunningInBrowser';
16
+ import { $isRunningInNode } from '../utils/environment/isRunningInNode';
17
+ import { $isRunningInWebWorker } from '../utils/environment/isRunningInWebWorker';
14
18
  import { countCharacters } from '../utils/expectation-counters/countCharacters';
15
19
  import { countLines } from '../utils/expectation-counters/countLines';
16
20
  import { countPages } from '../utils/expectation-counters/countPages';
@@ -20,9 +24,6 @@ import { countSentences } from '../utils/expectation-counters/countSentences';
20
24
  import { countWords } from '../utils/expectation-counters/countWords';
21
25
  import { CountUtils } from '../utils/expectation-counters/index';
22
26
  import { extractParameterNames } from '../utils/extractParameterNames';
23
- import { isRunningInBrowser } from '../utils/isRunningInWhatever';
24
- import { isRunningInNode } from '../utils/isRunningInWhatever';
25
- import { isRunningInWebWorker } from '../utils/isRunningInWhatever';
26
27
  import { capitalize } from '../utils/normalization/capitalize';
27
28
  import { decapitalize } from '../utils/normalization/decapitalize';
28
29
  import { DIACRITIC_VARIANTS_LETTERS } from '../utils/normalization/DIACRITIC_VARIANTS_LETTERS';
@@ -78,7 +79,11 @@ export { extractBlock };
78
79
  export { clonePipeline };
79
80
  export { $currentDate };
80
81
  export { deepClone };
81
- export { deepFreeze };
82
+ export { $deepFreeze };
83
+ export { $getGlobalScope };
84
+ export { $isRunningInBrowser };
85
+ export { $isRunningInNode };
86
+ export { $isRunningInWebWorker };
82
87
  export { countCharacters };
83
88
  export { countLines };
84
89
  export { countPages };
@@ -88,9 +93,6 @@ export { countSentences };
88
93
  export { countWords };
89
94
  export { CountUtils };
90
95
  export { extractParameterNames };
91
- export { isRunningInBrowser };
92
- export { isRunningInNode };
93
- export { isRunningInWebWorker };
94
96
  export { capitalize };
95
97
  export { decapitalize };
96
98
  export { DIACRITIC_VARIANTS_LETTERS };
@@ -3,7 +3,7 @@ import type { number_usd } from '../../types/typeAliases';
3
3
  /**
4
4
  * List of available Anthropic Claude models with pricing
5
5
  *
6
- * Note: Done at 2024-05-25
6
+ * Note: Done at 2024-08-16
7
7
  *
8
8
  * @see https://docs.anthropic.com/en/docs/models-overview
9
9
  * @public exported from `@promptbook/anthropic-claude`
@@ -19,5 +19,5 @@ export declare const ANTHROPIC_CLAUDE_MODELS: Array<AvailableModel & {
19
19
  * TODO: [🧠] !!! Add embedding models OR Anthropic has only chat+completion models?
20
20
  * TODO: [🧠] Some mechanism to propagate unsureness
21
21
  * TODO: [🧠][👮‍♀️] Put here more info like description, isVision, trainingDateCutoff, languages, strengths ( Top-level performance, intelligence, fluency, and understanding), contextWindow,...
22
- * TODO: [🕚] Make this list dynamic - dynamically can be listed modelNames but not modelVariant, legacy status, context length and pricing
22
+ * TODO: [🎰] Some mechanism to auto-update available models
23
23
  */
@@ -3,6 +3,7 @@ import type { Expectations } from '../../types/PipelineJson/Expectations';
3
3
  /**
4
4
  * Gets the expectations and creates a fake text that meets the expectations
5
5
  *
6
+ * Note: `$` is used to indicate that this function is not a pure function - it is not deterministic
6
7
  * Note: You can provide postprocessing functions to modify the text before checking the expectations
7
8
  * The result will be the text BEFORE the postprocessing
8
9
  *
@@ -18,4 +18,4 @@ import { MultipleLlmExecutionTools } from './MultipleLlmExecutionTools';
18
18
  export declare function joinLlmExecutionTools(...llmExecutionTools: Array<LlmExecutionTools>): MultipleLlmExecutionTools;
19
19
  /**
20
20
  * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
21
- */
21
+ */
@@ -18,7 +18,8 @@ export declare const OPENAI_MODELS: Array<AvailableModel & {
18
18
  /**
19
19
  * Note: [🤖] Add models of new variant
20
20
  * TODO: [🧠] Some mechanism to propagate unsureness
21
- * TODO: [🕚][👮‍♀️] Make this list dynamic - dynamically can be listed modelNames but not modelVariant, legacy status, context length and pricing
21
+ * TODO: [🎰] Some mechanism to auto-update available models
22
+ * TODO: [🎰][👮‍♀️] Make this list dynamic - dynamically can be listed modelNames but not modelVariant, legacy status, context length and pricing
22
23
  * TODO: [🧠][👮‍♀️] Put here more info like description, isVision, trainingDateCutoff, languages, strengths ( Top-level performance, intelligence, fluency, and understanding), contextWindow,...
23
24
  * @see https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4
24
25
  * @see https://openai.com/api/pricing/
@@ -2,6 +2,8 @@ import type { string_date_iso8601 } from '../types/typeAliases';
2
2
  /**
3
3
  * Simple wrapper `new Date().toISOString()`
4
4
  *
5
+ * Note: `$` is used to indicate that this function is not a pure function - it is not deterministic because it depends on the current time
6
+ *
5
7
  * @returns string_date branded type
6
8
  * @public exported from `@promptbook/utils`
7
9
  */
@@ -2,12 +2,13 @@ import type { ReadonlyDeep } from 'type-fest';
2
2
  /**
3
3
  * @@@
4
4
  *
5
+ * Note: `$` is used to indicate that this function is not a pure function - it mutates given object
5
6
  * Note: This function mutates the object and returns the original (but mutated-deep-freezed) object
6
7
  *
7
8
  * @returns The same object as the input, but deeply frozen
8
9
  * @public exported from `@promptbook/utils`
9
10
  */
10
- export declare function deepFreeze<TObject>(objectValue: TObject): ReadonlyDeep<TObject>;
11
+ export declare function $deepFreeze<TObject>(objectValue: TObject): ReadonlyDeep<TObject>;
11
12
  /**
12
13
  * @@@
13
14
  * @@@
@@ -0,0 +1,9 @@
1
+ import type { really_any } from '../organization/really_any';
2
+ /**
3
+ * @@@
4
+ *
5
+ * Note: `$` is used to indicate that this function is not a pure function - it access global
6
+ *
7
+ * @public exported from `@promptbook/utils`
8
+ */
9
+ export declare function $getGlobalScope(): really_any;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Detects if the code is running in a browser environment in main thread (Not in a web worker)
3
+ *
4
+ * Note: `$` is used to indicate that this function is not a pure function - it looks at the global object to determine the environment
5
+ *
6
+ * @public exported from `@promptbook/utils`
7
+ */
8
+ export declare const $isRunningInBrowser: Function;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Detects if the code is running in a Node.js environment
3
+ *
4
+ * Note: `$` is used to indicate that this function is not a pure function - it looks at the global object to determine the environment
5
+ *
6
+ * @public exported from `@promptbook/utils`
7
+ */
8
+ export declare const $isRunningInNode: Function;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Detects if the code is running in a web worker
3
+ *
4
+ * Note: `$` is used to indicate that this function is not a pure function - it looks at the global object to determine the environment
5
+ *
6
+ * @public exported from `@promptbook/utils`
7
+ */
8
+ export declare const $isRunningInWebWorker: Function;
@@ -2,9 +2,11 @@ import type { string_folder_path } from '../../types/typeAliases';
2
2
  /**
3
3
  * Checks if the directory exists
4
4
  *
5
+ * Note: `$` is used to indicate that this function is not a pure function - it looks at the filesystem
6
+ *
5
7
  * @private within the repository
6
8
  */
7
- export declare function isDirectoryExisting(directoryPath: string_folder_path): Promise<boolean>;
9
+ export declare function $isDirectoryExisting(directoryPath: string_folder_path): Promise<boolean>;
8
10
  /**
9
11
  * Note: [🟢] This code should never be published outside of `@promptbook/node` and `@promptbook/cli` and `@promptbook/cli`
10
12
  * TODO: [🐠] This can be a validator - with variants that return true/false and variants that throw errors with meaningless messages
@@ -2,9 +2,11 @@ import type { string_file_path } from '../../types/typeAliases';
2
2
  /**
3
3
  * Checks if the file exists
4
4
  *
5
+ * Note: `$` is used to indicate that this function is not a pure function - it looks at the filesystem
6
+ *
5
7
  * @private within the repository
6
8
  */
7
- export declare function isFileExisting(filePath: string_file_path): Promise<boolean>;
9
+ export declare function $isFileExisting(filePath: string_file_path): Promise<boolean>;
8
10
  /**
9
11
  * Note: [🟢] This code should never be published outside of `@promptbook/node` and `@promptbook/cli` and `@promptbook/cli`
10
12
  * TODO: [🐠] This can be a validator - with variants that return true/false and variants that throw errors with meaningless messages
@@ -3,12 +3,14 @@ import type { string_folder_path } from '../../types/typeAliases';
3
3
  /**
4
4
  * Reads all files in the directory
5
5
  *
6
+ * Note: `$` is used to indicate that this function is not a pure function - it looks at the filesystem
7
+ *
6
8
  * @param path
7
9
  * @param isRecursive
8
10
  * @returns List of all files in the directory
9
11
  * @private internal function of `createCollectionFromDirectory`
10
12
  */
11
- export declare function listAllFiles(path: string_folder_path, isRecursive: boolean): Promise<Array<string_file_path>>;
13
+ export declare function $listAllFiles(path: string_folder_path, isRecursive: boolean): Promise<Array<string_file_path>>;
12
14
  /**
13
15
  * Note: [🟢] This code should never be published outside of `@promptbook/node` and `@promptbook/cli` and `@promptbook/cli`
14
16
  * TODO: [🖇] What about symlinks?
@@ -2,6 +2,7 @@ import type { number_seed } from '../../types/typeAliases';
2
2
  /**
3
3
  * Generates random seed
4
4
  *
5
+ * Note: `$` is used to indicate that this function is not a pure function - it is not deterministic
5
6
  * Warning: This function is not cryptographically secure (it uses Math.random internally)
6
7
  * @public exported from `@promptbook/utils`
7
8
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/node",
3
- "version": "0.65.0",
3
+ "version": "0.66.0-0",
4
4
  "description": "Supercharge your use of large language models",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -47,13 +47,13 @@
47
47
  "module": "./esm/index.es.js",
48
48
  "typings": "./esm/typings/src/_packages/node.index.d.ts",
49
49
  "peerDependencies": {
50
- "@promptbook/core": "0.65.0"
50
+ "@promptbook/core": "0.66.0-0"
51
51
  },
52
52
  "dependencies": {
53
- "@anthropic-ai/sdk": "0.21.1",
53
+ "@anthropic-ai/sdk": "0.26.1",
54
54
  "@azure/openai": "1.0.0-beta.12",
55
55
  "colors": "1.4.0",
56
- "openai": "4.46.1",
56
+ "openai": "4.55.9",
57
57
  "prettier": "2.8.1",
58
58
  "socket.io-client": "4.7.2",
59
59
  "spacetrim": "0.11.39"