@promptbook/fake-llm 0.101.0-2 → 0.101.0-21
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 +47 -79
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/components.index.d.ts +20 -0
- package/esm/typings/src/_packages/core.index.d.ts +14 -0
- package/esm/typings/src/_packages/types.index.d.ts +14 -0
- package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +41 -3
- package/esm/typings/src/book-2.0/agent-source/AgentModelRequirements.d.ts +3 -0
- package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirements.d.ts +4 -22
- package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.d.ts +1 -26
- package/esm/typings/src/book-2.0/agent-source/parseParameters.d.ts +13 -0
- package/esm/typings/src/book-2.0/commitments/ACTION/ACTION.d.ts +2 -8
- package/esm/typings/src/book-2.0/commitments/DELETE/DELETE.d.ts +35 -0
- package/esm/typings/src/book-2.0/commitments/FORMAT/FORMAT.d.ts +2 -8
- package/esm/typings/src/book-2.0/commitments/GOAL/GOAL.d.ts +33 -0
- package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/KNOWLEDGE.d.ts +0 -6
- package/esm/typings/src/book-2.0/commitments/MEMORY/MEMORY.d.ts +34 -0
- package/esm/typings/src/book-2.0/commitments/MESSAGE/MESSAGE.d.ts +35 -0
- package/esm/typings/src/book-2.0/commitments/META/META.d.ts +56 -0
- package/esm/typings/src/book-2.0/commitments/META_IMAGE/META_IMAGE.d.ts +0 -6
- package/esm/typings/src/book-2.0/commitments/META_LINK/META_LINK.d.ts +0 -6
- package/esm/typings/src/book-2.0/commitments/MODEL/MODEL.d.ts +25 -10
- package/esm/typings/src/book-2.0/commitments/NOTE/NOTE.d.ts +2 -8
- package/esm/typings/src/book-2.0/commitments/PERSONA/PERSONA.d.ts +2 -8
- package/esm/typings/src/book-2.0/commitments/RULE/RULE.d.ts +0 -12
- package/esm/typings/src/book-2.0/commitments/SAMPLE/SAMPLE.d.ts +0 -12
- package/esm/typings/src/book-2.0/commitments/SCENARIO/SCENARIO.d.ts +34 -0
- package/esm/typings/src/book-2.0/commitments/STYLE/STYLE.d.ts +2 -8
- package/esm/typings/src/book-2.0/commitments/_base/createEmptyAgentModelRequirements.d.ts +1 -1
- package/esm/typings/src/book-2.0/commitments/index.d.ts +7 -3
- package/esm/typings/src/book-2.0/utils/generatePlaceholderAgentProfileImageUrl.d.ts +3 -0
- package/esm/typings/src/book-components/AvatarProfile/AvatarChip/AvatarChip.d.ts +5 -2
- package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/AvatarProfile.d.ts +3 -0
- package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/MockedChat.d.ts +63 -0
- package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/index.d.ts +3 -0
- package/esm/typings/src/book-components/BookEditor/BookEditor.d.ts +18 -0
- package/esm/typings/src/book-components/BookEditor/BookEditorInner.d.ts +2 -12
- package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +29 -0
- package/esm/typings/src/book-components/Chat/LlmChat/LlmChatProps.d.ts +13 -0
- package/esm/typings/src/book-components/Chat/hooks/index.d.ts +2 -0
- package/esm/typings/src/book-components/Chat/hooks/useChatAutoScroll.d.ts +41 -0
- package/esm/typings/src/book-components/Chat/hooks/useSendMessageToLlmChat.d.ts +44 -0
- package/esm/typings/src/book-components/Chat/utils/parseMessageButtons.d.ts +22 -0
- package/esm/typings/src/book-components/icons/PauseIcon.d.ts +8 -0
- package/esm/typings/src/book-components/icons/PlayIcon.d.ts +8 -0
- package/esm/typings/src/execution/PromptResult.d.ts +2 -4
- package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +1 -2
- package/esm/typings/src/execution/createPipelineExecutor/getKnowledgeForTask.d.ts +1 -3
- package/esm/typings/src/formats/csv/CsvFormatError.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsConfigurationFromEnv.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForTestingAndScriptsAndPlayground.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForWizardOrCli.d.ts +1 -2
- package/esm/typings/src/llm-providers/_common/register/createLlmToolsFromConfiguration.d.ts +8 -2
- package/esm/typings/src/llm-providers/_common/utils/removeUnsupportedModelRequirements.d.ts +25 -0
- package/esm/typings/src/llm-providers/_multiple/MultipleLlmExecutionTools.d.ts +7 -18
- package/esm/typings/src/llm-providers/_multiple/getSingleLlmExecutionTools.d.ts +11 -0
- package/esm/typings/src/llm-providers/_multiple/joinLlmExecutionTools.d.ts +2 -1
- package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +58 -0
- package/esm/typings/src/llm-providers/agent/createAgentLlmExecutionTools.d.ts +29 -0
- package/esm/typings/src/llm-providers/agent/playground/playground.d.ts +8 -0
- package/esm/typings/src/llm-providers/agent/register-configuration.d.ts +11 -0
- package/esm/typings/src/llm-providers/agent/register-constructor.d.ts +13 -0
- package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +3 -8
- package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +4 -5
- package/esm/typings/src/llm-providers/mocked/$fakeTextToExpectations.d.ts +1 -0
- package/esm/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +4 -10
- package/esm/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +4 -6
- package/esm/typings/src/llm-providers/ollama/OllamaExecutionTools.d.ts +3 -3
- package/esm/typings/src/llm-providers/openai/OpenAiCompatibleExecutionTools.d.ts +16 -8
- package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +3 -8
- package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +5 -14
- package/esm/typings/src/personas/preparePersona.d.ts +1 -0
- package/esm/typings/src/remote-server/openapi-types.d.ts +31 -31
- package/esm/typings/src/scrapers/markdown/MarkdownScraper.d.ts +1 -2
- package/esm/typings/src/types/ModelRequirements.d.ts +2 -4
- package/esm/typings/src/utils/color/utils/colorSaturation.d.ts +1 -1
- package/esm/typings/src/utils/editable/edit-pipeline-string/addPipelineCommand.d.ts +1 -1
- package/esm/typings/src/utils/markdown/humanizeAiText.d.ts +1 -1
- package/esm/typings/src/utils/markdown/promptbookifyAiText.d.ts +2 -2
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +50 -82
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/book-2.0/utils/extractAgentMetadata.d.ts +0 -17
- package/esm/typings/src/book-2.0/utils/extractProfileImageFromSystemMessage.d.ts +0 -12
- package/esm/typings/src/book-components/Chat/examples/ChatMarkdownDemo.d.ts +0 -16
- package/esm/typings/src/expectations/drafts/isDomainNameFree.d.ts +0 -10
- package/esm/typings/src/expectations/drafts/isGithubNameFree.d.ts +0 -10
- package/esm/typings/src/llm-providers/_common/profiles/llmProviderProfiles.d.ts +0 -81
- /package/esm/typings/src/llm-providers/_common/{profiles/test/llmProviderProfiles.test.d.ts → utils/removeUnsupportedModelRequirements.test.d.ts} +0 -0
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Do not make direct changes to the file.
|
|
4
4
|
*/
|
|
5
5
|
export type paths = {
|
|
6
|
-
readonly
|
|
6
|
+
readonly '/': {
|
|
7
7
|
readonly parameters: {
|
|
8
8
|
readonly query?: never;
|
|
9
9
|
readonly header?: never;
|
|
@@ -29,7 +29,7 @@ export type paths = {
|
|
|
29
29
|
readonly [name: string]: unknown;
|
|
30
30
|
};
|
|
31
31
|
content: {
|
|
32
|
-
readonly
|
|
32
|
+
readonly 'text/markdown': string;
|
|
33
33
|
};
|
|
34
34
|
};
|
|
35
35
|
};
|
|
@@ -42,7 +42,7 @@ export type paths = {
|
|
|
42
42
|
readonly patch?: never;
|
|
43
43
|
readonly trace?: never;
|
|
44
44
|
};
|
|
45
|
-
readonly
|
|
45
|
+
readonly '/login': {
|
|
46
46
|
readonly parameters: {
|
|
47
47
|
readonly query?: never;
|
|
48
48
|
readonly header?: never;
|
|
@@ -64,7 +64,7 @@ export type paths = {
|
|
|
64
64
|
};
|
|
65
65
|
readonly requestBody: {
|
|
66
66
|
readonly content: {
|
|
67
|
-
readonly
|
|
67
|
+
readonly 'application/json': {
|
|
68
68
|
readonly username?: string;
|
|
69
69
|
readonly password?: string;
|
|
70
70
|
readonly appId?: string;
|
|
@@ -78,7 +78,7 @@ export type paths = {
|
|
|
78
78
|
readonly [name: string]: unknown;
|
|
79
79
|
};
|
|
80
80
|
content: {
|
|
81
|
-
readonly
|
|
81
|
+
readonly 'application/json': {
|
|
82
82
|
readonly isSuccess?: boolean;
|
|
83
83
|
readonly message?: string;
|
|
84
84
|
readonly error?: Record<string, never>;
|
|
@@ -92,7 +92,7 @@ export type paths = {
|
|
|
92
92
|
readonly [name: string]: unknown;
|
|
93
93
|
};
|
|
94
94
|
content: {
|
|
95
|
-
readonly
|
|
95
|
+
readonly 'application/json': {
|
|
96
96
|
readonly error?: Record<string, never>;
|
|
97
97
|
};
|
|
98
98
|
};
|
|
@@ -103,7 +103,7 @@ export type paths = {
|
|
|
103
103
|
readonly [name: string]: unknown;
|
|
104
104
|
};
|
|
105
105
|
content: {
|
|
106
|
-
readonly
|
|
106
|
+
readonly 'application/json': {
|
|
107
107
|
/** @enum {boolean} */
|
|
108
108
|
readonly isSuccess?: false;
|
|
109
109
|
readonly message?: string;
|
|
@@ -119,7 +119,7 @@ export type paths = {
|
|
|
119
119
|
readonly patch?: never;
|
|
120
120
|
readonly trace?: never;
|
|
121
121
|
};
|
|
122
|
-
readonly
|
|
122
|
+
readonly '/books': {
|
|
123
123
|
readonly parameters: {
|
|
124
124
|
readonly query?: never;
|
|
125
125
|
readonly header?: never;
|
|
@@ -145,7 +145,7 @@ export type paths = {
|
|
|
145
145
|
readonly [name: string]: unknown;
|
|
146
146
|
};
|
|
147
147
|
content: {
|
|
148
|
-
readonly
|
|
148
|
+
readonly 'application/json': readonly string[];
|
|
149
149
|
};
|
|
150
150
|
};
|
|
151
151
|
/** @description No collection available */
|
|
@@ -154,7 +154,7 @@ export type paths = {
|
|
|
154
154
|
readonly [name: string]: unknown;
|
|
155
155
|
};
|
|
156
156
|
content: {
|
|
157
|
-
readonly
|
|
157
|
+
readonly 'text/plain': string;
|
|
158
158
|
};
|
|
159
159
|
};
|
|
160
160
|
};
|
|
@@ -167,7 +167,7 @@ export type paths = {
|
|
|
167
167
|
readonly patch?: never;
|
|
168
168
|
readonly trace?: never;
|
|
169
169
|
};
|
|
170
|
-
readonly
|
|
170
|
+
readonly '/books/{bookId}': {
|
|
171
171
|
readonly parameters: {
|
|
172
172
|
readonly query?: never;
|
|
173
173
|
readonly header?: never;
|
|
@@ -196,7 +196,7 @@ export type paths = {
|
|
|
196
196
|
readonly [name: string]: unknown;
|
|
197
197
|
};
|
|
198
198
|
content: {
|
|
199
|
-
readonly
|
|
199
|
+
readonly 'text/markdown': string;
|
|
200
200
|
};
|
|
201
201
|
};
|
|
202
202
|
/** @description Book not found. */
|
|
@@ -205,7 +205,7 @@ export type paths = {
|
|
|
205
205
|
readonly [name: string]: unknown;
|
|
206
206
|
};
|
|
207
207
|
content: {
|
|
208
|
-
readonly
|
|
208
|
+
readonly 'application/json': {
|
|
209
209
|
readonly error?: Record<string, never>;
|
|
210
210
|
};
|
|
211
211
|
};
|
|
@@ -216,7 +216,7 @@ export type paths = {
|
|
|
216
216
|
readonly [name: string]: unknown;
|
|
217
217
|
};
|
|
218
218
|
content: {
|
|
219
|
-
readonly
|
|
219
|
+
readonly 'text/plain': string;
|
|
220
220
|
};
|
|
221
221
|
};
|
|
222
222
|
};
|
|
@@ -229,7 +229,7 @@ export type paths = {
|
|
|
229
229
|
readonly patch?: never;
|
|
230
230
|
readonly trace?: never;
|
|
231
231
|
};
|
|
232
|
-
readonly
|
|
232
|
+
readonly '/executions': {
|
|
233
233
|
readonly parameters: {
|
|
234
234
|
readonly query?: never;
|
|
235
235
|
readonly header?: never;
|
|
@@ -255,7 +255,7 @@ export type paths = {
|
|
|
255
255
|
readonly [name: string]: unknown;
|
|
256
256
|
};
|
|
257
257
|
content: {
|
|
258
|
-
readonly
|
|
258
|
+
readonly 'application/json': readonly {
|
|
259
259
|
readonly nonce?: string;
|
|
260
260
|
readonly taskId?: string;
|
|
261
261
|
readonly taskType?: string;
|
|
@@ -277,7 +277,7 @@ export type paths = {
|
|
|
277
277
|
readonly patch?: never;
|
|
278
278
|
readonly trace?: never;
|
|
279
279
|
};
|
|
280
|
-
readonly
|
|
280
|
+
readonly '/executions/last': {
|
|
281
281
|
readonly parameters: {
|
|
282
282
|
readonly query?: never;
|
|
283
283
|
readonly header?: never;
|
|
@@ -303,7 +303,7 @@ export type paths = {
|
|
|
303
303
|
readonly [name: string]: unknown;
|
|
304
304
|
};
|
|
305
305
|
content: {
|
|
306
|
-
readonly
|
|
306
|
+
readonly 'application/json': {
|
|
307
307
|
readonly nonce?: string;
|
|
308
308
|
readonly taskId?: string;
|
|
309
309
|
readonly taskType?: string;
|
|
@@ -324,7 +324,7 @@ export type paths = {
|
|
|
324
324
|
readonly [name: string]: unknown;
|
|
325
325
|
};
|
|
326
326
|
content: {
|
|
327
|
-
readonly
|
|
327
|
+
readonly 'text/plain': string;
|
|
328
328
|
};
|
|
329
329
|
};
|
|
330
330
|
};
|
|
@@ -337,7 +337,7 @@ export type paths = {
|
|
|
337
337
|
readonly patch?: never;
|
|
338
338
|
readonly trace?: never;
|
|
339
339
|
};
|
|
340
|
-
readonly
|
|
340
|
+
readonly '/executions/{taskId}': {
|
|
341
341
|
readonly parameters: {
|
|
342
342
|
readonly query?: never;
|
|
343
343
|
readonly header?: never;
|
|
@@ -366,7 +366,7 @@ export type paths = {
|
|
|
366
366
|
readonly [name: string]: unknown;
|
|
367
367
|
};
|
|
368
368
|
content: {
|
|
369
|
-
readonly
|
|
369
|
+
readonly 'application/json': {
|
|
370
370
|
readonly nonce?: string;
|
|
371
371
|
readonly taskId?: string;
|
|
372
372
|
readonly taskType?: string;
|
|
@@ -387,7 +387,7 @@ export type paths = {
|
|
|
387
387
|
readonly [name: string]: unknown;
|
|
388
388
|
};
|
|
389
389
|
content: {
|
|
390
|
-
readonly
|
|
390
|
+
readonly 'text/plain': string;
|
|
391
391
|
};
|
|
392
392
|
};
|
|
393
393
|
};
|
|
@@ -400,7 +400,7 @@ export type paths = {
|
|
|
400
400
|
readonly patch?: never;
|
|
401
401
|
readonly trace?: never;
|
|
402
402
|
};
|
|
403
|
-
readonly
|
|
403
|
+
readonly '/executions/new': {
|
|
404
404
|
readonly parameters: {
|
|
405
405
|
readonly query?: never;
|
|
406
406
|
readonly header?: never;
|
|
@@ -422,7 +422,7 @@ export type paths = {
|
|
|
422
422
|
};
|
|
423
423
|
readonly requestBody: {
|
|
424
424
|
readonly content: {
|
|
425
|
-
readonly
|
|
425
|
+
readonly 'application/json': {
|
|
426
426
|
/** @description URL of the pipeline to execute */
|
|
427
427
|
readonly pipelineUrl?: string;
|
|
428
428
|
/** @description Alternative field for pipelineUrl */
|
|
@@ -441,7 +441,7 @@ export type paths = {
|
|
|
441
441
|
readonly [name: string]: unknown;
|
|
442
442
|
};
|
|
443
443
|
content: {
|
|
444
|
-
readonly
|
|
444
|
+
readonly 'application/json': Record<string, never>;
|
|
445
445
|
};
|
|
446
446
|
};
|
|
447
447
|
/** @description Invalid input. */
|
|
@@ -450,7 +450,7 @@ export type paths = {
|
|
|
450
450
|
readonly [name: string]: unknown;
|
|
451
451
|
};
|
|
452
452
|
content: {
|
|
453
|
-
readonly
|
|
453
|
+
readonly 'application/json': {
|
|
454
454
|
readonly error?: Record<string, never>;
|
|
455
455
|
};
|
|
456
456
|
};
|
|
@@ -461,7 +461,7 @@ export type paths = {
|
|
|
461
461
|
readonly [name: string]: unknown;
|
|
462
462
|
};
|
|
463
463
|
content: {
|
|
464
|
-
readonly
|
|
464
|
+
readonly 'text/plain': string;
|
|
465
465
|
};
|
|
466
466
|
};
|
|
467
467
|
};
|
|
@@ -472,7 +472,7 @@ export type paths = {
|
|
|
472
472
|
readonly patch?: never;
|
|
473
473
|
readonly trace?: never;
|
|
474
474
|
};
|
|
475
|
-
readonly
|
|
475
|
+
readonly '/api-docs': {
|
|
476
476
|
readonly parameters: {
|
|
477
477
|
readonly query?: never;
|
|
478
478
|
readonly header?: never;
|
|
@@ -509,7 +509,7 @@ export type paths = {
|
|
|
509
509
|
readonly patch?: never;
|
|
510
510
|
readonly trace?: never;
|
|
511
511
|
};
|
|
512
|
-
readonly
|
|
512
|
+
readonly '/swagger': {
|
|
513
513
|
readonly parameters: {
|
|
514
514
|
readonly query?: never;
|
|
515
515
|
readonly header?: never;
|
|
@@ -546,7 +546,7 @@ export type paths = {
|
|
|
546
546
|
readonly patch?: never;
|
|
547
547
|
readonly trace?: never;
|
|
548
548
|
};
|
|
549
|
-
readonly
|
|
549
|
+
readonly '/openapi': {
|
|
550
550
|
readonly parameters: {
|
|
551
551
|
readonly query?: never;
|
|
552
552
|
readonly header?: never;
|
|
@@ -572,7 +572,7 @@ export type paths = {
|
|
|
572
572
|
readonly [name: string]: unknown;
|
|
573
573
|
};
|
|
574
574
|
content: {
|
|
575
|
-
readonly
|
|
575
|
+
readonly 'application/json': Record<string, never>;
|
|
576
576
|
};
|
|
577
577
|
};
|
|
578
578
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { KnowledgePiecePreparedJson } from '../../pipeline/PipelineJson/KnowledgePieceJson';
|
|
2
|
-
import type { Scraper } from '../_common/Scraper';
|
|
3
|
-
import type { ScraperSourceHandler } from '../_common/Scraper';
|
|
2
|
+
import type { Scraper, ScraperSourceHandler } from '../_common/Scraper';
|
|
4
3
|
import type { ExecutionTools } from '../../execution/ExecutionTools';
|
|
5
4
|
import type { PrepareAndScrapeOptions } from '../../prepare/PrepareAndScrapeOptions';
|
|
6
5
|
import type { ScraperAndConverterMetadata } from '../_common/register/ScraperAndConverterMetadata';
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import type { ModelVariant } from './ModelVariant';
|
|
2
|
-
import type { number_model_temperature } from './typeAliases';
|
|
3
|
-
import type { number_seed } from './typeAliases';
|
|
4
|
-
import type { string_model_name } from './typeAliases';
|
|
5
|
-
import type { string_system_message } from './typeAliases';
|
|
2
|
+
import type { number_model_temperature, number_seed, string_model_name, string_system_message } from './typeAliases';
|
|
6
3
|
/**
|
|
7
4
|
* Abstract way to specify the LLM.
|
|
8
5
|
* It does not specify the LLM with concrete version itself, only the requirements for the LLM.
|
|
@@ -99,4 +96,5 @@ export type CommonModelRequirements = {
|
|
|
99
96
|
* TODO: Add here more requirement options like max context size, max tokens, etc.
|
|
100
97
|
* TODO: [💕][🧠] Just selecting gpt3 or gpt4 level of model
|
|
101
98
|
* TODO: [🧄] Replace all "github.com/webgptorg/promptbook#xxx" with "ptbk.io/xxx"
|
|
99
|
+
* TODO: [🐤] DRY `AgentModelRequirements` and `ModelRequirements`
|
|
102
100
|
*/
|
|
@@ -9,5 +9,5 @@ import { string_markdown } from '../../types/typeAliases';
|
|
|
9
9
|
*/
|
|
10
10
|
export declare function humanizeAiText(aiText: string_markdown): string_markdown;
|
|
11
11
|
/**
|
|
12
|
-
* TODO: [
|
|
12
|
+
* TODO: [🧠] Maybe this should be exported from `@promptbook/utils` not `@promptbook/markdown-utils`
|
|
13
13
|
*/
|
|
@@ -2,11 +2,11 @@ import { string_markdown } from '../../types/typeAliases';
|
|
|
2
2
|
/**
|
|
3
3
|
* Function `promptbookifyAiText` will slightly modify the text so we know it was processed by Promptbook
|
|
4
4
|
*
|
|
5
|
+
* Note: [🔂] This function is idempotent.
|
|
6
|
+
*
|
|
5
7
|
* @public exported from `@promptbook/markdown-utils`
|
|
6
8
|
*/
|
|
7
9
|
export declare function promptbookifyAiText(text: string_markdown): string_markdown;
|
|
8
10
|
/**
|
|
9
|
-
* TODO: !!!!! Make the function idempotent and add "Note: [🔂] This function is idempotent."
|
|
10
|
-
* TODO: [🅾️]!!! Use this across the project where AI text is involved
|
|
11
11
|
* TODO: [🧠][✌️] Make some Promptbook-native token system
|
|
12
12
|
*/
|
|
@@ -15,7 +15,7 @@ export declare const BOOK_LANGUAGE_VERSION: string_semantic_version;
|
|
|
15
15
|
export declare const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version;
|
|
16
16
|
/**
|
|
17
17
|
* Represents the version string of the Promptbook engine.
|
|
18
|
-
* It follows semantic versioning (e.g., `0.101.0-
|
|
18
|
+
* It follows semantic versioning (e.g., `0.101.0-20`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/fake-llm",
|
|
3
|
-
"version": "0.101.0-
|
|
3
|
+
"version": "0.101.0-21",
|
|
4
4
|
"description": "Promptbook: Run AI apps in plain human language across multiple models and platforms",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"module": "./esm/index.es.js",
|
|
97
97
|
"typings": "./esm/typings/src/_packages/fake-llm.index.d.ts",
|
|
98
98
|
"peerDependencies": {
|
|
99
|
-
"@promptbook/core": "0.101.0-
|
|
99
|
+
"@promptbook/core": "0.101.0-21"
|
|
100
100
|
},
|
|
101
101
|
"dependencies": {
|
|
102
102
|
"crypto": "1.0.1",
|
package/umd/index.umd.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('spacetrim'), require('
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'spacetrim', '
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-fake-llm"] = {}, global.spaceTrim, global.
|
|
5
|
-
})(this, (function (exports, spaceTrim,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('spacetrim'), require('waitasecond'), require('crypto'), require('lorem-ipsum'), require('path')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'spacetrim', 'waitasecond', 'crypto', 'lorem-ipsum', 'path'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-fake-llm"] = {}, global.spaceTrim, global.waitasecond, global.crypto, global.loremIpsum));
|
|
5
|
+
})(this, (function (exports, spaceTrim, waitasecond, crypto, loremIpsum) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -22,82 +22,12 @@
|
|
|
22
22
|
* @generated
|
|
23
23
|
* @see https://github.com/webgptorg/promptbook
|
|
24
24
|
*/
|
|
25
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.101.0-
|
|
25
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.101.0-21';
|
|
26
26
|
/**
|
|
27
27
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
28
28
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
|
-
/**
|
|
32
|
-
* Predefined profiles for LLM providers to maintain consistency across the application
|
|
33
|
-
* These profiles represent each provider as a virtual persona in chat interfaces
|
|
34
|
-
*
|
|
35
|
-
* @private !!!!
|
|
36
|
-
*/
|
|
37
|
-
const LLM_PROVIDER_PROFILES = {
|
|
38
|
-
OPENAI: {
|
|
39
|
-
name: 'OPENAI',
|
|
40
|
-
fullname: 'OpenAI GPT',
|
|
41
|
-
color: '#10a37f', // OpenAI's signature green
|
|
42
|
-
// Note: avatarSrc could be added when we have provider logos available
|
|
43
|
-
},
|
|
44
|
-
ANTHROPIC: {
|
|
45
|
-
name: 'ANTHROPIC',
|
|
46
|
-
fullname: 'Anthropic Claude',
|
|
47
|
-
color: '#d97706', // Anthropic's orange/amber color
|
|
48
|
-
},
|
|
49
|
-
AZURE_OPENAI: {
|
|
50
|
-
name: 'AZURE_OPENAI',
|
|
51
|
-
fullname: 'Azure OpenAI',
|
|
52
|
-
color: '#0078d4', // Microsoft Azure blue
|
|
53
|
-
},
|
|
54
|
-
GOOGLE: {
|
|
55
|
-
name: 'GOOGLE',
|
|
56
|
-
fullname: 'Google Gemini',
|
|
57
|
-
color: '#4285f4', // Google blue
|
|
58
|
-
},
|
|
59
|
-
DEEPSEEK: {
|
|
60
|
-
name: 'DEEPSEEK',
|
|
61
|
-
fullname: 'DeepSeek',
|
|
62
|
-
color: '#7c3aed', // Purple color for DeepSeek
|
|
63
|
-
},
|
|
64
|
-
OLLAMA: {
|
|
65
|
-
name: 'OLLAMA',
|
|
66
|
-
fullname: 'Ollama',
|
|
67
|
-
color: '#059669', // Emerald green for local models
|
|
68
|
-
},
|
|
69
|
-
REMOTE: {
|
|
70
|
-
name: 'REMOTE',
|
|
71
|
-
fullname: 'Remote Server',
|
|
72
|
-
color: '#6b7280', // Gray for remote/proxy connections
|
|
73
|
-
},
|
|
74
|
-
MOCKED_ECHO: {
|
|
75
|
-
name: 'MOCKED_ECHO',
|
|
76
|
-
fullname: 'Echo (Test)',
|
|
77
|
-
color: '#8b5cf6', // Purple for test/mock tools
|
|
78
|
-
},
|
|
79
|
-
MOCKED_FAKE: {
|
|
80
|
-
name: 'MOCKED_FAKE',
|
|
81
|
-
fullname: 'Fake LLM (Test)',
|
|
82
|
-
color: '#ec4899', // Pink for fake/test tools
|
|
83
|
-
},
|
|
84
|
-
VERCEL: {
|
|
85
|
-
name: 'VERCEL',
|
|
86
|
-
fullname: 'Vercel AI',
|
|
87
|
-
color: '#000000', // Vercel's black
|
|
88
|
-
},
|
|
89
|
-
MULTIPLE: {
|
|
90
|
-
name: 'MULTIPLE',
|
|
91
|
-
fullname: 'Multiple Providers',
|
|
92
|
-
color: '#6366f1', // Indigo for combined/multiple providers
|
|
93
|
-
},
|
|
94
|
-
};
|
|
95
|
-
/**
|
|
96
|
-
* TODO: Refactor this - each profile must be alongside the provider definition
|
|
97
|
-
* TODO: [🕛] Unite `AgentBasicInformation`, `ChatParticipant`, `LlmExecutionTools` + `LlmToolsMetadata`
|
|
98
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
99
|
-
*/
|
|
100
|
-
|
|
101
31
|
/**
|
|
102
32
|
* Freezes the given object and all its nested objects recursively
|
|
103
33
|
*
|
|
@@ -855,6 +785,14 @@
|
|
|
855
785
|
return replacedTemplates;
|
|
856
786
|
}
|
|
857
787
|
|
|
788
|
+
/**
|
|
789
|
+
* Profile for Mocked Echo provider
|
|
790
|
+
*/
|
|
791
|
+
const MOCKED_ECHO_PROVIDER_PROFILE = {
|
|
792
|
+
name: 'MOCKED_ECHO',
|
|
793
|
+
fullname: 'Echo (Test)',
|
|
794
|
+
color: '#8b5cf6',
|
|
795
|
+
};
|
|
858
796
|
/**
|
|
859
797
|
* Mocked execution Tools for just echoing the requests for testing purposes.
|
|
860
798
|
*
|
|
@@ -871,7 +809,7 @@
|
|
|
871
809
|
return 'What you say is whay you get - just for testing';
|
|
872
810
|
}
|
|
873
811
|
get profile() {
|
|
874
|
-
return
|
|
812
|
+
return MOCKED_ECHO_PROVIDER_PROFILE;
|
|
875
813
|
}
|
|
876
814
|
/**
|
|
877
815
|
* Does nothing, just to implement the interface
|
|
@@ -917,6 +855,10 @@
|
|
|
917
855
|
content: spaceTrim.spaceTrim((block) => `
|
|
918
856
|
You said:
|
|
919
857
|
${block(rawPromptContent)}
|
|
858
|
+
|
|
859
|
+
[1️⃣ Say that again!](?message=${encodeURIComponent(rawPromptContent)})
|
|
860
|
+
[2️⃣ Say that twice!](?message=${encodeURIComponent(rawPromptContent).repeat(2)})
|
|
861
|
+
[3️⃣ Say that thrice!](?message=${encodeURIComponent(rawPromptContent).repeat(3)})
|
|
920
862
|
`),
|
|
921
863
|
modelName,
|
|
922
864
|
timing: {
|
|
@@ -2372,11 +2314,20 @@
|
|
|
2372
2314
|
* @private internal utility for MockedFackedLlmExecutionTools
|
|
2373
2315
|
*/
|
|
2374
2316
|
async function $fakeTextToExpectations(expectations, postprocessingFunctionNames) {
|
|
2317
|
+
console.info({ expectations });
|
|
2318
|
+
// If no expectations are set, return one paragraph
|
|
2319
|
+
if (!expectations || Object.keys(expectations).length === 0) {
|
|
2320
|
+
const lorem = new loremIpsum.LoremIpsum({
|
|
2321
|
+
wordsPerSentence: { min: 5, max: 15 },
|
|
2322
|
+
sentencesPerParagraph: { min: 5, max: 15 },
|
|
2323
|
+
});
|
|
2324
|
+
return lorem.generateParagraphs(1);
|
|
2325
|
+
}
|
|
2375
2326
|
const lorem = new loremIpsum.LoremIpsum({
|
|
2376
2327
|
wordsPerSentence: { min: 5, max: 15 },
|
|
2377
2328
|
sentencesPerParagraph: { min: 5, max: 15 },
|
|
2378
2329
|
});
|
|
2379
|
-
let
|
|
2330
|
+
let loremWords = [];
|
|
2380
2331
|
let text = '';
|
|
2381
2332
|
for (let loopLimit = CHARACTER_LOOP_LIMIT; loopLimit-- > 0;) {
|
|
2382
2333
|
let textToCheck = text;
|
|
@@ -2398,11 +2349,14 @@
|
|
|
2398
2349
|
if (isPassingExpectations(expectations, textToCheck)) {
|
|
2399
2350
|
return text; // <- Note: Returning the text because the postprocessing
|
|
2400
2351
|
}
|
|
2401
|
-
if (
|
|
2402
|
-
loremText = lorem.generateParagraphs(1)
|
|
2352
|
+
if (loremWords.length === 0) {
|
|
2353
|
+
const loremText = lorem.generateParagraphs(1);
|
|
2354
|
+
loremWords = loremText.split(/\s+/);
|
|
2355
|
+
}
|
|
2356
|
+
const nextWord = loremWords.shift();
|
|
2357
|
+
if (nextWord) {
|
|
2358
|
+
text += (text ? ' ' : '') + nextWord;
|
|
2403
2359
|
}
|
|
2404
|
-
text += loremText.substring(0, 1);
|
|
2405
|
-
loremText = loremText.substring(1);
|
|
2406
2360
|
}
|
|
2407
2361
|
throw new LimitReachedError(spaceTrim.spaceTrim((block) => `
|
|
2408
2362
|
Can not generate fake text to met the expectations
|
|
@@ -2417,9 +2371,18 @@
|
|
|
2417
2371
|
`));
|
|
2418
2372
|
}
|
|
2419
2373
|
/**
|
|
2374
|
+
* TODO: Do not use LoremIpsum, but use some faked text that looks more human-promptbook-like
|
|
2420
2375
|
* TODO: [💝] Unite object for expecting amount and format - use here also a format
|
|
2421
2376
|
*/
|
|
2422
2377
|
|
|
2378
|
+
/**
|
|
2379
|
+
* Profile for Mocked Fake provider
|
|
2380
|
+
*/
|
|
2381
|
+
const MOCKED_FAKE_PROVIDER_PROFILE = {
|
|
2382
|
+
name: 'MOCKED_FAKE',
|
|
2383
|
+
fullname: 'Fake LLM (Test)',
|
|
2384
|
+
color: '#ec4899',
|
|
2385
|
+
};
|
|
2423
2386
|
/**
|
|
2424
2387
|
* Mocked execution Tools for just faking expected responses for testing purposes
|
|
2425
2388
|
*
|
|
@@ -2435,6 +2398,9 @@
|
|
|
2435
2398
|
get description() {
|
|
2436
2399
|
return 'Use faked lorem ipsum data - just for testing';
|
|
2437
2400
|
}
|
|
2401
|
+
get profile() {
|
|
2402
|
+
return MOCKED_FAKE_PROVIDER_PROFILE;
|
|
2403
|
+
}
|
|
2438
2404
|
/**
|
|
2439
2405
|
* Does nothing, just to implement the interface
|
|
2440
2406
|
*/
|
|
@@ -2471,7 +2437,9 @@
|
|
|
2471
2437
|
const usage = ZERO_USAGE;
|
|
2472
2438
|
// <- TODO: [🧠] Compute here at least words, characters,... etc
|
|
2473
2439
|
const content = await $fakeTextToExpectations(prompt.expectations || {
|
|
2474
|
-
|
|
2440
|
+
words: { min: 5, max: 1000 },
|
|
2441
|
+
sentences: { min: 5, max: 20 },
|
|
2442
|
+
paragraphs: { min: 1, max: 1 },
|
|
2475
2443
|
}, prompt.postprocessingFunctionNames);
|
|
2476
2444
|
const result = {
|
|
2477
2445
|
content,
|