@promptbook/markdown-utils 0.82.0-0 → 0.82.0-2

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 (33) hide show
  1. package/esm/index.es.js +2 -2
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/src/_packages/remote-client.index.d.ts +9 -3
  4. package/esm/typings/src/_packages/remote-server.index.d.ts +8 -2
  5. package/esm/typings/src/_packages/types.index.d.ts +16 -26
  6. package/esm/typings/src/collection/PipelineCollection.d.ts +2 -0
  7. package/esm/typings/src/conversion/compilePipelineOnRemoteServer.d.ts +6 -3
  8. package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +2 -2
  9. package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +3 -7
  10. package/esm/typings/src/other/templates/getBookTemplates.d.ts +5 -3
  11. package/esm/typings/src/prepare/preparePipelineOnRemoteServer.d.ts +5 -2
  12. package/esm/typings/src/remote-server/createRemoteClient.d.ts +10 -0
  13. package/esm/typings/src/remote-server/{interfaces → socket-types/_common}/PromptbookServer_Error.d.ts +3 -3
  14. package/esm/typings/src/remote-server/socket-types/_common/PromptbookServer_Progress.d.ts +10 -0
  15. package/esm/typings/src/remote-server/socket-types/_subtypes/PromptbookServer_Identification.d.ts +49 -0
  16. package/esm/typings/src/remote-server/socket-types/listModels/PromptbookServer_ListModels_Request.d.ts +17 -0
  17. package/esm/typings/src/remote-server/{interfaces → socket-types/listModels}/PromptbookServer_ListModels_Response.d.ts +4 -2
  18. package/esm/typings/src/remote-server/socket-types/prepare/PromptbookServer_PreparePipeline_Request.d.ts +17 -0
  19. package/esm/typings/src/remote-server/socket-types/prepare/PromptbookServer_PreparePipeline_Response.d.ts +12 -0
  20. package/esm/typings/src/remote-server/socket-types/prompt/PromptbookServer_Prompt_Request.d.ts +17 -0
  21. package/esm/typings/src/remote-server/{interfaces → socket-types/prompt}/PromptbookServer_Prompt_Response.d.ts +3 -3
  22. package/esm/typings/src/remote-server/startRemoteServer.d.ts +3 -2
  23. package/esm/typings/src/remote-server/types/RemoteClientOptions.d.ts +32 -0
  24. package/esm/typings/src/types/Arrayable.d.ts +1 -0
  25. package/esm/typings/src/types/NonEmptyArray.d.ts +8 -0
  26. package/package.json +1 -1
  27. package/umd/index.umd.js +2 -2
  28. package/umd/index.umd.js.map +1 -1
  29. package/esm/typings/src/remote-server/interfaces/PromptbookServer_ListModels_Request.d.ts +0 -38
  30. package/esm/typings/src/remote-server/interfaces/PromptbookServer_Prompt_Progress.d.ts +0 -12
  31. package/esm/typings/src/remote-server/interfaces/PromptbookServer_Prompt_Request.d.ts +0 -45
  32. package/esm/typings/src/remote-server/interfaces/RemoteLlmExecutionToolsOptions.d.ts +0 -54
  33. /package/esm/typings/src/remote-server/{interfaces → types}/RemoteServerOptions.d.ts +0 -0
@@ -2,11 +2,17 @@ import { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION } from '../version';
2
2
  import { compilePipelineOnRemoteServer } from '../conversion/compilePipelineOnRemoteServer';
3
3
  import { RemoteLlmExecutionTools } from '../llm-providers/remote/RemoteLlmExecutionTools';
4
4
  import { preparePipelineOnRemoteServer } from '../prepare/preparePipelineOnRemoteServer';
5
- import type { RemoteLlmExecutionToolsOptions } from '../remote-server/interfaces/RemoteLlmExecutionToolsOptions';
6
- import type { RemoteServerOptions } from '../remote-server/interfaces/RemoteServerOptions';
5
+ import type { PromptbookServer_Identification } from '../remote-server/socket-types/_subtypes/PromptbookServer_Identification';
6
+ import type { PromptbookServer_ApplicationIdentification } from '../remote-server/socket-types/_subtypes/PromptbookServer_Identification';
7
+ import type { PromptbookServer_AnonymousIdentification } from '../remote-server/socket-types/_subtypes/PromptbookServer_Identification';
8
+ import type { RemoteClientOptions } from '../remote-server/types/RemoteClientOptions';
9
+ import type { RemoteServerOptions } from '../remote-server/types/RemoteServerOptions';
7
10
  export { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION };
8
11
  export { compilePipelineOnRemoteServer };
9
12
  export { RemoteLlmExecutionTools };
10
13
  export { preparePipelineOnRemoteServer };
11
- export type { RemoteLlmExecutionToolsOptions };
14
+ export type { PromptbookServer_Identification };
15
+ export type { PromptbookServer_ApplicationIdentification };
16
+ export type { PromptbookServer_AnonymousIdentification };
17
+ export type { RemoteClientOptions };
12
18
  export type { RemoteServerOptions };
@@ -1,6 +1,12 @@
1
1
  import { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION } from '../version';
