@promptbook/legacy-documents 0.71.0-17 → 0.72.0-10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/esm/index.es.js +229 -202
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/src/_packages/cli.index.d.ts +4 -0
  4. package/esm/typings/src/_packages/core.index.d.ts +6 -2
  5. package/esm/typings/src/_packages/openai.index.d.ts +8 -0
  6. package/esm/typings/src/_packages/types.index.d.ts +8 -2
  7. package/esm/typings/src/dialogs/callback/CallbackInterfaceTools.d.ts +1 -1
  8. package/esm/typings/src/dialogs/simple-prompt/SimplePromptInterfaceTools.d.ts +1 -1
  9. package/esm/typings/src/execution/translation/automatic-translate/automatic-translators/LindatAutomaticTranslator.d.ts +1 -1
  10. package/esm/typings/src/execution/utils/addUsage.d.ts +0 -56
  11. package/esm/typings/src/execution/utils/usage-constants.d.ts +127 -0
  12. package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +1 -1
  13. package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +2 -2
  14. package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +1 -1
  15. package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionToolsOptions.d.ts +2 -1
  16. package/esm/typings/src/llm-providers/langtail/LangtailExecutionTools.d.ts +1 -1
  17. package/esm/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +1 -1
  18. package/esm/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +1 -1
  19. package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +37 -0
  20. package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionToolsOptions.d.ts +14 -0
  21. package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +11 -2
  22. package/esm/typings/src/llm-providers/openai/OpenAiExecutionToolsOptions.d.ts +2 -2
  23. package/esm/typings/src/llm-providers/openai/createOpenAiAssistantExecutionTools.d.ts +15 -0
  24. package/esm/typings/src/llm-providers/openai/register-configuration.d.ts +9 -0
  25. package/esm/typings/src/llm-providers/openai/register-constructor.d.ts +9 -0
  26. package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +3 -3
  27. package/esm/typings/src/llm-providers/remote/interfaces/PromptbookServer_ListModels_Request.d.ts +15 -6
  28. package/esm/typings/src/llm-providers/remote/interfaces/PromptbookServer_ListModels_Response.d.ts +2 -2
  29. package/esm/typings/src/llm-providers/remote/interfaces/PromptbookServer_Prompt_Request.d.ts +6 -12
  30. package/esm/typings/src/llm-providers/remote/interfaces/PromptbookServer_Prompt_Response.d.ts +1 -1
  31. package/esm/typings/src/llm-providers/remote/interfaces/RemoteLlmExecutionToolsOptions.d.ts +9 -14
  32. package/esm/typings/src/llm-providers/remote/interfaces/RemoteServerOptions.d.ts +22 -8
  33. package/esm/typings/src/llm-providers/remote/startRemoteServer.d.ts +1 -1
  34. package/esm/typings/src/scripting/javascript/JavascriptEvalExecutionTools.d.ts +1 -1
  35. package/esm/typings/src/scripting/python/PythonExecutionTools.d.ts +1 -1
  36. package/esm/typings/src/scripting/typescript/TypescriptExecutionTools.d.ts +1 -1
  37. package/esm/typings/src/storage/file-cache-storage/FileCacheStorage.d.ts +1 -1
  38. package/esm/typings/src/types/Prompt.d.ts +1 -0
  39. package/esm/typings/src/types/typeAliases.d.ts +11 -8
  40. package/package.json +2 -2
  41. package/umd/index.umd.js +229 -202
  42. package/umd/index.umd.js.map +1 -1
@@ -5,7 +5,9 @@ import { _AnthropicClaudeRegistration } from '../llm-providers/anthropic-claude/
5
5
  import { _AzureOpenAiMetadataRegistration } from '../llm-providers/azure-openai/register-configuration';
6
6
  import { _AzureOpenAiRegistration } from '../llm-providers/azure-openai/register-constructor';
7
7
  import { _OpenAiMetadataRegistration } from '../llm-providers/openai/register-configuration';
8
+ import { _OpenAiAssistantMetadataRegistration } from '../llm-providers/openai/register-configuration';
8
9
  import { _OpenAiRegistration } from '../llm-providers/openai/register-constructor';
