@promptbook/types 0.70.0-1 → 0.72.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.
- package/README.md +21 -57
- package/esm/typings/promptbook-collection/index.d.ts +0 -3
- package/esm/typings/src/_packages/core.index.d.ts +4 -2
- package/esm/typings/src/_packages/openai.index.d.ts +4 -0
- package/esm/typings/src/_packages/types.index.d.ts +2 -0
- package/esm/typings/src/cli/cli-commands/make.d.ts +1 -1
- package/esm/typings/src/collection/constructors/createCollectionFromUrl.d.ts +1 -1
- package/esm/typings/src/commands/FOREACH/ForeachCommand.d.ts +1 -6
- package/esm/typings/src/commands/FOREACH/foreachCommandParser.d.ts +1 -2
- package/esm/typings/src/commands/_common/types/CommandParser.d.ts +1 -16
- package/esm/typings/src/config.d.ts +2 -2
- package/esm/typings/src/conversion/pipelineStringToJsonSync.d.ts +1 -1
- package/esm/typings/src/conversion/validation/validatePipeline.d.ts +5 -5
- package/esm/typings/src/execution/createPipelineExecutor.d.ts +1 -1
- package/esm/typings/src/execution/translation/automatic-translate/automatic-translators/LindatAutomaticTranslator.d.ts +1 -1
- package/esm/typings/src/execution/utils/addUsage.d.ts +0 -56
- package/esm/typings/src/execution/utils/usage-constants.d.ts +127 -0
- package/esm/typings/src/knowledge/dialogs/callback/CallbackInterfaceTools.d.ts +1 -1
- package/esm/typings/src/knowledge/dialogs/simple-prompt/SimplePromptInterfaceTools.d.ts +1 -1
- package/esm/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +1 -1
- package/esm/typings/src/knowledge/prepare-knowledge/pdf/prepareKnowledgeFromPdf.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/utils/cache/CacheItem.d.ts +1 -1
- package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +3 -2
- package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/anthropic-claude/createAnthropicClaudeExecutionTools.d.ts +2 -2
- package/esm/typings/src/llm-providers/anthropic-claude/playground/playground.d.ts +2 -2
- package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +3 -2
- package/esm/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +37 -0
- package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionToolsOptions.d.ts +14 -0
- package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +3 -2
- package/esm/typings/src/llm-providers/openai/playground/playground.d.ts +1 -1
- package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/personas/preparePersona.d.ts +1 -1
- package/esm/typings/src/prepare/isPipelinePrepared.d.ts +1 -1
- package/esm/typings/src/prepare/prepareTemplates.d.ts +1 -1
- package/esm/typings/src/scripting/javascript/JavascriptEvalExecutionTools.d.ts +1 -1
- package/esm/typings/src/scripting/python/PythonExecutionTools.d.ts +1 -1
- package/esm/typings/src/scripting/typescript/TypescriptExecutionTools.d.ts +1 -1
- package/esm/typings/src/storage/files-storage/FilesStorage.d.ts +1 -1
- package/esm/typings/src/types/PipelineJson/PipelineJson.d.ts +1 -1
- package/esm/typings/src/types/typeAliases.d.ts +1 -1
- package/esm/typings/src/utils/serialization/checkSerializableAsJson.d.ts +1 -1
- package/esm/typings/src/utils/serialization/isSerializableAsJson.d.ts +1 -1
- package/package.json +2 -2
- package/esm/typings/src/personas/preparePersona.test.d.ts +0 -1
package/README.md
CHANGED
|
@@ -63,15 +63,21 @@ _Note: `@promptbook/types` does not export brand-specific types like `OpenAiExec
|
|
|
63
63
|
|
|
64
64
|
Rest of the documentation is common for **entire promptbook ecosystem**:
|
|
65
65
|
|
|
66
|
+
# ✨ New Features
|
|
67
|
+
|
|
68
|
+
- ✨ **Support [OpenAI o1 model](https://openai.com/o1/)**
|
|
69
|
+
|
|
66
70
|
## 🤍 The Promptbook Whitepaper
|
|
67
71
|
|
|
72
|
+
|
|
73
|
+
|
|
68
74
|
If you have a simple, single prompt for ChatGPT, GPT-4, Anthropic Claude, Google Gemini, Llama 2, or whatever, it doesn't matter how you integrate it. Whether it's calling a REST API directly, using the SDK, hardcoding the prompt into the source code, or importing a text file, the process remains the same.
|
|
69
75
|
|
|
70
76
|
But often you will struggle with the limitations of LLMs, such as hallucinations, off-topic responses, poor quality output, language drift, word repetition repetition repetition repetition or misuse, lack of context, or just plain w𝒆𝐢rd responses. When this happens, you generally have three options:
|
|
71
77
|
|
|
72
78
|
1. **Fine-tune** the model to your specifications or even train your own.
|
|
73
79
|
2. **Prompt-engineer** the prompt to the best shape you can achieve.
|
|
74
|
-
3.
|
|
80
|
+
3. Orchestrate **multiple prompts** in a [pipeline](https://github.com/webgptorg/promptbook/discussions/64) to get the best result.
|
|
75
81
|
|
|
76
82
|
In all of these situations, but especially in 3., the Promptbook library can make your life easier.
|
|
77
83
|
|
|
@@ -83,7 +89,9 @@ In all of these situations, but especially in 3., the Promptbook library can mak
|
|
|
83
89
|
- Promptbook has built in versioning. You can test multiple **A/B versions** of pipelines and see which one works best.
|
|
84
90
|
- Promptbook is designed to do [**RAG** (Retrieval-Augmented Generation)](https://github.com/webgptorg/promptbook/discussions/41) and other advanced techniques. You can use **knowledge** to improve the quality of the output.
|
|
85
91
|
|
|
86
|
-
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
## 🧔 Pipeline _(for prompt-engeneers)_
|
|
87
95
|
|
|
88
96
|
**P**romp**t** **b**oo**k** markdown file (or `.ptbk.md` file) is document that describes a **pipeline** - a series of prompts that are chained together to form somewhat reciepe for transforming natural language input.
|
|
89
97
|
|
|
@@ -400,6 +408,8 @@ The following glossary is used to clarify certain concepts:
|
|
|
400
408
|
- When you want to **version** your prompts and **test multiple versions**
|
|
401
409
|
- When you want to **log** the execution of prompts and backtrace the issues
|
|
402
410
|
|
|
411
|
+
[See more](https://github.com/webgptorg/promptbook/discussions/111)
|
|
412
|
+
|
|
403
413
|
### ➖ When not to use
|
|
404
414
|
|
|
405
415
|
- When you have already implemented single simple prompt and it works fine for your job
|
|
@@ -409,6 +419,8 @@ The following glossary is used to clarify certain concepts:
|
|
|
409
419
|
- When your main focus is on something other than text - like images, audio, video, spreadsheets _(other media types may be added in the future, [see discussion](https://github.com/webgptorg/promptbook/discussions/103))_
|
|
410
420
|
- When you need to use recursion _([see the discussion](https://github.com/webgptorg/promptbook/discussions/38))_
|
|
411
421
|
|
|
422
|
+
[See more](https://github.com/webgptorg/promptbook/discussions/112)
|
|
423
|
+
|
|
412
424
|
## 🐜 Known issues
|
|
413
425
|
|
|
414
426
|
- [🤸♂️ Iterations not working yet](https://github.com/webgptorg/promptbook/discussions/55)
|
|
@@ -421,63 +433,15 @@ The following glossary is used to clarify certain concepts:
|
|
|
421
433
|
|
|
422
434
|
## ❔ FAQ
|
|
423
435
|
|
|
424
|
-
|
|
425
|
-
|
|
426
436
|
If you have a question [start a discussion](https://github.com/webgptorg/promptbook/discussions/), [open an issue](https://github.com/webgptorg/promptbook/issues) or [write me an email](https://www.pavolhejny.com/contact).
|
|
427
437
|
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
We are considering creating a bridge/converter between these two libraries.
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
### Promptbooks vs. OpenAI`s GPTs
|
|
441
|
-
|
|
442
|
-
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.
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
### Where should I store my promptbooks?
|
|
459
|
-
|
|
460
|
-
If you use raw SDKs, you just put prompts in the sourcecode, mixed in with typescript, javascript, python or whatever programming language you use.
|
|
461
|
-
|
|
462
|
-
If you use promptbooks, you can store them in several places, each with its own advantages and disadvantages:
|
|
463
|
-
|
|
464
|
-
1. As **source code**, typically git-committed. In this case you can use the versioning system and the promptbooks will be tightly coupled with the version of the application. You still get the power of promptbooks, as you separate the concerns of the prompt-engineer and the programmer.
|
|
465
|
-
|
|
466
|
-
2. As data in a **database** In this case, promptbooks are like posts / articles on the blog. They can be modified independently of the application. You don't need to redeploy the application to change the promptbooks. You can have multiple versions of promptbooks for each user. You can have a web interface for non-programmers to create and modify promptbooks. But you lose the versioning system and you still have to consider the interface between the promptbooks and the application _(= input and output parameters)_.
|
|
467
|
-
|
|
468
|
-
3. In a **configuration** in environment variables. This is a good way to store promptbooks if you have an application with multiple deployments and you want to have different but simple promptbooks for each deployment and you don't need to change them often.
|
|
469
|
-
|
|
470
|
-
### What should I do when I need same promptbook in multiple human languages?
|
|
471
|
-
|
|
472
|
-
A single promptbook can be written for several _(human)_ languages at once. However, we recommend that you have separate promptbooks for each language.
|
|
473
|
-
|
|
474
|
-
In large language models, you will get better results if you have prompts in the same language as the user input.
|
|
475
|
-
|
|
476
|
-
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.
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
438
|
+
- [❔ Why not just use the OpenAI SDK / Anthropic Claude SDK / ...?](https://github.com/webgptorg/promptbook/discussions/114)
|
|
439
|
+
- [❔ How is it different from the OpenAI`s GPTs?](https://github.com/webgptorg/promptbook/discussions/118)
|
|
440
|
+
- [❔ How is it different from the Langchain?](https://github.com/webgptorg/promptbook/discussions/115)
|
|
441
|
+
- [❔ How is it different from the DSPy?](https://github.com/webgptorg/promptbook/discussions/117)
|
|
442
|
+
- [❔ How is it different from _anything_?](https://github.com/webgptorg/promptbook/discussions?discussions_q=is%3Aopen+label%3A%22Promptbook+vs%22)
|
|
443
|
+
- [❔ Is Promptbook using RAG _(Retrieval-Augmented Generation)_?](https://github.com/webgptorg/promptbook/discussions/123)
|
|
444
|
+
- [❔ Is Promptbook using function calling?](https://github.com/webgptorg/promptbook/discussions/124)
|
|
481
445
|
|
|
482
446
|
## ⌚ Changelog
|
|
483
447
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
declare const _default: ({
|
|
2
2
|
title: string;
|
|
3
3
|
pipelineUrl: string;
|
|
4
|
-
promptbookVersion: string;
|
|
5
4
|
parameters: {
|
|
6
5
|
name: string;
|
|
7
6
|
description: string;
|
|
@@ -24,7 +23,6 @@ declare const _default: ({
|
|
|
24
23
|
} | {
|
|
25
24
|
title: string;
|
|
26
25
|
pipelineUrl: string;
|
|
27
|
-
promptbookVersion: string;
|
|
28
26
|
parameters: {
|
|
29
27
|
name: string;
|
|
30
28
|
description: string;
|
|
@@ -53,7 +51,6 @@ declare const _default: ({
|
|
|
53
51
|
} | {
|
|
54
52
|
title: string;
|
|
55
53
|
pipelineUrl: string;
|
|
56
|
-
promptbookVersion: string;
|
|
57
54
|
parameters: {
|
|
58
55
|
name: string;
|
|
59
56
|
description: string;
|
|
@@ -40,9 +40,10 @@ import { UnexpectedError } from '../errors/UnexpectedError';
|
|
|
40
40
|
import { assertsExecutionSuccessful } from '../execution/assertsExecutionSuccessful';
|
|
41
41
|
import { createPipelineExecutor } from '../execution/createPipelineExecutor';
|
|
42
42
|
import { embeddingVectorToString } from '../execution/embeddingVectorToString';
|
|
43
|
-
import { ZERO_USAGE } from '../execution/utils/addUsage';
|
|
44
43
|
import { addUsage } from '../execution/utils/addUsage';
|
|
45
44
|
import { isPassingExpectations } from '../execution/utils/checkExpectations';
|
|
45
|
+
import { ZERO_USAGE } from '../execution/utils/usage-constants';
|
|
46
|
+
import { UNCERTAIN_USAGE } from '../execution/utils/usage-constants';
|
|
46
47
|
import { usageToHuman } from '../execution/utils/usageToHuman';
|
|
47
48
|
import { usageToWorktime } from '../execution/utils/usageToWorktime';
|
|
48
49
|
import { CallbackInterfaceTools } from '../knowledge/dialogs/callback/CallbackInterfaceTools';
|
|
@@ -113,9 +114,10 @@ export { UnexpectedError };
|
|
|
113
114
|
export { assertsExecutionSuccessful };
|
|
114
115
|
export { createPipelineExecutor };
|
|
115
116
|
export { embeddingVectorToString };
|
|
116
|
-
export { ZERO_USAGE };
|
|
117
117
|
export { addUsage };
|
|
118
118
|
export { isPassingExpectations };
|
|
119
|
+
export { ZERO_USAGE };
|
|
120
|
+
export { UNCERTAIN_USAGE };
|
|
119
121
|
export { usageToHuman };
|
|
120
122
|
export { usageToWorktime };
|
|
121
123
|
export { CallbackInterfaceTools };
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { PROMPTBOOK_VERSION } from '../version';
|
|
2
2
|
import { createOpenAiExecutionTools } from '../llm-providers/openai/createOpenAiExecutionTools';
|
|
3
3
|
import { OPENAI_MODELS } from '../llm-providers/openai/openai-models';
|
|
4
|
+
import { OpenAiAssistantExecutionTools } from '../llm-providers/openai/OpenAiAssistantExecutionTools';
|
|
5
|
+
import type { OpenAiAssistantExecutionToolsOptions } from '../llm-providers/openai/OpenAiAssistantExecutionToolsOptions';
|
|
4
6
|
import { OpenAiExecutionTools } from '../llm-providers/openai/OpenAiExecutionTools';
|
|
5
7
|
import type { OpenAiExecutionToolsOptions } from '../llm-providers/openai/OpenAiExecutionToolsOptions';
|
|
6
8
|
import { _OpenAiRegistration } from '../llm-providers/openai/register-constructor';
|
|
7
9
|
export { PROMPTBOOK_VERSION };
|
|
8
10
|
export { createOpenAiExecutionTools };
|
|
9
11
|
export { OPENAI_MODELS };
|
|
12
|
+
export { OpenAiAssistantExecutionTools };
|
|
13
|
+
export type { OpenAiAssistantExecutionToolsOptions };
|
|
10
14
|
export { OpenAiExecutionTools };
|
|
11
15
|
export type { OpenAiExecutionToolsOptions };
|
|
12
16
|
export { _OpenAiRegistration };
|
|
@@ -45,6 +45,7 @@ import type { AnthropicClaudeExecutionToolsProxiedOptions } from '../llm-provide
|
|
|
45
45
|
import type { AzureOpenAiExecutionToolsOptions } from '../llm-providers/azure-openai/AzureOpenAiExecutionToolsOptions';
|
|
46
46
|
import type { LangtailExecutionToolsOptions } from '../llm-providers/langtail/LangtailExecutionToolsOptions';
|
|
47
47
|
import type { MultipleLlmExecutionTools } from '../llm-providers/multiple/MultipleLlmExecutionTools';
|
|
48
|
+
import type { OpenAiAssistantExecutionToolsOptions } from '../llm-providers/openai/OpenAiAssistantExecutionToolsOptions';
|
|
48
49
|
import type { OpenAiExecutionToolsOptions } from '../llm-providers/openai/OpenAiExecutionToolsOptions';
|
|
49
50
|
import type { PromptbookServer_Error } from '../llm-providers/remote/interfaces/PromptbookServer_Error';
|
|
50
51
|
import type { PromptbookServer_ListModels_Request } from '../llm-providers/remote/interfaces/PromptbookServer_ListModels_Request';
|
|
@@ -270,6 +271,7 @@ export type { AnthropicClaudeExecutionToolsProxiedOptions };
|
|
|
270
271
|
export type { AzureOpenAiExecutionToolsOptions };
|
|
271
272
|
export type { LangtailExecutionToolsOptions };
|
|
272
273
|
export type { MultipleLlmExecutionTools };
|
|
274
|
+
export type { OpenAiAssistantExecutionToolsOptions };
|
|
273
275
|
export type { OpenAiExecutionToolsOptions };
|
|
274
276
|
export type { PromptbookServer_Error };
|
|
275
277
|
export type { PromptbookServer_ListModels_Request };
|
|
@@ -6,7 +6,7 @@ import type { Command as Program } from 'commander';
|
|
|
6
6
|
*/
|
|
7
7
|
export declare function initializeMakeCommand(program: Program): void;
|
|
8
8
|
/**
|
|
9
|
-
* TODO: [🥃] !!! Allow `ptbk make` without configuring any llm tools
|
|
9
|
+
* TODO: [🥃][main] !!! Allow `ptbk make` without configuring any llm tools
|
|
10
10
|
* TODO: Maybe remove this command - "about" command should be enough?
|
|
11
11
|
* TODO: [0] DRY Javascript and typescript - Maybe make ONLY typescript and for javascript just remove types
|
|
12
12
|
* Note: [🟡] This code should never be published outside of `@promptbook/cli`
|
|
@@ -25,5 +25,5 @@ type CreatePipelineCollectionFromUrlyOptions = {
|
|
|
25
25
|
export declare function createCollectionFromUrl(url: string_url | URL, options: CreatePipelineCollectionFromUrlyOptions): Promise<PipelineCollection>;
|
|
26
26
|
export {};
|
|
27
27
|
/**
|
|
28
|
-
* TODO: !!!! [🧠] Library precompilation and do not mix markdown and json promptbooks
|
|
28
|
+
* TODO:[main] !!!! [🧠] Library precompilation and do not mix markdown and json promptbooks
|
|
29
29
|
*/
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
import type { string_parameter_name } from '../../types/typeAliases';
|
|
2
|
-
import type { TODO_string } from '../../utils/organization/TODO_string';
|
|
3
1
|
/**
|
|
4
|
-
* Parsed FOREACH command <- Write [🍭]
|
|
2
|
+
* Parsed FOREACH command <- Write [🍭]
|
|
5
3
|
*
|
|
6
4
|
* @see ./foreachCommandParser.ts for more details
|
|
7
5
|
* @private within the commands folder
|
|
8
6
|
*/
|
|
9
7
|
export type ForeachCommand = {
|
|
10
8
|
readonly type: 'FOREACH';
|
|
11
|
-
formatName: TODO_string;
|
|
12
|
-
cellName: TODO_string;
|
|
13
|
-
parameterName: string_parameter_name;
|
|
14
9
|
};
|
|
@@ -10,6 +10,5 @@ import type { ForeachCommand } from './ForeachCommand';
|
|
|
10
10
|
*/
|
|
11
11
|
export declare const foreachCommandParser: PipelineTemplateCommandParser<ForeachCommand>;
|
|
12
12
|
/**
|
|
13
|
-
* TODO:
|
|
14
|
-
* TODO: [🍭] !!!!!! Make .ptbk.md file with examples of the FOREACH command and also with wrong parsing and logic
|
|
13
|
+
* TODO: [🍭] Make .ptbk.md file with examples of the FOREACH command and also with wrong parsing and logic
|
|
15
14
|
*/
|
|
@@ -147,39 +147,24 @@ export type $PipelineJson = WritableDeep<PipelineJson>;
|
|
|
147
147
|
export type CommandParserInput = {
|
|
148
148
|
/**
|
|
149
149
|
* @@@
|
|
150
|
-
*
|
|
151
|
-
* @example 'PIPELINE_HEAD'
|
|
152
|
-
* @example 'PIPELINE_TEMPLATE'
|
|
153
150
|
*/
|
|
154
151
|
readonly usagePlace: CommandUsagePlace;
|
|
155
152
|
/**
|
|
156
153
|
* @@@
|
|
157
|
-
*
|
|
158
|
-
* @example 'promptbook version 0.62.0'
|
|
159
|
-
* @example 'FOREACH List Line -> `{customer}`'
|
|
160
154
|
*/
|
|
161
155
|
readonly raw: string_markdown_text;
|
|
162
156
|
/**
|
|
163
157
|
* @@@
|
|
164
|
-
*
|
|
165
|
-
* @example '0.62.0'
|
|
166
|
-
* @example 'List Line -> `{customer}`'
|
|
167
158
|
*/
|
|
168
159
|
readonly rawArgs: string_markdown_text;
|
|
169
160
|
/**
|
|
170
161
|
* @@@
|
|
171
|
-
*
|
|
172
|
-
* @example 'PROMPTBOOK_VERSION_0_62_0'
|
|
173
|
-
* @example 'FOREACH_LIST_LINE_CUSTOMER'
|
|
174
162
|
*/
|
|
175
163
|
readonly normalized: string_name & string_SCREAMING_CASE;
|
|
176
164
|
/**
|
|
177
165
|
* @@@
|
|
178
|
-
*
|
|
179
|
-
* @example [ '0.62.0' ]
|
|
180
|
-
* @example [ 'List', 'Line', '', '{customer}' ]
|
|
181
166
|
*/
|
|
182
|
-
readonly args: Array<string_name>;
|
|
167
|
+
readonly args: Array<string_name & string_SCREAMING_CASE>;
|
|
183
168
|
};
|
|
184
169
|
/**
|
|
185
170
|
* TODO: [♓️] Add order here
|
|
@@ -68,14 +68,14 @@ export declare const MAX_EXECUTION_ATTEMPTS = 3;
|
|
|
68
68
|
export declare const MAX_FILENAME_LENGTH = 30;
|
|
69
69
|
/**
|
|
70
70
|
* @@@
|
|
71
|
-
* TODO: [🐝] !!! Use
|
|
71
|
+
* TODO: [🐝][main] !!! Use
|
|
72
72
|
*
|
|
73
73
|
* @public exported from `@promptbook/core`
|
|
74
74
|
*/
|
|
75
75
|
export declare const MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH = 3;
|
|
76
76
|
/**
|
|
77
77
|
* @@@
|
|
78
|
-
* TODO: [🐝] !!! Use
|
|
78
|
+
* TODO: [🐝][main] !!! Use
|
|
79
79
|
*
|
|
80
80
|
* @public exported from `@promptbook/core`
|
|
81
81
|
*/
|
|
@@ -18,7 +18,7 @@ import type { PipelineString } from '../types/PipelineString';
|
|
|
18
18
|
*/
|
|
19
19
|
export declare function pipelineStringToJsonSync(pipelineString: PipelineString): PipelineJson;
|
|
20
20
|
/**
|
|
21
|
-
* TODO: !!!! Warn if used only sync version
|
|
21
|
+
* TODO:[main] !!!! Warn if used only sync version
|
|
22
22
|
* TODO: [🚞] Report here line/column of error
|
|
23
23
|
* TODO: Use spaceTrim more effectively
|
|
24
24
|
* TODO: [🧠] Parameter flags - isInput, isOutput, isInternal
|
|
@@ -27,11 +27,11 @@ export declare function validatePipeline(pipeline: PipelineJson): PipelineJson;
|
|
|
27
27
|
* > ex port function validatePipeline(promptbook: really_unknown): asserts promptbook is PipelineJson {
|
|
28
28
|
*/
|
|
29
29
|
/**
|
|
30
|
-
* TODO: [🐣] !!!! Validate that all samples match expectations
|
|
31
|
-
* TODO: [🐣][🐝] !!!! Validate that knowledge is valid (non-void)
|
|
32
|
-
* TODO: [🐣] !!!! Validate that persona can be used only with CHAT variant
|
|
33
|
-
* TODO: [🐣] !!!! Validate that parameter with reserved name not used RESERVED_PARAMETER_NAMES
|
|
34
|
-
* TODO: [🐣] !!!! Validate that reserved parameter is not used as joker
|
|
30
|
+
* TODO: [🐣][main] !!!! Validate that all samples match expectations
|
|
31
|
+
* TODO: [🐣][🐝][main] !!!! Validate that knowledge is valid (non-void)
|
|
32
|
+
* TODO: [🐣][main] !!!! Validate that persona can be used only with CHAT variant
|
|
33
|
+
* TODO: [🐣][main] !!!! Validate that parameter with reserved name not used RESERVED_PARAMETER_NAMES
|
|
34
|
+
* TODO: [🐣][main] !!!! Validate that reserved parameter is not used as joker
|
|
35
35
|
* TODO: [🧠] Validation not only logic itself but imports around - files and websites and rerefenced pipelines exists
|
|
36
36
|
* TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
|
|
37
37
|
*/
|
|
@@ -58,7 +58,7 @@ interface CreatePipelineExecutorOptions {
|
|
|
58
58
|
export declare function createPipelineExecutor(options: CreatePipelineExecutorOptions): PipelineExecutor;
|
|
59
59
|
export {};
|
|
60
60
|
/**
|
|
61
|
-
* TODO: !!! Identify not only pipeline BUT exact template ${block(pipelineIdentification)}
|
|
61
|
+
* TODO:[main] !!! Identify not only pipeline BUT exact template ${block(pipelineIdentification)}
|
|
62
62
|
* TODO: Use isVerbose here (not only pass to `preparePipeline`)
|
|
63
63
|
* TODO: [🧠][🌳] Use here `countTotalUsage` and put preparation and prepared pipiline to report
|
|
64
64
|
* TODO: [🪂] Use maxParallelCount here (not only pass to `preparePipeline`)
|
|
@@ -7,7 +7,7 @@ interface LindatAutomaticTranslatorOptions extends TranslatorOptions {
|
|
|
7
7
|
* @private still in development [🏳]
|
|
8
8
|
*/
|
|
9
9
|
export declare class LindatAutomaticTranslator implements AutomaticTranslator {
|
|
10
|
-
|
|
10
|
+
protected readonly options: LindatAutomaticTranslatorOptions;
|
|
11
11
|
constructor(options: LindatAutomaticTranslatorOptions);
|
|
12
12
|
translate(message: string): Promise<string>;
|
|
13
13
|
}
|
|
@@ -1,60 +1,4 @@
|
|
|
1
1
|
import type { PromptResultUsage } from '../PromptResultUsage';
|
|
2
|
-
/**
|
|
3
|
-
* @@@
|
|
4
|
-
*
|
|
5
|
-
* @public exported from `@promptbook/core`
|
|
6
|
-
*/
|
|
7
|
-
export declare const ZERO_USAGE: import("type-fest/source/readonly-deep").ReadonlyObjectDeep<{
|
|
8
|
-
readonly price: {
|
|
9
|
-
readonly value: 0;
|
|
10
|
-
};
|
|
11
|
-
readonly input: {
|
|
12
|
-
readonly tokensCount: {
|
|
13
|
-
readonly value: 0;
|
|
14
|
-
};
|
|
15
|
-
readonly charactersCount: {
|
|
16
|
-
readonly value: 0;
|
|
17
|
-
};
|
|
18
|
-
readonly wordsCount: {
|
|
19
|
-
readonly value: 0;
|
|
20
|
-
};
|
|
21
|
-
readonly sentencesCount: {
|
|
22
|
-
readonly value: 0;
|
|
23
|
-
};
|
|
24
|
-
readonly linesCount: {
|
|
25
|
-
readonly value: 0;
|
|
26
|
-
};
|
|
27
|
-
readonly paragraphsCount: {
|
|
28
|
-
readonly value: 0;
|
|
29
|
-
};
|
|
30
|
-
readonly pagesCount: {
|
|
31
|
-
readonly value: 0;
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
readonly output: {
|
|
35
|
-
readonly tokensCount: {
|
|
36
|
-
readonly value: 0;
|
|
37
|
-
};
|
|
38
|
-
readonly charactersCount: {
|
|
39
|
-
readonly value: 0;
|
|
40
|
-
};
|
|
41
|
-
readonly wordsCount: {
|
|
42
|
-
readonly value: 0;
|
|
43
|
-
};
|
|
44
|
-
readonly sentencesCount: {
|
|
45
|
-
readonly value: 0;
|
|
46
|
-
};
|
|
47
|
-
readonly linesCount: {
|
|
48
|
-
readonly value: 0;
|
|
49
|
-
};
|
|
50
|
-
readonly paragraphsCount: {
|
|
51
|
-
readonly value: 0;
|
|
52
|
-
};
|
|
53
|
-
readonly pagesCount: {
|
|
54
|
-
readonly value: 0;
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
}>;
|
|
58
2
|
/**
|
|
59
3
|
* Function `addUsage` will add multiple usages into one
|
|
60
4
|
*
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents the usage with no resources consumed
|
|
3
|
+
*
|
|
4
|
+
* @public exported from `@promptbook/core`
|
|
5
|
+
*/
|
|
6
|
+
export declare const ZERO_USAGE: import("type-fest/source/readonly-deep").ReadonlyObjectDeep<{
|
|
7
|
+
readonly price: {
|
|
8
|
+
readonly value: 0;
|
|
9
|
+
};
|
|
10
|
+
readonly input: {
|
|
11
|
+
readonly tokensCount: {
|
|
12
|
+
readonly value: 0;
|
|
13
|
+
};
|
|
14
|
+
readonly charactersCount: {
|
|
15
|
+
readonly value: 0;
|
|
16
|
+
};
|
|
17
|
+
readonly wordsCount: {
|
|
18
|
+
readonly value: 0;
|
|
19
|
+
};
|
|
20
|
+
readonly sentencesCount: {
|
|
21
|
+
readonly value: 0;
|
|
22
|
+
};
|
|
23
|
+
readonly linesCount: {
|
|
24
|
+
readonly value: 0;
|
|
25
|
+
};
|
|
26
|
+
readonly paragraphsCount: {
|
|
27
|
+
readonly value: 0;
|
|
28
|
+
};
|
|
29
|
+
readonly pagesCount: {
|
|
30
|
+
readonly value: 0;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
readonly output: {
|
|
34
|
+
readonly tokensCount: {
|
|
35
|
+
readonly value: 0;
|
|
36
|
+
};
|
|
37
|
+
readonly charactersCount: {
|
|
38
|
+
readonly value: 0;
|
|
39
|
+
};
|
|
40
|
+
readonly wordsCount: {
|
|
41
|
+
readonly value: 0;
|
|
42
|
+
};
|
|
43
|
+
readonly sentencesCount: {
|
|
44
|
+
readonly value: 0;
|
|
45
|
+
};
|
|
46
|
+
readonly linesCount: {
|
|
47
|
+
readonly value: 0;
|
|
48
|
+
};
|
|
49
|
+
readonly paragraphsCount: {
|
|
50
|
+
readonly value: 0;
|
|
51
|
+
};
|
|
52
|
+
readonly pagesCount: {
|
|
53
|
+
readonly value: 0;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
}>;
|
|
57
|
+
/**
|
|
58
|
+
* Represents the usage with unknown resources consumed
|
|
59
|
+
*
|
|
60
|
+
* @public exported from `@promptbook/core`
|
|
61
|
+
*/
|
|
62
|
+
export declare const UNCERTAIN_USAGE: import("type-fest/source/readonly-deep").ReadonlyObjectDeep<{
|
|
63
|
+
readonly price: {
|
|
64
|
+
readonly value: 0;
|
|
65
|
+
readonly isUncertain: true;
|
|
66
|
+
};
|
|
67
|
+
readonly input: {
|
|
68
|
+
readonly tokensCount: {
|
|
69
|
+
readonly value: 0;
|
|
70
|
+
readonly isUncertain: true;
|
|
71
|
+
};
|
|
72
|
+
readonly charactersCount: {
|
|
73
|
+
readonly value: 0;
|
|
74
|
+
readonly isUncertain: true;
|
|
75
|
+
};
|
|
76
|
+
readonly wordsCount: {
|
|
77
|
+
readonly value: 0;
|
|
78
|
+
readonly isUncertain: true;
|
|
79
|
+
};
|
|
80
|
+
readonly sentencesCount: {
|
|
81
|
+
readonly value: 0;
|
|
82
|
+
readonly isUncertain: true;
|
|
83
|
+
};
|
|
84
|
+
readonly linesCount: {
|
|
85
|
+
readonly value: 0;
|
|
86
|
+
readonly isUncertain: true;
|
|
87
|
+
};
|
|
88
|
+
readonly paragraphsCount: {
|
|
89
|
+
readonly value: 0;
|
|
90
|
+
readonly isUncertain: true;
|
|
91
|
+
};
|
|
92
|
+
readonly pagesCount: {
|
|
93
|
+
readonly value: 0;
|
|
94
|
+
readonly isUncertain: true;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
readonly output: {
|
|
98
|
+
readonly tokensCount: {
|
|
99
|
+
readonly value: 0;
|
|
100
|
+
readonly isUncertain: true;
|
|
101
|
+
};
|
|
102
|
+
readonly charactersCount: {
|
|
103
|
+
readonly value: 0;
|
|
104
|
+
readonly isUncertain: true;
|
|
105
|
+
};
|
|
106
|
+
readonly wordsCount: {
|
|
107
|
+
readonly value: 0;
|
|
108
|
+
readonly isUncertain: true;
|
|
109
|
+
};
|
|
110
|
+
readonly sentencesCount: {
|
|
111
|
+
readonly value: 0;
|
|
112
|
+
readonly isUncertain: true;
|
|
113
|
+
};
|
|
114
|
+
readonly linesCount: {
|
|
115
|
+
readonly value: 0;
|
|
116
|
+
readonly isUncertain: true;
|
|
117
|
+
};
|
|
118
|
+
readonly paragraphsCount: {
|
|
119
|
+
readonly value: 0;
|
|
120
|
+
readonly isUncertain: true;
|
|
121
|
+
};
|
|
122
|
+
readonly pagesCount: {
|
|
123
|
+
readonly value: 0;
|
|
124
|
+
readonly isUncertain: true;
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
}>;
|
|
@@ -8,7 +8,7 @@ import type { CallbackInterfaceToolsOptions } from './CallbackInterfaceToolsOpti
|
|
|
8
8
|
* @public exported from `@promptbook/core`
|
|
9
9
|
*/
|
|
10
10
|
export declare class CallbackInterfaceTools implements UserInterfaceTools {
|
|
11
|
-
|
|
11
|
+
protected readonly options: CallbackInterfaceToolsOptions;
|
|
12
12
|
constructor(options: CallbackInterfaceToolsOptions);
|
|
13
13
|
/**
|
|
14
14
|
* Trigger the custom callback function
|
|
@@ -10,7 +10,7 @@ import type { UserInterfaceToolsPromptDialogOptions } from '../../../execution/U
|
|
|
10
10
|
* @public exported from `@promptbook/browser`
|
|
11
11
|
*/
|
|
12
12
|
export declare class SimplePromptInterfaceTools implements UserInterfaceTools {
|
|
13
|
-
|
|
13
|
+
protected readonly options: CommonExecutionToolsOptions;
|
|
14
14
|
constructor(options?: CommonExecutionToolsOptions);
|
|
15
15
|
/**
|
|
16
16
|
* Trigger window.DIALOG TEMPLATE
|
package/esm/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import type { string_markdown } from '../../../types/typeAliases';
|
|
|
8
8
|
*/
|
|
9
9
|
export declare function prepareKnowledgeFromMarkdown(knowledgeContent: string_markdown, options: PrepareOptions): Promise<Array<Omit<KnowledgePiecePreparedJson, 'sources' | 'preparationIds'>>>;
|
|
10
10
|
/**
|
|
11
|
-
* TODO: [🐝][🔼] !!! Export via `@promptbook/markdown`
|
|
11
|
+
* TODO: [🐝][🔼][main] !!! Export via `@promptbook/markdown`
|
|
12
12
|
* TODO: [🪂] Do it in parallel 11:11
|
|
13
13
|
* Note: No need to aggregate usage here, it is done by intercepting the llmTools
|
|
14
14
|
*/
|
|
@@ -8,7 +8,7 @@ import type { string_base64 } from '../../../types/typeAliases';
|
|
|
8
8
|
*/
|
|
9
9
|
export declare function prepareKnowledgeFromPdf(content: string_base64, options: PrepareOptions): Promise<Array<Omit<KnowledgePiecePreparedJson, 'sources' | 'preparationIds'>>>;
|
|
10
10
|
/**
|
|
11
|
-
* TODO: [🐝][🔼] !!! Export via `@promptbook/pdf`
|
|
11
|
+
* TODO: [🐝][🔼][main] !!! Export via `@promptbook/pdf`
|
|
12
12
|
* TODO: [🧺] In future, content can be alse File or Blob BUT for now for wider compatibility its only base64
|
|
13
13
|
* @see https://stackoverflow.com/questions/14653349/node-js-cant-create-blobs
|
|
14
14
|
* TODO: [🪂] Do it in parallel
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import Anthropic from '@anthropic-ai/sdk';
|
|
1
2
|
import type { AvailableModel } from '../../execution/AvailableModel';
|
|
2
3
|
import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
|
|
3
4
|
import type { ChatPromptResult } from '../../execution/PromptResult';
|
|
@@ -13,7 +14,7 @@ import type { AnthropicClaudeExecutionToolsDirectOptions } from './AnthropicClau
|
|
|
13
14
|
* @deprecated use `createAnthropicClaudeExecutionTools` instead
|
|
14
15
|
*/
|
|
15
16
|
export declare class AnthropicClaudeExecutionTools implements LlmExecutionTools {
|
|
16
|
-
|
|
17
|
+
protected readonly options: AnthropicClaudeExecutionToolsDirectOptions;
|
|
17
18
|
/**
|
|
18
19
|
* Anthropic Claude API client.
|
|
19
20
|
*/
|
|
@@ -26,7 +27,7 @@ export declare class AnthropicClaudeExecutionTools implements LlmExecutionTools
|
|
|
26
27
|
constructor(options?: AnthropicClaudeExecutionToolsDirectOptions);
|
|
27
28
|
get title(): string_title & string_markdown_text;
|
|
28
29
|
get description(): string_markdown;
|
|
29
|
-
|
|
30
|
+
getClient(): Promise<Anthropic>;
|
|
30
31
|
/**
|
|
31
32
|
* Check the `options` passed to `constructor`
|
|
32
33
|
*/
|
|
@@ -16,7 +16,7 @@ export declare const ANTHROPIC_CLAUDE_MODELS: Array<AvailableModel & {
|
|
|
16
16
|
}>;
|
|
17
17
|
/**
|
|
18
18
|
* Note: [🤖] Add models of new variant
|
|
19
|
-
* TODO: [🧠] !!! Add embedding models OR Anthropic has only chat+completion models?
|
|
19
|
+
* TODO: [🧠][main] !!! Add embedding models OR Anthropic has only chat+completion models?
|
|
20
20
|
* TODO: [🧠] Some mechanism to propagate unsureness
|
|
21
21
|
* TODO: [🧠][👮♀️] Put here more info like description, isVision, trainingDateCutoff, languages, strengths ( Top-level performance, intelligence, fluency, and understanding), contextWindow,...
|
|
22
22
|
* TODO: [🎰] Some mechanism to auto-update available models
|
package/esm/typings/src/llm-providers/anthropic-claude/createAnthropicClaudeExecutionTools.d.ts
CHANGED
|
@@ -11,8 +11,8 @@ export declare const createAnthropicClaudeExecutionTools: ((options: AnthropicCl
|
|
|
11
11
|
className: string;
|
|
12
12
|
};
|
|
13
13
|
/**
|
|
14
|
-
* TODO: [🧠] !!!! Make anonymous this with all LLM providers
|
|
15
|
-
* TODO: [🧠][🧱] !!!! Maybe change all `new AnthropicClaudeExecutionTools` -> `createAnthropicClaudeExecutionTools` in manual
|
|
14
|
+
* TODO: [🧠][main] !!!! Make anonymous this with all LLM providers
|
|
15
|
+
* TODO: [🧠][🧱][main] !!!! Maybe change all `new AnthropicClaudeExecutionTools` -> `createAnthropicClaudeExecutionTools` in manual
|
|
16
16
|
* TODO: [🧠] Maybe auto-detect usage in browser and determine default value of `isProxied`
|
|
17
17
|
* TODO: [🦺] Is there some way how to put `packageName` and `className` on top and function definition on bottom?
|
|
18
18
|
* TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env ts-node
|
|
2
2
|
export {};
|
|
3
3
|
/**
|
|
4
|
-
* TODO: !!! Playground with WebGPT / Promptbook.studio anonymous server
|
|
5
|
-
* TODO: !!! Test here that `systemMessage`, `temperature` and `seed` are working correctly
|
|
4
|
+
* TODO:[main] !!! Playground with WebGPT / Promptbook.studio anonymous server
|
|
5
|
+
* TODO:[main] !!! Test here that `systemMessage`, `temperature` and `seed` are working correctly
|
|
6
6
|
*/
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { OpenAIClient } from '@azure/openai';
|
|
1
2
|
import type { AvailableModel } from '../../execution/AvailableModel';
|
|
2
3
|
import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
|
|
3
4
|
import type { ChatPromptResult } from '../../execution/PromptResult';
|
|
@@ -13,7 +14,7 @@ import type { AzureOpenAiExecutionToolsOptions } from './AzureOpenAiExecutionToo
|
|
|
13
14
|
* @public exported from `@promptbook/azure-openai`
|
|
14
15
|
*/
|
|
15
16
|
export declare class AzureOpenAiExecutionTools implements LlmExecutionTools {
|
|
16
|
-
|
|
17
|
+
protected readonly options: AzureOpenAiExecutionToolsOptions;
|
|
17
18
|
/**
|
|
18
19
|
* OpenAI Azure API client.
|
|
19
20
|
*/
|
|
@@ -26,7 +27,7 @@ export declare class AzureOpenAiExecutionTools implements LlmExecutionTools {
|
|
|
26
27
|
constructor(options: AzureOpenAiExecutionToolsOptions);
|
|
27
28
|
get title(): string_title & string_markdown_text;
|
|
28
29
|
get description(): string_markdown;
|
|
29
|
-
|
|
30
|
+
getClient(): Promise<OpenAIClient>;
|
|
30
31
|
/**
|
|
31
32
|
* Check the `options` passed to `constructor`
|
|
32
33
|
*/
|
|
@@ -13,7 +13,7 @@ import type { string_title } from '../../types/typeAliases';
|
|
|
13
13
|
* @public exported from `@promptbook/fake-llm`
|
|
14
14
|
*/
|
|
15
15
|
export declare class MockedEchoLlmExecutionTools implements LlmExecutionTools {
|
|
16
|
-
|
|
16
|
+
protected readonly options: CommonExecutionToolsOptions;
|
|
17
17
|
constructor(options?: CommonExecutionToolsOptions);
|
|
18
18
|
get title(): string_title & string_markdown_text;
|
|
19
19
|
get description(): string_markdown;
|
|
@@ -14,7 +14,7 @@ import type { string_title } from '../../types/typeAliases';
|
|
|
14
14
|
* @public exported from `@promptbook/fake-llm`
|
|
15
15
|
*/
|
|
16
16
|
export declare class MockedFackedLlmExecutionTools implements LlmExecutionTools {
|
|
17
|
-
|
|
17
|
+
protected readonly options: CommonExecutionToolsOptions;
|
|
18
18
|
constructor(options?: CommonExecutionToolsOptions);
|
|
19
19
|
get title(): string_title & string_markdown_text;
|
|
20
20
|
get description(): string_markdown;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
|
|
2
|
+
import type { ChatPromptResult } from '../../execution/PromptResult';
|
|
3
|
+
import type { Prompt } from '../../types/Prompt';
|
|
4
|
+
import type { string_markdown } from '../../types/typeAliases';
|
|
5
|
+
import type { string_markdown_text } from '../../types/typeAliases';
|
|
6
|
+
import type { string_title } from '../../types/typeAliases';
|
|
7
|
+
import type { OpenAiAssistantExecutionToolsOptions } from './OpenAiAssistantExecutionToolsOptions';
|
|
8
|
+
import { OpenAiExecutionTools } from './OpenAiExecutionTools';
|
|
9
|
+
/**
|
|
10
|
+
* Execution Tools for calling OpenAI API Assistants
|
|
11
|
+
*
|
|
12
|
+
* This is usefull for calling OpenAI API with a single assistant, for more wide usage use `OpenAiExecutionTools`.
|
|
13
|
+
*
|
|
14
|
+
* @public exported from `@promptbook/openai`
|
|
15
|
+
*/
|
|
16
|
+
export declare class OpenAiAssistantExecutionTools extends OpenAiExecutionTools implements LlmExecutionTools {
|
|
17
|
+
private readonly assistantId?;
|
|
18
|
+
/**
|
|
19
|
+
* Creates OpenAI Execution Tools.
|
|
20
|
+
*
|
|
21
|
+
* @param options which are relevant are directly passed to the OpenAI client
|
|
22
|
+
*/
|
|
23
|
+
constructor(options?: OpenAiAssistantExecutionToolsOptions);
|
|
24
|
+
get title(): string_title & string_markdown_text;
|
|
25
|
+
get description(): string_markdown;
|
|
26
|
+
/**
|
|
27
|
+
* Calls OpenAI API to use a chat model.
|
|
28
|
+
*/
|
|
29
|
+
callChatModel(prompt: Pick<Prompt, 'content' | 'parameters' | 'modelRequirements' | 'format'>): Promise<ChatPromptResult>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* TODO: !!!!!! DO not use colors - can be used in browser
|
|
33
|
+
* TODO: [🧠][🧙♂️] Maybe there can be some wizzard for thoose who want to use just OpenAI
|
|
34
|
+
* TODO: Maybe make custom OpenAiError
|
|
35
|
+
* TODO: [🧠][🈁] Maybe use `isDeterministic` from options
|
|
36
|
+
* TODO: [🧠][🌰] Allow to pass `title` for tracking purposes
|
|
37
|
+
*/
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ClientOptions } from 'openai';
|
|
2
|
+
import type { string_token } from '../../types/typeAliases';
|
|
3
|
+
import type { OpenAiExecutionToolsOptions } from './OpenAiExecutionToolsOptions';
|
|
4
|
+
/**
|
|
5
|
+
* Options for `OpenAiAssistantExecutionTools`
|
|
6
|
+
*
|
|
7
|
+
* @public exported from `@promptbook/openai`
|
|
8
|
+
*/
|
|
9
|
+
export type OpenAiAssistantExecutionToolsOptions = OpenAiExecutionToolsOptions & ClientOptions & {
|
|
10
|
+
/**
|
|
11
|
+
* Which assistant to use
|
|
12
|
+
*/
|
|
13
|
+
assistantId?: string_token;
|
|
14
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import OpenAI from 'openai';
|
|
1
2
|
import type { AvailableModel } from '../../execution/AvailableModel';
|
|
2
3
|
import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
|
|
3
4
|
import type { ChatPromptResult } from '../../execution/PromptResult';
|
|
@@ -14,7 +15,7 @@ import type { OpenAiExecutionToolsOptions } from './OpenAiExecutionToolsOptions'
|
|
|
14
15
|
* @public exported from `@promptbook/openai`
|
|
15
16
|
*/
|
|
16
17
|
export declare class OpenAiExecutionTools implements LlmExecutionTools {
|
|
17
|
-
|
|
18
|
+
protected readonly options: OpenAiExecutionToolsOptions;
|
|
18
19
|
/**
|
|
19
20
|
* OpenAI API client.
|
|
20
21
|
*/
|
|
@@ -27,7 +28,7 @@ export declare class OpenAiExecutionTools implements LlmExecutionTools {
|
|
|
27
28
|
constructor(options?: OpenAiExecutionToolsOptions);
|
|
28
29
|
get title(): string_title & string_markdown_text;
|
|
29
30
|
get description(): string_markdown;
|
|
30
|
-
|
|
31
|
+
getClient(): Promise<OpenAI>;
|
|
31
32
|
/**
|
|
32
33
|
* Check the `options` passed to `constructor`
|
|
33
34
|
*/
|
|
@@ -20,7 +20,7 @@ import type { RemoteLlmExecutionToolsOptions } from './interfaces/RemoteLlmExecu
|
|
|
20
20
|
* @public exported from `@promptbook/remote-client`
|
|
21
21
|
*/
|
|
22
22
|
export declare class RemoteLlmExecutionTools implements LlmExecutionTools {
|
|
23
|
-
|
|
23
|
+
protected readonly options: RemoteLlmExecutionToolsOptions;
|
|
24
24
|
constructor(options: RemoteLlmExecutionToolsOptions);
|
|
25
25
|
get title(): string_title & string_markdown_text;
|
|
26
26
|
get description(): string_markdown;
|
|
@@ -9,7 +9,7 @@ import type { string_persona_description } from '../types/typeAliases';
|
|
|
9
9
|
*/
|
|
10
10
|
export declare function preparePersona(personaDescription: string_persona_description, options: PrepareOptions): Promise<PersonaPreparedJson['modelRequirements']>;
|
|
11
11
|
/**
|
|
12
|
-
* TODO: [🔃] !!!!! If the persona was prepared with different version or different set of models, prepare it once again
|
|
12
|
+
* TODO: [🔃][main] !!!!! If the persona was prepared with different version or different set of models, prepare it once again
|
|
13
13
|
* TODO: [🏢] !! Check validity of `modelName` in pipeline
|
|
14
14
|
* TODO: [🏢] !! Check validity of `systemMessage` in pipeline
|
|
15
15
|
* TODO: [🏢] !! Check validity of `temperature` in pipeline
|
|
@@ -6,7 +6,7 @@ import type { PipelineJson } from '../types/PipelineJson/PipelineJson';
|
|
|
6
6
|
*/
|
|
7
7
|
export declare function isPipelinePrepared(pipeline: PipelineJson): boolean;
|
|
8
8
|
/**
|
|
9
|
-
* TODO: [🔃] !!!!! If the pipeline was prepared with different version or different set of models, prepare it once again
|
|
9
|
+
* TODO: [🔃][main] !!!!! If the pipeline was prepared with different version or different set of models, prepare it once again
|
|
10
10
|
* TODO: [🐠] Maybe base this on `makeValidator`
|
|
11
11
|
* TODO: [🧊] Pipeline can be partially prepared, this should return true ONLY if fully prepared
|
|
12
12
|
* TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
|
|
@@ -23,7 +23,7 @@ export {};
|
|
|
23
23
|
/**
|
|
24
24
|
* TODO: [🧠] Add context to each template (if missing)
|
|
25
25
|
* TODO: [🧠] What is better name `prepareTemplate` or `prepareTemplateAndParameters`
|
|
26
|
-
* TODO: [♨] !!! Prepare index the samples and maybe templates
|
|
26
|
+
* TODO: [♨][main] !!! Prepare index the samples and maybe templates
|
|
27
27
|
* TODO: Write tests for `preparePipeline`
|
|
28
28
|
* TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
|
|
29
29
|
* TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
|
|
@@ -9,7 +9,7 @@ import type { JavascriptExecutionToolsOptions } from './JavascriptExecutionTools
|
|
|
9
9
|
* @public exported from `@promptbook/execute-javascript`
|
|
10
10
|
*/
|
|
11
11
|
export declare class JavascriptEvalExecutionTools implements ScriptExecutionTools {
|
|
12
|
-
|
|
12
|
+
protected readonly options: JavascriptExecutionToolsOptions;
|
|
13
13
|
constructor(options?: JavascriptExecutionToolsOptions);
|
|
14
14
|
/**
|
|
15
15
|
* Executes a JavaScript
|
|
@@ -9,7 +9,7 @@ import type { ScriptExecutionToolsExecuteOptions } from '../../execution/ScriptE
|
|
|
9
9
|
* @private still in development
|
|
10
10
|
*/
|
|
11
11
|
export declare class PythonExecutionTools implements ScriptExecutionTools {
|
|
12
|
-
|
|
12
|
+
protected readonly options: CommonExecutionToolsOptions;
|
|
13
13
|
constructor(options?: CommonExecutionToolsOptions);
|
|
14
14
|
/**
|
|
15
15
|
* Executes a Python
|
|
@@ -9,7 +9,7 @@ import type { ScriptExecutionToolsExecuteOptions } from '../../execution/ScriptE
|
|
|
9
9
|
* @private still in development
|
|
10
10
|
*/
|
|
11
11
|
export declare class TypescriptExecutionTools implements ScriptExecutionTools {
|
|
12
|
-
|
|
12
|
+
protected readonly options: CommonExecutionToolsOptions;
|
|
13
13
|
constructor(options?: CommonExecutionToolsOptions);
|
|
14
14
|
/**
|
|
15
15
|
* Executes a TypeScript
|
|
@@ -6,7 +6,7 @@ import type { FilesStorageOptions } from './FilesStorageOptions';
|
|
|
6
6
|
* @public exported from `@promptbook/node`
|
|
7
7
|
*/
|
|
8
8
|
export declare class FilesStorage<TItem> implements PromptbookStorage<TItem> {
|
|
9
|
-
|
|
9
|
+
protected readonly options: FilesStorageOptions;
|
|
10
10
|
constructor(options: FilesStorageOptions);
|
|
11
11
|
/**
|
|
12
12
|
* @@@
|
|
@@ -42,7 +42,7 @@ export type PipelineJson = {
|
|
|
42
42
|
/**
|
|
43
43
|
* Version of the .ptbk.json file
|
|
44
44
|
*/
|
|
45
|
-
readonly promptbookVersion
|
|
45
|
+
readonly promptbookVersion?: string_semantic_version;
|
|
46
46
|
/**
|
|
47
47
|
* Description of the promptbook
|
|
48
48
|
* It can use multiple paragraphs of simple markdown formatting like **bold**, *italic*, [link](https://example.com), ... BUT not code blocks and structure
|
|
@@ -592,7 +592,7 @@ export type number_megabytes = number_positive;
|
|
|
592
592
|
export type number_gigabytes = number_positive;
|
|
593
593
|
export type number_terabytes = number_positive;
|
|
594
594
|
/**.
|
|
595
|
-
* TODO: !!! Change "For example" to @example
|
|
595
|
+
* TODO:[main] !!! Change "For example" to @example
|
|
596
596
|
* TODO: !! Change to branded types
|
|
597
597
|
* TODO: Delete type aliases that are not exported or used internally
|
|
598
598
|
*/
|
|
@@ -22,6 +22,6 @@ import type { string_name } from '../../types/typeAliases';
|
|
|
22
22
|
export declare function checkSerializableAsJson(name: string_name, value: unknown): void;
|
|
23
23
|
/**
|
|
24
24
|
* TODO: [🧠][🛣] More elegant way to tracking than passing `name`
|
|
25
|
-
* TODO: [🧠] !!! In-memory cache of same values to prevent multiple checks
|
|
25
|
+
* TODO: [🧠][main] !!! In-memory cache of same values to prevent multiple checks
|
|
26
26
|
* Note: [🐠] This is how `checkSerializableAsJson` + `isSerializableAsJson` together can just retun true/false or rich error message
|
|
27
27
|
*/
|
|
@@ -19,6 +19,6 @@
|
|
|
19
19
|
*/
|
|
20
20
|
export declare function isSerializableAsJson(value: unknown): boolean;
|
|
21
21
|
/**
|
|
22
|
-
* TODO: [🧠] !!! In-memory cache of same values to prevent multiple checks
|
|
22
|
+
* TODO: [🧠][main] !!! In-memory cache of same values to prevent multiple checks
|
|
23
23
|
* TODO: [🧠][💺] Can be done this on type-level?
|
|
24
24
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/types",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.72.0-0",
|
|
4
4
|
"description": "Supercharge your use of large language models",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -45,6 +45,6 @@
|
|
|
45
45
|
],
|
|
46
46
|
"typings": "./esm/typings/src/_packages/types.index.d.ts",
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"@promptbook/core": "0.
|
|
48
|
+
"@promptbook/core": "0.72.0-0"
|
|
49
49
|
}
|
|
50
50
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|