2
- import type { RemoteServerOptions } from '../remote-server/interfaces/RemoteServerOptions';
2
+ import type { PromptbookServer_Identification } from '../remote-server/socket-types/_subtypes/PromptbookServer_Identification';
3
+ import type { PromptbookServer_ApplicationIdentification } from '../remote-server/socket-types/_subtypes/PromptbookServer_Identification';
4
+ import type { PromptbookServer_AnonymousIdentification } from '../remote-server/socket-types/_subtypes/PromptbookServer_Identification';
3
5
  import { startRemoteServer } from '../remote-server/startRemoteServer';
6
+ import type { RemoteServerOptions } from '../remote-server/types/RemoteServerOptions';
4
7
  export { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION };
5
- export type { RemoteServerOptions };
8
+ export type { PromptbookServer_Identification };
9
+ export type { PromptbookServer_ApplicationIdentification };
10
+ export type { PromptbookServer_AnonymousIdentification };
6
11
  export { startRemoteServer };
12
+ export type { RemoteServerOptions };
@@ -87,21 +87,14 @@ import type { SimpleTaskJson } from '../pipeline/PipelineJson/SimpleTaskJson';
87
87
  import type { TaskJson } from '../pipeline/PipelineJson/TaskJson';
88
88
  import type { PipelineString } from '../pipeline/PipelineString';
89
89
  import type { PrepareAndScrapeOptions } from '../prepare/PrepareAndScrapeOptions';
90
- import type { PromptbookServer_Error } from '../remote-server/interfaces/PromptbookServer_Error';
91
- import type { PromptbookServer_ListModels_Request } from '../remote-server/interfaces/PromptbookServer_ListModels_Request';
92
- import type { PromptbookServer_ListModels_CollectionRequest } from '../remote-server/interfaces/PromptbookServer_ListModels_Request';
93
- import type { PromptbookServer_ListModels_AnonymousRequest } from '../remote-server/interfaces/PromptbookServer_ListModels_Request';
94
- import type { PromptbookServer_ListModels_Response } from '../remote-server/interfaces/PromptbookServer_ListModels_Response';
95
- import type { PromptbookServer_Prompt_Progress } from '../remote-server/interfaces/PromptbookServer_Prompt_Progress';
96
- import type { PromptbookServer_Prompt_Request } from '../remote-server/interfaces/PromptbookServer_Prompt_Request';
97
- import type { PromptbookServer_Prompt_CollectionRequest } from '../remote-server/interfaces/PromptbookServer_Prompt_Request';
98
- import type { PromptbookServer_Prompt_AnonymousRequest } from '../remote-server/interfaces/PromptbookServer_Prompt_Request';
99
- import type { PromptbookServer_Prompt_Response } from '../remote-server/interfaces/PromptbookServer_Prompt_Response';
100
- import type { RemoteLlmExecutionToolsOptions } from '../remote-server/interfaces/RemoteLlmExecutionToolsOptions';
101
- import type { RemoteServerOptions } from '../remote-server/interfaces/RemoteServerOptions';
102
- import type { AnonymousRemoteServerOptions } from '../remote-server/interfaces/RemoteServerOptions';
103
- import type { ApplicationRemoteServerOptions } from '../remote-server/interfaces/RemoteServerOptions';
104
- import type { ApplicationRemoteServerClientOptions } from '../remote-server/interfaces/RemoteServerOptions';
90
+ import type { PromptbookServer_Identification } from '../remote-server/socket-types/_subtypes/PromptbookServer_Identification';
91
+ import type { PromptbookServer_ApplicationIdentification } from '../remote-server/socket-types/_subtypes/PromptbookServer_Identification';
92
+ import type { PromptbookServer_AnonymousIdentification } from '../remote-server/socket-types/_subtypes/PromptbookServer_Identification';
93
+ import type { RemoteClientOptions } from '../remote-server/types/RemoteClientOptions';
94
+ import type { RemoteServerOptions } from '../remote-server/types/RemoteServerOptions';
95
+ import type { AnonymousRemoteServerOptions } from '../remote-server/types/RemoteServerOptions';
96
+ import type { ApplicationRemoteServerOptions } from '../remote-server/types/RemoteServerOptions';
97
+ import type { ApplicationRemoteServerClientOptions } from '../remote-server/types/RemoteServerOptions';
105
98
  import type { Converter } from '../scrapers/_common/Converter';
106
99
  import type { ScraperAndConverterMetadata } from '../scrapers/_common/register/ScraperAndConverterMetadata';
107
100
  import type { ScraperConstructor } from '../scrapers/_common/register/ScraperConstructor';
@@ -118,6 +111,8 @@ import type { CompletionModelRequirements } from '../types/ModelRequirements';
118
111
  import type { ChatModelRequirements } from '../types/ModelRequirements';
119
112
  import type { EmbeddingModelRequirements } from '../types/ModelRequirements';
120
113
  import type { ModelVariant } from '../types/ModelVariant';
114
+ import type { NonEmptyArray } from '../types/NonEmptyArray';
115
+ import type { NonEmptyReadonlyArray } from '../types/NonEmptyArray';
121
116
  import type { Prompt } from '../types/Prompt';
122
117
  import type { CompletionPrompt } from '../types/Prompt';
123
118
  import type { ChatPrompt } from '../types/Prompt';
@@ -353,17 +348,10 @@ export type { SimpleTaskJson };
353
348
  export type { TaskJson };
354
349
  export type { PipelineString };
355
350
  export type { PrepareAndScrapeOptions };
