@promptbook/types 0.59.0-0 โ†’ 0.59.0-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -555,7 +555,7 @@ You can define postprocessing functions when creating `JavascriptEvalExecutionTo
555
555
 
556
556
  ```
557
557
 
558
- Additionally there are some usefull string-manipulation build-in functions, which are [listed here](src/execution/plugins/script-execution-tools/javascript/JavascriptEvalExecutionTools.ts).
558
+ Additionally there are some usefull string-manipulation build-in functions, which are [listed here](src/scripting/javascript/JavascriptEvalExecutionTools.ts).
559
559
 
560
560
  ### Expectations
561
561
 
package/esm/index.es.js CHANGED
@@ -11,7 +11,7 @@ var EXPECTATION_UNITS = ['CHARACTERS', 'WORDS', 'SENTENCES', 'LINES', 'PARAGRAPH
11
11
  /**
12
12
  * The version of the Promptbook library
13
13
  */
14
- var PROMPTBOOK_VERSION = '0.58.0';
14
+ var PROMPTBOOK_VERSION = '0.59.0-0';
15
15
 
16
16
  export { EXPECTATION_UNITS, PROMPTBOOK_VERSION };
17
17
  //# sourceMappingURL=index.es.js.map
@@ -1,18 +1,28 @@
1
1
  import type { LlmExecutionTools } from '../execution/LlmExecutionTools';
2
2
  import type { PromptbookJson } from '../types/PromptbookJson/PromptbookJson';
3
3
  import type { PromptbookString } from '../types/PromptbookString';
4
+ /**
5
+ * Options for promptbookStringToJson
6
+ */
7
+ type PromptbookStringToJsonOptions = {
8
+ /**
9
+ * Tools for processing required for knowledge processing *(not for actual execution)*
10
+ */
11
+ llmTools?: LlmExecutionTools;
12
+ };
4
13
  /**
5
14
  * Compile promptbook from string (markdown) format to JSON format
6
15
  *
7
16
  * @param promptbookString {Promptbook} in string markdown format (.ptbk.md)
8
- * @param llmTools {LlmExecutionTools} - tools for processing required for knowledge processing *(not for actual execution)*
17
+ * @param options - Options and tools for the compilation
9
18
  * @returns {Promptbook} compiled in JSON format (.ptbk.json)
10
19
  * @throws {PromptbookSyntaxError} if the promptbook string is not valid
11
20
  *
12
21
  * Note: This function does not validate logic of the pipeline only the syntax
13
22
  * Note: This function acts as compilation process
14
23
  */
15
- export declare function promptbookStringToJson(promptbookString: PromptbookString, llmTools?: LlmExecutionTools): Promise<PromptbookJson>;
24
+ export declare function promptbookStringToJson(promptbookString: PromptbookString, options?: PromptbookStringToJsonOptions): Promise<PromptbookJson>;
25
+ export {};
16
26
  /**
17
27
  * TODO: Report here line/column of error
18
28
  * TODO: Use spaceTrim more effectively
@@ -1,5 +1,5 @@
1
- import type { KnowledgeJson } from '../../../types/PromptbookJson/KnowledgeJson';
2
1
  import type { LlmExecutionTools } from '../../../execution/LlmExecutionTools';
2
+ import type { KnowledgeJson } from '../../../types/PromptbookJson/KnowledgeJson';
3
3
  import type { string_markdown } from '../../../types/typeAliases';
4
4
  export declare function prepareKnowledgeFromMarkdown(options: {
5
5
  content: string_markdown;
@@ -0,0 +1,16 @@
1
+ import type { LlmExecutionTools } from '../../../execution/LlmExecutionTools';
2
+ import type { KnowledgeJson } from '../../../types/PromptbookJson/KnowledgeJson';
3
+ import type { string_base64 } from '../../../types/typeAliases';
4
+ type PrepareKnowledgeFromPdfOptions = {
5
+ /**
6
+ * The source of the knowledge in PDF format
7
+ */
8
+ content: string_base64;
9
+ llmTools: LlmExecutionTools;
10
+ };
11
+ export declare function prepareKnowledgeFromPdf(options: PrepareKnowledgeFromPdfOptions): Promise<KnowledgeJson>;
12
+ export {};
13
+ /**
14
+ * TODO: [๐Ÿงบ] In future, content can be alse File or Blob BUT for now for wider compatibility its only base64
15
+ * @see https://stackoverflow.com/questions/14653349/node-js-cant-create-blobs
16
+ */
@@ -37,6 +37,7 @@ export declare class AnthropicClaudeExecutionTools implements LlmExecutionTools
37
37
  listModels(): Array<AvailableModel>;
38
38
  }
39
39
  /**
40
+ * TODO: !!!! [๐Ÿ†] JSON mode
40
41
  * TODO: [๐Ÿง ] Maybe handle errors via transformAnthropicError (like transformAzureError)
41
42
  * TODO: Maybe Create some common util for gptChat and gptComplete
42
43
  * TODO: Maybe make custom OpenaiError
@@ -193,7 +193,13 @@ export type string_promptbook_url_with_hashtemplate = string;
193
193
  *
194
194
  * For example `"data:text/plain;base64,SGVsbG8sIFdvcmxkIQ=="`
195
195
  */
