@promptbook/openai 0.101.0-15 → 0.101.0-16

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 (25) hide show
  1. package/esm/index.es.js +17 -17
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/src/_packages/components.index.d.ts +4 -0
  4. package/esm/typings/src/_packages/core.index.d.ts +2 -0
  5. package/esm/typings/src/_packages/types.index.d.ts +2 -0
  6. package/esm/typings/src/book-2.0/agent-source/AgentModelRequirements.d.ts +3 -0
  7. package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirements.d.ts +0 -20
  8. package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.d.ts +1 -26
  9. package/esm/typings/src/book-2.0/commitments/MODEL/MODEL.d.ts +23 -2
  10. package/esm/typings/src/book-2.0/commitments/NOTE/NOTE.d.ts +14 -2
  11. package/esm/typings/src/book-2.0/commitments/index.d.ts +1 -1
  12. package/esm/typings/src/book-components/BookEditor/BookEditor.d.ts +5 -0
  13. package/esm/typings/src/book-components/BookEditor/BookEditorInner.d.ts +1 -0
  14. package/esm/typings/src/book-components/Chat/utils/parseMessageButtons.d.ts +22 -0
  15. package/esm/typings/src/formats/csv/CsvFormatError.d.ts +1 -1
  16. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsConfigurationFromEnv.d.ts +1 -1
  17. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForTestingAndScriptsAndPlayground.d.ts +1 -1
  18. package/esm/typings/src/remote-server/openapi-types.d.ts +31 -31
  19. package/esm/typings/src/types/ModelRequirements.d.ts +2 -4
  20. package/esm/typings/src/utils/color/utils/colorSaturation.d.ts +1 -1
  21. package/esm/typings/src/utils/editable/edit-pipeline-string/addPipelineCommand.d.ts +1 -1
  22. package/esm/typings/src/version.d.ts +1 -1
  23. package/package.json +2 -2
  24. package/umd/index.umd.js +17 -17
  25. package/umd/index.umd.js.map +1 -1
@@ -6,31 +6,6 @@ import type { string_book } from './string_book';
6
6
  * This function uses a reduce-like pattern where each commitment applies its changes
7
7
  * to build the final requirements starting from a basic empty model
8
8
  *
9
- * @private - TODO: [🧠] Maybe should be public?
9
+ * @public exported from `@promptbook/core`
10
10
  */
11
11
  export declare function createAgentModelRequirementsWithCommitments(agentSource: string_book, modelName?: string_model_name): Promise<AgentModelRequirements>;
12
- /**
13
- * Cached version of createAgentModelRequirementsWithCommitments
14
- * This maintains the same caching behavior as the original function
15
- *
16
- * @private
17
- */
18
- export declare function createAgentModelRequirementsWithCommitmentsCached(agentSource: string_book, modelName?: string_model_name): Promise<AgentModelRequirements>;
19
- /**
20
- * Clears the cache for createAgentModelRequirementsWithCommitments
21
- *
22
- * @private
23
- */
24
- export declare function clearAgentModelRequirementsWithCommitmentsCache(): void;
25
- /**
26
- * Removes cache entries for a specific agent source
27
- *
28
- * @private
29
- */
30
- export declare function invalidateAgentModelRequirementsWithCommitmentsCache(agentSource: string_book): void;
31
- /**
32
- * Gets the current cache size
33
- *
34
- * @private
35
- */
36
- export declare function getAgentModelRequirementsWithCommitmentsCacheSize(): number;
@@ -4,16 +4,25 @@ import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
4
4
  * MODEL commitment definition
5
5
  *
6
6
  * The MODEL commitment specifies which AI model to use and can also set
7
- * model-specific parameters like temperature, topP, and topK.
7
+ * model-specific parameters like temperature, topP, topK, and maxTokens.
8
8
  *
9
- * Example usage in agent source:
9
+ * Supports multiple syntax variations:
10
10
  *
11
+ * Single-line format:
11
12
  * ```book
12
13
  * MODEL gpt-4
13
14
  * MODEL claude-3-opus temperature=0.3
14
15
  * MODEL gpt-3.5-turbo temperature=0.8 topP=0.9
15
16
  * ```
16
17
  *
18
+ * Multi-line named parameter format:
19
+ * ```book
20
+ * MODEL NAME gpt-4
21
+ * MODEL TEMPERATURE 0.7
22
+ * MODEL TOP_P 0.9
23
+ * MODEL MAX_TOKENS 2048
24
+ * ```
25
+ *
17
26
  * @private [🪔] Maybe export the commitments through some package