356
- export type { PromptbookServer_Error };
357
- export type { PromptbookServer_ListModels_Request };
358
- export type { PromptbookServer_ListModels_CollectionRequest };
359
- export type { PromptbookServer_ListModels_AnonymousRequest };
360
- export type { PromptbookServer_ListModels_Response };
361
- export type { PromptbookServer_Prompt_Progress };
362
- export type { PromptbookServer_Prompt_Request };
363
- export type { PromptbookServer_Prompt_CollectionRequest };
364
- export type { PromptbookServer_Prompt_AnonymousRequest };
365
- export type { PromptbookServer_Prompt_Response };
366
- export type { RemoteLlmExecutionToolsOptions };
351
+ export type { PromptbookServer_Identification };
352
+ export type { PromptbookServer_ApplicationIdentification };
353
+ export type { PromptbookServer_AnonymousIdentification };
354
+ export type { RemoteClientOptions };
367
355
  export type { RemoteServerOptions };
368
356
  export type { AnonymousRemoteServerOptions };
369
357
  export type { ApplicationRemoteServerOptions };
@@ -384,6 +372,8 @@ export type { CompletionModelRequirements };
384
372
  export type { ChatModelRequirements };
385
373
  export type { EmbeddingModelRequirements };
386
374
  export type { ModelVariant };
375
+ export type { NonEmptyArray };
376
+ export type { NonEmptyReadonlyArray };
387
377
  export type { Prompt };
388
378
  export type { CompletionPrompt };
389
379
  export type { ChatPrompt };
@@ -20,6 +20,8 @@ export type PipelineCollection = {
20
20
  getPipelineByUrl(url: string_pipeline_url): Promisable<PipelineJson>;
21
21
  /**
22
22
  * Checks whether given prompt was defined in any pipeline in the collection
23
+ *
24
+ * @deprecated Make better mechanism for skimming the remote server
23
25
  */
24
26
  isResponsibleForPrompt(prompt: Prompt): Promisable<boolean>;
25
27
  };
@@ -1,6 +1,6 @@
1
- import type { RemoteServerOptions } from '../remote-server/interfaces/RemoteServerOptions';
2
1
  import type { PipelineJson } from '../pipeline/PipelineJson/PipelineJson';
3
2
  import type { PipelineString } from '../pipeline/PipelineString';
3
+ import type { RemoteClientOptions } from '../remote-server/types/RemoteClientOptions';
4
4
  /**
5
5
  * Compile pipeline from string (markdown) format to JSON format
6
6
  *
@@ -10,9 +10,12 @@ import type { PipelineString } from '../pipeline/PipelineString';
10
10
  * Note: This function acts as compilation process
11
11
  *
12
12
  * @param pipelineString {Promptbook} in string markdown format (.book.md)
13
- * @param options - Options for remote server compilation
13
+ * @param options - Configuration of the remote server
14
14
  * @returns {Promptbook} compiled in JSON format (.book.json)
15
15
  * @throws {ParseError} if the promptbook string is not valid
16
16
  * @public exported from `@promptbook/remote-client`
17
17
  */
18
- export declare function compilePipelineOnRemoteServer<TCustomOptions = undefined>(pipelineString: PipelineString, options: RemoteServerOptions<TCustomOptions>): Promise<PipelineJson>;
18
+ export declare function compilePipelineOnRemoteServer<TCustomOptions = undefined>(pipelineString: PipelineString, options: RemoteClientOptions<TCustomOptions>): Promise<PipelineJson>;
19
+ /**
20
+ * TODO: !!!! Do not return Promise<PipelineJson> But PreparePipelineTask
21
+ */
@@ -1,6 +1,6 @@
1
1
  import type { ClientOptions } from '@anthropic-ai/sdk';
2
2
  import type { CommonToolsOptions } from '../../execution/CommonToolsOptions';
3
- import type { RemoteLlmExecutionToolsOptions } from '../../remote-server/interfaces/RemoteLlmExecutionToolsOptions';
3
+ import type { RemoteClientOptions } from '../../remote-server/types/RemoteClientOptions';
4
4
  /**
5
5
  * Options for `AnthropicClaudeExecutionTools`
6
6
  *
@@ -25,7 +25,7 @@ export type AnthropicClaudeExecutionToolsDirectOptions = CommonToolsOptions & Cl
25
25
  */
26
26
  export type AnthropicClaudeExecutionToolsProxiedOptions = CommonToolsOptions & ClientOptions & {
27
27
  isProxied: true;
28
- } & Pick<RemoteLlmExecutionToolsOptions<undefined>, 'remoteUrl' | 'path'>;
28
+ } & Pick<RemoteClientOptions<undefined>, 'remoteUrl' | 'path'>;
29
29
  /**
30
30
  * TODO: [🧠][🤺] Pass `userId`
31
31
  */
@@ -3,13 +3,13 @@ import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
3
3
  import type { ChatPromptResult } from '../../execution/PromptResult';
4
4
  import type { CompletionPromptResult } from '../../execution/PromptResult';
5
5
  import type { EmbeddingPromptResult } from '../../execution/PromptResult';
6
+ import type { RemoteClientOptions } from '../../remote-server/types/RemoteClientOptions';
6
7
  import type { ChatPrompt } from '../../types/Prompt';
