@promptbook/types 0.45.0 → 0.46.0-1

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/README.md CHANGED
@@ -2,15 +2,15 @@
2
2
 
3
3
  Library to supercharge your use of large language models
4
4
 
5
- <!--Badges-->
6
- <!--⚠️WARNING: This section was generated by https://github.com/hejny/batch-project-editor/blob/main/src/workflows/800-badges/badges.ts so every manual change will be overwritten.-->
5
+
6
+
7
7
 
8
8
  [![License of 📖 Prompt book](https://img.shields.io/github/license/webgptorg/promptbook.svg?style=flat)](https://github.com/webgptorg/promptbook/blob/main/LICENSE)
9
9
  [![Known Vulnerabilities](https://snyk.io/test/github/webgptorg/promptbook/badge.svg)](https://snyk.io/test/github/webgptorg/promptbook)
10
10
  [![Issues](https://img.shields.io/github/issues/webgptorg/promptbook.svg?style=flat)](https://github.com/webgptorg/promptbook/issues)
11
11
  [![Socket Badge](https://socket.dev/api/badge/npm/package/@promptbook/types)](https://socket.dev/npm/package/@promptbook/types)
12
12
 
13
- <!--/Badges-->
13
+
14
14
 
15
15
  ## 📦 Package `@promptbook/types`
16
16
 
@@ -32,15 +32,14 @@ import { promptbookStringToJson } from '@promptbook/core';
32
32
  const promptbook: PromptbookJson = promptbookStringToJson(...);
33
33
  ```
34
34
 
35
+ _Note: `@promptbook/types` does not export brand-specific types like `OpenAiExecutionToolsOptions`, `ClaudeExecutionToolsOptions`, `LangchainExecutionToolsOptions`,... etc._
36
+
35
37
 
36
38
  ---
37
39
 
38
40
  Rest of the documentation is common for **entire promptbook ecosystem**:
39
41
 
40
- <!--
41
- TODO: Probbably remove this section only in packages
42
- > ⚠ Warning: This library is still in early development.
43
- -->
42
+
44
43
 
45
44
  ## 🤍 Whitepaper
46
45
 
@@ -83,13 +82,13 @@ In any of these situations, but especially in (3), the Promptbook library can ma
83
82
  - Multiple promptbooks forms a library which will become a **part of your application codebase**.
84
83
  - Theese promptbooks are designed such as they **can be written by non-programmers**.
85
84
 
86
- <!-- TODO: [🧠] Make some more clear escaping -->
85
+
87
86
 
88
87
  ### Sample:
89
88
 
90
89
  File `write-website-content.ptbk.md`:
91
90
 
92
- <!------------------------[ Sample: ]------------------------>
91
+
93
92
 
94
93
  > # 🌍 Create website content
95
94
  >
@@ -260,7 +259,7 @@ File `write-website-content.ptbk.md`:
260
259
  >
261
260
  > `-> {content}`
262
261
 
263
- <!------------------------[ /Sample ]------------------------>
262
+
264
263
 
265
264
  Following is the scheme how the promptbook above is executed:
266
265
 
@@ -313,15 +312,27 @@ _Note: We are using [postprocessing functions](#postprocessing-functions) like `
313
312
 
314
313
  ## 📦 Packages
315
314
 
316
- This library is divided into several packages, all are published from [single monorepo](https://github.com/webgptorg/promptbook):
315
+ This library is divided into several packages, all are published from [single monorepo](https://github.com/webgptorg/promptbook).
316
+ You can install all of them at once:
317
+
318
+ ```bash
319
+ npm i ptbk
320
+ ```
317
321
 
318
- <!--[🔠]-->
322
+ Or you can install them separately:
319
323
 
324
+
325
+
326
+
327
+ - ⭐ **[ptbk](https://www.npmjs.com/package/@promptbook/core)** - Bundle of all packages, when you want to install everything and you don't care about the size
328
+ - **[promptbook](https://www.npmjs.com/package/@promptbook/core)** - Just alias for `ptbk`
320
329
  - **[@promptbook/core](https://www.npmjs.com/package/@promptbook/core)** - Core of the library, it contains the main logic for promptbooks
321
- - ⭐ **[@promptbook/utils](https://www.npmjs.com/package/@promptbook/utils)** - Utility functions used in the library but also useful for individual use in preprocessing and postprocessing LLM inputs and outputs
330
+ - ⭐ **[@promptbook/utils](https://www.npmjs.com/package/@promptbook/utils)** - Utility functions used in the library but also useful for individual use in preprocessing and postprocessing LLM inputs and outputs
322
331
  - _(Not finished)_ **[@promptbook/wizzard](https://www.npmjs.com/package/@promptbook/wizzard)** - Wizard for creating+running promptbooks in single line
323
332
  - **[@promptbook/execute-javascript](https://www.npmjs.com/package/@promptbook/execute-javascript)** - Execution tools for javascript inside promptbooks
324
333
  - **[@promptbook/openai](https://www.npmjs.com/package/@promptbook/openai)** - Execution tools for OpenAI API, wrapper around OpenAI SDK
334
+ - **[@promptbook/langtail](https://www.npmjs.com/package/@promptbook/langtail)** - Execution tools for Langtail API, wrapper around Langtail SDK
335
+ - **[@promptbook/mock](https://www.npmjs.com/package/@promptbook/mock)** - Mocked execution tools for testing the library and saving the tokens
325
336
  - **[@promptbook/remote-client](https://www.npmjs.com/package/@promptbook/remote-client)** - Remote client for remote execution of promptbooks
326
337
  - **[@promptbook/remote-server](https://www.npmjs.com/package/@promptbook/remote-server)** - Remote server for remote execution of promptbooks
327
338
  - **[@promptbook/types](https://www.npmjs.com/package/@promptbook/types)** - Just typescript types used in the library
@@ -493,7 +504,7 @@ There are [postprocessing functions](#postprocessing-functions) that can be used
493
504
 
494
505
  - _(Not implemented yet)_ `ConsoleInterfaceTools` is a wrapper around `readline` module that interacts with the user via console.
495
506
  - `SimplePromptInterfaceTools` is a wrapper around `window.prompt` synchronous function that interacts with the user via browser prompt. It is used for testing and mocking **NOT intended to use in the production** due to its synchronous nature.
496
- - `CallbackInterfaceTools` delagates the user interaction to a async callback function. You need to provide your own implementation of this callback function and its bind to UI. <!-- <- TODO: Provide here a way how to do it with some our plugin -->
507
+ - `CallbackInterfaceTools` delagates the user interaction to a async callback function. You need to provide your own implementation of this callback function and its bind to UI.
497
508
 
498
509
  ### Executor
499
510
 
@@ -563,10 +574,7 @@ There are two types of expectations which are not strictly symmetrical:
563
574
 
564
575
  Look at [expectations.ptbk.md](samples/templates/45-expectations.ptbk.md) and [expect-json.ptbk.md](samples/templates/45-expect-json.ptbk.md) samples for more.
565
576
 
566
- <!--
567
- ### New
568
- [🥻] Insert here when making new command
569
- -->
577
+
570
578
 
571
579
  ### Execution report
572
580
 
@@ -574,7 +582,7 @@ Execution report is a simple object or markdown that contains information about
574
582
 
575
583
  [See the example of such a report](/samples/templates/50-advanced.report.md)
576
584
 
577
- <!-- TODO: Write more -->
585
+
578
586
 
579
587
  ### Remote server
580
588
 
@@ -585,23 +593,7 @@ This is useful to make all logic on browser side but not expose your API keys or
585
593
 
586
594
  ## 👨‍💻 Usage and integration _(for developers)_
587
595
 
588
- <!--
589
-
590
- TODO: [🧙‍♂️]
591
-
592
- ### 🧙‍♂️ Using wizzard
593
-
594
- First you need to install this library:
595
-
596
- ```bash
597
- npm install --save @promptbook/wizzard
598
- ```
599
-
600
- > TODO: !! Write the Wizzard sample
601
-
602
- [Usage samples](./samples/usage/)
603
596
 
604
- -->
605
597
 
606
598
  ### 🔌 Usage in Typescript / Javascript
607
599
 
@@ -626,11 +618,11 @@ npm install --save @promptbook/wizzard
626
618
 
627
619
  ## 🐜 Known issues
628
620
 
629
- <!-- TODO: -->
621
+
630
622
 
631
623
  ## 🧼 Intentionally not implemented features
632
624
 
633
- <!-- TODO: -->
625
+
634
626
 
635
627
  ## ❔ FAQ
636
628
 
@@ -646,42 +638,17 @@ Langchain is primarily aimed at ML developers working in Python. This library is
646
638
 
647
639
  We are considering creating a bridge/converter between these two libraries.
648
640
 
649
- <!--
650
641
 
651
- ==========
652
- Include:
653
- - Langchain is the python library and JavaScript is on second place
654
- - Langchain primarily focused on making templates, not on combining templates into larger structures
655
- - at the language level it distinguishes between chat and completion, I need to mix the two into one template pipeline
656
- - for a non-programmer it's quite hard to work with such a thing and write templates - I would much prefer a system that allows non-technical people to write templates (of which there are many more on the market than free pythonists)
657
- - The focus of promptbooks is primarily on building user applications, not the data processing, training or autogpt.
658
- -->
659
642
 
660
643
  ### Promptbooks vs. OpenAI`s GPTs
661
644
 
662
645
  GPTs are chat assistants that can be assigned to specific tasks and materials. But they are still chat assistants. Promptbooks are a way to orchestrate many more predefined tasks to have much tighter control over the process. Promptbooks are not a good technology for creating human-like chatbots, GPTs are not a good technology for creating outputs with specific requirements.
663
646
 
664
- <!--
665
- TODO:
666
- ### Promptbooks vs. Semantic Kernel
667
-
668
647
 
669
- -->
670
648
 
671
- <!--
672
- TODO: !
673
- ### Promptbooks vs. Langtail
674
649
 
675
650
 
676
- -->
677
651
 
678
- <!--
679
- TODO:
680
- ### Promptbooks vs. Evidentally AI
681
-
682
- Logging and monitoring
683
-
684
- -->
685
652
 
686
653
  ### Where should I store my promptbooks?
687
654
 
@@ -703,34 +670,10 @@ In large language models, you will get better results if you have prompts in the
703
670
 
704
671
  The best way to manage this is to have suffixed promptbooks like `write-website-content.en.ptbk.md` and `write-website-content.cs.ptbk.md` for each supported language.
705
672
 
706
- <!--
707
- TODO: (Maybe)
708
- ### Why you need to explicitly specify input and output parameters?
709
- -->
710
-
711
- <!--
712
-
713
-
714
673
 
715
- !
716
674
 
717
675
 
718
676
 
719
- unit testing
720
-
721
- escaping
722
-
723
- how i get block into prompt
724
-
725
-
726
- ## 🚷 Limitations
727
-
728
- function calling
729
- system message
730
- iterations
731
-
732
- -->
733
-
734
677
  ## ⌚ Changelog
735
678
 
736
679
  See [CHANGELOG.md](./CHANGELOG.md)
@@ -739,13 +682,11 @@ See [CHANGELOG.md](./CHANGELOG.md)
739
682
 
740
683
  <p xmlns:cc="http://creativecommons.org/ns#" xmlns:dct="http://purl.org/dc/terms/"><a property="dct:title" rel="cc:attributionURL" href="https://github.com/webgptorg/promptbook">Promptbook</a> by <a rel="cc:attributionURL dct:creator" property="cc:attributionName" href="https://github.com/hejny/">Pavol Hejný</a> is licensed under <a href="https://creativecommons.org/licenses/by/4.0/?ref=chooser-v1" target="_blank" rel="license noopener noreferrer" style="display:inline-block;">CC BY 4.0</a></p>
741
684
 
742
- <!--Contributing-->
743
- <!--⚠️WARNING: This section was generated by https://github.com/hejny/batch-project-editor/blob/main/src/workflows/810-contributing/contributing.ts so every manual change will be overwritten.-->
685
+
686
+
744
687
 
745
688
  ## 🖋️ Contributing
746
689
 
747
690
  I am open to pull requests, feedback, and suggestions. Or if you like this utility, you can [☕ buy me a coffee](https://www.buymeacoffee.com/hejny) or [donate via cryptocurrencies](https://github.com/hejny/hejny/blob/main/documents/crypto.md).
748
691
 
749
- You can also ⭐ star the promptbook package, [follow me on GitHub](https://github.com/hejny) or [various other social networks](https://www.pavolhejny.com/contact/).
750
-
751
- <!--/Contributing-->
692
+ You can also ⭐ star the promptbook package, [follow me on GitHub](https://github.com/hejny) or [various other social networks](https://www.pavolhejny.com/contact/).
@@ -1,8 +1,6 @@
1
1
  import { promptbookStringToJson } from '../conversion/promptbookStringToJson';
2
2
  import { validatePromptbookJson } from '../conversion/validation/validatePromptbookJson';
3
3
  import { createPromptbookExecutor } from '../execution/createPromptbookExecutor';
4
- import { MockedEchoNaturalExecutionTools } from '../execution/plugins/natural-execution-tools/mocked/MockedEchoNaturalExecutionTools';
5
- import { MockedFackedNaturalExecutionTools } from '../execution/plugins/natural-execution-tools/mocked/MockedFackedNaturalExecutionTools';
6
4
  import { CallbackInterfaceTools } from '../execution/plugins/user-interface-execution-tools/callback/CallbackInterfaceTools';
7
5
  import { CallbackInterfaceToolsOptions } from '../execution/plugins/user-interface-execution-tools/callback/CallbackInterfaceToolsOptions';
8
6
  import { SimplePromptInterfaceTools } from '../execution/plugins/user-interface-execution-tools/simple-prompt/SimplePromptInterfaceTools';
@@ -16,6 +14,5 @@ export { ExecutionTypes, PROMPTBOOK_VERSION };
16
14
  export { createPromptbookLibraryFromPromise, createPromptbookLibraryFromSources, createPromptbookSublibrary, SimplePromptbookLibrary, };
17
15
  export { SimplePromptInterfaceTools };
18
16
  export { promptbookStringToJson, validatePromptbookJson };
19
- export { MockedEchoNaturalExecutionTools, MockedFackedNaturalExecutionTools };
20
17
  export { createPromptbookExecutor };
21
18
  export { CallbackInterfaceTools, CallbackInterfaceToolsOptions };
@@ -0,0 +1,3 @@
1
+ import { LangtailExecutionTools } from '../execution/plugins/natural-execution-tools/langtail/LangtailExecutionTools';
2
+ import { LangtailExecutionToolsOptions } from '../execution/plugins/natural-execution-tools/langtail/LangtailExecutionToolsOptions';
3
+ export { LangtailExecutionTools, LangtailExecutionToolsOptions };
@@ -0,0 +1,6 @@
1
+ import { MockedEchoNaturalExecutionTools } from '../execution/plugins/natural-execution-tools/mocked/MockedEchoNaturalExecutionTools';
2
+ import { MockedFackedNaturalExecutionTools } from '../execution/plugins/natural-execution-tools/mocked/MockedFackedNaturalExecutionTools';
3
+ export { MockedEchoNaturalExecutionTools, MockedFackedNaturalExecutionTools };
4
+ /**
5
+ * TODO: [🚏] FakeLLM
6
+ */
@@ -0,0 +1,11 @@
1
+ import type { OpenAiExecutionToolsOptions } from '../openai/OpenAiExecutionToolsOptions';
2
+ /**
3
+ * Options for LangtailExecutionTools
4
+ *
5
+ * This extends OpenAI's `ClientOptions` with are directly passed to the OpenAI client.
6
+ * Rest is used by the `OpenAiExecutionTools`.
7
+ */
8
+ export type LangtailExecutionToolsOptions = OpenAiExecutionToolsOptions;
9
+ /**
10
+ * TODO: !!! Use or remove
11
+ */
@@ -10,6 +10,6 @@ import { PostprocessingFunction } from '../../script-execution-tools/javascript/
10
10
  */
11
11
  export declare function $fakeTextToExpectations(expectations: Expectations, postprocessing?: Array<PostprocessingFunction>): Promise<string>;
12
12
  /**
13
- * TODO: Implement better - create FakeLLM from this
13
+ * TODO: [🚏] Implement better - create FakeLLM from this
14
14
  * TODO: [💝] Unite object for expecting amount and format - use here also a format
15
15
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/types",
3
- "version": "0.45.0",
3
+ "version": "0.46.0-1",
4
4
  "description": "Library to supercharge your use of large language models",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -35,7 +35,7 @@
35
35
  "homepage": "https://www.npmjs.com/package/@promptbook/core",
36
36
  "dependencies": {},
37
37
  "peerDependencies": {
38
- "@promptbook/core": "0.45.0"
38
+ "@promptbook/core": "0.46.0-1"
39
39
  },
40
40
  "main": "./umd/index.umd.js",
41
41
  "module": "./esm/index.es.js",
@@ -1,8 +1,6 @@
1
1
  import { promptbookStringToJson } from '../conversion/promptbookStringToJson';
2
2
  import { validatePromptbookJson } from '../conversion/validation/validatePromptbookJson';
3
3
  import { createPromptbookExecutor } from '../execution/createPromptbookExecutor';
4
- import { MockedEchoNaturalExecutionTools } from '../execution/plugins/natural-execution-tools/mocked/MockedEchoNaturalExecutionTools';
5
- import { MockedFackedNaturalExecutionTools } from '../execution/plugins/natural-execution-tools/mocked/MockedFackedNaturalExecutionTools';
6
4
  import { CallbackInterfaceTools } from '../execution/plugins/user-interface-execution-tools/callback/CallbackInterfaceTools';
7
5
  import { CallbackInterfaceToolsOptions } from '../execution/plugins/user-interface-execution-tools/callback/CallbackInterfaceToolsOptions';
8
6
  import { SimplePromptInterfaceTools } from '../execution/plugins/user-interface-execution-tools/simple-prompt/SimplePromptInterfaceTools';
@@ -16,6 +14,5 @@ export { ExecutionTypes, PROMPTBOOK_VERSION };
16
14
  export { createPromptbookLibraryFromPromise, createPromptbookLibraryFromSources, createPromptbookSublibrary, SimplePromptbookLibrary, };
17
15
  export { SimplePromptInterfaceTools };
18
16
  export { promptbookStringToJson, validatePromptbookJson };
19
- export { MockedEchoNaturalExecutionTools, MockedFackedNaturalExecutionTools };
20
17
  export { createPromptbookExecutor };
21
18
  export { CallbackInterfaceTools, CallbackInterfaceToolsOptions };
@@ -0,0 +1,3 @@
1
+ import { LangtailExecutionTools } from '../execution/plugins/natural-execution-tools/langtail/LangtailExecutionTools';
2
+ import { LangtailExecutionToolsOptions } from '../execution/plugins/natural-execution-tools/langtail/LangtailExecutionToolsOptions';
3
+ export { LangtailExecutionTools, LangtailExecutionToolsOptions };
@@ -0,0 +1,6 @@
1
+ import { MockedEchoNaturalExecutionTools } from '../execution/plugins/natural-execution-tools/mocked/MockedEchoNaturalExecutionTools';
2
+ import { MockedFackedNaturalExecutionTools } from '../execution/plugins/natural-execution-tools/mocked/MockedFackedNaturalExecutionTools';
3
+ export { MockedEchoNaturalExecutionTools, MockedFackedNaturalExecutionTools };
4
+ /**
5
+ * TODO: [🚏] FakeLLM
6
+ */
@@ -0,0 +1,11 @@
1
+ import type { OpenAiExecutionToolsOptions } from '../openai/OpenAiExecutionToolsOptions';
2
+ /**
3
+ * Options for LangtailExecutionTools
4
+ *
5
+ * This extends OpenAI's `ClientOptions` with are directly passed to the OpenAI client.
6
+ * Rest is used by the `OpenAiExecutionTools`.
7
+ */
8
+ export type LangtailExecutionToolsOptions = OpenAiExecutionToolsOptions;
9
+ /**
10
+ * TODO: !!! Use or remove
11
+ */
@@ -10,6 +10,6 @@ import { PostprocessingFunction } from '../../script-execution-tools/javascript/
10
10
  */
11
11
  export declare function $fakeTextToExpectations(expectations: Expectations, postprocessing?: Array<PostprocessingFunction>): Promise<string>;
12
12
  /**
13
- * TODO: Implement better - create FakeLLM from this
13
+ * TODO: [🚏] Implement better - create FakeLLM from this
14
14
  * TODO: [💝] Unite object for expecting amount and format - use here also a format
15
15
  */