@promptbook/remote-client 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/remote-client)](https://socket.dev/npm/package/@promptbook/remote-client)
12
12
 
13
- <!--/Badges-->
13
+
14
14
 
15
15
  ## 📦 Package `@promptbook/remote-client`
16
16
 
@@ -23,16 +23,13 @@ To install this package, run:
23
23
  npm i @promptbook/remote-client
24
24
  ```
25
25
 
26
- <!-- TODO: Sample of use + interlink server and client -->
26
+
27
27
 
28
28
  ---
29
29
 
30
30
  Rest of the documentation is common for **entire promptbook ecosystem**:
31
31
 
32
- <!--
33
- TODO: Probbably remove this section only in packages
34
- > ⚠ Warning: This library is still in early development.
35
- -->
32
+
36
33
 
37
34
  ## 🤍 Whitepaper
38
35
 
@@ -75,13 +72,13 @@ In any of these situations, but especially in (3), the Promptbook library can ma
75
72
  - Multiple promptbooks forms a library which will become a **part of your application codebase**.
76
73
  - Theese promptbooks are designed such as they **can be written by non-programmers**.
77
74
 
78
- <!-- TODO: [🧠] Make some more clear escaping -->
75
+
79
76
 
80
77
  ### Sample:
81
78
 
82
79
  File `write-website-content.ptbk.md`:
83
80
 
84
- <!------------------------[ Sample: ]------------------------>
81
+
85
82
 
86
83
  > # 🌍 Create website content
87
84
  >
@@ -252,7 +249,7 @@ File `write-website-content.ptbk.md`:
252
249
  >
253
250
  > `-> {content}`
254
251
 
255
- <!------------------------[ /Sample ]------------------------>
252
+
256
253
 
257
254
  Following is the scheme how the promptbook above is executed:
258
255
 
@@ -305,15 +302,27 @@ _Note: We are using [postprocessing functions](#postprocessing-functions) like `
305
302
 
306
303
  ## 📦 Packages
307
304
 
308
- This library is divided into several packages, all are published from [single monorepo](https://github.com/webgptorg/promptbook):
305
+ This library is divided into several packages, all are published from [single monorepo](https://github.com/webgptorg/promptbook).
306
+ You can install all of them at once:
307
+
308
+ ```bash
309
+ npm i ptbk
310
+ ```
309
311
 
310
- <!--[🔠]-->
312
+ Or you can install them separately:
311
313
 
314
+
315
+
316
+
317
+ - ⭐ **[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
318
+ - **[promptbook](https://www.npmjs.com/package/@promptbook/core)** - Just alias for `ptbk`
312
319
  - **[@promptbook/core](https://www.npmjs.com/package/@promptbook/core)** - Core of the library, it contains the main logic for promptbooks
313
- - ⭐ **[@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
320
+ - ⭐ **[@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
314
321
  - _(Not finished)_ **[@promptbook/wizzard](https://www.npmjs.com/package/@promptbook/wizzard)** - Wizard for creating+running promptbooks in single line
315
322
  - **[@promptbook/execute-javascript](https://www.npmjs.com/package/@promptbook/execute-javascript)** - Execution tools for javascript inside promptbooks
316
323
  - **[@promptbook/openai](https://www.npmjs.com/package/@promptbook/openai)** - Execution tools for OpenAI API, wrapper around OpenAI SDK
324
+ - **[@promptbook/langtail](https://www.npmjs.com/package/@promptbook/langtail)** - Execution tools for Langtail API, wrapper around Langtail SDK
325
+ - **[@promptbook/mock](https://www.npmjs.com/package/@promptbook/mock)** - Mocked execution tools for testing the library and saving the tokens
317
326
  - **[@promptbook/remote-client](https://www.npmjs.com/package/@promptbook/remote-client)** - Remote client for remote execution of promptbooks
318
327
  - **[@promptbook/remote-server](https://www.npmjs.com/package/@promptbook/remote-server)** - Remote server for remote execution of promptbooks
319
328
  - **[@promptbook/types](https://www.npmjs.com/package/@promptbook/types)** - Just typescript types used in the library
@@ -485,7 +494,7 @@ There are [postprocessing functions](#postprocessing-functions) that can be used
485
494
 
486
495
  - _(Not implemented yet)_ `ConsoleInterfaceTools` is a wrapper around `readline` module that interacts with the user via console.
487
496
  - `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.
488
- - `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 -->
497
+ - `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.
489
498
 
490
499
  ### Executor
491
500
 
@@ -555,10 +564,7 @@ There are two types of expectations which are not strictly symmetrical:
555
564
 
556
565
  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.
557
566
 
558
- <!--
559
- ### New
560
- [🥻] Insert here when making new command
561
- -->
567
+
562
568
 
563
569
  ### Execution report
564
570
 
@@ -566,7 +572,7 @@ Execution report is a simple object or markdown that contains information about
566
572
 
567
573
  [See the example of such a report](/samples/templates/50-advanced.report.md)
568
574
 
569
- <!-- TODO: Write more -->
575
+
570
576
 
571
577
  ### Remote server
572
578
 
@@ -577,23 +583,7 @@ This is useful to make all logic on browser side but not expose your API keys or
577
583
 
578
584
  ## 👨‍💻 Usage and integration _(for developers)_
579
585
 
580
- <!--
581
-
582
- TODO: [🧙‍♂️]
583
-
584
- ### 🧙‍♂️ Using wizzard
585
-
586
- First you need to install this library:
587
-
588
- ```bash
589
- npm install --save @promptbook/wizzard
590
- ```
591
-
592
- > TODO: !! Write the Wizzard sample
593
-
594
- [Usage samples](./samples/usage/)
595
586
 
596
- -->
597
587
 
598
588
  ### 🔌 Usage in Typescript / Javascript
599
589
 
@@ -618,11 +608,11 @@ npm install --save @promptbook/wizzard
618
608
 
619
609
  ## 🐜 Known issues
620
610
 
621
- <!-- TODO: -->
611
+
622
612
 
623
613
  ## 🧼 Intentionally not implemented features
624
614
 
625
- <!-- TODO: -->
615
+
626
616
 
627
617
  ## ❔ FAQ
628
618
 
@@ -638,42 +628,17 @@ Langchain is primarily aimed at ML developers working in Python. This library is
638
628
 
639
629
  We are considering creating a bridge/converter between these two libraries.
640
630
 
641
- <!--
642
631
 
643
- ==========
644
- Include:
645
- - Langchain is the python library and JavaScript is on second place
646
- - Langchain primarily focused on making templates, not on combining templates into larger structures
647
- - at the language level it distinguishes between chat and completion, I need to mix the two into one template pipeline
648
- - 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)
649
- - The focus of promptbooks is primarily on building user applications, not the data processing, training or autogpt.
650
- -->
651
632
 
652
633
  ### Promptbooks vs. OpenAI`s GPTs
653
634
 
654
635
  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.
655
636
 
656
- <!--
657
- TODO:
658
- ### Promptbooks vs. Semantic Kernel
659
-
660
637
 
661
- -->
662
638
 
663
- <!--
664
- TODO: !
665
- ### Promptbooks vs. Langtail
666
639
 
667
640
 
668
- -->
669
641
 
670
- <!--
671
- TODO:
672
- ### Promptbooks vs. Evidentally AI
673
-
674
- Logging and monitoring
675
-
676
- -->
677
642
 
678
643
  ### Where should I store my promptbooks?
679
644
 
@@ -695,34 +660,10 @@ In large language models, you will get better results if you have prompts in the
695
660
 
696
661
  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.
697
662
 
698
- <!--
699
- TODO: (Maybe)
700
- ### Why you need to explicitly specify input and output parameters?
701
- -->
702
-
703
- <!--
704
-
705
-
706
663
 
707
- !
708
664
 
709
665
 
710
666
 
711
- unit testing
712
-
713
- escaping
714
-
715
- how i get block into prompt
716
-
717
-
718
- ## 🚷 Limitations
719
-
720
- function calling
721
- system message
722
- iterations
723
-
724
- -->
725
-
726
667
  ## ⌚ Changelog
727
668
 
728
669
  See [CHANGELOG.md](./CHANGELOG.md)
@@ -731,13 +672,11 @@ See [CHANGELOG.md](./CHANGELOG.md)
731
672
 
732
673
  <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>
733
674
 
734
- <!--Contributing-->
735
- <!--⚠️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.-->
675
+
676
+
736
677
 
737
678
  ## 🖋️ Contributing
738
679
 
739
680
  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).
740
681
 
741
- 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/).
742
-
743
- <!--/Contributing-->
682
+ 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/remote-client",
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,
@@ -37,7 +37,7 @@
37
37
  "socket.io-client": "4.7.2"
38
38
  },
39
39
  "peerDependencies": {
40
- "@promptbook/core": "0.45.0"
40
+ "@promptbook/core": "0.46.0-1"
41
41
  },
42
42
  "main": "./umd/index.umd.js",
43
43
  "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
  */