10
+ import { _OpenAiAssistantRegistration } from '../llm-providers/openai/register-constructor';
9
11
  import { _LegacyDocumentScraperRegistration } from '../scrapers/document-legacy/register-constructor';
10
12
  import { _LegacyDocumentScraperMetadataRegistration } from '../scrapers/document-legacy/register-metadata';
11
13
  import { _DocumentScraperRegistration } from '../scrapers/document/register-constructor';
@@ -23,7 +25,9 @@ export { _AnthropicClaudeRegistration };
23
25
  export { _AzureOpenAiMetadataRegistration };
24
26
  export { _AzureOpenAiRegistration };
25
27
  export { _OpenAiMetadataRegistration };
28
+ export { _OpenAiAssistantMetadataRegistration };
26
29
  export { _OpenAiRegistration };
30
+ export { _OpenAiAssistantRegistration };
27
31
  export { _LegacyDocumentScraperRegistration };
28
32
  export { _LegacyDocumentScraperMetadataRegistration };
29
33
  export { _DocumentScraperRegistration };
@@ -47,9 +47,10 @@ import { UnexpectedError } from '../errors/UnexpectedError';
47
47
  import { assertsExecutionSuccessful } from '../execution/assertsExecutionSuccessful';
48
48
  import { createPipelineExecutor } from '../execution/createPipelineExecutor/00-createPipelineExecutor';
49
49
  import { embeddingVectorToString } from '../execution/embeddingVectorToString';
50
- import { ZERO_USAGE } from '../execution/utils/addUsage';
51
50
  import { addUsage } from '../execution/utils/addUsage';
52
51
  import { isPassingExpectations } from '../execution/utils/checkExpectations';
52
+ import { ZERO_USAGE } from '../execution/utils/usage-constants';
53
+ import { UNCERTAIN_USAGE } from '../execution/utils/usage-constants';
53
54
  import { usageToHuman } from '../execution/utils/usageToHuman';
54
55
  import { usageToWorktime } from '../execution/utils/usageToWorktime';
55
56
  import { CsvFormatDefinition } from '../formats/csv/CsvFormatDefinition';
@@ -66,6 +67,7 @@ import { _AnthropicClaudeMetadataRegistration } from '../llm-providers/anthropic
66
67
  import { _AzureOpenAiMetadataRegistration } from '../llm-providers/azure-openai/register-configuration';
67
68
  import { joinLlmExecutionTools } from '../llm-providers/multiple/joinLlmExecutionTools';
68
69
  import { _OpenAiMetadataRegistration } from '../llm-providers/openai/register-configuration';
70
+ import { _OpenAiAssistantMetadataRegistration } from '../llm-providers/openai/register-configuration';
69
71
  import { preparePersona } from '../personas/preparePersona';
70
72
  import { isPipelinePrepared } from '../prepare/isPipelinePrepared';
71
73
  import { preparePipeline } from '../prepare/preparePipeline';
@@ -135,9 +137,10 @@ export { UnexpectedError };
135
137
  export { assertsExecutionSuccessful };
136
138
  export { createPipelineExecutor };
137
139
  export { embeddingVectorToString };
138
- export { ZERO_USAGE };
139
140
  export { addUsage };
140
141
  export { isPassingExpectations };
142
+ export { ZERO_USAGE };
143
+ export { UNCERTAIN_USAGE };
141
144
  export { usageToHuman };
142
145
  export { usageToWorktime };
143
146
  export { CsvFormatDefinition };
@@ -154,6 +157,7 @@ export { _AnthropicClaudeMetadataRegistration };
154
157
  export { _AzureOpenAiMetadataRegistration };
155
158
  export { joinLlmExecutionTools };
156
159
  export { _OpenAiMetadataRegistration };
160
+ export { _OpenAiAssistantMetadataRegistration };
157
161
  export { preparePersona };
158
162
  export { isPipelinePrepared };
159
163
  export { preparePipeline };
@@ -1,12 +1,20 @@
1
1
  import { PROMPTBOOK_VERSION } from '../version';