7
8
  import type { CompletionPrompt } from '../../types/Prompt';
8
9
  import type { EmbeddingPrompt } from '../../types/Prompt';
9
10
  import type { string_markdown } from '../../types/typeAliases';
10
11
  import type { string_markdown_text } from '../../types/typeAliases';
11
12
  import type { string_title } from '../../types/typeAliases';
12
- import type { RemoteLlmExecutionToolsOptions } from '../../remote-server/interfaces/RemoteLlmExecutionToolsOptions';
13
13
  /**
14
14
  * Remote server is a proxy server that uses its execution tools internally and exposes the executor interface externally.
15
15
  *
@@ -20,8 +20,8 @@ import type { RemoteLlmExecutionToolsOptions } from '../../remote-server/interfa
20
20
  * @public exported from `@promptbook/remote-client`
21
21
  */
22
22
  export declare class RemoteLlmExecutionTools<TCustomOptions = undefined> implements LlmExecutionTools {
23
- protected readonly options: RemoteLlmExecutionToolsOptions<TCustomOptions>;
24
- constructor(options: RemoteLlmExecutionToolsOptions<TCustomOptions>);
23
+ protected readonly options: RemoteClientOptions<TCustomOptions>;
24
+ constructor(options: RemoteClientOptions<TCustomOptions>);
25
25
  get title(): string_title & string_markdown_text;
26
26
  get description(): string_markdown;
27
27
  /**
@@ -32,10 +32,6 @@ export declare class RemoteLlmExecutionTools<TCustomOptions = undefined> impleme
32
32
  * List all available models that can be used
33
33
  */
34
34
  listModels(): Promise<ReadonlyArray<AvailableModel>>;
35
- /**
36
- * Creates a connection to the remote proxy server.
37
- */
38
- private makeConnection;
39
35
  /**
40
36
  * Calls remote proxy server to use a chat model
41
37
  */
@@ -1,12 +1,14 @@
1
+ import { SetRequired } from 'type-fest';
1
2
  import type { string_formfactor_name } from '../../formfactors/_common/string_formfactor_name';
2
3
  import type { PipelineJson } from '../../pipeline/PipelineJson/PipelineJson';
4
+ import type { NonEmptyReadonlyArray } from '../../types/NonEmptyArray';
3
5
  /**
4
6
  * @@@
5
7
  *
6
8
  * @singleton
7
9
  * @private internal cache of `getBookTemplate`
8
10
  */
9
- export declare let pipelines: Array<PipelineJson> | null;
11
+ export declare let pipelines: Array<SetRequired<PipelineJson, 'pipelineUrl'>> | null;
10
12
  /**
11
13
  * Get template for new book
12
14
  *
@@ -14,9 +16,9 @@ export declare let pipelines: Array<PipelineJson> | null;
14
16
  * @returns list of pipelines
15
17
  * @public exported from `@promptbook/templates`
16
18
  */
17
- export declare function getBookTemplates(formfactorName?: string_formfactor_name): ReadonlyArray<PipelineJson>;
19
+ export declare function getBookTemplates(formfactorName?: string_formfactor_name): NonEmptyReadonlyArray<SetRequired<PipelineJson, 'pipelineUrl'>>;
18
20
  /**
19
- * TODO: Unit test
21
+ * TODO: Unit test + test that what we guarantee - always return non-empty array is true for e
20
22
  * TODO: [🧠] Which is the best place for this function
21
23
  * TODO: !!6 For GENERIC template ensure at least one pipeline is present for typescript in `getBookTemplates`
22
24
  */
@@ -1,5 +1,5 @@
1
- import type { RemoteServerOptions } from '../remote-server/interfaces/RemoteServerOptions';
2
1
  import type { PipelineJson } from '../pipeline/PipelineJson/PipelineJson';
2
+ import type { RemoteClientOptions } from '../remote-server/types/RemoteClientOptions';
3
3
  /**
4
4
  * Prepare pipeline on remote server
5
5
  *
@@ -11,4 +11,7 @@ import type { PipelineJson } from '../pipeline/PipelineJson/PipelineJson';
11
11
  *
12
12
  * @public exported from `@promptbook/remote-client`
13
13
  */
14
- export declare function preparePipelineOnRemoteServer<TCustomOptions = undefined>(pipeline: PipelineJson, options: RemoteServerOptions<TCustomOptions>): Promise<PipelineJson>;
14
+ export declare function preparePipelineOnRemoteServer<TCustomOptions = undefined>(pipeline: PipelineJson, options: RemoteClientOptions<TCustomOptions>): Promise<PipelineJson>;
15
+ /**
16
+ * TODO: !!!! Do not return Promise<PipelineJson> But PreparePipelineTask
17
+ */
@@ -0,0 +1,10 @@
1
+ import type { Socket } from 'socket.io-client';
2
+ import type { RemoteClientOptions } from './types/RemoteClientOptions';
3
+ /**
4
+ * Creates a connection to the remote proxy server.
5
+ *
6
+ * Note: This function creates a connection to the remote server and returns a socket but responsibility of closing the connection is on the caller
7
+ *
8
+ * @private internal utility function
9
+ */
10
+ export declare function createRemoteClient<TCustomOptions = undefined>(options: RemoteClientOptions<TCustomOptions>): Promise<Socket>;
@@ -1,7 +1,7 @@
1
- import type { ErrorJson } from '../../errors/utils/ErrorJson';
1
+ import type { ErrorJson } from '../../../errors/utils/ErrorJson';
2
2
  /**
3
- * Socket.io error for remote text generation
4
- *
5
3
  * This is sent from server to client when error occurs and stops the process
4
+ *
5
+ * @private internal type of remote server
6
6
  */
7
7
  export type PromptbookServer_Error = ErrorJson;
@@ -0,0 +1,10 @@
1
+ import type { TaskProgress } from '../../../types/TaskProgress';
2
+ /**
3
+ * This is sent from server to client as indication of prograss arbitrarily and may be sent multiple times
4
+ *
5
+ * @private internal type of remote server
6
+ */
7
+ export type PromptbookServer_Progress = TaskProgress;
8
+ /**
9
+ * TODO: `PromptbookServer_Progress` is unused for now, but it will be used in the future
10
+ */
@@ -0,0 +1,49 @@
1
+ import type { LlmToolsConfiguration } from '../../../llm-providers/_common/register/LlmToolsConfiguration';
2
+ import type { string_user_id } from '../../../types/typeAliases';
3
+ import type { ApplicationRemoteServerClientOptions } from '../../types/RemoteServerOptions';
4
+ /**
5
+ * Identification of client for Socket.io remote server
6
+ *
7
+ * @public exported from `@promptbook/remote-server`
8
+ * @public exported from `@promptbook/remote-client`
9
+ */
10
+ export type PromptbookServer_Identification<TCustomOptions> = PromptbookServer_ApplicationIdentification<TCustomOptions> | PromptbookServer_AnonymousIdentification;
11
+ /**
12
+ * Application mode is @@@!!!
13
+ *
14
+ * @public exported from `@promptbook/remote-server`
15
+ * @public exported from `@promptbook/remote-client`
16
+ */
17
+ export type PromptbookServer_ApplicationIdentification<TCustomOptions> = ApplicationRemoteServerClientOptions<TCustomOptions> & {
18
+ /**
19
+ * Application mode
20
+ */
21
+ readonly isAnonymous: false;
22
+ };
23
+ /**
24
+ * Anonymous mode is @@@!!!
25
+ *
26
+ * @public exported from `@promptbook/remote-server`
27
+ * @public exported from `@promptbook/remote-client`
28
+ */
29
+ export type PromptbookServer_AnonymousIdentification = {
30
+ /**
31
+ * Anonymous mode
32
+ */
33
+ readonly isAnonymous: true;
34
+ /**
35
+ * Identifier of the end user
36
+ *
37
+ * Note: this is passed to the certain model providers to identify misuse
38
+ * Note: In anonymous mode, there is no need to identify yourself, nor does it change the actual configuration of LLM Tools (unlike in application mode)
39
+ */
40
+ readonly userId?: string_user_id;
41
+ /**
42
+ * Configuration for the LLM tools
43
+ */
44
+ readonly llmToolsConfiguration: LlmToolsConfiguration;
45
+ };
46
+ /**
47
+ * TODO: [🧠][🛍] Maybe not `isAnonymous: boolean` BUT `mode: 'ANONYMOUS'|'COLLECTION'`
48
+ * TODO: [🧠][🤺] Maybe allow overriding of `userId` for each prompt - Pass `userId` in `PromptbookServer_ListModels_Request`
49
+ */
@@ -0,0 +1,17 @@
1
+ import type { PromptbookServer_Identification } from '../_subtypes/PromptbookServer_Identification';
2
+ /**
3
+ * List models available in the server
4
+ *
5
+ * This is a request from client to server
6
+ *
7
+ * @private internal type of remote server
8
+ */
9
+ export type PromptbookServer_ListModels_Request<TCustomOptions> = {
10
+ /**
11
+ * Identifier of the end user or application
12
+ */
13
+ readonly identification: PromptbookServer_Identification<TCustomOptions>;
14
+ };
15
+ /**
16
+ * TODO: [🧠] Listing models inanonymous mode does not make sence - keeping only to preserve consistency
17
+ */
@@ -1,8 +1,10 @@
1
- import type { AvailableModel } from '../../execution/AvailableModel';
1
+ import type { AvailableModel } from '../../../execution/AvailableModel';
2
2
  /**
3
- * Socket.io error for remote text generation
3
+ * Models available for use in the server
4
4
  *
5
5
  * This is sent from server to client when models are listed
6
+ *
7
+ * @private internal type of remote server
6
8
  */
7
9
  export type PromptbookServer_ListModels_Response = {
8
10
  /**
@@ -0,0 +1,17 @@
1
+ import type { PipelineJson } from '../../../pipeline/PipelineJson/PipelineJson';
2
+ import type { PromptbookServer_Identification } from '../_subtypes/PromptbookServer_Identification';
3
+ /**
4
+ * This is a request from client to server to prepare a pipeline
5
+ *
6
+ * @private internal type of remote server
7
+ */
8
+ export type PromptbookServer_PreparePipeline_Request<TCustomOptions> = {
9
+ /**
10
+ * Identifier of the end user or application
11
+ */
12
+ readonly identification: PromptbookServer_Identification<TCustomOptions>;
13
+ /**
14
+ * The Pipeline to prepare
15
+ */
16
+ readonly pipeline: PipelineJson;
17
+ };
@@ -0,0 +1,12 @@
1
+ import type { PipelineJson } from '../../../pipeline/PipelineJson/PipelineJson';
2
+ /**
3
+ * This is sent from server to client when the pipeline is prepared
4
+ *
5
+ * @private internal type of remote server
6
+ */
7
+ export type PromptbookServer_PreparePipeline_Response = {
8
+ /**
9
+ * Prepared pipeline
10
+ */
11
+ readonly preparedPipeline: PipelineJson;
12
+ };
@@ -0,0 +1,17 @@
1
+ import type { Prompt } from '../../../types/Prompt';
2
+ import type { PromptbookServer_Identification } from '../_subtypes/PromptbookServer_Identification';
3
+ /**
4
+ * This is a request from client to server to execute a prompt
5
+ *
6
+ * @private internal type of remote server
7
+ */
8
+ export type PromptbookServer_Prompt_Request<TCustomOptions> = {
9
+ /**
10
+ * Identifier of the end user or application
11
+ */
12
+ readonly identification: PromptbookServer_Identification<TCustomOptions>;
13
+ /**
14
+ * The Prompt to execute
15
+ */
16
+ readonly prompt: Prompt;
17
+ };
@@ -1,8 +1,8 @@
1
- import type { PromptResult } from '../../execution/PromptResult';
1
+ import type { PromptResult } from '../../../execution/PromptResult';
2
2
  /**
3
- * Socket.io error for remote text generation
4
- *
5
3
  * This is sent from server to client when the generated text is completed
4
+ *
5
+ * @private internal type of remote server
6
6
  */
7
7
  export type PromptbookServer_Prompt_Response = {
8
8
  /**
@@ -1,5 +1,5 @@
1
1
  import type { IDestroyable } from 'destroyable';
2
- import type { RemoteServerOptions } from './interfaces/RemoteServerOptions';
2
+ import type { RemoteServerOptions } from './types/RemoteServerOptions';
3
3
  /**
4
4
  * Remote server is a proxy server that uses its execution tools internally and exposes the executor interface externally.
5
5
  *
@@ -11,6 +11,7 @@ import type { RemoteServerOptions } from './interfaces/RemoteServerOptions';
11
11
  */
12
12
  export declare function startRemoteServer<TCustomOptions = undefined>(options: RemoteServerOptions<TCustomOptions>): IDestroyable;
13
13
  /**
14
+ * TODO: Split this file into multiple functions - handler for each request
14
15
  * TODO: Maybe use `$exportJson`
15
16
  * TODO: [🧠][🛍] Maybe not `isAnonymous: boolean` BUT `mode: 'ANONYMOUS'|'COLLECTION'`
16
17
  * TODO: [⚖] Expose the collection to be able to connect to same collection via createCollectionFromUrl
@@ -19,5 +20,5 @@ export declare function startRemoteServer<TCustomOptions = undefined>(options: R
19
20
  * TODO: [🗯] Timeout on chat to free up resources
20
21
  * TODO: [🃏] Pass here some security token to prevent malitious usage and/or DDoS
21
22
  * TODO: [0] Set unavailable models as undefined in `RemoteLlmExecutionTools` NOT throw error here
22
- * TODO: Constrain anonymous mode for specific models / providers
23
+ * TODO: Allow to constrain anonymous mode for specific models / providers
23
24
  */
@@ -0,0 +1,32 @@
1
+ import type { CommonToolsOptions } from '../../execution/CommonToolsOptions';
2
+ import type { string_base_url } from '../../types/typeAliases';
3
+ import type { string_uri } from '../../types/typeAliases';
4
+ import type { PromptbookServer_Identification } from '../socket-types/_subtypes/PromptbookServer_Identification';
5
+ /**
6
+ * Options for `RemoteLlmExecutionTools`
7
+ *
8
+ * @public exported from `@promptbook/remote-client`
9
+ */
10
+ export type RemoteClientOptions<TCustomOptions> = CommonToolsOptions & {
11
+ /**
12
+ * URL of the remote server
13
+ * On this server will be connected to the socket.io server
14
+ */
15
+ readonly remoteUrl: string_base_url;
16
+ /**
17
+ * Path for the Socket.io server to listen
18
+ *
19
+ * @default '/socket.io'
20
+ * @example '/promptbook/socket.io'
21
+ */
22
+ readonly path: string_uri;
23
+ /**
24
+ * Identification of client for Socket.io remote server
25
+ */
26
+ readonly identification: PromptbookServer_Identification<TCustomOptions>;
27
+ };
28
+ /**
29
+ * TODO: Pass more options from Socket.io to `RemoteClientOptions` (like `transports`)
30
+ * TODO: [🧠][🛍] Maybe not `isAnonymous: boolean` BUT `mode: 'ANONYMOUS'|'COLLECTION'`
31
+ * TODO: [🧠][🧜‍♂️] Maybe join remoteUrl and path into single value
32
+ */
@@ -5,6 +5,7 @@
5
5
  * 2) Undefined represents empty array
6
6
  * 3) Array represents itself
7
7
  *
8
+ * @deprecated Use `Arrayable` from `type-fest` instead
8
9
  * @private internal type
9
10
  */
10
11
  export type Arrayable<TItem> = TItem | ReadonlyArray<TItem> | undefined;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Represents an array that is guaranteed to have at least one element
3
+ */
4
+ export type NonEmptyArray<TItem> = [TItem, ...TItem[]];
5
+ /**
6
+ * Represents an array that is guaranteed to have at least one element and is readonly
7
+ */
8
+ export type NonEmptyReadonlyArray<TItem> = ReadonlyArray<TItem> & NonEmptyArray<TItem>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/markdown-utils",
3
- "version": "0.82.0-0",
3
+ "version": "0.82.0-2",
4
4
  "description": "It's time for a paradigm shift. The future of software in plain English, French or Latin",
5
5
  "--note-0": " <- [🐊]",
6
6
  "private": false,
package/umd/index.umd.js CHANGED
@@ -24,7 +24,7 @@
24
24
  * @generated
25
25
  * @see https://github.com/webgptorg/promptbook
26
26
  */
27
- var PROMPTBOOK_ENGINE_VERSION = '0.81.0-23';
27
+ var PROMPTBOOK_ENGINE_VERSION = '0.82.0-1';
28
28
  /**
29
29
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
30
30
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -360,7 +360,7 @@
360
360
  * TODO: [🏢] Make this logic part of `JsonFormatDefinition` or `isValidJsonString`
361
361
  */
362
362
 
363
- var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}",resultingParameterName:"knowledgePieces",dependentParameterNames:["knowledgeContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Knowledge from Markdown\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book.md`\n- INPUT PARAMETER `{knowledgeContent}` Markdown document content\n- OUTPUT PARAMETER `{knowledgePieces}` The knowledge JSON object\n\n## Knowledge\n\n<!-- TODO: [🍆] -FORMAT JSON -->\n\n```markdown\nYou are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}\n```\n\n`-> {knowledgePieces}`\n"}],sourceFile:"./books/prepare-knowledge-from-markdown.book.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}",resultingParameterName:"keywords",dependentParameterNames:["knowledgePieceContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Keywords\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-keywords.book.md`\n- INPUT PARAMETER `{knowledgePieceContent}` The content\n- OUTPUT PARAMETER `{keywords}` Keywords separated by comma\n\n## Knowledge\n\n<!-- TODO: [🍆] -FORMAT JSON -->\n\n```markdown\nYou are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}\n```\n\n`-> {keywords}`\n"}],sourceFile:"./books/prepare-knowledge-keywords.book.md"},{title:"Prepare Knowledge-piece Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Title should be concise and clear - Write maximum ideally 2 words, maximum 5 words\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}",resultingParameterName:"title",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Knowledge-piece Title\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-title.book.md`\n- INPUT PARAMETER `{knowledgePieceContent}` The content\n- OUTPUT PARAMETER `{title}` The title of the document\n\n## Knowledge\n\n- EXPECT MIN 1 WORD\n- EXPECT MAX 8 WORDS\n\n```markdown\nYou are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Title should be concise and clear - Write maximum ideally 2 words, maximum 5 words\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}\n```\n\n`-> {title}`\n"}],sourceFile:"./books/prepare-knowledge-title.book.md"},{title:"Prepare Persona",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.book.md",formfactorName:"GENERIC",parameters:[{name:"availableModelNames",description:"List of available model names separated by comma (,)",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-model-requirements",title:"Make modelRequirements",content:"You are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Example\n\n```json\n{\n\"modelName\": \"gpt-4o\",\n\"systemMessage\": \"You are experienced AI engineer and helpfull assistant.\",\n\"temperature\": 0.7\n}\n```\n\n## Instructions\n\n- Your output format is JSON object\n- Write just the JSON object, no other text should be present\n- It contains the following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}",resultingParameterName:"modelRequirements",format:"JSON",dependentParameterNames:["availableModelNames","personaDescription"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Persona\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-persona.book.md`\n- INPUT PARAMETER `{availableModelNames}` List of available model names separated by comma (,)\n- INPUT PARAMETER `{personaDescription}` Description of the persona\n- OUTPUT PARAMETER `{modelRequirements}` Specific requirements for the model\n\n## Make modelRequirements\n\n- FORMAT JSON\n\n```markdown\nYou are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Example\n\n\\`\\`\\`json\n{\n\"modelName\": \"gpt-4o\",\n\"systemMessage\": \"You are experienced AI engineer and helpfull assistant.\",\n\"temperature\": 0.7\n}\n\\`\\`\\`\n\n## Instructions\n\n- Your output format is JSON object\n- Write just the JSON object, no other text should be present\n- It contains the following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}\n```\n\n`-> {modelRequirements}`\n"}],sourceFile:"./books/prepare-persona.book.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-title.book.md",formfactorName:"GENERIC",parameters:[{name:"book",description:"The book to prepare the title for",isInput:true,isOutput:false},{name:"title",description:"Best title for the book",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-title",title:"Make title",content:"Make best title for given text which describes the task:\n\n> {book}\n\n## Rules\n\n- Write just title, nothing else\n- Title should be concise and clear\n- Title starts with emoticon",resultingParameterName:"title",expectations:{words:{min:1,max:8},lines:{min:1,max:1}},dependentParameterNames:["book"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Title\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-title.book.md`\n- INPUT PARAMETER `{book}` The book to prepare the title for\n- OUTPUT PARAMETER `{title}` Best title for the book\n\n## Make title\n\n- EXPECT MIN 1 Word\n- EXPECT MAX 8 Words\n- EXPECT EXACTLY 1 Line\n\n```markdown\nMake best title for given text which describes the task:\n\n> {book}\n\n## Rules\n\n- Write just title, nothing else\n- Title should be concise and clear\n- Title starts with emoticon\n```\n\n`-> {title}`\n"}],sourceFile:"./books/prepare-title.book.md"}];
363
+ var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}",resultingParameterName:"knowledgePieces",dependentParameterNames:["knowledgeContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Knowledge from Markdown\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book.md`\n- INPUT PARAMETER `{knowledgeContent}` Markdown document content\n- OUTPUT PARAMETER `{knowledgePieces}` The knowledge JSON object\n\n## Knowledge\n\n<!-- TODO: [🍆] -FORMAT JSON -->\n\n```markdown\nYou are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}\n```\n\n`-> {knowledgePieces}`\n"}],sourceFile:"./books/prepare-knowledge-from-markdown.book.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}",resultingParameterName:"keywords",dependentParameterNames:["knowledgePieceContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Keywords\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-keywords.book.md`\n- INPUT PARAMETER `{knowledgePieceContent}` The content\n- OUTPUT PARAMETER `{keywords}` Keywords separated by comma\n\n## Knowledge\n\n<!-- TODO: [🍆] -FORMAT JSON -->\n\n```markdown\nYou are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}\n```\n\n`-> {keywords}`\n"}],sourceFile:"./books/prepare-knowledge-keywords.book.md"},{title:"Prepare Knowledge-piece Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}",resultingParameterName:"title",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Knowledge-piece Title\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-title.book.md`\n- INPUT PARAMETER `{knowledgePieceContent}` The content\n- OUTPUT PARAMETER `{title}` The title of the document\n\n## Knowledge\n\n- EXPECT MIN 1 WORD\n- EXPECT MAX 8 WORDS\n\n```markdown\nYou are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}\n```\n\n`-> {title}`\n"}],sourceFile:"./books/prepare-knowledge-title.book.md"},{title:"Prepare Persona",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.book.md",formfactorName:"GENERIC",parameters:[{name:"availableModelNames",description:"List of available model names separated by comma (,)",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-model-requirements",title:"Make modelRequirements",content:"You are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Example\n\n```json\n{\n\"modelName\": \"gpt-4o\",\n\"systemMessage\": \"You are experienced AI engineer and helpfull assistant.\",\n\"temperature\": 0.7\n}\n```\n\n## Instructions\n\n- Your output format is JSON object\n- Write just the JSON object, no other text should be present\n- It contains the following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}",resultingParameterName:"modelRequirements",format:"JSON",dependentParameterNames:["availableModelNames","personaDescription"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Persona\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-persona.book.md`\n- INPUT PARAMETER `{availableModelNames}` List of available model names separated by comma (,)\n- INPUT PARAMETER `{personaDescription}` Description of the persona\n- OUTPUT PARAMETER `{modelRequirements}` Specific requirements for the model\n\n## Make modelRequirements\n\n- FORMAT JSON\n\n```markdown\nYou are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Example\n\n\\`\\`\\`json\n{\n\"modelName\": \"gpt-4o\",\n\"systemMessage\": \"You are experienced AI engineer and helpfull assistant.\",\n\"temperature\": 0.7\n}\n\\`\\`\\`\n\n## Instructions\n\n- Your output format is JSON object\n- Write just the JSON object, no other text should be present\n- It contains the following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}\n```\n\n`-> {modelRequirements}`\n"}],sourceFile:"./books/prepare-persona.book.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-title.book.md",formfactorName:"GENERIC",parameters:[{name:"book",description:"The book to prepare the title for",isInput:true,isOutput:false},{name:"title",description:"Best title for the book",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-title",title:"Make title",content:"Make best title for given text which describes the workflow:\n\n## Rules\n\n- Write just title, nothing else\n- Title should be concise and clear - Write maximum ideally 2 words, maximum 5 words\n- Title starts with emoticon\n- Title should not mention the input and output of the workflow but the main purpose of the workflow\n _For example, not \"✍ Convert Knowledge-piece to title\" but \"✍ Title\"_\n\n## The workflow\n\n> {book}",resultingParameterName:"title",expectations:{words:{min:1,max:8},lines:{min:1,max:1}},dependentParameterNames:["book"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Title\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-title.book.md`\n- INPUT PARAMETER `{book}` The book to prepare the title for\n- OUTPUT PARAMETER `{title}` Best title for the book\n\n## Make title\n\n- EXPECT MIN 1 Word\n- EXPECT MAX 8 Words\n- EXPECT EXACTLY 1 Line\n\n```markdown\nMake best title for given text which describes the workflow:\n\n## Rules\n\n- Write just title, nothing else\n- Title should be concise and clear - Write maximum ideally 2 words, maximum 5 words\n- Title starts with emoticon\n- Title should not mention the input and output of the workflow but the main purpose of the workflow\n _For example, not \"✍ Convert Knowledge-piece to title\" but \"✍ Title\"_\n\n## The workflow\n\n> {book}\n```\n\n`-> {title}`\n"}],sourceFile:"./books/prepare-title.book.md"}];
364
364
 
365
365
  /**
366
366
  * Function `validatePipelineString` will validate the if the string is a valid pipeline string