@promptbook/node 0.67.0-3 → 0.67.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -157,7 +157,7 @@ import type { string_protocol } from '../types/typeAliases';
157
157
  import type { string_email } from '../types/typeAliases';
158
158
  import type { string_emails } from '../types/typeAliases';
159
159
  import type { string_uuid } from '../types/typeAliases';
160
- import type { client_id } from '../types/typeAliases';
160
+ import type { string_user_id } from '../types/typeAliases';
161
161
  import type { string_sha256 } from '../types/typeAliases';
162
162
  import type { string_semantic_version } from '../types/typeAliases';
163
163
  import type { string_version_dependency } from '../types/typeAliases';
@@ -383,7 +383,7 @@ export type { string_protocol };
383
383
  export type { string_email };
384
384
  export type { string_emails };
385
385
  export type { string_uuid };
386
- export type { client_id };
386
+ export type { string_user_id };
387
387
  export type { string_sha256 };
388
388
  export type { string_semantic_version };
389
389
  export type { string_version_dependency };
@@ -1,4 +1,3 @@
1
- import type { client_id } from '../../../types/typeAliases';
2
1
  import type { LlmToolsConfiguration } from '../../_common/LlmToolsConfiguration';
3
2
  /**
4
3
  * Socket.io progress for remote text generation
@@ -11,10 +10,6 @@ export type PromptbookServer_ListModels_CollectionRequest = {
11
10
  * Collection mode
12
11
  */
13
12
  isAnonymous: false;
14
- /**
15
- * Client responsible for the requests
16
- */
17
- readonly clientId: client_id;
18
13
  };
