@promptbook/openai 0.89.0-9 → 0.92.0-3
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 +9 -7
- package/esm/index.es.js +106 -10
- package/esm/index.es.js.map +1 -1
- package/esm/typings/servers.d.ts +40 -0
- package/esm/typings/src/_packages/core.index.d.ts +10 -4
- package/esm/typings/src/_packages/types.index.d.ts +18 -0
- package/esm/typings/src/_packages/utils.index.d.ts +4 -0
- package/esm/typings/src/cli/cli-commands/login.d.ts +0 -1
- package/esm/typings/src/cli/common/$provideLlmToolsForCli.d.ts +16 -3
- package/esm/typings/src/cli/test/ptbk.d.ts +1 -1
- package/esm/typings/src/commands/EXPECT/expectCommandParser.d.ts +2 -0
- package/esm/typings/src/config.d.ts +10 -19
- package/esm/typings/src/errors/0-index.d.ts +7 -4
- package/esm/typings/src/errors/PipelineExecutionError.d.ts +1 -1
- package/esm/typings/src/errors/WrappedError.d.ts +10 -0
- package/esm/typings/src/errors/assertsError.d.ts +11 -0
- package/esm/typings/src/execution/PromptbookFetch.d.ts +1 -1
- package/esm/typings/src/formats/csv/utils/isValidCsvString.d.ts +9 -0
- package/esm/typings/src/formats/csv/utils/isValidCsvString.test.d.ts +1 -0
- package/esm/typings/src/formats/json/utils/isValidJsonString.d.ts +3 -0
- package/esm/typings/src/formats/xml/utils/isValidXmlString.d.ts +9 -0
- package/esm/typings/src/formats/xml/utils/isValidXmlString.test.d.ts +1 -0
- package/esm/typings/src/llm-providers/_common/filterModels.d.ts +15 -0
- package/esm/typings/src/llm-providers/_common/register/{$provideEnvFilepath.d.ts → $provideEnvFilename.d.ts} +2 -2
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsConfigurationFromEnv.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForTestingAndScriptsAndPlayground.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForWizzardOrCli.d.ts +11 -2
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsFromEnv.d.ts +1 -1
- package/esm/typings/src/remote-server/openapi-types.d.ts +284 -0
- package/esm/typings/src/remote-server/openapi.d.ts +187 -0
- package/esm/typings/src/remote-server/socket-types/_subtypes/Identification.d.ts +7 -1
- package/esm/typings/src/remote-server/socket-types/_subtypes/identificationToPromptbookToken.d.ts +11 -0
- package/esm/typings/src/remote-server/socket-types/_subtypes/promptbookTokenToIdentification.d.ts +10 -0
- package/esm/typings/src/remote-server/startRemoteServer.d.ts +1 -2
- package/esm/typings/src/remote-server/types/RemoteServerOptions.d.ts +15 -9
- package/esm/typings/src/storage/env-storage/$EnvStorage.d.ts +40 -0
- package/esm/typings/src/types/typeAliases.d.ts +26 -0
- package/package.json +7 -3
- package/umd/index.umd.js +106 -10
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/cli/test/ptbk2.d.ts +0 -5
package/README.md
CHANGED
|
@@ -447,6 +447,10 @@ But unlike programming languages, it is designed to be understandable by non-pro
|
|
|
447
447
|
|
|
448
448
|
|
|
449
449
|
|
|
450
|
+
## 🔒 Security
|
|
451
|
+
|
|
452
|
+
For information on reporting security vulnerabilities, see our [Security Policy](./SECURITY.md).
|
|
453
|
+
|
|
450
454
|
## 📦 Packages _(for developers)_
|
|
451
455
|
|
|
452
456
|
This library is divided into several packages, all are published from [single monorepo](https://github.com/webgptorg/promptbook).
|
|
@@ -503,7 +507,7 @@ The following glossary is used to clarify certain concepts:
|
|
|
503
507
|
### General LLM / AI terms
|
|
504
508
|
|
|
505
509
|
- **Prompt drift** is a phenomenon where the AI model starts to generate outputs that are not aligned with the original prompt. This can happen due to the model's training data, the prompt's wording, or the model's architecture.
|
|
506
|
-
- **Pipeline, workflow or chain** is a sequence of tasks that are executed in a specific order. In the context of AI, a pipeline can refer to a sequence of AI models that are used to process data.
|
|
510
|
+
- [**Pipeline, workflow scenario or chain** is a sequence of tasks that are executed in a specific order. In the context of AI, a pipeline can refer to a sequence of AI models that are used to process data.](https://github.com/webgptorg/promptbook/discussions/88)
|
|
507
511
|
- **Fine-tuning** is a process where a pre-trained AI model is further trained on a specific dataset to improve its performance on a specific task.
|
|
508
512
|
- **Zero-shot learning** is a machine learning paradigm where a model is trained to perform a task without any labeled examples. Instead, the model is provided with a description of the task and is expected to generate the correct output.
|
|
509
513
|
- **Few-shot learning** is a machine learning paradigm where a model is trained to perform a task with only a few labeled examples. This is in contrast to traditional machine learning, where models are trained on large datasets.
|
|
@@ -511,10 +515,6 @@ The following glossary is used to clarify certain concepts:
|
|
|
511
515
|
- **Retrieval-augmented generation** is a machine learning paradigm where a model generates text by retrieving relevant information from a large database of text. This approach combines the benefits of generative models and retrieval models.
|
|
512
516
|
- **Longtail** refers to non-common or rare events, items, or entities that are not well-represented in the training data of machine learning models. Longtail items are often challenging for models to predict accurately.
|
|
513
517
|
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
518
|
_Note: This section is not complete dictionary, more list of general AI / LLM terms that has connection with Promptbook_
|
|
519
519
|
|
|
520
520
|
|
|
@@ -628,6 +628,8 @@ See [TODO.md](./TODO.md)
|
|
|
628
628
|
|
|
629
629
|
## 🖋️ Contributing
|
|
630
630
|
|
|
631
|
-
We are open to pull requests, feedback, and suggestions.
|
|
631
|
+
You can also ⭐ star the project, [follow us on GitHub](https://github.com/hejny) or [various other social networks](https://www.pavolhejny.com/contact/).We are open to [pull requests, feedback, and suggestions](./CONTRIBUTING.md).
|
|
632
|
+
|
|
633
|
+
## 📞 Support
|
|
632
634
|
|
|
633
|
-
|
|
635
|
+
If you need help or have questions, please check our [Support Resources](./SUPPORT.md).
|
package/esm/index.es.js
CHANGED
|
@@ -17,7 +17,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
17
17
|
* @generated
|
|
18
18
|
* @see https://github.com/webgptorg/promptbook
|
|
19
19
|
*/
|
|
20
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.
|
|
20
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.92.0-3';
|
|
21
21
|
/**
|
|
22
22
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
23
23
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -117,7 +117,7 @@ class PipelineExecutionError extends Error {
|
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
/**
|
|
120
|
-
* TODO:
|
|
120
|
+
* TODO: [🧠][🌂] Add id to all errors
|
|
121
121
|
*/
|
|
122
122
|
|
|
123
123
|
/**
|
|
@@ -267,6 +267,7 @@ const VALUE_STRINGS = {
|
|
|
267
267
|
infinity: '(infinity; ∞)',
|
|
268
268
|
negativeInfinity: '(negative infinity; -∞)',
|
|
269
269
|
unserializable: '(unserializable value)',
|
|
270
|
+
circular: '(circular JSON)',
|
|
270
271
|
};
|
|
271
272
|
/**
|
|
272
273
|
* Small number limit
|
|
@@ -374,6 +375,54 @@ class UnexpectedError extends Error {
|
|
|
374
375
|
}
|
|
375
376
|
}
|
|
376
377
|
|
|
378
|
+
/**
|
|
379
|
+
* This error type indicates that somewhere in the code non-Error object was thrown and it was wrapped into the `WrappedError`
|
|
380
|
+
*
|
|
381
|
+
* @public exported from `@promptbook/core`
|
|
382
|
+
*/
|
|
383
|
+
class WrappedError extends Error {
|
|
384
|
+
constructor(whatWasThrown) {
|
|
385
|
+
const tag = `[🤮]`;
|
|
386
|
+
console.error(tag, whatWasThrown);
|
|
387
|
+
super(spaceTrim(`
|
|
388
|
+
Non-Error object was thrown
|
|
389
|
+
|
|
390
|
+
Note: Look for ${tag} in the console for more details
|
|
391
|
+
Please report issue on ${ADMIN_EMAIL}
|
|
392
|
+
`));
|
|
393
|
+
this.name = 'WrappedError';
|
|
394
|
+
Object.setPrototypeOf(this, WrappedError.prototype);
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* Helper used in catch blocks to assert that the error is an instance of `Error`
|
|
400
|
+
*
|
|
401
|
+
* @param whatWasThrown Any object that was thrown
|
|
402
|
+
* @returns Nothing if the error is an instance of `Error`
|
|
403
|
+
* @throws `WrappedError` or `UnexpectedError` if the error is not standard
|
|
404
|
+
*
|
|
405
|
+
* @private within the repository
|
|
406
|
+
*/
|
|
407
|
+
function assertsError(whatWasThrown) {
|
|
408
|
+
// Case 1: Handle error which was rethrown as `WrappedError`
|
|
409
|
+
if (whatWasThrown instanceof WrappedError) {
|
|
410
|
+
const wrappedError = whatWasThrown;
|
|
411
|
+
throw wrappedError;
|
|
412
|
+
}
|
|
413
|
+
// Case 2: Handle unexpected errors
|
|
414
|
+
if (whatWasThrown instanceof UnexpectedError) {
|
|
415
|
+
const unexpectedError = whatWasThrown;
|
|
416
|
+
throw unexpectedError;
|
|
417
|
+
}
|
|
418
|
+
// Case 3: Handle standard errors - keep them up to consumer
|
|
419
|
+
if (whatWasThrown instanceof Error) {
|
|
420
|
+
return;
|
|
421
|
+
}
|
|
422
|
+
// Case 4: Handle non-standard errors - wrap them into `WrappedError` and throw
|
|
423
|
+
throw new WrappedError(whatWasThrown);
|
|
424
|
+
}
|
|
425
|
+
|
|
377
426
|
/**
|
|
378
427
|
* Checks if the value is [🚉] serializable as JSON
|
|
379
428
|
* If not, throws an UnexpectedError with a rich error message and tracking
|
|
@@ -465,9 +514,7 @@ function checkSerializableAsJson(options) {
|
|
|
465
514
|
JSON.stringify(value); // <- TODO: [0]
|
|
466
515
|
}
|
|
467
516
|
catch (error) {
|
|
468
|
-
|
|
469
|
-
throw error;
|
|
470
|
-
}
|
|
517
|
+
assertsError(error);
|
|
471
518
|
throw new UnexpectedError(spaceTrim$1((block) => `
|
|
472
519
|
\`${name}\` is not serializable
|
|
473
520
|
|
|
@@ -689,13 +736,19 @@ function valueToString(value) {
|
|
|
689
736
|
return value.toISOString();
|
|
690
737
|
}
|
|
691
738
|
else {
|
|
692
|
-
|
|
739
|
+
try {
|
|
740
|
+
return JSON.stringify(value);
|
|
741
|
+
}
|
|
742
|
+
catch (error) {
|
|
743
|
+
if (error instanceof TypeError && error.message.includes('circular structure')) {
|
|
744
|
+
return VALUE_STRINGS.circular;
|
|
745
|
+
}
|
|
746
|
+
throw error;
|
|
747
|
+
}
|
|
693
748
|
}
|
|
694
749
|
}
|
|
695
750
|
catch (error) {
|
|
696
|
-
|
|
697
|
-
throw error;
|
|
698
|
-
}
|
|
751
|
+
assertsError(error);
|
|
699
752
|
console.error(error);
|
|
700
753
|
return VALUE_STRINGS.unserializable;
|
|
701
754
|
}
|
|
@@ -1219,6 +1272,7 @@ const OPENAI_MODELS = exportJson({
|
|
|
1219
1272
|
modelVariant: 'COMPLETION',
|
|
1220
1273
|
modelTitle: 'davinci-002',
|
|
1221
1274
|
modelName: 'davinci-002',
|
|
1275
|
+
modelDescription: 'Legacy completion model with strong performance on text generation tasks. Optimized for complex instructions and longer outputs.',
|
|
1222
1276
|
pricing: {
|
|
1223
1277
|
prompt: computeUsage(`$2.00 / 1M tokens`),
|
|
1224
1278
|
output: computeUsage(`$2.00 / 1M tokens`), // <- not sure
|
|
@@ -1236,6 +1290,7 @@ const OPENAI_MODELS = exportJson({
|
|
|
1236
1290
|
modelVariant: 'CHAT',
|
|
1237
1291
|
modelTitle: 'gpt-3.5-turbo-16k',
|
|
1238
1292
|
modelName: 'gpt-3.5-turbo-16k',
|
|
1293
|
+
modelDescription: 'GPT-3.5 Turbo with extended 16k token context length for handling longer conversations and documents.',
|
|
1239
1294
|
pricing: {
|
|
1240
1295
|
prompt: computeUsage(`$3.00 / 1M tokens`),
|
|
1241
1296
|
output: computeUsage(`$4.00 / 1M tokens`),
|
|
@@ -1259,6 +1314,7 @@ const OPENAI_MODELS = exportJson({
|
|
|
1259
1314
|
modelVariant: 'CHAT',
|
|
1260
1315
|
modelTitle: 'gpt-4',
|
|
1261
1316
|
modelName: 'gpt-4',
|
|
1317
|
+
modelDescription: 'GPT-4 is a powerful language model with enhanced reasoning, instruction-following capabilities, and 8K context window. Optimized for complex tasks requiring deep understanding.',
|
|
1262
1318
|
pricing: {
|
|
1263
1319
|
prompt: computeUsage(`$30.00 / 1M tokens`),
|
|
1264
1320
|
output: computeUsage(`$60.00 / 1M tokens`),
|
|
@@ -1270,6 +1326,7 @@ const OPENAI_MODELS = exportJson({
|
|
|
1270
1326
|
modelVariant: 'CHAT',
|
|
1271
1327
|
modelTitle: 'gpt-4-32k',
|
|
1272
1328
|
modelName: 'gpt-4-32k',
|
|
1329
|
+
modelDescription: 'Extended context version of GPT-4 with a 32K token window for processing very long inputs and generating comprehensive responses for complex tasks.',
|
|
1273
1330
|
pricing: {
|
|
1274
1331
|
prompt: computeUsage(`$60.00 / 1M tokens`),
|
|
1275
1332
|
output: computeUsage(`$120.00 / 1M tokens`),
|
|
@@ -1292,6 +1349,7 @@ const OPENAI_MODELS = exportJson({
|
|
|
1292
1349
|
modelVariant: 'CHAT',
|
|
1293
1350
|
modelTitle: 'gpt-4-turbo-2024-04-09',
|
|
1294
1351
|
modelName: 'gpt-4-turbo-2024-04-09',
|
|
1352
|
+
modelDescription: 'Latest stable GPT-4 Turbo model from April 2024 with enhanced reasoning and context handling capabilities. Offers 128K context window and improved performance.',
|
|
1295
1353
|
pricing: {
|
|
1296
1354
|
prompt: computeUsage(`$10.00 / 1M tokens`),
|
|
1297
1355
|
output: computeUsage(`$30.00 / 1M tokens`),
|
|
@@ -1303,6 +1361,7 @@ const OPENAI_MODELS = exportJson({
|
|
|
1303
1361
|
modelVariant: 'CHAT',
|
|
1304
1362
|
modelTitle: 'gpt-3.5-turbo-1106',
|
|
1305
1363
|
modelName: 'gpt-3.5-turbo-1106',
|
|
1364
|
+
modelDescription: 'November 2023 version of GPT-3.5 Turbo with improved instruction following and a 16K token context window.',
|
|
1306
1365
|
pricing: {
|
|
1307
1366
|
prompt: computeUsage(`$1.00 / 1M tokens`),
|
|
1308
1367
|
output: computeUsage(`$2.00 / 1M tokens`),
|
|
@@ -1314,6 +1373,7 @@ const OPENAI_MODELS = exportJson({
|
|
|
1314
1373
|
modelVariant: 'CHAT',
|
|
1315
1374
|
modelTitle: 'gpt-4-turbo',
|
|
1316
1375
|
modelName: 'gpt-4-turbo',
|
|
1376
|
+
modelDescription: 'More capable model than GPT-4 with improved instruction following, function calling and a 128K token context window for handling very large documents.',
|
|
1317
1377
|
pricing: {
|
|
1318
1378
|
prompt: computeUsage(`$10.00 / 1M tokens`),
|
|
1319
1379
|
output: computeUsage(`$30.00 / 1M tokens`),
|
|
@@ -1325,6 +1385,7 @@ const OPENAI_MODELS = exportJson({
|
|
|
1325
1385
|
modelVariant: 'COMPLETION',
|
|
1326
1386
|
modelTitle: 'gpt-3.5-turbo-instruct-0914',
|
|
1327
1387
|
modelName: 'gpt-3.5-turbo-instruct-0914',
|
|
1388
|
+
modelDescription: 'September 2023 version of GPT-3.5 Turbo optimized for completion-style instruction following with a 4K context window.',
|
|
1328
1389
|
pricing: {
|
|
1329
1390
|
prompt: computeUsage(`$1.50 / 1M tokens`),
|
|
1330
1391
|
output: computeUsage(`$2.00 / 1M tokens`), // <- For gpt-3.5-turbo-instruct
|
|
@@ -1336,6 +1397,7 @@ const OPENAI_MODELS = exportJson({
|
|
|
1336
1397
|
modelVariant: 'COMPLETION',
|
|
1337
1398
|
modelTitle: 'gpt-3.5-turbo-instruct',
|
|
1338
1399
|
modelName: 'gpt-3.5-turbo-instruct',
|
|
1400
|
+
modelDescription: 'Optimized version of GPT-3.5 for completion-style API with good instruction following and a 4K token context window.',
|
|
1339
1401
|
pricing: {
|
|
1340
1402
|
prompt: computeUsage(`$1.50 / 1M tokens`),
|
|
1341
1403
|
output: computeUsage(`$2.00 / 1M tokens`),
|
|
@@ -1353,6 +1415,7 @@ const OPENAI_MODELS = exportJson({
|
|
|
1353
1415
|
modelVariant: 'CHAT',
|
|
1354
1416
|
modelTitle: 'gpt-3.5-turbo',
|
|
1355
1417
|
modelName: 'gpt-3.5-turbo',
|
|
1418
|
+
modelDescription: 'Latest version of GPT-3.5 Turbo with improved performance and instruction following capabilities. Default 4K context window with options for 16K.',
|
|
1356
1419
|
pricing: {
|
|
1357
1420
|
prompt: computeUsage(`$3.00 / 1M tokens`),
|
|
1358
1421
|
output: computeUsage(`$6.00 / 1M tokens`), // <- Not sure, refer to gpt-3.5-turbo in Fine-tuning models
|
|
@@ -1364,6 +1427,7 @@ const OPENAI_MODELS = exportJson({
|
|
|
1364
1427
|
modelVariant: 'CHAT',
|
|
1365
1428
|
modelTitle: 'gpt-3.5-turbo-0301',
|
|
1366
1429
|
modelName: 'gpt-3.5-turbo-0301',
|
|
1430
|
+
modelDescription: 'March 2023 version of GPT-3.5 Turbo with a 4K token context window. Legacy model maintained for backward compatibility.',
|
|
1367
1431
|
pricing: {
|
|
1368
1432
|
prompt: computeUsage(`$1.50 / 1M tokens`),
|
|
1369
1433
|
output: computeUsage(`$2.00 / 1M tokens`),
|
|
@@ -1375,6 +1439,7 @@ const OPENAI_MODELS = exportJson({
|
|
|
1375
1439
|
modelVariant: 'COMPLETION',
|
|
1376
1440
|
modelTitle: 'babbage-002',
|
|
1377
1441
|
modelName: 'babbage-002',
|
|
1442
|
+
modelDescription: 'Efficient legacy completion model with a good balance of performance and speed. Suitable for straightforward text generation tasks.',
|
|
1378
1443
|
pricing: {
|
|
1379
1444
|
prompt: computeUsage(`$0.40 / 1M tokens`),
|
|
1380
1445
|
output: computeUsage(`$0.40 / 1M tokens`), // <- Not sure
|
|
@@ -1386,6 +1451,7 @@ const OPENAI_MODELS = exportJson({
|
|
|
1386
1451
|
modelVariant: 'CHAT',
|
|
1387
1452
|
modelTitle: 'gpt-4-1106-preview',
|
|
1388
1453
|
modelName: 'gpt-4-1106-preview',
|
|
1454
|
+
modelDescription: 'November 2023 preview version of GPT-4 Turbo with improved instruction following and a 128K token context window.',
|
|
1389
1455
|
pricing: {
|
|
1390
1456
|
prompt: computeUsage(`$10.00 / 1M tokens`),
|
|
1391
1457
|
output: computeUsage(`$30.00 / 1M tokens`),
|
|
@@ -1397,6 +1463,7 @@ const OPENAI_MODELS = exportJson({
|
|
|
1397
1463
|
modelVariant: 'CHAT',
|
|
1398
1464
|
modelTitle: 'gpt-4-0125-preview',
|
|
1399
1465
|
modelName: 'gpt-4-0125-preview',
|
|
1466
|
+
modelDescription: 'January 2024 preview version of GPT-4 Turbo with improved reasoning capabilities and a 128K token context window.',
|
|
1400
1467
|
pricing: {
|
|
1401
1468
|
prompt: computeUsage(`$10.00 / 1M tokens`),
|
|
1402
1469
|
output: computeUsage(`$30.00 / 1M tokens`),
|
|
@@ -1414,6 +1481,7 @@ const OPENAI_MODELS = exportJson({
|
|
|
1414
1481
|
modelVariant: 'CHAT',
|
|
1415
1482
|
modelTitle: 'gpt-3.5-turbo-0125',
|
|
1416
1483
|
modelName: 'gpt-3.5-turbo-0125',
|
|
1484
|
+
modelDescription: 'January 2024 version of GPT-3.5 Turbo with improved reasoning capabilities and a 16K token context window.',
|
|
1417
1485
|
pricing: {
|
|
1418
1486
|
prompt: computeUsage(`$0.50 / 1M tokens`),
|
|
1419
1487
|
output: computeUsage(`$1.50 / 1M tokens`),
|
|
@@ -1425,6 +1493,7 @@ const OPENAI_MODELS = exportJson({
|
|
|
1425
1493
|
modelVariant: 'CHAT',
|
|
1426
1494
|
modelTitle: 'gpt-4-turbo-preview',
|
|
1427
1495
|
modelName: 'gpt-4-turbo-preview',
|
|
1496
|
+
modelDescription: 'Preview version of GPT-4 Turbo that points to the latest model version. Features improved instruction following, 128K token context window and lower latency.',
|
|
1428
1497
|
pricing: {
|
|
1429
1498
|
prompt: computeUsage(`$10.00 / 1M tokens`),
|
|
1430
1499
|
output: computeUsage(`$30.00 / 1M tokens`), // <- Not sure, just for gpt-4-turbo
|
|
@@ -1436,6 +1505,7 @@ const OPENAI_MODELS = exportJson({
|
|
|
1436
1505
|
modelVariant: 'EMBEDDING',
|
|
1437
1506
|
modelTitle: 'text-embedding-3-large',
|
|
1438
1507
|
modelName: 'text-embedding-3-large',
|
|
1508
|
+
modelDescription: "OpenAI's most capable text embedding model designed for high-quality embeddings for complex similarity tasks and information retrieval.",
|
|
1439
1509
|
pricing: {
|
|
1440
1510
|
prompt: computeUsage(`$0.13 / 1M tokens`),
|
|
1441
1511
|
// TODO: [🏏] Leverage the batch API @see https://platform.openai.com/docs/guides/batch
|
|
@@ -1448,6 +1518,7 @@ const OPENAI_MODELS = exportJson({
|
|
|
1448
1518
|
modelVariant: 'EMBEDDING',
|
|
1449
1519
|
modelTitle: 'text-embedding-3-small',
|
|
1450
1520
|
modelName: 'text-embedding-3-small',
|
|
1521
|
+
modelDescription: 'Cost-effective embedding model with good performance for simpler tasks like text similarity and retrieval. Good balance of quality and efficiency.',
|
|
1451
1522
|
pricing: {
|
|
1452
1523
|
prompt: computeUsage(`$0.02 / 1M tokens`),
|
|
1453
1524
|
// TODO: [🏏] Leverage the batch API @see https://platform.openai.com/docs/guides/batch
|
|
@@ -1460,6 +1531,7 @@ const OPENAI_MODELS = exportJson({
|
|
|
1460
1531
|
modelVariant: 'CHAT',
|
|
1461
1532
|
modelTitle: 'gpt-3.5-turbo-0613',
|
|
1462
1533
|
modelName: 'gpt-3.5-turbo-0613',
|
|
1534
|
+
modelDescription: 'June 2023 version of GPT-3.5 Turbo with function calling capabilities and a 4K token context window.',
|
|
1463
1535
|
pricing: {
|
|
1464
1536
|
prompt: computeUsage(`$1.50 / 1M tokens`),
|
|
1465
1537
|
output: computeUsage(`$2.00 / 1M tokens`),
|
|
@@ -1471,6 +1543,7 @@ const OPENAI_MODELS = exportJson({
|
|
|
1471
1543
|
modelVariant: 'EMBEDDING',
|
|
1472
1544
|
modelTitle: 'text-embedding-ada-002',
|
|
1473
1545
|
modelName: 'text-embedding-ada-002',
|
|
1546
|
+
modelDescription: 'Legacy text embedding model suitable for text similarity and retrieval augmented generation use cases. Replaced by newer embedding-3 models.',
|
|
1474
1547
|
pricing: {
|
|
1475
1548
|
prompt: computeUsage(`$0.1 / 1M tokens`),
|
|
1476
1549
|
// TODO: [🏏] Leverage the batch API @see https://platform.openai.com/docs/guides/batch
|
|
@@ -1501,11 +1574,11 @@ const OPENAI_MODELS = exportJson({
|
|
|
1501
1574
|
modelVariant: 'CHAT',
|
|
1502
1575
|
modelTitle: 'gpt-4o-2024-05-13',
|
|
1503
1576
|
modelName: 'gpt-4o-2024-05-13',
|
|
1577
|
+
modelDescription: 'May 2024 version of GPT-4o with enhanced multimodal capabilities, improved reasoning, and optimized for vision, audio and chat at lower latencies.',
|
|
1504
1578
|
pricing: {
|
|
1505
1579
|
prompt: computeUsage(`$5.00 / 1M tokens`),
|
|
1506
1580
|
output: computeUsage(`$15.00 / 1M tokens`),
|
|
1507
1581
|
},
|
|
1508
|
-
//TODO: [main] !!3 Add gpt-4o-mini-2024-07-18 and all others to be up to date
|
|
1509
1582
|
},
|
|
1510
1583
|
/**/
|
|
1511
1584
|
/**/
|
|
@@ -1513,6 +1586,7 @@ const OPENAI_MODELS = exportJson({
|
|
|
1513
1586
|
modelVariant: 'CHAT',
|
|
1514
1587
|
modelTitle: 'gpt-4o',
|
|
1515
1588
|
modelName: 'gpt-4o',
|
|
1589
|
+
modelDescription: "OpenAI's most advanced multimodal model optimized for performance, speed, and cost. Capable of vision, reasoning, and high quality text generation.",
|
|
1516
1590
|
pricing: {
|
|
1517
1591
|
prompt: computeUsage(`$5.00 / 1M tokens`),
|
|
1518
1592
|
output: computeUsage(`$15.00 / 1M tokens`),
|
|
@@ -1520,10 +1594,23 @@ const OPENAI_MODELS = exportJson({
|
|
|
1520
1594
|
},
|
|
1521
1595
|
/**/
|
|
1522
1596
|
/**/
|
|
1597
|
+
{
|
|
1598
|
+
modelVariant: 'CHAT',
|
|
1599
|
+
modelTitle: 'gpt-4o-mini',
|
|
1600
|
+
modelName: 'gpt-4o-mini',
|
|
1601
|
+
modelDescription: 'Smaller, more cost-effective version of GPT-4o with good performance across text, vision, and audio tasks at reduced complexity.',
|
|
1602
|
+
pricing: {
|
|
1603
|
+
prompt: computeUsage(`$3.00 / 1M tokens`),
|
|
1604
|
+
output: computeUsage(`$9.00 / 1M tokens`),
|
|
1605
|
+
},
|
|
1606
|
+
},
|
|
1607
|
+
/**/
|
|
1608
|
+
/**/
|
|
1523
1609
|
{
|
|
1524
1610
|
modelVariant: 'CHAT',
|
|
1525
1611
|
modelTitle: 'o1-preview',
|
|
1526
1612
|
modelName: 'o1-preview',
|
|
1613
|
+
modelDescription: 'Advanced reasoning model with exceptional performance on complex logical, mathematical, and analytical tasks. Built for deep reasoning and specialized professional tasks.',
|
|
1527
1614
|
pricing: {
|
|
1528
1615
|
prompt: computeUsage(`$15.00 / 1M tokens`),
|
|
1529
1616
|
output: computeUsage(`$60.00 / 1M tokens`),
|
|
@@ -1535,6 +1622,7 @@ const OPENAI_MODELS = exportJson({
|
|
|
1535
1622
|
modelVariant: 'CHAT',
|
|
1536
1623
|
modelTitle: 'o1-preview-2024-09-12',
|
|
1537
1624
|
modelName: 'o1-preview-2024-09-12',
|
|
1625
|
+
modelDescription: 'September 2024 version of O1 preview with specialized reasoning capabilities for complex tasks requiring precise analytical thinking.',
|
|
1538
1626
|
// <- TODO: [💩] Some better system to organize theese date suffixes and versions
|
|
1539
1627
|
pricing: {
|
|
1540
1628
|
prompt: computeUsage(`$15.00 / 1M tokens`),
|
|
@@ -1547,6 +1635,7 @@ const OPENAI_MODELS = exportJson({
|
|
|
1547
1635
|
modelVariant: 'CHAT',
|
|
1548
1636
|
modelTitle: 'o1-mini',
|
|
1549
1637
|
modelName: 'o1-mini',
|
|
1638
|
+
modelDescription: 'Smaller, cost-effective version of the O1 model with good performance on reasoning tasks while maintaining efficiency for everyday analytical use.',
|
|
1550
1639
|
pricing: {
|
|
1551
1640
|
prompt: computeUsage(`$3.00 / 1M tokens`),
|
|
1552
1641
|
output: computeUsage(`$12.00 / 1M tokens`),
|
|
@@ -1570,6 +1659,7 @@ const OPENAI_MODELS = exportJson({
|
|
|
1570
1659
|
modelVariant: 'CHAT',
|
|
1571
1660
|
modelTitle: 'o3-mini',
|
|
1572
1661
|
modelName: 'o3-mini',
|
|
1662
|
+
modelDescription: 'Compact and efficient reasoning model specializing in problem-solving with a focus on research and analysis tasks.',
|
|
1573
1663
|
pricing: {
|
|
1574
1664
|
prompt: computeUsage(`$3.00 / 1M tokens`),
|
|
1575
1665
|
output: computeUsage(`$12.00 / 1M tokens`),
|
|
@@ -1582,6 +1672,7 @@ const OPENAI_MODELS = exportJson({
|
|
|
1582
1672
|
modelVariant: 'CHAT',
|
|
1583
1673
|
modelTitle: 'o1-mini-2024-09-12',
|
|
1584
1674
|
modelName: 'o1-mini-2024-09-12',
|
|
1675
|
+
modelDescription: "September 2024 version of O1-mini with balanced reasoning capabilities and cost-efficiency. Good for analytical tasks that don't require the full O1 model.",
|
|
1585
1676
|
pricing: {
|
|
1586
1677
|
prompt: computeUsage(`$3.00 / 1M tokens`),
|
|
1587
1678
|
output: computeUsage(`$12.00 / 1M tokens`),
|
|
@@ -1593,12 +1684,14 @@ const OPENAI_MODELS = exportJson({
|
|
|
1593
1684
|
modelVariant: 'CHAT',
|
|
1594
1685
|
modelTitle: 'gpt-3.5-turbo-16k-0613',
|
|
1595
1686
|
modelName: 'gpt-3.5-turbo-16k-0613',
|
|
1687
|
+
modelDescription: 'June 2023 version of GPT-3.5 Turbo with extended 16k token context window for processing longer conversations and documents.',
|
|
1596
1688
|
pricing: {
|
|
1597
1689
|
prompt: computeUsage(`$3.00 / 1M tokens`),
|
|
1598
1690
|
output: computeUsage(`$4.00 / 1M tokens`),
|
|
1599
1691
|
},
|
|
1600
1692
|
},
|
|
1601
1693
|
/**/
|
|
1694
|
+
// <- [🕕]
|
|
1602
1695
|
],
|
|
1603
1696
|
});
|
|
1604
1697
|
/**
|
|
@@ -1781,6 +1874,7 @@ class OpenAiExecutionTools {
|
|
|
1781
1874
|
console.info(colors.bgWhite('rawRequest'), JSON.stringify(rawRequest, null, 4));
|
|
1782
1875
|
}
|
|
1783
1876
|
const rawResponse = await client.chat.completions.create(rawRequest).catch((error) => {
|
|
1877
|
+
assertsError(error);
|
|
1784
1878
|
if (this.options.isVerbose) {
|
|
1785
1879
|
console.info(colors.bgRed('error'), error);
|
|
1786
1880
|
}
|
|
@@ -1857,6 +1951,7 @@ class OpenAiExecutionTools {
|
|
|
1857
1951
|
console.info(colors.bgWhite('rawRequest'), JSON.stringify(rawRequest, null, 4));
|
|
1858
1952
|
}
|
|
1859
1953
|
const rawResponse = await client.completions.create(rawRequest).catch((error) => {
|
|
1954
|
+
assertsError(error);
|
|
1860
1955
|
if (this.options.isVerbose) {
|
|
1861
1956
|
console.info(colors.bgRed('error'), error);
|
|
1862
1957
|
}
|
|
@@ -1920,6 +2015,7 @@ class OpenAiExecutionTools {
|
|
|
1920
2015
|
console.info(colors.bgWhite('rawRequest'), JSON.stringify(rawRequest, null, 4));
|
|
1921
2016
|
}
|
|
1922
2017
|
const rawResponse = await client.embeddings.create(rawRequest).catch((error) => {
|
|
2018
|
+
assertsError(error);
|
|
1923
2019
|
if (this.options.isVerbose) {
|
|
1924
2020
|
console.info(colors.bgRed('error'), error);
|
|
1925
2021
|
}
|