@promptbook/utils 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
@@ -651,7 +651,7 @@ You can define postprocessing functions when creating `JavascriptEvalExecutionTo
651
651
 
652
652
  ```
653
653
 
654
- Additionally there are some usefull string-manipulation build-in functions, which are [listed here](src/execution/plugins/script-execution-tools/javascript/JavascriptEvalExecutionTools.ts).
654
+ Additionally there are some usefull string-manipulation build-in functions, which are [listed here](src/scripting/javascript/JavascriptEvalExecutionTools.ts).
655
655
 
656
656
  ### Expectations
657
657
 
package/esm/index.es.js CHANGED
@@ -1692,7 +1692,7 @@ function unwrapResult(text, options) {
1692
1692
  /**
1693
1693
  * The version of the Promptbook library
1694
1694
  */
1695
- var PROMPTBOOK_VERSION = '0.58.0';
1695
+ var PROMPTBOOK_VERSION = '0.59.0-0';
1696
1696
 
1697
1697
  // @promptbook/utils
1698
1698
  // And the normalization (originally n12 library) utilities:
@@ -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/utils",
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,
package/umd/index.umd.js CHANGED
@@ -1695,7 +1695,7 @@
1695
1695
  /**
1696
1696
  * The version of the Promptbook library
1697
1697
  */
1698
- var PROMPTBOOK_VERSION = '0.58.0';
1698
+ var PROMPTBOOK_VERSION = '0.59.0-0';
1699
1699
 
1700
1700
  // @promptbook/utils
1701
1701
  // And the normalization (originally n12 library) utilities:
@@ -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
  *