@promptbook/documents 0.103.0-42 → 0.103.0-44
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 +6 -18
- package/esm/index.es.js +47 -114
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +6 -0
- package/esm/typings/src/_packages/node.index.d.ts +0 -2
- package/esm/typings/src/_packages/types.index.d.ts +22 -0
- package/esm/typings/src/_packages/utils.index.d.ts +2 -0
- package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +2 -4
- package/esm/typings/src/book-2.0/agent-source/padBook.d.ts +1 -1
- package/esm/typings/src/book-2.0/agent-source/string_book.d.ts +1 -0
- package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/AvatarProfile.d.ts +6 -1
- package/esm/typings/src/book-components/BookEditor/BookEditor.d.ts +1 -1
- package/esm/typings/src/book-components/Chat/save/_common/ChatSaveFormatDefinition.d.ts +1 -1
- package/esm/typings/src/book-components/Chat/types/ChatParticipant.d.ts +1 -1
- package/esm/typings/src/book-components/Qr/BrandedQrCode.d.ts +1 -1
- package/esm/typings/src/book-components/Qr/useQrCode.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/_boilerplate.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/about.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/hello.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/list-models.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/list-scrapers.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/login.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/make.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/prettify.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/run.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/start-agents-server.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/start-pipelines-server.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/test-command.d.ts +1 -1
- package/esm/typings/src/cli/common/$addGlobalOptionsToCommand.d.ts +1 -1
- package/esm/typings/src/collection/agent-collection/AgentCollection.d.ts +2 -29
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +107 -0
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentsDatabaseSchema.d.ts +129 -0
- package/esm/typings/src/commands/_common/types/CommandParser.d.ts +1 -1
- package/esm/typings/src/config.d.ts +1 -1
- package/esm/typings/src/errors/0-index.d.ts +3 -0
- package/esm/typings/src/errors/DatabaseError.d.ts +12 -0
- package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +1 -1
- package/esm/typings/src/high-level-abstractions/_common/HighLevelAbstraction.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/register/$registeredLlmToolsMessage.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/register/LlmToolsMetadata.d.ts +1 -1
- package/esm/typings/src/llm-providers/_multiple/getSingleLlmExecutionTools.d.ts +1 -0
- package/esm/typings/src/llm-providers/_multiple/joinLlmExecutionTools.d.ts +1 -0
- package/esm/typings/src/llm-providers/agent/Agent.d.ts +5 -2
- package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/agent/AgentOptions.d.ts +4 -2
- package/esm/typings/src/llm-providers/agent/CreateAgentLlmExecutionToolsOptions.d.ts +4 -3
- package/esm/typings/src/llm-providers/agent/createAgentLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/google/google-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/openai-models.d.ts +1 -1
- package/esm/typings/src/prepare/PrepareAndScrapeOptions.d.ts +1 -0
- package/esm/typings/src/remote-server/startAgentServer.d.ts +2 -2
- package/esm/typings/src/remote-server/types/RemoteServerOptions.d.ts +0 -19
- package/esm/typings/src/storage/env-storage/$EnvStorage.d.ts +1 -1
- package/esm/typings/src/transpilers/_common/BookTranspiler.d.ts +5 -1
- package/esm/typings/src/transpilers/_common/BookTranspilerOptions.d.ts +1 -1
- package/esm/typings/src/transpilers/_common/register/$bookTranspilersRegister.d.ts +1 -1
- package/esm/typings/src/transpilers/formatted-book-in-markdown/FormattedBookInMarkdownTranspiler.d.ts +4 -1
- package/esm/typings/src/transpilers/formatted-book-in-markdown/register.d.ts +1 -1
- package/esm/typings/src/transpilers/openai-sdk/OpenAiSdkTranspiler.d.ts +4 -1
- package/esm/typings/src/transpilers/openai-sdk/register.d.ts +1 -1
- package/esm/typings/src/types/typeAliases.d.ts +19 -1
- package/esm/typings/src/utils/color/$randomColor.d.ts +1 -0
- package/esm/typings/src/utils/color/operators/darken.d.ts +1 -1
- package/esm/typings/src/utils/color/operators/grayscale.d.ts +1 -1
- package/esm/typings/src/utils/color/operators/lighten.d.ts +1 -1
- package/esm/typings/src/utils/color/operators/mixWithColor.d.ts +1 -1
- package/esm/typings/src/utils/color/operators/saturate.d.ts +1 -1
- package/esm/typings/src/utils/environment/$detectRuntimeEnvironment.d.ts +16 -0
- package/esm/typings/src/utils/execCommand/$execCommand.d.ts +1 -1
- package/esm/typings/src/utils/execCommand/$execCommands.d.ts +1 -1
- package/esm/typings/src/utils/files/$induceBookDownload.d.ts +2 -2
- package/esm/typings/src/utils/files/$induceFileDownload.d.ts +2 -2
- package/esm/typings/src/utils/files/ObjectUrl.d.ts +1 -1
- package/esm/typings/src/utils/misc/aboutPromptbookInformation.d.ts +6 -0
- package/esm/typings/src/utils/organization/$side_effect.d.ts +1 -1
- package/esm/typings/src/utils/random/$generateBookBoilerplate.d.ts +25 -0
- package/esm/typings/src/utils/random/$randomAgentPersona.d.ts +9 -0
- package/esm/typings/src/utils/random/$randomFullnameWithColor.d.ts +13 -0
- package/esm/typings/src/utils/random/$randomItem.d.ts +9 -0
- package/esm/typings/src/utils/random/$randomSeed.d.ts +3 -0
- package/esm/typings/src/utils/random/$randomToken.d.ts +2 -0
- package/esm/typings/src/utils/serialization/$deepFreeze.d.ts +1 -1
- package/esm/typings/src/utils/serialization/serializeToPromptbookJavascript.d.ts +2 -2
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +47 -114
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/collection/agent-collection/constructors/AgentCollectionInDirectory.d.ts +0 -89
- package/esm/typings/src/collection/agent-collection/constructors/AgentCollectionInDirectory.test.d.ts +0 -1
- package/esm/typings/src/commands/_common/parseCommand.test.d.ts +0 -1
- package/esm/typings/src/execution/utils/logLlmCall.d.ts +0 -8
package/README.md
CHANGED
|
@@ -9,8 +9,8 @@ Turn your company's scattered knowledge into AI ready Books
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
[ Promptbook](https://badge.fury.io/js/promptbook.svg)](https://www.npmjs.com/package/promptbook)
|
|
13
|
+
[ Promptbook](https://packagequality.com/shield/promptbook.svg)](https://packagequality.com/#?package=promptbook)
|
|
14
14
|
[](https://snyk.io/test/github/webgptorg/promptbook)
|
|
15
15
|
[](https://github.com/webgptorg/promptbook/actions/workflows/test-books.yml)
|
|
16
16
|
[](https://github.com/webgptorg/promptbook/actions/workflows/test-build.yml)
|
|
@@ -23,11 +23,7 @@ Turn your company's scattered knowledge into AI ready Books
|
|
|
23
23
|
|
|
24
24
|
## 🌟 New Features
|
|
25
25
|
|
|
26
|
-
-
|
|
27
|
-
- 💡 VS Code support for `.book` files with syntax highlighting and IntelliSense
|
|
28
|
-
- 🐳 Official Docker image (`hejny/promptbook`) for seamless containerized usage
|
|
29
|
-
- 🔥 Native support for OpenAI `o3-mini`, GPT-4 and other leading LLMs
|
|
30
|
-
- 🔍 DeepSeek integration for advanced knowledge search
|
|
26
|
+
- **Gemini 3 Support**
|
|
31
27
|
|
|
32
28
|
|
|
33
29
|
|
|
@@ -119,7 +115,7 @@ Promptbook Engine will automatically enforce this knowledge during interactions.
|
|
|
119
115
|
Your job is to provide legal advice and support to the company and its employees.<br/>
|
|
120
116
|
You are knowledgeable, professional, and detail-oriented.<br/>
|
|
121
117
|
<br/>
|
|
122
|
-
**KNOWLEDGE**
|
|
118
|
+
**KNOWLEDGE** https://company.com/company-policies.pdf<br/>
|
|
123
119
|
**KNOWLEDGE** https://company.com/internal-documents/employee-handbook.docx<br/>
|
|
124
120
|
|
|
125
121
|
</td></tr></table>
|
|
@@ -141,7 +137,7 @@ You are knowledgeable, professional, and detail-oriented.<br/>
|
|
|
141
137
|
**RULE** Always ensure compliance with laws and regulations.<br/>
|
|
142
138
|
**RULE** Never provide legal advice outside your area of expertise.<br/>
|
|
143
139
|
**RULE** Never provide legal advice about criminal law.<br/>
|
|
144
|
-
**KNOWLEDGE**
|
|
140
|
+
**KNOWLEDGE** https://company.com/company-policies.pdf<br/>
|
|
145
141
|
**KNOWLEDGE** https://company.com/internal-documents/employee-handbook.docx<br/>
|
|
146
142
|
|
|
147
143
|
</td></tr></table>
|
|
@@ -161,7 +157,7 @@ You are knowledgeable, professional, and detail-oriented.<br/>
|
|
|
161
157
|
**RULE** Always ensure compliance with laws and regulations.<br/>
|
|
162
158
|
**RULE** Never provide legal advice outside your area of expertise.<br/>
|
|
163
159
|
**RULE** Never provide legal advice about criminal law.<br/>
|
|
164
|
-
**KNOWLEDGE**
|
|
160
|
+
**KNOWLEDGE** https://company.com/company-policies.pdf<br/>
|
|
165
161
|
**KNOWLEDGE** https://company.com/internal-documents/employee-handbook.docx<br/>
|
|
166
162
|
**ACTION** When a user asks about an issue that could be treated as a crime, notify legal@company.com.<br/>
|
|
167
163
|
|
|
@@ -212,14 +208,10 @@ Now you want to use it. There are several ways how to write your first book:
|
|
|
212
208
|
|
|
213
209
|
We have written ai asistant in book who can help you with writing your first book.
|
|
214
210
|
|
|
215
|
-
|
|
216
|
-
|
|
217
211
|
#### Your AI twin
|
|
218
212
|
|
|
219
213
|
Copy your own behavior, personality, and knowledge into book and create your AI twin. It can help you with your work, personal life, or any other task.
|
|
220
214
|
|
|
221
|
-
|
|
222
|
-
|
|
223
215
|
#### AI persona workpool
|
|
224
216
|
|
|
225
217
|
Or you can pick from our library of pre-written books for various roles and tasks. You can find books for customer support, coding, marketing, sales, HR, legal, and many other roles.
|
|
@@ -339,8 +331,6 @@ Join our growing community of developers and users:
|
|
|
339
331
|
|
|
340
332
|
|
|
341
333
|
|
|
342
|
-
|
|
343
|
-
|
|
344
334
|
## 📚 Documentation
|
|
345
335
|
|
|
346
336
|
See detailed guides and API reference in the [docs](https://github.com/webgptorg/promptbook/discussions/categories/concepts) or [online](https://discord.gg/x3QWNaa89N).
|
|
@@ -417,8 +407,6 @@ The following glossary is used to clarify certain concepts:
|
|
|
417
407
|
|
|
418
408
|
_Note: This section is not a complete dictionary, more list of general AI / LLM terms that has connection with Promptbook_
|
|
419
409
|
|
|
420
|
-
|
|
421
|
-
|
|
422
410
|
### 💯 Core concepts
|
|
423
411
|
|
|
424
412
|
- [📚 Collection of pipelines](https://github.com/webgptorg/promptbook/discussions/65)
|
package/esm/index.es.js
CHANGED
|
@@ -19,14 +19,14 @@ import { parse, unparse } from 'papaparse';
|
|
|
19
19
|
* @generated
|
|
20
20
|
* @see https://github.com/webgptorg/book
|
|
21
21
|
*/
|
|
22
|
-
const BOOK_LANGUAGE_VERSION = '
|
|
22
|
+
const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
23
23
|
/**
|
|
24
24
|
* The version of the Promptbook engine
|
|
25
25
|
*
|
|
26
26
|
* @generated
|
|
27
27
|
* @see https://github.com/webgptorg/promptbook
|
|
28
28
|
*/
|
|
29
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.103.0-
|
|
29
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.103.0-44';
|
|
30
30
|
/**
|
|
31
31
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
32
32
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -707,6 +707,23 @@ class Color {
|
|
|
707
707
|
* TODO: Maybe connect with textures
|
|
708
708
|
*/
|
|
709
709
|
|
|
710
|
+
/**
|
|
711
|
+
* Makes color transformer which returns a grayscale version of the color
|
|
712
|
+
*
|
|
713
|
+
* @param amount from 0 to 1
|
|
714
|
+
*
|
|
715
|
+
* @public exported from `@promptbook/color`
|
|
716
|
+
*/
|
|
717
|
+
function grayscale(amount) {
|
|
718
|
+
return ({ red, green, blue, alpha }) => {
|
|
719
|
+
const average = (red + green + blue) / 3;
|
|
720
|
+
red = Math.round(average * amount + red * (1 - amount));
|
|
721
|
+
green = Math.round(average * amount + green * (1 - amount));
|
|
722
|
+
blue = Math.round(average * amount + blue * (1 - amount));
|
|
723
|
+
return Color.fromValues(red, green, blue, alpha);
|
|
724
|
+
};
|
|
725
|
+
}
|
|
726
|
+
|
|
710
727
|
/**
|
|
711
728
|
* Converts HSL values to RGB values
|
|
712
729
|
*
|
|
@@ -822,102 +839,6 @@ function lighten(amount) {
|
|
|
822
839
|
* TODO: Maybe implement by mix+hsl
|
|
823
840
|
*/
|
|
824
841
|
|
|
825
|
-
/**
|
|
826
|
-
* Calculates distance between two colors
|
|
827
|
-
*
|
|
828
|
-
* @param color1 first color
|
|
829
|
-
* @param color2 second color
|
|
830
|
-
*
|
|
831
|
-
* Note: This function is inefficient. Use colorDistanceSquared instead if possible.
|
|
832
|
-
*
|
|
833
|
-
* @public exported from `@promptbook/color`
|
|
834
|
-
*/
|
|
835
|
-
/**
|
|
836
|
-
* Calculates distance between two colors without square root
|
|
837
|
-
*
|
|
838
|
-
* @param color1 first color
|
|
839
|
-
* @param color2 second color
|
|
840
|
-
*
|
|
841
|
-
* @public exported from `@promptbook/color`
|
|
842
|
-
*/
|
|
843
|
-
function colorDistanceSquared(color1, color2) {
|
|
844
|
-
const rmean = (color1.red + color2.red) / 2;
|
|
845
|
-
const r = color1.red - color2.red;
|
|
846
|
-
const g = color1.green - color2.green;
|
|
847
|
-
const b = color1.blue - color2.blue;
|
|
848
|
-
const weightR = 2 + rmean / 256;
|
|
849
|
-
const weightG = 4.0;
|
|
850
|
-
const weightB = 2 + (255 - rmean) / 256;
|
|
851
|
-
const distance = weightR * r * r + weightG * g * g + weightB * b * b;
|
|
852
|
-
return distance;
|
|
853
|
-
}
|
|
854
|
-
|
|
855
|
-
/**
|
|
856
|
-
* Makes color transformer which finds the nearest color from the given list
|
|
857
|
-
*
|
|
858
|
-
* @param colors array of colors to choose from
|
|
859
|
-
*
|
|
860
|
-
* @public exported from `@promptbook/color`
|
|
861
|
-
*/
|
|
862
|
-
function nearest(...colors) {
|
|
863
|
-
return (color) => {
|
|
864
|
-
const distances = colors.map((c) => colorDistanceSquared(c, color));
|
|
865
|
-
const minDistance = Math.min(...distances);
|
|
866
|
-
const minIndex = distances.indexOf(minDistance);
|
|
867
|
-
const nearestColor = colors[minIndex];
|
|
868
|
-
return nearestColor;
|
|
869
|
-
};
|
|
870
|
-
}
|
|
871
|
-
|
|
872
|
-
/**
|
|
873
|
-
* Color transformer which returns the negative color
|
|
874
|
-
*
|
|
875
|
-
* @public exported from `@promptbook/color`
|
|
876
|
-
*/
|
|
877
|
-
function negative(color) {
|
|
878
|
-
const r = 255 - color.red;
|
|
879
|
-
const g = 255 - color.green;
|
|
880
|
-
const b = 255 - color.blue;
|
|
881
|
-
return Color.fromValues(r, g, b, color.alpha);
|
|
882
|
-
}
|
|
883
|
-
|
|
884
|
-
/**
|
|
885
|
-
* Makes color transformer which finds the furthest color from the given list
|
|
886
|
-
*
|
|
887
|
-
* @param colors array of colors to choose from
|
|
888
|
-
*
|
|
889
|
-
* @public exported from `@promptbook/color`
|
|
890
|
-
*/
|
|
891
|
-
function furthest(...colors) {
|
|
892
|
-
return (color) => {
|
|
893
|
-
const furthestColor = negative(nearest(...colors.map(negative))(color));
|
|
894
|
-
return furthestColor;
|
|
895
|
-
};
|
|
896
|
-
}
|
|
897
|
-
/**
|
|
898
|
-
* Makes color transformer which finds the best text color (black or white) for the given background color
|
|
899
|
-
*
|
|
900
|
-
* @public exported from `@promptbook/color`
|
|
901
|
-
*/
|
|
902
|
-
furthest(Color.get('white'), Color.from('black'));
|
|
903
|
-
|
|
904
|
-
/**
|
|
905
|
-
* Makes color transformer which returns a grayscale version of the color
|
|
906
|
-
*
|
|
907
|
-
* @param amount from 0 to 1
|
|
908
|
-
*
|
|
909
|
-
* @public exported from `@promptbook/color`
|
|
910
|
-
*/
|
|
911
|
-
function grayscale(amount) {
|
|
912
|
-
return ({ red, green, blue, alpha }) => {
|
|
913
|
-
const average = (red + green + blue) / 3;
|
|
914
|
-
red = Math.round(average * amount + red * (1 - amount));
|
|
915
|
-
green = Math.round(average * amount + green * (1 - amount));
|
|
916
|
-
blue = Math.round(average * amount + blue * (1 - amount));
|
|
917
|
-
return Color.fromValues(red, green, blue, alpha);
|
|
918
|
-
};
|
|
919
|
-
}
|
|
920
|
-
|
|
921
842
|
/**
|
|
922
843
|
* Makes color transformer which saturate the given color
|
|
923
844
|
*
|
|
@@ -3200,6 +3121,7 @@ function createPipelineCollectionFromJson(...promptbooks) {
|
|
|
3200
3121
|
/**
|
|
3201
3122
|
* Generates random token
|
|
3202
3123
|
*
|
|
3124
|
+
* Note: `$` is used to indicate that this function is not a pure function - it is not deterministic
|
|
3203
3125
|
* Note: This function is cryptographically secure (it uses crypto.randomBytes internally)
|
|
3204
3126
|
*
|
|
3205
3127
|
* @private internal helper function
|
|
@@ -3209,6 +3131,7 @@ function $randomToken(randomness) {
|
|
|
3209
3131
|
return randomBytes(randomness).toString('hex');
|
|
3210
3132
|
}
|
|
3211
3133
|
/**
|
|
3134
|
+
* TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
|
|
3212
3135
|
* TODO: Maybe use nanoid instead https://github.com/ai/nanoid
|
|
3213
3136
|
*/
|
|
3214
3137
|
|
|
@@ -3327,6 +3250,22 @@ class CollectionError extends Error {
|
|
|
3327
3250
|
}
|
|
3328
3251
|
}
|
|
3329
3252
|
|
|
3253
|
+
/**
|
|
3254
|
+
* This error indicates error from the database
|
|
3255
|
+
*
|
|
3256
|
+
* @public exported from `@promptbook/core`
|
|
3257
|
+
*/
|
|
3258
|
+
class DatabaseError extends Error {
|
|
3259
|
+
constructor(message) {
|
|
3260
|
+
super(message);
|
|
3261
|
+
this.name = 'DatabaseError';
|
|
3262
|
+
Object.setPrototypeOf(this, DatabaseError.prototype);
|
|
3263
|
+
}
|
|
3264
|
+
}
|
|
3265
|
+
/**
|
|
3266
|
+
* TODO: !!!! Explain that NotFoundError (!!! and other specific errors) has priority over DatabaseError in some contexts
|
|
3267
|
+
*/
|
|
3268
|
+
|
|
3330
3269
|
/**
|
|
3331
3270
|
* This error occurs when some expectation is not met in the execution of the pipeline
|
|
3332
3271
|
*
|
|
@@ -3430,6 +3369,7 @@ const PROMPTBOOK_ERRORS = {
|
|
|
3430
3369
|
UnexpectedError,
|
|
3431
3370
|
WrappedError,
|
|
3432
3371
|
NotAllowed,
|
|
3372
|
+
DatabaseError,
|
|
3433
3373
|
// TODO: [🪑]> VersionMismatchError,
|
|
3434
3374
|
};
|
|
3435
3375
|
/**
|
|
@@ -4266,6 +4206,7 @@ function joinLlmExecutionTools(title, ...llmExecutionTools) {
|
|
|
4266
4206
|
return new MultipleLlmExecutionTools(title || 'Multiple LLM Providers joined by `joinLlmExecutionTools`', ...llmExecutionTools);
|
|
4267
4207
|
}
|
|
4268
4208
|
/**
|
|
4209
|
+
* TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
|
|
4269
4210
|
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
4270
4211
|
*/
|
|
4271
4212
|
|
|
@@ -4282,6 +4223,7 @@ function getSingleLlmExecutionTools(oneOrMoreLlmExecutionTools) {
|
|
|
4282
4223
|
return llmTools;
|
|
4283
4224
|
}
|
|
4284
4225
|
/**
|
|
4226
|
+
* TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
|
|
4285
4227
|
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
4286
4228
|
*/
|
|
4287
4229
|
|
|
@@ -5857,18 +5799,6 @@ function templateParameters(template, parameters) {
|
|
|
5857
5799
|
return replacedTemplates;
|
|
5858
5800
|
}
|
|
5859
5801
|
|
|
5860
|
-
/**
|
|
5861
|
-
* Logs an LLM call with the given report.
|
|
5862
|
-
*
|
|
5863
|
-
* @private internal utility of `createPipelineExecutor`
|
|
5864
|
-
*/
|
|
5865
|
-
function logLlmCall(logLlmCall, report) {
|
|
5866
|
-
logLlmCall({
|
|
5867
|
-
modelName: 'model' /* <- TODO: How to get model name from the report */,
|
|
5868
|
-
report,
|
|
5869
|
-
});
|
|
5870
|
-
}
|
|
5871
|
-
|
|
5872
5802
|
/**
|
|
5873
5803
|
* Extracts all code blocks from markdown.
|
|
5874
5804
|
*
|
|
@@ -6214,7 +6144,7 @@ function validatePromptResult(options) {
|
|
|
6214
6144
|
*/
|
|
6215
6145
|
async function executeAttempts(options) {
|
|
6216
6146
|
const { jokerParameterNames, priority, maxAttempts, // <- Note: [💂]
|
|
6217
|
-
preparedContent, parameters, task, preparedPipeline, tools, $executionReport, pipelineIdentification, maxExecutionAttempts, onProgress, logLlmCall
|
|
6147
|
+
preparedContent, parameters, task, preparedPipeline, tools, $executionReport, pipelineIdentification, maxExecutionAttempts, onProgress, logLlmCall, } = options;
|
|
6218
6148
|
const $ongoingTaskResult = {
|
|
6219
6149
|
$result: null,
|
|
6220
6150
|
$resultString: null,
|
|
@@ -6476,8 +6406,11 @@ async function executeAttempts(options) {
|
|
|
6476
6406
|
: serializeError($ongoingTaskResult.$expectError),
|
|
6477
6407
|
};
|
|
6478
6408
|
$executionReport.promptExecutions.push(executionPromptReport);
|
|
6479
|
-
if (logLlmCall
|
|
6480
|
-
logLlmCall(
|
|
6409
|
+
if (logLlmCall) {
|
|
6410
|
+
logLlmCall({
|
|
6411
|
+
modelName: 'model' /* <- TODO: How to get model name from the report */,
|
|
6412
|
+
report: executionPromptReport,
|
|
6413
|
+
});
|
|
6481
6414
|
}
|
|
6482
6415
|
}
|
|
6483
6416
|
}
|
|
@@ -6751,7 +6684,7 @@ async function getKnowledgeForTask(options) {
|
|
|
6751
6684
|
},
|
|
6752
6685
|
content: task.content,
|
|
6753
6686
|
parameters,
|
|
6754
|
-
};
|
|
6687
|
+
}; /* <- Note: [🤛] */
|
|
6755
6688
|
const taskEmbeddingResult = await llmTools.callEmbeddingModel(taskEmbeddingPrompt);
|
|
6756
6689
|
const knowledgePiecesWithRelevance = preparedPipeline.knowledgePieces.map((knowledgePiece) => {
|
|
6757
6690
|
const { index } = knowledgePiece;
|