18
27
  */
19
28
  export declare class ModelCommitmentDefinition extends BaseCommitmentDefinition<'MODEL' | 'MODELS'> {
@@ -27,6 +36,18 @@ export declare class ModelCommitmentDefinition extends BaseCommitmentDefinition<
27
36
  */
28
37
  get documentation(): string;
29
38
  applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
39
+ /**
40
+ * Check if the first part is a known named parameter
41
+ */
42
+ private isNamedParameter;
43
+ /**
44
+ * Parse the new named parameter format: "MODEL TEMPERATURE 0.7"
45
+ */
46
+ private parseNamedParameter;
47
+ /**
48
+ * Parse the legacy format: "MODEL gpt-4 temperature=0.3 topP=0.9"
49
+ */
50
+ private parseLegacyFormat;
30
51
  }
31
52
  /**
32
53
  * Singleton instance of the MODEL commitment definition
@@ -26,8 +26,8 @@ import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
26
26
  *
27
27
  * @private [🪔] Maybe export the commitments through some package
28
28
  */
29
- export declare class NoteCommitmentDefinition extends BaseCommitmentDefinition<'NOTE' | 'NOTES'> {
30
- constructor(type?: 'NOTE' | 'NOTES');
29
+ export declare class NoteCommitmentDefinition extends BaseCommitmentDefinition<'NOTE' | 'NOTES' | 'COMMENT' | 'NONCE'> {
30
+ constructor(type?: 'NOTE' | 'NOTES' | 'COMMENT' | 'NONCE');
31
31
  /**
32
32
  * Short one-line description of NOTE.
33
33
  */
@@ -50,6 +50,18 @@ export declare const NoteCommitment: NoteCommitmentDefinition;
50
50
  * @private [🪔] Maybe export the commitments through some package
51
51
  */
52
52
  export declare const NotesCommitment: NoteCommitmentDefinition;
53
+ /**
54
+ * Singleton instance of the COMMENT commitment definition
55
+ *
56
+ * @private [🪔] Maybe export the commitments through some package
57
+ */
58
+ export declare const CommentCommitment: NoteCommitmentDefinition;
59
+ /**
60
+ * Singleton instance of the NONCE commitment definition
61
+ *
62
+ * @private [🪔] Maybe export the commitments through some package
63
+ */
64
+ export declare const NonceCommitment: NoteCommitmentDefinition;
53
65
  /**
54
66
  * [💞] Ignore a discrepancy between file name and entity name
55
67
  */
@@ -23,7 +23,7 @@ import { NotYetImplementedCommitmentDefinition } from './_base/NotYetImplemented
23
23
  *
24
24
  * @private Use functions to access commitments instead of this array directly
25
25
  */
26
- export declare const COMMITMENT_REGISTRY: readonly [PersonaCommitmentDefinition, PersonaCommitmentDefinition, KnowledgeCommitmentDefinition, MemoryCommitmentDefinition, MemoryCommitmentDefinition, StyleCommitmentDefinition, StyleCommitmentDefinition, RuleCommitmentDefinition, RuleCommitmentDefinition, SampleCommitmentDefinition, SampleCommitmentDefinition, FormatCommitmentDefinition, FormatCommitmentDefinition, ModelCommitmentDefinition, ModelCommitmentDefinition, ActionCommitmentDefinition, ActionCommitmentDefinition, MetaCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, GoalCommitmentDefinition, GoalCommitmentDefinition, MessageCommitmentDefinition, MessageCommitmentDefinition, ScenarioCommitmentDefinition, ScenarioCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, NotYetImplementedCommitmentDefinition<"EXPECT">, NotYetImplementedCommitmentDefinition<"BEHAVIOUR">, NotYetImplementedCommitmentDefinition<"BEHAVIOURS">, NotYetImplementedCommitmentDefinition<"AVOID">, NotYetImplementedCommitmentDefinition<"AVOIDANCE">, NotYetImplementedCommitmentDefinition<"CONTEXT">];
26
+ export declare const COMMITMENT_REGISTRY: readonly [PersonaCommitmentDefinition, PersonaCommitmentDefinition, KnowledgeCommitmentDefinition, MemoryCommitmentDefinition, MemoryCommitmentDefinition, StyleCommitmentDefinition, StyleCommitmentDefinition, RuleCommitmentDefinition, RuleCommitmentDefinition, SampleCommitmentDefinition, SampleCommitmentDefinition, FormatCommitmentDefinition, FormatCommitmentDefinition, ModelCommitmentDefinition, ModelCommitmentDefinition, ActionCommitmentDefinition, ActionCommitmentDefinition, MetaCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, GoalCommitmentDefinition, GoalCommitmentDefinition, MessageCommitmentDefinition, MessageCommitmentDefinition, ScenarioCommitmentDefinition, ScenarioCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, NotYetImplementedCommitmentDefinition<"EXPECT">, NotYetImplementedCommitmentDefinition<"BEHAVIOUR">, NotYetImplementedCommitmentDefinition<"BEHAVIOURS">, NotYetImplementedCommitmentDefinition<"AVOID">, NotYetImplementedCommitmentDefinition<"AVOIDANCE">, NotYetImplementedCommitmentDefinition<"CONTEXT">];
27
27
  /**
28
28
  * Gets a commitment definition by its type
29
29
  * @param type The commitment type to look up
@@ -41,6 +41,11 @@ export type BookEditorProps = {
41
41
  * If true, disables border radius making the editor have sharp corners
42
42
  */
43
43
  readonly isBorderRadiusDisabled?: boolean;
44
+ /**
45
+ * If true, shows the footer with book title and version information.
46
+ * By default, the footer is hidden.
47
+ */
48
+ readonly isFooterShown?: boolean;
44
49
  };
45
50
  /**
46
51
  * Renders a book editor
@@ -11,6 +11,7 @@ export type BookEditorInnerProps = {
11
11
  onFileUpload?(file: File): Promisable<string>;
12
12
  isVerbose?: boolean;
13
13
  isBorderRadiusDisabled?: boolean;
14
+ isFooterShown?: boolean;
14
15
  };
15
16
  /**
16
17
  * @private util of `<BookEditor />`
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Represents a parsed message button from markdown
3
+ *
4
+ * @public exported from `@promptbook/components`
5
+ */
6
+ export type MessageButton = {
7
+ text: string;
8
+ message: string;
9
+ };
10
+ /**
11
+ * Parses markdown buttons in the format [Button Text](?message=Message%20to%20send)
12
+ * Returns both the content without buttons and the extracted buttons
13
+ *
14
+ * @param content The markdown content that may contain buttons
15
+ * @returns Object with contentWithoutButtons and buttons array
16
+ *
17
+ * @public exported from `@promptbook/components`
18
+ */
19
+ export declare function parseMessageButtons(content: string): {
20
+ contentWithoutButtons: string;
21
+ buttons: MessageButton[];
22
+ };
@@ -1,4 +1,4 @@
1
- import { AbstractFormatError } from "../../errors/AbstractFormatError";
1
+ import { AbstractFormatError } from '../../errors/AbstractFormatError';
2
2
  /**
3
3
  * This error indicates problem with parsing of CSV
4
4
  *
@@ -16,4 +16,4 @@ import type { LlmToolsConfiguration } from './LlmToolsConfiguration';
16
16
  export declare function $provideLlmToolsConfigurationFromEnv(): Promise<LlmToolsConfiguration>;
17
17
  /**
18
18
  * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
19
- */
19
+ */
@@ -24,4 +24,4 @@ export {};
24
24
  * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
25
25
  * TODO: This should be maybe not under `_common` but under `utils-internal` / `utils/internal`
26
26
  * TODO: [®] DRY Register logi
27
- */
27
+ */
@@ -3,7 +3,7 @@
3
3
  * Do not make direct changes to the file.
4
4
  */
5
5
  export type paths = {
6
- readonly "/": {
6
+ readonly '/': {
7
7
  readonly parameters: {
8
8
  readonly query?: never;
9
9
  readonly header?: never;
@@ -29,7 +29,7 @@ export type paths = {
29
29
  readonly [name: string]: unknown;
30
30
  };
31
31
  content: {
32
- readonly "text/markdown": string;
32
+ readonly 'text/markdown': string;
33
33
  };
34
34
  };
35
35
  };
@@ -42,7 +42,7 @@ export type paths = {
42
42
  readonly patch?: never;
43
43
  readonly trace?: never;
44
44
  };
45
- readonly "/login": {
45
+ readonly '/login': {
46
46
  readonly parameters: {
47
47
  readonly query?: never;
48
48
  readonly header?: never;
@@ -64,7 +64,7 @@ export type paths = {
64
64
  };
65
65
  readonly requestBody: {
66
66
  readonly content: {
67
- readonly "application/json": {
67
+ readonly 'application/json': {
68
68
  readonly username?: string;
69
69
  readonly password?: string;
70
70
  readonly appId?: string;
@@ -78,7 +78,7 @@ export type paths = {
78
78
  readonly [name: string]: unknown;
79
79
  };
80
80
  content: {
81
- readonly "application/json": {
81
+ readonly 'application/json': {
82
82
  readonly isSuccess?: boolean;
83
83
  readonly message?: string;
84
84
  readonly error?: Record<string, never>;
@@ -92,7 +92,7 @@ export type paths = {
92
92
  readonly [name: string]: unknown;
93
93
  };
94
94
  content: {
95
- readonly "application/json": {
95
+ readonly 'application/json': {
96
96
  readonly error?: Record<string, never>;
97
97
  };
98
98
  };
@@ -103,7 +103,7 @@ export type paths = {
103
103
  readonly [name: string]: unknown;
104
104
  };
105
105
  content: {
106
- readonly "application/json": {
106
+ readonly 'application/json': {
107
107
  /** @enum {boolean} */
108
108
  readonly isSuccess?: false;
109
109
  readonly message?: string;
@@ -119,7 +119,7 @@ export type paths = {
119
119
  readonly patch?: never;
120
120
  readonly trace?: never;
121
121
  };
122
- readonly "/books": {
122
+ readonly '/books': {
123
123
  readonly parameters: {
124
124
  readonly query?: never;
125
125
  readonly header?: never;
@@ -145,7 +145,7 @@ export type paths = {
145
145
  readonly [name: string]: unknown;
146
146
  };
147
147
  content: {
148
- readonly "application/json": readonly string[];
148
+ readonly 'application/json': readonly string[];
149
149
  };
150
150
  };
151
151
  /** @description No collection available */
@@ -154,7 +154,7 @@ export type paths = {
154
154
  readonly [name: string]: unknown;
155
155
  };
156
156
  content: {
157
- readonly "text/plain": string;
157
+ readonly 'text/plain': string;
158
158
  };
159
159
  };
160
160
  };
@@ -167,7 +167,7 @@ export type paths = {
167
167
  readonly patch?: never;
168
168
  readonly trace?: never;
169
169
  };
170
- readonly "/books/{bookId}": {
170
+ readonly '/books/{bookId}': {
171
171
  readonly parameters: {
172
172
  readonly query?: never;
173
173
  readonly header?: never;
@@ -196,7 +196,7 @@ export type paths = {
196
196
  readonly [name: string]: unknown;
197
197
  };
198
198
  content: {
199
- readonly "text/markdown": string;
199
+ readonly 'text/markdown': string;
200
200
  };
201
201
  };
202
202
  /** @description Book not found. */
@@ -205,7 +205,7 @@ export type paths = {
205
205
  readonly [name: string]: unknown;
206
206
  };
207
207
  content: {
208
- readonly "application/json": {
208
+ readonly 'application/json': {
209
209
  readonly error?: Record<string, never>;
210
210
  };
211
211
  };
@@ -216,7 +216,7 @@ export type paths = {
216
216
  readonly [name: string]: unknown;
217
217
  };
218
218
  content: {
219
- readonly "text/plain": string;
219
+ readonly 'text/plain': string;
220
220
  };
221
221
  };
222
222
  };
@@ -229,7 +229,7 @@ export type paths = {
229
229
  readonly patch?: never;
230
230
  readonly trace?: never;
231
231
  };
232
- readonly "/executions": {
232
+ readonly '/executions': {
233
233
  readonly parameters: {
234
234
  readonly query?: never;
235
235
  readonly header?: never;
@@ -255,7 +255,7 @@ export type paths = {
255
255
  readonly [name: string]: unknown;
256
256
  };
257
257
  content: {
258
- readonly "application/json": readonly {
258
+ readonly 'application/json': readonly {
259
259
  readonly nonce?: string;
260
260
  readonly taskId?: string;
261
261
  readonly taskType?: string;
@@ -277,7 +277,7 @@ export type paths = {
277
277
  readonly patch?: never;
278
278
  readonly trace?: never;
279
279
  };
280
- readonly "/executions/last": {
280
+ readonly '/executions/last': {
281
281
  readonly parameters: {
282
282
  readonly query?: never;
283
283
  readonly header?: never;
@@ -303,7 +303,7 @@ export type paths = {
303
303
  readonly [name: string]: unknown;
304
304
  };
305
305
  content: {
306
- readonly "application/json": {
306
+ readonly 'application/json': {
307
307
  readonly nonce?: string;
308
308
  readonly taskId?: string;
309
309
  readonly taskType?: string;
@@ -324,7 +324,7 @@ export type paths = {
324
324
  readonly [name: string]: unknown;
325
325
  };
326
326
  content: {
327
- readonly "text/plain": string;
327
+ readonly 'text/plain': string;
328
328
  };
329
329
  };
330
330
  };
@@ -337,7 +337,7 @@ export type paths = {
337
337
  readonly patch?: never;
338
338
  readonly trace?: never;
339
339
  };
340
- readonly "/executions/{taskId}": {
340
+ readonly '/executions/{taskId}': {
341
341
  readonly parameters: {
342
342
  readonly query?: never;
343
343
  readonly header?: never;
@@ -366,7 +366,7 @@ export type paths = {
366
366
  readonly [name: string]: unknown;
367
367
  };
368
368
  content: {
369
- readonly "application/json": {
369
+ readonly 'application/json': {
370
370
  readonly nonce?: string;
371
371
  readonly taskId?: string;
372
372
  readonly taskType?: string;
@@ -387,7 +387,7 @@ export type paths = {
387
387
  readonly [name: string]: unknown;
388
388
  };
389
389
  content: {
390
- readonly "text/plain": string;
390
+ readonly 'text/plain': string;
391
391
  };
392
392
  };
393
393
  };
@@ -400,7 +400,7 @@ export type paths = {
400
400
  readonly patch?: never;
401
401
  readonly trace?: never;
402
402
  };
403
- readonly "/executions/new": {
403
+ readonly '/executions/new': {
404
404
  readonly parameters: {
405
405
  readonly query?: never;
406
406
  readonly header?: never;
@@ -422,7 +422,7 @@ export type paths = {
422
422
  };
423
423
  readonly requestBody: {
424
424
  readonly content: {
425
- readonly "application/json": {
425
+ readonly 'application/json': {
426
426
  /** @description URL of the pipeline to execute */
427
427
  readonly pipelineUrl?: string;
428
428
  /** @description Alternative field for pipelineUrl */
@@ -441,7 +441,7 @@ export type paths = {
441
441
  readonly [name: string]: unknown;
442
442
  };
443
443
  content: {
444
- readonly "application/json": Record<string, never>;
444
+ readonly 'application/json': Record<string, never>;
445
445
  };
446
446
  };
447
447
  /** @description Invalid input. */
@@ -450,7 +450,7 @@ export type paths = {
450
450
  readonly [name: string]: unknown;
451
451
  };
452
452
  content: {
453
- readonly "application/json": {
453
+ readonly 'application/json': {
454
454
  readonly error?: Record<string, never>;
455
455
  };
456
456
  };
@@ -461,7 +461,7 @@ export type paths = {
461
461
  readonly [name: string]: unknown;
462
462
  };
463
463
  content: {
464
- readonly "text/plain": string;
464
+ readonly 'text/plain': string;
465
465
  };
466
466
  };
467
467
  };
@@ -472,7 +472,7 @@ export type paths = {
472
472
  readonly patch?: never;
473
473
  readonly trace?: never;
474
474
  };
475
- readonly "/api-docs": {
475
+ readonly '/api-docs': {
476
476
  readonly parameters: {
477
477
  readonly query?: never;
478
478
  readonly header?: never;
@@ -509,7 +509,7 @@ export type paths = {
509
509
  readonly patch?: never;
510
510
  readonly trace?: never;
511
511
  };
512
- readonly "/swagger": {
512
+ readonly '/swagger': {
513
513
  readonly parameters: {
514
514
  readonly query?: never;
515
515
  readonly header?: never;
@@ -546,7 +546,7 @@ export type paths = {
546
546
  readonly patch?: never;
547
547
  readonly trace?: never;
548
548
  };
549
- readonly "/openapi": {
549
+ readonly '/openapi': {
550
550
  readonly parameters: {
551
551
  readonly query?: never;
552
552
  readonly header?: never;
@@ -572,7 +572,7 @@ export type paths = {
572
572
  readonly [name: string]: unknown;
573
573
  };
574
574
  content: {
575
- readonly "application/json": Record<string, never>;
575
+ readonly 'application/json': Record<string, never>;
576
576
  };
577
577
  };
578
578
  };
@@ -1,8 +1,5 @@
1
1
  import type { ModelVariant } from './ModelVariant';
2
- import type { number_model_temperature } from './typeAliases';
3
- import type { number_seed } from './typeAliases';
4
- import type { string_model_name } from './typeAliases';
5
- import type { string_system_message } from './typeAliases';
2
+ import type { number_model_temperature, number_seed, string_model_name, string_system_message } from './typeAliases';
6
3
  /**
7
4
  * Abstract way to specify the LLM.
8
5
  * It does not specify the LLM with concrete version itself, only the requirements for the LLM.
@@ -99,4 +96,5 @@ export type CommonModelRequirements = {
99
96
  * TODO: Add here more requirement options like max context size, max tokens, etc.
100
97
  * TODO: [💕][🧠] Just selecting gpt3 or gpt4 level of model
101
98
  * TODO: [🧄] Replace all "github.com/webgptorg/promptbook#xxx" with "ptbk.io/xxx"
99
+ * TODO: [🐤] DRY `AgentModelRequirements` and `ModelRequirements`
102
100
  */
@@ -1,4 +1,4 @@
1
- import { Color } from "../Color";
1
+ import { Color } from '../Color';
2
2
  /**
3
3
  * Calculates saturation of the color
4
4
  *
@@ -14,4 +14,4 @@ export {};
14
14
  /**
15
15
  * TODO: [🧠] What is the better solution - `- xxx`, - `- xxx` or preserve (see also next TODO)
16
16
  * TODO: When existing commands 1) as 2) number 3) list, add 4) new command as next number
17
- */
17
+ */
@@ -15,7 +15,7 @@ export declare const BOOK_LANGUAGE_VERSION: string_semantic_version;
15
15
  export declare const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version;
16
16
  /**
17
17
  * Represents the version string of the Promptbook engine.
18
- * It follows semantic versioning (e.g., `0.101.0-14`).
18
+ * It follows semantic versioning (e.g., `0.101.0-15`).
19
19
  *
20
20
  * @generated
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/openai",
3
- "version": "0.101.0-15",
3
+ "version": "0.101.0-16",
4
4
  "description": "Promptbook: Run AI apps in plain human language across multiple models and platforms",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -102,7 +102,7 @@
102
102
  "module": "./esm/index.es.js",
103
103
  "typings": "./esm/typings/src/_packages/openai.index.d.ts",
104
104
  "peerDependencies": {
105
- "@promptbook/core": "0.101.0-15"
105
+ "@promptbook/core": "0.101.0-16"
106
106
  },
107
107
  "dependencies": {
108
108
  "bottleneck": "^2.19.5",
package/umd/index.umd.js CHANGED
@@ -25,7 +25,7 @@
25
25
  * @generated
26
26
  * @see https://github.com/webgptorg/promptbook
27
27
  */
28
- const PROMPTBOOK_ENGINE_VERSION = '0.101.0-15';
28
+ const PROMPTBOOK_ENGINE_VERSION = '0.101.0-16';
29
29
  /**
30
30
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
31
31
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -1402,7 +1402,7 @@
1402
1402
  modelVariant: 'CHAT',
1403
1403
  modelTitle: 'gpt-5-mini',
1404
1404
  modelName: 'gpt-5-mini',
1405
- modelDescription: "A faster, cost-efficient version of GPT-5 for well-defined tasks with 200K context window. Maintains core GPT-5 capabilities while offering 5x faster inference and significantly lower costs. Features enhanced instruction following and reduced latency for production applications requiring quick responses with high quality.",
1405
+ modelDescription: 'A faster, cost-efficient version of GPT-5 for well-defined tasks with 200K context window. Maintains core GPT-5 capabilities while offering 5x faster inference and significantly lower costs. Features enhanced instruction following and reduced latency for production applications requiring quick responses with high quality.',
1406
1406
  pricing: {
1407
1407
  prompt: pricing(`$0.25 / 1M tokens`),
1408
1408
  output: pricing(`$2.00 / 1M tokens`),
@@ -1414,7 +1414,7 @@
1414
1414
  modelVariant: 'CHAT',
1415
1415
  modelTitle: 'gpt-5-nano',
1416
1416
  modelName: 'gpt-5-nano',
1417
- modelDescription: "The fastest, most cost-efficient version of GPT-5 with 200K context window. Optimized for summarization, classification, and simple reasoning tasks. Features 10x faster inference than base GPT-5 while maintaining good quality for straightforward applications. Ideal for high-volume, cost-sensitive deployments.",
1417
+ modelDescription: 'The fastest, most cost-efficient version of GPT-5 with 200K context window. Optimized for summarization, classification, and simple reasoning tasks. Features 10x faster inference than base GPT-5 while maintaining good quality for straightforward applications. Ideal for high-volume, cost-sensitive deployments.',
1418
1418
  pricing: {
1419
1419
  prompt: pricing(`$0.05 / 1M tokens`),
1420
1420
  output: pricing(`$0.40 / 1M tokens`),
@@ -1426,7 +1426,7 @@
1426
1426
  modelVariant: 'CHAT',
1427
1427
  modelTitle: 'gpt-4.1',
1428
1428
  modelName: 'gpt-4.1',
1429
- modelDescription: "Smartest non-reasoning model with 128K context window. Enhanced version of GPT-4 with improved instruction following, better factual accuracy, and reduced hallucinations. Features advanced function calling capabilities and superior performance on coding tasks. Ideal for applications requiring high intelligence without reasoning overhead.",
1429
+ modelDescription: 'Smartest non-reasoning model with 128K context window. Enhanced version of GPT-4 with improved instruction following, better factual accuracy, and reduced hallucinations. Features advanced function calling capabilities and superior performance on coding tasks. Ideal for applications requiring high intelligence without reasoning overhead.',
1430
1430
  pricing: {
1431
1431
  prompt: pricing(`$3.00 / 1M tokens`),
1432
1432
  output: pricing(`$12.00 / 1M tokens`),
@@ -1438,7 +1438,7 @@
1438
1438
  modelVariant: 'CHAT',
1439
1439
  modelTitle: 'gpt-4.1-mini',
1440
1440
  modelName: 'gpt-4.1-mini',
1441
- modelDescription: "Smaller, faster version of GPT-4.1 with 128K context window. Balances intelligence and efficiency with 3x faster inference than base GPT-4.1. Maintains strong capabilities across text generation, reasoning, and coding while offering better cost-performance ratio for most applications.",
1441
+ modelDescription: 'Smaller, faster version of GPT-4.1 with 128K context window. Balances intelligence and efficiency with 3x faster inference than base GPT-4.1. Maintains strong capabilities across text generation, reasoning, and coding while offering better cost-performance ratio for most applications.',
1442
1442
  pricing: {
1443
1443
  prompt: pricing(`$0.80 / 1M tokens`),
1444
1444
  output: pricing(`$3.20 / 1M tokens`),
@@ -1450,7 +1450,7 @@
1450
1450
  modelVariant: 'CHAT',
1451
1451
  modelTitle: 'gpt-4.1-nano',
1452
1452
  modelName: 'gpt-4.1-nano',
1453
- modelDescription: "Fastest, most cost-efficient version of GPT-4.1 with 128K context window. Optimized for high-throughput applications requiring good quality at minimal cost. Features 5x faster inference than GPT-4.1 while maintaining adequate performance for most general-purpose tasks.",
1453
+ modelDescription: 'Fastest, most cost-efficient version of GPT-4.1 with 128K context window. Optimized for high-throughput applications requiring good quality at minimal cost. Features 5x faster inference than GPT-4.1 while maintaining adequate performance for most general-purpose tasks.',
1454
1454
  pricing: {
1455
1455
  prompt: pricing(`$0.20 / 1M tokens`),
1456
1456
  output: pricing(`$0.80 / 1M tokens`),
@@ -1462,7 +1462,7 @@
1462
1462
  modelVariant: 'CHAT',
1463
1463
  modelTitle: 'o3',
1464
1464
  modelName: 'o3',
1465
- modelDescription: "Advanced reasoning model with 128K context window specializing in complex logical, mathematical, and analytical tasks. Successor to o1 with enhanced step-by-step problem-solving capabilities and superior performance on STEM-focused problems. Ideal for professional applications requiring deep analytical thinking and precise reasoning.",
1465
+ modelDescription: 'Advanced reasoning model with 128K context window specializing in complex logical, mathematical, and analytical tasks. Successor to o1 with enhanced step-by-step problem-solving capabilities and superior performance on STEM-focused problems. Ideal for professional applications requiring deep analytical thinking and precise reasoning.',
1466
1466
  pricing: {
1467
1467
  prompt: pricing(`$15.00 / 1M tokens`),
1468
1468
  output: pricing(`$60.00 / 1M tokens`),
@@ -1474,7 +1474,7 @@
1474
1474
  modelVariant: 'CHAT',
1475
1475
  modelTitle: 'o3-pro',
1476
1476
  modelName: 'o3-pro',
1477
- modelDescription: "Enhanced version of o3 with more compute allocated for better responses on the most challenging problems. Features extended reasoning time and improved accuracy on complex analytical tasks. Designed for applications where maximum reasoning quality is more important than response speed.",
1477
+ modelDescription: 'Enhanced version of o3 with more compute allocated for better responses on the most challenging problems. Features extended reasoning time and improved accuracy on complex analytical tasks. Designed for applications where maximum reasoning quality is more important than response speed.',
1478
1478
  pricing: {
1479
1479
  prompt: pricing(`$30.00 / 1M tokens`),
1480
1480
  output: pricing(`$120.00 / 1M tokens`),
@@ -1486,7 +1486,7 @@
1486
1486
  modelVariant: 'CHAT',
1487
1487
  modelTitle: 'o4-mini',
1488
1488
  modelName: 'o4-mini',
1489
- modelDescription: "Fast, cost-efficient reasoning model with 128K context window. Successor to o1-mini with improved analytical capabilities while maintaining speed advantages. Features enhanced mathematical reasoning and logical problem-solving at significantly lower cost than full reasoning models.",
1489
+ modelDescription: 'Fast, cost-efficient reasoning model with 128K context window. Successor to o1-mini with improved analytical capabilities while maintaining speed advantages. Features enhanced mathematical reasoning and logical problem-solving at significantly lower cost than full reasoning models.',
1490
1490
  pricing: {
1491
1491
  prompt: pricing(`$4.00 / 1M tokens`),
1492
1492
  output: pricing(`$16.00 / 1M tokens`),
@@ -1498,7 +1498,7 @@
1498
1498
  modelVariant: 'CHAT',
1499
1499
  modelTitle: 'o3-deep-research',
1500
1500
  modelName: 'o3-deep-research',
1501
- modelDescription: "Most powerful deep research model with 128K context window. Specialized for comprehensive research tasks, literature analysis, and complex information synthesis. Features advanced citation capabilities and enhanced factual accuracy for academic and professional research applications.",
1501
+ modelDescription: 'Most powerful deep research model with 128K context window. Specialized for comprehensive research tasks, literature analysis, and complex information synthesis. Features advanced citation capabilities and enhanced factual accuracy for academic and professional research applications.',
1502
1502
  pricing: {
1503
1503
  prompt: pricing(`$25.00 / 1M tokens`),
1504
1504
  output: pricing(`$100.00 / 1M tokens`),
@@ -1510,7 +1510,7 @@
1510
1510
  modelVariant: 'CHAT',
1511
1511
  modelTitle: 'o4-mini-deep-research',
1512
1512
  modelName: 'o4-mini-deep-research',
1513
- modelDescription: "Faster, more affordable deep research model with 128K context window. Balances research capabilities with cost efficiency, offering good performance on literature review, fact-checking, and information synthesis tasks at a more accessible price point.",
1513
+ modelDescription: 'Faster, more affordable deep research model with 128K context window. Balances research capabilities with cost efficiency, offering good performance on literature review, fact-checking, and information synthesis tasks at a more accessible price point.',
1514
1514
  pricing: {
1515
1515
  prompt: pricing(`$12.00 / 1M tokens`),
1516
1516
  output: pricing(`$48.00 / 1M tokens`),
@@ -2050,10 +2050,10 @@
2050
2050
  const newRequirements = { ...modelRequirements };
2051
2051
  // Map of parameter names that might appear in error messages to ModelRequirements properties
2052
2052
  const parameterMap = {
2053
- 'temperature': 'temperature',
2054
- 'max_tokens': 'maxTokens',
2055
- 'maxTokens': 'maxTokens',
2056
- 'seed': 'seed',
2053
+ temperature: 'temperature',
2054
+ max_tokens: 'maxTokens',
2055
+ maxTokens: 'maxTokens',
2056
+ seed: 'seed',
2057
2057
  };
2058
2058
  const propertyToRemove = parameterMap[unsupportedParameter];
2059
2059
  if (propertyToRemove && propertyToRemove in newRequirements) {
@@ -2069,9 +2069,9 @@
2069
2069
  */
2070
2070
  function isUnsupportedParameterError(error) {
2071
2071
  const errorMessage = error.message.toLowerCase();
2072
- return errorMessage.includes('unsupported value:') ||
2072
+ return (errorMessage.includes('unsupported value:') ||
2073
2073
  errorMessage.includes('is not supported with this model') ||
2074
- errorMessage.includes('does not support');
2074
+ errorMessage.includes('does not support'));
2075
2075
  }
2076
2076
 
2077
2077
  /**