@promptbook/openai 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
@@ -628,7 +628,7 @@ You can define postprocessing functions when creating `JavascriptEvalExecutionTo
628
628
 
629
629
  ```
630
630
 
631
- Additionally there are some usefull string-manipulation build-in functions, which are [listed here](src/execution/plugins/script-execution-tools/javascript/JavascriptEvalExecutionTools.ts).
631
+ Additionally there are some usefull string-manipulation build-in functions, which are [listed here](src/scripting/javascript/JavascriptEvalExecutionTools.ts).
632
632
 
633
633
  ### Expectations
634
634
 
package/esm/index.es.js CHANGED
@@ -1035,7 +1035,7 @@ var OpenAiExecutionTools = /** @class */ (function () {
1035
1035
  /**
1036
1036
  * The version of the Promptbook library
1037
1037
  */
1038
- var PROMPTBOOK_VERSION = '0.58.0';
1038
+ var PROMPTBOOK_VERSION = '0.59.0-0';
1039
1039
 
1040
1040
  export { OPENAI_MODELS, OpenAiExecutionTools, PROMPTBOOK_VERSION };
1041
1041
  //# 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/openai",
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,
@@ -48,7 +48,7 @@
48
48
  }
49
49
  ],
50
50
  "peerDependencies": {
51
- "@promptbook/core": "0.59.0-0"
51
+ "@promptbook/core": "0.59.0-1"
52
52
  },
53
53
  "main": "./umd/index.umd.js",
54
54
  "module": "./esm/index.es.js",
package/umd/index.umd.js CHANGED
@@ -1043,7 +1043,7 @@
1043
1043
  /**
1044
1044
  * The version of the Promptbook library
1045
1045
  */
1046
- var PROMPTBOOK_VERSION = '0.58.0';
1046
+ var PROMPTBOOK_VERSION = '0.59.0-0';
1047
1047
 
1048
1048
  exports.OPENAI_MODELS = OPENAI_MODELS;
1049
1049
  exports.OpenAiExecutionTools = OpenAiExecutionTools;
@@ -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
  *