@promptbook/templates 0.92.0-31 → 0.92.0-33

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 CHANGED
@@ -16,7 +16,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
16
16
  * @generated
17
17
  * @see https://github.com/webgptorg/promptbook
18
18
  */
19
- const PROMPTBOOK_ENGINE_VERSION = '0.92.0-31';
19
+ const PROMPTBOOK_ENGINE_VERSION = '0.92.0-33';
20
20
  /**
21
21
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
22
22
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -1571,7 +1571,7 @@ function getTemplatesPipelineCollection() {
1571
1571
  "preparations": [
1572
1572
  {
1573
1573
  "id": 1,
1574
- "promptbookVersion": "0.92.0-30",
1574
+ "promptbookVersion": "0.92.0-32",
1575
1575
  "usage": {
1576
1576
  "price": {
1577
1577
  "value": 0.017265000000000003
@@ -2067,7 +2067,7 @@ function getTemplatesPipelineCollection() {
2067
2067
  "preparations": [
2068
2068
  {
2069
2069
  "id": 1,
2070
- "promptbookVersion": "0.92.0-30",
2070
+ "promptbookVersion": "0.92.0-32",
2071
2071
  "usage": {
2072
2072
  "price": {
2073
2073
  "value": 0.017265000000000003
@@ -2690,7 +2690,7 @@ function getTemplatesPipelineCollection() {
2690
2690
  "preparations": [
2691
2691
  {
2692
2692
  "id": 1,
2693
- "promptbookVersion": "0.92.0-30",
2693
+ "promptbookVersion": "0.92.0-32",
2694
2694
  "usage": {
2695
2695
  "price": {
2696
2696
  "value": 0.016422
@@ -2838,7 +2838,7 @@ function getTemplatesPipelineCollection() {
2838
2838
  "preparations": [
2839
2839
  {
2840
2840
  "id": 1,
2841
- "promptbookVersion": "0.92.0-30",
2841
+ "promptbookVersion": "0.92.0-32",
2842
2842
  "usage": {
2843
2843
  "price": {
2844
2844
  "value": 0.016332
@@ -2934,7 +2934,7 @@ function getTemplatesPipelineCollection() {
2934
2934
  "preparations": [
2935
2935
  {
2936
2936
  "id": 1,
2937
- "promptbookVersion": "0.92.0-30",
2937
+ "promptbookVersion": "0.92.0-32",
2938
2938
  "usage": {
2939
2939
  "price": {
2940
2940
  "value": 0
@@ -3077,7 +3077,7 @@ function getTemplatesPipelineCollection() {
3077
3077
  "preparations": [
3078
3078
  {
3079
3079
  "id": 1,
3080
- "promptbookVersion": "0.92.0-30",
3080
+ "promptbookVersion": "0.92.0-32",
3081
3081
  "usage": {
3082
3082
  "price": {
3083
3083
  "value": 0.016719
@@ -3233,7 +3233,7 @@ function getTemplatesPipelineCollection() {
3233
3233
  "preparations": [
3234
3234
  {
3235
3235
  "id": 1,
3236
- "promptbookVersion": "0.92.0-30",
3236
+ "promptbookVersion": "0.92.0-32",
3237
3237
  "usage": {
3238
3238
  "price": {
3239
3239
  "value": 0.016899
@@ -3566,7 +3566,7 @@ function getTemplatesPipelineCollection() {
3566
3566
  "preparations": [
3567
3567
  {
3568
3568
  "id": 1,
3569
- "promptbookVersion": "0.92.0-30",
3569
+ "promptbookVersion": "0.92.0-32",
3570
3570
  "usage": {
3571
3571
  "price": {
3572
3572
  "value": 0.017847000000000002
@@ -3713,7 +3713,7 @@ function getTemplatesPipelineCollection() {
3713
3713
  "preparations": [
3714
3714
  {
3715
3715
  "id": 1,
3716
- "promptbookVersion": "0.92.0-30",
3716
+ "promptbookVersion": "0.92.0-32",
3717
3717
  "usage": {
3718
3718
  "price": {
3719
3719
  "value": 0.016389
@@ -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>) => void): Promise<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
  */
@@ -2,6 +2,7 @@ import Anthropic from '@anthropic-ai/sdk';
2
2
  import type { AvailableModel } from '../../execution/AvailableModel';
3
3
  import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
4
4
  import type { ChatPromptResult } from '../../execution/PromptResult';
5
+ import type { CompletionPromptResult } from '../../execution/PromptResult';
5
6
  import type { Prompt } from '../../types/Prompt';
6
7
  import type { string_markdown } from '../../types/typeAliases';
7
8
  import type { string_markdown_text } from '../../types/typeAliases';
@@ -19,6 +20,7 @@ export declare class AnthropicClaudeExecutionTools implements LlmExecutionTools
19
20
  * Anthropic Claude API client.
20
21
  */
21
22
  private client;
23
+ private limiter;
22
24
  /**
23
25
  * Creates Anthropic Claude Execution Tools.
24
26
  *
@@ -40,6 +42,10 @@ export declare class AnthropicClaudeExecutionTools implements LlmExecutionTools
40
42
  * Calls Anthropic Claude API to use a chat model.
41
43
  */
