@promptbook/core 0.94.0-0 → 0.94.0-2
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 +1 -8
- package/esm/index.es.js +61 -11
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/cli.index.d.ts +4 -0
- package/esm/typings/src/_packages/core.index.d.ts +2 -0
- package/esm/typings/src/_packages/ollama.index.d.ts +10 -0
- package/esm/typings/src/_packages/types.index.d.ts +2 -0
- package/esm/typings/src/_packages/wizzard.index.d.ts +4 -0
- package/esm/typings/src/execution/AvailableModel.d.ts +9 -1
- package/esm/typings/src/execution/ExecutionTask.d.ts +3 -1
- package/esm/typings/src/llm-providers/_common/filterModels.d.ts +2 -2
- package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +1 -1
- package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionToolsOptions.d.ts +1 -1
- package/esm/typings/src/llm-providers/deepseek/DeepseekExecutionToolsOptions.d.ts +1 -1
- package/esm/typings/src/llm-providers/google/GoogleExecutionToolsOptions.d.ts +1 -1
- package/esm/typings/src/llm-providers/ollama/OllamaExecutionToolsOptions.d.ts +23 -0
- package/esm/typings/src/llm-providers/ollama/createOllamaExecutionTools.d.ts +11 -0
- package/esm/typings/src/llm-providers/ollama/playground/playground.d.ts +6 -0
- package/esm/typings/src/llm-providers/ollama/register-configuration.d.ts +14 -0
- package/esm/typings/src/llm-providers/ollama/register-constructor.d.ts +15 -0
- package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionToolsOptions.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/OpenAiExecutionToolsOptions.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/createOpenAiExecutionTools.d.ts +2 -0
- package/esm/typings/src/llm-providers/openai/openai-models.d.ts +1 -7
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/umd/index.umd.js +61 -10
- package/umd/index.umd.js.map +1 -1
|
@@ -8,6 +8,8 @@ import { _DeepseekMetadataRegistration } from '../llm-providers/deepseek/registe
|
|
|
8
8
|
import { _DeepseekRegistration } from '../llm-providers/deepseek/register-constructor';
|
|
9
9
|
import { _GoogleMetadataRegistration } from '../llm-providers/google/register-configuration';
|
|
10
10
|
import { _GoogleRegistration } from '../llm-providers/google/register-constructor';
|
|
11
|
+
import { _OllamaMetadataRegistration } from '../llm-providers/ollama/register-configuration';
|
|
12
|
+
import { _OllamaRegistration } from '../llm-providers/ollama/register-constructor';
|
|
11
13
|
import { _OpenAiMetadataRegistration } from '../llm-providers/openai/register-configuration';
|
|
12
14
|
import { _OpenAiAssistantMetadataRegistration } from '../llm-providers/openai/register-configuration';
|
|
13
15
|
import { _OpenAiRegistration } from '../llm-providers/openai/register-constructor';
|
|
@@ -36,6 +38,8 @@ export { _DeepseekMetadataRegistration };
|
|
|
36
38
|
export { _DeepseekRegistration };
|
|
37
39
|
export { _GoogleMetadataRegistration };
|
|
38
40
|
export { _GoogleRegistration };
|
|
41
|
+
export { _OllamaMetadataRegistration };
|
|
42
|
+
export { _OllamaRegistration };
|
|
39
43
|
export { _OpenAiMetadataRegistration };
|
|
40
44
|
export { _OpenAiAssistantMetadataRegistration };
|
|
41
45
|
export { _OpenAiRegistration };
|
|
@@ -108,6 +108,7 @@ import { _AnthropicClaudeMetadataRegistration } from '../llm-providers/anthropic
|
|
|
108
108
|
import { _AzureOpenAiMetadataRegistration } from '../llm-providers/azure-openai/register-configuration';
|
|
109
109
|
import { _DeepseekMetadataRegistration } from '../llm-providers/deepseek/register-configuration';
|
|
110
110
|
import { _GoogleMetadataRegistration } from '../llm-providers/google/register-configuration';
|
|
111
|
+
import { _OllamaMetadataRegistration } from '../llm-providers/ollama/register-configuration';
|
|
111
112
|
import { _OpenAiMetadataRegistration } from '../llm-providers/openai/register-configuration';
|
|
112
113
|
import { _OpenAiAssistantMetadataRegistration } from '../llm-providers/openai/register-configuration';
|
|
113
114
|
import { migratePipeline } from '../migrations/migratePipeline';
|
|
@@ -255,6 +256,7 @@ export { _AnthropicClaudeMetadataRegistration };
|
|
|
255
256
|
export { _AzureOpenAiMetadataRegistration };
|
|
256
257
|
export { _DeepseekMetadataRegistration };
|
|
257
258
|
export { _GoogleMetadataRegistration };
|
|
259
|
+
export { _OllamaMetadataRegistration };
|
|
258
260
|
export { _OpenAiMetadataRegistration };
|
|
259
261
|
export { _OpenAiAssistantMetadataRegistration };
|
|
260
262
|
export { migratePipeline };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION } from '../version';
|
|
2
|
+
import { createOllamaExecutionTools } from '../llm-providers/ollama/createOllamaExecutionTools';
|
|
3
|
+
import { DEFAULT_OLLAMA_BASE_URL } from '../llm-providers/ollama/OllamaExecutionToolsOptions';
|
|
4
|
+
import type { OllamaExecutionToolsOptions } from '../llm-providers/ollama/OllamaExecutionToolsOptions';
|
|
5
|
+
import { _OllamaRegistration } from '../llm-providers/ollama/register-constructor';
|
|
6
|
+
export { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION };
|
|
7
|
+
export { createOllamaExecutionTools };
|
|
8
|
+
export { DEFAULT_OLLAMA_BASE_URL };
|
|
9
|
+
export type { OllamaExecutionToolsOptions };
|
|
10
|
+
export { _OllamaRegistration };
|
|
@@ -79,6 +79,7 @@ import type { AnthropicClaudeExecutionToolsProxiedOptions } from '../llm-provide
|
|
|
79
79
|
import type { AzureOpenAiExecutionToolsOptions } from '../llm-providers/azure-openai/AzureOpenAiExecutionToolsOptions';
|
|
80
80
|
import type { DeepseekExecutionToolsOptions } from '../llm-providers/deepseek/DeepseekExecutionToolsOptions';
|
|
81
81
|
import type { GoogleExecutionToolsOptions } from '../llm-providers/google/GoogleExecutionToolsOptions';
|
|
82
|
+
import type { OllamaExecutionToolsOptions } from '../llm-providers/ollama/OllamaExecutionToolsOptions';
|
|
82
83
|
import type { OpenAiAssistantExecutionToolsOptions } from '../llm-providers/openai/OpenAiAssistantExecutionToolsOptions';
|
|
83
84
|
import type { OpenAiExecutionToolsOptions } from '../llm-providers/openai/OpenAiExecutionToolsOptions';
|
|
84
85
|
import type { VercelExecutionToolsOptions } from '../llm-providers/vercel/VercelExecutionToolsOptions';
|
|
@@ -377,6 +378,7 @@ export type { AnthropicClaudeExecutionToolsProxiedOptions };
|
|
|
377
378
|
export type { AzureOpenAiExecutionToolsOptions };
|
|
378
379
|
export type { DeepseekExecutionToolsOptions };
|
|
379
380
|
export type { GoogleExecutionToolsOptions };
|
|
381
|
+
export type { OllamaExecutionToolsOptions };
|
|
380
382
|
export type { OpenAiAssistantExecutionToolsOptions };
|
|
381
383
|
export type { OpenAiExecutionToolsOptions };
|
|
382
384
|
export type { VercelExecutionToolsOptions };
|
|
@@ -7,6 +7,8 @@ import { _DeepseekMetadataRegistration } from '../llm-providers/deepseek/registe
|
|
|
7
7
|
import { _DeepseekRegistration } from '../llm-providers/deepseek/register-constructor';
|
|
8
8
|
import { _GoogleMetadataRegistration } from '../llm-providers/google/register-configuration';
|
|
9
9
|
import { _GoogleRegistration } from '../llm-providers/google/register-constructor';
|
|
10
|
+
import { _OllamaMetadataRegistration } from '../llm-providers/ollama/register-configuration';
|
|
11
|
+
import { _OllamaRegistration } from '../llm-providers/ollama/register-constructor';
|
|
10
12
|
import { _OpenAiMetadataRegistration } from '../llm-providers/openai/register-configuration';
|
|
11
13
|
import { _OpenAiAssistantMetadataRegistration } from '../llm-providers/openai/register-configuration';
|
|
12
14
|
import { _OpenAiRegistration } from '../llm-providers/openai/register-constructor';
|
|
@@ -35,6 +37,8 @@ export { _DeepseekMetadataRegistration };
|
|
|
35
37
|
export { _DeepseekRegistration };
|
|
36
38
|
export { _GoogleMetadataRegistration };
|
|
37
39
|
export { _GoogleRegistration };
|
|
40
|
+
export { _OllamaMetadataRegistration };
|
|
41
|
+
export { _OllamaRegistration };
|
|
38
42
|
export { _OpenAiMetadataRegistration };
|
|
39
43
|
export { _OpenAiAssistantMetadataRegistration };
|
|
40
44
|
export { _OpenAiRegistration };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ModelVariant } from '../types/ModelVariant';
|
|
2
|
+
import type { number_usd } from '../types/typeAliases';
|
|
2
3
|
import type { string_model_description } from '../types/typeAliases';
|
|
3
4
|
import type { string_model_name } from '../types/typeAliases';
|
|
4
5
|
import type { string_title } from '../types/typeAliases';
|
|
@@ -32,7 +33,14 @@ export type AvailableModel = {
|
|
|
32
33
|
* @example "Model with 1 billion parameters and advanced reasoning capabilities"
|
|
33
34
|
*/
|
|
34
35
|
readonly modelDescription?: string_model_description;
|
|
36
|
+
/**
|
|
37
|
+
* Pricing information for the model
|
|
38
|
+
*/
|
|
39
|
+
readonly pricing?: {
|
|
40
|
+
readonly prompt: number_usd;
|
|
41
|
+
readonly output: number_usd;
|
|
42
|
+
};
|
|
35
43
|
};
|
|
36
44
|
/**
|
|
37
|
-
* TODO:
|
|
45
|
+
* TODO: [🧠] Maybe rename to something else - like `ModelInformation` or `ModelMetadata`
|
|
38
46
|
*/
|
|
@@ -72,6 +72,8 @@ export type AbstractTask<TTaskResult extends AbstractTaskResult> = {
|
|
|
72
72
|
readonly taskId: task_id;
|
|
73
73
|
/**
|
|
74
74
|
* Human-readable title of the task - used for displaying in the UI
|
|
75
|
+
*
|
|
76
|
+
* For example name of the book which is being executed
|
|
75
77
|
*/
|
|
76
78
|
readonly title: string;
|
|
77
79
|
/**
|
|
@@ -99,7 +101,7 @@ export type AbstractTask<TTaskResult extends AbstractTaskResult> = {
|
|
|
99
101
|
/**
|
|
100
102
|
* Gets just the current value which is mutated during the task processing
|
|
101
103
|
*/
|
|
102
|
-
currentValue: PartialDeep<TTaskResult>;
|
|
104
|
+
readonly currentValue: PartialDeep<TTaskResult>;
|
|
103
105
|
/**
|
|
104
106
|
* List of errors that occurred during the task processing
|
|
105
107
|
*/
|
|
@@ -4,12 +4,12 @@ import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
|
|
|
4
4
|
* Creates a wrapper around LlmExecutionTools that only exposes models matching the filter function
|
|
5
5
|
*
|
|
6
6
|
* @param llmTools The original LLM execution tools to wrap
|
|
7
|
-
* @param
|
|
7
|
+
* @param predicate Function that determines whether a model should be included
|
|
8
8
|
* @returns A new LlmExecutionTools instance with filtered models
|
|
9
9
|
*
|
|
10
10
|
* @public exported from `@promptbook/core`
|
|
11
11
|
*/
|
|
12
|
-
export declare function filterModels<TLlmTools extends LlmExecutionTools>(llmTools: TLlmTools,
|
|
12
|
+
export declare function filterModels<TLlmTools extends LlmExecutionTools>(llmTools: TLlmTools, predicate: (model: AvailableModel) => boolean): TLlmTools;
|
|
13
13
|
/**
|
|
14
14
|
* TODO: !!! [models] Test that this is working
|
|
15
15
|
*/
|
package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { ClientOptions } from '@anthropic-ai/sdk';
|
|
|
2
2
|
import type { CommonToolsOptions } from '../../execution/CommonToolsOptions';
|
|
3
3
|
import type { RemoteClientOptions } from '../../remote-server/types/RemoteClientOptions';
|
|
4
4
|
/**
|
|
5
|
-
* Options for `AnthropicClaudeExecutionTools`
|
|
5
|
+
* Options for `createAnthropicClaudeExecutionTools` and `AnthropicClaudeExecutionTools`
|
|
6
6
|
*
|
|
7
7
|
* This extends Anthropic's `ClientOptions` with are directly passed to the Anthropic client.
|
|
8
8
|
* @public exported from `@promptbook/anthropic-claude`
|
|
@@ -3,7 +3,7 @@ import type { string_name } from '../../types/typeAliases';
|
|
|
3
3
|
import type { string_token } from '../../types/typeAliases';
|
|
4
4
|
import type { string_user_id } from '../../types/typeAliases';
|
|
5
5
|
/**
|
|
6
|
-
* Options for `AzureOpenAiExecutionTools`
|
|
6
|
+
* Options for `createAzureOpenAiExecutionTools` and `AzureOpenAiExecutionTools`
|
|
7
7
|
*
|
|
8
8
|
* @see https://oai.azure.com/portal/
|
|
9
9
|
* @public exported from `@promptbook/azure-openai`
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { createDeepSeek } from '@ai-sdk/deepseek';
|
|
2
2
|
import type { VercelExecutionToolsOptions } from '../vercel/VercelExecutionToolsOptions';
|
|
3
3
|
/**
|
|
4
|
-
* Options for `
|
|
4
|
+
* Options for `createDeepseekExecutionTools`
|
|
5
5
|
*
|
|
6
6
|
* This combines options for Promptbook, Deepseek and Vercel together
|
|
7
7
|
* @public exported from `@promptbook/deepseek`
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { createGoogleGenerativeAI } from '@ai-sdk/google';
|
|
2
2
|
import type { VercelExecutionToolsOptions } from '../vercel/VercelExecutionToolsOptions';
|
|
3
3
|
/**
|
|
4
|
-
* Options for `
|
|
4
|
+
* Options for `createGoogleExecutionTools`
|
|
5
5
|
*
|
|
6
6
|
* This combines options for Promptbook, Google and Vercel together
|
|
7
7
|
* @public exported from `@promptbook/google`
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { OpenAiExecutionToolsOptions } from '../openai/OpenAiExecutionToolsOptions';
|
|
2
|
+
/**
|
|
3
|
+
* Default base URL for Ollama API
|
|
4
|
+
*
|
|
5
|
+
* @public exported from `@promptbook/ollama`
|
|
6
|
+
*/
|
|
7
|
+
export declare const DEFAULT_OLLAMA_BASE_URL = "http://localhost:11434";
|
|
8
|
+
/**
|
|
9
|
+
* Options for `createOllamaExecutionTools`
|
|
10
|
+
*
|
|
11
|
+
* This combines options for Promptbook, Google and Vercel together
|
|
12
|
+
* @public exported from `@promptbook/ollama`
|
|
13
|
+
*/
|
|
14
|
+
export type OllamaExecutionToolsOptions = {
|
|
15
|
+
/**
|
|
16
|
+
* Base URL of Ollama API
|
|
17
|
+
*
|
|
18
|
+
* Note: Naming this `baseURL` not `baseUrl` to be consistent with OpenAI API
|
|
19
|
+
*
|
|
20
|
+
* @default `DEFAULT_OLLAMA_BASE_URL`
|
|
21
|
+
*/
|
|
22
|
+
baseURL?: string;
|
|
23
|
+
} & Omit<OpenAiExecutionToolsOptions, 'baseURL' | 'userId'>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
|
|
2
|
+
import type { OllamaExecutionToolsOptions } from './OllamaExecutionToolsOptions';
|
|
3
|
+
/**
|
|
4
|
+
* Execution Tools for calling Ollama API
|
|
5
|
+
*
|
|
6
|
+
* @public exported from `@promptbook/ollama`
|
|
7
|
+
*/
|
|
8
|
+
export declare const createOllamaExecutionTools: ((ollamaOptions: OllamaExecutionToolsOptions) => LlmExecutionTools) & {
|
|
9
|
+
packageName: string;
|
|
10
|
+
className: string;
|
|
11
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Registration } from '../../utils/$Register';
|
|
2
|
+
/**
|
|
3
|
+
* Registration of LLM provider metadata
|
|
4
|
+
*
|
|
5
|
+
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available LLM tools
|
|
6
|
+
*
|
|
7
|
+
* @public exported from `@promptbook/core`
|
|
8
|
+
* @public exported from `@promptbook/wizzard`
|
|
9
|
+
* @public exported from `@promptbook/cli`
|
|
10
|
+
*/
|
|
11
|
+
export declare const _OllamaMetadataRegistration: Registration;
|
|
12
|
+
/**
|
|
13
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
14
|
+
*/
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Registration } from '../../utils/$Register';
|
|
2
|
+
/**
|
|
3
|
+
* Registration of LLM provider
|
|
4
|
+
*
|
|
5
|
+
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available LLM tools
|
|
6
|
+
*
|
|
7
|
+
* @public exported from `@promptbook/ollama`
|
|
8
|
+
* @public exported from `@promptbook/wizzard`
|
|
9
|
+
* @public exported from `@promptbook/cli`
|
|
10
|
+
*/
|
|
11
|
+
export declare const _OllamaRegistration: Registration;
|
|
12
|
+
/**
|
|
13
|
+
* TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
|
|
14
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
15
|
+
*/
|
|
@@ -2,7 +2,7 @@ import type { ClientOptions } from 'openai';
|
|
|
2
2
|
import type { string_token } from '../../types/typeAliases';
|
|
3
3
|
import type { OpenAiExecutionToolsOptions } from './OpenAiExecutionToolsOptions';
|
|
4
4
|
/**
|
|
5
|
-
* Options for `OpenAiAssistantExecutionTools`
|
|
5
|
+
* Options for `createOpenAiAssistantExecutionTools` and `OpenAiAssistantExecutionTools`
|
|
6
6
|
*
|
|
7
7
|
* @public exported from `@promptbook/openai`
|
|
8
8
|
*/
|
|
@@ -40,7 +40,7 @@ export declare class OpenAiExecutionTools implements LlmExecutionTools {
|
|
|
40
40
|
/**
|
|
41
41
|
* List all available OpenAI models that can be used
|
|
42
42
|
*/
|
|
43
|
-
listModels(): ReadonlyArray<AvailableModel
|
|
43
|
+
listModels(): Promise<ReadonlyArray<AvailableModel>>;
|
|
44
44
|
/**
|
|
45
45
|
* Calls OpenAI API to use a chat model.
|
|
46
46
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ClientOptions } from 'openai';
|
|
2
2
|
import type { CommonToolsOptions } from '../../execution/CommonToolsOptions';
|
|
3
3
|
/**
|
|
4
|
-
* Options for `OpenAiExecutionTools`
|
|
4
|
+
* Options for `createOpenAiExecutionTools` and `OpenAiExecutionTools`
|
|
5
5
|
*
|
|
6
6
|
* This extends OpenAI's `ClientOptions` with are directly passed to the OpenAI client.
|
|
7
7
|
* Rest is used by the `OpenAiExecutionTools`.
|
|
@@ -3,6 +3,8 @@ import type { OpenAiExecutionToolsOptions } from './OpenAiExecutionToolsOptions'
|
|
|
3
3
|
/**
|
|
4
4
|
* Execution Tools for calling OpenAI API
|
|
5
5
|
*
|
|
6
|
+
* Note: This can be also used for other OpenAI compatible APIs, like Ollama
|
|
7
|
+
*
|
|
6
8
|
* @public exported from `@promptbook/openai`
|
|
7
9
|
*/
|
|
8
10
|
export declare const createOpenAiExecutionTools: ((options: OpenAiExecutionToolsOptions) => OpenAiExecutionTools) & {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { AvailableModel } from '../../execution/AvailableModel';
|
|
2
|
-
import type { number_usd } from '../../types/typeAliases';
|
|
3
2
|
/**
|
|
4
3
|
* List of available OpenAI models with pricing
|
|
5
4
|
*
|
|
@@ -9,12 +8,7 @@ import type { number_usd } from '../../types/typeAliases';
|
|
|
9
8
|
* @see https://openai.com/api/pricing/
|
|
10
9
|
* @public exported from `@promptbook/openai`
|
|
11
10
|
*/
|
|
12
|
-
export declare const OPENAI_MODELS: ReadonlyArray<AvailableModel
|
|
13
|
-
pricing?: {
|
|
14
|
-
readonly prompt: number_usd;
|
|
15
|
-
readonly output: number_usd;
|
|
16
|
-
};
|
|
17
|
-
}>;
|
|
11
|
+
export declare const OPENAI_MODELS: ReadonlyArray<AvailableModel>;
|
|
18
12
|
/**
|
|
19
13
|
* Note: [🤖] Add models of new variant
|
|
20
14
|
* TODO: [🧠] Some mechanism to propagate unsureness
|
|
@@ -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.
|
|
18
|
+
* It follows semantic versioning (e.g., `0.94.0-1`).
|
|
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.94.0-
|
|
30
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.94.0-2';
|
|
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
|
|
@@ -4751,11 +4751,6 @@
|
|
|
4751
4751
|
const jokerParameterNames = currentTask.jokerParameterNames || [];
|
|
4752
4752
|
const preparedContent = (currentTask.preparedContent || '{content}').split('{content}').join(currentTask.content);
|
|
4753
4753
|
// <- TODO: [🍵] Use here `templateParameters` to replace {websiteContent} with option to ignore missing parameters
|
|
4754
|
-
await onProgress({
|
|
4755
|
-
outputParameters: {
|
|
4756
|
-
[currentTask.resultingParameterName]: '',
|
|
4757
|
-
},
|
|
4758
|
-
});
|
|
4759
4754
|
const resultString = await executeFormatSubvalues({
|
|
4760
4755
|
jokerParameterNames,
|
|
4761
4756
|
priority,
|
|
@@ -4854,6 +4849,13 @@
|
|
|
4854
4849
|
* Note: This is a flag to prevent `onProgress` call after the pipeline execution is finished
|
|
4855
4850
|
*/
|
|
4856
4851
|
let isReturned = false;
|
|
4852
|
+
// Note: Report all output parameters upfront as empty strings
|
|
4853
|
+
if (onProgress) {
|
|
4854
|
+
const emptyOutputParameters = Object.fromEntries(preparedPipeline.parameters.filter((param) => !param.isInput).map((param) => [param.name, '']));
|
|
4855
|
+
onProgress({
|
|
4856
|
+
outputParameters: emptyOutputParameters,
|
|
4857
|
+
});
|
|
4858
|
+
}
|
|
4857
4859
|
// Note: Check that all input input parameters are defined
|
|
4858
4860
|
for (const parameter of preparedPipeline.parameters.filter(({ isInput }) => isInput)) {
|
|
4859
4861
|
if (inputParameters[parameter.name] === undefined) {
|
|
@@ -10363,12 +10365,12 @@
|
|
|
10363
10365
|
* Creates a wrapper around LlmExecutionTools that only exposes models matching the filter function
|
|
10364
10366
|
*
|
|
10365
10367
|
* @param llmTools The original LLM execution tools to wrap
|
|
10366
|
-
* @param
|
|
10368
|
+
* @param predicate Function that determines whether a model should be included
|
|
10367
10369
|
* @returns A new LlmExecutionTools instance with filtered models
|
|
10368
10370
|
*
|
|
10369
10371
|
* @public exported from `@promptbook/core`
|
|
10370
10372
|
*/
|
|
10371
|
-
function filterModels(llmTools,
|
|
10373
|
+
function filterModels(llmTools, predicate) {
|
|
10372
10374
|
const filteredTools = {
|
|
10373
10375
|
// Keep all properties from the original llmTools
|
|
10374
10376
|
...llmTools,
|
|
@@ -10385,10 +10387,10 @@
|
|
|
10385
10387
|
const originalModels = await llmTools.listModels();
|
|
10386
10388
|
// Handle both synchronous and Promise return types
|
|
10387
10389
|
if (originalModels instanceof Promise) {
|
|
10388
|
-
return originalModels.then((models) => models.filter(
|
|
10390
|
+
return originalModels.then((models) => models.filter(predicate));
|
|
10389
10391
|
}
|
|
10390
10392
|
else {
|
|
10391
|
-
return originalModels.filter(
|
|
10393
|
+
return originalModels.filter(predicate);
|
|
10392
10394
|
}
|
|
10393
10395
|
},
|
|
10394
10396
|
};
|
|
@@ -11126,6 +11128,54 @@
|
|
|
11126
11128
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
11127
11129
|
*/
|
|
11128
11130
|
|
|
11131
|
+
/**
|
|
11132
|
+
* Registration of LLM provider metadata
|
|
11133
|
+
*
|
|
11134
|
+
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available LLM tools
|
|
11135
|
+
*
|
|
11136
|
+
* @public exported from `@promptbook/core`
|
|
11137
|
+
* @public exported from `@promptbook/wizzard`
|
|
11138
|
+
* @public exported from `@promptbook/cli`
|
|
11139
|
+
*/
|
|
11140
|
+
const _OllamaMetadataRegistration = $llmToolsMetadataRegister.register({
|
|
11141
|
+
title: 'Ollama',
|
|
11142
|
+
packageName: '@promptbook/ollama',
|
|
11143
|
+
className: 'OllamaExecutionTools',
|
|
11144
|
+
envVariables: ['OLLAMA_BASE_URL', 'OLLAMA_MODEL'],
|
|
11145
|
+
trustLevel: 'CLOSED_LOCAL',
|
|
11146
|
+
order: MODEL_ORDERS.NORMAL,
|
|
11147
|
+
getBoilerplateConfiguration() {
|
|
11148
|
+
return {
|
|
11149
|
+
title: 'Ollama',
|
|
11150
|
+
packageName: '@promptbook/ollama',
|
|
11151
|
+
className: 'OllamaExecutionTools',
|
|
11152
|
+
options: {
|
|
11153
|
+
baseURL: 'http://localhost:11434',
|
|
11154
|
+
model: 'llama2',
|
|
11155
|
+
maxRequestsPerMinute: DEFAULT_MAX_REQUESTS_PER_MINUTE,
|
|
11156
|
+
},
|
|
11157
|
+
};
|
|
11158
|
+
},
|
|
11159
|
+
createConfigurationFromEnv(env) {
|
|
11160
|
+
if (typeof env.OLLAMA_BASE_URL === 'string') {
|
|
11161
|
+
return {
|
|
11162
|
+
title: 'Ollama (from env)',
|
|
11163
|
+
packageName: '@promptbook/ollama',
|
|
11164
|
+
className: 'OllamaExecutionTools',
|
|
11165
|
+
options: {
|
|
11166
|
+
baseURL: env.OLLAMA_BASE_URL,
|
|
11167
|
+
model: env.OLLAMA_MODEL || 'llama2',
|
|
11168
|
+
maxRequestsPerMinute: DEFAULT_MAX_REQUESTS_PER_MINUTE,
|
|
11169
|
+
},
|
|
11170
|
+
};
|
|
11171
|
+
}
|
|
11172
|
+
return null;
|
|
11173
|
+
},
|
|
11174
|
+
});
|
|
11175
|
+
/**
|
|
11176
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
11177
|
+
*/
|
|
11178
|
+
|
|
11129
11179
|
/**
|
|
11130
11180
|
* Registration of LLM provider metadata
|
|
11131
11181
|
*
|
|
@@ -11798,6 +11848,7 @@
|
|
|
11798
11848
|
exports._LegacyDocumentScraperMetadataRegistration = _LegacyDocumentScraperMetadataRegistration;
|
|
11799
11849
|
exports._MarkdownScraperMetadataRegistration = _MarkdownScraperMetadataRegistration;
|
|
11800
11850
|
exports._MarkitdownScraperMetadataRegistration = _MarkitdownScraperMetadataRegistration;
|
|
11851
|
+
exports._OllamaMetadataRegistration = _OllamaMetadataRegistration;
|
|
11801
11852
|
exports._OpenAiAssistantMetadataRegistration = _OpenAiAssistantMetadataRegistration;
|
|
11802
11853
|
exports._OpenAiMetadataRegistration = _OpenAiMetadataRegistration;
|
|
11803
11854
|
exports._PdfScraperMetadataRegistration = _PdfScraperMetadataRegistration;
|