2
+ import { createOpenAiAssistantExecutionTools } from '../llm-providers/openai/createOpenAiAssistantExecutionTools';
2
3
  import { createOpenAiExecutionTools } from '../llm-providers/openai/createOpenAiExecutionTools';
3
4
  import { OPENAI_MODELS } from '../llm-providers/openai/openai-models';
5
+ import { OpenAiAssistantExecutionTools } from '../llm-providers/openai/OpenAiAssistantExecutionTools';
6
+ import type { OpenAiAssistantExecutionToolsOptions } from '../llm-providers/openai/OpenAiAssistantExecutionToolsOptions';
4
7
  import { OpenAiExecutionTools } from '../llm-providers/openai/OpenAiExecutionTools';
5
8
  import type { OpenAiExecutionToolsOptions } from '../llm-providers/openai/OpenAiExecutionToolsOptions';
6
9
  import { _OpenAiRegistration } from '../llm-providers/openai/register-constructor';
10
+ import { _OpenAiAssistantRegistration } from '../llm-providers/openai/register-constructor';
7
11
  export { PROMPTBOOK_VERSION };
12
+ export { createOpenAiAssistantExecutionTools };
8
13
  export { createOpenAiExecutionTools };
9
14
  export { OPENAI_MODELS };
15
+ export { OpenAiAssistantExecutionTools };
16
+ export type { OpenAiAssistantExecutionToolsOptions };
10
17
  export { OpenAiExecutionTools };
11
18
  export type { OpenAiExecutionToolsOptions };
12
19
  export { _OpenAiRegistration };
20
+ export { _OpenAiAssistantRegistration };
@@ -50,6 +50,7 @@ import type { AnthropicClaudeExecutionToolsProxiedOptions } from '../llm-provide
50
50
  import type { AzureOpenAiExecutionToolsOptions } from '../llm-providers/azure-openai/AzureOpenAiExecutionToolsOptions';
51
51
  import type { LangtailExecutionToolsOptions } from '../llm-providers/langtail/LangtailExecutionToolsOptions';
52
52
  import type { MultipleLlmExecutionTools } from '../llm-providers/multiple/MultipleLlmExecutionTools';
53
+ import type { OpenAiAssistantExecutionToolsOptions } from '../llm-providers/openai/OpenAiAssistantExecutionToolsOptions';
53
54
  import type { OpenAiExecutionToolsOptions } from '../llm-providers/openai/OpenAiExecutionToolsOptions';
54
55
  import type { PromptbookServer_Error } from '../llm-providers/remote/interfaces/PromptbookServer_Error';
55
56
  import type { PromptbookServer_ListModels_Request } from '../llm-providers/remote/interfaces/PromptbookServer_ListModels_Request';
@@ -65,6 +66,7 @@ import type { RemoteLlmExecutionToolsOptions } from '../llm-providers/remote/int
65
66
  import type { RemoteServerOptions } from '../llm-providers/remote/interfaces/RemoteServerOptions';
66
67
  import type { AnonymousRemoteServerOptions } from '../llm-providers/remote/interfaces/RemoteServerOptions';
67
68
  import type { CollectionRemoteServerOptions } from '../llm-providers/remote/interfaces/RemoteServerOptions';
69
+ import type { CollectionRemoteServerClientOptions } from '../llm-providers/remote/interfaces/RemoteServerOptions';
68
70
  import type { PrepareAndScrapeOptions } from '../prepare/PrepareAndScrapeOptions';
69
71
  import type { Converter } from '../scrapers/_common/Converter';
70
72
  import type { ScraperAndConverterMetadata } from '../scrapers/_common/register/ScraperAndConverterMetadata';
@@ -161,13 +163,13 @@ import type { string_url_image } from '../types/typeAliases';
161
163
  import type { string_executable_path } from '../types/typeAliases';
162
164
  import type { string_uri } from '../types/typeAliases';
163
165
  import type { string_uri_part } from '../types/typeAliases';
164
- import type { string_uriid } from '../types/typeAliases';
165
166
  import type { string_hostname } from '../types/typeAliases';
166
167
  import type { string_host } from '../types/typeAliases';