19
14
  export type PromptbookServer_ListModels_AnonymousRequest = {
20
15
  /**
@@ -29,6 +24,6 @@ export type PromptbookServer_ListModels_AnonymousRequest = {
29
24
  /**
30
25
  * TODO: [ðŸ‘Ą] DRY `PromptbookServer_Prompt_Request` and `PromptbookServer_ListModels_Request`
31
26
  * TODO: [🧠][🛍] Maybe not `isAnonymous: boolean` BUT `mode: 'ANONYMOUS'|'COLLECTION'`
32
- * TODO: [🧠][ðŸĪš] Pass `clientId` in `PromptbookServer_ListModels_Request`
27
+ * TODO: [🧠][ðŸĪš] Pass `userId` in `PromptbookServer_ListModels_Request`
33
28
  * TODO: [👒] Listing models (and checking configuration) probbably should go through REST API not Socket.io
34
29
  */
@@ -1,5 +1,5 @@
1
1
  import type { Prompt } from '../../../types/Prompt';
2
- import type { client_id } from '../../../types/typeAliases';
2
+ import type { string_user_id } from '../../../types/typeAliases';
3
3
  import type { LlmToolsConfiguration } from '../../_common/LlmToolsConfiguration';
4
4
  /**
5
5
  * Socket.io progress for remote text generation
@@ -11,11 +11,14 @@ export type PromptbookServer_Prompt_CollectionRequest = {
11
11
  /**
12
12
  * Collection mode
13
13
  */
14
- isAnonymous: false;
14
+ readonly isAnonymous: false;
15
15
  /**
16
- * Client responsible for the requests
16
+ * Identifier of the end user
17
+ *
18
+ * Note: this is passed to the certain model providers to identify misuse
19
+ * Note: In anonymous mode it is not required to identify
17
20
  */
18
- readonly clientId: client_id;
21
+ readonly userId: string_user_id;
19
22
  /**
20
23
  * The Prompt to execute
21
24
  */
@@ -25,7 +28,14 @@ export type PromptbookServer_Prompt_AnonymousRequest = {
25
28
  /**
26
29
  * Anonymous mode
27
30
  */
28
- isAnonymous: true;
31
+ readonly isAnonymous: true;
32
+ /**
33
+ * Identifier of the end user
34
+ *
35
+ * Note: this is passed to the certain model providers to identify misuse
36
+ * Note: In anonymous mode it is not required to identify
37
+ */
38
+ readonly userId?: string_user_id;
29
39
  /**
30
40
  * Configuration for the LLM tools
31
41
  */
@@ -38,4 +48,4 @@ export type PromptbookServer_Prompt_AnonymousRequest = {
38
48
  /**
39
49
  * TODO: [ðŸ‘Ą] DRY `PromptbookServer_Prompt_Request` and `PromptbookServer_ListModels_Request`
40
50
  * TODO: [🧠][🛍] Maybe not `isAnonymous: boolean` BUT `mode: 'ANONYMOUS'|'COLLECTION'`
41
- */
51
+ */
@@ -1,7 +1,7 @@
1
1
  import type { CommonExecutionToolsOptions } from '../../../execution/CommonExecutionToolsOptions';
2
- import type { client_id } from '../../../types/typeAliases';
3
2
  import type { string_base_url } from '../../../types/typeAliases';
4
3
  import type { string_uri } from '../../../types/typeAliases';
4
+ import type { string_user_id } from '../../../types/typeAliases';
5
5
  import type { LlmToolsConfiguration } from '../../_common/LlmToolsConfiguration';
6
6
  /**
7
7
  * Options for `RemoteLlmExecutionTools`
@@ -34,15 +34,24 @@ export type RemoteLlmExecutionToolsOptions = CommonExecutionToolsOptions & {
34
34
  * Configuration for the LLM tools
35
35
  */
36
36
  readonly llmToolsConfiguration: LlmToolsConfiguration;
37
+ /**
38
+ * Identifier of the end user
39
+ *
40
+ * Note: this is passed to the certain model providers to identify misuse
41
+ * Note: In anonymous mode it is not required to identify
42
+ */
43
+ readonly userId?: string_user_id;
37
44
  } | {
38
45
  /**
39
46
  * Use anonymous server with client identification and fixed collection
40
47
  */
41
48
  isAnonymous: false;
42
49
  /**
43
- * Your client ID
50
+ * Identifier of the end user
51
+ *
52
+ * Note: this is passed to the certain model providers to identify misuse
44
53
  */
45
- readonly clientId: client_id;
54
+ readonly userId: string_user_id;
46
55
  });
47
56
  /**
48
57
  * TODO: [🧠][🛍] Maybe not `isAnonymous: boolean` BUT `mode: 'ANONYMOUS'|'COLLECTION'`
@@ -1,8 +1,8 @@
1
1
  import type { PipelineCollection } from '../../../collection/PipelineCollection';
2
2
  import type { CommonExecutionToolsOptions } from '../../../execution/CommonExecutionToolsOptions';
3
3
  import type { LlmExecutionTools } from '../../../execution/LlmExecutionTools';
4
- import type { client_id } from '../../../types/typeAliases';
5
4
  import type { string_uri } from '../../../types/typeAliases';
5
+ import type { string_user_id } from '../../../types/typeAliases';
6
6
  /**
7
7
  * @@@
8
8
  *
@@ -50,7 +50,7 @@ export type CollectionRemoteServerOptions = {
50
50
  /**
51
51
  * Creates llm execution tools for each client
52
52
  */
53
- createLlmExecutionTools(clientId: client_id): LlmExecutionTools;
53
+ createLlmExecutionTools(userId: string_user_id | undefined): LlmExecutionTools;
54
54
  };
55
55
  /**
56
56
  * TODO: Constrain anonymous mode for specific models / providers
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env ts-node
2
- export {};
2
+ import '../../openai/register-constructor';
@@ -391,11 +391,9 @@ export type string_uuid = string & {
391
391
  readonly _type: 'uuid';
392
392
  };
393
393
  /**
394
- * Branded type client id
394
+ * End user identifier;
395
395
  */
