@promptbook/types 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
@@ -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.59.0-31';
14
+ var PROMPTBOOK_VERSION = '0.59.0-33';
15
15
 
16
16
  export { EXPECTATION_UNITS, PROMPTBOOK_VERSION };
17
17
  //# 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/types",
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,
@@ -45,7 +45,7 @@
45
45
  }
46
46
  ],
47
47
  "peerDependencies": {
48
- "@promptbook/core": "0.59.0-32"
48
+ "@promptbook/core": "0.59.0-34"
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.59.0-31';
20
+ var PROMPTBOOK_VERSION = '0.59.0-33';
21
21
 
22
22
  exports.EXPECTATION_UNITS = EXPECTATION_UNITS;
23
23
  exports.PROMPTBOOK_VERSION = PROMPTBOOK_VERSION;
@@ -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
+ */