@promptbook/core 0.44.0-0 → 0.44.0-10

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.
Files changed (37) hide show
  1. package/esm/index.es.js +745 -603
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/_packages/core.index.d.ts +2 -1
  4. package/esm/typings/_packages/utils.index.d.ts +21 -11
  5. package/esm/typings/config.d.ts +4 -0
  6. package/esm/typings/errors/PromptbookNotFoundError.d.ts +7 -0
  7. package/esm/typings/errors/{ExpectError.d.ts → _ExpectError.d.ts} +1 -0
  8. package/esm/typings/execution/plugins/natural-execution-tools/mocked/MockedEchoNaturalExecutionTools.d.ts +1 -1
  9. package/esm/typings/execution/plugins/natural-execution-tools/mocked/MockedFackedNaturalExecutionTools.d.ts +19 -0
  10. package/esm/typings/execution/plugins/natural-execution-tools/mocked/fakeTextToExpectations.d.ts +11 -0
  11. package/esm/typings/execution/plugins/natural-execution-tools/mocked/fakeTextToExpectations.test.d.ts +1 -0
  12. package/esm/typings/execution/plugins/natural-execution-tools/mocked/faked-completion.test.d.ts +1 -0
  13. package/esm/typings/execution/utils/checkExpectations.d.ts +25 -0
  14. package/esm/typings/execution/utils/checkExpectations.test.d.ts +1 -0
  15. package/esm/typings/types/Prompt.d.ts +8 -0
  16. package/esm/typings/types/PromptbookJson/PromptTemplateJson.d.ts +13 -4
  17. package/esm/typings/utils/expectation-counters/countSentences.d.ts +4 -0
  18. package/package.json +2 -1
  19. package/umd/index.umd.js +748 -606
  20. package/umd/index.umd.js.map +1 -1
  21. package/umd/typings/_packages/core.index.d.ts +2 -1
  22. package/umd/typings/_packages/utils.index.d.ts +21 -11
  23. package/umd/typings/config.d.ts +4 -0
  24. package/umd/typings/errors/PromptbookNotFoundError.d.ts +7 -0
  25. package/umd/typings/errors/{ExpectError.d.ts → _ExpectError.d.ts} +1 -0
  26. package/umd/typings/execution/plugins/natural-execution-tools/mocked/MockedEchoNaturalExecutionTools.d.ts +1 -1
  27. package/umd/typings/execution/plugins/natural-execution-tools/mocked/MockedFackedNaturalExecutionTools.d.ts +19 -0
  28. package/umd/typings/execution/plugins/natural-execution-tools/mocked/fakeTextToExpectations.d.ts +11 -0
  29. package/umd/typings/execution/plugins/natural-execution-tools/mocked/fakeTextToExpectations.test.d.ts +1 -0
  30. package/umd/typings/execution/plugins/natural-execution-tools/mocked/faked-completion.test.d.ts +1 -0
  31. package/umd/typings/execution/utils/checkExpectations.d.ts +25 -0
  32. package/umd/typings/execution/utils/checkExpectations.test.d.ts +1 -0
  33. package/umd/typings/types/Prompt.d.ts +8 -0
  34. package/umd/typings/types/PromptbookJson/PromptTemplateJson.d.ts +13 -4
  35. package/umd/typings/utils/expectation-counters/countSentences.d.ts +4 -0
  36. package/esm/typings/errors/NotFoundError.d.ts +0 -7
  37. package/umd/typings/errors/NotFoundError.d.ts +0 -7
@@ -18,6 +18,17 @@ export type NaturalTemplateJson = PromptTemplateJsonCommon & {
18
18
  */
19
19
  readonly modelRequirements: ModelRequirements;
20
20
  };
21
+ /**
22
+ * Expect this amount of each unit in the answer
23
+ *
24
+ * For example 5 words, 3 sentences, 2 paragraphs, ...
25
+ *
26
+ * Note: Expectations are performed after all postprocessing steps
27
+ */
28
+ export type Expectations = Partial<Record<Lowercase<ExpectationUnit>, {
29
+ min?: ExpectationAmount;
30
+ max?: ExpectationAmount;
31
+ }>>;
21
32
  /**
22
33
  * Units of text measurement
23
34
  */
@@ -105,10 +116,7 @@ interface PromptTemplateJsonCommon {
105
116
  *
106
117
  * Note: Expectations are performed after all postprocessing steps
107
118
  */
108
- readonly expectAmount?: Partial<Record<Lowercase<ExpectationUnit>, {
109
- min?: ExpectationAmount;
110
- max?: ExpectationAmount;
111
- }>>;
119
+ readonly expectations?: Expectations;
112
120
  /**
113
121
  * Expect this format of the answer
114
122
  *
@@ -122,5 +130,6 @@ interface PromptTemplateJsonCommon {
122
130
  }
123
131
  export {};
124
132
  /**
133
+ * TODO: [💝] Unite object for expecting amount and format - remove expectFormat
125
134
  * TODO: use one helper type> (string_prompt | string_javascript | string_markdown) & string_template
126
135
  */
@@ -1,4 +1,8 @@
1
1
  import type { ExpectationAmount } from '../../types/PromptbookJson/PromptTemplateJson';
2
+ /**
3
+ * Split text into sentences
4
+ */
5
+ export declare function splitIntoSentences(text: string): Array<string>;
2
6
  /**
3
7
  * Counts number of sentences in the text
4
8
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/core",
3
- "version": "0.44.0-0",
3
+ "version": "0.44.0-10",
4
4
  "description": "Library to supercharge your use of large language models",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -34,6 +34,7 @@
34
34
  },
35
35
  "homepage": "https://www.npmjs.com/package/@promptbook/core",
36
36
  "dependencies": {
37
+ "lorem-ipsum": "^2.0.8",
37
38
  "spacetrim": "0.11.2"
38
39
  },
39
40
  "main": "./umd/index.umd.js",