196
- export type string_data_url = string;
196
+ export type string_data_url = `data:${string_mime_type};base64,${string_base64}`;
197
+ /**
198
+ * Semantic helper
199
+ *
200
+ * For example `"SGVsbG8sIFdvcmxkIQ=="`
201
+ */
202
+ export type string_base64 = string;
197
203
  /**
198
204
  * Semantic helper
199
205
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/types",
3
- "version": "0.59.0-0",
3
+ "version": "0.59.0-1",
4
4
  "description": "Library to supercharge your use of large language models",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -45,7 +45,7 @@
45
45
  }
46
46
  ],
47
47
  "peerDependencies": {
48
- "@promptbook/core": "0.59.0-0"
48
+ "@promptbook/core": "0.59.0-1"
49
49
  },
50
50
  "main": "./umd/index.umd.js",
51
51
  "module": "./esm/index.es.js",
package/umd/index.umd.js CHANGED
@@ -17,7 +17,7 @@
17
17
  /**
18
18
  * The version of the Promptbook library
19
19
  */
20
- var PROMPTBOOK_VERSION = '0.58.0';
20
+ var PROMPTBOOK_VERSION = '0.59.0-0';
21
21
 
22
22
  exports.EXPECTATION_UNITS = EXPECTATION_UNITS;
23
23
  exports.PROMPTBOOK_VERSION = PROMPTBOOK_VERSION;
@@ -1,18 +1,28 @@
1
1
  import type { LlmExecutionTools } from '../execution/LlmExecutionTools';
2
2
  import type { PromptbookJson } from '../types/PromptbookJson/PromptbookJson';
3
3
  import type { PromptbookString } from '../types/PromptbookString';
4
+ /**
5
+ * Options for promptbookStringToJson
6
+ */
7
+ type PromptbookStringToJsonOptions = {
8
+ /**
9
+ * Tools for processing required for knowledge processing *(not for actual execution)*
10
+ */
11
+ llmTools?: LlmExecutionTools;
12
+ };
4
13
  /**
5
14
  * Compile promptbook from string (markdown) format to JSON format
6
15
  *
7
16
  * @param promptbookString {Promptbook} in string markdown format (.ptbk.md)
8
- * @param llmTools {LlmExecutionTools} - tools for processing required for knowledge processing *(not for actual execution)*
17
+ * @param options - Options and tools for the compilation
9
18
  * @returns {Promptbook} compiled in JSON format (.ptbk.json)
10
19
  * @throws {PromptbookSyntaxError} if the promptbook string is not valid
11
20
  *
12
21
  * Note: This function does not validate logic of the pipeline only the syntax
13
22
  * Note: This function acts as compilation process
14
23
  */
15
- export declare function promptbookStringToJson(promptbookString: PromptbookString, llmTools?: LlmExecutionTools): Promise<PromptbookJson>;
24
+ export declare function promptbookStringToJson(promptbookString: PromptbookString, options?: PromptbookStringToJsonOptions): Promise<PromptbookJson>;
25
+ export {};
16
26
  /**
17
27
  * TODO: Report here line/column of error
18
28
  * TODO: Use spaceTrim more effectively
@@ -1,5 +1,5 @@
1
- import type { KnowledgeJson } from '../../../types/PromptbookJson/KnowledgeJson';
2
1
  import type { LlmExecutionTools } from '../../../execution/LlmExecutionTools';
2
+ import type { KnowledgeJson } from '../../../types/PromptbookJson/KnowledgeJson';
3
3
  import type { string_markdown } from '../../../types/typeAliases';
4
4
  export declare function prepareKnowledgeFromMarkdown(options: {
5
5
  content: string_markdown;
@@ -0,0 +1,16 @@
1
+ import type { LlmExecutionTools } from '../../../execution/LlmExecutionTools';
2
+ import type { KnowledgeJson } from '../../../types/PromptbookJson/KnowledgeJson';
3
+ import type { string_base64 } from '../../../types/typeAliases';
4
+ type PrepareKnowledgeFromPdfOptions = {
5
+ /**
6
+ * The source of the knowledge in PDF format
7
+ */
8
+ content: string_base64;
9
+ llmTools: LlmExecutionTools;
10
+ };
11
+ export declare function prepareKnowledgeFromPdf(options: PrepareKnowledgeFromPdfOptions): Promise<KnowledgeJson>;
12
+ export {};
13
+ /**
14
+ * TODO: [๐Ÿงบ] In future, content can be alse File or Blob BUT for now for wider compatibility its only base64
15
+ * @see https://stackoverflow.com/questions/14653349/node-js-cant-create-blobs
16
+ */
@@ -37,6 +37,7 @@ export declare class AnthropicClaudeExecutionTools implements LlmExecutionTools
37
37
  listModels(): Array<AvailableModel>;
38
38
  }
39
39
  /**
40
+ * TODO: !!!! [๐Ÿ†] JSON mode
40
41
  * TODO: [๐Ÿง ] Maybe handle errors via transformAnthropicError (like transformAzureError)
41
42
  * TODO: Maybe Create some common util for gptChat and gptComplete
42
43
  * TODO: Maybe make custom OpenaiError
@@ -193,7 +193,13 @@ export type string_promptbook_url_with_hashtemplate = string;
193
193
  *
194
194
  * For example `"data:text/plain;base64,SGVsbG8sIFdvcmxkIQ=="`
195
195
  */
196
- export type string_data_url = string;
196
+ export type string_data_url = `data:${string_mime_type};base64,${string_base64}`;
197
+ /**
198
+ * Semantic helper
199
+ *
200
+ * For example `"SGVsbG8sIFdvcmxkIQ=="`
201
+ */
202
+ export type string_base64 = string;
197
203
  /**
198
204
  * Semantic helper
199
205
  *