@promptbook/utils 0.47.0-0 → 0.48.0-0

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 (40) hide show
  1. package/README.md +13 -1
  2. package/esm/index.es.js +4 -5
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/_packages/core.index.d.ts +2 -1
  5. package/esm/typings/conversion/prettify/prettifyPromptbookStringCli.d.ts +1 -1
  6. package/esm/typings/conversion/promptbookJsonToString.d.ts +8 -0
  7. package/esm/typings/execution/ExecutionTools.d.ts +1 -1
  8. package/esm/typings/execution/LlmExecutionTools.d.ts +1 -0
  9. package/esm/typings/execution/plugins/llm-execution-tools/langtail/LangtailExecutionTools.d.ts +1 -1
  10. package/esm/typings/execution/plugins/llm-execution-tools/openai/OpenAiExecutionTools.d.ts +1 -1
  11. package/esm/typings/execution/plugins/llm-execution-tools/openai/computeOpenaiUsage.d.ts +4 -1
  12. package/esm/typings/execution/plugins/llm-execution-tools/remote/RemoteLlmExecutionTools.d.ts +1 -0
  13. package/esm/typings/library/SimplePromptbookLibrary.d.ts +2 -1
  14. package/esm/typings/library/constructors/createPromptbookLibraryFromDirectory.d.ts +10 -1
  15. package/esm/typings/library/constructors/createPromptbookLibraryFromPromise.d.ts +20 -1
  16. package/esm/typings/library/constructors/createPromptbookLibraryFromSources.d.ts +5 -6
  17. package/esm/typings/library/constructors/createPromptbookLibraryFromUrl.d.ts +13 -0
  18. package/esm/typings/library/constructors/createPromptbookSublibrary.d.ts +10 -1
  19. package/esm/typings/utils/markdown/extractOneBlockFromMarkdown.d.ts +1 -1
  20. package/package.json +13 -3
  21. package/umd/index.umd.js +4 -5
  22. package/umd/index.umd.js.map +1 -1
  23. package/umd/typings/_packages/core.index.d.ts +2 -1
  24. package/umd/typings/conversion/prettify/prettifyPromptbookStringCli.d.ts +1 -1
  25. package/umd/typings/conversion/promptbookJsonToString.d.ts +8 -0
  26. package/umd/typings/execution/ExecutionTools.d.ts +1 -1
  27. package/umd/typings/execution/LlmExecutionTools.d.ts +1 -0
  28. package/umd/typings/execution/plugins/llm-execution-tools/langtail/LangtailExecutionTools.d.ts +1 -1
  29. package/umd/typings/execution/plugins/llm-execution-tools/openai/OpenAiExecutionTools.d.ts +1 -1
  30. package/umd/typings/execution/plugins/llm-execution-tools/openai/computeOpenaiUsage.d.ts +4 -1
  31. package/umd/typings/execution/plugins/llm-execution-tools/remote/RemoteLlmExecutionTools.d.ts +1 -0
  32. package/umd/typings/library/SimplePromptbookLibrary.d.ts +2 -1
  33. package/umd/typings/library/constructors/createPromptbookLibraryFromDirectory.d.ts +10 -1
  34. package/umd/typings/library/constructors/createPromptbookLibraryFromPromise.d.ts +20 -1
  35. package/umd/typings/library/constructors/createPromptbookLibraryFromSources.d.ts +5 -6
  36. package/umd/typings/library/constructors/createPromptbookLibraryFromUrl.d.ts +13 -0
  37. package/umd/typings/library/constructors/createPromptbookSublibrary.d.ts +10 -1
  38. package/umd/typings/utils/markdown/extractOneBlockFromMarkdown.d.ts +1 -1
  39. package/esm/typings/library/constructors/createPromptbookLibraryFromList.d.ts +0 -5
  40. package/umd/typings/library/constructors/createPromptbookLibraryFromList.d.ts +0 -5
@@ -1,7 +1,26 @@
1
1
  import type { PromptbookJson } from '../../types/PromptbookJson/PromptbookJson';
2
2
  import { PromptbookString } from '../../types/PromptbookString';
3
3
  import { PromptbookLibrary } from '../PromptbookLibrary';
4
+ /**
5
+ * Constructs Promptbook from async sources
6
+ * It can be one of the following:
7
+ * - Promise of array of PromptbookJson or PromptbookString
8
+ * - Factory function that returns Promise of array of PromptbookJson or PromptbookString
9
+ *
10
+ * Note: This is useful as internal tool for other constructor functions like
11
+ * `createPromptbookLibraryFromUrl` or `createPromptbookLibraryFromDirectory`
12
+ * Consider using those functions instead of this one
13
+ *
14
+ * Note: The function does NOT return promise it returns the library directly which waits for the sources to be resolved
15
+ * when error occurs in given promise or factory function, it is thrown during `listPromptbooks` or `getPromptbookByUrl` call
16
+ *
17
+ *
18
+ * @param promptbookSourcesPromiseOrFactory
19
+ * @returns PromptbookLibrary
20
+ *
21
+ * @deprecated Consider using `createPromptbookLibraryFromUrl` or `createPromptbookLibraryFromDirectory`
22
+ */
4
23
  export declare function createPromptbookLibraryFromPromise(promptbookSourcesPromiseOrFactory: Promise<Array<PromptbookJson | PromptbookString>> | (() => Promise<Array<PromptbookJson | PromptbookString>>)): PromptbookLibrary;