396
- export type client_id = string & {
397
- readonly _type: 'client_id';
398
- };
396
+ export type string_user_id = string;
399
397
  /**
400
398
  * Semantic helper
401
399
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/node",
3
- "version": "0.67.0-3",
3
+ "version": "0.67.0",
4
4
  "description": "Supercharge your use of large language models",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -47,7 +47,7 @@
47
47
  "module": "./esm/index.es.js",
48
48
  "typings": "./esm/typings/src/_packages/node.index.d.ts",
49
49
  "peerDependencies": {
50
- "@promptbook/core": "0.67.0-3"
50
+ "@promptbook/core": "0.67.0"
51
51
  },
52
52
  "dependencies": {
53
53
  "colors": "1.4.0",
package/umd/index.umd.js CHANGED
@@ -35,7 +35,7 @@
35
35
  /**
36
36
  * The version of the Promptbook library
37
37
  */
38
- var PROMPTBOOK_VERSION = '0.67.0-2';
38
+ var PROMPTBOOK_VERSION = '0.67.0-4';
39
39
  // TODO: !!!! List here all the versions and annotate + put into script
40
40
 
41
41
  /*! *****************************************************************************
@@ -509,7 +509,7 @@
509
509
  commands.push("PIPELINE URL ".concat(pipelineUrl));
510
510
  }
511
511
  commands.push("PROMPTBOOK VERSION ".concat(promptbookVersion));
512
- // TODO: !!!!!! This increase size of the bundle and is probbably not necessary
512
+ // TODO: !!! This increase size of the bundle and is probbably not necessary
513
513
  pipelineString = prettifyMarkdown(pipelineString);
514
514
  try {
515
515
  for (var _g = __values(parameters.filter(function (_a) {
@@ -889,7 +889,7 @@
889
889
  });
890
890
  }
891
891
 
892
- var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.67.0-2",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},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}",dependentParameterNames:["knowledgeContent"],resultingParameterName:"knowledgePieces"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-from-markdown.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.ptbk.md",promptbookVersion:"0.67.0-2",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},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}",dependentParameterNames:["knowledgePieceContent"],resultingParameterName:"keywords"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-keywords.ptbk.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.ptbk.md",promptbookVersion:"0.67.0-2",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},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\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"],resultingParameterName:"title"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-title.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.ptbk.md",promptbookVersion:"0.67.0-2",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}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"make-model-requirements",title:"Make modelRequirements",modelRequirements:{modelVariant:"CHAT",modelName:"gpt-4-turbo"},content:"You are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Sample\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### Option `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Option `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### Option `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}",expectFormat:"JSON",dependentParameterNames:["availableModelNames","personaDescription"],resultingParameterName:"modelRequirements"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-persona.ptbk.md"}];
892
+ var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.67.0-4",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},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}",dependentParameterNames:["knowledgeContent"],resultingParameterName:"knowledgePieces"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-from-markdown.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.ptbk.md",promptbookVersion:"0.67.0-4",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},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}",dependentParameterNames:["knowledgePieceContent"],resultingParameterName:"keywords"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-keywords.ptbk.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.ptbk.md",promptbookVersion:"0.67.0-4",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},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\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"],resultingParameterName:"title"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-title.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.ptbk.md",promptbookVersion:"0.67.0-4",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}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"make-model-requirements",title:"Make modelRequirements",modelRequirements:{modelVariant:"CHAT",modelName:"gpt-4-turbo"},content:"You are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Sample\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### Option `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Option `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### Option `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}",expectFormat:"JSON",dependentParameterNames:["availableModelNames","personaDescription"],resultingParameterName:"modelRequirements"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-persona.ptbk.md"}];
893
893
 
894
894
  /**
895
895
  * This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
@@ -6667,6 +6667,9 @@
6667
6667
  });
6668
6668
  return __assign(__assign({}, metadata), { isMetadataAviailable: isMetadataAviailable, isInstalled: isInstalled });
6669
6669
  });
6670
+ if (metadata.length === 0) {
6671
+ return "No LLM providers are available.";
6672
+ }
6670
6673
  return spaceTrim__default["default"](function (block) { return "\n Available LLM providers are:\n ".concat(block(metadata
6671
6674
  .map(function (_a, i) {
6672
6675
  var packageName = _a.packageName, className = _a.className, isMetadataAviailable = _a.isMetadataAviailable, isInstalled = _a.isInstalled;