@promptbook/utils 0.59.0-32 → 0.59.0-33

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
@@ -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.59.0-31';
1695
+ var PROMPTBOOK_VERSION = '0.59.0-32';
1696
1696
 
1697
1697
  // @promptbook/utils
1698
1698
  // And the normalization (originally n12 library) utilities:
@@ -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/utils",
3
- "version": "0.59.0-32",
3
+ "version": "0.59.0-33",
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.59.0-31';
1698
+ var PROMPTBOOK_VERSION = '0.59.0-32';
1699
1699
 
1700
1700
  // @promptbook/utils
1701
1701
  // And the normalization (originally n12 library) utilities:
@@ -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
+ */