@promptbook/core 0.92.0-32 → 0.92.0-34
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/esm/index.es.js +67 -29
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +4 -4
- package/esm/typings/src/_packages/types.index.d.ts +2 -0
- package/esm/typings/src/execution/ExecutionTask.d.ts +19 -1
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsFromEnv.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/register/createLlmToolsFromConfiguration.d.ts +1 -1
- package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionToolsOptions.d.ts +4 -4
- package/esm/typings/src/storage/local-storage/getIndexedDbStorage.d.ts +2 -1
- package/esm/typings/src/storage/local-storage/utils/IndexedDbStorageOptions.d.ts +14 -0
- package/esm/typings/src/storage/local-storage/utils/makePromptbookStorageFromIndexedDb.d.ts +2 -1
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/umd/index.umd.js +67 -29
- package/umd/index.umd.js.map +1 -1
- /package/esm/typings/src/llm-providers/{multiple → _multiple}/MultipleLlmExecutionTools.d.ts +0 -0
- /package/esm/typings/src/llm-providers/{multiple → _multiple}/joinLlmExecutionTools.d.ts +0 -0
- /package/esm/typings/src/llm-providers/{multiple → _multiple}/playground/playground.d.ts +0 -0
|
@@ -102,12 +102,12 @@ import { createLlmToolsFromConfiguration } from '../llm-providers/_common/regist
|
|
|
102
102
|
import { cacheLlmTools } from '../llm-providers/_common/utils/cache/cacheLlmTools';
|
|
103
103
|
import { countUsage } from '../llm-providers/_common/utils/count-total-usage/countUsage';
|
|
104
104
|
import { limitTotalUsage } from '../llm-providers/_common/utils/count-total-usage/limitTotalUsage';
|
|
105
|
+
import { joinLlmExecutionTools } from '../llm-providers/_multiple/joinLlmExecutionTools';
|
|
106
|
+
import { MultipleLlmExecutionTools } from '../llm-providers/_multiple/MultipleLlmExecutionTools';
|
|
105
107
|
import { _AnthropicClaudeMetadataRegistration } from '../llm-providers/anthropic-claude/register-configuration';
|
|
106
108
|
import { _AzureOpenAiMetadataRegistration } from '../llm-providers/azure-openai/register-configuration';
|
|
107
109
|
import { _DeepseekMetadataRegistration } from '../llm-providers/deepseek/register-configuration';
|
|
108
110
|
import { _GoogleMetadataRegistration } from '../llm-providers/google/register-configuration';
|
|
109
|
-
import { joinLlmExecutionTools } from '../llm-providers/multiple/joinLlmExecutionTools';
|
|
110
|
-
import { MultipleLlmExecutionTools } from '../llm-providers/multiple/MultipleLlmExecutionTools';
|
|
111
111
|
import { _OpenAiMetadataRegistration } from '../llm-providers/openai/register-configuration';
|
|
112
112
|
import { _OpenAiAssistantMetadataRegistration } from '../llm-providers/openai/register-configuration';
|
|
113
113
|
import { migratePipeline } from '../migrations/migratePipeline';
|
|
@@ -249,12 +249,12 @@ export { createLlmToolsFromConfiguration };
|
|
|
249
249
|
export { cacheLlmTools };
|
|
250
250
|
export { countUsage };
|
|
251
251
|
export { limitTotalUsage };
|
|
252
|
+
export { joinLlmExecutionTools };
|
|
253
|
+
export { MultipleLlmExecutionTools };
|
|
252
254
|
export { _AnthropicClaudeMetadataRegistration };
|
|
253
255
|
export { _AzureOpenAiMetadataRegistration };
|
|
254
256
|
export { _DeepseekMetadataRegistration };
|
|
255
257
|
export { _GoogleMetadataRegistration };
|
|
256
|
-
export { joinLlmExecutionTools };
|
|
257
|
-
export { MultipleLlmExecutionTools };
|
|
258
258
|
export { _OpenAiMetadataRegistration };
|
|
259
259
|
export { _OpenAiAssistantMetadataRegistration };
|
|
260
260
|
export { migratePipeline };
|
|
@@ -134,6 +134,7 @@ import type { JavascriptExecutionToolsOptions } from '../scripting/javascript/Ja
|
|
|
134
134
|
import type { PostprocessingFunction } from '../scripting/javascript/JavascriptExecutionToolsOptions';
|
|
135
135
|
import type { PromptbookStorage } from '../storage/_common/PromptbookStorage';
|
|
136
136
|
import type { FileCacheStorageOptions } from '../storage/file-cache-storage/FileCacheStorageOptions';
|
|
137
|
+
import type { IndexedDbStorageOptions } from '../storage/local-storage/utils/IndexedDbStorageOptions';
|
|
137
138
|
import type { IntermediateFilesStrategy } from '../types/IntermediateFilesStrategy';
|
|
138
139
|
import type { ModelRequirements } from '../types/ModelRequirements';
|
|
139
140
|
import type { CompletionModelRequirements } from '../types/ModelRequirements';
|
|
@@ -431,6 +432,7 @@ export type { JavascriptExecutionToolsOptions };
|
|
|
431
432
|
export type { PostprocessingFunction };
|
|
432
433
|
export type { PromptbookStorage };
|
|
433
434
|
export type { FileCacheStorageOptions };
|
|
435
|
+
export type { IndexedDbStorageOptions };
|
|
434
436
|
export type { IntermediateFilesStrategy };
|
|
435
437
|
export type { ModelRequirements };
|
|
436
438
|
export type { CompletionModelRequirements };
|
|
@@ -2,6 +2,7 @@ import type { Observable } from 'rxjs';
|
|
|
2
2
|
import { PartialDeep } from 'type-fest';
|
|
3
3
|
import type { task_id } from '../types/typeAliases';
|
|
4
4
|
import type { string_SCREAMING_CASE } from '../utils/normalization/normalizeTo_SCREAMING_CASE';
|
|
5
|
+
import type { string_promptbook_version } from '../version';
|
|
5
6
|
import type { AbstractTaskResult } from './AbstractTaskResult';
|
|
6
7
|
import type { PipelineExecutorResult } from './PipelineExecutorResult';
|
|
7
8
|
/**
|
|
@@ -12,12 +13,21 @@ type CreateTaskOptions<TTaskResult extends AbstractTaskResult> = {
|
|
|
12
13
|
* The type of task to create
|
|
13
14
|
*/
|
|
14
15
|
readonly taskType: AbstractTask<TTaskResult>['taskType'];
|
|
16
|
+
/**
|
|
17
|
+
* Human-readable title of the task - used for displaying in the UI
|
|
18
|
+
*/
|
|
19
|
+
readonly title: AbstractTask<TTaskResult>['title'];
|
|
15
20
|
/**
|
|
16
21
|
* Callback that processes the task and updates the ongoing result
|
|
17
22
|
* @param ongoingResult The partial result of the task processing
|
|
18
23
|
* @returns The final task result
|
|
19
24
|
*/
|
|
20
|
-
taskProcessCallback(updateOngoingResult: (newOngoingResult: PartialDeep<TTaskResult>
|
|
25
|
+
taskProcessCallback(updateOngoingResult: (newOngoingResult: PartialDeep<TTaskResult> & {
|
|
26
|
+
/**
|
|
27
|
+
* Optional update of the task title
|
|
28
|
+
*/
|
|
29
|
+
readonly title?: AbstractTask<TTaskResult>['title'];
|
|
30
|
+
}) => void): Promise<TTaskResult>;
|
|
21
31
|
};
|
|
22
32
|
/**
|
|
23
33
|
* Helper to create a new task
|
|
@@ -52,10 +62,18 @@ export type AbstractTask<TTaskResult extends AbstractTaskResult> = {
|
|
|
52
62
|
* Type of the task
|
|
53
63
|
*/
|
|
54
64
|
readonly taskType: string_SCREAMING_CASE;
|
|
65
|
+
/**
|
|
66
|
+
* Version of the promptbook used to run the task
|
|
67
|
+
*/
|
|
68
|
+
readonly promptbookVersion: string_promptbook_version;
|
|
55
69
|
/**
|
|
56
70
|
* Unique identifier for the task
|
|
57
71
|
*/
|
|
58
72
|
readonly taskId: task_id;
|
|
73
|
+
/**
|
|
74
|
+
* Human-readable title of the task - used for displaying in the UI
|
|
75
|
+
*/
|
|
76
|
+
readonly title: string;
|
|
59
77
|
/**
|
|
60
78
|
* Status of the task
|
|
61
79
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MultipleLlmExecutionTools } from '../../
|
|
1
|
+
import { MultipleLlmExecutionTools } from '../../_multiple/MultipleLlmExecutionTools';
|
|
2
2
|
import type { CreateLlmToolsFromConfigurationOptions } from './createLlmToolsFromConfiguration';
|
|
3
3
|
/**
|
|
4
4
|
* Automatically configures LLM tools from environment variables in Node.js
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { string_user_id } from '../../../types/typeAliases';
|
|
2
|
-
import { MultipleLlmExecutionTools } from '../../
|
|
2
|
+
import { MultipleLlmExecutionTools } from '../../_multiple/MultipleLlmExecutionTools';
|
|
3
3
|
import type { LlmToolsConfiguration } from './LlmToolsConfiguration';
|
|
4
4
|
/**
|
|
5
5
|
* Options for `$provideLlmToolsFromEnv`
|
|
@@ -9,6 +9,10 @@ import type { string_user_id } from '../../types/typeAliases';
|
|
|
9
9
|
* @public exported from `@promptbook/azure-openai`
|
|
10
10
|
*/
|
|
11
11
|
export type AzureOpenAiExecutionToolsOptions = CommonToolsOptions & {
|
|
12
|
+
/**
|
|
13
|
+
* The API key of the Azure OpenAI resource
|
|
14
|
+
*/
|
|
15
|
+
readonly apiKey: string_token;
|
|
12
16
|
/**
|
|
13
17
|
* The resource name of the Azure OpenAI resource
|
|
14
18
|
*
|
|
@@ -23,10 +27,6 @@ export type AzureOpenAiExecutionToolsOptions = CommonToolsOptions & {
|
|
|
23
27
|
* Note: Typically you have one resource and multiple deployments.
|
|
24
28
|
*/
|
|
25
29
|
readonly deploymentName: string_name;
|
|
26
|
-
/**
|
|
27
|
-
* The API key of the Azure OpenAI resource
|
|
28
|
-
*/
|
|
29
|
-
readonly apiKey: string_token;
|
|
30
30
|
/**
|
|
31
31
|
* A unique identifier representing your end-user, which can help Azure OpenAI to monitor
|
|
32
32
|
* and detect abuse.
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { PromptbookStorage } from '../_common/PromptbookStorage';
|
|
2
|
+
import type { IndexedDbStorageOptions } from './utils/IndexedDbStorageOptions';
|
|
2
3
|
/**
|
|
3
4
|
* Gets wrapper around IndexedDB which can be used as PromptbookStorage
|
|
4
5
|
*
|
|
5
6
|
* @public exported from `@promptbook/browser`
|
|
6
7
|
*/
|
|
7
|
-
export declare function getIndexedDbStorage<TItem>(): PromptbookStorage<TItem>;
|
|
8
|
+
export declare function getIndexedDbStorage<TItem>(options: IndexedDbStorageOptions): PromptbookStorage<TItem>;
|
|
8
9
|
/**
|
|
9
10
|
* Note: [🔵] Code in this file should never be published outside of `@promptbook/browser`
|
|
10
11
|
*/
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { string_name } from '../../../types/typeAliases';
|
|
2
|
+
/**
|
|
3
|
+
* Options for IndexedDB storage
|
|
4
|
+
*/
|
|
5
|
+
export type IndexedDbStorageOptions = {
|
|
6
|
+
/**
|
|
7
|
+
* Name of the database
|
|
8
|
+
*/
|
|
9
|
+
databaseName: string_name;
|
|
10
|
+
/**
|
|
11
|
+
* Name of the object store (table) in the database
|
|
12
|
+
*/
|
|
13
|
+
storeName: string_name;
|
|
14
|
+
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { PromptbookStorage } from '../../_common/PromptbookStorage';
|
|
2
|
+
import type { IndexedDbStorageOptions } from './IndexedDbStorageOptions';
|
|
2
3
|
/**
|
|
3
4
|
* Creates a PromptbookStorage backed by IndexedDB.
|
|
4
5
|
* Uses a single object store named 'promptbook'.
|
|
5
6
|
* @private for `getIndexedDbStorage`
|
|
6
7
|
*/
|
|
7
|
-
export declare function makePromptbookStorageFromIndexedDb<TValue>(
|
|
8
|
+
export declare function makePromptbookStorageFromIndexedDb<TValue>(options: IndexedDbStorageOptions): PromptbookStorage<TValue>;
|
|
@@ -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.92.0-
|
|
18
|
+
* It follows semantic versioning (e.g., `0.92.0-33`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
package/package.json
CHANGED
package/umd/index.umd.js
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
* @generated
|
|
28
28
|
* @see https://github.com/webgptorg/promptbook
|
|
29
29
|
*/
|
|
30
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.92.0-
|
|
30
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.92.0-34';
|
|
31
31
|
/**
|
|
32
32
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
33
33
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -2368,6 +2368,7 @@
|
|
|
2368
2368
|
*/
|
|
2369
2369
|
function createTask(options) {
|
|
2370
2370
|
const { taskType, taskProcessCallback } = options;
|
|
2371
|
+
let { title } = options;
|
|
2371
2372
|
// TODO: [🐙] DRY
|
|
2372
2373
|
const taskId = `${taskType.toLowerCase().substring(0, 4)}-${$randomToken(8 /* <- TODO: To global config + Use Base58 to avoid simmilar char conflicts */)}`;
|
|
2373
2374
|
let status = 'RUNNING';
|
|
@@ -2379,6 +2380,10 @@
|
|
|
2379
2380
|
const partialResultSubject = new rxjs.Subject();
|
|
2380
2381
|
// <- Note: Not using `BehaviorSubject` because on error we can't access the last value
|
|
2381
2382
|
const finalResultPromise = /* not await */ taskProcessCallback((newOngoingResult) => {
|
|
2383
|
+
if (newOngoingResult.title) {
|
|
2384
|
+
title = newOngoingResult.title;
|
|
2385
|
+
}
|
|
2386
|
+
updatedAt = new Date();
|
|
2382
2387
|
Object.assign(currentValue, newOngoingResult);
|
|
2383
2388
|
// <- TODO: assign deep
|
|
2384
2389
|
partialResultSubject.next(newOngoingResult);
|
|
@@ -2424,17 +2429,24 @@
|
|
|
2424
2429
|
return {
|
|
2425
2430
|
taskType,
|
|
2426
2431
|
taskId,
|
|
2432
|
+
get promptbookVersion() {
|
|
2433
|
+
return PROMPTBOOK_ENGINE_VERSION;
|
|
2434
|
+
},
|
|
2435
|
+
get title() {
|
|
2436
|
+
return title;
|
|
2437
|
+
// <- Note: [1] Theese must be getters to allow changing the value in the future
|
|
2438
|
+
},
|
|
2427
2439
|
get status() {
|
|
2428
2440
|
return status;
|
|
2429
|
-
// <- Note: [1]
|
|
2441
|
+
// <- Note: [1] --||--
|
|
2430
2442
|
},
|
|
2431
2443
|
get createdAt() {
|
|
2432
2444
|
return createdAt;
|
|
2433
|
-
// <- Note: [1]
|
|
2445
|
+
// <- Note: [1] --||--
|
|
2434
2446
|
},
|
|
2435
2447
|
get updatedAt() {
|
|
2436
2448
|
return updatedAt;
|
|
2437
|
-
// <- Note: [1]
|
|
2449
|
+
// <- Note: [1] --||--
|
|
2438
2450
|
},
|
|
2439
2451
|
asPromise,
|
|
2440
2452
|
asObservable() {
|
|
@@ -2442,15 +2454,15 @@
|
|
|
2442
2454
|
},
|
|
2443
2455
|
get errors() {
|
|
2444
2456
|
return errors;
|
|
2445
|
-
// <- Note: [1]
|
|
2457
|
+
// <- Note: [1] --||--
|
|
2446
2458
|
},
|
|
2447
2459
|
get warnings() {
|
|
2448
2460
|
return warnings;
|
|
2449
|
-
// <- Note: [1]
|
|
2461
|
+
// <- Note: [1] --||--
|
|
2450
2462
|
},
|
|
2451
2463
|
get currentValue() {
|
|
2452
2464
|
return currentValue;
|
|
2453
|
-
// <- Note: [1]
|
|
2465
|
+
// <- Note: [1] --||--
|
|
2454
2466
|
},
|
|
2455
2467
|
};
|
|
2456
2468
|
}
|
|
@@ -3192,7 +3204,14 @@
|
|
|
3192
3204
|
return 'Multiple LLM Providers';
|
|
3193
3205
|
}
|
|
3194
3206
|
get description() {
|
|
3195
|
-
|
|
3207
|
+
const innerModelsTitlesAndDescriptions = this.llmExecutionTools
|
|
3208
|
+
.map(({ title, description }, index) => `${index + 1}) \`${title}\`\n${description}`)
|
|
3209
|
+
.join('\n\n');
|
|
3210
|
+
return spaceTrim__default["default"]((block) => `
|
|
3211
|
+
Multiple LLM Providers:
|
|
3212
|
+
|
|
3213
|
+
${block(innerModelsTitlesAndDescriptions)}
|
|
3214
|
+
`);
|
|
3196
3215
|
}
|
|
3197
3216
|
/**
|
|
3198
3217
|
* Check the configuration of all execution tools
|
|
@@ -4546,6 +4565,7 @@
|
|
|
4546
4565
|
*/
|
|
4547
4566
|
async function getKnowledgeForTask(options) {
|
|
4548
4567
|
const { tools, preparedPipeline, task, parameters } = options;
|
|
4568
|
+
console.log('!!! getKnowledgeForTask', options);
|
|
4549
4569
|
const firstKnowlegePiece = preparedPipeline.knowledgePieces[0];
|
|
4550
4570
|
const firstKnowlegeIndex = firstKnowlegePiece === null || firstKnowlegePiece === void 0 ? void 0 : firstKnowlegePiece.index[0];
|
|
4551
4571
|
// <- TODO: Do not use just first knowledge piece and first index to determine embedding model, use also keyword search
|
|
@@ -4584,7 +4604,7 @@
|
|
|
4584
4604
|
});
|
|
4585
4605
|
const knowledgePiecesSorted = knowledgePiecesWithRelevance.sort((a, b) => a.relevance - b.relevance);
|
|
4586
4606
|
const knowledgePiecesLimited = knowledgePiecesSorted.slice(0, 5);
|
|
4587
|
-
console.log('!!! Embedding', {
|
|
4607
|
+
console.log('!!! `getKnowledgeForTask` Embedding', {
|
|
4588
4608
|
task,
|
|
4589
4609
|
taskEmbeddingPrompt,
|
|
4590
4610
|
taskEmbeddingResult,
|
|
@@ -4620,6 +4640,7 @@
|
|
|
4620
4640
|
*/
|
|
4621
4641
|
async function getReservedParametersForTask(options) {
|
|
4622
4642
|
const { tools, preparedPipeline, task, parameters, pipelineIdentification } = options;
|
|
4643
|
+
console.log('!!! getReservedParametersForTask', options);
|
|
4623
4644
|
const context = await getContextForTask(); // <- [🏍]
|
|
4624
4645
|
const knowledge = await getKnowledgeForTask({ tools, preparedPipeline, task, parameters });
|
|
4625
4646
|
const examples = await getExamplesForTask();
|
|
@@ -4656,6 +4677,7 @@
|
|
|
4656
4677
|
*/
|
|
4657
4678
|
async function executeTask(options) {
|
|
4658
4679
|
const { currentTask, preparedPipeline, parametersToPass, tools, onProgress, $executionReport, pipelineIdentification, maxExecutionAttempts, maxParallelCount, csvSettings, isVerbose, rootDirname, cacheDirname, intermediateFilesStrategy, isAutoInstalled, isNotPreparedWarningSupressed, } = options;
|
|
4680
|
+
console.log('!!! executeTask', options);
|
|
4659
4681
|
const priority = preparedPipeline.tasks.length - preparedPipeline.tasks.indexOf(currentTask);
|
|
4660
4682
|
// Note: Check consistency of used and dependent parameters which was also done in `validatePipeline`, but it’s good to doublecheck
|
|
4661
4683
|
const usedParameterNames = extractParameterNamesFromTask(currentTask);
|
|
@@ -4679,14 +4701,15 @@
|
|
|
4679
4701
|
|
|
4680
4702
|
`));
|
|
4681
4703
|
}
|
|
4704
|
+
const reservedParameters = await getReservedParametersForTask({
|
|
4705
|
+
tools,
|
|
4706
|
+
preparedPipeline,
|
|
4707
|
+
task: currentTask,
|
|
4708
|
+
pipelineIdentification,
|
|
4709
|
+
parameters: parametersToPass,
|
|
4710
|
+
});
|
|
4682
4711
|
const definedParameters = Object.freeze({
|
|
4683
|
-
...
|
|
4684
|
-
tools,
|
|
4685
|
-
preparedPipeline,
|
|
4686
|
-
task: currentTask,
|
|
4687
|
-
pipelineIdentification,
|
|
4688
|
-
parameters: parametersToPass,
|
|
4689
|
-
})),
|
|
4712
|
+
...reservedParameters,
|
|
4690
4713
|
...parametersToPass,
|
|
4691
4714
|
});
|
|
4692
4715
|
const definedParameterNames = new Set(Object.keys(definedParameters));
|
|
@@ -5133,6 +5156,7 @@
|
|
|
5133
5156
|
};
|
|
5134
5157
|
const pipelineExecutor = (inputParameters) => createTask({
|
|
5135
5158
|
taskType: 'EXECUTION',
|
|
5159
|
+
title: pipeline.title,
|
|
5136
5160
|
taskProcessCallback(updateOngoingResult) {
|
|
5137
5161
|
return pipelineExecutorWithCallback(inputParameters, async (newOngoingResult) => {
|
|
5138
5162
|
updateOngoingResult(newOngoingResult);
|
|
@@ -5184,12 +5208,14 @@
|
|
|
5184
5208
|
const spending = new rxjs.Subject();
|
|
5185
5209
|
const proxyTools = {
|
|
5186
5210
|
get title() {
|
|
5187
|
-
|
|
5188
|
-
|
|
5211
|
+
return `${llmTools.title} (+usage)`;
|
|
5212
|
+
// <- TODO: [🧈] Maybe standartize the suffix when wrapping `LlmExecutionTools` up
|
|
5213
|
+
// <- TODO: [🧈][🧠] Does it make sence to suffix "(+usage)"?
|
|
5189
5214
|
},
|
|
5190
5215
|
get description() {
|
|
5191
|
-
|
|
5192
|
-
|
|
5216
|
+
return `${llmTools.description} (+usage)`;
|
|
5217
|
+
// <- TODO: [🧈] Maybe standartize the suffix when wrapping `LlmExecutionTools` up
|
|
5218
|
+
// <- TODO: [🧈][🧠] Does it make sence to suffix "(+usage)"?
|
|
5193
5219
|
},
|
|
5194
5220
|
checkConfiguration() {
|
|
5195
5221
|
return /* not await */ llmTools.checkConfiguration();
|
|
@@ -10334,8 +10360,13 @@
|
|
|
10334
10360
|
const filteredTools = {
|
|
10335
10361
|
// Keep all properties from the original llmTools
|
|
10336
10362
|
...llmTools,
|
|
10363
|
+
get title() {
|
|
10364
|
+
return `${llmTools.title} (filtered)`;
|
|
10365
|
+
// <- TODO: [🧈] Maybe standartize the suffix when wrapping `LlmExecutionTools` up
|
|
10366
|
+
},
|
|
10337
10367
|
get description() {
|
|
10338
10368
|
return `${llmTools.description} (filtered)`;
|
|
10369
|
+
// <- TODO: [🧈] Maybe standartize the suffix when wrapping `LlmExecutionTools` up
|
|
10339
10370
|
},
|
|
10340
10371
|
// Override listModels to filter the models
|
|
10341
10372
|
async listModels() {
|
|
@@ -10696,12 +10727,14 @@
|
|
|
10696
10727
|
...llmTools,
|
|
10697
10728
|
// <- Note: [🥫]
|
|
10698
10729
|
get title() {
|
|
10699
|
-
|
|
10700
|
-
|
|
10730
|
+
return `${llmTools.title} (cached)`;
|
|
10731
|
+
// <- TODO: [🧈] Maybe standartize the suffix when wrapping `LlmExecutionTools` up
|
|
10732
|
+
// <- TODO: [🧈][🧠] Does it make sence to suffix "(cached)"?
|
|
10701
10733
|
},
|
|
10702
10734
|
get description() {
|
|
10703
|
-
|
|
10704
|
-
|
|
10735
|
+
return `${llmTools.description} (cached)`;
|
|
10736
|
+
// <- TODO: [🧈] Maybe standartize the suffix when wrapping `LlmExecutionTools` up
|
|
10737
|
+
// <- TODO: [🧈][🧠] Does it make sence to suffix "(cached)"?
|
|
10705
10738
|
},
|
|
10706
10739
|
listModels() {
|
|
10707
10740
|
// TODO: [🧠] Should be model listing also cached?
|
|
@@ -10864,6 +10897,7 @@
|
|
|
10864
10897
|
apiKey: 'sk-ant-api03-',
|
|
10865
10898
|
isProxied: true,
|
|
10866
10899
|
remoteServerUrl: DEFAULT_REMOTE_SERVER_URL,
|
|
10900
|
+
maxRequestsPerMinute: DEFAULT_MAX_REQUESTS_PER_MINUTE,
|
|
10867
10901
|
},
|
|
10868
10902
|
};
|
|
10869
10903
|
},
|
|
@@ -10899,7 +10933,7 @@
|
|
|
10899
10933
|
title: 'Azure Open AI',
|
|
10900
10934
|
packageName: '@promptbook/azure-openai',
|
|
10901
10935
|
className: 'AzureOpenAiExecutionTools',
|
|
10902
|
-
envVariables: ['
|
|
10936
|
+
envVariables: ['AZUREOPENAI_API_KEY', 'AZUREOPENAI_RESOURCE_NAME', 'AZUREOPENAI_DEPLOYMENT_NAME'],
|
|
10903
10937
|
trustLevel: 'CLOSED_BUSINESS',
|
|
10904
10938
|
order: MODEL_ORDERS.NORMAL,
|
|
10905
10939
|
getBoilerplateConfiguration() {
|
|
@@ -10909,6 +10943,9 @@
|
|
|
10909
10943
|
className: 'AzureOpenAiExecutionTools',
|
|
10910
10944
|
options: {
|
|
10911
10945
|
apiKey: 'sk-',
|
|
10946
|
+
resourceName: 'my-resource-name',
|
|
10947
|
+
deploymentName: 'my-deployment-name',
|
|
10948
|
+
maxRequestsPerMinute: DEFAULT_MAX_REQUESTS_PER_MINUTE,
|
|
10912
10949
|
},
|
|
10913
10950
|
};
|
|
10914
10951
|
},
|
|
@@ -10922,15 +10959,15 @@
|
|
|
10922
10959
|
packageName: '@promptbook/azure-openai',
|
|
10923
10960
|
className: 'AzureOpenAiExecutionTools',
|
|
10924
10961
|
options: {
|
|
10962
|
+
apiKey: env.AZUREOPENAI_API_KEY,
|
|
10925
10963
|
resourceName: env.AZUREOPENAI_RESOURCE_NAME,
|
|
10926
10964
|
deploymentName: env.AZUREOPENAI_DEPLOYMENT_NAME,
|
|
10927
|
-
apiKey: env.AZUREOPENAI_API_KEY,
|
|
10928
10965
|
},
|
|
10929
10966
|
};
|
|
10930
10967
|
}
|
|
10931
|
-
else if (typeof env.
|
|
10932
|
-
typeof env.
|
|
10933
|
-
typeof env.
|
|
10968
|
+
else if (typeof env.AZUREOPENAI_API_KEY === 'string' ||
|
|
10969
|
+
typeof env.AZUREOPENAI_RESOURCE_NAME === 'string' ||
|
|
10970
|
+
typeof env.AZUREOPENAI_DEPLOYMENT_NAME === 'string') {
|
|
10934
10971
|
return null;
|
|
10935
10972
|
/*
|
|
10936
10973
|
Note: [🗨] Partial configuration is handled more gracefully elsewhere
|
|
@@ -11143,6 +11180,7 @@
|
|
|
11143
11180
|
options: {
|
|
11144
11181
|
apiKey: 'sk-',
|
|
11145
11182
|
assistantId: 'asst_',
|
|
11183
|
+
maxRequestsPerMinute: DEFAULT_MAX_REQUESTS_PER_MINUTE,
|
|
11146
11184
|
},
|
|
11147
11185
|
};
|
|
11148
11186
|
},
|