42
44
  callChatModel(prompt: Pick<Prompt, 'content' | 'parameters' | 'modelRequirements'>): Promise<ChatPromptResult>;
45
+ /**
46
+ * Calls Anthropic Claude API to use a completion model.
47
+ */
48
+ callCompletionModel(prompt: Pick<Prompt, 'content' | 'parameters' | 'modelRequirements'>): Promise<CompletionPromptResult>;
43
49
  /**
44
50
  * Get the model that should be used as default
45
51
  */
@@ -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>(dbName?: string, storeName?: string): PromptbookStorage<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-30`).
18
+ * It follows semantic versioning (e.g., `0.92.0-32`).
19
19
  *
20
20
  * @generated
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/templates",
3
- "version": "0.92.0-31",
3
+ "version": "0.92.0-33",
4
4
  "description": "It's time for a paradigm shift. The future of software in plain English, French or Latin",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -51,7 +51,7 @@
51
51
  "module": "./esm/index.es.js",
52
52
  "typings": "./esm/typings/src/_packages/templates.index.d.ts",
53
53
  "peerDependencies": {
54
- "@promptbook/core": "0.92.0-31"
54
+ "@promptbook/core": "0.92.0-33"
55
55
  },
56
56
  "dependencies": {
57
57
  "prettier": "2.8.1",
package/umd/index.umd.js CHANGED
@@ -23,7 +23,7 @@
23
23
  * @generated
24
24
  * @see https://github.com/webgptorg/promptbook
25
25
  */
26
- const PROMPTBOOK_ENGINE_VERSION = '0.92.0-31';
26
+ const PROMPTBOOK_ENGINE_VERSION = '0.92.0-33';
27
27
  /**
28
28
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
29
29
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -1578,7 +1578,7 @@
1578
1578
  "preparations": [
1579
1579
  {
1580
1580
  "id": 1,
1581
- "promptbookVersion": "0.92.0-30",
1581
+ "promptbookVersion": "0.92.0-32",
1582
1582
  "usage": {
1583
1583
  "price": {
1584
1584
  "value": 0.017265000000000003
@@ -2074,7 +2074,7 @@
2074
2074
  "preparations": [
2075
2075
  {
2076
2076
  "id": 1,
2077
- "promptbookVersion": "0.92.0-30",
2077
+ "promptbookVersion": "0.92.0-32",
2078
2078
  "usage": {
2079
2079
  "price": {
2080
2080
  "value": 0.017265000000000003
@@ -2697,7 +2697,7 @@
2697
2697
  "preparations": [
2698
2698
  {
2699
2699
  "id": 1,
2700
- "promptbookVersion": "0.92.0-30",
2700
+ "promptbookVersion": "0.92.0-32",
2701
2701
  "usage": {
2702
2702
  "price": {
2703
2703
  "value": 0.016422
@@ -2845,7 +2845,7 @@
2845
2845
  "preparations": [
2846
2846
  {
2847
2847
  "id": 1,
2848
- "promptbookVersion": "0.92.0-30",
2848
+ "promptbookVersion": "0.92.0-32",
2849
2849
  "usage": {
2850
2850
  "price": {
2851
2851
  "value": 0.016332
@@ -2941,7 +2941,7 @@
2941
2941
  "preparations": [
2942
2942
  {
2943
2943
  "id": 1,
2944
- "promptbookVersion": "0.92.0-30",
2944
+ "promptbookVersion": "0.92.0-32",
2945
2945
  "usage": {
2946
2946
  "price": {
2947
2947
  "value": 0
@@ -3084,7 +3084,7 @@
3084
3084
  "preparations": [
3085
3085
  {
3086
3086
  "id": 1,
3087
- "promptbookVersion": "0.92.0-30",
3087
+ "promptbookVersion": "0.92.0-32",
3088
3088
  "usage": {
3089
3089
  "price": {
3090
3090
  "value": 0.016719
@@ -3240,7 +3240,7 @@
3240
3240
  "preparations": [
3241
3241
  {
3242
3242
  "id": 1,
3243
- "promptbookVersion": "0.92.0-30",
3243
+ "promptbookVersion": "0.92.0-32",
3244
3244
  "usage": {
3245
3245
  "price": {
3246
3246
  "value": 0.016899
@@ -3573,7 +3573,7 @@
3573
3573
  "preparations": [
3574
3574
  {
3575
3575
  "id": 1,
3576
- "promptbookVersion": "0.92.0-30",
3576
+ "promptbookVersion": "0.92.0-32",
3577
3577
  "usage": {
3578
3578
  "price": {
3579
3579
  "value": 0.017847000000000002
@@ -3720,7 +3720,7 @@
3720
3720
  "preparations": [
3721
3721
  {
3722
3722
  "id": 1,
3723
- "promptbookVersion": "0.92.0-30",
3723
+ "promptbookVersion": "0.92.0-32",
3724
3724
  "usage": {
3725
3725
  "price": {
3726
3726
  "value": 0.016389