@promptbook/openai 0.59.0-32 → 0.59.0-34

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/esm/index.es.js CHANGED
@@ -1143,7 +1143,7 @@ var OpenAiExecutionTools = /** @class */ (function () {
1143
1143
  /**
1144
1144
  * The version of the Promptbook library
1145
1145
  */
1146
- var PROMPTBOOK_VERSION = '0.59.0-31';
1146
+ var PROMPTBOOK_VERSION = '0.59.0-33';
1147
1147
 
1148
1148
  export { OPENAI_MODELS, OpenAiExecutionTools, PROMPTBOOK_VERSION };
1149
1149
  //# sourceMappingURL=index.es.js.map
@@ -1,6 +1,7 @@
1
1
  import { prettifyPromptbookString } from '../conversion/prettify/prettifyPromptbookString';
2
2
  import { promptbookJsonToString } from '../conversion/promptbookJsonToString';
3
3
  import { promptbookStringToJson } from '../conversion/promptbookStringToJson';
4
+ import { promptbookStringToJsonSync } from '../conversion/promptbookStringToJsonSync';
4
5
  import { validatePromptbook } from '../conversion/validation/validatePromptbook';
5
6
  import { ExpectError } from '../errors/_ExpectError';
6
7
  import { PromptbookExecutionError } from '../errors/PromptbookExecutionError';
@@ -37,7 +38,7 @@ export { ExecutionTypes };
37
38
  export { addUsage, assertsExecutionSuccessful, checkExpectations, embeddingVectorToString, executionReportJsonToString, ExecutionReportStringOptions, ExecutionReportStringOptionsDefaults, isPassingExpectations, prepareKnowledgeFromMarkdown, prettifyPromptbookString, usageToWorktime, };
38
39
  export { createLibraryFromJson, createLibraryFromPromise, createLibraryFromUrl, createSublibrary, libraryToJson };
39
40
  export { SimplePromptInterfaceTools };
40
- export { promptbookJsonToString, promptbookStringToJson, validatePromptbook };
41
+ export { promptbookJsonToString, promptbookStringToJson, promptbookStringToJsonSync, validatePromptbook };
41
42
  export { createPromptbookExecutor, MultipleLlmExecutionTools };
42
43
  export { CallbackInterfaceTools, CallbackInterfaceToolsOptions };
43
44
  export { ExpectError, PromptbookExecutionError, PromptbookLibraryError, PromptbookLogicError, PromptbookNotFoundError, PromptbookReferenceError, PromptbookSyntaxError, TemplateError, UnexpectedError, };
@@ -13,6 +13,10 @@ type PromptbookStringToJsonOptions = {
13
13
  /**
14
14
  * Compile promptbook from string (markdown) format to JSON format
15
15
  *
16
+ * Note: There are two similar functions:
17
+ * - `promptbookStringToJson` **(preferred)** - which propperly compiles the promptbook and use embedding for external knowledge
18
+ * - `promptbookStringToJsonSync` - use only if you need to compile promptbook synchronously and it contains NO external knowledge
19
+ *
16
20
  * @param promptbookString {Promptbook} in string markdown format (.ptbk.md)
17
21
  * @param options - Options and tools for the compilation
18
22
  * @returns {Promptbook} compiled in JSON format (.ptbk.json)
@@ -24,8 +28,5 @@ type PromptbookStringToJsonOptions = {
24
28
  export declare function promptbookStringToJson(promptbookString: PromptbookString, options?: PromptbookStringToJsonOptions): Promise<PromptbookJson>;
25
29
  export {};
26
30
  /**
27
- * TODO: Report here line/column of error
28
- * TODO: Use spaceTrim more effectively
29
- * TODO: [🧠] Parameter flags - isInput, isOutput, isInternal
30
31
  * TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
31
32
  */
@@ -0,0 +1,23 @@
1
+ import type { PromptbookJson } from '../types/PromptbookJson/PromptbookJson';
2
+ import type { PromptbookString } from '../types/PromptbookString';
3
+ /**
4
+ * Compile promptbook from string (markdown) format to JSON format synchronously
5
+ *
6
+ * Note: There are two similar functions:
7
+ * - `promptbookStringToJson` **(preferred)** - which propperly compiles the promptbook and use embedding for external knowledge
8
+ * - `promptbookStringToJsonSync` - use only if you need to compile promptbook synchronously and it contains NO external knowledge
9
+ *
10
+ * @param promptbookString {Promptbook} in string markdown format (.ptbk.md)
11
+ * @param options - Options and tools for the compilation
12
+ * @returns {Promptbook} compiled in JSON format (.ptbk.json)
13
+ * @throws {PromptbookSyntaxError} if the promptbook string is not valid
14
+ *
15
+ * Note: This function does not validate logic of the pipeline only the syntax
16
+ * Note: This function acts as compilation process
17
+ */
18
+ export declare function promptbookStringToJsonSync(promptbookString: PromptbookString): PromptbookJson;
19
+ /**
20
+ * TODO: Report here line/column of error
21
+ * TODO: Use spaceTrim more effectively
22
+ * TODO: [🧠] Parameter flags - isInput, isOutput, isInternal
23
+ */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/openai",
3
- "version": "0.59.0-32",
3
+ "version": "0.59.0-34",
4
4
  "description": "Library to supercharge your use of large language models",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -49,7 +49,7 @@
49
49
  }
50
50
  ],
51
51
  "peerDependencies": {
52
- "@promptbook/core": "0.59.0-32"
52
+ "@promptbook/core": "0.59.0-34"
53
53
  },
54
54
  "main": "./umd/index.umd.js",
55
55
  "module": "./esm/index.es.js",
package/umd/index.umd.js CHANGED
@@ -1151,7 +1151,7 @@
1151
1151
  /**
1152
1152
  * The version of the Promptbook library
1153
1153
  */
1154
- var PROMPTBOOK_VERSION = '0.59.0-31';
1154
+ var PROMPTBOOK_VERSION = '0.59.0-33';
1155
1155
 
1156
1156
  exports.OPENAI_MODELS = OPENAI_MODELS;
1157
1157
  exports.OpenAiExecutionTools = OpenAiExecutionTools;
@@ -1,6 +1,7 @@
1
1
  import { prettifyPromptbookString } from '../conversion/prettify/prettifyPromptbookString';
2
2
  import { promptbookJsonToString } from '../conversion/promptbookJsonToString';
3
3
  import { promptbookStringToJson } from '../conversion/promptbookStringToJson';
4
+ import { promptbookStringToJsonSync } from '../conversion/promptbookStringToJsonSync';
4
5
  import { validatePromptbook } from '../conversion/validation/validatePromptbook';
5
6
  import { ExpectError } from '../errors/_ExpectError';
6
7
  import { PromptbookExecutionError } from '../errors/PromptbookExecutionError';
@@ -37,7 +38,7 @@ export { ExecutionTypes };
37
38
  export { addUsage, assertsExecutionSuccessful, checkExpectations, embeddingVectorToString, executionReportJsonToString, ExecutionReportStringOptions, ExecutionReportStringOptionsDefaults, isPassingExpectations, prepareKnowledgeFromMarkdown, prettifyPromptbookString, usageToWorktime, };
38
39
  export { createLibraryFromJson, createLibraryFromPromise, createLibraryFromUrl, createSublibrary, libraryToJson };
39
40
  export { SimplePromptInterfaceTools };
40
- export { promptbookJsonToString, promptbookStringToJson, validatePromptbook };
41
+ export { promptbookJsonToString, promptbookStringToJson, promptbookStringToJsonSync, validatePromptbook };
41
42
  export { createPromptbookExecutor, MultipleLlmExecutionTools };
42
43
  export { CallbackInterfaceTools, CallbackInterfaceToolsOptions };
43
44
  export { ExpectError, PromptbookExecutionError, PromptbookLibraryError, PromptbookLogicError, PromptbookNotFoundError, PromptbookReferenceError, PromptbookSyntaxError, TemplateError, UnexpectedError, };
@@ -13,6 +13,10 @@ type PromptbookStringToJsonOptions = {
13
13
  /**
14
14
  * Compile promptbook from string (markdown) format to JSON format
15
15
  *
16
+ * Note: There are two similar functions:
17
+ * - `promptbookStringToJson` **(preferred)** - which propperly compiles the promptbook and use embedding for external knowledge
18
+ * - `promptbookStringToJsonSync` - use only if you need to compile promptbook synchronously and it contains NO external knowledge
19
+ *
16
20
  * @param promptbookString {Promptbook} in string markdown format (.ptbk.md)
17
21
  * @param options - Options and tools for the compilation
18
22
  * @returns {Promptbook} compiled in JSON format (.ptbk.json)
@@ -24,8 +28,5 @@ type PromptbookStringToJsonOptions = {
24
28
  export declare function promptbookStringToJson(promptbookString: PromptbookString, options?: PromptbookStringToJsonOptions): Promise<PromptbookJson>;
25
29
  export {};
26
30
  /**
27
- * TODO: Report here line/column of error
28
- * TODO: Use spaceTrim more effectively
29
- * TODO: [🧠] Parameter flags - isInput, isOutput, isInternal
30
31
  * TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
31
32
  */
@@ -0,0 +1,23 @@
1
+ import type { PromptbookJson } from '../types/PromptbookJson/PromptbookJson';
2
+ import type { PromptbookString } from '../types/PromptbookString';
3
+ /**
4
+ * Compile promptbook from string (markdown) format to JSON format synchronously
5
+ *
6
+ * Note: There are two similar functions:
7
+ * - `promptbookStringToJson` **(preferred)** - which propperly compiles the promptbook and use embedding for external knowledge
8
+ * - `promptbookStringToJsonSync` - use only if you need to compile promptbook synchronously and it contains NO external knowledge
9
+ *
10
+ * @param promptbookString {Promptbook} in string markdown format (.ptbk.md)
11
+ * @param options - Options and tools for the compilation
12
+ * @returns {Promptbook} compiled in JSON format (.ptbk.json)
13
+ * @throws {PromptbookSyntaxError} if the promptbook string is not valid
14
+ *
15
+ * Note: This function does not validate logic of the pipeline only the syntax
16
+ * Note: This function acts as compilation process
17
+ */
18
+ export declare function promptbookStringToJsonSync(promptbookString: PromptbookString): PromptbookJson;
19
+ /**
20
+ * TODO: Report here line/column of error
21
+ * TODO: Use spaceTrim more effectively
22
+ * TODO: [🧠] Parameter flags - isInput, isOutput, isInternal
23
+ */