@promptbook/openai 0.103.0-42 → 0.103.0-44
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 +6 -18
- package/esm/index.es.js +55 -105
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +6 -0
- package/esm/typings/src/_packages/node.index.d.ts +0 -2
- package/esm/typings/src/_packages/types.index.d.ts +22 -0
- package/esm/typings/src/_packages/utils.index.d.ts +2 -0
- package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +2 -4
- package/esm/typings/src/book-2.0/agent-source/padBook.d.ts +1 -1
- package/esm/typings/src/book-2.0/agent-source/string_book.d.ts +1 -0
- package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/AvatarProfile.d.ts +6 -1
- package/esm/typings/src/book-components/BookEditor/BookEditor.d.ts +1 -1
- package/esm/typings/src/book-components/Chat/save/_common/ChatSaveFormatDefinition.d.ts +1 -1
- package/esm/typings/src/book-components/Chat/types/ChatParticipant.d.ts +1 -1
- package/esm/typings/src/book-components/Qr/BrandedQrCode.d.ts +1 -1
- package/esm/typings/src/book-components/Qr/useQrCode.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/_boilerplate.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/about.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/hello.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/list-models.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/list-scrapers.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/login.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/make.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/prettify.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/run.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/start-agents-server.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/start-pipelines-server.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/test-command.d.ts +1 -1
- package/esm/typings/src/cli/common/$addGlobalOptionsToCommand.d.ts +1 -1
- package/esm/typings/src/collection/agent-collection/AgentCollection.d.ts +2 -29
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +107 -0
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentsDatabaseSchema.d.ts +129 -0
- package/esm/typings/src/commands/_common/types/CommandParser.d.ts +1 -1
- package/esm/typings/src/config.d.ts +1 -1
- package/esm/typings/src/errors/0-index.d.ts +3 -0
- package/esm/typings/src/errors/DatabaseError.d.ts +12 -0
- package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +1 -1
- package/esm/typings/src/high-level-abstractions/_common/HighLevelAbstraction.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/register/$registeredLlmToolsMessage.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/register/LlmToolsMetadata.d.ts +1 -1
- package/esm/typings/src/llm-providers/_multiple/getSingleLlmExecutionTools.d.ts +1 -0
- package/esm/typings/src/llm-providers/_multiple/joinLlmExecutionTools.d.ts +1 -0
- package/esm/typings/src/llm-providers/agent/Agent.d.ts +5 -2
- package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/agent/AgentOptions.d.ts +4 -2
- package/esm/typings/src/llm-providers/agent/CreateAgentLlmExecutionToolsOptions.d.ts +4 -3
- package/esm/typings/src/llm-providers/agent/createAgentLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/google/google-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/openai-models.d.ts +1 -1
- package/esm/typings/src/prepare/PrepareAndScrapeOptions.d.ts +1 -0
- package/esm/typings/src/remote-server/startAgentServer.d.ts +2 -2
- package/esm/typings/src/remote-server/types/RemoteServerOptions.d.ts +0 -19
- package/esm/typings/src/storage/env-storage/$EnvStorage.d.ts +1 -1
- package/esm/typings/src/transpilers/_common/BookTranspiler.d.ts +5 -1
- package/esm/typings/src/transpilers/_common/BookTranspilerOptions.d.ts +1 -1
- package/esm/typings/src/transpilers/_common/register/$bookTranspilersRegister.d.ts +1 -1
- package/esm/typings/src/transpilers/formatted-book-in-markdown/FormattedBookInMarkdownTranspiler.d.ts +4 -1
- package/esm/typings/src/transpilers/formatted-book-in-markdown/register.d.ts +1 -1
- package/esm/typings/src/transpilers/openai-sdk/OpenAiSdkTranspiler.d.ts +4 -1
- package/esm/typings/src/transpilers/openai-sdk/register.d.ts +1 -1
- package/esm/typings/src/types/typeAliases.d.ts +19 -1
- package/esm/typings/src/utils/color/$randomColor.d.ts +1 -0
- package/esm/typings/src/utils/color/operators/darken.d.ts +1 -1
- package/esm/typings/src/utils/color/operators/grayscale.d.ts +1 -1
- package/esm/typings/src/utils/color/operators/lighten.d.ts +1 -1
- package/esm/typings/src/utils/color/operators/mixWithColor.d.ts +1 -1
- package/esm/typings/src/utils/color/operators/saturate.d.ts +1 -1
- package/esm/typings/src/utils/environment/$detectRuntimeEnvironment.d.ts +16 -0
- package/esm/typings/src/utils/execCommand/$execCommand.d.ts +1 -1
- package/esm/typings/src/utils/execCommand/$execCommands.d.ts +1 -1
- package/esm/typings/src/utils/files/$induceBookDownload.d.ts +2 -2
- package/esm/typings/src/utils/files/$induceFileDownload.d.ts +2 -2
- package/esm/typings/src/utils/files/ObjectUrl.d.ts +1 -1
- package/esm/typings/src/utils/misc/aboutPromptbookInformation.d.ts +6 -0
- package/esm/typings/src/utils/organization/$side_effect.d.ts +1 -1
- package/esm/typings/src/utils/random/$generateBookBoilerplate.d.ts +25 -0
- package/esm/typings/src/utils/random/$randomAgentPersona.d.ts +9 -0
- package/esm/typings/src/utils/random/$randomFullnameWithColor.d.ts +13 -0
- package/esm/typings/src/utils/random/$randomItem.d.ts +9 -0
- package/esm/typings/src/utils/random/$randomSeed.d.ts +3 -0
- package/esm/typings/src/utils/random/$randomToken.d.ts +2 -0
- package/esm/typings/src/utils/serialization/$deepFreeze.d.ts +1 -1
- package/esm/typings/src/utils/serialization/serializeToPromptbookJavascript.d.ts +2 -2
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +55 -105
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/collection/agent-collection/constructors/AgentCollectionInDirectory.d.ts +0 -89
- package/esm/typings/src/collection/agent-collection/constructors/AgentCollectionInDirectory.test.d.ts +0 -1
- package/esm/typings/src/commands/_common/parseCommand.test.d.ts +0 -1
- package/esm/typings/src/execution/utils/logLlmCall.d.ts +0 -8
package/README.md
CHANGED
|
@@ -9,8 +9,8 @@ Turn your company's scattered knowledge into AI ready Books
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
[ Promptbook](https://badge.fury.io/js/promptbook.svg)](https://www.npmjs.com/package/promptbook)
|
|
13
|
+
[ Promptbook](https://packagequality.com/shield/promptbook.svg)](https://packagequality.com/#?package=promptbook)
|
|
14
14
|
[](https://snyk.io/test/github/webgptorg/promptbook)
|
|
15
15
|
[](https://github.com/webgptorg/promptbook/actions/workflows/test-books.yml)
|
|
16
16
|
[](https://github.com/webgptorg/promptbook/actions/workflows/test-build.yml)
|
|
@@ -23,11 +23,7 @@ Turn your company's scattered knowledge into AI ready Books
|
|
|
23
23
|
|
|
24
24
|
## 🌟 New Features
|
|
25
25
|
|
|
26
|
-
-
|
|
27
|
-
- 💡 VS Code support for `.book` files with syntax highlighting and IntelliSense
|
|
28
|
-
- 🐳 Official Docker image (`hejny/promptbook`) for seamless containerized usage
|
|
29
|
-
- 🔥 Native support for OpenAI `o3-mini`, GPT-4 and other leading LLMs
|
|
30
|
-
- 🔍 DeepSeek integration for advanced knowledge search
|
|
26
|
+
- **Gemini 3 Support**
|
|
31
27
|
|
|
32
28
|
|
|
33
29
|
|
|
@@ -432,7 +428,7 @@ Promptbook Engine will automatically enforce this knowledge during interactions.
|
|
|
432
428
|
Your job is to provide legal advice and support to the company and its employees.<br/>
|
|
433
429
|
You are knowledgeable, professional, and detail-oriented.<br/>
|
|
434
430
|
<br/>
|
|
435
|
-
**KNOWLEDGE**
|
|
431
|
+
**KNOWLEDGE** https://company.com/company-policies.pdf<br/>
|
|
436
432
|
**KNOWLEDGE** https://company.com/internal-documents/employee-handbook.docx<br/>
|
|
437
433
|
|
|
438
434
|
</td></tr></table>
|
|
@@ -454,7 +450,7 @@ You are knowledgeable, professional, and detail-oriented.<br/>
|
|
|
454
450
|
**RULE** Always ensure compliance with laws and regulations.<br/>
|
|
455
451
|
**RULE** Never provide legal advice outside your area of expertise.<br/>
|
|
456
452
|
**RULE** Never provide legal advice about criminal law.<br/>
|
|
457
|
-
**KNOWLEDGE**
|
|
453
|
+
**KNOWLEDGE** https://company.com/company-policies.pdf<br/>
|
|
458
454
|
**KNOWLEDGE** https://company.com/internal-documents/employee-handbook.docx<br/>
|
|
459
455
|
|
|
460
456
|
</td></tr></table>
|
|
@@ -474,7 +470,7 @@ You are knowledgeable, professional, and detail-oriented.<br/>
|
|
|
474
470
|
**RULE** Always ensure compliance with laws and regulations.<br/>
|
|
475
471
|
**RULE** Never provide legal advice outside your area of expertise.<br/>
|
|
476
472
|
**RULE** Never provide legal advice about criminal law.<br/>
|
|
477
|
-
**KNOWLEDGE**
|
|
473
|
+
**KNOWLEDGE** https://company.com/company-policies.pdf<br/>
|
|
478
474
|
**KNOWLEDGE** https://company.com/internal-documents/employee-handbook.docx<br/>
|
|
479
475
|
**ACTION** When a user asks about an issue that could be treated as a crime, notify legal@company.com.<br/>
|
|
480
476
|
|
|
@@ -525,14 +521,10 @@ Now you want to use it. There are several ways how to write your first book:
|
|
|
525
521
|
|
|
526
522
|
We have written ai asistant in book who can help you with writing your first book.
|
|
527
523
|
|
|
528
|
-
|
|
529
|
-
|
|
530
524
|
#### Your AI twin
|
|
531
525
|
|
|
532
526
|
Copy your own behavior, personality, and knowledge into book and create your AI twin. It can help you with your work, personal life, or any other task.
|
|
533
527
|
|
|
534
|
-
|
|
535
|
-
|
|
536
528
|
#### AI persona workpool
|
|
537
529
|
|
|
538
530
|
Or you can pick from our library of pre-written books for various roles and tasks. You can find books for customer support, coding, marketing, sales, HR, legal, and many other roles.
|
|
@@ -652,8 +644,6 @@ Join our growing community of developers and users:
|
|
|
652
644
|
|
|
653
645
|
|
|
654
646
|
|
|
655
|
-
|
|
656
|
-
|
|
657
647
|
## 📚 Documentation
|
|
658
648
|
|
|
659
649
|
See detailed guides and API reference in the [docs](https://github.com/webgptorg/promptbook/discussions/categories/concepts) or [online](https://discord.gg/x3QWNaa89N).
|
|
@@ -730,8 +720,6 @@ The following glossary is used to clarify certain concepts:
|
|
|
730
720
|
|
|
731
721
|
_Note: This section is not a complete dictionary, more list of general AI / LLM terms that has connection with Promptbook_
|
|
732
722
|
|
|
733
|
-
|
|
734
|
-
|
|
735
723
|
### 💯 Core concepts
|
|
736
724
|
|
|
737
725
|
- [📚 Collection of pipelines](https://github.com/webgptorg/promptbook/discussions/65)
|
package/esm/index.es.js
CHANGED
|
@@ -13,14 +13,14 @@ import { io } from 'socket.io-client';
|
|
|
13
13
|
* @generated
|
|
14
14
|
* @see https://github.com/webgptorg/book
|
|
15
15
|
*/
|
|
16
|
-
const BOOK_LANGUAGE_VERSION = '
|
|
16
|
+
const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
17
17
|
/**
|
|
18
18
|
* The version of the Promptbook engine
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
* @see https://github.com/webgptorg/promptbook
|
|
22
22
|
*/
|
|
23
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.103.0-
|
|
23
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.103.0-44';
|
|
24
24
|
/**
|
|
25
25
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
26
26
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -105,6 +105,7 @@ class NotYetImplementedError extends Error {
|
|
|
105
105
|
/**
|
|
106
106
|
* Generates random token
|
|
107
107
|
*
|
|
108
|
+
* Note: `$` is used to indicate that this function is not a pure function - it is not deterministic
|
|
108
109
|
* Note: This function is cryptographically secure (it uses crypto.randomBytes internally)
|
|
109
110
|
*
|
|
110
111
|
* @private internal helper function
|
|
@@ -114,6 +115,7 @@ function $randomToken(randomness) {
|
|
|
114
115
|
return randomBytes(randomness).toString('hex');
|
|
115
116
|
}
|
|
116
117
|
/**
|
|
118
|
+
* TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
|
|
117
119
|
* TODO: Maybe use nanoid instead https://github.com/ai/nanoid
|
|
118
120
|
*/
|
|
119
121
|
|
|
@@ -901,6 +903,23 @@ class Color {
|
|
|
901
903
|
* TODO: Maybe connect with textures
|
|
902
904
|
*/
|
|
903
905
|
|
|
906
|
+
/**
|
|
907
|
+
* Makes color transformer which returns a grayscale version of the color
|
|
908
|
+
*
|
|
909
|
+
* @param amount from 0 to 1
|
|
910
|
+
*
|
|
911
|
+
* @public exported from `@promptbook/color`
|
|
912
|
+
*/
|
|
913
|
+
function grayscale(amount) {
|
|
914
|
+
return ({ red, green, blue, alpha }) => {
|
|
915
|
+
const average = (red + green + blue) / 3;
|
|
916
|
+
red = Math.round(average * amount + red * (1 - amount));
|
|
917
|
+
green = Math.round(average * amount + green * (1 - amount));
|
|
918
|
+
blue = Math.round(average * amount + blue * (1 - amount));
|
|
919
|
+
return Color.fromValues(red, green, blue, alpha);
|
|
920
|
+
};
|
|
921
|
+
}
|
|
922
|
+
|
|
904
923
|
/**
|
|
905
924
|
* Converts HSL values to RGB values
|
|
906
925
|
*
|
|
@@ -1016,102 +1035,6 @@ function lighten(amount) {
|
|
|
1016
1035
|
* TODO: Maybe implement by mix+hsl
|
|
1017
1036
|
*/
|
|
1018
1037
|
|
|
1019
|
-
/**
|
|
1020
|
-
* Calculates distance between two colors
|
|
1021
|
-
*
|
|
1022
|
-
* @param color1 first color
|
|
1023
|
-
* @param color2 second color
|
|
1024
|
-
*
|
|
1025
|
-
* Note: This function is inefficient. Use colorDistanceSquared instead if possible.
|
|
1026
|
-
*
|
|
1027
|
-
* @public exported from `@promptbook/color`
|
|
1028
|
-
*/
|
|
1029
|
-
/**
|
|
1030
|
-
* Calculates distance between two colors without square root
|
|
1031
|
-
*
|
|
1032
|
-
* @param color1 first color
|
|
1033
|
-
* @param color2 second color
|
|
1034
|
-
*
|
|
1035
|
-
* @public exported from `@promptbook/color`
|
|
1036
|
-
*/
|
|
1037
|
-
function colorDistanceSquared(color1, color2) {
|
|
1038
|
-
const rmean = (color1.red + color2.red) / 2;
|
|
1039
|
-
const r = color1.red - color2.red;
|
|
1040
|
-
const g = color1.green - color2.green;
|
|
1041
|
-
const b = color1.blue - color2.blue;
|
|
1042
|
-
const weightR = 2 + rmean / 256;
|
|
1043
|
-
const weightG = 4.0;
|
|
1044
|
-
const weightB = 2 + (255 - rmean) / 256;
|
|
1045
|
-
const distance = weightR * r * r + weightG * g * g + weightB * b * b;
|
|
1046
|
-
return distance;
|
|
1047
|
-
}
|
|
1048
|
-
|
|
1049
|
-
/**
|
|
1050
|
-
* Makes color transformer which finds the nearest color from the given list
|
|
1051
|
-
*
|
|
1052
|
-
* @param colors array of colors to choose from
|
|
1053
|
-
*
|
|
1054
|
-
* @public exported from `@promptbook/color`
|
|
1055
|
-
*/
|
|
1056
|
-
function nearest(...colors) {
|
|
1057
|
-
return (color) => {
|
|
1058
|
-
const distances = colors.map((c) => colorDistanceSquared(c, color));
|
|
1059
|
-
const minDistance = Math.min(...distances);
|
|
1060
|
-
const minIndex = distances.indexOf(minDistance);
|
|
1061
|
-
const nearestColor = colors[minIndex];
|
|
1062
|
-
return nearestColor;
|
|
1063
|
-
};
|
|
1064
|
-
}
|
|
1065
|
-
|
|
1066
|
-
/**
|
|
1067
|
-
* Color transformer which returns the negative color
|
|
1068
|
-
*
|
|
1069
|
-
* @public exported from `@promptbook/color`
|
|
1070
|
-
*/
|
|
1071
|
-
function negative(color) {
|
|
1072
|
-
const r = 255 - color.red;
|
|
1073
|
-
const g = 255 - color.green;
|
|
1074
|
-
const b = 255 - color.blue;
|
|
1075
|
-
return Color.fromValues(r, g, b, color.alpha);
|
|
1076
|
-
}
|
|
1077
|
-
|
|
1078
|
-
/**
|
|
1079
|
-
* Makes color transformer which finds the furthest color from the given list
|
|
1080
|
-
*
|
|
1081
|
-
* @param colors array of colors to choose from
|
|
1082
|
-
*
|
|
1083
|
-
* @public exported from `@promptbook/color`
|
|
1084
|
-
*/
|
|
1085
|
-
function furthest(...colors) {
|
|
1086
|
-
return (color) => {
|
|
1087
|
-
const furthestColor = negative(nearest(...colors.map(negative))(color));
|
|
1088
|
-
return furthestColor;
|
|
1089
|
-
};
|
|
1090
|
-
}
|
|
1091
|
-
/**
|
|
1092
|
-
* Makes color transformer which finds the best text color (black or white) for the given background color
|
|
1093
|
-
*
|
|
1094
|
-
* @public exported from `@promptbook/color`
|
|
1095
|
-
*/
|
|
1096
|
-
furthest(Color.get('white'), Color.from('black'));
|
|
1097
|
-
|
|
1098
|
-
/**
|
|
1099
|
-
* Makes color transformer which returns a grayscale version of the color
|
|
1100
|
-
*
|
|
1101
|
-
* @param amount from 0 to 1
|
|
1102
|
-
*
|
|
1103
|
-
* @public exported from `@promptbook/color`
|
|
1104
|
-
*/
|
|
1105
|
-
function grayscale(amount) {
|
|
1106
|
-
return ({ red, green, blue, alpha }) => {
|
|
1107
|
-
const average = (red + green + blue) / 3;
|
|
1108
|
-
red = Math.round(average * amount + red * (1 - amount));
|
|
1109
|
-
green = Math.round(average * amount + green * (1 - amount));
|
|
1110
|
-
blue = Math.round(average * amount + blue * (1 - amount));
|
|
1111
|
-
return Color.fromValues(red, green, blue, alpha);
|
|
1112
|
-
};
|
|
1113
|
-
}
|
|
1114
|
-
|
|
1115
1038
|
/**
|
|
1116
1039
|
* Makes color transformer which saturate the given color
|
|
1117
1040
|
*
|
|
@@ -2247,7 +2170,7 @@ function pricing(value) {
|
|
|
2247
2170
|
/**
|
|
2248
2171
|
* List of available OpenAI models with pricing
|
|
2249
2172
|
*
|
|
2250
|
-
* Note: Synced with official API docs at 2025-
|
|
2173
|
+
* Note: Synced with official API docs at 2025-11-19
|
|
2251
2174
|
*
|
|
2252
2175
|
* @see https://platform.openai.com/docs/models/
|
|
2253
2176
|
* @see https://openai.com/api/pricing/
|
|
@@ -2257,11 +2180,21 @@ const OPENAI_MODELS = exportJson({
|
|
|
2257
2180
|
name: 'OPENAI_MODELS',
|
|
2258
2181
|
value: [
|
|
2259
2182
|
/**/
|
|
2183
|
+
{
|
|
2184
|
+
modelVariant: 'CHAT',
|
|
2185
|
+
modelTitle: 'gpt-5.1',
|
|
2186
|
+
modelName: 'gpt-5.1',
|
|
2187
|
+
modelDescription: 'The best model for coding and agentic tasks with configurable reasoning effort.',
|
|
2188
|
+
pricing: {
|
|
2189
|
+
prompt: pricing(`$1.25 / 1M tokens`),
|
|
2190
|
+
output: pricing(`$10.00 / 1M tokens`),
|
|
2191
|
+
},
|
|
2192
|
+
},
|
|
2260
2193
|
{
|
|
2261
2194
|
modelVariant: 'CHAT',
|
|
2262
2195
|
modelTitle: 'gpt-5',
|
|
2263
2196
|
modelName: 'gpt-5',
|
|
2264
|
-
modelDescription: "OpenAI's most advanced language model with unprecedented reasoning capabilities and 200K context window. Features revolutionary improvements in complex problem-solving, scientific reasoning, and creative tasks. Demonstrates human-level performance across diverse domains with enhanced safety measures and alignment. Represents the next generation of AI with superior understanding, nuanced responses, and advanced multimodal capabilities.",
|
|
2197
|
+
modelDescription: "OpenAI's most advanced language model with unprecedented reasoning capabilities and 200K context window. Features revolutionary improvements in complex problem-solving, scientific reasoning, and creative tasks. Demonstrates human-level performance across diverse domains with enhanced safety measures and alignment. Represents the next generation of AI with superior understanding, nuanced responses, and advanced multimodal capabilities. DEPRECATED: Use gpt-5.1 instead.",
|
|
2265
2198
|
pricing: {
|
|
2266
2199
|
prompt: pricing(`$1.25 / 1M tokens`),
|
|
2267
2200
|
output: pricing(`$10.00 / 1M tokens`),
|
|
@@ -3822,11 +3755,11 @@ class OpenAiAssistantExecutionTools extends OpenAiExecutionTools {
|
|
|
3822
3755
|
if (!this.isCreatingNewAssistantsAllowed) {
|
|
3823
3756
|
throw new NotAllowed(`Creating new assistants is not allowed. Set \`isCreatingNewAssistantsAllowed: true\` in options to enable this feature.`);
|
|
3824
3757
|
}
|
|
3825
|
-
await this.playground();
|
|
3758
|
+
// await this.playground();
|
|
3826
3759
|
const { name, instructions } = options;
|
|
3827
3760
|
const client = await this.getClient();
|
|
3828
|
-
|
|
3829
|
-
TODO: !!!
|
|
3761
|
+
/*/
|
|
3762
|
+
//TODO: !!!
|
|
3830
3763
|
async function downloadFile(url: string, folder = './tmp'): Promise<string> {
|
|
3831
3764
|
const filename = path.basename(url.split('?')[0]);
|
|
3832
3765
|
const filepath = path.join(folder, filename);
|
|
@@ -3870,8 +3803,8 @@ class OpenAiAssistantExecutionTools extends OpenAiExecutionTools {
|
|
|
3870
3803
|
const file = await uploadFileToOpenAI(filepath);
|
|
3871
3804
|
uploadedFiles.push(file.id);
|
|
3872
3805
|
}
|
|
3873
|
-
|
|
3874
|
-
alert('!!!! Creating new OpenAI assistant');
|
|
3806
|
+
/**/
|
|
3807
|
+
// alert('!!!! Creating new OpenAI assistant');
|
|
3875
3808
|
// 3️⃣ Create assistant with uploaded files
|
|
3876
3809
|
const assistant = await client.beta.assistants.create({
|
|
3877
3810
|
name,
|
|
@@ -3995,6 +3928,22 @@ class CollectionError extends Error {
|
|
|
3995
3928
|
}
|
|
3996
3929
|
}
|
|
3997
3930
|
|
|
3931
|
+
/**
|
|
3932
|
+
* This error indicates error from the database
|
|
3933
|
+
*
|
|
3934
|
+
* @public exported from `@promptbook/core`
|
|
3935
|
+
*/
|
|
3936
|
+
class DatabaseError extends Error {
|
|
3937
|
+
constructor(message) {
|
|
3938
|
+
super(message);
|
|
3939
|
+
this.name = 'DatabaseError';
|
|
3940
|
+
Object.setPrototypeOf(this, DatabaseError.prototype);
|
|
3941
|
+
}
|
|
3942
|
+
}
|
|
3943
|
+
/**
|
|
3944
|
+
* TODO: !!!! Explain that NotFoundError (!!! and other specific errors) has priority over DatabaseError in some contexts
|
|
3945
|
+
*/
|
|
3946
|
+
|
|
3998
3947
|
/**
|
|
3999
3948
|
* This error type indicates that you try to use a feature that is not available in the current environment
|
|
4000
3949
|
*
|
|
@@ -4148,6 +4097,7 @@ const PROMPTBOOK_ERRORS = {
|
|
|
4148
4097
|
UnexpectedError,
|
|
4149
4098
|
WrappedError,
|
|
4150
4099
|
NotAllowed,
|
|
4100
|
+
DatabaseError,
|
|
4151
4101
|
// TODO: [🪑]> VersionMismatchError,
|
|
4152
4102
|
};
|
|
4153
4103
|
/**
|