167
168
  import type { string_protocol } from '../types/typeAliases';
168
169
  import type { string_email } from '../types/typeAliases';
169
170
  import type { string_emails } from '../types/typeAliases';
170
171
  import type { string_uuid } from '../types/typeAliases';
172
+ import type { string_app_id } from '../types/typeAliases';
171
173
  import type { string_user_id } from '../types/typeAliases';
172
174
  import type { string_sha256 } from '../types/typeAliases';
173
175
  import type { string_semantic_version } from '../types/typeAliases';
@@ -190,6 +192,7 @@ import type { string_translate_name_not_normalized } from '../types/typeAliases'
190
192
  import type { string_translate_language } from '../types/typeAliases';
191
193
  import type { string_javascript_name } from '../types/typeAliases';
192
194
  import type { string_postprocessing_function_name } from '../types/typeAliases';
195
+ import type { id } from '../types/typeAliases';
193
196
  import type { string_token } from '../types/typeAliases';
194
197
  import type { string_license_token } from '../types/typeAliases';
195
198
  import type { string_password } from '../types/typeAliases';
@@ -290,6 +293,7 @@ export type { AnthropicClaudeExecutionToolsProxiedOptions };
290
293
  export type { AzureOpenAiExecutionToolsOptions };
291
294
  export type { LangtailExecutionToolsOptions };
292
295
  export type { MultipleLlmExecutionTools };
296
+ export type { OpenAiAssistantExecutionToolsOptions };
293
297
  export type { OpenAiExecutionToolsOptions };
294
298
  export type { PromptbookServer_Error };
295
299
  export type { PromptbookServer_ListModels_Request };
@@ -305,6 +309,7 @@ export type { RemoteLlmExecutionToolsOptions };
305
309
  export type { RemoteServerOptions };
306
310
  export type { AnonymousRemoteServerOptions };
307
311
  export type { CollectionRemoteServerOptions };
312
+ export type { CollectionRemoteServerClientOptions };
308
313
  export type { PrepareAndScrapeOptions };
309
314
  export type { Converter };
310
315
  export type { ScraperAndConverterMetadata };
@@ -401,13 +406,13 @@ export type { string_url_image };
401
406
  export type { string_executable_path };
402
407
  export type { string_uri };
403
408
  export type { string_uri_part };
404
- export type { string_uriid };
405
409
  export type { string_hostname };
406
410
  export type { string_host };
407
411
  export type { string_protocol };
408
412
  export type { string_email };
409
413
  export type { string_emails };
410
414
  export type { string_uuid };
415
+ export type { string_app_id };
411
416
  export type { string_user_id };
412
417
  export type { string_sha256 };
413
418
  export type { string_semantic_version };
@@ -430,6 +435,7 @@ export type { string_translate_name_not_normalized };
430
435
  export type { string_translate_language };
431
436
  export type { string_javascript_name };
432
437
  export type { string_postprocessing_function_name };
438
+ export type { id };
433
439
  export type { string_token };
434
440
  export type { string_license_token };
435
441
  export type { string_password };
@@ -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
- private readonly options;
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/User
10
10
  * @public exported from `@promptbook/browser`
11
11
  */
