@promptbook/utils 0.65.0 → 0.66.0-1
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.
- package/esm/index.es.js +53 -24
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/anthropic-claude.index.d.ts +2 -0
- package/esm/typings/src/_packages/core.index.d.ts +6 -2
- package/esm/typings/src/_packages/utils.index.d.ts +10 -8
- package/esm/typings/src/config.d.ts +22 -0
- package/esm/typings/src/execution/LlmExecutionTools.d.ts +11 -5
- package/esm/typings/src/llm-providers/_common/config.d.ts +1 -6
- package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +2 -2
- package/esm/typings/src/llm-providers/anthropic-claude/computeAnthropicClaudeUsage.d.ts +18 -0
- package/esm/typings/src/llm-providers/anthropic-claude/computeAnthropicClaudeUsage.test.d.ts +4 -0
- package/esm/typings/src/llm-providers/anthropic-claude/register1.d.ts +4 -0
- package/esm/typings/src/llm-providers/mocked/fakeTextToExpectations.d.ts +1 -0
- package/esm/typings/src/llm-providers/multiple/joinLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/computeOpenaiUsage.d.ts +5 -1
- package/esm/typings/src/llm-providers/openai/computeOpenaiUsage.test.d.ts +3 -0
- package/esm/typings/src/llm-providers/openai/openai-models.d.ts +2 -1
- package/esm/typings/src/llm-providers/remote/interfaces/RemoteLlmExecutionToolsOptions.d.ts +4 -1
- package/esm/typings/src/utils/currentDate.d.ts +2 -0
- package/esm/typings/src/utils/deepFreeze.d.ts +2 -1
- package/esm/typings/src/utils/environment/getGlobalScope.d.ts +12 -0
- package/esm/typings/src/utils/environment/isRunningInBrowser.d.ts +8 -0
- package/esm/typings/src/utils/environment/isRunningInNode.d.ts +8 -0
- package/esm/typings/src/utils/environment/isRunningInWebWorker.d.ts +8 -0
- package/esm/typings/src/utils/files/isDirectoryExisting.d.ts +3 -1
- package/esm/typings/src/utils/files/isFileExisting.d.ts +3 -1
- package/esm/typings/src/utils/files/listAllFiles.d.ts +3 -1
- package/esm/typings/src/utils/random/randomSeed.d.ts +1 -0
- package/package.json +1 -1
- package/umd/index.umd.js +57 -27
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/utils/isRunningInWhatever.d.ts +0 -18
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
|
|
2
2
|
import type { TODO_any } from '../../utils/organization/TODO_any';
|
|
3
|
-
import type { LlmToolsConfiguration } from './LlmToolsConfiguration';
|
|
4
|
-
/**
|
|
5
|
-
* @public exported from `@promptbook/core`
|
|
6
|
-
*/
|
|
7
|
-
export declare const LLM_CONFIGURATION_BOILERPLATES: LlmToolsConfiguration;
|
|
8
3
|
/**
|
|
9
4
|
* @private internal type for `createLlmToolsFromConfiguration`
|
|
10
5
|
*/
|
|
11
6
|
export declare const EXECUTION_TOOLS_CLASSES: Record<`create${string}`, (options: TODO_any) => LlmExecutionTools>;
|
|
12
7
|
/**
|
|
13
|
-
* TODO:
|
|
8
|
+
* TODO: !!!!!!! Make global register for this
|
|
14
9
|
* TODO: [🧠][🎌] Adding this should be responsibility of each provider package NOT this one central place
|
|
15
10
|
*/
|
|
@@ -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-
|
|
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: [
|
|
22
|
+
* TODO: [🎰] Some mechanism to auto-update available models
|
|
23
23
|
*/
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type Anthropic from '@anthropic-ai/sdk';
|
|
2
|
+
import type { PartialDeep } from 'type-fest';
|
|
3
|
+
import type { PromptResultUsage } from '../../execution/PromptResultUsage';
|
|
4
|
+
import type { Prompt } from '../../types/Prompt';
|
|
5
|
+
/**
|
|
6
|
+
* Computes the usage of the Anthropic Claude API based on the response from Anthropic Claude
|
|
7
|
+
*
|
|
8
|
+
* @param promptContent The content of the prompt
|
|
9
|
+
* @param resultContent The content of the result (for embedding prompts or failed prompts pass empty string)
|
|
10
|
+
* @param rawResponse The raw response from Anthropic Claude API
|
|
11
|
+
* @throws {PipelineExecutionError} If the usage is not defined in the response from Anthropic Claude
|
|
12
|
+
* @private internal utility of `AnthropicClaudeExecutionTools`
|
|
13
|
+
*/
|
|
14
|
+
export declare function computeAnthropicClaudeUsage(promptContent: Prompt['content'], // <- Note: Intentionally using [] to access type properties to bring jsdoc from Prompt/PromptResult to consumer
|
|
15
|
+
resultContent: string, rawResponse: PartialDeep<Pick<Anthropic.Messages.Message, 'model' | 'usage'>>): PromptResultUsage;
|
|
16
|
+
/**
|
|
17
|
+
* TODO: [🤝] DRY Maybe some common abstraction between `computeOpenaiUsage` and `computeAnthropicClaudeUsage`
|
|
18
|
+
*/
|
|
@@ -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
|
+
*/
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type OpenAI from 'openai';
|
|
2
|
+
import type { PartialDeep } from 'type-fest';
|
|
2
3
|
import type { PromptResultUsage } from '../../execution/PromptResultUsage';
|
|
3
4
|
import type { Prompt } from '../../types/Prompt';
|
|
4
5
|
/**
|
|
@@ -11,4 +12,7 @@ import type { Prompt } from '../../types/Prompt';
|
|
|
11
12
|
* @private internal utility of `OpenAiExecutionTools`
|
|
12
13
|
*/
|
|
13
14
|
export declare function computeOpenaiUsage(promptContent: Prompt['content'], // <- Note: Intentionally using [] to access type properties to bring jsdoc from Prompt/PromptResult to consumer
|
|
14
|
-
resultContent: string, rawResponse: Pick<OpenAI.Chat.Completions.ChatCompletion | OpenAI.Completions.Completion | OpenAI.Embeddings.CreateEmbeddingResponse, 'model' | 'usage'
|
|
15
|
+
resultContent: string, rawResponse: PartialDeep<Pick<OpenAI.Chat.Completions.ChatCompletion | OpenAI.Completions.Completion | OpenAI.Embeddings.CreateEmbeddingResponse, 'model' | 'usage'>>): PromptResultUsage;
|
|
16
|
+
/**
|
|
17
|
+
* TODO: [🤝] DRY Maybe some common abstraction between `computeOpenaiUsage` and `computeAnthropicClaudeUsage`
|
|
18
|
+
*/
|
|
@@ -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: [
|
|
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/
|
|
@@ -25,7 +25,7 @@ export type RemoteLlmExecutionToolsOptions = CommonExecutionToolsOptions & {
|
|
|
25
25
|
/**
|
|
26
26
|
* If set, only these models will be listed as available
|
|
27
27
|
*
|
|
28
|
-
* TODO: [🧠]
|
|
28
|
+
* TODO: [🧠] !!!!!! Figure out better solution
|
|
29
29
|
*/
|
|
30
30
|
readonly models?: Array<AvailableModel>;
|
|
31
31
|
/**
|
|
@@ -51,3 +51,6 @@ export type RemoteLlmExecutionToolsOptions = CommonExecutionToolsOptions & {
|
|
|
51
51
|
*/
|
|
52
52
|
readonly clientId: client_id;
|
|
53
53
|
});
|
|
54
|
+
/**
|
|
55
|
+
* TODO: [🧠][🧜♂️] Maybe join remoteUrl and path into single value
|
|
56
|
+
*/
|
|
@@ -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,12 @@
|
|
|
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;
|
|
10
|
+
/***
|
|
11
|
+
* TODO: !!!!! Make private and promptbook registry from this
|
|
12
|
+
*/
|
|
@@ -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
package/umd/index.umd.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
/**
|
|
13
13
|
* The version of the Promptbook library
|
|
14
14
|
*/
|
|
15
|
-
var PROMPTBOOK_VERSION = '0.
|
|
15
|
+
var PROMPTBOOK_VERSION = '0.66.0-0';
|
|
16
16
|
// TODO: !!!! List here all the versions and annotate + put into script
|
|
17
17
|
|
|
18
18
|
/*! *****************************************************************************
|
|
@@ -1121,6 +1121,8 @@
|
|
|
1121
1121
|
/**
|
|
1122
1122
|
* Simple wrapper `new Date().toISOString()`
|
|
1123
1123
|
*
|
|
1124
|
+
* Note: `$` is used to indicate that this function is not a pure function - it is not deterministic because it depends on the current time
|
|
1125
|
+
*
|
|
1124
1126
|
* @returns string_date branded type
|
|
1125
1127
|
* @public exported from `@promptbook/utils`
|
|
1126
1128
|
*/
|
|
@@ -1154,12 +1156,13 @@
|
|
|
1154
1156
|
/**
|
|
1155
1157
|
* @@@
|
|
1156
1158
|
*
|
|
1159
|
+
* Note: `$` is used to indicate that this function is not a pure function - it mutates given object
|
|
1157
1160
|
* Note: This function mutates the object and returns the original (but mutated-deep-freezed) object
|
|
1158
1161
|
*
|
|
1159
1162
|
* @returns The same object as the input, but deeply frozen
|
|
1160
1163
|
* @public exported from `@promptbook/utils`
|
|
1161
1164
|
*/
|
|
1162
|
-
function deepFreeze(objectValue) {
|
|
1165
|
+
function $deepFreeze(objectValue) {
|
|
1163
1166
|
var e_1, _a;
|
|
1164
1167
|
var propertyNames = Object.getOwnPropertyNames(objectValue);
|
|
1165
1168
|
try {
|
|
@@ -1167,7 +1170,7 @@
|
|
|
1167
1170
|
var propertyName = propertyNames_1_1.value;
|
|
1168
1171
|
var value = objectValue[propertyName];
|
|
1169
1172
|
if (value && typeof value === 'object') {
|
|
1170
|
-
deepFreeze(value);
|
|
1173
|
+
$deepFreeze(value);
|
|
1171
1174
|
}
|
|
1172
1175
|
}
|
|
1173
1176
|
}
|
|
@@ -1184,6 +1187,47 @@
|
|
|
1184
1187
|
* TODO: [🧠] Is there a way how to meaningfully test this utility
|
|
1185
1188
|
*/
|
|
1186
1189
|
|
|
1190
|
+
/**
|
|
1191
|
+
* @@@
|
|
1192
|
+
*
|
|
1193
|
+
* Note: `$` is used to indicate that this function is not a pure function - it access global
|
|
1194
|
+
*
|
|
1195
|
+
* @public exported from `@promptbook/utils`
|
|
1196
|
+
*/
|
|
1197
|
+
function $getGlobalScope() {
|
|
1198
|
+
return Function('return this')();
|
|
1199
|
+
}
|
|
1200
|
+
/***
|
|
1201
|
+
* TODO: !!!!! Make private and promptbook registry from this
|
|
1202
|
+
*/
|
|
1203
|
+
|
|
1204
|
+
/**
|
|
1205
|
+
* Detects if the code is running in a browser environment in main thread (Not in a web worker)
|
|
1206
|
+
*
|
|
1207
|
+
* Note: `$` is used to indicate that this function is not a pure function - it looks at the global object to determine the environment
|
|
1208
|
+
*
|
|
1209
|
+
* @public exported from `@promptbook/utils`
|
|
1210
|
+
*/
|
|
1211
|
+
var $isRunningInBrowser = new Function("\n try {\n return this === window;\n } catch (e) {\n return false;\n }\n");
|
|
1212
|
+
|
|
1213
|
+
/**
|
|
1214
|
+
* Detects if the code is running in a Node.js environment
|
|
1215
|
+
*
|
|
1216
|
+
* Note: `$` is used to indicate that this function is not a pure function - it looks at the global object to determine the environment
|
|
1217
|
+
*
|
|
1218
|
+
* @public exported from `@promptbook/utils`
|
|
1219
|
+
*/
|
|
1220
|
+
var $isRunningInNode = new Function("\n try {\n return this === global;\n } catch (e) {\n return false;\n }\n");
|
|
1221
|
+
|
|
1222
|
+
/**
|
|
1223
|
+
* Detects if the code is running in a web worker
|
|
1224
|
+
*
|
|
1225
|
+
* Note: `$` is used to indicate that this function is not a pure function - it looks at the global object to determine the environment
|
|
1226
|
+
*
|
|
1227
|
+
* @public exported from `@promptbook/utils`
|
|
1228
|
+
*/
|
|
1229
|
+
var $isRunningInWebWorker = new Function("\n try {\n if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) {\n return true;\n } else {\n return false;\n }\n } catch (e) {\n return false;\n }\n");
|
|
1230
|
+
|
|
1187
1231
|
/**
|
|
1188
1232
|
* Counts number of characters in the text
|
|
1189
1233
|
*
|
|
@@ -1274,25 +1318,6 @@
|
|
|
1274
1318
|
PAGES: countPages,
|
|
1275
1319
|
};
|
|
1276
1320
|
|
|
1277
|
-
/**
|
|
1278
|
-
* Detects if the code is running in a browser environment in main thread (Not in a web worker)
|
|
1279
|
-
*
|
|
1280
|
-
* @public exported from `@promptbook/utils`
|
|
1281
|
-
*/
|
|
1282
|
-
var isRunningInBrowser = new Function("\n try {\n return this === window;\n } catch (e) {\n return false;\n }\n");
|
|
1283
|
-
/**
|
|
1284
|
-
* Detects if the code is running in a Node.js environment
|
|
1285
|
-
*
|
|
1286
|
-
* @public exported from `@promptbook/utils`
|
|
1287
|
-
*/
|
|
1288
|
-
var isRunningInNode = new Function("\n try {\n return this === global;\n } catch (e) {\n return false;\n }\n");
|
|
1289
|
-
/**
|
|
1290
|
-
* Detects if the code is running in a web worker
|
|
1291
|
-
*
|
|
1292
|
-
* @public exported from `@promptbook/utils`
|
|
1293
|
-
*/
|
|
1294
|
-
var isRunningInWebWorker = new Function("\n try {\n if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) {\n return true;\n } else {\n return false;\n }\n } catch (e) {\n return false;\n }\n");
|
|
1295
|
-
|
|
1296
1321
|
/**
|
|
1297
1322
|
* Makes first letter of a string uppercase
|
|
1298
1323
|
*
|
|
@@ -1608,6 +1633,7 @@
|
|
|
1608
1633
|
/**
|
|
1609
1634
|
* Generates random seed
|
|
1610
1635
|
*
|
|
1636
|
+
* Note: `$` is used to indicate that this function is not a pure function - it is not deterministic
|
|
1611
1637
|
* Warning: This function is not cryptographically secure (it uses Math.random internally)
|
|
1612
1638
|
* @public exported from `@promptbook/utils`
|
|
1613
1639
|
*/
|
|
@@ -1656,7 +1682,7 @@
|
|
|
1656
1682
|
*
|
|
1657
1683
|
* @public exported from `@promptbook/core`
|
|
1658
1684
|
*/
|
|
1659
|
-
deepFreeze([
|
|
1685
|
+
$deepFreeze([
|
|
1660
1686
|
'content',
|
|
1661
1687
|
'context',
|
|
1662
1688
|
'knowledge',
|
|
@@ -1678,6 +1704,9 @@
|
|
|
1678
1704
|
* @private within the repository
|
|
1679
1705
|
*/
|
|
1680
1706
|
var RESERVED_PARAMETER_RESTRICTED = 'RESTRICTED-' + REPLACING_NONCE;
|
|
1707
|
+
/**
|
|
1708
|
+
* TODO: [🧠][🧜♂️] Maybe join remoteUrl and path into single value
|
|
1709
|
+
*/
|
|
1681
1710
|
|
|
1682
1711
|
/**
|
|
1683
1712
|
* This error type indicates that some limit was reached
|
|
@@ -2230,6 +2259,11 @@
|
|
|
2230
2259
|
}
|
|
2231
2260
|
|
|
2232
2261
|
exports.$currentDate = $currentDate;
|
|
2262
|
+
exports.$deepFreeze = $deepFreeze;
|
|
2263
|
+
exports.$getGlobalScope = $getGlobalScope;
|
|
2264
|
+
exports.$isRunningInBrowser = $isRunningInBrowser;
|
|
2265
|
+
exports.$isRunningInNode = $isRunningInNode;
|
|
2266
|
+
exports.$isRunningInWebWorker = $isRunningInWebWorker;
|
|
2233
2267
|
exports.$randomSeed = $randomSeed;
|
|
2234
2268
|
exports.CountUtils = CountUtils;
|
|
2235
2269
|
exports.DIACRITIC_VARIANTS_LETTERS = DIACRITIC_VARIANTS_LETTERS;
|
|
@@ -2244,7 +2278,6 @@
|
|
|
2244
2278
|
exports.countWords = countWords;
|
|
2245
2279
|
exports.decapitalize = decapitalize;
|
|
2246
2280
|
exports.deepClone = deepClone;
|
|
2247
|
-
exports.deepFreeze = deepFreeze;
|
|
2248
2281
|
exports.difference = difference;
|
|
2249
2282
|
exports.extractBlock = extractBlock;
|
|
2250
2283
|
exports.extractParameterNames = extractParameterNames;
|
|
@@ -2253,9 +2286,6 @@
|
|
|
2253
2286
|
exports.forEachAsync = forEachAsync;
|
|
2254
2287
|
exports.intersection = intersection;
|
|
2255
2288
|
exports.isHostnameOnPrivateNetwork = isHostnameOnPrivateNetwork;
|
|
2256
|
-
exports.isRunningInBrowser = isRunningInBrowser;
|
|
2257
|
-
exports.isRunningInNode = isRunningInNode;
|
|
2258
|
-
exports.isRunningInWebWorker = isRunningInWebWorker;
|
|
2259
2289
|
exports.isUrlOnPrivateNetwork = isUrlOnPrivateNetwork;
|
|
2260
2290
|
exports.isValidEmail = isValidEmail;
|
|
2261
2291
|
exports.isValidFilePath = isValidFilePath;
|