@promptbook/core 0.77.0-5 → 0.77.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -4
- package/esm/index.es.js +92 -30
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/types.index.d.ts +2 -0
- package/esm/typings/src/execution/AvailableModel.d.ts +17 -3
- package/esm/typings/src/execution/LlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsConfigurationFromEnv.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/register/$registeredLlmToolsMessage.d.ts +1 -0
- package/esm/typings/src/llm-providers/_common/register/LlmToolsMetadata.d.ts +6 -3
- package/esm/typings/src/llm-providers/google/GoogleExecutionToolsOptions.d.ts +3 -6
- package/esm/typings/src/llm-providers/google/createGoogleExecutionTools.d.ts +0 -4
- package/esm/typings/src/llm-providers/vercel/VercelExecutionToolsOptions.d.ts +2 -1
- package/esm/typings/src/llm-providers/vercel/createExecutionToolsFromVercelProvider.d.ts +1 -1
- package/esm/typings/src/types/typeAliases.d.ts +7 -1
- package/esm/typings/src/utils/serialization/asSerializable.d.ts +11 -0
- package/esm/typings/src/utils/serialization/asSerializable.test.d.ts +1 -0
- package/package.json +2 -1
- package/umd/index.umd.js +96 -34
- package/umd/index.umd.js.map +1 -1
|
@@ -145,6 +145,7 @@ import type { string_reserved_parameter_name } from '../types/typeAliases';
|
|
|
145
145
|
import type { ReservedParameters } from '../types/typeAliases';
|
|
146
146
|
import type { string_title } from '../types/typeAliases';
|
|
147
147
|
import type { string_persona_description } from '../types/typeAliases';
|
|
148
|
+
import type { string_model_description } from '../types/typeAliases';
|
|
148
149
|
import type { string_knowledge_source_content } from '../types/typeAliases';
|
|
149
150
|
import type { string_knowledge_source_link } from '../types/typeAliases';
|
|
150
151
|
import type { string_html } from '../types/typeAliases';
|
|
@@ -402,6 +403,7 @@ export type { string_reserved_parameter_name };
|
|
|
402
403
|
export type { ReservedParameters };
|
|
403
404
|
export type { string_title };
|
|
404
405
|
export type { string_persona_description };
|
|
406
|
+
export type { string_model_description };
|
|
405
407
|
export type { string_knowledge_source_content };
|
|
406
408
|
export type { string_knowledge_source_link };
|
|
407
409
|
export type { string_html };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ModelVariant } from '../types/ModelVariant';
|
|
2
|
+
import type { string_model_description } from '../types/typeAliases';
|
|
2
3
|
import type { string_model_name } from '../types/typeAliases';
|
|
3
4
|
import type { string_title } from '../types/typeAliases';
|
|
4
5
|
/**
|
|
@@ -6,19 +7,32 @@ import type { string_title } from '../types/typeAliases';
|
|
|
6
7
|
*/
|
|
7
8
|
export type AvailableModel = {
|
|
8
9
|
/**
|
|
9
|
-
* The model title
|
|
10
|
+
* The model title, when not provided, the `modelName` should be used
|
|
11
|
+
*
|
|
12
|
+
* @example "GPT o1"
|
|
10
13
|
*/
|
|
11
14
|
readonly modelTitle?: string_title;
|
|
12
15
|
/**
|
|
13
16
|
* The model name aviailable
|
|
17
|
+
*
|
|
18
|
+
* @example "o1"
|
|
14
19
|
*/
|
|
15
20
|
readonly modelName: string_model_name;
|
|
16
21
|
/**
|
|
17
22
|
* Variant of the model
|
|
23
|
+
*
|
|
24
|
+
* @example "CHAT"
|
|
18
25
|
*/
|
|
19
26
|
readonly modelVariant: ModelVariant;
|
|
27
|
+
/**
|
|
28
|
+
* Unstructured description of the model
|
|
29
|
+
*
|
|
30
|
+
* This will be used to pick the best available model for each task
|
|
31
|
+
*
|
|
32
|
+
* @example "Model with 1 billion parameters and advanced reasoning capabilities"
|
|
33
|
+
*/
|
|
34
|
+
readonly modelDescription?: string_model_description;
|
|
20
35
|
};
|
|
21
36
|
/**
|
|
22
|
-
* TODO:
|
|
23
|
-
* TODO: !!!!!! Put pricing information here
|
|
37
|
+
* TODO: (not only [🕘]) Put pricing information here
|
|
24
38
|
*/
|
package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsConfigurationFromEnv.d.ts
CHANGED
|
@@ -21,5 +21,5 @@ export declare function $provideLlmToolsConfigurationFromEnv(): LlmToolsConfigur
|
|
|
21
21
|
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
22
22
|
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
23
23
|
* TODO: This should be maybe not under `_common` but under `utils`
|
|
24
|
-
* TODO: [🧠] Maybe pass env as argument
|
|
24
|
+
* TODO: [🧠][⚛] Maybe pass env as argument
|
|
25
25
|
* TODO: [®] DRY Register logic */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { string_SCREAMING_CASE } from '../../../utils/normalization/normalizeTo_SCREAMING_CASE';
|
|
2
1
|
import type { string_name } from '../../../types/typeAliases';
|
|
3
2
|
import type { string_title } from '../../../types/typeAliases';
|
|
4
3
|
import type { Registered } from '../../../utils/$Register';
|
|
4
|
+
import type { string_SCREAMING_CASE } from '../../../utils/normalization/normalizeTo_SCREAMING_CASE';
|
|
5
5
|
import type { LlmToolsConfiguration } from './LlmToolsConfiguration';
|
|
6
6
|
/**
|
|
7
7
|
* @@@
|
|
@@ -14,9 +14,12 @@ export type LlmToolsMetadata = Registered & {
|
|
|
14
14
|
*/
|
|
15
15
|
readonly title: string_title;
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* List of environment variables that can be used to configure the provider
|
|
18
|
+
*
|
|
19
|
+
* If `[]`, empty array, it means that the provider is available automatically without any configuration
|
|
20
|
+
* If `null`, it means that the provider can not be configured via environment variables
|
|
18
21
|
*/
|
|
19
|
-
readonly envVariables: ReadonlyArray<string_name & string_SCREAMING_CASE
|
|
22
|
+
readonly envVariables: ReadonlyArray<string_name & string_SCREAMING_CASE> | null;
|
|
20
23
|
/**
|
|
21
24
|
* @@@
|
|
22
25
|
*/
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import type { createGoogleGenerativeAI } from '@ai-sdk/google';
|
|
2
|
-
import type {
|
|
2
|
+
import type { VercelExecutionToolsOptions } from '../vercel/VercelExecutionToolsOptions';
|
|
3
3
|
/**
|
|
4
4
|
* Options for `GoogleExecutionTools`
|
|
5
5
|
*
|
|
6
|
-
*
|
|
6
|
+
* This combines options for Promptbook, Google and Vercel together
|
|
7
7
|
* @public exported from `@promptbook/google`
|
|
8
8
|
*/
|
|
9
|
-
export type GoogleExecutionToolsOptions =
|
|
10
|
-
/**
|
|
11
|
-
* TODO: [🧠][🤺] Pass `userId`
|
|
12
|
-
*/
|
|
9
|
+
export type GoogleExecutionToolsOptions = Omit<VercelExecutionToolsOptions, 'title' | 'description' | 'vercelProvider' | 'availableModels'> & Parameters<typeof createGoogleGenerativeAI>[0];
|
|
@@ -10,9 +10,5 @@ export declare const createGoogleExecutionTools: ((options: GoogleExecutionTools
|
|
|
10
10
|
className: string;
|
|
11
11
|
};
|
|
12
12
|
/**
|
|
13
|
-
* TODO: [🧠][main] !!!! Make anonymous this with all LLM providers
|
|
14
|
-
* TODO: [🧠][🧱][main] !!!! Maybe change all `new GoogleExecutionTools` -> `createGoogleExecutionTools` in manual
|
|
15
|
-
* TODO: [🧠] Maybe auto-detect usage in browser and determine default value of `isProxied`
|
|
16
|
-
* TODO: [🦺] Is there some way how to put `packageName` and `className` on top and function definition on bottom?
|
|
17
13
|
* TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
|
|
18
14
|
*/
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { AvailableModel } from '../../execution/AvailableModel';
|
|
2
2
|
import type { CommonToolsOptions } from '../../execution/CommonToolsOptions';
|
|
3
|
+
import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
|
|
3
4
|
import type { VercelProvider } from './VercelProvider';
|
|
4
5
|
/**
|
|
5
6
|
* Options for `createExecutionToolsFromVercelProvider`
|
|
6
7
|
*
|
|
7
8
|
* @public exported from `@promptbook/google`
|
|
8
9
|
*/
|
|
9
|
-
export type VercelExecutionToolsOptions = CommonToolsOptions & {
|
|
10
|
+
export type VercelExecutionToolsOptions = CommonToolsOptions & Pick<LlmExecutionTools, 'title' | 'description'> & {
|
|
10
11
|
/**
|
|
11
12
|
* Vercel provider for the execution tools
|
|
12
13
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
|
|
2
2
|
import type { VercelExecutionToolsOptions } from './VercelExecutionToolsOptions';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Adapter which creates Promptbook execution tools from Vercel provider
|
|
5
5
|
*
|
|
6
6
|
* @public exported from `@promptbook/vercel`
|
|
7
7
|
*/
|
|
@@ -128,11 +128,17 @@ export type ReservedParameters = Record<string_reserved_parameter_name, string_p
|
|
|
128
128
|
*/
|
|
129
129
|
export type string_title = string;
|
|
130
130
|
/**
|
|
131
|
-
*
|
|
131
|
+
* Unstructured description of the persona
|
|
132
132
|
*
|
|
133
133
|
* For example `"Skilled copywriter"`
|
|
134
134
|
*/
|
|
135
135
|
export type string_persona_description = string;
|
|
136
|
+
/**
|
|
137
|
+
* Unstructured description of the model
|
|
138
|
+
*
|
|
139
|
+
* For example `"Model with logical reasoning and creative mindset"`
|
|
140
|
+
*/
|
|
141
|
+
export type string_model_description = string;
|
|
136
142
|
/**
|
|
137
143
|
* Source of one knowledge
|
|
138
144
|
*
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { really_any } from '../organization/really_any';
|
|
2
|
+
/**
|
|
3
|
+
* Function `asSerializable` will convert values which are not serializable to serializable values
|
|
4
|
+
* It walks deeply through the object and converts all values
|
|
5
|
+
*
|
|
6
|
+
* For example:
|
|
7
|
+
* - `Date` objects will be converted to string
|
|
8
|
+
*
|
|
9
|
+
* @private Internal helper function
|
|
10
|
+
*/
|
|
11
|
+
export declare function asSerializable(value: really_any): really_any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/core",
|
|
3
|
-
"version": "0.77.0
|
|
3
|
+
"version": "0.77.0",
|
|
4
4
|
"description": "It's time for a paradigm shift. The future of software in plain English, French or Latin",
|
|
5
5
|
"--note-0": " <- [🐊]",
|
|
6
6
|
"private": false,
|
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
"module": "./esm/index.es.js",
|
|
55
55
|
"typings": "./esm/typings/src/_packages/core.index.d.ts",
|
|
56
56
|
"dependencies": {
|
|
57
|
+
"colors": "1.4.0",
|
|
57
58
|
"crypto-js": "4.2.0",
|
|
58
59
|
"moment": "2.30.1",
|
|
59
60
|
"papaparse": "5.4.1",
|
package/umd/index.umd.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('spacetrim'), require('prettier'), require('prettier/parser-html'), require('waitasecond'), require('papaparse'), require('path'), require('crypto-js'), require('crypto-js/enc-hex'), require('mime-types'), require('moment'), require('crypto-js/sha256')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'spacetrim', 'prettier', 'prettier/parser-html', 'waitasecond', 'papaparse', 'path', 'crypto-js', 'crypto-js/enc-hex', 'mime-types', 'moment', 'crypto-js/sha256'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-core"] = {}, global.spaceTrim, global.prettier, global.parserHtml, global.waitasecond, global.papaparse, global.path, global.cryptoJs, global.hexEncoder, global.mimeTypes, global.moment, global.sha256));
|
|
5
|
-
})(this, (function (exports, spaceTrim, prettier, parserHtml, waitasecond, papaparse, path, cryptoJs, hexEncoder, mimeTypes, moment, sha256) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('spacetrim'), require('prettier'), require('prettier/parser-html'), require('waitasecond'), require('papaparse'), require('path'), require('crypto-js'), require('crypto-js/enc-hex'), require('mime-types'), require('moment'), require('colors'), require('crypto-js/sha256')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'spacetrim', 'prettier', 'prettier/parser-html', 'waitasecond', 'papaparse', 'path', 'crypto-js', 'crypto-js/enc-hex', 'mime-types', 'moment', 'colors', 'crypto-js/sha256'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-core"] = {}, global.spaceTrim, global.prettier, global.parserHtml, global.waitasecond, global.papaparse, global.path, global.cryptoJs, global.hexEncoder, global.mimeTypes, global.moment, global.colors, global.sha256));
|
|
5
|
+
})(this, (function (exports, spaceTrim, prettier, parserHtml, waitasecond, papaparse, path, cryptoJs, hexEncoder, mimeTypes, moment, colors, sha256) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
var parserHtml__default = /*#__PURE__*/_interopDefaultLegacy(parserHtml);
|
|
11
11
|
var hexEncoder__default = /*#__PURE__*/_interopDefaultLegacy(hexEncoder);
|
|
12
12
|
var moment__default = /*#__PURE__*/_interopDefaultLegacy(moment);
|
|
13
|
+
var colors__default = /*#__PURE__*/_interopDefaultLegacy(colors);
|
|
13
14
|
var sha256__default = /*#__PURE__*/_interopDefaultLegacy(sha256);
|
|
14
15
|
|
|
15
16
|
// ⚠️ WARNING: This code has been generated so that any manual changes will be overwritten
|
|
@@ -24,7 +25,7 @@
|
|
|
24
25
|
*
|
|
25
26
|
* @see https://github.com/webgptorg/promptbook
|
|
26
27
|
*/
|
|
27
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.77.0-
|
|
28
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.77.0-6';
|
|
28
29
|
/**
|
|
29
30
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
30
31
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -9608,6 +9609,15 @@
|
|
|
9608
9609
|
* TODO: [®] DRY Register logic
|
|
9609
9610
|
*/
|
|
9610
9611
|
|
|
9612
|
+
/**
|
|
9613
|
+
* Detects if the code is running in a Node.js environment
|
|
9614
|
+
*
|
|
9615
|
+
* Note: `$` is used to indicate that this function is not a pure function - it looks at the global object to determine the environment
|
|
9616
|
+
*
|
|
9617
|
+
* @public exported from `@promptbook/utils`
|
|
9618
|
+
*/
|
|
9619
|
+
var $isRunningInNode = new Function("\n try {\n return this === global;\n } catch (e) {\n return false;\n }\n");
|
|
9620
|
+
|
|
9611
9621
|
/**
|
|
9612
9622
|
* Creates a message with all registered LLM tools
|
|
9613
9623
|
*
|
|
@@ -9617,20 +9627,28 @@
|
|
|
9617
9627
|
*/
|
|
9618
9628
|
function $registeredLlmToolsMessage() {
|
|
9619
9629
|
var e_1, _a, e_2, _b;
|
|
9630
|
+
var env;
|
|
9631
|
+
if ($isRunningInNode()) {
|
|
9632
|
+
env = process.env;
|
|
9633
|
+
// <- TODO: [⚛] Some DRY way how to get to `process.env` and pass it into functions - ACRY search for `env`
|
|
9634
|
+
}
|
|
9635
|
+
else {
|
|
9636
|
+
env = {};
|
|
9637
|
+
}
|
|
9620
9638
|
/**
|
|
9621
9639
|
* Mixes registered LLM tools from $llmToolsMetadataRegister and $llmToolsRegister
|
|
9622
9640
|
*/
|
|
9623
9641
|
var all = [];
|
|
9624
|
-
var _loop_1 = function (packageName, className, envVariables) {
|
|
9642
|
+
var _loop_1 = function (title, packageName, className, envVariables) {
|
|
9625
9643
|
if (all.some(function (item) { return item.packageName === packageName && item.className === className; })) {
|
|
9626
9644
|
return "continue";
|
|
9627
9645
|
}
|
|
9628
|
-
all.push({ packageName: packageName, className: className, envVariables: envVariables });
|
|
9646
|
+
all.push({ title: title, packageName: packageName, className: className, envVariables: envVariables });
|
|
9629
9647
|
};
|
|
9630
9648
|
try {
|
|
9631
9649
|
for (var _c = __values($llmToolsMetadataRegister.list()), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
9632
|
-
var _e = _d.value, packageName = _e.packageName, className = _e.className, envVariables = _e.envVariables;
|
|
9633
|
-
_loop_1(packageName, className, envVariables);
|
|
9650
|
+
var _e = _d.value, title = _e.title, packageName = _e.packageName, className = _e.className, envVariables = _e.envVariables;
|
|
9651
|
+
_loop_1(title, packageName, className, envVariables);
|
|
9634
9652
|
}
|
|
9635
9653
|
}
|
|
9636
9654
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
@@ -9660,6 +9678,7 @@
|
|
|
9660
9678
|
finally { if (e_2) throw e_2.error; }
|
|
9661
9679
|
}
|
|
9662
9680
|
var metadata = all.map(function (metadata) {
|
|
9681
|
+
var _a, _b;
|
|
9663
9682
|
var isMetadataAviailable = $llmToolsMetadataRegister
|
|
9664
9683
|
.list()
|
|
9665
9684
|
.find(function (_a) {
|
|
@@ -9672,46 +9691,77 @@
|
|
|
9672
9691
|
var packageName = _a.packageName, className = _a.className;
|
|
9673
9692
|
return metadata.packageName === packageName && metadata.className === className;
|
|
9674
9693
|
});
|
|
9675
|
-
|
|
9694
|
+
var isFullyConfigured = ((_a = metadata.envVariables) === null || _a === void 0 ? void 0 : _a.every(function (envVariableName) { return env[envVariableName] !== undefined; })) || false;
|
|
9695
|
+
var isPartiallyConfigured = ((_b = metadata.envVariables) === null || _b === void 0 ? void 0 : _b.some(function (envVariableName) { return env[envVariableName] !== undefined; })) || false;
|
|
9696
|
+
// <- Note: [🗨]
|
|
9697
|
+
return __assign(__assign({}, metadata), { isMetadataAviailable: isMetadataAviailable, isInstalled: isInstalled, isFullyConfigured: isFullyConfigured, isPartiallyConfigured: isPartiallyConfigured });
|
|
9676
9698
|
});
|
|
9677
9699
|
if (metadata.length === 0) {
|
|
9678
9700
|
return "No LLM providers are available.";
|
|
9679
9701
|
}
|
|
9680
|
-
return spaceTrim__default["default"](function (block) { return "\n
|
|
9702
|
+
return spaceTrim__default["default"](function (block) { return "\n Relevant environment variables:\n ".concat(block(Object.keys(env)
|
|
9703
|
+
.filter(function (envVariableName) {
|
|
9704
|
+
return metadata.some(function (_a) {
|
|
9705
|
+
var envVariables = _a.envVariables;
|
|
9706
|
+
return envVariables === null || envVariables === void 0 ? void 0 : envVariables.includes(envVariableName);
|
|
9707
|
+
});
|
|
9708
|
+
})
|
|
9709
|
+
.map(function (envVariableName) { return "- `".concat(envVariableName, "`"); })
|
|
9710
|
+
.join('\n')), "\n\n Available LLM providers are:\n ").concat(block(metadata
|
|
9681
9711
|
.map(function (_a, i) {
|
|
9682
|
-
var packageName = _a.packageName, className = _a.className, envVariables = _a.envVariables, isMetadataAviailable = _a.isMetadataAviailable, isInstalled = _a.isInstalled;
|
|
9683
|
-
var
|
|
9684
|
-
if (just(false))
|
|
9685
|
-
more = '';
|
|
9686
|
-
}
|
|
9712
|
+
var title = _a.title, packageName = _a.packageName, className = _a.className, envVariables = _a.envVariables, isMetadataAviailable = _a.isMetadataAviailable, isInstalled = _a.isInstalled, isFullyConfigured = _a.isFullyConfigured, isPartiallyConfigured = _a.isPartiallyConfigured;
|
|
9713
|
+
var morePieces = [];
|
|
9714
|
+
if (just(false)) ;
|
|
9687
9715
|
else if (!isMetadataAviailable && !isInstalled) {
|
|
9688
9716
|
// TODO: [�][�] Maybe do allow to do auto-install if package not registered and not found
|
|
9689
|
-
|
|
9717
|
+
morePieces.push("Not installed and no metadata, looks like a unexpected behavior");
|
|
9690
9718
|
}
|
|
9691
9719
|
else if (isMetadataAviailable && !isInstalled) {
|
|
9692
9720
|
// TODO: [�][�]
|
|
9693
|
-
|
|
9721
|
+
morePieces.push("Not installed");
|
|
9694
9722
|
}
|
|
9695
9723
|
else if (!isMetadataAviailable && isInstalled) {
|
|
9696
|
-
|
|
9724
|
+
morePieces.push("No metadata but installed, looks like a unexpected behavior");
|
|
9697
9725
|
}
|
|
9698
9726
|
else if (isMetadataAviailable && isInstalled) {
|
|
9699
|
-
|
|
9727
|
+
morePieces.push("Installed");
|
|
9700
9728
|
}
|
|
9701
9729
|
else {
|
|
9702
|
-
|
|
9730
|
+
morePieces.push("unknown state, looks like a unexpected behavior");
|
|
9731
|
+
} /* not else */
|
|
9732
|
+
if (isFullyConfigured) {
|
|
9733
|
+
morePieces.push("Configured");
|
|
9703
9734
|
}
|
|
9704
|
-
|
|
9705
|
-
|
|
9706
|
-
envVariablesMessage = 'Configured by ' + envVariables.join(' + ');
|
|
9735
|
+
else if (isPartiallyConfigured) {
|
|
9736
|
+
morePieces.push("Partially confugured, missing ".concat(envVariables === null || envVariables === void 0 ? void 0 : envVariables.filter(function (envVariable) { return env[envVariable] === undefined; }).join(' + ')));
|
|
9707
9737
|
}
|
|
9708
|
-
|
|
9709
|
-
|
|
9738
|
+
else {
|
|
9739
|
+
if (envVariables !== null) {
|
|
9740
|
+
morePieces.push("Not configured, to configure set env ".concat(envVariables === null || envVariables === void 0 ? void 0 : envVariables.join(' + ')));
|
|
9741
|
+
}
|
|
9742
|
+
else {
|
|
9743
|
+
morePieces.push("Not configured"); // <- Note: Can not be configured via environment variables
|
|
9744
|
+
}
|
|
9745
|
+
}
|
|
9746
|
+
var providerMessage = spaceTrim__default["default"]("\n ".concat(i + 1, ") **").concat(title, "** `").concat(className, "` from `").concat(packageName, "`\n ").concat(morePieces.join('; '), "\n "));
|
|
9747
|
+
if ($isRunningInNode) {
|
|
9748
|
+
if (isInstalled && isFullyConfigured) {
|
|
9749
|
+
providerMessage = colors__default["default"].green(providerMessage);
|
|
9750
|
+
}
|
|
9751
|
+
else if (isInstalled && isPartiallyConfigured) {
|
|
9752
|
+
providerMessage = colors__default["default"].yellow(providerMessage);
|
|
9753
|
+
}
|
|
9754
|
+
else {
|
|
9755
|
+
providerMessage = colors__default["default"].gray(providerMessage);
|
|
9756
|
+
}
|
|
9757
|
+
}
|
|
9758
|
+
return providerMessage;
|
|
9710
9759
|
})
|
|
9711
9760
|
.join('\n')), "\n "); });
|
|
9712
9761
|
}
|
|
9713
9762
|
/**
|
|
9714
9763
|
* TODO: [®] DRY Register logic
|
|
9764
|
+
* TODO: [🧠][⚛] Maybe pass env as argument
|
|
9715
9765
|
*/
|
|
9716
9766
|
|
|
9717
9767
|
/**
|
|
@@ -10062,7 +10112,23 @@
|
|
|
10062
10112
|
else if (typeof env.AZUREOPENAI_RESOURCE_NAME === 'string' ||
|
|
10063
10113
|
typeof env.AZUREOPENAI_DEPLOYMENT_NAME === 'string' ||
|
|
10064
10114
|
typeof env.AZUREOPENAI_API_KEY === 'string') {
|
|
10065
|
-
|
|
10115
|
+
return null;
|
|
10116
|
+
/*
|
|
10117
|
+
Note: [🗨] Partial configuration is handled more gracefully elsewhere
|
|
10118
|
+
> throw new Error(
|
|
10119
|
+
> spaceTrim(`
|
|
10120
|
+
> You must provide all of the following environment variables:
|
|
10121
|
+
>
|
|
10122
|
+
> - AZUREOPENAI_RESOURCE_NAME (${
|
|
10123
|
+
> typeof env.AZUREOPENAI_RESOURCE_NAME === 'string' ? 'defined' : 'not defined'
|
|
10124
|
+
> })
|
|
10125
|
+
> - AZUREOPENAI_DEPLOYMENT_NAME (${
|
|
10126
|
+
> typeof env.AZUREOPENAI_DEPLOYMENT_NAME === 'string' ? 'defined' : 'not defined'
|
|
10127
|
+
> })
|
|
10128
|
+
> - AZUREOPENAI_API_KEY (${typeof env.AZUREOPENAI_API_KEY === 'string' ? 'defined' : 'not defined'})
|
|
10129
|
+
> `),
|
|
10130
|
+
> );
|
|
10131
|
+
*/
|
|
10066
10132
|
}
|
|
10067
10133
|
return null;
|
|
10068
10134
|
},
|
|
@@ -10099,10 +10165,7 @@
|
|
|
10099
10165
|
packageName: '@promptbook/google',
|
|
10100
10166
|
className: 'GoogleExecutionTools',
|
|
10101
10167
|
options: {
|
|
10102
|
-
apiKey: '
|
|
10103
|
-
isProxied: true,
|
|
10104
|
-
remoteUrl: DEFAULT_REMOTE_URL,
|
|
10105
|
-
path: DEFAULT_REMOTE_URL_PATH,
|
|
10168
|
+
apiKey: 'AI',
|
|
10106
10169
|
},
|
|
10107
10170
|
};
|
|
10108
10171
|
},
|
|
@@ -10181,9 +10244,8 @@
|
|
|
10181
10244
|
title: 'Open AI Assistant',
|
|
10182
10245
|
packageName: '@promptbook/openai',
|
|
10183
10246
|
className: 'OpenAiAssistantExecutionTools',
|
|
10184
|
-
envVariables:
|
|
10185
|
-
|
|
10186
|
-
],
|
|
10247
|
+
envVariables: null,
|
|
10248
|
+
// <- TODO: ['OPENAI_API_KEY', 'OPENAI_ASSISTANT_ID']
|
|
10187
10249
|
getBoilerplateConfiguration: function () {
|
|
10188
10250
|
return {
|
|
10189
10251
|
title: 'Open AI Assistant (boilerplate)',
|