@promptbook/pdf 0.104.0-3 → 0.104.0-4

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.
@@ -1,8 +1,8 @@
1
1
  import type { ChatParticipant } from '../../book-components/Chat/types/ChatParticipant';
2
2
  import type { AvailableModel } from '../../execution/AvailableModel';
3
3
  import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
4
- import type { ChatPromptResult, CompletionPromptResult, EmbeddingPromptResult, PromptResult } from '../../execution/PromptResult';
5
- import type { ChatPrompt, CompletionPrompt, EmbeddingPrompt, Prompt } from '../../types/Prompt';
4
+ import type { ChatPromptResult, CompletionPromptResult, EmbeddingPromptResult, ImagePromptResult, PromptResult } from '../../execution/PromptResult';
5
+ import type { ChatPrompt, CompletionPrompt, EmbeddingPrompt, ImagePrompt, Prompt } from '../../types/Prompt';
6
6
  import type { string_markdown, string_markdown_text, string_title } from '../../types/typeAliases';
7
7
  /**
8
8
  * Multiple LLM Execution Tools is a proxy server that uses multiple execution tools internally and exposes the executor interface externally.
@@ -43,6 +43,10 @@ export declare class MultipleLlmExecutionTools implements LlmExecutionTools {
43
43
  * Calls the best available embedding model
44
44
  */
45
45
  callEmbeddingModel(prompt: EmbeddingPrompt): Promise<EmbeddingPromptResult>;
46
+ /**
47
+ * Calls the best available embedding model
48
+ */
49
+ callImageGenerationModel(prompt: ImagePrompt): Promise<ImagePromptResult>;
46
50
  /**
47
51
  * Calls the best available model
48
52
  *
@@ -46,6 +46,7 @@ export declare class RemoteLlmExecutionTools<TCustomOptions = undefined> impleme
46
46
  private callCommonModel;
47
47
  }
48
48
  /**
49
+ * TODO: !!!! Deprecate pipeline server and all of its components
49
50
  * TODO: Maybe use `$exportJson`
50
51
  * TODO: [🧠][🛍] Maybe not `isAnonymous: boolean` BUT `mode: 'ANONYMOUS'|'COLLECTION'`
51
52
  * TODO: [🍓] Allow to list compatible models with each variant
@@ -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.104.0-2`).
18
+ * It follows semantic versioning (e.g., `0.104.0-3`).
19
19
  *
20
20
  * @generated
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/pdf",
3
- "version": "0.104.0-3",
3
+ "version": "0.104.0-4",
4
4
  "description": "Promptbook: Turn your company's scattered knowledge into AI ready books",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -94,7 +94,7 @@
94
94
  "module": "./esm/index.es.js",
95
95
  "typings": "./esm/typings/src/_packages/pdf.index.d.ts",
96
96
  "peerDependencies": {
97
- "@promptbook/core": "0.104.0-3"
97
+ "@promptbook/core": "0.104.0-4"
98
98
  },
99
99
  "dependencies": {
100
100
  "crypto": "1.0.1",
package/umd/index.umd.js CHANGED
@@ -24,7 +24,7 @@
24
24
  * @generated
25
25
  * @see https://github.com/webgptorg/promptbook
26
26
  */
27
- const PROMPTBOOK_ENGINE_VERSION = '0.104.0-3';
27
+ const PROMPTBOOK_ENGINE_VERSION = '0.104.0-4';
28
28
  /**
29
29
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
30
30
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -3885,6 +3885,15 @@
3885
3885
  return promptResult;
3886
3886
  };
3887
3887
  }
3888
+ if (llmTools.callImageGenerationModel !== undefined) {
3889
+ proxyTools.callImageGenerationModel = async (prompt) => {
3890
+ // console.info('[🚕] callImageGenerationModel through countTotalUsage');
3891
+ const promptResult = await llmTools.callImageGenerationModel(prompt);
3892
+ totalUsage = addUsage(totalUsage, promptResult.usage);
3893
+ spending.next(promptResult.usage);
3894
+ return promptResult;
3895
+ };
3896
+ }
3888
3897
  // <- Note: [🤖]
3889
3898
  return proxyTools;
3890
3899
  }
@@ -3994,6 +4003,12 @@
3994
4003
  callEmbeddingModel(prompt) {
3995
4004
  return this.callCommonModel(prompt);
3996
4005
  }
4006
+ /**
4007
+ * Calls the best available embedding model
4008
+ */
4009
+ callImageGenerationModel(prompt) {
4010
+ return this.callCommonModel(prompt);
4011
+ }
3997
4012
  // <- Note: [🤖]
3998
4013
  /**
3999
4014
  * Calls the best available model
@@ -4020,6 +4035,11 @@
4020
4035
  continue llm;
4021
4036
  }
4022
4037
  return await llmExecutionTools.callEmbeddingModel(prompt);
4038
+ case 'IMAGE_GENERATION':
4039
+ if (llmExecutionTools.callImageGenerationModel === undefined) {
4040
+ continue llm;
4041
+ }
4042
+ return await llmExecutionTools.callImageGenerationModel(prompt);
4023
4043
  // <- case [🤖]:
4024
4044
  default:
4025
4045
  throw new UnexpectedError(`Unknown model variant "${prompt.modelRequirements.modelVariant}" in ${llmExecutionTools.title}`);
@@ -6154,8 +6174,9 @@
6154
6174
  $ongoingTaskResult.$resultString = $ongoingTaskResult.$completionResult.content;
6155
6175
  break variant;
6156
6176
  case 'EMBEDDING':
6177
+ case 'IMAGE_GENERATION':
6157
6178
  throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6158
- Embedding model can not be used in pipeline
6179
+ ${modelRequirements.modelVariant} model can not be used in pipeline
6159
6180
 
6160
6181
  This should be catched during parsing
6161
6182