12
12
  export declare class SimplePromptInterfaceTools implements UserInterfaceTools {
13
- private readonly options;
13
+ protected readonly options: CommonToolsOptions;
14
14
  constructor(options?: CommonToolsOptions);
15
15
  /**
16
16
  * Trigger window.DIALOG TEMPLATE
@@ -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
- private readonly options;
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
+ }>;
@@ -14,7 +14,7 @@ import type { AnthropicClaudeExecutionToolsDirectOptions } from './AnthropicClau
14
14
  * @deprecated use `createAnthropicClaudeExecutionTools` instead
15
15
  */
16
16
  export declare class AnthropicClaudeExecutionTools implements LlmExecutionTools {
17
- private readonly options;
17
+ protected readonly options: AnthropicClaudeExecutionToolsDirectOptions;
18
18
  /**
19
19
  * Anthropic Claude API client.
20
20
  */
@@ -25,7 +25,7 @@ export type AnthropicClaudeExecutionToolsDirectOptions = CommonToolsOptions & Cl
25
25
  */
26
26
  export type AnthropicClaudeExecutionToolsProxiedOptions = CommonToolsOptions & ClientOptions & {
27
27
  isProxied: true;
28
- } & Pick<RemoteLlmExecutionToolsOptions, 'remoteUrl' | 'path'>;
28
+ } & Pick<RemoteLlmExecutionToolsOptions<undefined>, 'remoteUrl' | 'path'>;
29
29
  /**
30
- * TODO: [🧠][🤺] Detecting `user`
30
+ * TODO: [🧠][🤺] Pass `userId`
31
31
  */
@@ -14,7 +14,7 @@ import type { AzureOpenAiExecutionToolsOptions } from './AzureOpenAiExecutionToo
14
14
  * @public exported from `@promptbook/azure-openai`
15
15
  */
16
16
  export declare class AzureOpenAiExecutionTools implements LlmExecutionTools {
17
- private readonly options;
17
+ protected readonly options: AzureOpenAiExecutionToolsOptions;
18
18
  /**
19
19
  * OpenAI Azure API client.
20
20
  */
@@ -1,6 +1,7 @@
1
1
  import type { CommonToolsOptions } from '../../execution/CommonToolsOptions';
2
2
  import type { string_name } from '../../types/typeAliases';
3
3
  import type { string_token } from '../../types/typeAliases';
4
+ import type { string_user_id } from '../../types/typeAliases';
4
5
  /**
5
6
  * Options for `AzureOpenAiExecutionTools`
6
7
  *
@@ -32,5 +33,5 @@ export type AzureOpenAiExecutionToolsOptions = CommonToolsOptions & {
32
33
  *
33
34
  * @see https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids (document from OpenAI not Azure, but same concept)
34
35
  */
35
- readonly user?: string_token;
36
+ readonly userId: string_user_id | null;
36
37
  };
@@ -14,4 +14,4 @@ export declare class LangtailExecutionTools extends OpenAiExecutionTools impleme
14
14
  }
15
15
  /**
16
16
  * TODO: [🧠][🈁] Maybe use `isDeterministic` from options
17
- */
17
+ */
@@ -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
- private readonly options;
16
+ protected readonly options: CommonToolsOptions;
17
17
  constructor(options?: CommonToolsOptions);
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
- private readonly options;
17
+ protected readonly options: CommonToolsOptions;
18
18
  constructor(options?: CommonToolsOptions);
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
+ };
@@ -8,6 +8,8 @@ import type { Prompt } from '../../types/Prompt';
8
8
  import type { string_markdown } from '../../types/typeAliases';
9
9
  import type { string_markdown_text } from '../../types/typeAliases';
10
10
  import type { string_title } from '../../types/typeAliases';
11
+ import type { string_token } from '../../types/typeAliases';
12
+ import { OpenAiAssistantExecutionTools } from './OpenAiAssistantExecutionTools';
11
13
  import type { OpenAiExecutionToolsOptions } from './OpenAiExecutionToolsOptions';
12
14
  /**
13
15
  * Execution Tools for calling OpenAI API
@@ -15,7 +17,7 @@ import type { OpenAiExecutionToolsOptions } from './OpenAiExecutionToolsOptions'
15
17
  * @public exported from `@promptbook/openai`
16
18
  */