5
24
  /***
6
- * TODO: !!! Annotate all + all to README and samples
25
+ * TODO: [🍓][🚯] !!! Add to README and samples + maybe make `@promptbook/library` package
7
26
  */
@@ -1,16 +1,15 @@
1
1
  import { PromptbookJson, PromptbookString } from '../../_packages/types.index';
2
2
  import { SimplePromptbookLibrary } from '../SimplePromptbookLibrary';
3
- export declare function createPromptbookLibraryFromSources(...promptbookSources: Array<PromptbookJson | PromptbookString>): SimplePromptbookLibrary;
4
3
  /**
5
- * Constructs Promptbook from any sources
4
+ * Creates PromptbookLibrary from array of PromptbookJson or PromptbookString
6
5
  *
6
+ * Note: You can combine `PromptbookString` (`.ptbk.md`) with `PromptbookJson` BUT it is not recommended
7
7
  * Note: During the construction syntax and logic of all sources are validated
8
- * Note: You can combine .ptbk.md and .ptbk.json files BUT it is not recommended
9
8
  *
10
- * @param promptbookSources contents of .ptbk.md or .ptbk.json files
11
- * @param settings settings for creating executor functions
9
+ * @param promptbookSources
12
10
  * @returns PromptbookLibrary
13
11
  */
12
+ export declare function createPromptbookLibraryFromSources(...promptbookSources: Array<PromptbookJson | PromptbookString>): SimplePromptbookLibrary;
14
13
  /***
15
- * TODO: !!! Annotate all + all to README and samples
14
+ * TODO: [🍓][🚯] !!! Add to README and samples + maybe make `@promptbook/library` package
16
15
  */
@@ -0,0 +1,13 @@
1
+ import { PromptbookLibrary } from '../PromptbookLibrary';
2
+ /**
3
+ * Constructs Promptbook from remote Promptbase URL
4
+ *
5
+ * Note: The function does NOT return promise it returns the library directly which dynamically loads promptbooks when needed
6
+ * SO during the construction syntax and logic sources IS NOT validated
7
+ *
8
+ * @returns PromptbookLibrary
9
+ */
10
+ export declare function createPromptbookLibraryFromUrl(): PromptbookLibrary;
11
+ /***
12
+ * TODO: [🍓][🚯] !!! Add to README and samples + maybe make `@promptbook/library` package
13
+ */
@@ -1,6 +1,15 @@
1
1
  import type { string_promptbook_url } from '../../types/typeAliases';
2
2
  import { PromptbookLibrary } from '../PromptbookLibrary';
3
+ /**
4
+ * Creates PromptbookLibrary as a subset of another PromptbookLibrary
5
+ *
6
+ * Note: You can use any type of library as a parent library - local, remote, etc.
7
+ * Note: This is just a thin wrapper / proxy around the parent library
8
+ *
9
+ * @param promptbookSources
10
+ * @returns PromptbookLibrary
11
+ */
3
12
  export declare function createPromptbookSublibrary(library: PromptbookLibrary, predicate: (url: string_promptbook_url) => boolean): PromptbookLibrary;
4
13
  /***
5
- * TODO: !!! Annotate all + all to README and samples
14
+ * TODO: [🍓][🚯] !!! Add to README and samples + maybe make `@promptbook/library` package
6
15
  */
@@ -15,5 +15,5 @@ import { CodeBlock } from './extractAllBlocksFromMarkdown';
15
15
  */
16
16
  export declare function extractOneBlockFromMarkdown(markdown: string_markdown): CodeBlock;
17
17
  /***
18
- * TODO: [🌻] !!! Decide of this is internal util, external util OR validator/postprocessor
18
+ * TODO: [🍓][🌻] !!! Decide of this is internal util, external util OR validator/postprocessor
19
19
  */
@@ -1,5 +0,0 @@
1
- import { PromptbookLibrary } from '../PromptbookLibrary';
2
- export declare function createPromptbookLibraryFromList(): PromptbookLibrary;
3
- /***
4
- * TODO: !!! Annotate all + all to README and samples
5
- */
@@ -1,5 +0,0 @@
1
- import { PromptbookLibrary } from '../PromptbookLibrary';
2
- export declare function createPromptbookLibraryFromList(): PromptbookLibrary;
3
- /***
4
- * TODO: !!! Annotate all + all to README and samples
5
- */