17
19
  export declare class OpenAiExecutionTools implements LlmExecutionTools {
18
- private readonly options;
20
+ protected readonly options: OpenAiExecutionToolsOptions;
19
21
  /**
20
22
  * OpenAI API client.
21
23
  */
@@ -25,10 +27,17 @@ export declare class OpenAiExecutionTools implements LlmExecutionTools {
25
27
  *
26
28
  * @param options which are relevant are directly passed to the OpenAI client
27
29
  */
28
- constructor(options?: OpenAiExecutionToolsOptions);
30
+ constructor(options: OpenAiExecutionToolsOptions);
29
31
  get title(): string_title & string_markdown_text;
30
32
  get description(): string_markdown;
31
33
  getClient(): Promise<OpenAI>;
34
+ /**
35
+ * Create (sub)tools for calling OpenAI API Assistants
36
+ *
37
+ * @param assistantId Which assistant to use
38
+ * @returns Tools for calling OpenAI API Assistants with same token
39
+ */
40
+ createAssistantSubtools(assistantId: string_token): OpenAiAssistantExecutionTools;
32
41
  /**
33
42
  * Check the `options` passed to `constructor`
34
43
  */
@@ -1,6 +1,6 @@
1
1
  import type { ClientOptions } from 'openai';
2
2
  import type { CommonToolsOptions } from '../../execution/CommonToolsOptions';
3
- import type { string_token } from '../../types/typeAliases';
3
+ import type { string_user_id } from '../../types/typeAliases';
4
4
  /**
5
5
  * Options for `OpenAiExecutionTools`
6
6
  *
@@ -16,5 +16,5 @@ export type OpenAiExecutionToolsOptions = CommonToolsOptions & ClientOptions & {
16
16
  *
17
17
  * @see https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids
18
18
  */
19
- user?: string_token;
19
+ userId: string_user_id | null;
20
20
  };
@@ -0,0 +1,15 @@
1
+ import { OpenAiAssistantExecutionTools } from './OpenAiAssistantExecutionTools';
2
+ import type { OpenAiAssistantExecutionToolsOptions } from './OpenAiAssistantExecutionToolsOptions';
3
+ /**
4
+ * Execution Tools for calling OpenAI API
5
+ *
6
+ * @public exported from `@promptbook/openai`
7
+ */
8
+ export declare const createOpenAiAssistantExecutionTools: ((options: OpenAiAssistantExecutionToolsOptions) => OpenAiAssistantExecutionTools) & {
9
+ packageName: string;
10
+ className: string;
11
+ };
12
+ /**
13
+ * TODO: [🦺] Is there some way how to put `packageName` and `className` on top and function definition on bottom?
14
+ * TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
15
+ */
@@ -8,3 +8,12 @@ import type { Registration } from '../../utils/$Register';
8
8
  * @public exported from `@promptbook/cli`
9
9
  */
10
10
  export declare const _OpenAiMetadataRegistration: Registration;
11
+ /**
12
+ * @@@ registration1 of default configuration for Open AI
13
+ *
14
+ * Note: [🏐] Configurations registrations are done in @@@ BUT constructor @@@
15
+ *
16
+ * @public exported from `@promptbook/core`
17
+ * @public exported from `@promptbook/cli`
18
+ */
19
+ export declare const _OpenAiAssistantMetadataRegistration: Registration;
@@ -8,6 +8,15 @@ import type { Registration } from '../../utils/$Register';
8
8
  * @public exported from `@promptbook/cli`
9
9
  */
10
10
  export declare const _OpenAiRegistration: Registration;
11
+ /**
12
+ * @@@ registration2
13
+ *
14
+ * Note: [🏐] Configurations registrations are done in @@@ BUT constructor @@@
15
+ *
16
+ * @public exported from `@promptbook/openai`
17
+ * @public exported from `@promptbook/cli`
18
+ */
19
+ export declare const _OpenAiAssistantRegistration: Registration;
11
20
  /**
12
21
  * TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
13
22
  */
@@ -19,9 +19,9 @@ import type { RemoteLlmExecutionToolsOptions } from './interfaces/RemoteLlmExecu
19
19
  * @see https://github.com/webgptorg/promptbook#remote-server
20
20
  * @public exported from `@promptbook/remote-client`
21
21
  */
22
- export declare class RemoteLlmExecutionTools implements LlmExecutionTools {
23
- private readonly options;
24
- constructor(options: RemoteLlmExecutionToolsOptions);
22
+ export declare class RemoteLlmExecutionTools<TCustomOptions = undefined> implements LlmExecutionTools {
23
+ protected readonly options: RemoteLlmExecutionToolsOptions<TCustomOptions>;
24
+ constructor(options: RemoteLlmExecutionToolsOptions<TCustomOptions>);
25
25
  get title(): string_title & string_markdown_text;
26
26
  get description(): string_markdown;
27
27
  /**