@promptbook/components 0.103.0-35 → 0.103.0-37
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 +2000 -241
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +4 -0
- package/esm/typings/src/_packages/types.index.d.ts +5 -1
- package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +1 -0
- package/esm/typings/src/book-components/Chat/save/html/htmlSaveFormatDefinition.d.ts +1 -0
- package/esm/typings/src/book-components/Chat/save/pdf/pdfSaveFormatDefinition.d.ts +4 -0
- package/esm/typings/src/book-components/_common/Tooltip/Tooltip.d.ts +47 -0
- package/esm/typings/src/errors/0-index.d.ts +3 -0
- package/esm/typings/src/errors/NotAllowed.d.ts +9 -0
- package/esm/typings/src/execution/AvailableModel.d.ts +1 -0
- package/esm/typings/src/execution/Executables.d.ts +3 -0
- package/esm/typings/src/execution/ExecutionTools.d.ts +5 -0
- package/esm/typings/src/execution/LlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/agent/Agent.d.ts +44 -0
- package/esm/typings/src/llm-providers/agent/AgentOptions.d.ts +17 -0
- package/esm/typings/src/llm-providers/agent/CreateAgentLlmExecutionToolsOptions.d.ts +16 -0
- package/esm/typings/src/llm-providers/agent/createAgentLlmExecutionTools.d.ts +1 -15
- package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +12 -0
- package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionToolsOptions.d.ts +7 -1
- package/esm/typings/src/remote-server/startRemoteServer.d.ts +2 -0
- package/esm/typings/src/types/Updatable.d.ts +19 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +4 -1
- package/umd/index.umd.js +2004 -244
- package/umd/index.umd.js.map +1 -1
package/esm/index.es.js
CHANGED
|
@@ -13,7 +13,9 @@ import { SHA256 } from 'crypto-js';
|
|
|
13
13
|
import { lookup, extension } from 'mime-types';
|
|
14
14
|
import { parse, unparse } from 'papaparse';
|
|
15
15
|
import 'moment';
|
|
16
|
-
import 'colors';
|
|
16
|
+
import colors from 'colors';
|
|
17
|
+
import Bottleneck from 'bottleneck';
|
|
18
|
+
import OpenAI from 'openai';
|
|
17
19
|
import hljs from 'highlight.js';
|
|
18
20
|
import katex from 'katex';
|
|
19
21
|
import { Converter } from 'showdown';
|
|
@@ -33,7 +35,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
33
35
|
* @generated
|
|
34
36
|
* @see https://github.com/webgptorg/promptbook
|
|
35
37
|
*/
|
|
36
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.103.0-
|
|
38
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.103.0-37';
|
|
37
39
|
/**
|
|
38
40
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
39
41
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -3397,6 +3399,13 @@ const VALUE_STRINGS = {
|
|
|
3397
3399
|
* @public exported from `@promptbook/utils`
|
|
3398
3400
|
*/
|
|
3399
3401
|
const SMALL_NUMBER = 0.001;
|
|
3402
|
+
// <- TODO: [⏳] Standardize timeouts, Make DEFAULT_TIMEOUT_MS as global constant
|
|
3403
|
+
/**
|
|
3404
|
+
* How many times to retry the connections
|
|
3405
|
+
*
|
|
3406
|
+
* @private within the repository - too low-level in comparison with other `MAX_...`
|
|
3407
|
+
*/
|
|
3408
|
+
const CONNECTION_RETRIES_LIMIT = 5;
|
|
3400
3409
|
/**
|
|
3401
3410
|
* Short time interval to prevent race conditions in milliseconds
|
|
3402
3411
|
*
|
|
@@ -3496,7 +3505,7 @@ const DEFAULT_MAX_REQUESTS_PER_MINUTE = 60;
|
|
|
3496
3505
|
*
|
|
3497
3506
|
* @public exported from `@promptbook/core`
|
|
3498
3507
|
*/
|
|
3499
|
-
parseInt(process.env.API_REQUEST_TIMEOUT || '90000');
|
|
3508
|
+
const API_REQUEST_TIMEOUT = parseInt(process.env.API_REQUEST_TIMEOUT || '90000');
|
|
3500
3509
|
/**
|
|
3501
3510
|
* Indicates whether pipeline logic validation is enabled. When true, the pipeline logic is checked for consistency.
|
|
3502
3511
|
*
|
|
@@ -3888,6 +3897,12 @@ const ORDER_OF_PIPELINE_JSON = [
|
|
|
3888
3897
|
* @private within the repository
|
|
3889
3898
|
*/
|
|
3890
3899
|
const REPLACING_NONCE = 'ptbkauk42kV2dzao34faw7FudQUHYPtW';
|
|
3900
|
+
/**
|
|
3901
|
+
* Nonce which is used as string which is not occurring in normal text
|
|
3902
|
+
*
|
|
3903
|
+
* @private within the repository
|
|
3904
|
+
*/
|
|
3905
|
+
const SALT_NONCE = 'ptbkghhewbvruets21t54et5';
|
|
3891
3906
|
/**
|
|
3892
3907
|
* Placeholder value indicating a parameter is missing its value.
|
|
3893
3908
|
*
|
|
@@ -4495,6 +4510,19 @@ class MissingToolsError extends Error {
|
|
|
4495
4510
|
}
|
|
4496
4511
|
}
|
|
4497
4512
|
|
|
4513
|
+
/**
|
|
4514
|
+
* This error indicates that promptbook operation is not allowed
|
|
4515
|
+
*
|
|
4516
|
+
* @public exported from `@promptbook/core`
|
|
4517
|
+
*/
|
|
4518
|
+
class NotAllowed extends Error {
|
|
4519
|
+
constructor(message) {
|
|
4520
|
+
super(message);
|
|
4521
|
+
this.name = 'NotAllowed';
|
|
4522
|
+
Object.setPrototypeOf(this, NotAllowed.prototype);
|
|
4523
|
+
}
|
|
4524
|
+
}
|
|
4525
|
+
|
|
4498
4526
|
/**
|
|
4499
4527
|
* This error indicates that promptbook not found in the collection
|
|
4500
4528
|
*
|
|
@@ -4644,6 +4672,7 @@ const PROMPTBOOK_ERRORS = {
|
|
|
4644
4672
|
PromptbookFetchError,
|
|
4645
4673
|
UnexpectedError,
|
|
4646
4674
|
WrappedError,
|
|
4675
|
+
NotAllowed,
|
|
4647
4676
|
// TODO: [🪑]> VersionMismatchError,
|
|
4648
4677
|
};
|
|
4649
4678
|
/**
|
|
@@ -5240,6 +5269,18 @@ const CountUtils = {
|
|
|
5240
5269
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
5241
5270
|
*/
|
|
5242
5271
|
|
|
5272
|
+
/**
|
|
5273
|
+
* Simple wrapper `new Date().toISOString()`
|
|
5274
|
+
*
|
|
5275
|
+
* Note: `$` is used to indicate that this function is not a pure function - it is not deterministic because it depends on the current time
|
|
5276
|
+
*
|
|
5277
|
+
* @returns string_date branded type
|
|
5278
|
+
* @public exported from `@promptbook/utils`
|
|
5279
|
+
*/
|
|
5280
|
+
function $getCurrentDate() {
|
|
5281
|
+
return new Date().toISOString();
|
|
5282
|
+
}
|
|
5283
|
+
|
|
5243
5284
|
/**
|
|
5244
5285
|
* Function parseNumber will parse number from string
|
|
5245
5286
|
*
|
|
@@ -5710,12 +5751,15 @@ const DEFAULT_BOOK = padBook(validateBook(spaceTrim$1(`
|
|
|
5710
5751
|
PERSONA A friendly AI assistant that helps you with your tasks
|
|
5711
5752
|
`)));
|
|
5712
5753
|
// <- Note: Not using book`...` notation to avoid strange error in jest unit tests `TypeError: (0 , book_notation_1.book) is not a function`
|
|
5754
|
+
// <- TODO: !!! GENESIS_BOOK
|
|
5755
|
+
// <- !!! Buttons into genesis book
|
|
5756
|
+
// <- TODO: !!! createBookBoilerplate and deprecate `DEFAULT_BOOK`
|
|
5713
5757
|
|
|
5714
5758
|
var css_248z$5 = ".BookEditor-module_BookEditor__s-0PU{width:100%}.BookEditor-module_bookEditorContainer__wLMwM{box-sizing:border-box;height:100%;padding:10px 25px 0;position:relative;width:100%}.BookEditor-module_bookEditorContainer__wLMwM.BookEditor-module_isVerbose__VQ6iL{background-color:rgba(0,0,0,.05);outline:1px dotted rgba(0,0,0,.5)}.BookEditor-module_isVerbose__VQ6iL{outline:2px dotted #ff7526}.BookEditor-module_bookEditorWrapper__twppD{background-color:#fff;border:1px solid rgba(209,213,219,.8);border-radius:1rem;box-shadow:0 1px 2px 0 rgba(0,0,0,.05);overflow:hidden;padding-top:10px;transition:box-shadow .2s ease-in-out}.BookEditor-module_isVerbose__VQ6iL .BookEditor-module_bookEditorWrapper__twppD{overflow:visible}.BookEditor-module_bookEditorWrapper__twppD:hover{box-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -1px rgba(0,0,0,.06)}.BookEditor-module_bookEditorWrapper__twppD.BookEditor-module_isBorderRadiusDisabled__h1I3v{border-radius:0}.BookEditor-module_dropOverlay__xWWoX{align-items:center;background-color:rgba(0,0,0,.5);bottom:0;color:#fff;display:flex;font-size:1.5rem;justify-content:center;left:0;pointer-events:none;position:absolute;right:0;top:0;z-index:100}.BookEditor-module_bookEditorContainer__wLMwM .view-line{border-bottom:1px solid #eee}.BookEditor-module_bookEditorActionbar__KW6dc{position:absolute;right:55px;top:10px;z-index:100}.BookEditor-module_fullscreen__rktsl{border:none;border-radius:0;bottom:0;box-shadow:none;height:100%;left:0;padding-top:50px;position:fixed;right:0;top:0;width:100%;z-index:9999}.BookEditor-module_button__hS390{align-items:center;background-color:#fff;border:1px solid #d1d5db;border-radius:.375rem;box-shadow:0 1px 2px 0 rgba(0,0,0,.05);color:#374151;cursor:pointer;display:inline-flex;gap:.5rem;padding:.5rem 1rem;transition:all .2s ease-in-out}.BookEditor-module_button__hS390:hover{background-color:#f9fafb;border-color:#b7bcce;box-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px 0 rgba(0,0,0,.06)}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkJvb2tFZGl0b3IubW9kdWxlLmNzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxxQ0FFSSxVQUNKLENBRUEsOENBS0kscUJBQXNCLENBSHRCLFdBQVksQ0FFWixtQkFBb0IsQ0FEcEIsaUJBQWtCLENBRmxCLFVBS0osQ0FFQSxpRkFFSSxnQ0FBcUMsQ0FDckMsaUNBRUosQ0FFQSxvQ0FDSSwwQkFDSixDQUVBLDRDQUtJLHFCQUF1QixDQUR2QixxQ0FBMEMsQ0FGMUMsa0JBQW1CLENBSW5CLHNDQUEyQyxDQUwzQyxlQUFnQixDQUVoQixnQkFBaUIsQ0FJakIscUNBQ0osQ0FDQSxnRkFFSSxnQkFFSixDQUVBLGtEQUNJLHVFQUNKLENBVUEsNEZBQ0ksZUFDSixDQUVBLHNDQVNJLGtCQUFtQixDQUhuQiwrQkFBb0MsQ0FEcEMsUUFBUyxDQUVULFVBQVksQ0FDWixZQUFhLENBR2IsZ0JBQWlCLENBRGpCLHNCQUF1QixDQVB2QixNQUFPLENBVVAsbUJBQW9CLENBWnBCLGlCQUFrQixDQUdsQixPQUFRLENBRlIsS0FBTSxDQVVOLFdBRUosQ0FFQSx5REFDSSw0QkFDSixDQUVBLDhDQUNJLGlCQUFrQixDQUVsQixVQUFXLENBRFgsUUFBUyxDQUVULFdBQ0osQ0FFQSxxQ0FXSSxXQUFZLENBRlosZUFBZ0IsQ0FKaEIsUUFBUyxDQU9ULGVBQWdCLENBTGhCLFdBQVksQ0FKWixNQUFPLENBT1AsZ0JBQWlCLENBVGpCLGNBQWUsQ0FHZixPQUFRLENBRlIsS0FBTSxDQUlOLFVBQVcsQ0FFWCxZQUtKLENBRUEsaUNBT0ksa0JBQW1CLENBTm5CLHFCQUFzQixDQUN0Qix3QkFBeUIsQ0FDekIscUJBQXVCLENBT3ZCLHNDQUEyQyxDQUQzQyxhQUFjLENBSmQsY0FBZSxDQUNmLG1CQUFvQixDQUVwQixTQUFXLENBSlgsa0JBQW9CLENBT3BCLDhCQUNKLENBRUEsdUNBQ0ksd0JBQXlCLENBQ3pCLG9CQUFxQixDQUNyQixpRUFDSiIsImZpbGUiOiJCb29rRWRpdG9yLm1vZHVsZS5jc3MiLCJzb3VyY2VzQ29udGVudCI6WyIuQm9va0VkaXRvciB7XG4gICAgLyogaGVpZ2h0OiA0NTBweDsgKi9cbiAgICB3aWR0aDogMTAwJTtcbn1cblxuLmJvb2tFZGl0b3JDb250YWluZXIge1xuICAgIHdpZHRoOiAxMDAlO1xuICAgIGhlaWdodDogMTAwJTtcbiAgICBwb3NpdGlvbjogcmVsYXRpdmU7XG4gICAgcGFkZGluZzogMTBweCAyNXB4IDA7XG4gICAgYm94LXNpemluZzogYm9yZGVyLWJveDtcbn1cblxuLmJvb2tFZGl0b3JDb250YWluZXIuaXNWZXJib3NlIHtcbiAgICAvKiovXG4gICAgYmFja2dyb3VuZC1jb2xvcjogcmdiYSgwLCAwLCAwLCAwLjA1KTtcbiAgICBvdXRsaW5lOiAxcHggZG90dGVkIHJnYmEoMCwgMCwgMCwgMC41KTtcbiAgICAvKiovXG59XG5cbi5pc1ZlcmJvc2Uge1xuICAgIG91dGxpbmU6IDJweCBkb3R0ZWQgcmdiKDI1NSAxMTcgMzgpO1xufVxuXG4uYm9va0VkaXRvcldyYXBwZXIge1xuICAgIG92ZXJmbG93OiBoaWRkZW47XG4gICAgYm9yZGVyLXJhZGl1czogMXJlbTtcbiAgICBwYWRkaW5nLXRvcDogMTBweDtcbiAgICBib3JkZXI6IDFweCBzb2xpZCByZ2JhKDIwOSwgMjEzLCAyMTksIDAuOCk7XG4gICAgYmFja2dyb3VuZC1jb2xvcjogd2hpdGU7XG4gICAgYm94LXNoYWRvdzogMCAxcHggMnB4IDAgcmdiYSgwLCAwLCAwLCAwLjA1KTtcbiAgICB0cmFuc2l0aW9uOiBib3gtc2hhZG93IDAuMnMgZWFzZS1pbi1vdXQ7XG59XG4uaXNWZXJib3NlIC5ib29rRWRpdG9yV3JhcHBlciB7XG4gICAgLyoqL1xuICAgIG92ZXJmbG93OiB2aXNpYmxlO1xuICAgIC8qKi9cbn1cblxuLmJvb2tFZGl0b3JXcmFwcGVyOmhvdmVyIHtcbiAgICBib3gtc2hhZG93OiAwIDRweCA2cHggLTFweCByZ2JhKDAsIDAsIDAsIDAuMSksIDAgMnB4IDRweCAtMXB4IHJnYmEoMCwgMCwgMCwgMC4wNik7XG59XG5cbi5ib29rRWRpdG9yV3JhcHBlcjpmb2N1cy13aXRoaW4ge1xuICAgIC8qXG4gICAgb3V0bGluZTogMnB4IHNvbGlkIHRyYW5zcGFyZW50O1xuICAgIG91dGxpbmUtb2Zmc2V0OiAycHg7XG4gICAgYm94LXNoYWRvdzogMCAwIDAgM3B4IHJnYmEoOTksIDEwMiwgMjQxLCAwLjQpO1xuICAgICovXG59XG5cbi5ib29rRWRpdG9yV3JhcHBlci5pc0JvcmRlclJhZGl1c0Rpc2FibGVkIHtcbiAgICBib3JkZXItcmFkaXVzOiAwO1xufVxuXG4uZHJvcE92ZXJsYXkge1xuICAgIHBvc2l0aW9uOiBhYnNvbHV0ZTtcbiAgICB0b3A6IDA7XG4gICAgbGVmdDogMDtcbiAgICByaWdodDogMDtcbiAgICBib3R0b206IDA7XG4gICAgYmFja2dyb3VuZC1jb2xvcjogcmdiYSgwLCAwLCAwLCAwLjUpO1xuICAgIGNvbG9yOiB3aGl0ZTtcbiAgICBkaXNwbGF5OiBmbGV4O1xuICAgIGFsaWduLWl0ZW1zOiBjZW50ZXI7XG4gICAganVzdGlmeS1jb250ZW50OiBjZW50ZXI7XG4gICAgZm9udC1zaXplOiAxLjVyZW07XG4gICAgei1pbmRleDogMTAwO1xuICAgIHBvaW50ZXItZXZlbnRzOiBub25lO1xufVxuXG4uYm9va0VkaXRvckNvbnRhaW5lciA6Z2xvYmFsKC52aWV3LWxpbmUpIHtcbiAgICBib3JkZXItYm90dG9tOiAxcHggc29saWQgI2VlZTtcbn1cblxuLmJvb2tFZGl0b3JBY3Rpb25iYXIge1xuICAgIHBvc2l0aW9uOiBhYnNvbHV0ZTtcbiAgICB0b3A6IDEwcHg7XG4gICAgcmlnaHQ6IDU1cHg7XG4gICAgei1pbmRleDogMTAwO1xufVxuXG4uZnVsbHNjcmVlbiB7XG4gICAgcG9zaXRpb246IGZpeGVkO1xuICAgIHRvcDogMDtcbiAgICBsZWZ0OiAwO1xuICAgIHJpZ2h0OiAwO1xuICAgIGJvdHRvbTogMDtcbiAgICB3aWR0aDogMTAwJTtcbiAgICBoZWlnaHQ6IDEwMCU7XG4gICAgei1pbmRleDogOTk5OTtcbiAgICBib3JkZXItcmFkaXVzOiAwO1xuICAgIHBhZGRpbmctdG9wOiA1MHB4O1xuICAgIGJvcmRlcjogbm9uZTtcbiAgICBib3gtc2hhZG93OiBub25lO1xufVxuXG4uYnV0dG9uIHtcbiAgICBiYWNrZ3JvdW5kLWNvbG9yOiAjZmZmO1xuICAgIGJvcmRlcjogMXB4IHNvbGlkICNkMWQ1ZGI7XG4gICAgYm9yZGVyLXJhZGl1czogMC4zNzVyZW07XG4gICAgcGFkZGluZzogMC41cmVtIDFyZW07XG4gICAgY3Vyc29yOiBwb2ludGVyO1xuICAgIGRpc3BsYXk6IGlubGluZS1mbGV4O1xuICAgIGFsaWduLWl0ZW1zOiBjZW50ZXI7XG4gICAgZ2FwOiAwLjVyZW07XG4gICAgY29sb3I6ICMzNzQxNTE7XG4gICAgYm94LXNoYWRvdzogMCAxcHggMnB4IDAgcmdiYSgwLCAwLCAwLCAwLjA1KTtcbiAgICB0cmFuc2l0aW9uOiBhbGwgMC4ycyBlYXNlLWluLW91dDtcbn1cblxuLmJ1dHRvbjpob3ZlciB7XG4gICAgYmFja2dyb3VuZC1jb2xvcjogI2Y5ZmFmYjtcbiAgICBib3JkZXItY29sb3I6ICNiN2JjY2U7XG4gICAgYm94LXNoYWRvdzogMCAxcHggM3B4IDAgcmdiYSgwLCAwLCAwLCAwLjEpLCAwIDFweCAycHggMCByZ2JhKDAsIDAsIDAsIDAuMDYpO1xufVxuIl19 */";
|
|
5715
5759
|
var styles$4 = {"BookEditor":"BookEditor-module_BookEditor__s-0PU","bookEditorContainer":"BookEditor-module_bookEditorContainer__wLMwM","isVerbose":"BookEditor-module_isVerbose__VQ6iL","bookEditorWrapper":"BookEditor-module_bookEditorWrapper__twppD","isBorderRadiusDisabled":"BookEditor-module_isBorderRadiusDisabled__h1I3v","dropOverlay":"BookEditor-module_dropOverlay__xWWoX","bookEditorActionbar":"BookEditor-module_bookEditorActionbar__KW6dc","fullscreen":"BookEditor-module_fullscreen__rktsl","button":"BookEditor-module_button__hS390"};
|
|
5716
5760
|
styleInject(css_248z$5);
|
|
5717
5761
|
|
|
5718
|
-
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book",formfactorName:"GENERIC",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}",resultingParameterName:"knowledgePieces",dependentParameterNames:["knowledgeContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Knowledge from Markdown\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book`\n- INPUT PARAMETER `{knowledgeContent}` Markdown document content\n- OUTPUT PARAMETER `{knowledgePieces}` The knowledge JSON object\n\n## Knowledge\n\n<!-- TODO: [🍆] -FORMAT JSON -->\n\n```markdown\nYou are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}\n```\n\n`-> {knowledgePieces}`\n"}],sourceFile:"./books/prepare-knowledge-from-markdown.book"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.book",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}",resultingParameterName:"keywords",dependentParameterNames:["knowledgePieceContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Keywords\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-keywords.book`\n- INPUT PARAMETER `{knowledgePieceContent}` The content\n- OUTPUT PARAMETER `{keywords}` Keywords separated by comma\n\n## Knowledge\n\n<!-- TODO: [🍆] -FORMAT JSON -->\n\n```markdown\nYou are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}\n```\n\n`-> {keywords}`\n"}],sourceFile:"./books/prepare-knowledge-keywords.book"},{title:"Prepare Knowledge-piece Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.book",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}",resultingParameterName:"title",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Knowledge-piece Title\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-title.book`\n- INPUT PARAMETER `{knowledgePieceContent}` The content\n- OUTPUT PARAMETER `{title}` The title of the document\n\n## Knowledge\n\n- EXPECT MIN 1 WORD\n- EXPECT MAX 8 WORDS\n\n```markdown\nYou are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}\n```\n\n`-> {title}`\n"}],sourceFile:"./books/prepare-knowledge-title.book"},{title:"Prepare Persona",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.book",formfactorName:"GENERIC",parameters:[{name:"availableModels",description:"List of available model names together with their descriptions as JSON",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelsRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-model-requirements",title:"Make modelRequirements",content:"You are an experienced AI engineer, you need to find the best models for virtual assistants:\n\n## Example\n\n```json\n[\n {\n \"modelName\": \"gpt-4o\",\n \"systemMessage\": \"You are experienced AI engineer and helpful assistant.\",\n \"temperature\": 0.7\n },\n {\n \"modelName\": \"claude-3-5-sonnet\",\n \"systemMessage\": \"You are a friendly and knowledgeable chatbot.\",\n \"temperature\": 0.5\n }\n]\n```\n\n## Instructions\n\n- Your output format is JSON array\n- Sort best-fitting models first\n- Omit any models that are not suitable\n- Write just the JSON, no other text should be present\n- Array contain items with following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nHere are the available models:\n\n```json\n{availableModels}\n```\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}",resultingParameterName:"modelsRequirements",format:"JSON",dependentParameterNames:["availableModels","personaDescription"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Persona\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-persona.book`\n- INPUT PARAMETER `{availableModels}` List of available model names together with their descriptions as JSON\n- INPUT PARAMETER `{personaDescription}` Description of the persona\n- OUTPUT PARAMETER `{modelsRequirements}` Specific requirements for the model\n\n## Make modelRequirements\n\n- FORMAT JSON\n\n```markdown\nYou are an experienced AI engineer, you need to find the best models for virtual assistants:\n\n## Example\n\n\\`\\`\\`json\n[\n {\n \"modelName\": \"gpt-4o\",\n \"systemMessage\": \"You are experienced AI engineer and helpful assistant.\",\n \"temperature\": 0.7\n },\n {\n \"modelName\": \"claude-3-5-sonnet\",\n \"systemMessage\": \"You are a friendly and knowledgeable chatbot.\",\n \"temperature\": 0.5\n }\n]\n\\`\\`\\`\n\n## Instructions\n\n- Your output format is JSON array\n- Sort best-fitting models first\n- Omit any models that are not suitable\n- Write just the JSON, no other text should be present\n- Array contain items with following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nHere are the available models:\n\n\\`\\`\\`json\n{availableModels}\n\\`\\`\\`\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}\n```\n\n`-> {modelsRequirements}`\n"}],sourceFile:"./books/prepare-persona.book"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-title.book",formfactorName:"GENERIC",parameters:[{name:"book",description:"The book to prepare the title for",isInput:true,isOutput:false},{name:"title",description:"Best title for the book",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-title",title:"Make title",content:"Make best title for given text which describes the workflow:\n\n## Rules\n\n- Write just title, nothing else\n- Title should be concise and clear - Write maximum ideally 2 words, maximum 5 words\n- Title starts with emoticon\n- Title should not mention the input and output of the workflow but the main purpose of the workflow\n _For example, not \"✍ Convert Knowledge-piece to title\" but \"✍ Title\"_\n\n## The workflow\n\n> {book}",resultingParameterName:"title",expectations:{words:{min:1,max:8},lines:{min:1,max:1}},dependentParameterNames:["book"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Title\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-title.book`\n- INPUT PARAMETER `{book}` The book to prepare the title for\n- OUTPUT PARAMETER `{title}` Best title for the book\n\n## Make title\n\n- EXPECT MIN 1 Word\n- EXPECT MAX 8 Words\n- EXPECT EXACTLY 1 Line\n\n```markdown\nMake best title for given text which describes the workflow:\n\n## Rules\n\n- Write just title, nothing else\n- Title should be concise and clear - Write maximum ideally 2 words, maximum 5 words\n- Title starts with emoticon\n- Title should not mention the input and output of the workflow but the main purpose of the workflow\n _For example, not \"✍ Convert Knowledge-piece to title\" but \"✍ Title\"_\n\n## The workflow\n\n> {book}\n```\n\n`-> {title}`\n"}],sourceFile:"./books/prepare-title.book"},{title:"📊 Curriculum Audit",pipelineUrl:"https://promptbook.studio/promptbook//examples/lsvp-asistent.book",formfactorName:"GENERIC",parameters:[{name:"result",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"prompt",title:"Prompt",content:"Asistent pro LŠVP\n\nPERSONA Jsi asistent pro RVP Lyceum v rámci Národního pedagogického institutu České Republiky\nMETA IMAGE https://edulk.cz/getFile/id:475818/type:large/02%20zna%C4%8Dka%20npi.jpg\nRULE Pokud jsi nejsi jistý, napiš nevím\nKNOWLEDGE ./241129_Lyceum_final.pdf\nCONTEXT Obecně dokážeš řešit libovolné ŠVP, aktuálně řešíš {Školní vzdělávací program LYCEUM}\nRULE Z {Porovnání RVP a ŠVP - postup} je nejdůležitější fáze 3\nKNOWLEDGE {Školní vzdělávací program LYCEUM} ./ŠVP Lyceum - Finance v digitální době.pdf\nKNOWLEDGE @Slovník\n\n**Interní slovník - RVP/ŠVP**\n\n**RVP**\n\nRámcový vzdělávací program pro obor vzdělání Lyceum je dokument na národní úrovni, který formuluje požadavky na školní vzdělávací programy ve formě především očekávaných výsledků učení, kterých mají žáci absolvováním tohoto programu na dané škole dosáhnout.\n\n**ŠVP**\n\nŠkolní vzdělávací program pro obor vzdělání Lyceum je dokument každé jednotlivé školy, který popisuje v jakých vyučovacích předmětech/ vzdělávacích modulech a v jakých ročnících budou požadované očekávané výsledky učení naplněny. Zároveň formuluje další očekávané výsledky učení, které naplňují disponibilní část vyučovacího času určeného RVP pro tento obor vzdělání.\n\n**Očekávaný výsledek učení (OVU)**\n\nVyjadřuje jednotlivý požadavek na to, co mají žáci umět na konci vzdělávacího programu, tzn. jejich požadované kompetence. Je vyjádřen formulací, která je uvozena činnostním slovesem a dále obsahuje předmět této činnosti. Formulace je konkretizována resp. doplněna zpravidla formou odrážek vymezením dílčích znalostí, dovedností, postojů, jejichž splnění je předpokladem dosažení OVU jako celku.\n\n_Příklad:_\n\n<div class=\"joplin-table-wrapper\"><table><tbody><tr><th><p><strong>Žák/žákyně řídí realizaci jednoduchého projektu</strong></p></th></tr><tr><td><ul><li>naplánuje aktivity projektu</li></ul></td></tr><tr><td><ul><li>navrhne rozpočet projektu vzhledem k navrženým aktivitám</li></ul></td></tr><tr><td><ul><li>stanoví základní ukazatele a sleduje jejich naplňování</li></ul></td></tr><tr><td><ul><li>vede projektový tým</li></ul></td></tr><tr><td><ul><li>uvede, jak by řešil krizové situace v projektu</li></ul></td></tr><tr><td><ul><li>vyhodnotí úspěšnost projektu</li></ul></td></tr></tbody></table></div>\n\n**Vzdělávací oblasti**\n\nOčekávané výsledky učení jsou v **_RVP členěny do 4 vzdělávacích oblastí_**, které tvoří společný všeobecně vzdělávací základ:\n\n- Osobnostní rozvoj, vzdělávání ke zdraví, bezpečí a produktivnímu pracovnímu životu (kariéře)\n- Komunikační a jazykové vzdělávání\n- Aplikované vzdělávání STEM (Science, Technology, Engeneering, Math), tj. přírodní vědy, informatika, technika, matematika\n- Prakticky orientované vzdělávání společenskovědní a humanitní\n\nKaždá vzdělávací oblast se dále člení na okruhy, v jejichž rámci jsou OVU samostatně číslované.\n\n<div class=\"joplin-table-wrapper\"><table><tbody><tr><th rowspan=\"21\"><ul><li>Prakticky orientované vzdělávání společenskovědní a humanitní</li></ul></th><th rowspan=\"21\"><p><strong>Člověk, ekonomie a podnikání</strong></p></th><th rowspan=\"7\"><p><strong>1</strong></p></th><th><p><strong>zpracuje podklady související s podnikáním</strong></p></th></tr><tr><td><p>připraví podnikatelský záměr</p></td></tr><tr><td><p>sestaví zakladatelský rozpočet</p></td></tr><tr><td><p>zkalkuluje cenu zboží nebo služby</p></td></tr><tr><td><p>vysvětlí na příkladu základní povinnosti podnikatele vůči státu a zaměstnancům</p></td></tr><tr><td><p>vede daňovou evidenci</p></td></tr><tr><td><p>vysvětlí na příkladech etiku v podnikání</p></td></tr><tr><td rowspan=\"7\"><p><strong>2</strong></p></td><td><p><strong>řídí realizaci jednoduchého projektu</strong></p></td></tr><tr><td><p>naplánuje aktivity projektu</p></td></tr><tr><td><p>navrhne rozpočet projektu vzhledem k navrženým aktivitám</p></td></tr><tr><td><p>stanoví základní ukazatele a sleduje jejich naplňování</p></td></tr><tr><td><p>vede projektový tým</p></td></tr><tr><td><p>uvede, jak by řešil krizové situace v projektu</p></td></tr><tr><td><p>vyhodnotí úspěšnost projektu</p></td></tr><tr><td rowspan=\"7\"><p><strong>3</strong></p></td><td><p><strong>aplikuje ekonomické teorie v osobním a profesním životě</strong></p></td></tr><tr><td><p>vysvětlí základní ekonomické otázky</p></td></tr><tr><td><p>vysvětí stanovení rovnovážné ceny na dokonalém i nedokonalém trhu</p></td></tr><tr><td><p>charakterizuje výrobní faktory a vysvětlí hranici produkčních možností a náklady obětované příležitosti</p></td></tr><tr><td><p>uvede nejdůležitější makroekonomické pojmy a vliv jejich výše na kvalitu života a podnikání v daném státě</p></td></tr><tr><td><p>vysvětlí podstatu inflace a její důsledky na finanční situaci obyvatel a na příkladu ukáže jak se bránit jejím nepříznivým důsledkům</p></td></tr><tr><td><p>uvede hlavní výhody a nevýhody mezinárodního obchodu a vliv ochranářských opatření na ekonomickou situaci dané země</p></td></tr><tr><td></td><td></td><td><p><strong>4</strong></p></td><td><p>Atd.</p></td></tr></tbody></table></div>\n\n**Vyučovací předmět / vzdělávací modul**\n\nOčekávané výsledky učení jsou v **ŠVP** členěny do vyučovacích předmětů nebo vzdělávacích modulů, které jsou dále zařazeny do jednoho nebo více ročníků 4letého studia. Vyučovací předmět / vzdělávací modul tvoří vyučovací jednotku, kde jsou očekávané výsledky učení dále rozpracovány pro potřeby výuky podle následující šablony\n\n| **A. VSTUPNÍ ČÁST** |\n| --- |\n| **1\\. Název** |\n| **2\\. Kód** (kódy by měly být navázány na obory vzdělání a výsledky učení) |\n| **2a) Kategorie vzdělání** - v případě, že nebude součástí kódu |\n| **3\\. Typ vyučovací jednotky** (modul, předmět, stáž apod.) |\n| **4\\. Délka** (počet hodin - dělitelný čtyřmi (optimální modul 16, 32 hodin = týden výuky) |\n| **5\\. Platnost** (datum, od kterého platí) |\n| **6\\. Vstupní předpoklady** (vymezení požadované úrovně vstupních vědomostí a dovedností, které jsou předpokladem úspěšného studia) |\n| |\n| **B. JÁDRO VYUČOVACÍ JEDNOTKY** |\n| **1\\. Charakteristika** (stručná anotace popisující obecné cíle a pojetí) |\n| **2\\. Očekávané výsledky učení a jejich indikátory (převzaté z RVP nebo dále konkretizované)** |\n| **3\\. Podpora rozvoje klíčových kompetencí a základních gramotností** (které klíčové kompetence jsou v rozvíjeny) |\n| **4\\. Obsah vzdělávání** (rozpis učiva) |\n| **5\\. Vzdělávací strategie** (strategie výuky, resp. učební činnosti žáků, které jsou doporučené pro dosažení výsledků) |\n| |\n| **C. VÝSTUPNÍ ČÁST** |\n| **1\\. Způsob ověřování dosažených výsledků** (ve vazbě na jednotlivé výsledky učení) |\n| **2\\. Kritéria hodnocení** (co znamená splnění výsledků učení, kdy je splněna celá vyučovací jednotka, kritéria pro známky, příp. procentuální, slovní hodnocení) |\n| **3\\. Doporučená studijní literatura, odkazy na ilustrační zdroje** |\n| **4\\. Poznámky** |\n\n**Soulad OVU RVP a ŠVP**\n\nTento soulad je předmětem zjišťování. Soulad nastává, jestliže jsou očekávané výsledky učení z jednotlivých vzdělávacích oblastí RVP **obsaženy** ve vyučovacích předmětech/ vzdělávacích modulech ŠVP jednotlivých škol, tzn. že v ŠVP se objevuje jejich formulace buď v doslovném nebo podobném znění v jednom nebo více vyučovacích předmětech/ vzdělávacích modulech.\n\n_Příklad souladu:_\n\nRVP ŠVP - komunikace a marketing (SŠ obchodní Č.\n\n| **2** | **řídí realizaci jednoduchého projektu** |\n| --- | --- |\n| naplánuje aktivity projektu |\n| navrhne rozpočet projektu vzhledem k navrženým aktivitám |\n| stanoví základní ukazatele a sleduje jejich naplňování |\n| vede projektový tým |\n| uvede, jak by řešil krizové situace v projektu |\n| vyhodnotí úspěšnost projektu |\n\nKNOWLEDGE {Porovnání RVP a ŠVP - postup}\n\n\n# AUDITNÍ PROTOKOL ŠVP-RVP\n\n# (POPIS KONTROLNÍHO ALGORITMU)\n\nMetodika je určena pro **Kvantifikaci Shody** školního vzdělávacího programu (ŠVP) s Rámcovým vzdělávacím programem (RVP).\n\n## FÁZE 1: VALIDACE DOKUMENTACE\n\n**Cíl:** Ověřit platnost, aktuálnost a strukturu zdrojových dokumentů.\n\n- **RVP Verifikace:** Otevřít aktuální verzi RVP (např. RVP ZV/G/SOŠ).\n- **Typová shoda:** Ověřit, že RVP se vztahuje k danému typu školy.\n- **ŠVP Dimenze:** Identifikovat a izolovat relevantní části ŠVP: Profil absolventa, Klíčové kompetence (KK), Vzdělávací oblasti (VO), případně Učební plán (UP).\n- **Verzování:** Potvrdit, že obě verze (RVP a ŠVP) jsou nejnovější a platné (včetně dodatků RVP).\n\n## FÁZE 2: DATABÁZOVÉ MAPOVÁNÍ VÝSTUPŮ (MASTER MATICE)\n\n**Cíl:** Vytvořit systémovou databázi pro křížové porovnání všech povinných komponent RVP se ŠVP.\n\n- **Dekompozice RVP:** Rozložit RVP na základní povinné komponenty: Klíčové kompetence, Vzdělávací oblasti a obory, Očekávané výstupy (OVU), Průřezová témata (PT).\n- **Přiřazovací mapa:** Vytvořit hlavní kontrolní matici (Master Matice) pro záznam vazeb.\n\n| Oblast RVP | Výstup RVP (OVU) | Odpovídající Část ŠVP (Předmět/Ročník) | Konkrétní Tématický Celek v ŠVP | Stav Shody (Protokol) |\n| --- | --- | --- | --- | --- |\n| ... | ... | ... | ... | ... |\n| --- | --- | --- | --- | --- |\n\n## FÁZE 3: ALGORITMICKÁ KONTROLA POKRYTÍ A HLOUBKY\n\n**Cíl:** Posoudit, zda každý povinný výstup RVP je adekvátně reflektován v obsahu ŠVP, a přidělit bodovou hodnotu pro kvantifikaci.\n\n- **Audit OVU:** Projít každý jednotlivý Očekávaný výstup (OVU) z RVP.\n- **Kódování stavu a bodování:** U každého OVU v matici označit stav pokrytí dle následujícího schématu:\n\n| Kód (Protokol) | Popis (Kvalitativní zjištění) | Bodová hodnota (Kvantifikace) |\n| --- | --- | --- |\n| ✅ | Plná shoda (Výstup pokryt v plném rozsahu, odpovídající úrovni RVP) | 1,0 |\n| --- | --- | --- |\n| ⚠️ | Částečná shoda (Formální pokrytí, omezený rozsah, chybná návaznost) | 0,5 |\n| --- | --- | --- |\n| ❌ | Absence (Výstup zcela chybí v obsahu ŠVP) | 0,0 |\n| --- | --- | --- |\n\n- **Defektologie ŠVP:** Identifikovat a zaznamenat deficity ŠVP: Chybějící výstupy (❌), Sémantické překryvy, Přetížení obsahu.\n- **Kvalitativní posun:** Ověřit, zda je formulace výstupů v ŠVP **aktivní, měřitelná a v souladu** s úrovní RVP.\n\n## FÁZE 4: STRUKTURÁLNÍ VERIFIKACE NÁVAZNOSTI (VERTIKÁLA/HORIZONTÁLA)\n\n**Cíl:** Zkontrolovat logickou posloupnost a provázanost učiva v rámci ŠVP.\n\n- **Vertikální Kontrola:** Ověřit posloupnost OVU a učiva uvnitř jednoho předmětu/oblasti (postup od jednodušších ke složitějším konceptům napříč ročníky).\n- **Horizontální Kontrola:** Zkontrolovat logické provázání napříč vzdělávacími oblastmi a předměty (např. fyzika ↔ matematika).\n- **PT Integrace:** Audit reálné integrace Průřezových témat (PT) do konkrétních částí obsahu, metod a projektů.\n\n## FÁZE 5: ANALÝZA ŠKOLNÍ PROFILACE A ROZŠÍŘENÍ RVP\n\n**Cíl:** Validovat, že profilace školy je **v souladu** s RVP a nejedná se o **rozpor**.\n\n- **Nekonfliktnost:** Porovnat definovaný Profil absolventa školy s Klíčovými kompetencemi RVP. Profil ŠVP musí RVP rozvíjet, nikoli mu odporovat.\n- **Modularita:** Zkontrolovat, zda volitelné předměty a rozšiřující moduly logicky navazují na vzdělávací oblasti RVP.\n- **Implementace specializace:** Popisně uvést, jak je školní profilace (např. STEM zaměření, projektová výuka) integrována do OVU a kompetencí definovaných RVP.\n\n## FÁZE 6: GENERÁTOR ZÁVĚREČNÉ ZPRÁVY A KVANTIFIKACE\n\n**Cíl:** Syntetizovat výsledky, kvantifikovat soulad a generovat závazné návrhy na korekce.\n\n### 6.1 Kvantifikace Souladu\n\nVypočítat Index shody (IS) na základě bodového hodnocení (Fáze 3):\n\n### 6.2 Interpretace Indexu Shody (IS)\n\nKlasifikace souladu pro standardizované vyhodnocení:\n\n| Interval IS | Klasifikace souladu | Popis |\n| --- | --- | --- |\n| 95-100 % | Výborný soulad | ŠVP plně odpovídá RVP, pouze stylistické nebo formální rozdíly. |\n| --- | --- | --- |\n| 85-94 % | Dobrá shoda | ŠVP pokrývá všechny klíčové výstupy, menší korekce nutné. |\n| --- | --- | --- |\n| 70-84 % | Částečná shoda | Významné nedostatky v některých oblastech, nutná revize obsahu. |\n| --- | --- | --- |\n| < 70 % | Kritická neshoda | ŠVP neplní rámcové požadavky, ohrožuje legislativní soulad. |\n| --- | --- | --- |\n\n### 6.3 Doplňkové Indexy\n\nVypočítat následující doplňkové indexy pro detailní kvalitativní analýzu:\n\n- **Index kompetenčního souladu (IKS):** Poměr pokrytí klíčových kompetencí RVP v ŠVP.\n- **Index průřezové integrace (IPI):** Míra reálné integrace průřezových témat do výuky.\n- **Index hloubky pokrytí (IHP):** Procento výstupů, které jsou v ŠVP rozvedeny na konkrétní výukové cíle (měřitelné, aktivní formulace).\n- **Index profilové rozšiřitelnosti (IPR):** Kolik rozšiřujících nebo profilových výstupů přesahuje rámec RVP, aniž by narušily jeho strukturu.\n\n### 6.4 Vizuální výstupy\n\nZajistit generování následujících vizualizací pro Závěrečnou zprávu:\n\n- Graf pokrytí po vzdělávacích oblastech (Sloupcový graf IS pro VO).\n- Pavoukový diagram Klíčových kompetencí (RVP vs. ŠVP).\n- Mapa defektů (Vizualizace ❌ a ⚠️ výstupů).\n\n### 6.5 Struktura Závěrečné Zprávy\n\nZpráva musí být strukturována dle standardizovaného formátu:\n\n| Oddíl | Obsah |\n| --- | --- |\n| A. Identifikace | Název školy, IZO, typ školy, datum revize, zpracovatel, verze ŠVP a RVP. |\n| --- | --- |\n| B. Shrnutí výsledků | Celkový Index Shody (IS), hlavní závěry a doporučení. |\n| --- | --- |\n| C. Kvantitativní analýza | Přehled IS v % dle kategorií OVU / VO / kompetencí. |\n| --- | --- |\n| D. Kvalitativní analýza | Slovní zhodnocení kvality souladu (formulace, obtížnost, integrace PT). |\n| --- | --- |\n| E. Rizikové oblasti | Přehled nalezených defektů (chybějící OVU, přetížení, formální shoda). |\n| --- | --- |\n| F. Návrhy opatření (Korekční plán) | Přesné návrhy změn - **Co, Kde, Kdo** má upravit, včetně termínu. |\n| --- | --- |\n| G. Přílohy | Master Matice (Fáze 2-3), revizní tabulka, výstupní grafy a metriky. |\n| --- | --- |\n\n\n\n\n.",resultingParameterName:"result",dependentParameterNames:[]}],personas:[],preparations:[{id:1,promptbookVersion:"0.103.0-34",usage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"Asistent pro LŠVP\n\nPERSONA Jsi asistent pro RVP Lyceum v rámci Národního pedagogického institutu České Republiky\nMETA IMAGE https://edulk.cz/getFile/id:475818/type:large/02%20zna%C4%8Dka%20npi.jpg\nRULE Pokud jsi nejsi jistý, napiš nevím\nKNOWLEDGE ./241129_Lyceum_final.pdf\nCONTEXT Obecně dokážeš řešit libovolné ŠVP, aktuálně řešíš {Školní vzdělávací program LYCEUM}\nRULE Z {Porovnání RVP a ŠVP - postup} je nejdůležitější fáze 3\nKNOWLEDGE {Školní vzdělávací program LYCEUM} ./ŠVP Lyceum - Finance v digitální době.pdf\nKNOWLEDGE @Slovník\n\n**Interní slovník - RVP/ŠVP**\n\n**RVP**\n\nRámcový vzdělávací program pro obor vzdělání Lyceum je dokument na národní úrovni, který formuluje požadavky na školní vzdělávací programy ve formě především očekávaných výsledků učení, kterých mají žáci absolvováním tohoto programu na dané škole dosáhnout.\n\n**ŠVP**\n\nŠkolní vzdělávací program pro obor vzdělání Lyceum je dokument každé jednotlivé školy, který popisuje v jakých vyučovacích předmětech/ vzdělávacích modulech a v jakých ročnících budou požadované očekávané výsledky učení naplněny. Zároveň formuluje další očekávané výsledky učení, které naplňují disponibilní část vyučovacího času určeného RVP pro tento obor vzdělání.\n\n**Očekávaný výsledek učení (OVU)**\n\nVyjadřuje jednotlivý požadavek na to, co mají žáci umět na konci vzdělávacího programu, tzn. jejich požadované kompetence. Je vyjádřen formulací, která je uvozena činnostním slovesem a dále obsahuje předmět této činnosti. Formulace je konkretizována resp. doplněna zpravidla formou odrážek vymezením dílčích znalostí, dovedností, postojů, jejichž splnění je předpokladem dosažení OVU jako celku.\n\n_Příklad:_\n\n<div class=\"joplin-table-wrapper\"><table><tbody><tr><th><p><strong>Žák/žákyně řídí realizaci jednoduchého projektu</strong></p></th></tr><tr><td><ul><li>naplánuje aktivity projektu</li></ul></td></tr><tr><td><ul><li>navrhne rozpočet projektu vzhledem k navrženým aktivitám</li></ul></td></tr><tr><td><ul><li>stanoví základní ukazatele a sleduje jejich naplňování</li></ul></td></tr><tr><td><ul><li>vede projektový tým</li></ul></td></tr><tr><td><ul><li>uvede, jak by řešil krizové situace v projektu</li></ul></td></tr><tr><td><ul><li>vyhodnotí úspěšnost projektu</li></ul></td></tr></tbody></table></div>\n\n**Vzdělávací oblasti**\n\nOčekávané výsledky učení jsou v **_RVP členěny do 4 vzdělávacích oblastí_**, které tvoří společný všeobecně vzdělávací základ:\n\n- Osobnostní rozvoj, vzdělávání ke zdraví, bezpečí a produktivnímu pracovnímu životu (kariéře)\n- Komunikační a jazykové vzdělávání\n- Aplikované vzdělávání STEM (Science, Technology, Engeneering, Math), tj. přírodní vědy, informatika, technika, matematika\n- Prakticky orientované vzdělávání společenskovědní a humanitní\n\nKaždá vzdělávací oblast se dále člení na okruhy, v jejichž rámci jsou OVU samostatně číslované.\n\n<div class=\"joplin-table-wrapper\"><table><tbody><tr><th rowspan=\"21\"><ul><li>Prakticky orientované vzdělávání společenskovědní a humanitní</li></ul></th><th rowspan=\"21\"><p><strong>Člověk, ekonomie a podnikání</strong></p></th><th rowspan=\"7\"><p><strong>1</strong></p></th><th><p><strong>zpracuje podklady související s podnikáním</strong></p></th></tr><tr><td><p>připraví podnikatelský záměr</p></td></tr><tr><td><p>sestaví zakladatelský rozpočet</p></td></tr><tr><td><p>zkalkuluje cenu zboží nebo služby</p></td></tr><tr><td><p>vysvětlí na příkladu základní povinnosti podnikatele vůči státu a zaměstnancům</p></td></tr><tr><td><p>vede daňovou evidenci</p></td></tr><tr><td><p>vysvětlí na příkladech etiku v podnikání</p></td></tr><tr><td rowspan=\"7\"><p><strong>2</strong></p></td><td><p><strong>řídí realizaci jednoduchého projektu</strong></p></td></tr><tr><td><p>naplánuje aktivity projektu</p></td></tr><tr><td><p>navrhne rozpočet projektu vzhledem k navrženým aktivitám</p></td></tr><tr><td><p>stanoví základní ukazatele a sleduje jejich naplňování</p></td></tr><tr><td><p>vede projektový tým</p></td></tr><tr><td><p>uvede, jak by řešil krizové situace v projektu</p></td></tr><tr><td><p>vyhodnotí úspěšnost projektu</p></td></tr><tr><td rowspan=\"7\"><p><strong>3</strong></p></td><td><p><strong>aplikuje ekonomické teorie v osobním a profesním životě</strong></p></td></tr><tr><td><p>vysvětlí základní ekonomické otázky</p></td></tr><tr><td><p>vysvětí stanovení rovnovážné ceny na dokonalém i nedokonalém trhu</p></td></tr><tr><td><p>charakterizuje výrobní faktory a vysvětlí hranici produkčních možností a náklady obětované příležitosti</p></td></tr><tr><td><p>uvede nejdůležitější makroekonomické pojmy a vliv jejich výše na kvalitu života a podnikání v daném státě</p></td></tr><tr><td><p>vysvětlí podstatu inflace a její důsledky na finanční situaci obyvatel a na příkladu ukáže jak se bránit jejím nepříznivým důsledkům</p></td></tr><tr><td><p>uvede hlavní výhody a nevýhody mezinárodního obchodu a vliv ochranářských opatření na ekonomickou situaci dané země</p></td></tr><tr><td></td><td></td><td><p><strong>4</strong></p></td><td><p>Atd.</p></td></tr></tbody></table></div>\n\n**Vyučovací předmět / vzdělávací modul**\n\nOčekávané výsledky učení jsou v **ŠVP** členěny do vyučovacích předmětů nebo vzdělávacích modulů, které jsou dále zařazeny do jednoho nebo více ročníků 4letého studia. Vyučovací předmět / vzdělávací modul tvoří vyučovací jednotku, kde jsou očekávané výsledky učení dále rozpracovány pro potřeby výuky podle následující šablony\n\n| **A. VSTUPNÍ ČÁST** |\n| --- |\n| **1\\. Název** |\n| **2\\. Kód** (kódy by měly být navázány na obory vzdělání a výsledky učení) |\n| **2a) Kategorie vzdělání** - v případě, že nebude součástí kódu |\n| **3\\. Typ vyučovací jednotky** (modul, předmět, stáž apod.) |\n| **4\\. Délka** (počet hodin - dělitelný čtyřmi (optimální modul 16, 32 hodin = týden výuky) |\n| **5\\. Platnost** (datum, od kterého platí) |\n| **6\\. Vstupní předpoklady** (vymezení požadované úrovně vstupních vědomostí a dovedností, které jsou předpokladem úspěšného studia) |\n| |\n| **B. JÁDRO VYUČOVACÍ JEDNOTKY** |\n| **1\\. Charakteristika** (stručná anotace popisující obecné cíle a pojetí) |\n| **2\\. Očekávané výsledky učení a jejich indikátory (převzaté z RVP nebo dále konkretizované)** |\n| **3\\. Podpora rozvoje klíčových kompetencí a základních gramotností** (které klíčové kompetence jsou v rozvíjeny) |\n| **4\\. Obsah vzdělávání** (rozpis učiva) |\n| **5\\. Vzdělávací strategie** (strategie výuky, resp. učební činnosti žáků, které jsou doporučené pro dosažení výsledků) |\n| |\n| **C. VÝSTUPNÍ ČÁST** |\n| **1\\. Způsob ověřování dosažených výsledků** (ve vazbě na jednotlivé výsledky učení) |\n| **2\\. Kritéria hodnocení** (co znamená splnění výsledků učení, kdy je splněna celá vyučovací jednotka, kritéria pro známky, příp. procentuální, slovní hodnocení) |\n| **3\\. Doporučená studijní literatura, odkazy na ilustrační zdroje** |\n| **4\\. Poznámky** |\n\n**Soulad OVU RVP a ŠVP**\n\nTento soulad je předmětem zjišťování. Soulad nastává, jestliže jsou očekávané výsledky učení z jednotlivých vzdělávacích oblastí RVP **obsaženy** ve vyučovacích předmětech/ vzdělávacích modulech ŠVP jednotlivých škol, tzn. že v ŠVP se objevuje jejich formulace buď v doslovném nebo podobném znění v jednom nebo více vyučovacích předmětech/ vzdělávacích modulech.\n\n_Příklad souladu:_\n\nRVP ŠVP - komunikace a marketing (SŠ obchodní Č.\n\n| **2** | **řídí realizaci jednoduchého projektu** |\n| --- | --- |\n| naplánuje aktivity projektu |\n| navrhne rozpočet projektu vzhledem k navrženým aktivitám |\n| stanoví základní ukazatele a sleduje jejich naplňování |\n| vede projektový tým |\n| uvede, jak by řešil krizové situace v projektu |\n| vyhodnotí úspěšnost projektu |\n\nKNOWLEDGE {Porovnání RVP a ŠVP - postup}\n\n\n# AUDITNÍ PROTOKOL ŠVP-RVP\n\n# (POPIS KONTROLNÍHO ALGORITMU)\n\nMetodika je určena pro **Kvantifikaci Shody** školního vzdělávacího programu (ŠVP) s Rámcovým vzdělávacím programem (RVP).\n\n## FÁZE 1: VALIDACE DOKUMENTACE\n\n**Cíl:** Ověřit platnost, aktuálnost a strukturu zdrojových dokumentů.\n\n- **RVP Verifikace:** Otevřít aktuální verzi RVP (např. RVP ZV/G/SOŠ).\n- **Typová shoda:** Ověřit, že RVP se vztahuje k danému typu školy.\n- **ŠVP Dimenze:** Identifikovat a izolovat relevantní části ŠVP: Profil absolventa, Klíčové kompetence (KK), Vzdělávací oblasti (VO), případně Učební plán (UP).\n- **Verzování:** Potvrdit, že obě verze (RVP a ŠVP) jsou nejnovější a platné (včetně dodatků RVP).\n\n## FÁZE 2: DATABÁZOVÉ MAPOVÁNÍ VÝSTUPŮ (MASTER MATICE)\n\n**Cíl:** Vytvořit systémovou databázi pro křížové porovnání všech povinných komponent RVP se ŠVP.\n\n- **Dekompozice RVP:** Rozložit RVP na základní povinné komponenty: Klíčové kompetence, Vzdělávací oblasti a obory, Očekávané výstupy (OVU), Průřezová témata (PT).\n- **Přiřazovací mapa:** Vytvořit hlavní kontrolní matici (Master Matice) pro záznam vazeb.\n\n| Oblast RVP | Výstup RVP (OVU) | Odpovídající Část ŠVP (Předmět/Ročník) | Konkrétní Tématický Celek v ŠVP | Stav Shody (Protokol) |\n| --- | --- | --- | --- | --- |\n| ... | ... | ... | ... | ... |\n| --- | --- | --- | --- | --- |\n\n## FÁZE 3: ALGORITMICKÁ KONTROLA POKRYTÍ A HLOUBKY\n\n**Cíl:** Posoudit, zda každý povinný výstup RVP je adekvátně reflektován v obsahu ŠVP, a přidělit bodovou hodnotu pro kvantifikaci.\n\n- **Audit OVU:** Projít každý jednotlivý Očekávaný výstup (OVU) z RVP.\n- **Kódování stavu a bodování:** U každého OVU v matici označit stav pokrytí dle následujícího schématu:\n\n| Kód (Protokol) | Popis (Kvalitativní zjištění) | Bodová hodnota (Kvantifikace) |\n| --- | --- | --- |\n| ✅ | Plná shoda (Výstup pokryt v plném rozsahu, odpovídající úrovni RVP) | 1,0 |\n| --- | --- | --- |\n| ⚠️ | Částečná shoda (Formální pokrytí, omezený rozsah, chybná návaznost) | 0,5 |\n| --- | --- | --- |\n| ❌ | Absence (Výstup zcela chybí v obsahu ŠVP) | 0,0 |\n| --- | --- | --- |\n\n- **Defektologie ŠVP:** Identifikovat a zaznamenat deficity ŠVP: Chybějící výstupy (❌), Sémantické překryvy, Přetížení obsahu.\n- **Kvalitativní posun:** Ověřit, zda je formulace výstupů v ŠVP **aktivní, měřitelná a v souladu** s úrovní RVP.\n\n## FÁZE 4: STRUKTURÁLNÍ VERIFIKACE NÁVAZNOSTI (VERTIKÁLA/HORIZONTÁLA)\n\n**Cíl:** Zkontrolovat logickou posloupnost a provázanost učiva v rámci ŠVP.\n\n- **Vertikální Kontrola:** Ověřit posloupnost OVU a učiva uvnitř jednoho předmětu/oblasti (postup od jednodušších ke složitějším konceptům napříč ročníky).\n- **Horizontální Kontrola:** Zkontrolovat logické provázání napříč vzdělávacími oblastmi a předměty (např. fyzika ↔ matematika).\n- **PT Integrace:** Audit reálné integrace Průřezových témat (PT) do konkrétních částí obsahu, metod a projektů.\n\n## FÁZE 5: ANALÝZA ŠKOLNÍ PROFILACE A ROZŠÍŘENÍ RVP\n\n**Cíl:** Validovat, že profilace školy je **v souladu** s RVP a nejedná se o **rozpor**.\n\n- **Nekonfliktnost:** Porovnat definovaný Profil absolventa školy s Klíčovými kompetencemi RVP. Profil ŠVP musí RVP rozvíjet, nikoli mu odporovat.\n- **Modularita:** Zkontrolovat, zda volitelné předměty a rozšiřující moduly logicky navazují na vzdělávací oblasti RVP.\n- **Implementace specializace:** Popisně uvést, jak je školní profilace (např. STEM zaměření, projektová výuka) integrována do OVU a kompetencí definovaných RVP.\n\n## FÁZE 6: GENERÁTOR ZÁVĚREČNÉ ZPRÁVY A KVANTIFIKACE\n\n**Cíl:** Syntetizovat výsledky, kvantifikovat soulad a generovat závazné návrhy na korekce.\n\n### 6.1 Kvantifikace Souladu\n\nVypočítat Index shody (IS) na základě bodového hodnocení (Fáze 3):\n\n### 6.2 Interpretace Indexu Shody (IS)\n\nKlasifikace souladu pro standardizované vyhodnocení:\n\n| Interval IS | Klasifikace souladu | Popis |\n| --- | --- | --- |\n| 95-100 % | Výborný soulad | ŠVP plně odpovídá RVP, pouze stylistické nebo formální rozdíly. |\n| --- | --- | --- |\n| 85-94 % | Dobrá shoda | ŠVP pokrývá všechny klíčové výstupy, menší korekce nutné. |\n| --- | --- | --- |\n| 70-84 % | Částečná shoda | Významné nedostatky v některých oblastech, nutná revize obsahu. |\n| --- | --- | --- |\n| < 70 % | Kritická neshoda | ŠVP neplní rámcové požadavky, ohrožuje legislativní soulad. |\n| --- | --- | --- |\n\n### 6.3 Doplňkové Indexy\n\nVypočítat následující doplňkové indexy pro detailní kvalitativní analýzu:\n\n- **Index kompetenčního souladu (IKS):** Poměr pokrytí klíčových kompetencí RVP v ŠVP.\n- **Index průřezové integrace (IPI):** Míra reálné integrace průřezových témat do výuky.\n- **Index hloubky pokrytí (IHP):** Procento výstupů, které jsou v ŠVP rozvedeny na konkrétní výukové cíle (měřitelné, aktivní formulace).\n- **Index profilové rozšiřitelnosti (IPR):** Kolik rozšiřujících nebo profilových výstupů přesahuje rámec RVP, aniž by narušily jeho strukturu.\n\n### 6.4 Vizuální výstupy\n\nZajistit generování následujících vizualizací pro Závěrečnou zprávu:\n\n- Graf pokrytí po vzdělávacích oblastech (Sloupcový graf IS pro VO).\n- Pavoukový diagram Klíčových kompetencí (RVP vs. ŠVP).\n- Mapa defektů (Vizualizace ❌ a ⚠️ výstupů).\n\n### 6.5 Struktura Závěrečné Zprávy\n\nZpráva musí být strukturována dle standardizovaného formátu:\n\n| Oddíl | Obsah |\n| --- | --- |\n| A. Identifikace | Název školy, IZO, typ školy, datum revize, zpracovatel, verze ŠVP a RVP. |\n| --- | --- |\n| B. Shrnutí výsledků | Celkový Index Shody (IS), hlavní závěry a doporučení. |\n| --- | --- |\n| C. Kvantitativní analýza | Přehled IS v % dle kategorií OVU / VO / kompetencí. |\n| --- | --- |\n| D. Kvalitativní analýza | Slovní zhodnocení kvality souladu (formulace, obtížnost, integrace PT). |\n| --- | --- |\n| E. Rizikové oblasti | Přehled nalezených defektů (chybějící OVU, přetížení, formální shoda). |\n| --- | --- |\n| F. Návrhy opatření (Korekční plán) | Přesné návrhy změn - **Co, Kde, Kdo** má upravit, včetně termínu. |\n| --- | --- |\n| G. Přílohy | Master Matice (Fáze 2-3), revizní tabulka, výstupní grafy a metriky. |\n| --- | --- |\n\n\n\n\n.\n"}],sourceFile:"./books/examples/lsvp-asistent.book"}];
|
|
5762
|
+
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book",formfactorName:"GENERIC",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}",resultingParameterName:"knowledgePieces",dependentParameterNames:["knowledgeContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Knowledge from Markdown\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book`\n- INPUT PARAMETER `{knowledgeContent}` Markdown document content\n- OUTPUT PARAMETER `{knowledgePieces}` The knowledge JSON object\n\n## Knowledge\n\n<!-- TODO: [🍆] -FORMAT JSON -->\n\n```markdown\nYou are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}\n```\n\n`-> {knowledgePieces}`\n"}],sourceFile:"./books/prepare-knowledge-from-markdown.book"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.book",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}",resultingParameterName:"keywords",dependentParameterNames:["knowledgePieceContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Keywords\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-keywords.book`\n- INPUT PARAMETER `{knowledgePieceContent}` The content\n- OUTPUT PARAMETER `{keywords}` Keywords separated by comma\n\n## Knowledge\n\n<!-- TODO: [🍆] -FORMAT JSON -->\n\n```markdown\nYou are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}\n```\n\n`-> {keywords}`\n"}],sourceFile:"./books/prepare-knowledge-keywords.book"},{title:"Prepare Knowledge-piece Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.book",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}",resultingParameterName:"title",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Knowledge-piece Title\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-title.book`\n- INPUT PARAMETER `{knowledgePieceContent}` The content\n- OUTPUT PARAMETER `{title}` The title of the document\n\n## Knowledge\n\n- EXPECT MIN 1 WORD\n- EXPECT MAX 8 WORDS\n\n```markdown\nYou are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}\n```\n\n`-> {title}`\n"}],sourceFile:"./books/prepare-knowledge-title.book"},{title:"Prepare Persona",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.book",formfactorName:"GENERIC",parameters:[{name:"availableModels",description:"List of available model names together with their descriptions as JSON",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelsRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-model-requirements",title:"Make modelRequirements",content:"You are an experienced AI engineer, you need to find the best models for virtual assistants:\n\n## Example\n\n```json\n[\n {\n \"modelName\": \"gpt-4o\",\n \"systemMessage\": \"You are experienced AI engineer and helpful assistant.\",\n \"temperature\": 0.7\n },\n {\n \"modelName\": \"claude-3-5-sonnet\",\n \"systemMessage\": \"You are a friendly and knowledgeable chatbot.\",\n \"temperature\": 0.5\n }\n]\n```\n\n## Instructions\n\n- Your output format is JSON array\n- Sort best-fitting models first\n- Omit any models that are not suitable\n- Write just the JSON, no other text should be present\n- Array contain items with following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nHere are the available models:\n\n```json\n{availableModels}\n```\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}",resultingParameterName:"modelsRequirements",format:"JSON",dependentParameterNames:["availableModels","personaDescription"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Persona\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-persona.book`\n- INPUT PARAMETER `{availableModels}` List of available model names together with their descriptions as JSON\n- INPUT PARAMETER `{personaDescription}` Description of the persona\n- OUTPUT PARAMETER `{modelsRequirements}` Specific requirements for the model\n\n## Make modelRequirements\n\n- FORMAT JSON\n\n```markdown\nYou are an experienced AI engineer, you need to find the best models for virtual assistants:\n\n## Example\n\n\\`\\`\\`json\n[\n {\n \"modelName\": \"gpt-4o\",\n \"systemMessage\": \"You are experienced AI engineer and helpful assistant.\",\n \"temperature\": 0.7\n },\n {\n \"modelName\": \"claude-3-5-sonnet\",\n \"systemMessage\": \"You are a friendly and knowledgeable chatbot.\",\n \"temperature\": 0.5\n }\n]\n\\`\\`\\`\n\n## Instructions\n\n- Your output format is JSON array\n- Sort best-fitting models first\n- Omit any models that are not suitable\n- Write just the JSON, no other text should be present\n- Array contain items with following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nHere are the available models:\n\n\\`\\`\\`json\n{availableModels}\n\\`\\`\\`\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}\n```\n\n`-> {modelsRequirements}`\n"}],sourceFile:"./books/prepare-persona.book"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-title.book",formfactorName:"GENERIC",parameters:[{name:"book",description:"The book to prepare the title for",isInput:true,isOutput:false},{name:"title",description:"Best title for the book",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-title",title:"Make title",content:"Make best title for given text which describes the workflow:\n\n## Rules\n\n- Write just title, nothing else\n- Title should be concise and clear - Write maximum ideally 2 words, maximum 5 words\n- Title starts with emoticon\n- Title should not mention the input and output of the workflow but the main purpose of the workflow\n _For example, not \"✍ Convert Knowledge-piece to title\" but \"✍ Title\"_\n\n## The workflow\n\n> {book}",resultingParameterName:"title",expectations:{words:{min:1,max:8},lines:{min:1,max:1}},dependentParameterNames:["book"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Title\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-title.book`\n- INPUT PARAMETER `{book}` The book to prepare the title for\n- OUTPUT PARAMETER `{title}` Best title for the book\n\n## Make title\n\n- EXPECT MIN 1 Word\n- EXPECT MAX 8 Words\n- EXPECT EXACTLY 1 Line\n\n```markdown\nMake best title for given text which describes the workflow:\n\n## Rules\n\n- Write just title, nothing else\n- Title should be concise and clear - Write maximum ideally 2 words, maximum 5 words\n- Title starts with emoticon\n- Title should not mention the input and output of the workflow but the main purpose of the workflow\n _For example, not \"✍ Convert Knowledge-piece to title\" but \"✍ Title\"_\n\n## The workflow\n\n> {book}\n```\n\n`-> {title}`\n"}],sourceFile:"./books/prepare-title.book"},{title:"📊 Curriculum Audit",pipelineUrl:"https://promptbook.studio/promptbook//examples/lsvp-asistent.book",formfactorName:"GENERIC",parameters:[{name:"result",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"prompt",title:"Prompt",content:"Asistent pro LŠVP\n\nPERSONA Jsi asistent pro RVP Lyceum v rámci Národního pedagogického institutu České Republiky\nMETA IMAGE https://edulk.cz/getFile/id:475818/type:large/02%20zna%C4%8Dka%20npi.jpg\nRULE Pokud jsi nejsi jistý, napiš nevím\nKNOWLEDGE ./241129_Lyceum_final.pdf\nCONTEXT Obecně dokážeš řešit libovolné ŠVP, aktuálně řešíš {Školní vzdělávací program LYCEUM}\nRULE Z {Porovnání RVP a ŠVP - postup} je nejdůležitější fáze 3\nKNOWLEDGE {Školní vzdělávací program LYCEUM} ./ŠVP Lyceum - Finance v digitální době.pdf\nKNOWLEDGE @Slovník\n\n**Interní slovník - RVP/ŠVP**\n\n**RVP**\n\nRámcový vzdělávací program pro obor vzdělání Lyceum je dokument na národní úrovni, který formuluje požadavky na školní vzdělávací programy ve formě především očekávaných výsledků učení, kterých mají žáci absolvováním tohoto programu na dané škole dosáhnout.\n\n**ŠVP**\n\nŠkolní vzdělávací program pro obor vzdělání Lyceum je dokument každé jednotlivé školy, který popisuje v jakých vyučovacích předmětech/ vzdělávacích modulech a v jakých ročnících budou požadované očekávané výsledky učení naplněny. Zároveň formuluje další očekávané výsledky učení, které naplňují disponibilní část vyučovacího času určeného RVP pro tento obor vzdělání.\n\n**Očekávaný výsledek učení (OVU)**\n\nVyjadřuje jednotlivý požadavek na to, co mají žáci umět na konci vzdělávacího programu, tzn. jejich požadované kompetence. Je vyjádřen formulací, která je uvozena činnostním slovesem a dále obsahuje předmět této činnosti. Formulace je konkretizována resp. doplněna zpravidla formou odrážek vymezením dílčích znalostí, dovedností, postojů, jejichž splnění je předpokladem dosažení OVU jako celku.\n\n_Příklad:_\n\n<div class=\"joplin-table-wrapper\"><table><tbody><tr><th><p><strong>Žák/žákyně řídí realizaci jednoduchého projektu</strong></p></th></tr><tr><td><ul><li>naplánuje aktivity projektu</li></ul></td></tr><tr><td><ul><li>navrhne rozpočet projektu vzhledem k navrženým aktivitám</li></ul></td></tr><tr><td><ul><li>stanoví základní ukazatele a sleduje jejich naplňování</li></ul></td></tr><tr><td><ul><li>vede projektový tým</li></ul></td></tr><tr><td><ul><li>uvede, jak by řešil krizové situace v projektu</li></ul></td></tr><tr><td><ul><li>vyhodnotí úspěšnost projektu</li></ul></td></tr></tbody></table></div>\n\n**Vzdělávací oblasti**\n\nOčekávané výsledky učení jsou v **_RVP členěny do 4 vzdělávacích oblastí_**, které tvoří společný všeobecně vzdělávací základ:\n\n- Osobnostní rozvoj, vzdělávání ke zdraví, bezpečí a produktivnímu pracovnímu životu (kariéře)\n- Komunikační a jazykové vzdělávání\n- Aplikované vzdělávání STEM (Science, Technology, Engeneering, Math), tj. přírodní vědy, informatika, technika, matematika\n- Prakticky orientované vzdělávání společenskovědní a humanitní\n\nKaždá vzdělávací oblast se dále člení na okruhy, v jejichž rámci jsou OVU samostatně číslované.\n\n<div class=\"joplin-table-wrapper\"><table><tbody><tr><th rowspan=\"21\"><ul><li>Prakticky orientované vzdělávání společenskovědní a humanitní</li></ul></th><th rowspan=\"21\"><p><strong>Člověk, ekonomie a podnikání</strong></p></th><th rowspan=\"7\"><p><strong>1</strong></p></th><th><p><strong>zpracuje podklady související s podnikáním</strong></p></th></tr><tr><td><p>připraví podnikatelský záměr</p></td></tr><tr><td><p>sestaví zakladatelský rozpočet</p></td></tr><tr><td><p>zkalkuluje cenu zboží nebo služby</p></td></tr><tr><td><p>vysvětlí na příkladu základní povinnosti podnikatele vůči státu a zaměstnancům</p></td></tr><tr><td><p>vede daňovou evidenci</p></td></tr><tr><td><p>vysvětlí na příkladech etiku v podnikání</p></td></tr><tr><td rowspan=\"7\"><p><strong>2</strong></p></td><td><p><strong>řídí realizaci jednoduchého projektu</strong></p></td></tr><tr><td><p>naplánuje aktivity projektu</p></td></tr><tr><td><p>navrhne rozpočet projektu vzhledem k navrženým aktivitám</p></td></tr><tr><td><p>stanoví základní ukazatele a sleduje jejich naplňování</p></td></tr><tr><td><p>vede projektový tým</p></td></tr><tr><td><p>uvede, jak by řešil krizové situace v projektu</p></td></tr><tr><td><p>vyhodnotí úspěšnost projektu</p></td></tr><tr><td rowspan=\"7\"><p><strong>3</strong></p></td><td><p><strong>aplikuje ekonomické teorie v osobním a profesním životě</strong></p></td></tr><tr><td><p>vysvětlí základní ekonomické otázky</p></td></tr><tr><td><p>vysvětí stanovení rovnovážné ceny na dokonalém i nedokonalém trhu</p></td></tr><tr><td><p>charakterizuje výrobní faktory a vysvětlí hranici produkčních možností a náklady obětované příležitosti</p></td></tr><tr><td><p>uvede nejdůležitější makroekonomické pojmy a vliv jejich výše na kvalitu života a podnikání v daném státě</p></td></tr><tr><td><p>vysvětlí podstatu inflace a její důsledky na finanční situaci obyvatel a na příkladu ukáže jak se bránit jejím nepříznivým důsledkům</p></td></tr><tr><td><p>uvede hlavní výhody a nevýhody mezinárodního obchodu a vliv ochranářských opatření na ekonomickou situaci dané země</p></td></tr><tr><td></td><td></td><td><p><strong>4</strong></p></td><td><p>Atd.</p></td></tr></tbody></table></div>\n\n**Vyučovací předmět / vzdělávací modul**\n\nOčekávané výsledky učení jsou v **ŠVP** členěny do vyučovacích předmětů nebo vzdělávacích modulů, které jsou dále zařazeny do jednoho nebo více ročníků 4letého studia. Vyučovací předmět / vzdělávací modul tvoří vyučovací jednotku, kde jsou očekávané výsledky učení dále rozpracovány pro potřeby výuky podle následující šablony\n\n| **A. VSTUPNÍ ČÁST** |\n| --- |\n| **1\\. Název** |\n| **2\\. Kód** (kódy by měly být navázány na obory vzdělání a výsledky učení) |\n| **2a) Kategorie vzdělání** - v případě, že nebude součástí kódu |\n| **3\\. Typ vyučovací jednotky** (modul, předmět, stáž apod.) |\n| **4\\. Délka** (počet hodin - dělitelný čtyřmi (optimální modul 16, 32 hodin = týden výuky) |\n| **5\\. Platnost** (datum, od kterého platí) |\n| **6\\. Vstupní předpoklady** (vymezení požadované úrovně vstupních vědomostí a dovedností, které jsou předpokladem úspěšného studia) |\n| |\n| **B. JÁDRO VYUČOVACÍ JEDNOTKY** |\n| **1\\. Charakteristika** (stručná anotace popisující obecné cíle a pojetí) |\n| **2\\. Očekávané výsledky učení a jejich indikátory (převzaté z RVP nebo dále konkretizované)** |\n| **3\\. Podpora rozvoje klíčových kompetencí a základních gramotností** (které klíčové kompetence jsou v rozvíjeny) |\n| **4\\. Obsah vzdělávání** (rozpis učiva) |\n| **5\\. Vzdělávací strategie** (strategie výuky, resp. učební činnosti žáků, které jsou doporučené pro dosažení výsledků) |\n| |\n| **C. VÝSTUPNÍ ČÁST** |\n| **1\\. Způsob ověřování dosažených výsledků** (ve vazbě na jednotlivé výsledky učení) |\n| **2\\. Kritéria hodnocení** (co znamená splnění výsledků učení, kdy je splněna celá vyučovací jednotka, kritéria pro známky, příp. procentuální, slovní hodnocení) |\n| **3\\. Doporučená studijní literatura, odkazy na ilustrační zdroje** |\n| **4\\. Poznámky** |\n\n**Soulad OVU RVP a ŠVP**\n\nTento soulad je předmětem zjišťování. Soulad nastává, jestliže jsou očekávané výsledky učení z jednotlivých vzdělávacích oblastí RVP **obsaženy** ve vyučovacích předmětech/ vzdělávacích modulech ŠVP jednotlivých škol, tzn. že v ŠVP se objevuje jejich formulace buď v doslovném nebo podobném znění v jednom nebo více vyučovacích předmětech/ vzdělávacích modulech.\n\n_Příklad souladu:_\n\nRVP ŠVP - komunikace a marketing (SŠ obchodní Č.\n\n| **2** | **řídí realizaci jednoduchého projektu** |\n| --- | --- |\n| naplánuje aktivity projektu |\n| navrhne rozpočet projektu vzhledem k navrženým aktivitám |\n| stanoví základní ukazatele a sleduje jejich naplňování |\n| vede projektový tým |\n| uvede, jak by řešil krizové situace v projektu |\n| vyhodnotí úspěšnost projektu |\n\nKNOWLEDGE {Porovnání RVP a ŠVP - postup}\n\n\n# AUDITNÍ PROTOKOL ŠVP-RVP\n\n# (POPIS KONTROLNÍHO ALGORITMU)\n\nMetodika je určena pro **Kvantifikaci Shody** školního vzdělávacího programu (ŠVP) s Rámcovým vzdělávacím programem (RVP).\n\n## FÁZE 1: VALIDACE DOKUMENTACE\n\n**Cíl:** Ověřit platnost, aktuálnost a strukturu zdrojových dokumentů.\n\n- **RVP Verifikace:** Otevřít aktuální verzi RVP (např. RVP ZV/G/SOŠ).\n- **Typová shoda:** Ověřit, že RVP se vztahuje k danému typu školy.\n- **ŠVP Dimenze:** Identifikovat a izolovat relevantní části ŠVP: Profil absolventa, Klíčové kompetence (KK), Vzdělávací oblasti (VO), případně Učební plán (UP).\n- **Verzování:** Potvrdit, že obě verze (RVP a ŠVP) jsou nejnovější a platné (včetně dodatků RVP).\n\n## FÁZE 2: DATABÁZOVÉ MAPOVÁNÍ VÝSTUPŮ (MASTER MATICE)\n\n**Cíl:** Vytvořit systémovou databázi pro křížové porovnání všech povinných komponent RVP se ŠVP.\n\n- **Dekompozice RVP:** Rozložit RVP na základní povinné komponenty: Klíčové kompetence, Vzdělávací oblasti a obory, Očekávané výstupy (OVU), Průřezová témata (PT).\n- **Přiřazovací mapa:** Vytvořit hlavní kontrolní matici (Master Matice) pro záznam vazeb.\n\n| Oblast RVP | Výstup RVP (OVU) | Odpovídající Část ŠVP (Předmět/Ročník) | Konkrétní Tématický Celek v ŠVP | Stav Shody (Protokol) |\n| --- | --- | --- | --- | --- |\n| ... | ... | ... | ... | ... |\n| --- | --- | --- | --- | --- |\n\n## FÁZE 3: ALGORITMICKÁ KONTROLA POKRYTÍ A HLOUBKY\n\n**Cíl:** Posoudit, zda každý povinný výstup RVP je adekvátně reflektován v obsahu ŠVP, a přidělit bodovou hodnotu pro kvantifikaci.\n\n- **Audit OVU:** Projít každý jednotlivý Očekávaný výstup (OVU) z RVP.\n- **Kódování stavu a bodování:** U každého OVU v matici označit stav pokrytí dle následujícího schématu:\n\n| Kód (Protokol) | Popis (Kvalitativní zjištění) | Bodová hodnota (Kvantifikace) |\n| --- | --- | --- |\n| ✅ | Plná shoda (Výstup pokryt v plném rozsahu, odpovídající úrovni RVP) | 1,0 |\n| --- | --- | --- |\n| ⚠️ | Částečná shoda (Formální pokrytí, omezený rozsah, chybná návaznost) | 0,5 |\n| --- | --- | --- |\n| ❌ | Absence (Výstup zcela chybí v obsahu ŠVP) | 0,0 |\n| --- | --- | --- |\n\n- **Defektologie ŠVP:** Identifikovat a zaznamenat deficity ŠVP: Chybějící výstupy (❌), Sémantické překryvy, Přetížení obsahu.\n- **Kvalitativní posun:** Ověřit, zda je formulace výstupů v ŠVP **aktivní, měřitelná a v souladu** s úrovní RVP.\n\n## FÁZE 4: STRUKTURÁLNÍ VERIFIKACE NÁVAZNOSTI (VERTIKÁLA/HORIZONTÁLA)\n\n**Cíl:** Zkontrolovat logickou posloupnost a provázanost učiva v rámci ŠVP.\n\n- **Vertikální Kontrola:** Ověřit posloupnost OVU a učiva uvnitř jednoho předmětu/oblasti (postup od jednodušších ke složitějším konceptům napříč ročníky).\n- **Horizontální Kontrola:** Zkontrolovat logické provázání napříč vzdělávacími oblastmi a předměty (např. fyzika ↔ matematika).\n- **PT Integrace:** Audit reálné integrace Průřezových témat (PT) do konkrétních částí obsahu, metod a projektů.\n\n## FÁZE 5: ANALÝZA ŠKOLNÍ PROFILACE A ROZŠÍŘENÍ RVP\n\n**Cíl:** Validovat, že profilace školy je **v souladu** s RVP a nejedná se o **rozpor**.\n\n- **Nekonfliktnost:** Porovnat definovaný Profil absolventa školy s Klíčovými kompetencemi RVP. Profil ŠVP musí RVP rozvíjet, nikoli mu odporovat.\n- **Modularita:** Zkontrolovat, zda volitelné předměty a rozšiřující moduly logicky navazují na vzdělávací oblasti RVP.\n- **Implementace specializace:** Popisně uvést, jak je školní profilace (např. STEM zaměření, projektová výuka) integrována do OVU a kompetencí definovaných RVP.\n\n## FÁZE 6: GENERÁTOR ZÁVĚREČNÉ ZPRÁVY A KVANTIFIKACE\n\n**Cíl:** Syntetizovat výsledky, kvantifikovat soulad a generovat závazné návrhy na korekce.\n\n### 6.1 Kvantifikace Souladu\n\nVypočítat Index shody (IS) na základě bodového hodnocení (Fáze 3):\n\n### 6.2 Interpretace Indexu Shody (IS)\n\nKlasifikace souladu pro standardizované vyhodnocení:\n\n| Interval IS | Klasifikace souladu | Popis |\n| --- | --- | --- |\n| 95-100 % | Výborný soulad | ŠVP plně odpovídá RVP, pouze stylistické nebo formální rozdíly. |\n| --- | --- | --- |\n| 85-94 % | Dobrá shoda | ŠVP pokrývá všechny klíčové výstupy, menší korekce nutné. |\n| --- | --- | --- |\n| 70-84 % | Částečná shoda | Významné nedostatky v některých oblastech, nutná revize obsahu. |\n| --- | --- | --- |\n| < 70 % | Kritická neshoda | ŠVP neplní rámcové požadavky, ohrožuje legislativní soulad. |\n| --- | --- | --- |\n\n### 6.3 Doplňkové Indexy\n\nVypočítat následující doplňkové indexy pro detailní kvalitativní analýzu:\n\n- **Index kompetenčního souladu (IKS):** Poměr pokrytí klíčových kompetencí RVP v ŠVP.\n- **Index průřezové integrace (IPI):** Míra reálné integrace průřezových témat do výuky.\n- **Index hloubky pokrytí (IHP):** Procento výstupů, které jsou v ŠVP rozvedeny na konkrétní výukové cíle (měřitelné, aktivní formulace).\n- **Index profilové rozšiřitelnosti (IPR):** Kolik rozšiřujících nebo profilových výstupů přesahuje rámec RVP, aniž by narušily jeho strukturu.\n\n### 6.4 Vizuální výstupy\n\nZajistit generování následujících vizualizací pro Závěrečnou zprávu:\n\n- Graf pokrytí po vzdělávacích oblastech (Sloupcový graf IS pro VO).\n- Pavoukový diagram Klíčových kompetencí (RVP vs. ŠVP).\n- Mapa defektů (Vizualizace ❌ a ⚠️ výstupů).\n\n### 6.5 Struktura Závěrečné Zprávy\n\nZpráva musí být strukturována dle standardizovaného formátu:\n\n| Oddíl | Obsah |\n| --- | --- |\n| A. Identifikace | Název školy, IZO, typ školy, datum revize, zpracovatel, verze ŠVP a RVP. |\n| --- | --- |\n| B. Shrnutí výsledků | Celkový Index Shody (IS), hlavní závěry a doporučení. |\n| --- | --- |\n| C. Kvantitativní analýza | Přehled IS v % dle kategorií OVU / VO / kompetencí. |\n| --- | --- |\n| D. Kvalitativní analýza | Slovní zhodnocení kvality souladu (formulace, obtížnost, integrace PT). |\n| --- | --- |\n| E. Rizikové oblasti | Přehled nalezených defektů (chybějící OVU, přetížení, formální shoda). |\n| --- | --- |\n| F. Návrhy opatření (Korekční plán) | Přesné návrhy změn - **Co, Kde, Kdo** má upravit, včetně termínu. |\n| --- | --- |\n| G. Přílohy | Master Matice (Fáze 2-3), revizní tabulka, výstupní grafy a metriky. |\n| --- | --- |\n\n\n\n\n.",resultingParameterName:"result",dependentParameterNames:[]}],personas:[],preparations:[{id:1,promptbookVersion:"0.103.0-36",usage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"Asistent pro LŠVP\n\nPERSONA Jsi asistent pro RVP Lyceum v rámci Národního pedagogického institutu České Republiky\nMETA IMAGE https://edulk.cz/getFile/id:475818/type:large/02%20zna%C4%8Dka%20npi.jpg\nRULE Pokud jsi nejsi jistý, napiš nevím\nKNOWLEDGE ./241129_Lyceum_final.pdf\nCONTEXT Obecně dokážeš řešit libovolné ŠVP, aktuálně řešíš {Školní vzdělávací program LYCEUM}\nRULE Z {Porovnání RVP a ŠVP - postup} je nejdůležitější fáze 3\nKNOWLEDGE {Školní vzdělávací program LYCEUM} ./ŠVP Lyceum - Finance v digitální době.pdf\nKNOWLEDGE @Slovník\n\n**Interní slovník - RVP/ŠVP**\n\n**RVP**\n\nRámcový vzdělávací program pro obor vzdělání Lyceum je dokument na národní úrovni, který formuluje požadavky na školní vzdělávací programy ve formě především očekávaných výsledků učení, kterých mají žáci absolvováním tohoto programu na dané škole dosáhnout.\n\n**ŠVP**\n\nŠkolní vzdělávací program pro obor vzdělání Lyceum je dokument každé jednotlivé školy, který popisuje v jakých vyučovacích předmětech/ vzdělávacích modulech a v jakých ročnících budou požadované očekávané výsledky učení naplněny. Zároveň formuluje další očekávané výsledky učení, které naplňují disponibilní část vyučovacího času určeného RVP pro tento obor vzdělání.\n\n**Očekávaný výsledek učení (OVU)**\n\nVyjadřuje jednotlivý požadavek na to, co mají žáci umět na konci vzdělávacího programu, tzn. jejich požadované kompetence. Je vyjádřen formulací, která je uvozena činnostním slovesem a dále obsahuje předmět této činnosti. Formulace je konkretizována resp. doplněna zpravidla formou odrážek vymezením dílčích znalostí, dovedností, postojů, jejichž splnění je předpokladem dosažení OVU jako celku.\n\n_Příklad:_\n\n<div class=\"joplin-table-wrapper\"><table><tbody><tr><th><p><strong>Žák/žákyně řídí realizaci jednoduchého projektu</strong></p></th></tr><tr><td><ul><li>naplánuje aktivity projektu</li></ul></td></tr><tr><td><ul><li>navrhne rozpočet projektu vzhledem k navrženým aktivitám</li></ul></td></tr><tr><td><ul><li>stanoví základní ukazatele a sleduje jejich naplňování</li></ul></td></tr><tr><td><ul><li>vede projektový tým</li></ul></td></tr><tr><td><ul><li>uvede, jak by řešil krizové situace v projektu</li></ul></td></tr><tr><td><ul><li>vyhodnotí úspěšnost projektu</li></ul></td></tr></tbody></table></div>\n\n**Vzdělávací oblasti**\n\nOčekávané výsledky učení jsou v **_RVP členěny do 4 vzdělávacích oblastí_**, které tvoří společný všeobecně vzdělávací základ:\n\n- Osobnostní rozvoj, vzdělávání ke zdraví, bezpečí a produktivnímu pracovnímu životu (kariéře)\n- Komunikační a jazykové vzdělávání\n- Aplikované vzdělávání STEM (Science, Technology, Engeneering, Math), tj. přírodní vědy, informatika, technika, matematika\n- Prakticky orientované vzdělávání společenskovědní a humanitní\n\nKaždá vzdělávací oblast se dále člení na okruhy, v jejichž rámci jsou OVU samostatně číslované.\n\n<div class=\"joplin-table-wrapper\"><table><tbody><tr><th rowspan=\"21\"><ul><li>Prakticky orientované vzdělávání společenskovědní a humanitní</li></ul></th><th rowspan=\"21\"><p><strong>Člověk, ekonomie a podnikání</strong></p></th><th rowspan=\"7\"><p><strong>1</strong></p></th><th><p><strong>zpracuje podklady související s podnikáním</strong></p></th></tr><tr><td><p>připraví podnikatelský záměr</p></td></tr><tr><td><p>sestaví zakladatelský rozpočet</p></td></tr><tr><td><p>zkalkuluje cenu zboží nebo služby</p></td></tr><tr><td><p>vysvětlí na příkladu základní povinnosti podnikatele vůči státu a zaměstnancům</p></td></tr><tr><td><p>vede daňovou evidenci</p></td></tr><tr><td><p>vysvětlí na příkladech etiku v podnikání</p></td></tr><tr><td rowspan=\"7\"><p><strong>2</strong></p></td><td><p><strong>řídí realizaci jednoduchého projektu</strong></p></td></tr><tr><td><p>naplánuje aktivity projektu</p></td></tr><tr><td><p>navrhne rozpočet projektu vzhledem k navrženým aktivitám</p></td></tr><tr><td><p>stanoví základní ukazatele a sleduje jejich naplňování</p></td></tr><tr><td><p>vede projektový tým</p></td></tr><tr><td><p>uvede, jak by řešil krizové situace v projektu</p></td></tr><tr><td><p>vyhodnotí úspěšnost projektu</p></td></tr><tr><td rowspan=\"7\"><p><strong>3</strong></p></td><td><p><strong>aplikuje ekonomické teorie v osobním a profesním životě</strong></p></td></tr><tr><td><p>vysvětlí základní ekonomické otázky</p></td></tr><tr><td><p>vysvětí stanovení rovnovážné ceny na dokonalém i nedokonalém trhu</p></td></tr><tr><td><p>charakterizuje výrobní faktory a vysvětlí hranici produkčních možností a náklady obětované příležitosti</p></td></tr><tr><td><p>uvede nejdůležitější makroekonomické pojmy a vliv jejich výše na kvalitu života a podnikání v daném státě</p></td></tr><tr><td><p>vysvětlí podstatu inflace a její důsledky na finanční situaci obyvatel a na příkladu ukáže jak se bránit jejím nepříznivým důsledkům</p></td></tr><tr><td><p>uvede hlavní výhody a nevýhody mezinárodního obchodu a vliv ochranářských opatření na ekonomickou situaci dané země</p></td></tr><tr><td></td><td></td><td><p><strong>4</strong></p></td><td><p>Atd.</p></td></tr></tbody></table></div>\n\n**Vyučovací předmět / vzdělávací modul**\n\nOčekávané výsledky učení jsou v **ŠVP** členěny do vyučovacích předmětů nebo vzdělávacích modulů, které jsou dále zařazeny do jednoho nebo více ročníků 4letého studia. Vyučovací předmět / vzdělávací modul tvoří vyučovací jednotku, kde jsou očekávané výsledky učení dále rozpracovány pro potřeby výuky podle následující šablony\n\n| **A. VSTUPNÍ ČÁST** |\n| --- |\n| **1\\. Název** |\n| **2\\. Kód** (kódy by měly být navázány na obory vzdělání a výsledky učení) |\n| **2a) Kategorie vzdělání** - v případě, že nebude součástí kódu |\n| **3\\. Typ vyučovací jednotky** (modul, předmět, stáž apod.) |\n| **4\\. Délka** (počet hodin - dělitelný čtyřmi (optimální modul 16, 32 hodin = týden výuky) |\n| **5\\. Platnost** (datum, od kterého platí) |\n| **6\\. Vstupní předpoklady** (vymezení požadované úrovně vstupních vědomostí a dovedností, které jsou předpokladem úspěšného studia) |\n| |\n| **B. JÁDRO VYUČOVACÍ JEDNOTKY** |\n| **1\\. Charakteristika** (stručná anotace popisující obecné cíle a pojetí) |\n| **2\\. Očekávané výsledky učení a jejich indikátory (převzaté z RVP nebo dále konkretizované)** |\n| **3\\. Podpora rozvoje klíčových kompetencí a základních gramotností** (které klíčové kompetence jsou v rozvíjeny) |\n| **4\\. Obsah vzdělávání** (rozpis učiva) |\n| **5\\. Vzdělávací strategie** (strategie výuky, resp. učební činnosti žáků, které jsou doporučené pro dosažení výsledků) |\n| |\n| **C. VÝSTUPNÍ ČÁST** |\n| **1\\. Způsob ověřování dosažených výsledků** (ve vazbě na jednotlivé výsledky učení) |\n| **2\\. Kritéria hodnocení** (co znamená splnění výsledků učení, kdy je splněna celá vyučovací jednotka, kritéria pro známky, příp. procentuální, slovní hodnocení) |\n| **3\\. Doporučená studijní literatura, odkazy na ilustrační zdroje** |\n| **4\\. Poznámky** |\n\n**Soulad OVU RVP a ŠVP**\n\nTento soulad je předmětem zjišťování. Soulad nastává, jestliže jsou očekávané výsledky učení z jednotlivých vzdělávacích oblastí RVP **obsaženy** ve vyučovacích předmětech/ vzdělávacích modulech ŠVP jednotlivých škol, tzn. že v ŠVP se objevuje jejich formulace buď v doslovném nebo podobném znění v jednom nebo více vyučovacích předmětech/ vzdělávacích modulech.\n\n_Příklad souladu:_\n\nRVP ŠVP - komunikace a marketing (SŠ obchodní Č.\n\n| **2** | **řídí realizaci jednoduchého projektu** |\n| --- | --- |\n| naplánuje aktivity projektu |\n| navrhne rozpočet projektu vzhledem k navrženým aktivitám |\n| stanoví základní ukazatele a sleduje jejich naplňování |\n| vede projektový tým |\n| uvede, jak by řešil krizové situace v projektu |\n| vyhodnotí úspěšnost projektu |\n\nKNOWLEDGE {Porovnání RVP a ŠVP - postup}\n\n\n# AUDITNÍ PROTOKOL ŠVP-RVP\n\n# (POPIS KONTROLNÍHO ALGORITMU)\n\nMetodika je určena pro **Kvantifikaci Shody** školního vzdělávacího programu (ŠVP) s Rámcovým vzdělávacím programem (RVP).\n\n## FÁZE 1: VALIDACE DOKUMENTACE\n\n**Cíl:** Ověřit platnost, aktuálnost a strukturu zdrojových dokumentů.\n\n- **RVP Verifikace:** Otevřít aktuální verzi RVP (např. RVP ZV/G/SOŠ).\n- **Typová shoda:** Ověřit, že RVP se vztahuje k danému typu školy.\n- **ŠVP Dimenze:** Identifikovat a izolovat relevantní části ŠVP: Profil absolventa, Klíčové kompetence (KK), Vzdělávací oblasti (VO), případně Učební plán (UP).\n- **Verzování:** Potvrdit, že obě verze (RVP a ŠVP) jsou nejnovější a platné (včetně dodatků RVP).\n\n## FÁZE 2: DATABÁZOVÉ MAPOVÁNÍ VÝSTUPŮ (MASTER MATICE)\n\n**Cíl:** Vytvořit systémovou databázi pro křížové porovnání všech povinných komponent RVP se ŠVP.\n\n- **Dekompozice RVP:** Rozložit RVP na základní povinné komponenty: Klíčové kompetence, Vzdělávací oblasti a obory, Očekávané výstupy (OVU), Průřezová témata (PT).\n- **Přiřazovací mapa:** Vytvořit hlavní kontrolní matici (Master Matice) pro záznam vazeb.\n\n| Oblast RVP | Výstup RVP (OVU) | Odpovídající Část ŠVP (Předmět/Ročník) | Konkrétní Tématický Celek v ŠVP | Stav Shody (Protokol) |\n| --- | --- | --- | --- | --- |\n| ... | ... | ... | ... | ... |\n| --- | --- | --- | --- | --- |\n\n## FÁZE 3: ALGORITMICKÁ KONTROLA POKRYTÍ A HLOUBKY\n\n**Cíl:** Posoudit, zda každý povinný výstup RVP je adekvátně reflektován v obsahu ŠVP, a přidělit bodovou hodnotu pro kvantifikaci.\n\n- **Audit OVU:** Projít každý jednotlivý Očekávaný výstup (OVU) z RVP.\n- **Kódování stavu a bodování:** U každého OVU v matici označit stav pokrytí dle následujícího schématu:\n\n| Kód (Protokol) | Popis (Kvalitativní zjištění) | Bodová hodnota (Kvantifikace) |\n| --- | --- | --- |\n| ✅ | Plná shoda (Výstup pokryt v plném rozsahu, odpovídající úrovni RVP) | 1,0 |\n| --- | --- | --- |\n| ⚠️ | Částečná shoda (Formální pokrytí, omezený rozsah, chybná návaznost) | 0,5 |\n| --- | --- | --- |\n| ❌ | Absence (Výstup zcela chybí v obsahu ŠVP) | 0,0 |\n| --- | --- | --- |\n\n- **Defektologie ŠVP:** Identifikovat a zaznamenat deficity ŠVP: Chybějící výstupy (❌), Sémantické překryvy, Přetížení obsahu.\n- **Kvalitativní posun:** Ověřit, zda je formulace výstupů v ŠVP **aktivní, měřitelná a v souladu** s úrovní RVP.\n\n## FÁZE 4: STRUKTURÁLNÍ VERIFIKACE NÁVAZNOSTI (VERTIKÁLA/HORIZONTÁLA)\n\n**Cíl:** Zkontrolovat logickou posloupnost a provázanost učiva v rámci ŠVP.\n\n- **Vertikální Kontrola:** Ověřit posloupnost OVU a učiva uvnitř jednoho předmětu/oblasti (postup od jednodušších ke složitějším konceptům napříč ročníky).\n- **Horizontální Kontrola:** Zkontrolovat logické provázání napříč vzdělávacími oblastmi a předměty (např. fyzika ↔ matematika).\n- **PT Integrace:** Audit reálné integrace Průřezových témat (PT) do konkrétních částí obsahu, metod a projektů.\n\n## FÁZE 5: ANALÝZA ŠKOLNÍ PROFILACE A ROZŠÍŘENÍ RVP\n\n**Cíl:** Validovat, že profilace školy je **v souladu** s RVP a nejedná se o **rozpor**.\n\n- **Nekonfliktnost:** Porovnat definovaný Profil absolventa školy s Klíčovými kompetencemi RVP. Profil ŠVP musí RVP rozvíjet, nikoli mu odporovat.\n- **Modularita:** Zkontrolovat, zda volitelné předměty a rozšiřující moduly logicky navazují na vzdělávací oblasti RVP.\n- **Implementace specializace:** Popisně uvést, jak je školní profilace (např. STEM zaměření, projektová výuka) integrována do OVU a kompetencí definovaných RVP.\n\n## FÁZE 6: GENERÁTOR ZÁVĚREČNÉ ZPRÁVY A KVANTIFIKACE\n\n**Cíl:** Syntetizovat výsledky, kvantifikovat soulad a generovat závazné návrhy na korekce.\n\n### 6.1 Kvantifikace Souladu\n\nVypočítat Index shody (IS) na základě bodového hodnocení (Fáze 3):\n\n### 6.2 Interpretace Indexu Shody (IS)\n\nKlasifikace souladu pro standardizované vyhodnocení:\n\n| Interval IS | Klasifikace souladu | Popis |\n| --- | --- | --- |\n| 95-100 % | Výborný soulad | ŠVP plně odpovídá RVP, pouze stylistické nebo formální rozdíly. |\n| --- | --- | --- |\n| 85-94 % | Dobrá shoda | ŠVP pokrývá všechny klíčové výstupy, menší korekce nutné. |\n| --- | --- | --- |\n| 70-84 % | Částečná shoda | Významné nedostatky v některých oblastech, nutná revize obsahu. |\n| --- | --- | --- |\n| < 70 % | Kritická neshoda | ŠVP neplní rámcové požadavky, ohrožuje legislativní soulad. |\n| --- | --- | --- |\n\n### 6.3 Doplňkové Indexy\n\nVypočítat následující doplňkové indexy pro detailní kvalitativní analýzu:\n\n- **Index kompetenčního souladu (IKS):** Poměr pokrytí klíčových kompetencí RVP v ŠVP.\n- **Index průřezové integrace (IPI):** Míra reálné integrace průřezových témat do výuky.\n- **Index hloubky pokrytí (IHP):** Procento výstupů, které jsou v ŠVP rozvedeny na konkrétní výukové cíle (měřitelné, aktivní formulace).\n- **Index profilové rozšiřitelnosti (IPR):** Kolik rozšiřujících nebo profilových výstupů přesahuje rámec RVP, aniž by narušily jeho strukturu.\n\n### 6.4 Vizuální výstupy\n\nZajistit generování následujících vizualizací pro Závěrečnou zprávu:\n\n- Graf pokrytí po vzdělávacích oblastech (Sloupcový graf IS pro VO).\n- Pavoukový diagram Klíčových kompetencí (RVP vs. ŠVP).\n- Mapa defektů (Vizualizace ❌ a ⚠️ výstupů).\n\n### 6.5 Struktura Závěrečné Zprávy\n\nZpráva musí být strukturována dle standardizovaného formátu:\n\n| Oddíl | Obsah |\n| --- | --- |\n| A. Identifikace | Název školy, IZO, typ školy, datum revize, zpracovatel, verze ŠVP a RVP. |\n| --- | --- |\n| B. Shrnutí výsledků | Celkový Index Shody (IS), hlavní závěry a doporučení. |\n| --- | --- |\n| C. Kvantitativní analýza | Přehled IS v % dle kategorií OVU / VO / kompetencí. |\n| --- | --- |\n| D. Kvalitativní analýza | Slovní zhodnocení kvality souladu (formulace, obtížnost, integrace PT). |\n| --- | --- |\n| E. Rizikové oblasti | Přehled nalezených defektů (chybějící OVU, přetížení, formální shoda). |\n| --- | --- |\n| F. Návrhy opatření (Korekční plán) | Přesné návrhy změn - **Co, Kde, Kdo** má upravit, včetně termínu. |\n| --- | --- |\n| G. Přílohy | Master Matice (Fáze 2-3), revizní tabulka, výstupní grafy a metriky. |\n| --- | --- |\n\n\n\n\n.\n"}],sourceFile:"./books/examples/lsvp-asistent.book"}];
|
|
5719
5763
|
|
|
5720
5764
|
/**
|
|
5721
5765
|
* Function `validatePipelineString` will validate the if the string is a valid pipeline string
|
|
@@ -10441,260 +10485,1970 @@ function promptbookifyAiText(text) {
|
|
|
10441
10485
|
*/
|
|
10442
10486
|
|
|
10443
10487
|
/**
|
|
10444
|
-
*
|
|
10445
|
-
* This wraps underlying LLM execution tools and applies agent-specific system prompts and requirements
|
|
10488
|
+
* Helper of usage compute
|
|
10446
10489
|
*
|
|
10447
|
-
* @
|
|
10490
|
+
* @param content the content of prompt or response
|
|
10491
|
+
* @returns part of UsageCounts
|
|
10492
|
+
*
|
|
10493
|
+
* @private internal utility of LlmExecutionTools
|
|
10448
10494
|
*/
|
|
10449
|
-
|
|
10450
|
-
|
|
10451
|
-
|
|
10452
|
-
|
|
10453
|
-
|
|
10454
|
-
|
|
10455
|
-
|
|
10456
|
-
|
|
10457
|
-
|
|
10458
|
-
this.agentSource = agentSource;
|
|
10459
|
-
/**
|
|
10460
|
-
* Cached model requirements to avoid re-parsing the agent source
|
|
10461
|
-
*/
|
|
10462
|
-
this._cachedModelRequirements = null;
|
|
10463
|
-
/**
|
|
10464
|
-
* Cached parsed agent information
|
|
10465
|
-
*/
|
|
10466
|
-
this._cachedAgentInfo = null;
|
|
10467
|
-
}
|
|
10468
|
-
/**
|
|
10469
|
-
* Get cached or parse agent information
|
|
10470
|
-
*/
|
|
10471
|
-
getAgentInfo() {
|
|
10472
|
-
if (this._cachedAgentInfo === null) {
|
|
10473
|
-
this._cachedAgentInfo = parseAgentSource(this.agentSource);
|
|
10474
|
-
}
|
|
10475
|
-
return this._cachedAgentInfo;
|
|
10476
|
-
}
|
|
10477
|
-
/**
|
|
10478
|
-
* Get cached or create agent model requirements
|
|
10479
|
-
*/
|
|
10480
|
-
async getAgentModelRequirements() {
|
|
10481
|
-
if (this._cachedModelRequirements === null) {
|
|
10482
|
-
// Get available models from underlying LLM tools for best model selection
|
|
10483
|
-
const availableModels = await this.llmTools.listModels();
|
|
10484
|
-
this._cachedModelRequirements = await createAgentModelRequirements(this.agentSource, undefined, // Let the function pick the best model
|
|
10485
|
-
availableModels);
|
|
10486
|
-
}
|
|
10487
|
-
return this._cachedModelRequirements;
|
|
10488
|
-
}
|
|
10489
|
-
get title() {
|
|
10490
|
-
const agentInfo = this.getAgentInfo();
|
|
10491
|
-
return (agentInfo.agentName || 'Agent');
|
|
10492
|
-
}
|
|
10493
|
-
get description() {
|
|
10494
|
-
const agentInfo = this.getAgentInfo();
|
|
10495
|
-
return agentInfo.personaDescription || 'AI Agent with predefined personality and behavior';
|
|
10496
|
-
}
|
|
10497
|
-
get profile() {
|
|
10498
|
-
const agentInfo = this.getAgentInfo();
|
|
10499
|
-
if (!agentInfo.agentName) {
|
|
10500
|
-
return undefined;
|
|
10501
|
-
}
|
|
10502
|
-
return {
|
|
10503
|
-
name: agentInfo.agentName.toUpperCase().replace(/\s+/g, '_'),
|
|
10504
|
-
fullname: agentInfo.agentName,
|
|
10505
|
-
color: agentInfo.meta.color || '#6366f1',
|
|
10506
|
-
avatarSrc: agentInfo.meta.image,
|
|
10507
|
-
};
|
|
10508
|
-
}
|
|
10509
|
-
checkConfiguration() {
|
|
10510
|
-
// Check underlying tools configuration
|
|
10511
|
-
return this.llmTools.checkConfiguration();
|
|
10512
|
-
}
|
|
10513
|
-
/**
|
|
10514
|
-
* Returns a virtual model name representing the agent behavior
|
|
10515
|
-
*/
|
|
10516
|
-
get modelName() {
|
|
10517
|
-
const hash = SHA256(hexEncoder.parse(this.agentSource))
|
|
10518
|
-
// <- TODO: [🥬] Encapsulate sha256 to some private utility function
|
|
10519
|
-
.toString( /* hex */);
|
|
10520
|
-
// <- TODO: [🥬] Make some system for hashes and ids of promptbook
|
|
10521
|
-
const agentId = hash.substring(0, 10);
|
|
10522
|
-
// <- TODO: [🥬] Make some system for hashes and ids of promptbook
|
|
10523
|
-
return (normalizeToKebabCase(this.title) + '-' + agentId);
|
|
10524
|
-
}
|
|
10525
|
-
listModels() {
|
|
10526
|
-
return [
|
|
10527
|
-
{
|
|
10528
|
-
modelName: this.modelName,
|
|
10529
|
-
modelVariant: 'CHAT',
|
|
10530
|
-
modelTitle: `${this.title} (Agent Chat Default)`,
|
|
10531
|
-
modelDescription: `Chat model with agent behavior: ${this.description}`,
|
|
10532
|
-
},
|
|
10533
|
-
// <- Note: We only list a single "virtual" agent model here as this wrapper only supports chat prompts
|
|
10534
|
-
];
|
|
10535
|
-
}
|
|
10536
|
-
/**
|
|
10537
|
-
* Calls the chat model with agent-specific system prompt and requirements
|
|
10538
|
-
*/
|
|
10539
|
-
async callChatModel(prompt) {
|
|
10540
|
-
if (!this.llmTools.callChatModel) {
|
|
10541
|
-
throw new Error('Underlying LLM execution tools do not support chat model calls');
|
|
10542
|
-
}
|
|
10543
|
-
// Ensure we're working with a chat prompt
|
|
10544
|
-
if (prompt.modelRequirements.modelVariant !== 'CHAT') {
|
|
10545
|
-
throw new Error('AgentLlmExecutionTools only supports chat prompts');
|
|
10546
|
-
}
|
|
10547
|
-
const chatPrompt = prompt;
|
|
10548
|
-
// Get agent model requirements (cached with best model selection)
|
|
10549
|
-
const modelRequirements = await this.getAgentModelRequirements();
|
|
10550
|
-
// Create modified chat prompt with agent system message
|
|
10551
|
-
const modifiedChatPrompt = {
|
|
10552
|
-
...chatPrompt,
|
|
10553
|
-
modelRequirements: {
|
|
10554
|
-
...chatPrompt.modelRequirements,
|
|
10555
|
-
...modelRequirements,
|
|
10556
|
-
// Prepend agent system message to existing system message
|
|
10557
|
-
systemMessage: modelRequirements.systemMessage +
|
|
10558
|
-
(chatPrompt.modelRequirements.systemMessage
|
|
10559
|
-
? `\n\n${chatPrompt.modelRequirements.systemMessage}`
|
|
10560
|
-
: ''),
|
|
10561
|
-
},
|
|
10562
|
-
};
|
|
10563
|
-
const underlyingLlmResult = await this.llmTools.callChatModel(modifiedChatPrompt);
|
|
10564
|
-
let content = underlyingLlmResult.content;
|
|
10565
|
-
// Note: Cleanup the AI artifacts from the content
|
|
10566
|
-
content = humanizeAiText(content);
|
|
10567
|
-
// Note: Make sure the content is Promptbook-like
|
|
10568
|
-
content = promptbookifyAiText(content);
|
|
10569
|
-
const agentResult = {
|
|
10570
|
-
...underlyingLlmResult,
|
|
10571
|
-
content,
|
|
10572
|
-
modelName: this.modelName,
|
|
10573
|
-
};
|
|
10574
|
-
return agentResult;
|
|
10575
|
-
}
|
|
10495
|
+
function computeUsageCounts(content) {
|
|
10496
|
+
return {
|
|
10497
|
+
charactersCount: { value: countCharacters(content) },
|
|
10498
|
+
wordsCount: { value: countWords(content) },
|
|
10499
|
+
sentencesCount: { value: countSentences(content) },
|
|
10500
|
+
linesCount: { value: countLines(content) },
|
|
10501
|
+
paragraphsCount: { value: countParagraphs(content) },
|
|
10502
|
+
pagesCount: { value: countPages(content) },
|
|
10503
|
+
};
|
|
10576
10504
|
}
|
|
10577
|
-
/**
|
|
10578
|
-
* TODO: [🍚] Implement Destroyable pattern to free resources
|
|
10579
|
-
* TODO: [🧠] Adding parameter substitution support (here or should be responsibility of the underlying LLM Tools)
|
|
10580
|
-
*/
|
|
10581
10505
|
|
|
10582
10506
|
/**
|
|
10583
|
-
*
|
|
10507
|
+
* Make UncertainNumber
|
|
10584
10508
|
*
|
|
10585
|
-
* @
|
|
10586
|
-
|
|
10587
|
-
const createAgentLlmExecutionTools = Object.assign((options) => {
|
|
10588
|
-
return new AgentLlmExecutionTools(options.llmTools, options.agentSource);
|
|
10589
|
-
}, {
|
|
10590
|
-
packageName: '@promptbook/core',
|
|
10591
|
-
className: 'AgentLlmExecutionTools',
|
|
10592
|
-
});
|
|
10593
|
-
/**
|
|
10594
|
-
* TODO: [🧠] Consider adding validation for agent source format
|
|
10595
|
-
* TODO: [🧠] Consider adding options for caching behavior
|
|
10596
|
-
*/
|
|
10597
|
-
|
|
10598
|
-
/**
|
|
10599
|
-
* Metadata for Agent LLM execution tools
|
|
10509
|
+
* @param value value of the uncertain number, if `NaN` or `undefined`, it will be set to 0 and `isUncertain=true`
|
|
10510
|
+
* @param isUncertain if `true`, the value is uncertain, otherwise depends on the value
|
|
10600
10511
|
*
|
|
10601
|
-
* @
|
|
10602
|
-
*/
|
|
10603
|
-
$llmToolsMetadataRegister.register({
|
|
10604
|
-
packageName: '@promptbook/core',
|
|
10605
|
-
className: 'AgentLlmExecutionTools',
|
|
10606
|
-
title: 'Agent',
|
|
10607
|
-
trustLevel: 'UNTRUSTED',
|
|
10608
|
-
order: MODEL_ORDERS.LOW_TIER,
|
|
10609
|
-
envVariables: null,
|
|
10610
|
-
getBoilerplateConfiguration() {
|
|
10611
|
-
return {
|
|
10612
|
-
packageName: '@promptbook/core',
|
|
10613
|
-
className: 'AgentLlmExecutionTools',
|
|
10614
|
-
title: 'Agent',
|
|
10615
|
-
options: {
|
|
10616
|
-
// Note: Agent tools require runtime configuration with underlying tools and agent source
|
|
10617
|
-
// This cannot be provided as a static configuration
|
|
10618
|
-
},
|
|
10619
|
-
};
|
|
10620
|
-
},
|
|
10621
|
-
createConfigurationFromEnv() {
|
|
10622
|
-
// Agent tools cannot be configured from environment variables alone
|
|
10623
|
-
// They require underlying LLM tools and agent source to be provided programmatically
|
|
10624
|
-
return null;
|
|
10625
|
-
},
|
|
10626
|
-
});
|
|
10627
|
-
/**
|
|
10628
|
-
* TODO: [🧠] Consider adding a special trust level for AgentLlmExecutionTools
|
|
10629
|
-
* TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
|
|
10630
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
10512
|
+
* @private utility for initializating UncertainNumber
|
|
10631
10513
|
*/
|
|
10514
|
+
function uncertainNumber(value, isUncertain) {
|
|
10515
|
+
if (value === null || value === undefined || Number.isNaN(value)) {
|
|
10516
|
+
return UNCERTAIN_ZERO_VALUE;
|
|
10517
|
+
}
|
|
10518
|
+
if (isUncertain === true) {
|
|
10519
|
+
return { value, isUncertain };
|
|
10520
|
+
}
|
|
10521
|
+
return { value };
|
|
10522
|
+
}
|
|
10632
10523
|
|
|
10633
10524
|
/**
|
|
10634
|
-
*
|
|
10635
|
-
*
|
|
10636
|
-
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available LLM tools
|
|
10525
|
+
* Create price per one token based on the string value found on openai page
|
|
10637
10526
|
*
|
|
10638
|
-
* @
|
|
10639
|
-
*/
|
|
10640
|
-
$llmToolsRegister.register(createAgentLlmExecutionTools);
|
|
10641
|
-
/**
|
|
10642
|
-
* TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
|
|
10643
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
10527
|
+
* @private within the repository, used only as internal helper for `OPENAI_MODELS`
|
|
10644
10528
|
*/
|
|
10529
|
+
function pricing(value) {
|
|
10530
|
+
const [price, tokens] = value.split(' / ');
|
|
10531
|
+
return parseFloat(price.replace('$', '')) / parseFloat(tokens.replace('M tokens', '')) / 1000000;
|
|
10532
|
+
}
|
|
10645
10533
|
|
|
10646
10534
|
/**
|
|
10647
|
-
*
|
|
10535
|
+
* List of available OpenAI models with pricing
|
|
10648
10536
|
*
|
|
10649
|
-
*
|
|
10537
|
+
* Note: Synced with official API docs at 2025-08-20
|
|
10650
10538
|
*
|
|
10651
|
-
* @
|
|
10652
|
-
* @
|
|
10653
|
-
* @public exported from `@promptbook/
|
|
10539
|
+
* @see https://platform.openai.com/docs/models/
|
|
10540
|
+
* @see https://openai.com/api/pricing/
|
|
10541
|
+
* @public exported from `@promptbook/openai`
|
|
10654
10542
|
*/
|
|
10655
|
-
|
|
10656
|
-
|
|
10657
|
-
|
|
10658
|
-
|
|
10659
|
-
|
|
10660
|
-
|
|
10661
|
-
|
|
10662
|
-
|
|
10663
|
-
|
|
10664
|
-
|
|
10665
|
-
|
|
10666
|
-
|
|
10667
|
-
options: {
|
|
10668
|
-
apiKey: 'sk-ant-api03-',
|
|
10669
|
-
isProxied: true,
|
|
10670
|
-
remoteServerUrl: DEFAULT_REMOTE_SERVER_URL,
|
|
10671
|
-
maxRequestsPerMinute: DEFAULT_MAX_REQUESTS_PER_MINUTE,
|
|
10543
|
+
const OPENAI_MODELS = exportJson({
|
|
10544
|
+
name: 'OPENAI_MODELS',
|
|
10545
|
+
value: [
|
|
10546
|
+
/**/
|
|
10547
|
+
{
|
|
10548
|
+
modelVariant: 'CHAT',
|
|
10549
|
+
modelTitle: 'gpt-5',
|
|
10550
|
+
modelName: 'gpt-5',
|
|
10551
|
+
modelDescription: "OpenAI's most advanced language model with unprecedented reasoning capabilities and 200K context window. Features revolutionary improvements in complex problem-solving, scientific reasoning, and creative tasks. Demonstrates human-level performance across diverse domains with enhanced safety measures and alignment. Represents the next generation of AI with superior understanding, nuanced responses, and advanced multimodal capabilities.",
|
|
10552
|
+
pricing: {
|
|
10553
|
+
prompt: pricing(`$1.25 / 1M tokens`),
|
|
10554
|
+
output: pricing(`$10.00 / 1M tokens`),
|
|
10672
10555
|
},
|
|
10673
|
-
}
|
|
10674
|
-
|
|
10675
|
-
|
|
10676
|
-
|
|
10677
|
-
|
|
10678
|
-
|
|
10679
|
-
|
|
10680
|
-
|
|
10681
|
-
|
|
10682
|
-
|
|
10683
|
-
|
|
10684
|
-
|
|
10685
|
-
|
|
10686
|
-
|
|
10687
|
-
|
|
10688
|
-
|
|
10689
|
-
|
|
10690
|
-
|
|
10691
|
-
|
|
10692
|
-
|
|
10693
|
-
|
|
10694
|
-
|
|
10695
|
-
|
|
10696
|
-
|
|
10697
|
-
|
|
10556
|
+
},
|
|
10557
|
+
/**/
|
|
10558
|
+
/**/
|
|
10559
|
+
{
|
|
10560
|
+
modelVariant: 'CHAT',
|
|
10561
|
+
modelTitle: 'gpt-5-mini',
|
|
10562
|
+
modelName: 'gpt-5-mini',
|
|
10563
|
+
modelDescription: 'A faster, cost-efficient version of GPT-5 for well-defined tasks with 200K context window. Maintains core GPT-5 capabilities while offering 5x faster inference and significantly lower costs. Features enhanced instruction following and reduced latency for production applications requiring quick responses with high quality.',
|
|
10564
|
+
pricing: {
|
|
10565
|
+
prompt: pricing(`$0.25 / 1M tokens`),
|
|
10566
|
+
output: pricing(`$2.00 / 1M tokens`),
|
|
10567
|
+
},
|
|
10568
|
+
},
|
|
10569
|
+
/**/
|
|
10570
|
+
/**/
|
|
10571
|
+
{
|
|
10572
|
+
modelVariant: 'CHAT',
|
|
10573
|
+
modelTitle: 'gpt-5-nano',
|
|
10574
|
+
modelName: 'gpt-5-nano',
|
|
10575
|
+
modelDescription: 'The fastest, most cost-efficient version of GPT-5 with 200K context window. Optimized for summarization, classification, and simple reasoning tasks. Features 10x faster inference than base GPT-5 while maintaining good quality for straightforward applications. Ideal for high-volume, cost-sensitive deployments.',
|
|
10576
|
+
pricing: {
|
|
10577
|
+
prompt: pricing(`$0.05 / 1M tokens`),
|
|
10578
|
+
output: pricing(`$0.40 / 1M tokens`),
|
|
10579
|
+
},
|
|
10580
|
+
},
|
|
10581
|
+
/**/
|
|
10582
|
+
/**/
|
|
10583
|
+
{
|
|
10584
|
+
modelVariant: 'CHAT',
|
|
10585
|
+
modelTitle: 'gpt-4.1',
|
|
10586
|
+
modelName: 'gpt-4.1',
|
|
10587
|
+
modelDescription: 'Smartest non-reasoning model with 128K context window. Enhanced version of GPT-4 with improved instruction following, better factual accuracy, and reduced hallucinations. Features advanced function calling capabilities and superior performance on coding tasks. Ideal for applications requiring high intelligence without reasoning overhead.',
|
|
10588
|
+
pricing: {
|
|
10589
|
+
prompt: pricing(`$3.00 / 1M tokens`),
|
|
10590
|
+
output: pricing(`$12.00 / 1M tokens`),
|
|
10591
|
+
},
|
|
10592
|
+
},
|
|
10593
|
+
/**/
|
|
10594
|
+
/**/
|
|
10595
|
+
{
|
|
10596
|
+
modelVariant: 'CHAT',
|
|
10597
|
+
modelTitle: 'gpt-4.1-mini',
|
|
10598
|
+
modelName: 'gpt-4.1-mini',
|
|
10599
|
+
modelDescription: 'Smaller, faster version of GPT-4.1 with 128K context window. Balances intelligence and efficiency with 3x faster inference than base GPT-4.1. Maintains strong capabilities across text generation, reasoning, and coding while offering better cost-performance ratio for most applications.',
|
|
10600
|
+
pricing: {
|
|
10601
|
+
prompt: pricing(`$0.80 / 1M tokens`),
|
|
10602
|
+
output: pricing(`$3.20 / 1M tokens`),
|
|
10603
|
+
},
|
|
10604
|
+
},
|
|
10605
|
+
/**/
|
|
10606
|
+
/**/
|
|
10607
|
+
{
|
|
10608
|
+
modelVariant: 'CHAT',
|
|
10609
|
+
modelTitle: 'gpt-4.1-nano',
|
|
10610
|
+
modelName: 'gpt-4.1-nano',
|
|
10611
|
+
modelDescription: 'Fastest, most cost-efficient version of GPT-4.1 with 128K context window. Optimized for high-throughput applications requiring good quality at minimal cost. Features 5x faster inference than GPT-4.1 while maintaining adequate performance for most general-purpose tasks.',
|
|
10612
|
+
pricing: {
|
|
10613
|
+
prompt: pricing(`$0.20 / 1M tokens`),
|
|
10614
|
+
output: pricing(`$0.80 / 1M tokens`),
|
|
10615
|
+
},
|
|
10616
|
+
},
|
|
10617
|
+
/**/
|
|
10618
|
+
/**/
|
|
10619
|
+
{
|
|
10620
|
+
modelVariant: 'CHAT',
|
|
10621
|
+
modelTitle: 'o3',
|
|
10622
|
+
modelName: 'o3',
|
|
10623
|
+
modelDescription: 'Advanced reasoning model with 128K context window specializing in complex logical, mathematical, and analytical tasks. Successor to o1 with enhanced step-by-step problem-solving capabilities and superior performance on STEM-focused problems. Ideal for professional applications requiring deep analytical thinking and precise reasoning.',
|
|
10624
|
+
pricing: {
|
|
10625
|
+
prompt: pricing(`$15.00 / 1M tokens`),
|
|
10626
|
+
output: pricing(`$60.00 / 1M tokens`),
|
|
10627
|
+
},
|
|
10628
|
+
},
|
|
10629
|
+
/**/
|
|
10630
|
+
/**/
|
|
10631
|
+
{
|
|
10632
|
+
modelVariant: 'CHAT',
|
|
10633
|
+
modelTitle: 'o3-pro',
|
|
10634
|
+
modelName: 'o3-pro',
|
|
10635
|
+
modelDescription: 'Enhanced version of o3 with more compute allocated for better responses on the most challenging problems. Features extended reasoning time and improved accuracy on complex analytical tasks. Designed for applications where maximum reasoning quality is more important than response speed.',
|
|
10636
|
+
pricing: {
|
|
10637
|
+
prompt: pricing(`$30.00 / 1M tokens`),
|
|
10638
|
+
output: pricing(`$120.00 / 1M tokens`),
|
|
10639
|
+
},
|
|
10640
|
+
},
|
|
10641
|
+
/**/
|
|
10642
|
+
/**/
|
|
10643
|
+
{
|
|
10644
|
+
modelVariant: 'CHAT',
|
|
10645
|
+
modelTitle: 'o4-mini',
|
|
10646
|
+
modelName: 'o4-mini',
|
|
10647
|
+
modelDescription: 'Fast, cost-efficient reasoning model with 128K context window. Successor to o1-mini with improved analytical capabilities while maintaining speed advantages. Features enhanced mathematical reasoning and logical problem-solving at significantly lower cost than full reasoning models.',
|
|
10648
|
+
pricing: {
|
|
10649
|
+
prompt: pricing(`$4.00 / 1M tokens`),
|
|
10650
|
+
output: pricing(`$16.00 / 1M tokens`),
|
|
10651
|
+
},
|
|
10652
|
+
},
|
|
10653
|
+
/**/
|
|
10654
|
+
/**/
|
|
10655
|
+
{
|
|
10656
|
+
modelVariant: 'CHAT',
|
|
10657
|
+
modelTitle: 'o3-deep-research',
|
|
10658
|
+
modelName: 'o3-deep-research',
|
|
10659
|
+
modelDescription: 'Most powerful deep research model with 128K context window. Specialized for comprehensive research tasks, literature analysis, and complex information synthesis. Features advanced citation capabilities and enhanced factual accuracy for academic and professional research applications.',
|
|
10660
|
+
pricing: {
|
|
10661
|
+
prompt: pricing(`$25.00 / 1M tokens`),
|
|
10662
|
+
output: pricing(`$100.00 / 1M tokens`),
|
|
10663
|
+
},
|
|
10664
|
+
},
|
|
10665
|
+
/**/
|
|
10666
|
+
/**/
|
|
10667
|
+
{
|
|
10668
|
+
modelVariant: 'CHAT',
|
|
10669
|
+
modelTitle: 'o4-mini-deep-research',
|
|
10670
|
+
modelName: 'o4-mini-deep-research',
|
|
10671
|
+
modelDescription: 'Faster, more affordable deep research model with 128K context window. Balances research capabilities with cost efficiency, offering good performance on literature review, fact-checking, and information synthesis tasks at a more accessible price point.',
|
|
10672
|
+
pricing: {
|
|
10673
|
+
prompt: pricing(`$12.00 / 1M tokens`),
|
|
10674
|
+
output: pricing(`$48.00 / 1M tokens`),
|
|
10675
|
+
},
|
|
10676
|
+
},
|
|
10677
|
+
/**/
|
|
10678
|
+
/*/
|
|
10679
|
+
{
|
|
10680
|
+
modelTitle: 'dall-e-3',
|
|
10681
|
+
modelName: 'dall-e-3',
|
|
10682
|
+
},
|
|
10683
|
+
/**/
|
|
10684
|
+
/*/
|
|
10685
|
+
{
|
|
10686
|
+
modelTitle: 'whisper-1',
|
|
10687
|
+
modelName: 'whisper-1',
|
|
10688
|
+
},
|
|
10689
|
+
/**/
|
|
10690
|
+
/**/
|
|
10691
|
+
{
|
|
10692
|
+
modelVariant: 'COMPLETION',
|
|
10693
|
+
modelTitle: 'davinci-002',
|
|
10694
|
+
modelName: 'davinci-002',
|
|
10695
|
+
modelDescription: 'Legacy completion model with 4K token context window. Excels at complex text generation, creative writing, and detailed content creation with strong contextual understanding. Optimized for instructions requiring nuanced outputs and extended reasoning. Suitable for applications needing high-quality text generation without conversation management.',
|
|
10696
|
+
pricing: {
|
|
10697
|
+
prompt: pricing(`$2.00 / 1M tokens`),
|
|
10698
|
+
output: pricing(`$2.00 / 1M tokens`),
|
|
10699
|
+
},
|
|
10700
|
+
},
|
|
10701
|
+
/**/
|
|
10702
|
+
/*/
|
|
10703
|
+
{
|
|
10704
|
+
modelTitle: 'dall-e-2',
|
|
10705
|
+
modelName: 'dall-e-2',
|
|
10706
|
+
},
|
|
10707
|
+
/**/
|
|
10708
|
+
/**/
|
|
10709
|
+
{
|
|
10710
|
+
modelVariant: 'CHAT',
|
|
10711
|
+
modelTitle: 'gpt-3.5-turbo-16k',
|
|
10712
|
+
modelName: 'gpt-3.5-turbo-16k',
|
|
10713
|
+
modelDescription: 'Extended context GPT-3.5 Turbo with 16K token window. Maintains core capabilities of standard 3.5 Turbo while supporting longer conversations and documents. Features good balance of performance and cost for applications requiring more context than standard 4K models. Effective for document analysis, extended conversations, and multi-step reasoning tasks.',
|
|
10714
|
+
pricing: {
|
|
10715
|
+
prompt: pricing(`$3.00 / 1M tokens`),
|
|
10716
|
+
output: pricing(`$4.00 / 1M tokens`),
|
|
10717
|
+
},
|
|
10718
|
+
},
|
|
10719
|
+
/**/
|
|
10720
|
+
/*/
|
|
10721
|
+
{
|
|
10722
|
+
modelTitle: 'tts-1-hd-1106',
|
|
10723
|
+
modelName: 'tts-1-hd-1106',
|
|
10724
|
+
},
|
|
10725
|
+
/**/
|
|
10726
|
+
/*/
|
|
10727
|
+
{
|
|
10728
|
+
modelTitle: 'tts-1-hd',
|
|
10729
|
+
modelName: 'tts-1-hd',
|
|
10730
|
+
},
|
|
10731
|
+
/**/
|
|
10732
|
+
/**/
|
|
10733
|
+
{
|
|
10734
|
+
modelVariant: 'CHAT',
|
|
10735
|
+
modelTitle: 'gpt-4',
|
|
10736
|
+
modelName: 'gpt-4',
|
|
10737
|
+
modelDescription: 'Powerful language model with 8K context window featuring sophisticated reasoning, instruction-following, and knowledge capabilities. Demonstrates strong performance on complex tasks requiring deep understanding and multi-step reasoning. Excels at code generation, logical analysis, and nuanced content creation. Suitable for advanced applications requiring high-quality outputs.',
|
|
10738
|
+
pricing: {
|
|
10739
|
+
prompt: pricing(`$30.00 / 1M tokens`),
|
|
10740
|
+
output: pricing(`$60.00 / 1M tokens`),
|
|
10741
|
+
},
|
|
10742
|
+
},
|
|
10743
|
+
/**/
|
|
10744
|
+
/**/
|
|
10745
|
+
{
|
|
10746
|
+
modelVariant: 'CHAT',
|
|
10747
|
+
modelTitle: 'gpt-4-32k',
|
|
10748
|
+
modelName: 'gpt-4-32k',
|
|
10749
|
+
modelDescription: 'Extended context version of GPT-4 with 32K token window. Maintains all capabilities of standard GPT-4 while supporting analysis of very lengthy documents, code bases, and conversations. Features enhanced ability to maintain context over long interactions and process detailed information from large inputs. Ideal for document analysis, legal review, and complex problem-solving.',
|
|
10750
|
+
pricing: {
|
|
10751
|
+
prompt: pricing(`$60.00 / 1M tokens`),
|
|
10752
|
+
output: pricing(`$120.00 / 1M tokens`),
|
|
10753
|
+
},
|
|
10754
|
+
},
|
|
10755
|
+
/**/
|
|
10756
|
+
/*/
|
|
10757
|
+
{
|
|
10758
|
+
modelVariant: 'CHAT',
|
|
10759
|
+
modelTitle: 'gpt-4-0613',
|
|
10760
|
+
modelName: 'gpt-4-0613',
|
|
10761
|
+
pricing: {
|
|
10762
|
+
prompt: computeUsage(` / 1M tokens`),
|
|
10763
|
+
output: computeUsage(` / 1M tokens`),
|
|
10764
|
+
},
|
|
10765
|
+
},
|
|
10766
|
+
/**/
|
|
10767
|
+
/**/
|
|
10768
|
+
{
|
|
10769
|
+
modelVariant: 'CHAT',
|
|
10770
|
+
modelTitle: 'gpt-4-turbo-2024-04-09',
|
|
10771
|
+
modelName: 'gpt-4-turbo-2024-04-09',
|
|
10772
|
+
modelDescription: 'Latest stable GPT-4 Turbo from April 2024 with 128K context window. Features enhanced reasoning chains, improved factual accuracy with 40% reduction in hallucinations, and better instruction following compared to earlier versions. Includes advanced function calling capabilities and knowledge up to April 2024. Provides optimal performance for enterprise applications requiring reliability.',
|
|
10773
|
+
pricing: {
|
|
10774
|
+
prompt: pricing(`$10.00 / 1M tokens`),
|
|
10775
|
+
output: pricing(`$30.00 / 1M tokens`),
|
|
10776
|
+
},
|
|
10777
|
+
},
|
|
10778
|
+
/**/
|
|
10779
|
+
/**/
|
|
10780
|
+
{
|
|
10781
|
+
modelVariant: 'CHAT',
|
|
10782
|
+
modelTitle: 'gpt-3.5-turbo-1106',
|
|
10783
|
+
modelName: 'gpt-3.5-turbo-1106',
|
|
10784
|
+
modelDescription: 'November 2023 version of GPT-3.5 Turbo with 16K token context window. Features improved instruction following, more consistent output formatting, and enhanced function calling capabilities. Includes knowledge cutoff from April 2023. Suitable for applications requiring good performance at lower cost than GPT-4 models.',
|
|
10785
|
+
pricing: {
|
|
10786
|
+
prompt: pricing(`$1.00 / 1M tokens`),
|
|
10787
|
+
output: pricing(`$2.00 / 1M tokens`),
|
|
10788
|
+
},
|
|
10789
|
+
},
|
|
10790
|
+
/**/
|
|
10791
|
+
/**/
|
|
10792
|
+
{
|
|
10793
|
+
modelVariant: 'CHAT',
|
|
10794
|
+
modelTitle: 'gpt-4-turbo',
|
|
10795
|
+
modelName: 'gpt-4-turbo',
|
|
10796
|
+
modelDescription: 'More capable and cost-efficient version of GPT-4 with 128K token context window. Features improved instruction following, advanced function calling capabilities, and better performance on coding tasks. Maintains superior reasoning and knowledge while offering substantial cost reduction compared to base GPT-4. Ideal for complex applications requiring extensive context processing.',
|
|
10797
|
+
pricing: {
|
|
10798
|
+
prompt: pricing(`$10.00 / 1M tokens`),
|
|
10799
|
+
output: pricing(`$30.00 / 1M tokens`),
|
|
10800
|
+
},
|
|
10801
|
+
},
|
|
10802
|
+
/**/
|
|
10803
|
+
/**/
|
|
10804
|
+
{
|
|
10805
|
+
modelVariant: 'COMPLETION',
|
|
10806
|
+
modelTitle: 'gpt-3.5-turbo-instruct-0914',
|
|
10807
|
+
modelName: 'gpt-3.5-turbo-instruct-0914',
|
|
10808
|
+
modelDescription: 'September 2023 version of GPT-3.5 Turbo Instruct with 4K context window. Optimized for completion-style instruction following with deterministic responses. Better suited than chat models for applications requiring specific formatted outputs without conversation management. Knowledge cutoff from September 2021.',
|
|
10809
|
+
pricing: {
|
|
10810
|
+
prompt: pricing(`$1.50 / 1M tokens`),
|
|
10811
|
+
output: pricing(`$2.00 / 1M tokens`),
|
|
10812
|
+
},
|
|
10813
|
+
},
|
|
10814
|
+
/**/
|
|
10815
|
+
/**/
|
|
10816
|
+
{
|
|
10817
|
+
modelVariant: 'COMPLETION',
|
|
10818
|
+
modelTitle: 'gpt-3.5-turbo-instruct',
|
|
10819
|
+
modelName: 'gpt-3.5-turbo-instruct',
|
|
10820
|
+
modelDescription: 'Optimized version of GPT-3.5 for completion-style API with 4K token context window. Features strong instruction following with single-turn design rather than multi-turn conversation. Provides more consistent, deterministic outputs compared to chat models. Well-suited for templated content generation and structured text transformation tasks.',
|
|
10821
|
+
pricing: {
|
|
10822
|
+
prompt: pricing(`$1.50 / 1M tokens`),
|
|
10823
|
+
output: pricing(`$2.00 / 1M tokens`),
|
|
10824
|
+
},
|
|
10825
|
+
},
|
|
10826
|
+
/**/
|
|
10827
|
+
/*/
|
|
10828
|
+
{
|
|
10829
|
+
modelTitle: 'tts-1',
|
|
10830
|
+
modelName: 'tts-1',
|
|
10831
|
+
},
|
|
10832
|
+
/**/
|
|
10833
|
+
/**/
|
|
10834
|
+
{
|
|
10835
|
+
modelVariant: 'CHAT',
|
|
10836
|
+
modelTitle: 'gpt-3.5-turbo',
|
|
10837
|
+
modelName: 'gpt-3.5-turbo',
|
|
10838
|
+
modelDescription: 'Latest version of GPT-3.5 Turbo with 4K token default context window (16K available). Features continually improved performance with enhanced instruction following and reduced hallucinations. Offers excellent balance between capability and cost efficiency. Suitable for most general-purpose applications requiring good AI capabilities at reasonable cost.',
|
|
10839
|
+
pricing: {
|
|
10840
|
+
prompt: pricing(`$0.50 / 1M tokens`),
|
|
10841
|
+
output: pricing(`$1.50 / 1M tokens`),
|
|
10842
|
+
},
|
|
10843
|
+
},
|
|
10844
|
+
/**/
|
|
10845
|
+
/**/
|
|
10846
|
+
{
|
|
10847
|
+
modelVariant: 'CHAT',
|
|
10848
|
+
modelTitle: 'gpt-3.5-turbo-0301',
|
|
10849
|
+
modelName: 'gpt-3.5-turbo-0301',
|
|
10850
|
+
modelDescription: 'March 2023 version of GPT-3.5 Turbo with 4K token context window. Legacy model maintained for backward compatibility with specific application behaviors. Features solid conversational abilities and basic instruction following. Knowledge cutoff from September 2021. Suitable for applications explicitly designed for this version.',
|
|
10851
|
+
pricing: {
|
|
10852
|
+
prompt: pricing(`$1.50 / 1M tokens`),
|
|
10853
|
+
output: pricing(`$2.00 / 1M tokens`),
|
|
10854
|
+
},
|
|
10855
|
+
},
|
|
10856
|
+
/**/
|
|
10857
|
+
/**/
|
|
10858
|
+
{
|
|
10859
|
+
modelVariant: 'COMPLETION',
|
|
10860
|
+
modelTitle: 'babbage-002',
|
|
10861
|
+
modelName: 'babbage-002',
|
|
10862
|
+
modelDescription: 'Efficient legacy completion model with 4K context window balancing performance and speed. Features moderate reasoning capabilities with focus on straightforward text generation tasks. Significantly more efficient than davinci models while maintaining adequate quality for many applications. Suitable for high-volume, cost-sensitive text generation needs.',
|
|
10863
|
+
pricing: {
|
|
10864
|
+
prompt: pricing(`$0.40 / 1M tokens`),
|
|
10865
|
+
output: pricing(`$0.40 / 1M tokens`),
|
|
10866
|
+
},
|
|
10867
|
+
},
|
|
10868
|
+
/**/
|
|
10869
|
+
/**/
|
|
10870
|
+
{
|
|
10871
|
+
modelVariant: 'CHAT',
|
|
10872
|
+
modelTitle: 'gpt-4-1106-preview',
|
|
10873
|
+
modelName: 'gpt-4-1106-preview',
|
|
10874
|
+
modelDescription: 'November 2023 preview version of GPT-4 Turbo with 128K token context window. Features improved instruction following, better function calling capabilities, and enhanced reasoning. Includes knowledge cutoff from April 2023. Suitable for complex applications requiring extensive document understanding and sophisticated interactions.',
|
|
10875
|
+
pricing: {
|
|
10876
|
+
prompt: pricing(`$10.00 / 1M tokens`),
|
|
10877
|
+
output: pricing(`$30.00 / 1M tokens`),
|
|
10878
|
+
},
|
|
10879
|
+
},
|
|
10880
|
+
/**/
|
|
10881
|
+
/**/
|
|
10882
|
+
{
|
|
10883
|
+
modelVariant: 'CHAT',
|
|
10884
|
+
modelTitle: 'gpt-4-0125-preview',
|
|
10885
|
+
modelName: 'gpt-4-0125-preview',
|
|
10886
|
+
modelDescription: 'January 2024 preview version of GPT-4 Turbo with 128K token context window. Features improved reasoning capabilities, enhanced tool use, and more reliable function calling. Includes knowledge cutoff from October 2023. Offers better performance on complex logical tasks and more consistent outputs than previous preview versions.',
|
|
10887
|
+
pricing: {
|
|
10888
|
+
prompt: pricing(`$10.00 / 1M tokens`),
|
|
10889
|
+
output: pricing(`$30.00 / 1M tokens`),
|
|
10890
|
+
},
|
|
10891
|
+
},
|
|
10892
|
+
/**/
|
|
10893
|
+
/*/
|
|
10894
|
+
{
|
|
10895
|
+
modelTitle: 'tts-1-1106',
|
|
10896
|
+
modelName: 'tts-1-1106',
|
|
10897
|
+
},
|
|
10898
|
+
/**/
|
|
10899
|
+
/**/
|
|
10900
|
+
{
|
|
10901
|
+
modelVariant: 'CHAT',
|
|
10902
|
+
modelTitle: 'gpt-3.5-turbo-0125',
|
|
10903
|
+
modelName: 'gpt-3.5-turbo-0125',
|
|
10904
|
+
modelDescription: 'January 2024 version of GPT-3.5 Turbo with 16K token context window. Features improved reasoning capabilities, better instruction adherence, and reduced hallucinations compared to previous versions. Includes knowledge cutoff from September 2021. Provides good performance for most general applications at reasonable cost.',
|
|
10905
|
+
pricing: {
|
|
10906
|
+
prompt: pricing(`$0.50 / 1M tokens`),
|
|
10907
|
+
output: pricing(`$1.50 / 1M tokens`),
|
|
10908
|
+
},
|
|
10909
|
+
},
|
|
10910
|
+
/**/
|
|
10911
|
+
/**/
|
|
10912
|
+
{
|
|
10913
|
+
modelVariant: 'CHAT',
|
|
10914
|
+
modelTitle: 'gpt-4-turbo-preview',
|
|
10915
|
+
modelName: 'gpt-4-turbo-preview',
|
|
10916
|
+
modelDescription: 'Preview version of GPT-4 Turbo with 128K token context window that points to the latest development model. Features cutting-edge improvements to instruction following, knowledge representation, and tool use capabilities. Provides access to newest features but may have occasional behavior changes. Best for non-critical applications wanting latest capabilities.',
|
|
10917
|
+
pricing: {
|
|
10918
|
+
prompt: pricing(`$10.00 / 1M tokens`),
|
|
10919
|
+
output: pricing(`$30.00 / 1M tokens`),
|
|
10920
|
+
},
|
|
10921
|
+
},
|
|
10922
|
+
/**/
|
|
10923
|
+
/**/
|
|
10924
|
+
{
|
|
10925
|
+
modelVariant: 'EMBEDDING',
|
|
10926
|
+
modelTitle: 'text-embedding-3-large',
|
|
10927
|
+
modelName: 'text-embedding-3-large',
|
|
10928
|
+
modelDescription: "OpenAI's most capable text embedding model generating 3072-dimensional vectors. Designed for high-quality embeddings for complex similarity tasks, clustering, and information retrieval. Features enhanced cross-lingual capabilities and significantly improved performance on retrieval and classification benchmarks. Ideal for sophisticated RAG systems and semantic search applications.",
|
|
10929
|
+
pricing: {
|
|
10930
|
+
prompt: pricing(`$0.13 / 1M tokens`),
|
|
10931
|
+
output: 0,
|
|
10932
|
+
},
|
|
10933
|
+
},
|
|
10934
|
+
/**/
|
|
10935
|
+
/**/
|
|
10936
|
+
{
|
|
10937
|
+
modelVariant: 'EMBEDDING',
|
|
10938
|
+
modelTitle: 'text-embedding-3-small',
|
|
10939
|
+
modelName: 'text-embedding-3-small',
|
|
10940
|
+
modelDescription: 'Cost-effective embedding model generating 1536-dimensional vectors. Balances quality and efficiency for simpler tasks while maintaining good performance on text similarity and retrieval applications. Offers 20% better quality than ada-002 at significantly lower cost. Ideal for production embedding applications with cost constraints.',
|
|
10941
|
+
pricing: {
|
|
10942
|
+
prompt: pricing(`$0.02 / 1M tokens`),
|
|
10943
|
+
output: 0,
|
|
10944
|
+
},
|
|
10945
|
+
},
|
|
10946
|
+
/**/
|
|
10947
|
+
/**/
|
|
10948
|
+
{
|
|
10949
|
+
modelVariant: 'CHAT',
|
|
10950
|
+
modelTitle: 'gpt-3.5-turbo-0613',
|
|
10951
|
+
modelName: 'gpt-3.5-turbo-0613',
|
|
10952
|
+
modelDescription: "June 2023 version of GPT-3.5 Turbo with 4K token context window. Features function calling capabilities for structured data extraction and API interaction. Includes knowledge cutoff from September 2021. Maintained for applications specifically designed for this version's behaviors and capabilities.",
|
|
10953
|
+
pricing: {
|
|
10954
|
+
prompt: pricing(`$1.50 / 1M tokens`),
|
|
10955
|
+
output: pricing(`$2.00 / 1M tokens`),
|
|
10956
|
+
},
|
|
10957
|
+
},
|
|
10958
|
+
/**/
|
|
10959
|
+
/**/
|
|
10960
|
+
{
|
|
10961
|
+
modelVariant: 'EMBEDDING',
|
|
10962
|
+
modelTitle: 'text-embedding-ada-002',
|
|
10963
|
+
modelName: 'text-embedding-ada-002',
|
|
10964
|
+
modelDescription: 'Legacy text embedding model generating 1536-dimensional vectors suitable for text similarity and retrieval applications. Processes up to 8K tokens per request with consistent embedding quality. While superseded by newer embedding-3 models, still maintains adequate performance for many semantic search and classification tasks.',
|
|
10965
|
+
pricing: {
|
|
10966
|
+
prompt: pricing(`$0.1 / 1M tokens`),
|
|
10967
|
+
output: 0,
|
|
10968
|
+
},
|
|
10969
|
+
},
|
|
10970
|
+
/**/
|
|
10971
|
+
/*/
|
|
10972
|
+
{
|
|
10973
|
+
modelVariant: 'CHAT',
|
|
10974
|
+
modelTitle: 'gpt-4-1106-vision-preview',
|
|
10975
|
+
modelName: 'gpt-4-1106-vision-preview',
|
|
10976
|
+
},
|
|
10977
|
+
/**/
|
|
10978
|
+
/*/
|
|
10979
|
+
{
|
|
10980
|
+
modelVariant: 'CHAT',
|
|
10981
|
+
modelTitle: 'gpt-4-vision-preview',
|
|
10982
|
+
modelName: 'gpt-4-vision-preview',
|
|
10983
|
+
pricing: {
|
|
10984
|
+
prompt: computeUsage(`$10.00 / 1M tokens`),
|
|
10985
|
+
output: computeUsage(`$30.00 / 1M tokens`),
|
|
10986
|
+
},
|
|
10987
|
+
},
|
|
10988
|
+
/**/
|
|
10989
|
+
/**/
|
|
10990
|
+
{
|
|
10991
|
+
modelVariant: 'CHAT',
|
|
10992
|
+
modelTitle: 'gpt-4o-2024-05-13',
|
|
10993
|
+
modelName: 'gpt-4o-2024-05-13',
|
|
10994
|
+
modelDescription: 'May 2024 version of GPT-4o with 128K context window. Features enhanced multimodal capabilities including superior image understanding (up to 20MP), audio processing, and improved reasoning. Optimized for 2x lower latency than GPT-4 Turbo while maintaining high performance. Includes knowledge up to October 2023. Ideal for production applications requiring reliable multimodal capabilities.',
|
|
10995
|
+
pricing: {
|
|
10996
|
+
prompt: pricing(`$5.00 / 1M tokens`),
|
|
10997
|
+
output: pricing(`$15.00 / 1M tokens`),
|
|
10998
|
+
},
|
|
10999
|
+
},
|
|
11000
|
+
/**/
|
|
11001
|
+
/**/
|
|
11002
|
+
{
|
|
11003
|
+
modelVariant: 'CHAT',
|
|
11004
|
+
modelTitle: 'gpt-4o',
|
|
11005
|
+
modelName: 'gpt-4o',
|
|
11006
|
+
modelDescription: "OpenAI's most advanced general-purpose multimodal model with 128K context window. Optimized for balanced performance, speed, and cost with 2x faster responses than GPT-4 Turbo. Features excellent vision processing, audio understanding, reasoning, and text generation quality. Represents optimal balance of capability and efficiency for most advanced applications.",
|
|
11007
|
+
pricing: {
|
|
11008
|
+
prompt: pricing(`$5.00 / 1M tokens`),
|
|
11009
|
+
output: pricing(`$15.00 / 1M tokens`),
|
|
11010
|
+
},
|
|
11011
|
+
},
|
|
11012
|
+
/**/
|
|
11013
|
+
/**/
|
|
11014
|
+
{
|
|
11015
|
+
modelVariant: 'CHAT',
|
|
11016
|
+
modelTitle: 'gpt-4o-mini',
|
|
11017
|
+
modelName: 'gpt-4o-mini',
|
|
11018
|
+
modelDescription: 'Smaller, more cost-effective version of GPT-4o with 128K context window. Maintains impressive capabilities across text, vision, and audio tasks while operating at significantly lower cost. Features 3x faster inference than GPT-4o with good performance on general tasks. Excellent for applications requiring good quality multimodal capabilities at scale.',
|
|
11019
|
+
pricing: {
|
|
11020
|
+
prompt: pricing(`$0.15 / 1M tokens`),
|
|
11021
|
+
output: pricing(`$0.60 / 1M tokens`),
|
|
11022
|
+
},
|
|
11023
|
+
},
|
|
11024
|
+
/**/
|
|
11025
|
+
/**/
|
|
11026
|
+
{
|
|
11027
|
+
modelVariant: 'CHAT',
|
|
11028
|
+
modelTitle: 'o1-preview',
|
|
11029
|
+
modelName: 'o1-preview',
|
|
11030
|
+
modelDescription: 'Advanced reasoning model with 128K context window specializing in complex logical, mathematical, and analytical tasks. Features exceptional step-by-step problem-solving capabilities, advanced mathematical and scientific reasoning, and superior performance on STEM-focused problems. Significantly outperforms GPT-4 on quantitative reasoning benchmarks. Ideal for professional and specialized applications.',
|
|
11031
|
+
pricing: {
|
|
11032
|
+
prompt: pricing(`$15.00 / 1M tokens`),
|
|
11033
|
+
output: pricing(`$60.00 / 1M tokens`),
|
|
11034
|
+
},
|
|
11035
|
+
},
|
|
11036
|
+
/**/
|
|
11037
|
+
/**/
|
|
11038
|
+
{
|
|
11039
|
+
modelVariant: 'CHAT',
|
|
11040
|
+
modelTitle: 'o1-preview-2024-09-12',
|
|
11041
|
+
modelName: 'o1-preview-2024-09-12',
|
|
11042
|
+
modelDescription: 'September 2024 version of O1 preview with 128K context window. Features specialized reasoning capabilities with 30% improvement on mathematical and scientific accuracy over previous versions. Includes enhanced support for formal logic, statistical analysis, and technical domains. Optimized for professional applications requiring precise analytical thinking and rigorous methodologies.',
|
|
11043
|
+
pricing: {
|
|
11044
|
+
prompt: pricing(`$15.00 / 1M tokens`),
|
|
11045
|
+
output: pricing(`$60.00 / 1M tokens`),
|
|
11046
|
+
},
|
|
11047
|
+
},
|
|
11048
|
+
/**/
|
|
11049
|
+
/**/
|
|
11050
|
+
{
|
|
11051
|
+
modelVariant: 'CHAT',
|
|
11052
|
+
modelTitle: 'o1-mini',
|
|
11053
|
+
modelName: 'o1-mini',
|
|
11054
|
+
modelDescription: 'Smaller, cost-effective version of the O1 model with 128K context window. Maintains strong analytical reasoning abilities while reducing computational requirements by 70%. Features good performance on mathematical, logical, and scientific tasks at significantly lower cost than full O1. Excellent for everyday analytical applications that benefit from reasoning focus.',
|
|
11055
|
+
pricing: {
|
|
11056
|
+
prompt: pricing(`$3.00 / 1M tokens`),
|
|
11057
|
+
output: pricing(`$12.00 / 1M tokens`),
|
|
11058
|
+
},
|
|
11059
|
+
},
|
|
11060
|
+
/**/
|
|
11061
|
+
/**/
|
|
11062
|
+
{
|
|
11063
|
+
modelVariant: 'CHAT',
|
|
11064
|
+
modelTitle: 'o1',
|
|
11065
|
+
modelName: 'o1',
|
|
11066
|
+
modelDescription: "OpenAI's advanced reasoning model with 128K context window focusing on logical problem-solving and analytical thinking. Features exceptional performance on quantitative tasks, step-by-step deduction, and complex technical problems. Maintains 95%+ of o1-preview capabilities with production-ready stability. Ideal for scientific computing, financial analysis, and professional applications.",
|
|
11067
|
+
pricing: {
|
|
11068
|
+
prompt: pricing(`$15.00 / 1M tokens`),
|
|
11069
|
+
output: pricing(`$60.00 / 1M tokens`),
|
|
11070
|
+
},
|
|
11071
|
+
},
|
|
11072
|
+
/**/
|
|
11073
|
+
/**/
|
|
11074
|
+
{
|
|
11075
|
+
modelVariant: 'CHAT',
|
|
11076
|
+
modelTitle: 'o3-mini',
|
|
11077
|
+
modelName: 'o3-mini',
|
|
11078
|
+
modelDescription: 'Cost-effective reasoning model with 128K context window optimized for academic and scientific problem-solving. Features efficient performance on STEM tasks with specialized capabilities in mathematics, physics, chemistry, and computer science. Offers 80% of O1 performance on technical domains at significantly lower cost. Ideal for educational applications and research support.',
|
|
11079
|
+
pricing: {
|
|
11080
|
+
prompt: pricing(`$3.00 / 1M tokens`),
|
|
11081
|
+
output: pricing(`$12.00 / 1M tokens`),
|
|
11082
|
+
},
|
|
11083
|
+
},
|
|
11084
|
+
/**/
|
|
11085
|
+
/**/
|
|
11086
|
+
{
|
|
11087
|
+
modelVariant: 'CHAT',
|
|
11088
|
+
modelTitle: 'o1-mini-2024-09-12',
|
|
11089
|
+
modelName: 'o1-mini-2024-09-12',
|
|
11090
|
+
modelDescription: "September 2024 version of O1-mini with 128K context window featuring balanced reasoning capabilities and cost-efficiency. Includes 25% improvement in mathematical accuracy and enhanced performance on coding tasks compared to previous versions. Maintains efficient resource utilization while delivering improved results for analytical applications that don't require the full O1 model.",
|
|
11091
|
+
pricing: {
|
|
11092
|
+
prompt: pricing(`$3.00 / 1M tokens`),
|
|
11093
|
+
output: pricing(`$12.00 / 1M tokens`),
|
|
11094
|
+
},
|
|
11095
|
+
},
|
|
11096
|
+
/**/
|
|
11097
|
+
/**/
|
|
11098
|
+
{
|
|
11099
|
+
modelVariant: 'CHAT',
|
|
11100
|
+
modelTitle: 'gpt-3.5-turbo-16k-0613',
|
|
11101
|
+
modelName: 'gpt-3.5-turbo-16k-0613',
|
|
11102
|
+
modelDescription: "June 2023 version of GPT-3.5 Turbo with extended 16K token context window. Features good handling of longer conversations and documents with improved memory management across extended contexts. Includes knowledge cutoff from September 2021. Maintained for applications specifically designed for this version's behaviors and capabilities.",
|
|
11103
|
+
pricing: {
|
|
11104
|
+
prompt: pricing(`$3.00 / 1M tokens`),
|
|
11105
|
+
output: pricing(`$4.00 / 1M tokens`),
|
|
11106
|
+
},
|
|
11107
|
+
},
|
|
11108
|
+
/**/
|
|
11109
|
+
// <- [🕕]
|
|
11110
|
+
],
|
|
11111
|
+
});
|
|
11112
|
+
/**
|
|
11113
|
+
* Note: [🤖] Add models of new variant
|
|
11114
|
+
* TODO: [🧠] Some mechanism to propagate unsureness
|
|
11115
|
+
* TODO: [🎰] Some mechanism to auto-update available models
|
|
11116
|
+
* TODO: [🎰][👮♀️] Make this list dynamic - dynamically can be listed modelNames but not modelVariant, legacy status, context length and pricing
|
|
11117
|
+
* TODO: [🧠][👮♀️] Put here more info like description, isVision, trainingDateCutoff, languages, strengths ( Top-level performance, intelligence, fluency, and understanding), contextWindow,...
|
|
11118
|
+
* @see https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4
|
|
11119
|
+
* @see https://openai.com/api/pricing/
|
|
11120
|
+
* @see /other/playground/playground.ts
|
|
11121
|
+
* TODO: [🍓][💩] Make better
|
|
11122
|
+
* TODO: Change model titles to human eg: "gpt-4-turbo-2024-04-09" -> "GPT-4 Turbo (2024-04-09)"
|
|
11123
|
+
* TODO: [🚸] Not all models are compatible with JSON mode, add this information here and use it
|
|
11124
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
11125
|
+
*/
|
|
11126
|
+
|
|
11127
|
+
/**
|
|
11128
|
+
* Computes the usage of the OpenAI API based on the response from OpenAI
|
|
11129
|
+
*
|
|
11130
|
+
* @param promptContent The content of the prompt
|
|
11131
|
+
* @param resultContent The content of the result (for embedding prompts or failed prompts pass empty string)
|
|
11132
|
+
* @param rawResponse The raw response from OpenAI API
|
|
11133
|
+
* @throws {PipelineExecutionError} If the usage is not defined in the response from OpenAI
|
|
11134
|
+
* @private internal utility of `OpenAiExecutionTools`
|
|
11135
|
+
*/
|
|
11136
|
+
function computeOpenAiUsage(promptContent, // <- Note: Intentionally using [] to access type properties to bring jsdoc from Prompt/PromptResult to consumer
|
|
11137
|
+
resultContent, rawResponse) {
|
|
11138
|
+
var _a, _b;
|
|
11139
|
+
if (rawResponse.usage === undefined) {
|
|
11140
|
+
throw new PipelineExecutionError('The usage is not defined in the response from OpenAI');
|
|
11141
|
+
}
|
|
11142
|
+
if (((_a = rawResponse.usage) === null || _a === void 0 ? void 0 : _a.prompt_tokens) === undefined) {
|
|
11143
|
+
throw new PipelineExecutionError('In OpenAI response `usage.prompt_tokens` not defined');
|
|
11144
|
+
}
|
|
11145
|
+
const inputTokens = rawResponse.usage.prompt_tokens;
|
|
11146
|
+
const outputTokens = ((_b = rawResponse.usage) === null || _b === void 0 ? void 0 : _b.completion_tokens) || 0;
|
|
11147
|
+
let isUncertain = false;
|
|
11148
|
+
let modelInfo = OPENAI_MODELS.find((model) => model.modelName === rawResponse.model);
|
|
11149
|
+
if (modelInfo === undefined) {
|
|
11150
|
+
// Note: Model is not in the list of known models, fallback to the family of the models and mark price as uncertain
|
|
11151
|
+
modelInfo = OPENAI_MODELS.find((model) => (rawResponse.model || SALT_NONCE).startsWith(model.modelName));
|
|
11152
|
+
if (modelInfo !== undefined) {
|
|
11153
|
+
isUncertain = true;
|
|
11154
|
+
}
|
|
11155
|
+
}
|
|
11156
|
+
let price;
|
|
11157
|
+
if (modelInfo === undefined || modelInfo.pricing === undefined) {
|
|
11158
|
+
price = uncertainNumber();
|
|
11159
|
+
}
|
|
11160
|
+
else {
|
|
11161
|
+
price = uncertainNumber(inputTokens * modelInfo.pricing.prompt + outputTokens * modelInfo.pricing.output, isUncertain);
|
|
11162
|
+
}
|
|
11163
|
+
return {
|
|
11164
|
+
price,
|
|
11165
|
+
input: {
|
|
11166
|
+
tokensCount: uncertainNumber(rawResponse.usage.prompt_tokens),
|
|
11167
|
+
...computeUsageCounts(promptContent),
|
|
11168
|
+
},
|
|
11169
|
+
output: {
|
|
11170
|
+
tokensCount: uncertainNumber(outputTokens),
|
|
11171
|
+
...computeUsageCounts(resultContent),
|
|
11172
|
+
},
|
|
11173
|
+
};
|
|
11174
|
+
}
|
|
11175
|
+
/**
|
|
11176
|
+
* TODO: [🤝] DRY Maybe some common abstraction between `computeOpenAiUsage` and `computeAnthropicClaudeUsage`
|
|
11177
|
+
*/
|
|
11178
|
+
|
|
11179
|
+
/**
|
|
11180
|
+
* Parses an OpenAI error message to identify which parameter is unsupported
|
|
11181
|
+
*
|
|
11182
|
+
* @param errorMessage The error message from OpenAI API
|
|
11183
|
+
* @returns The parameter name that is unsupported, or null if not an unsupported parameter error
|
|
11184
|
+
* @private utility of LLM Tools
|
|
11185
|
+
*/
|
|
11186
|
+
function parseUnsupportedParameterError(errorMessage) {
|
|
11187
|
+
// Pattern to match "Unsupported value: 'parameter' does not support ..."
|
|
11188
|
+
const unsupportedValueMatch = errorMessage.match(/Unsupported value:\s*'([^']+)'\s*does not support/i);
|
|
11189
|
+
if (unsupportedValueMatch === null || unsupportedValueMatch === void 0 ? void 0 : unsupportedValueMatch[1]) {
|
|
11190
|
+
return unsupportedValueMatch[1];
|
|
11191
|
+
}
|
|
11192
|
+
// Pattern to match "'parameter' of type ... is not supported with this model"
|
|
11193
|
+
const parameterTypeMatch = errorMessage.match(/'([^']+)'\s*of type.*is not supported with this model/i);
|
|
11194
|
+
if (parameterTypeMatch === null || parameterTypeMatch === void 0 ? void 0 : parameterTypeMatch[1]) {
|
|
11195
|
+
return parameterTypeMatch[1];
|
|
11196
|
+
}
|
|
11197
|
+
return null;
|
|
11198
|
+
}
|
|
11199
|
+
/**
|
|
11200
|
+
* Creates a copy of model requirements with the specified parameter removed
|
|
11201
|
+
*
|
|
11202
|
+
* @param modelRequirements Original model requirements
|
|
11203
|
+
* @param unsupportedParameter The parameter to remove
|
|
11204
|
+
* @returns New model requirements without the unsupported parameter
|
|
11205
|
+
* @private utility of LLM Tools
|
|
11206
|
+
*/
|
|
11207
|
+
function removeUnsupportedModelRequirement(modelRequirements, unsupportedParameter) {
|
|
11208
|
+
const newRequirements = { ...modelRequirements };
|
|
11209
|
+
// Map of parameter names that might appear in error messages to ModelRequirements properties
|
|
11210
|
+
const parameterMap = {
|
|
11211
|
+
temperature: 'temperature',
|
|
11212
|
+
max_tokens: 'maxTokens',
|
|
11213
|
+
maxTokens: 'maxTokens',
|
|
11214
|
+
seed: 'seed',
|
|
11215
|
+
};
|
|
11216
|
+
const propertyToRemove = parameterMap[unsupportedParameter];
|
|
11217
|
+
if (propertyToRemove && propertyToRemove in newRequirements) {
|
|
11218
|
+
delete newRequirements[propertyToRemove];
|
|
11219
|
+
}
|
|
11220
|
+
return newRequirements;
|
|
11221
|
+
}
|
|
11222
|
+
/**
|
|
11223
|
+
* Checks if an error is an "Unsupported value" error from OpenAI
|
|
11224
|
+
* @param error The error to check
|
|
11225
|
+
* @returns true if this is an unsupported parameter error
|
|
11226
|
+
* @private utility of LLM Tools
|
|
11227
|
+
*/
|
|
11228
|
+
function isUnsupportedParameterError(error) {
|
|
11229
|
+
const errorMessage = error.message.toLowerCase();
|
|
11230
|
+
return (errorMessage.includes('unsupported value:') ||
|
|
11231
|
+
errorMessage.includes('is not supported with this model') ||
|
|
11232
|
+
errorMessage.includes('does not support'));
|
|
11233
|
+
}
|
|
11234
|
+
|
|
11235
|
+
/**
|
|
11236
|
+
* Execution Tools for calling OpenAI API or other OpenAI compatible provider
|
|
11237
|
+
*
|
|
11238
|
+
* @public exported from `@promptbook/openai`
|
|
11239
|
+
*/
|
|
11240
|
+
class OpenAiCompatibleExecutionTools {
|
|
11241
|
+
// Removed retriedUnsupportedParameters and attemptHistory instance fields
|
|
11242
|
+
/**
|
|
11243
|
+
* Creates OpenAI compatible Execution Tools.
|
|
11244
|
+
*
|
|
11245
|
+
* @param options which are relevant are directly passed to the OpenAI compatible client
|
|
11246
|
+
*/
|
|
11247
|
+
constructor(options) {
|
|
11248
|
+
this.options = options;
|
|
11249
|
+
/**
|
|
11250
|
+
* OpenAI API client.
|
|
11251
|
+
*/
|
|
11252
|
+
this.client = null;
|
|
11253
|
+
// TODO: Allow configuring rate limits via options
|
|
11254
|
+
this.limiter = new Bottleneck({
|
|
11255
|
+
minTime: 60000 / (this.options.maxRequestsPerMinute || DEFAULT_MAX_REQUESTS_PER_MINUTE),
|
|
11256
|
+
});
|
|
11257
|
+
}
|
|
11258
|
+
async getClient() {
|
|
11259
|
+
if (this.client === null) {
|
|
11260
|
+
// Note: Passing only OpenAI relevant options to OpenAI constructor
|
|
11261
|
+
const openAiOptions = { ...this.options };
|
|
11262
|
+
delete openAiOptions.isVerbose;
|
|
11263
|
+
delete openAiOptions.userId;
|
|
11264
|
+
// Enhanced configuration for better ECONNRESET handling
|
|
11265
|
+
const enhancedOptions = {
|
|
11266
|
+
...openAiOptions,
|
|
11267
|
+
timeout: API_REQUEST_TIMEOUT,
|
|
11268
|
+
maxRetries: CONNECTION_RETRIES_LIMIT,
|
|
11269
|
+
defaultHeaders: {
|
|
11270
|
+
Connection: 'keep-alive',
|
|
11271
|
+
'Keep-Alive': 'timeout=30, max=100',
|
|
11272
|
+
...openAiOptions.defaultHeaders,
|
|
11273
|
+
},
|
|
11274
|
+
};
|
|
11275
|
+
this.client = new OpenAI(enhancedOptions);
|
|
11276
|
+
}
|
|
11277
|
+
return this.client;
|
|
11278
|
+
}
|
|
11279
|
+
/**
|
|
11280
|
+
* Check the `options` passed to `constructor`
|
|
11281
|
+
*/
|
|
11282
|
+
async checkConfiguration() {
|
|
11283
|
+
await this.getClient();
|
|
11284
|
+
// TODO: [🎍] Do here a real check that API is online, working and API key is correct
|
|
11285
|
+
}
|
|
11286
|
+
/**
|
|
11287
|
+
* List all available OpenAI compatible models that can be used
|
|
11288
|
+
*/
|
|
11289
|
+
async listModels() {
|
|
11290
|
+
const client = await this.getClient();
|
|
11291
|
+
const rawModelsList = await client.models.list();
|
|
11292
|
+
const availableModels = rawModelsList.data
|
|
11293
|
+
.sort((a, b) => (a.created > b.created ? 1 : -1))
|
|
11294
|
+
.map((modelFromApi) => {
|
|
11295
|
+
const modelFromList = this.HARDCODED_MODELS.find(({ modelName }) => modelName === modelFromApi.id ||
|
|
11296
|
+
modelName.startsWith(modelFromApi.id) ||
|
|
11297
|
+
modelFromApi.id.startsWith(modelName));
|
|
11298
|
+
if (modelFromList !== undefined) {
|
|
11299
|
+
return modelFromList;
|
|
11300
|
+
}
|
|
11301
|
+
return {
|
|
11302
|
+
modelVariant: 'CHAT',
|
|
11303
|
+
modelTitle: modelFromApi.id,
|
|
11304
|
+
modelName: modelFromApi.id,
|
|
11305
|
+
modelDescription: '',
|
|
11306
|
+
};
|
|
11307
|
+
});
|
|
11308
|
+
return availableModels;
|
|
11309
|
+
}
|
|
11310
|
+
/**
|
|
11311
|
+
* Calls OpenAI compatible API to use a chat model.
|
|
11312
|
+
*/
|
|
11313
|
+
async callChatModel(prompt) {
|
|
11314
|
+
// Deep clone prompt and modelRequirements to avoid mutation across calls
|
|
11315
|
+
const clonedPrompt = JSON.parse(JSON.stringify(prompt));
|
|
11316
|
+
// Use local Set for retried parameters to ensure independence and thread safety
|
|
11317
|
+
const retriedUnsupportedParameters = new Set();
|
|
11318
|
+
return this.callChatModelWithRetry(clonedPrompt, clonedPrompt.modelRequirements, [], retriedUnsupportedParameters);
|
|
11319
|
+
}
|
|
11320
|
+
/**
|
|
11321
|
+
* Internal method that handles parameter retry for chat model calls
|
|
11322
|
+
*/
|
|
11323
|
+
async callChatModelWithRetry(prompt, currentModelRequirements, attemptStack = [], retriedUnsupportedParameters = new Set()) {
|
|
11324
|
+
var _a;
|
|
11325
|
+
if (this.options.isVerbose) {
|
|
11326
|
+
console.info(`💬 ${this.title} callChatModel call`, { prompt, currentModelRequirements });
|
|
11327
|
+
}
|
|
11328
|
+
const { content, parameters, format } = prompt;
|
|
11329
|
+
const client = await this.getClient();
|
|
11330
|
+
// TODO: [☂] Use here more modelRequirements
|
|
11331
|
+
if (currentModelRequirements.modelVariant !== 'CHAT') {
|
|
11332
|
+
throw new PipelineExecutionError('Use callChatModel only for CHAT variant');
|
|
11333
|
+
}
|
|
11334
|
+
const modelName = currentModelRequirements.modelName || this.getDefaultChatModel().modelName;
|
|
11335
|
+
const modelSettings = {
|
|
11336
|
+
model: modelName,
|
|
11337
|
+
max_tokens: currentModelRequirements.maxTokens,
|
|
11338
|
+
temperature: currentModelRequirements.temperature,
|
|
11339
|
+
// <- TODO: [🈁] Use `seed` here AND/OR use is `isDeterministic` for entire execution tools
|
|
11340
|
+
// <- Note: [🧆]
|
|
11341
|
+
}; // <- TODO: [💩] Guard here types better
|
|
11342
|
+
if (format === 'JSON') {
|
|
11343
|
+
modelSettings.response_format = {
|
|
11344
|
+
type: 'json_object',
|
|
11345
|
+
};
|
|
11346
|
+
}
|
|
11347
|
+
// <- TODO: [🚸] Not all models are compatible with JSON mode
|
|
11348
|
+
// > 'response_format' of type 'json_object' is not supported with this model.
|
|
11349
|
+
const rawPromptContent = templateParameters(content, { ...parameters, modelName });
|
|
11350
|
+
// Convert thread to OpenAI format if present
|
|
11351
|
+
let threadMessages = [];
|
|
11352
|
+
if ('thread' in prompt && Array.isArray(prompt.thread)) {
|
|
11353
|
+
threadMessages = prompt.thread.map((msg) => ({
|
|
11354
|
+
role: msg.role === 'assistant' ? 'assistant' : 'user',
|
|
11355
|
+
content: msg.content,
|
|
11356
|
+
}));
|
|
11357
|
+
}
|
|
11358
|
+
const rawRequest = {
|
|
11359
|
+
...modelSettings,
|
|
11360
|
+
messages: [
|
|
11361
|
+
...(currentModelRequirements.systemMessage === undefined
|
|
11362
|
+
? []
|
|
11363
|
+
: [
|
|
11364
|
+
{
|
|
11365
|
+
role: 'system',
|
|
11366
|
+
content: currentModelRequirements.systemMessage,
|
|
11367
|
+
},
|
|
11368
|
+
]),
|
|
11369
|
+
...threadMessages,
|
|
11370
|
+
{
|
|
11371
|
+
role: 'user',
|
|
11372
|
+
content: rawPromptContent,
|
|
11373
|
+
},
|
|
11374
|
+
],
|
|
11375
|
+
user: (_a = this.options.userId) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
11376
|
+
};
|
|
11377
|
+
const start = $getCurrentDate();
|
|
11378
|
+
if (this.options.isVerbose) {
|
|
11379
|
+
console.info(colors.bgWhite('rawRequest'), JSON.stringify(rawRequest, null, 4));
|
|
11380
|
+
}
|
|
11381
|
+
try {
|
|
11382
|
+
const rawResponse = await this.limiter
|
|
11383
|
+
.schedule(() => this.makeRequestWithNetworkRetry(() => client.chat.completions.create(rawRequest)))
|
|
11384
|
+
.catch((error) => {
|
|
11385
|
+
assertsError(error);
|
|
11386
|
+
if (this.options.isVerbose) {
|
|
11387
|
+
console.info(colors.bgRed('error'), error);
|
|
11388
|
+
}
|
|
11389
|
+
throw error;
|
|
11390
|
+
});
|
|
11391
|
+
if (this.options.isVerbose) {
|
|
11392
|
+
console.info(colors.bgWhite('rawResponse'), JSON.stringify(rawResponse, null, 4));
|
|
11393
|
+
}
|
|
11394
|
+
const complete = $getCurrentDate();
|
|
11395
|
+
if (!rawResponse.choices[0]) {
|
|
11396
|
+
throw new PipelineExecutionError(`No choises from ${this.title}`);
|
|
11397
|
+
}
|
|
11398
|
+
if (rawResponse.choices.length > 1) {
|
|
11399
|
+
// TODO: This should be maybe only warning
|
|
11400
|
+
throw new PipelineExecutionError(`More than one choise from ${this.title}`);
|
|
11401
|
+
}
|
|
11402
|
+
const resultContent = rawResponse.choices[0].message.content;
|
|
11403
|
+
const usage = this.computeUsage(content || '', resultContent || '', rawResponse);
|
|
11404
|
+
if (resultContent === null) {
|
|
11405
|
+
throw new PipelineExecutionError(`No response message from ${this.title}`);
|
|
11406
|
+
}
|
|
11407
|
+
return exportJson({
|
|
11408
|
+
name: 'promptResult',
|
|
11409
|
+
message: `Result of \`OpenAiCompatibleExecutionTools.callChatModel\``,
|
|
11410
|
+
order: [],
|
|
11411
|
+
value: {
|
|
11412
|
+
content: resultContent,
|
|
11413
|
+
modelName: rawResponse.model || modelName,
|
|
11414
|
+
timing: {
|
|
11415
|
+
start,
|
|
11416
|
+
complete,
|
|
11417
|
+
},
|
|
11418
|
+
usage,
|
|
11419
|
+
rawPromptContent,
|
|
11420
|
+
rawRequest,
|
|
11421
|
+
rawResponse,
|
|
11422
|
+
// <- [🗯]
|
|
11423
|
+
},
|
|
11424
|
+
});
|
|
11425
|
+
}
|
|
11426
|
+
catch (error) {
|
|
11427
|
+
assertsError(error);
|
|
11428
|
+
// Check if this is an unsupported parameter error
|
|
11429
|
+
if (!isUnsupportedParameterError(error)) {
|
|
11430
|
+
// If we have attemptStack, include it in the error message
|
|
11431
|
+
if (attemptStack.length > 0) {
|
|
11432
|
+
throw new PipelineExecutionError(`All attempts failed. Attempt history:\n` +
|
|
11433
|
+
attemptStack
|
|
11434
|
+
.map((a, i) => ` ${i + 1}. Model: ${a.modelName}` +
|
|
11435
|
+
(a.unsupportedParameter ? `, Stripped: ${a.unsupportedParameter}` : '') +
|
|
11436
|
+
`, Error: ${a.errorMessage}` +
|
|
11437
|
+
(a.stripped ? ' (stripped and retried)' : ''))
|
|
11438
|
+
.join('\n') +
|
|
11439
|
+
`\nFinal error: ${error.message}`);
|
|
11440
|
+
}
|
|
11441
|
+
throw error;
|
|
11442
|
+
}
|
|
11443
|
+
// Parse which parameter is unsupported
|
|
11444
|
+
const unsupportedParameter = parseUnsupportedParameterError(error.message);
|
|
11445
|
+
if (!unsupportedParameter) {
|
|
11446
|
+
if (this.options.isVerbose) {
|
|
11447
|
+
console.warn(colors.bgYellow('Warning'), 'Could not parse unsupported parameter from error:', error.message);
|
|
11448
|
+
}
|
|
11449
|
+
throw error;
|
|
11450
|
+
}
|
|
11451
|
+
// Create a unique key for this model + parameter combination to prevent infinite loops
|
|
11452
|
+
const retryKey = `${modelName}-${unsupportedParameter}`;
|
|
11453
|
+
if (retriedUnsupportedParameters.has(retryKey)) {
|
|
11454
|
+
// Already retried this parameter, throw the error with attemptStack
|
|
11455
|
+
attemptStack.push({
|
|
11456
|
+
modelName,
|
|
11457
|
+
unsupportedParameter,
|
|
11458
|
+
errorMessage: error.message,
|
|
11459
|
+
stripped: true,
|
|
11460
|
+
});
|
|
11461
|
+
throw new PipelineExecutionError(`All attempts failed. Attempt history:\n` +
|
|
11462
|
+
attemptStack
|
|
11463
|
+
.map((a, i) => ` ${i + 1}. Model: ${a.modelName}` +
|
|
11464
|
+
(a.unsupportedParameter ? `, Stripped: ${a.unsupportedParameter}` : '') +
|
|
11465
|
+
`, Error: ${a.errorMessage}` +
|
|
11466
|
+
(a.stripped ? ' (stripped and retried)' : ''))
|
|
11467
|
+
.join('\n') +
|
|
11468
|
+
`\nFinal error: ${error.message}`);
|
|
11469
|
+
}
|
|
11470
|
+
// Mark this parameter as retried
|
|
11471
|
+
retriedUnsupportedParameters.add(retryKey);
|
|
11472
|
+
// Log warning in verbose mode
|
|
11473
|
+
if (this.options.isVerbose) {
|
|
11474
|
+
console.warn(colors.bgYellow('Warning'), `Removing unsupported parameter '${unsupportedParameter}' for model '${modelName}' and retrying request`);
|
|
11475
|
+
}
|
|
11476
|
+
// Add to attemptStack
|
|
11477
|
+
attemptStack.push({
|
|
11478
|
+
modelName,
|
|
11479
|
+
unsupportedParameter,
|
|
11480
|
+
errorMessage: error.message,
|
|
11481
|
+
stripped: true,
|
|
11482
|
+
});
|
|
11483
|
+
// Remove the unsupported parameter and retry
|
|
11484
|
+
const modifiedModelRequirements = removeUnsupportedModelRequirement(currentModelRequirements, unsupportedParameter);
|
|
11485
|
+
return this.callChatModelWithRetry(prompt, modifiedModelRequirements, attemptStack, retriedUnsupportedParameters);
|
|
11486
|
+
}
|
|
11487
|
+
}
|
|
11488
|
+
/**
|
|
11489
|
+
* Calls OpenAI API to use a complete model.
|
|
11490
|
+
*/
|
|
11491
|
+
async callCompletionModel(prompt) {
|
|
11492
|
+
// Deep clone prompt and modelRequirements to avoid mutation across calls
|
|
11493
|
+
const clonedPrompt = JSON.parse(JSON.stringify(prompt));
|
|
11494
|
+
const retriedUnsupportedParameters = new Set();
|
|
11495
|
+
return this.callCompletionModelWithRetry(clonedPrompt, clonedPrompt.modelRequirements, [], retriedUnsupportedParameters);
|
|
11496
|
+
}
|
|
11497
|
+
/**
|
|
11498
|
+
* Internal method that handles parameter retry for completion model calls
|
|
11499
|
+
*/
|
|
11500
|
+
async callCompletionModelWithRetry(prompt, currentModelRequirements, attemptStack = [], retriedUnsupportedParameters = new Set()) {
|
|
11501
|
+
var _a;
|
|
11502
|
+
if (this.options.isVerbose) {
|
|
11503
|
+
console.info(`🖋 ${this.title} callCompletionModel call`, { prompt, currentModelRequirements });
|
|
11504
|
+
}
|
|
11505
|
+
const { content, parameters } = prompt;
|
|
11506
|
+
const client = await this.getClient();
|
|
11507
|
+
// TODO: [☂] Use here more modelRequirements
|
|
11508
|
+
if (currentModelRequirements.modelVariant !== 'COMPLETION') {
|
|
11509
|
+
throw new PipelineExecutionError('Use callCompletionModel only for COMPLETION variant');
|
|
11510
|
+
}
|
|
11511
|
+
const modelName = currentModelRequirements.modelName || this.getDefaultCompletionModel().modelName;
|
|
11512
|
+
const modelSettings = {
|
|
11513
|
+
model: modelName,
|
|
11514
|
+
max_tokens: currentModelRequirements.maxTokens,
|
|
11515
|
+
temperature: currentModelRequirements.temperature,
|
|
11516
|
+
};
|
|
11517
|
+
const rawPromptContent = templateParameters(content, { ...parameters, modelName });
|
|
11518
|
+
const rawRequest = {
|
|
11519
|
+
...modelSettings,
|
|
11520
|
+
prompt: rawPromptContent,
|
|
11521
|
+
user: (_a = this.options.userId) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
11522
|
+
};
|
|
11523
|
+
const start = $getCurrentDate();
|
|
11524
|
+
if (this.options.isVerbose) {
|
|
11525
|
+
console.info(colors.bgWhite('rawRequest'), JSON.stringify(rawRequest, null, 4));
|
|
11526
|
+
}
|
|
11527
|
+
try {
|
|
11528
|
+
const rawResponse = await this.limiter
|
|
11529
|
+
.schedule(() => this.makeRequestWithNetworkRetry(() => client.completions.create(rawRequest)))
|
|
11530
|
+
.catch((error) => {
|
|
11531
|
+
assertsError(error);
|
|
11532
|
+
if (this.options.isVerbose) {
|
|
11533
|
+
console.info(colors.bgRed('error'), error);
|
|
11534
|
+
}
|
|
11535
|
+
throw error;
|
|
11536
|
+
});
|
|
11537
|
+
if (this.options.isVerbose) {
|
|
11538
|
+
console.info(colors.bgWhite('rawResponse'), JSON.stringify(rawResponse, null, 4));
|
|
11539
|
+
}
|
|
11540
|
+
const complete = $getCurrentDate();
|
|
11541
|
+
if (!rawResponse.choices[0]) {
|
|
11542
|
+
throw new PipelineExecutionError(`No choises from ${this.title}`);
|
|
11543
|
+
}
|
|
11544
|
+
if (rawResponse.choices.length > 1) {
|
|
11545
|
+
throw new PipelineExecutionError(`More than one choise from ${this.title}`);
|
|
11546
|
+
}
|
|
11547
|
+
const resultContent = rawResponse.choices[0].text;
|
|
11548
|
+
const usage = this.computeUsage(content || '', resultContent || '', rawResponse);
|
|
11549
|
+
return exportJson({
|
|
11550
|
+
name: 'promptResult',
|
|
11551
|
+
message: `Result of \`OpenAiCompatibleExecutionTools.callCompletionModel\``,
|
|
11552
|
+
order: [],
|
|
11553
|
+
value: {
|
|
11554
|
+
content: resultContent,
|
|
11555
|
+
modelName: rawResponse.model || modelName,
|
|
11556
|
+
timing: {
|
|
11557
|
+
start,
|
|
11558
|
+
complete,
|
|
11559
|
+
},
|
|
11560
|
+
usage,
|
|
11561
|
+
rawPromptContent,
|
|
11562
|
+
rawRequest,
|
|
11563
|
+
rawResponse,
|
|
11564
|
+
},
|
|
11565
|
+
});
|
|
11566
|
+
}
|
|
11567
|
+
catch (error) {
|
|
11568
|
+
assertsError(error);
|
|
11569
|
+
if (!isUnsupportedParameterError(error)) {
|
|
11570
|
+
if (attemptStack.length > 0) {
|
|
11571
|
+
throw new PipelineExecutionError(`All attempts failed. Attempt history:\n` +
|
|
11572
|
+
attemptStack
|
|
11573
|
+
.map((a, i) => ` ${i + 1}. Model: ${a.modelName}` +
|
|
11574
|
+
(a.unsupportedParameter ? `, Stripped: ${a.unsupportedParameter}` : '') +
|
|
11575
|
+
`, Error: ${a.errorMessage}` +
|
|
11576
|
+
(a.stripped ? ' (stripped and retried)' : ''))
|
|
11577
|
+
.join('\n') +
|
|
11578
|
+
`\nFinal error: ${error.message}`);
|
|
11579
|
+
}
|
|
11580
|
+
throw error;
|
|
11581
|
+
}
|
|
11582
|
+
const unsupportedParameter = parseUnsupportedParameterError(error.message);
|
|
11583
|
+
if (!unsupportedParameter) {
|
|
11584
|
+
if (this.options.isVerbose) {
|
|
11585
|
+
console.warn(colors.bgYellow('Warning'), 'Could not parse unsupported parameter from error:', error.message);
|
|
11586
|
+
}
|
|
11587
|
+
throw error;
|
|
11588
|
+
}
|
|
11589
|
+
const retryKey = `${modelName}-${unsupportedParameter}`;
|
|
11590
|
+
if (retriedUnsupportedParameters.has(retryKey)) {
|
|
11591
|
+
attemptStack.push({
|
|
11592
|
+
modelName,
|
|
11593
|
+
unsupportedParameter,
|
|
11594
|
+
errorMessage: error.message,
|
|
11595
|
+
stripped: true,
|
|
11596
|
+
});
|
|
11597
|
+
throw new PipelineExecutionError(`All attempts failed. Attempt history:\n` +
|
|
11598
|
+
attemptStack
|
|
11599
|
+
.map((a, i) => ` ${i + 1}. Model: ${a.modelName}` +
|
|
11600
|
+
(a.unsupportedParameter ? `, Stripped: ${a.unsupportedParameter}` : '') +
|
|
11601
|
+
`, Error: ${a.errorMessage}` +
|
|
11602
|
+
(a.stripped ? ' (stripped and retried)' : ''))
|
|
11603
|
+
.join('\n') +
|
|
11604
|
+
`\nFinal error: ${error.message}`);
|
|
11605
|
+
}
|
|
11606
|
+
retriedUnsupportedParameters.add(retryKey);
|
|
11607
|
+
if (this.options.isVerbose) {
|
|
11608
|
+
console.warn(colors.bgYellow('Warning'), `Removing unsupported parameter '${unsupportedParameter}' for model '${modelName}' and retrying request`);
|
|
11609
|
+
}
|
|
11610
|
+
attemptStack.push({
|
|
11611
|
+
modelName,
|
|
11612
|
+
unsupportedParameter,
|
|
11613
|
+
errorMessage: error.message,
|
|
11614
|
+
stripped: true,
|
|
11615
|
+
});
|
|
11616
|
+
const modifiedModelRequirements = removeUnsupportedModelRequirement(currentModelRequirements, unsupportedParameter);
|
|
11617
|
+
return this.callCompletionModelWithRetry(prompt, modifiedModelRequirements, attemptStack, retriedUnsupportedParameters);
|
|
11618
|
+
}
|
|
11619
|
+
}
|
|
11620
|
+
/**
|
|
11621
|
+
* Calls OpenAI compatible API to use a embedding model
|
|
11622
|
+
*/
|
|
11623
|
+
async callEmbeddingModel(prompt) {
|
|
11624
|
+
// Deep clone prompt and modelRequirements to avoid mutation across calls
|
|
11625
|
+
const clonedPrompt = JSON.parse(JSON.stringify(prompt));
|
|
11626
|
+
const retriedUnsupportedParameters = new Set();
|
|
11627
|
+
return this.callEmbeddingModelWithRetry(clonedPrompt, clonedPrompt.modelRequirements, [], retriedUnsupportedParameters);
|
|
11628
|
+
}
|
|
11629
|
+
/**
|
|
11630
|
+
* Internal method that handles parameter retry for embedding model calls
|
|
11631
|
+
*/
|
|
11632
|
+
async callEmbeddingModelWithRetry(prompt, currentModelRequirements, attemptStack = [], retriedUnsupportedParameters = new Set()) {
|
|
11633
|
+
if (this.options.isVerbose) {
|
|
11634
|
+
console.info(`🖋 ${this.title} embedding call`, { prompt, currentModelRequirements });
|
|
11635
|
+
}
|
|
11636
|
+
const { content, parameters } = prompt;
|
|
11637
|
+
const client = await this.getClient();
|
|
11638
|
+
if (currentModelRequirements.modelVariant !== 'EMBEDDING') {
|
|
11639
|
+
throw new PipelineExecutionError('Use embed only for EMBEDDING variant');
|
|
11640
|
+
}
|
|
11641
|
+
const modelName = currentModelRequirements.modelName || this.getDefaultEmbeddingModel().modelName;
|
|
11642
|
+
const rawPromptContent = templateParameters(content, { ...parameters, modelName });
|
|
11643
|
+
const rawRequest = {
|
|
11644
|
+
input: rawPromptContent,
|
|
11645
|
+
model: modelName,
|
|
11646
|
+
};
|
|
11647
|
+
const start = $getCurrentDate();
|
|
11648
|
+
if (this.options.isVerbose) {
|
|
11649
|
+
console.info(colors.bgWhite('rawRequest'), JSON.stringify(rawRequest, null, 4));
|
|
11650
|
+
}
|
|
11651
|
+
try {
|
|
11652
|
+
const rawResponse = await this.limiter
|
|
11653
|
+
.schedule(() => this.makeRequestWithNetworkRetry(() => client.embeddings.create(rawRequest)))
|
|
11654
|
+
.catch((error) => {
|
|
11655
|
+
assertsError(error);
|
|
11656
|
+
if (this.options.isVerbose) {
|
|
11657
|
+
console.info(colors.bgRed('error'), error);
|
|
11658
|
+
}
|
|
11659
|
+
throw error;
|
|
11660
|
+
});
|
|
11661
|
+
if (this.options.isVerbose) {
|
|
11662
|
+
console.info(colors.bgWhite('rawResponse'), JSON.stringify(rawResponse, null, 4));
|
|
11663
|
+
}
|
|
11664
|
+
const complete = $getCurrentDate();
|
|
11665
|
+
if (rawResponse.data.length !== 1) {
|
|
11666
|
+
throw new PipelineExecutionError(`Expected exactly 1 data item in response, got ${rawResponse.data.length}`);
|
|
11667
|
+
}
|
|
11668
|
+
const resultContent = rawResponse.data[0].embedding;
|
|
11669
|
+
const usage = this.computeUsage(content || '', '', rawResponse);
|
|
11670
|
+
return exportJson({
|
|
11671
|
+
name: 'promptResult',
|
|
11672
|
+
message: `Result of \`OpenAiCompatibleExecutionTools.callEmbeddingModel\``,
|
|
11673
|
+
order: [],
|
|
11674
|
+
value: {
|
|
11675
|
+
content: resultContent,
|
|
11676
|
+
modelName: rawResponse.model || modelName,
|
|
11677
|
+
timing: {
|
|
11678
|
+
start,
|
|
11679
|
+
complete,
|
|
11680
|
+
},
|
|
11681
|
+
usage,
|
|
11682
|
+
rawPromptContent,
|
|
11683
|
+
rawRequest,
|
|
11684
|
+
rawResponse,
|
|
11685
|
+
},
|
|
11686
|
+
});
|
|
11687
|
+
}
|
|
11688
|
+
catch (error) {
|
|
11689
|
+
assertsError(error);
|
|
11690
|
+
if (!isUnsupportedParameterError(error)) {
|
|
11691
|
+
if (attemptStack.length > 0) {
|
|
11692
|
+
throw new PipelineExecutionError(`All attempts failed. Attempt history:\n` +
|
|
11693
|
+
attemptStack
|
|
11694
|
+
.map((a, i) => ` ${i + 1}. Model: ${a.modelName}` +
|
|
11695
|
+
(a.unsupportedParameter ? `, Stripped: ${a.unsupportedParameter}` : '') +
|
|
11696
|
+
`, Error: ${a.errorMessage}` +
|
|
11697
|
+
(a.stripped ? ' (stripped and retried)' : ''))
|
|
11698
|
+
.join('\n') +
|
|
11699
|
+
`\nFinal error: ${error.message}`);
|
|
11700
|
+
}
|
|
11701
|
+
throw error;
|
|
11702
|
+
}
|
|
11703
|
+
const unsupportedParameter = parseUnsupportedParameterError(error.message);
|
|
11704
|
+
if (!unsupportedParameter) {
|
|
11705
|
+
if (this.options.isVerbose) {
|
|
11706
|
+
console.warn(colors.bgYellow('Warning'), 'Could not parse unsupported parameter from error:', error.message);
|
|
11707
|
+
}
|
|
11708
|
+
throw error;
|
|
11709
|
+
}
|
|
11710
|
+
const retryKey = `${modelName}-${unsupportedParameter}`;
|
|
11711
|
+
if (retriedUnsupportedParameters.has(retryKey)) {
|
|
11712
|
+
attemptStack.push({
|
|
11713
|
+
modelName,
|
|
11714
|
+
unsupportedParameter,
|
|
11715
|
+
errorMessage: error.message,
|
|
11716
|
+
stripped: true,
|
|
11717
|
+
});
|
|
11718
|
+
throw new PipelineExecutionError(`All attempts failed. Attempt history:\n` +
|
|
11719
|
+
attemptStack
|
|
11720
|
+
.map((a, i) => ` ${i + 1}. Model: ${a.modelName}` +
|
|
11721
|
+
(a.unsupportedParameter ? `, Stripped: ${a.unsupportedParameter}` : '') +
|
|
11722
|
+
`, Error: ${a.errorMessage}` +
|
|
11723
|
+
(a.stripped ? ' (stripped and retried)' : ''))
|
|
11724
|
+
.join('\n') +
|
|
11725
|
+
`\nFinal error: ${error.message}`);
|
|
11726
|
+
}
|
|
11727
|
+
retriedUnsupportedParameters.add(retryKey);
|
|
11728
|
+
if (this.options.isVerbose) {
|
|
11729
|
+
console.warn(colors.bgYellow('Warning'), `Removing unsupported parameter '${unsupportedParameter}' for model '${modelName}' and retrying request`);
|
|
11730
|
+
}
|
|
11731
|
+
attemptStack.push({
|
|
11732
|
+
modelName,
|
|
11733
|
+
unsupportedParameter,
|
|
11734
|
+
errorMessage: error.message,
|
|
11735
|
+
stripped: true,
|
|
11736
|
+
});
|
|
11737
|
+
const modifiedModelRequirements = removeUnsupportedModelRequirement(currentModelRequirements, unsupportedParameter);
|
|
11738
|
+
return this.callEmbeddingModelWithRetry(prompt, modifiedModelRequirements, attemptStack, retriedUnsupportedParameters);
|
|
11739
|
+
}
|
|
11740
|
+
}
|
|
11741
|
+
// <- Note: [🤖] callXxxModel
|
|
11742
|
+
/**
|
|
11743
|
+
* Get the model that should be used as default
|
|
11744
|
+
*/
|
|
11745
|
+
getDefaultModel(defaultModelName) {
|
|
11746
|
+
// Note: Match exact or prefix for model families
|
|
11747
|
+
const model = this.HARDCODED_MODELS.find(({ modelName }) => modelName === defaultModelName || modelName.startsWith(defaultModelName));
|
|
11748
|
+
if (model === undefined) {
|
|
11749
|
+
throw new PipelineExecutionError(spaceTrim$1((block) => `
|
|
11750
|
+
Cannot find model in ${this.title} models with name "${defaultModelName}" which should be used as default.
|
|
11751
|
+
|
|
11752
|
+
Available models:
|
|
11753
|
+
${block(this.HARDCODED_MODELS.map(({ modelName }) => `- "${modelName}"`).join('\n'))}
|
|
11754
|
+
|
|
11755
|
+
Model "${defaultModelName}" is probably not available anymore, not installed, inaccessible or misconfigured.
|
|
11756
|
+
|
|
11757
|
+
`));
|
|
11758
|
+
}
|
|
11759
|
+
return model;
|
|
11760
|
+
}
|
|
11761
|
+
// <- Note: [🤖] getDefaultXxxModel
|
|
11762
|
+
/**
|
|
11763
|
+
* Makes a request with retry logic for network errors like ECONNRESET
|
|
11764
|
+
*/
|
|
11765
|
+
async makeRequestWithNetworkRetry(requestFn) {
|
|
11766
|
+
let lastError;
|
|
11767
|
+
for (let attempt = 1; attempt <= CONNECTION_RETRIES_LIMIT; attempt++) {
|
|
11768
|
+
try {
|
|
11769
|
+
return await requestFn();
|
|
11770
|
+
}
|
|
11771
|
+
catch (error) {
|
|
11772
|
+
assertsError(error);
|
|
11773
|
+
lastError = error;
|
|
11774
|
+
// Check if this is a retryable network error
|
|
11775
|
+
const isRetryableError = this.isRetryableNetworkError(error);
|
|
11776
|
+
if (!isRetryableError || attempt === CONNECTION_RETRIES_LIMIT) {
|
|
11777
|
+
if (this.options.isVerbose && this.isRetryableNetworkError(error)) {
|
|
11778
|
+
console.info(colors.bgRed('Final network error after retries'), `Attempt ${attempt}/${CONNECTION_RETRIES_LIMIT}:`, error);
|
|
11779
|
+
}
|
|
11780
|
+
throw error;
|
|
11781
|
+
}
|
|
11782
|
+
// Calculate exponential backoff delay
|
|
11783
|
+
const baseDelay = 1000; // 1 second
|
|
11784
|
+
const backoffDelay = baseDelay * Math.pow(2, attempt - 1);
|
|
11785
|
+
const jitterDelay = Math.random() * 500; // Add some randomness
|
|
11786
|
+
const totalDelay = backoffDelay + jitterDelay;
|
|
11787
|
+
if (this.options.isVerbose) {
|
|
11788
|
+
console.info(colors.bgYellow('Retrying network request'), `Attempt ${attempt}/${CONNECTION_RETRIES_LIMIT}, waiting ${Math.round(totalDelay)}ms:`, error.message);
|
|
11789
|
+
}
|
|
11790
|
+
// Wait before retrying
|
|
11791
|
+
await new Promise((resolve) => setTimeout(resolve, totalDelay));
|
|
11792
|
+
}
|
|
11793
|
+
}
|
|
11794
|
+
throw lastError;
|
|
11795
|
+
}
|
|
11796
|
+
/**
|
|
11797
|
+
* Determines if an error is retryable (network-related errors)
|
|
11798
|
+
*/
|
|
11799
|
+
isRetryableNetworkError(error) {
|
|
11800
|
+
const errorMessage = error.message.toLowerCase();
|
|
11801
|
+
const errorCode = error.code;
|
|
11802
|
+
// Network connection errors that should be retried
|
|
11803
|
+
const retryableErrors = [
|
|
11804
|
+
'econnreset',
|
|
11805
|
+
'enotfound',
|
|
11806
|
+
'econnrefused',
|
|
11807
|
+
'etimedout',
|
|
11808
|
+
'socket hang up',
|
|
11809
|
+
'network error',
|
|
11810
|
+
'fetch failed',
|
|
11811
|
+
'connection reset',
|
|
11812
|
+
'connection refused',
|
|
11813
|
+
'timeout',
|
|
11814
|
+
];
|
|
11815
|
+
// Check error message
|
|
11816
|
+
if (retryableErrors.some((retryableError) => errorMessage.includes(retryableError))) {
|
|
11817
|
+
return true;
|
|
11818
|
+
}
|
|
11819
|
+
// Check error code
|
|
11820
|
+
if (errorCode && retryableErrors.includes(errorCode.toLowerCase())) {
|
|
11821
|
+
return true;
|
|
11822
|
+
}
|
|
11823
|
+
// Check for specific HTTP status codes that are retryable
|
|
11824
|
+
const errorWithStatus = error;
|
|
11825
|
+
const httpStatus = errorWithStatus.status || errorWithStatus.statusCode;
|
|
11826
|
+
if (httpStatus && [429, 500, 502, 503, 504].includes(httpStatus)) {
|
|
11827
|
+
return true;
|
|
11828
|
+
}
|
|
11829
|
+
return false;
|
|
11830
|
+
}
|
|
11831
|
+
}
|
|
11832
|
+
/**
|
|
11833
|
+
* TODO: [🛄] Some way how to re-wrap the errors from `OpenAiCompatibleExecutionTools`
|
|
11834
|
+
* TODO: [🛄] Maybe make custom `OpenAiCompatibleError`
|
|
11835
|
+
* TODO: [🧠][🈁] Maybe use `isDeterministic` from options
|
|
11836
|
+
* TODO: [🧠][🌰] Allow to pass `title` for tracking purposes
|
|
11837
|
+
* TODO: [🧠][🦢] Make reverse adapter from LlmExecutionTools to OpenAI-compatible:
|
|
11838
|
+
*/
|
|
11839
|
+
|
|
11840
|
+
/**
|
|
11841
|
+
* Profile for OpenAI provider
|
|
11842
|
+
*/
|
|
11843
|
+
const OPENAI_PROVIDER_PROFILE = {
|
|
11844
|
+
name: 'OPENAI',
|
|
11845
|
+
fullname: 'OpenAI GPT',
|
|
11846
|
+
color: '#10a37f',
|
|
11847
|
+
};
|
|
11848
|
+
/**
|
|
11849
|
+
* Execution Tools for calling OpenAI API
|
|
11850
|
+
*
|
|
11851
|
+
* @public exported from `@promptbook/openai`
|
|
11852
|
+
*/
|
|
11853
|
+
class OpenAiExecutionTools extends OpenAiCompatibleExecutionTools {
|
|
11854
|
+
constructor() {
|
|
11855
|
+
super(...arguments);
|
|
11856
|
+
/**
|
|
11857
|
+
* Computes the usage of the OpenAI API based on the response from OpenAI
|
|
11858
|
+
*/
|
|
11859
|
+
this.computeUsage = computeOpenAiUsage;
|
|
11860
|
+
// <- Note: [🤖] getDefaultXxxModel
|
|
11861
|
+
}
|
|
11862
|
+
/* <- TODO: [🍚] `, Destroyable` */
|
|
11863
|
+
get title() {
|
|
11864
|
+
return 'OpenAI';
|
|
11865
|
+
}
|
|
11866
|
+
get description() {
|
|
11867
|
+
return 'Use all models provided by OpenAI';
|
|
11868
|
+
}
|
|
11869
|
+
get profile() {
|
|
11870
|
+
return OPENAI_PROVIDER_PROFILE;
|
|
11871
|
+
}
|
|
11872
|
+
/*
|
|
11873
|
+
Note: Commenting this out to avoid circular dependency
|
|
11874
|
+
/**
|
|
11875
|
+
* Create (sub)tools for calling OpenAI API Assistants
|
|
11876
|
+
*
|
|
11877
|
+
* @param assistantId Which assistant to use
|
|
11878
|
+
* @returns Tools for calling OpenAI API Assistants with same token
|
|
11879
|
+
* /
|
|
11880
|
+
public createAssistantSubtools(assistantId: string_token): OpenAiAssistantExecutionTools {
|
|
11881
|
+
return new OpenAiAssistantExecutionTools({ ...this.options, assistantId });
|
|
11882
|
+
}
|
|
11883
|
+
*/
|
|
11884
|
+
/**
|
|
11885
|
+
* List all available models (non dynamically)
|
|
11886
|
+
*
|
|
11887
|
+
* Note: Purpose of this is to provide more information about models than standard listing from API
|
|
11888
|
+
*/
|
|
11889
|
+
get HARDCODED_MODELS() {
|
|
11890
|
+
return OPENAI_MODELS;
|
|
11891
|
+
}
|
|
11892
|
+
/**
|
|
11893
|
+
* Default model for chat variant.
|
|
11894
|
+
*/
|
|
11895
|
+
getDefaultChatModel() {
|
|
11896
|
+
return this.getDefaultModel('gpt-5');
|
|
11897
|
+
}
|
|
11898
|
+
/**
|
|
11899
|
+
* Default model for completion variant.
|
|
11900
|
+
*/
|
|
11901
|
+
getDefaultCompletionModel() {
|
|
11902
|
+
return this.getDefaultModel('gpt-3.5-turbo-instruct');
|
|
11903
|
+
}
|
|
11904
|
+
/**
|
|
11905
|
+
* Default model for completion variant.
|
|
11906
|
+
*/
|
|
11907
|
+
getDefaultEmbeddingModel() {
|
|
11908
|
+
return this.getDefaultModel('text-embedding-3-large');
|
|
11909
|
+
}
|
|
11910
|
+
}
|
|
11911
|
+
|
|
11912
|
+
/**
|
|
11913
|
+
* Execution Tools for calling OpenAI API Assistants
|
|
11914
|
+
*
|
|
11915
|
+
* This is useful for calling OpenAI API with a single assistant, for more wide usage use `OpenAiExecutionTools`.
|
|
11916
|
+
*
|
|
11917
|
+
* @public exported from `@promptbook/openai`
|
|
11918
|
+
*/
|
|
11919
|
+
class OpenAiAssistantExecutionTools extends OpenAiExecutionTools {
|
|
11920
|
+
/**
|
|
11921
|
+
* Creates OpenAI Execution Tools.
|
|
11922
|
+
*
|
|
11923
|
+
* @param options which are relevant are directly passed to the OpenAI client
|
|
11924
|
+
*/
|
|
11925
|
+
constructor(options) {
|
|
11926
|
+
var _a;
|
|
11927
|
+
if (options.isProxied) {
|
|
11928
|
+
throw new NotYetImplementedError(`Proxy mode is not yet implemented for OpenAI assistants`);
|
|
11929
|
+
}
|
|
11930
|
+
super(options);
|
|
11931
|
+
this.isCreatingNewAssistantsAllowed = false;
|
|
11932
|
+
this.assistantId = options.assistantId;
|
|
11933
|
+
this.isCreatingNewAssistantsAllowed = (_a = options.isCreatingNewAssistantsAllowed) !== null && _a !== void 0 ? _a : false;
|
|
11934
|
+
if (this.assistantId === null && !this.isCreatingNewAssistantsAllowed) {
|
|
11935
|
+
throw new NotAllowed(`Assistant ID is null and creating new assistants is not allowed - this configuration does not make sense`);
|
|
11936
|
+
}
|
|
11937
|
+
// <- TODO: !!! `OpenAiAssistantExecutionToolsOptions` - Allow `assistantId: null` together with `isCreatingNewAssistantsAllowed: true`
|
|
11938
|
+
// TODO: [👱] Make limiter same as in `OpenAiExecutionTools`
|
|
11939
|
+
}
|
|
11940
|
+
get title() {
|
|
11941
|
+
return 'OpenAI Assistant';
|
|
11942
|
+
}
|
|
11943
|
+
get description() {
|
|
11944
|
+
return 'Use single assistant provided by OpenAI';
|
|
11945
|
+
}
|
|
11946
|
+
/**
|
|
11947
|
+
* Calls OpenAI API to use a chat model.
|
|
11948
|
+
*/
|
|
11949
|
+
async callChatModel(prompt) {
|
|
11950
|
+
var _a, _b, _c;
|
|
11951
|
+
if (this.options.isVerbose) {
|
|
11952
|
+
console.info('💬 OpenAI callChatModel call', { prompt });
|
|
11953
|
+
}
|
|
11954
|
+
const { content, parameters, modelRequirements /*, format*/ } = prompt;
|
|
11955
|
+
const client = await this.getClient();
|
|
11956
|
+
// TODO: [☂] Use here more modelRequirements
|
|
11957
|
+
if (modelRequirements.modelVariant !== 'CHAT') {
|
|
11958
|
+
throw new PipelineExecutionError('Use callChatModel only for CHAT variant');
|
|
11959
|
+
}
|
|
11960
|
+
// TODO: [👨👨👧👧] Remove:
|
|
11961
|
+
for (const key of ['maxTokens', 'modelName', 'seed', 'temperature']) {
|
|
11962
|
+
if (modelRequirements[key] !== undefined) {
|
|
11963
|
+
throw new NotYetImplementedError(`In \`OpenAiAssistantExecutionTools\` you cannot specify \`${key}\``);
|
|
11964
|
+
}
|
|
11965
|
+
}
|
|
11966
|
+
/*
|
|
11967
|
+
TODO: [👨👨👧👧] Implement all of this for Assistants
|
|
11968
|
+
const modelName = modelRequirements.modelName || this.getDefaultChatModel().modelName;
|
|
11969
|
+
const modelSettings = {
|
|
11970
|
+
model: modelName,
|
|
11971
|
+
|
|
11972
|
+
temperature: modelRequirements.temperature,
|
|
11973
|
+
|
|
11974
|
+
// <- TODO: [🈁] Use `seed` here AND/OR use is `isDeterministic` for entire execution tools
|
|
11975
|
+
// <- Note: [🧆]
|
|
11976
|
+
} as OpenAI.Chat.Completions.CompletionCreateParamsNonStreaming; // <- TODO: Guard here types better
|
|
11977
|
+
|
|
11978
|
+
if (format === 'JSON') {
|
|
11979
|
+
modelSettings.response_format = {
|
|
11980
|
+
type: 'json_object',
|
|
11981
|
+
};
|
|
11982
|
+
}
|
|
11983
|
+
*/
|
|
11984
|
+
// <- TODO: [🚸] Not all models are compatible with JSON mode
|
|
11985
|
+
// > 'response_format' of type 'json_object' is not supported with this model.
|
|
11986
|
+
const rawPromptContent = templateParameters(content, {
|
|
11987
|
+
...parameters,
|
|
11988
|
+
modelName: 'assistant',
|
|
11989
|
+
// <- [🧠] What is the best value here
|
|
11990
|
+
});
|
|
11991
|
+
const rawRequest = {
|
|
11992
|
+
// TODO: [👨👨👧👧] ...modelSettings,
|
|
11993
|
+
// TODO: [👨👨👧👧][🧠] What about system message for assistants, does it make sense - combination of OpenAI assistants with Promptbook Personas
|
|
11994
|
+
assistant_id: this.assistantId,
|
|
11995
|
+
thread: {
|
|
11996
|
+
messages: 'thread' in prompt &&
|
|
11997
|
+
Array.isArray(prompt.thread)
|
|
11998
|
+
? prompt.thread.map((msg) => ({
|
|
11999
|
+
role: msg.role === 'assistant' ? 'assistant' : 'user',
|
|
12000
|
+
content: msg.content,
|
|
12001
|
+
}))
|
|
12002
|
+
: [{ role: 'user', content: rawPromptContent }],
|
|
12003
|
+
},
|
|
12004
|
+
// <- TODO: Add user identification here> user: this.options.user,
|
|
12005
|
+
};
|
|
12006
|
+
const start = $getCurrentDate();
|
|
12007
|
+
let complete;
|
|
12008
|
+
if (this.options.isVerbose) {
|
|
12009
|
+
console.info(colors.bgWhite('rawRequest'), JSON.stringify(rawRequest, null, 4));
|
|
12010
|
+
}
|
|
12011
|
+
const stream = await client.beta.threads.createAndRunStream(rawRequest);
|
|
12012
|
+
stream.on('connect', () => {
|
|
12013
|
+
if (this.options.isVerbose) {
|
|
12014
|
+
console.info('connect', stream.currentEvent);
|
|
12015
|
+
}
|
|
12016
|
+
});
|
|
12017
|
+
stream.on('messageDelta', (messageDelta) => {
|
|
12018
|
+
var _a;
|
|
12019
|
+
if (this.options.isVerbose &&
|
|
12020
|
+
messageDelta &&
|
|
12021
|
+
messageDelta.content &&
|
|
12022
|
+
messageDelta.content[0] &&
|
|
12023
|
+
messageDelta.content[0].type === 'text') {
|
|
12024
|
+
console.info('messageDelta', (_a = messageDelta.content[0].text) === null || _a === void 0 ? void 0 : _a.value);
|
|
12025
|
+
}
|
|
12026
|
+
// <- TODO: [🐚] Make streaming and running tasks working
|
|
12027
|
+
});
|
|
12028
|
+
stream.on('messageCreated', (message) => {
|
|
12029
|
+
if (this.options.isVerbose) {
|
|
12030
|
+
console.info('messageCreated', message);
|
|
12031
|
+
}
|
|
12032
|
+
});
|
|
12033
|
+
stream.on('messageDone', (message) => {
|
|
12034
|
+
if (this.options.isVerbose) {
|
|
12035
|
+
console.info('messageDone', message);
|
|
12036
|
+
}
|
|
12037
|
+
});
|
|
12038
|
+
const rawResponse = await stream.finalMessages();
|
|
12039
|
+
if (this.options.isVerbose) {
|
|
12040
|
+
console.info(colors.bgWhite('rawResponse'), JSON.stringify(rawResponse, null, 4));
|
|
12041
|
+
}
|
|
12042
|
+
if (rawResponse.length !== 1) {
|
|
12043
|
+
throw new PipelineExecutionError(`There is NOT 1 BUT ${rawResponse.length} finalMessages from OpenAI`);
|
|
12044
|
+
}
|
|
12045
|
+
if (rawResponse[0].content.length !== 1) {
|
|
12046
|
+
throw new PipelineExecutionError(`There is NOT 1 BUT ${rawResponse[0].content.length} finalMessages content from OpenAI`);
|
|
12047
|
+
}
|
|
12048
|
+
if (((_a = rawResponse[0].content[0]) === null || _a === void 0 ? void 0 : _a.type) !== 'text') {
|
|
12049
|
+
throw new PipelineExecutionError(`There is NOT 'text' BUT ${(_b = rawResponse[0].content[0]) === null || _b === void 0 ? void 0 : _b.type} finalMessages content type from OpenAI`);
|
|
12050
|
+
}
|
|
12051
|
+
const resultContent = (_c = rawResponse[0].content[0]) === null || _c === void 0 ? void 0 : _c.text.value;
|
|
12052
|
+
// <- TODO: [🧠] There are also annotations, maybe use them
|
|
12053
|
+
// eslint-disable-next-line prefer-const
|
|
12054
|
+
complete = $getCurrentDate();
|
|
12055
|
+
const usage = UNCERTAIN_USAGE;
|
|
12056
|
+
// <- TODO: [🥘] Compute real usage for assistant
|
|
12057
|
+
// ?> const usage = computeOpenAiUsage(content, resultContent || '', rawResponse);
|
|
12058
|
+
if (resultContent === null) {
|
|
12059
|
+
throw new PipelineExecutionError('No response message from OpenAI');
|
|
12060
|
+
}
|
|
12061
|
+
return exportJson({
|
|
12062
|
+
name: 'promptResult',
|
|
12063
|
+
message: `Result of \`OpenAiAssistantExecutionTools.callChatModel\``,
|
|
12064
|
+
order: [],
|
|
12065
|
+
value: {
|
|
12066
|
+
content: resultContent,
|
|
12067
|
+
modelName: 'assistant',
|
|
12068
|
+
// <- TODO: [🥘] Detect used model in assistant
|
|
12069
|
+
// ?> model: rawResponse.model || modelName,
|
|
12070
|
+
timing: {
|
|
12071
|
+
start,
|
|
12072
|
+
complete,
|
|
12073
|
+
},
|
|
12074
|
+
usage,
|
|
12075
|
+
rawPromptContent,
|
|
12076
|
+
rawRequest,
|
|
12077
|
+
rawResponse,
|
|
12078
|
+
// <- [🗯]
|
|
12079
|
+
},
|
|
12080
|
+
});
|
|
12081
|
+
}
|
|
12082
|
+
async createNewAssistant() {
|
|
12083
|
+
if (!this.isCreatingNewAssistantsAllowed) {
|
|
12084
|
+
throw new NotAllowed(`Creating new assistants is not allowed. Set \`isCreatingNewAssistantsAllowed: true\` in options to enable this feature.`);
|
|
12085
|
+
}
|
|
12086
|
+
const client = await this.getClient();
|
|
12087
|
+
/*
|
|
12088
|
+
TODO: !!!
|
|
12089
|
+
async function downloadFile(url: string, folder = './tmp'): Promise<string> {
|
|
12090
|
+
const filename = path.basename(url.split('?')[0]);
|
|
12091
|
+
const filepath = path.join(folder, filename);
|
|
12092
|
+
|
|
12093
|
+
if (!fs.existsSync(folder)) fs.mkdirSync(folder);
|
|
12094
|
+
|
|
12095
|
+
const res = await fetch(url);
|
|
12096
|
+
if (!res.ok) throw new Error(`Download error: ${url}`);
|
|
12097
|
+
const buffer = await res.arrayBuffer();
|
|
12098
|
+
fs.writeFileSync(filepath, Buffer.from(buffer));
|
|
12099
|
+
console.log(`📥 File downloaded: ${filename}`);
|
|
12100
|
+
|
|
12101
|
+
return filepath;
|
|
12102
|
+
}
|
|
12103
|
+
|
|
12104
|
+
async function uploadFileToOpenAI(filepath: string) {
|
|
12105
|
+
const file = await client.files.create({
|
|
12106
|
+
file: fs.createReadStream(filepath),
|
|
12107
|
+
purpose: 'assistants',
|
|
12108
|
+
});
|
|
12109
|
+
console.log(`⬆️ File uploaded to OpenAI: ${file.filename} (${file.id})`);
|
|
12110
|
+
return file;
|
|
12111
|
+
}
|
|
12112
|
+
|
|
12113
|
+
// 🌐 URL addresses of files to upload
|
|
12114
|
+
const fileUrls = [
|
|
12115
|
+
'https://raw.githubusercontent.com/vercel/next.js/canary/packages/next/README.md',
|
|
12116
|
+
'https://raw.githubusercontent.com/openai/openai-cookbook/main/examples/How_to_call_the_Assistants_API_with_Node.js.ipynb',
|
|
12117
|
+
];
|
|
12118
|
+
|
|
12119
|
+
// 1️⃣ Download files from URL
|
|
12120
|
+
const localFiles = [];
|
|
12121
|
+
for (const url of fileUrls) {
|
|
12122
|
+
const filepath = await downloadFile(url);
|
|
12123
|
+
localFiles.push(filepath);
|
|
12124
|
+
}
|
|
12125
|
+
|
|
12126
|
+
// 2️⃣ Upload files to OpenAI
|
|
12127
|
+
const uploadedFiles = [];
|
|
12128
|
+
for (const filepath of localFiles) {
|
|
12129
|
+
const file = await uploadFileToOpenAI(filepath);
|
|
12130
|
+
uploadedFiles.push(file.id);
|
|
12131
|
+
}
|
|
12132
|
+
*/
|
|
12133
|
+
// 3️⃣ Create assistant with uploaded files
|
|
12134
|
+
const assistant = await client.beta.assistants.create({
|
|
12135
|
+
name: 'Next.js documentation assistant',
|
|
12136
|
+
description: 'Assistant that can answer questions about Next.js and working with APIs.',
|
|
12137
|
+
model: 'gpt-4o',
|
|
12138
|
+
instructions: spaceTrim$1(`
|
|
12139
|
+
Answer clearly and comprehensively.
|
|
12140
|
+
Quote parts from uploaded files if needed.
|
|
12141
|
+
`),
|
|
12142
|
+
// <- TODO: !!!! Generate the `instructions` from passed `agentSource` (generate outside of this class)
|
|
12143
|
+
tools: [{ type: 'code_interpreter' }, { type: 'file_search' }],
|
|
12144
|
+
// !!!! file_ids: uploadedFiles,
|
|
12145
|
+
});
|
|
12146
|
+
// TODO: !!!! Change Czech to English
|
|
12147
|
+
console.log(`✅ Assistant created: ${assistant.id}`);
|
|
12148
|
+
return new OpenAiAssistantExecutionTools({
|
|
12149
|
+
...this.options,
|
|
12150
|
+
isCreatingNewAssistantsAllowed: false,
|
|
12151
|
+
assistantId: assistant.id,
|
|
12152
|
+
});
|
|
12153
|
+
}
|
|
12154
|
+
/**
|
|
12155
|
+
* Discriminant for type guards
|
|
12156
|
+
*/
|
|
12157
|
+
get discriminant() {
|
|
12158
|
+
return DISCRIMINANT;
|
|
12159
|
+
}
|
|
12160
|
+
/**
|
|
12161
|
+
* Type guard to check if given `LlmExecutionTools` are instanceof `OpenAiAssistantExecutionTools`
|
|
12162
|
+
*
|
|
12163
|
+
* Note: This is useful when you can possibly have multiple versions of `@promptbook/openai` installed
|
|
12164
|
+
*/
|
|
12165
|
+
static isOpenAiAssistantExecutionTools(llmExecutionTools) {
|
|
12166
|
+
return llmExecutionTools.discriminant === DISCRIMINANT;
|
|
12167
|
+
}
|
|
12168
|
+
}
|
|
12169
|
+
/**
|
|
12170
|
+
* Discriminant for type guards
|
|
12171
|
+
*
|
|
12172
|
+
* @private const of `OpenAiAssistantExecutionTools`
|
|
12173
|
+
*/
|
|
12174
|
+
const DISCRIMINANT = 'OPEN_AI_ASSISTANT_V1';
|
|
12175
|
+
/**
|
|
12176
|
+
* TODO: [🧠][🧙♂️] Maybe there can be some wizard for those who want to use just OpenAI
|
|
12177
|
+
* TODO: Maybe make custom OpenAiError
|
|
12178
|
+
* TODO: [🧠][🈁] Maybe use `isDeterministic` from options
|
|
12179
|
+
* TODO: [🧠][🌰] Allow to pass `title` for tracking purposes
|
|
12180
|
+
*/
|
|
12181
|
+
|
|
12182
|
+
/**
|
|
12183
|
+
* Execution Tools for calling LLM models with a predefined agent "soul"
|
|
12184
|
+
* This wraps underlying LLM execution tools and applies agent-specific system prompts and requirements
|
|
12185
|
+
*
|
|
12186
|
+
* @public exported from `@promptbook/core`
|
|
12187
|
+
*/
|
|
12188
|
+
class AgentLlmExecutionTools {
|
|
12189
|
+
/**
|
|
12190
|
+
* Creates new AgentLlmExecutionTools
|
|
12191
|
+
*
|
|
12192
|
+
* @param llmTools The underlying LLM execution tools to wrap
|
|
12193
|
+
* @param agentSource The agent source string that defines the agent's behavior
|
|
12194
|
+
*/
|
|
12195
|
+
constructor(llmTools, agentSource) {
|
|
12196
|
+
this.llmTools = llmTools;
|
|
12197
|
+
this.agentSource = agentSource;
|
|
12198
|
+
/**
|
|
12199
|
+
* Cached model requirements to avoid re-parsing the agent source
|
|
12200
|
+
*/
|
|
12201
|
+
this._cachedModelRequirements = null;
|
|
12202
|
+
/**
|
|
12203
|
+
* Cached parsed agent information
|
|
12204
|
+
*/
|
|
12205
|
+
this._cachedAgentInfo = null;
|
|
12206
|
+
// <- TODO: !!!! CreateAgentLlmExecutionToolsOptions
|
|
12207
|
+
// <- TODO: !!!! Leverage `OpenAiAssistantExecutionTools`
|
|
12208
|
+
}
|
|
12209
|
+
/**
|
|
12210
|
+
* Get cached or parse agent information
|
|
12211
|
+
*/
|
|
12212
|
+
getAgentInfo() {
|
|
12213
|
+
if (this._cachedAgentInfo === null) {
|
|
12214
|
+
this._cachedAgentInfo = parseAgentSource(this.agentSource);
|
|
12215
|
+
}
|
|
12216
|
+
return this._cachedAgentInfo;
|
|
12217
|
+
}
|
|
12218
|
+
/**
|
|
12219
|
+
* Get cached or create agent model requirements
|
|
12220
|
+
*/
|
|
12221
|
+
async getAgentModelRequirements() {
|
|
12222
|
+
if (this._cachedModelRequirements === null) {
|
|
12223
|
+
// Get available models from underlying LLM tools for best model selection
|
|
12224
|
+
const availableModels = await this.llmTools.listModels();
|
|
12225
|
+
this._cachedModelRequirements = await createAgentModelRequirements(this.agentSource, undefined, // Let the function pick the best model
|
|
12226
|
+
availableModels);
|
|
12227
|
+
}
|
|
12228
|
+
return this._cachedModelRequirements;
|
|
12229
|
+
}
|
|
12230
|
+
get title() {
|
|
12231
|
+
const agentInfo = this.getAgentInfo();
|
|
12232
|
+
return (agentInfo.agentName || 'Agent');
|
|
12233
|
+
}
|
|
12234
|
+
get description() {
|
|
12235
|
+
const agentInfo = this.getAgentInfo();
|
|
12236
|
+
return agentInfo.personaDescription || 'AI Agent with predefined personality and behavior';
|
|
12237
|
+
}
|
|
12238
|
+
get profile() {
|
|
12239
|
+
const agentInfo = this.getAgentInfo();
|
|
12240
|
+
if (!agentInfo.agentName) {
|
|
12241
|
+
return undefined;
|
|
12242
|
+
}
|
|
12243
|
+
return {
|
|
12244
|
+
name: agentInfo.agentName.toUpperCase().replace(/\s+/g, '_'),
|
|
12245
|
+
fullname: agentInfo.agentName,
|
|
12246
|
+
color: agentInfo.meta.color || '#6366f1',
|
|
12247
|
+
avatarSrc: agentInfo.meta.image,
|
|
12248
|
+
};
|
|
12249
|
+
}
|
|
12250
|
+
checkConfiguration() {
|
|
12251
|
+
// Check underlying tools configuration
|
|
12252
|
+
return this.llmTools.checkConfiguration();
|
|
12253
|
+
}
|
|
12254
|
+
/**
|
|
12255
|
+
* Returns a virtual model name representing the agent behavior
|
|
12256
|
+
*/
|
|
12257
|
+
get modelName() {
|
|
12258
|
+
const hash = SHA256(hexEncoder.parse(this.agentSource))
|
|
12259
|
+
// <- TODO: [🥬] Encapsulate sha256 to some private utility function
|
|
12260
|
+
.toString( /* hex */);
|
|
12261
|
+
// <- TODO: [🥬] Make some system for hashes and ids of promptbook
|
|
12262
|
+
const agentId = hash.substring(0, 10);
|
|
12263
|
+
// <- TODO: [🥬] Make some system for hashes and ids of promptbook
|
|
12264
|
+
return (normalizeToKebabCase(this.title) + '-' + agentId);
|
|
12265
|
+
}
|
|
12266
|
+
listModels() {
|
|
12267
|
+
return [
|
|
12268
|
+
{
|
|
12269
|
+
modelName: this.modelName,
|
|
12270
|
+
modelVariant: 'CHAT',
|
|
12271
|
+
modelTitle: `${this.title} (Agent Chat Default)`,
|
|
12272
|
+
modelDescription: `Chat model with agent behavior: ${this.description}`,
|
|
12273
|
+
},
|
|
12274
|
+
// <- Note: We only list a single "virtual" agent model here as this wrapper only supports chat prompts
|
|
12275
|
+
];
|
|
12276
|
+
}
|
|
12277
|
+
/**
|
|
12278
|
+
* Calls the chat model with agent-specific system prompt and requirements
|
|
12279
|
+
*/
|
|
12280
|
+
async callChatModel(prompt) {
|
|
12281
|
+
if (!this.llmTools.callChatModel) {
|
|
12282
|
+
throw new Error('Underlying LLM execution tools do not support chat model calls');
|
|
12283
|
+
}
|
|
12284
|
+
// Ensure we're working with a chat prompt
|
|
12285
|
+
if (prompt.modelRequirements.modelVariant !== 'CHAT') {
|
|
12286
|
+
throw new Error('AgentLlmExecutionTools only supports chat prompts');
|
|
12287
|
+
}
|
|
12288
|
+
const chatPrompt = prompt;
|
|
12289
|
+
let underlyingLlmResult;
|
|
12290
|
+
if (OpenAiAssistantExecutionTools.isOpenAiAssistantExecutionTools(this.llmTools)) {
|
|
12291
|
+
// <- TODO: !!! Check also `isCreatingNewAssistantsAllowed` and warn about it
|
|
12292
|
+
const assistant = await this.llmTools.createNewAssistant( /* <- TODO: !!!! Generate the `instructions` from passed `agentSource` */);
|
|
12293
|
+
// <- TODO: !!! Cache the assistant in prepareCache
|
|
12294
|
+
underlyingLlmResult = await assistant.callChatModel(chatPrompt);
|
|
12295
|
+
}
|
|
12296
|
+
else {
|
|
12297
|
+
// Get agent model requirements (cached with best model selection)
|
|
12298
|
+
const modelRequirements = await this.getAgentModelRequirements();
|
|
12299
|
+
// Create modified chat prompt with agent system message
|
|
12300
|
+
const modifiedChatPrompt = {
|
|
12301
|
+
...chatPrompt,
|
|
12302
|
+
modelRequirements: {
|
|
12303
|
+
...chatPrompt.modelRequirements,
|
|
12304
|
+
...modelRequirements,
|
|
12305
|
+
// Prepend agent system message to existing system message
|
|
12306
|
+
systemMessage: modelRequirements.systemMessage +
|
|
12307
|
+
(chatPrompt.modelRequirements.systemMessage
|
|
12308
|
+
? `\n\n${chatPrompt.modelRequirements.systemMessage}`
|
|
12309
|
+
: ''),
|
|
12310
|
+
},
|
|
12311
|
+
};
|
|
12312
|
+
underlyingLlmResult = await this.llmTools.callChatModel(modifiedChatPrompt);
|
|
12313
|
+
}
|
|
12314
|
+
let content = underlyingLlmResult.content;
|
|
12315
|
+
// Note: Cleanup the AI artifacts from the content
|
|
12316
|
+
content = humanizeAiText(content);
|
|
12317
|
+
// Note: Make sure the content is Promptbook-like
|
|
12318
|
+
content = promptbookifyAiText(content);
|
|
12319
|
+
const agentResult = {
|
|
12320
|
+
...underlyingLlmResult,
|
|
12321
|
+
content,
|
|
12322
|
+
modelName: this.modelName,
|
|
12323
|
+
};
|
|
12324
|
+
return agentResult;
|
|
12325
|
+
}
|
|
12326
|
+
}
|
|
12327
|
+
/**
|
|
12328
|
+
* TODO: [🍚] Implement Destroyable pattern to free resources
|
|
12329
|
+
* TODO: [🧠] Adding parameter substitution support (here or should be responsibility of the underlying LLM Tools)
|
|
12330
|
+
*/
|
|
12331
|
+
|
|
12332
|
+
/**
|
|
12333
|
+
* Creates new AgentLlmExecutionTools that wrap underlying LLM tools with agent-specific behavior
|
|
12334
|
+
*
|
|
12335
|
+
* @public exported from `@promptbook/core`
|
|
12336
|
+
*/
|
|
12337
|
+
const createAgentLlmExecutionTools = Object.assign((options) => {
|
|
12338
|
+
/*
|
|
12339
|
+
if (llmTools instanceof OpenAiAssistantExecutionTools) {
|
|
12340
|
+
// !!!!! Leverage `OpenAiAssistantExecutionTools` specific features here
|
|
12341
|
+
}*/
|
|
12342
|
+
return new AgentLlmExecutionTools(options.llmTools, options.agentSource);
|
|
12343
|
+
}, {
|
|
12344
|
+
packageName: '@promptbook/core',
|
|
12345
|
+
className: 'AgentLlmExecutionTools',
|
|
12346
|
+
});
|
|
12347
|
+
/**
|
|
12348
|
+
* TODO: [🧠] Consider adding validation for agent source format
|
|
12349
|
+
* TODO: [🧠] Consider adding options for caching behavior
|
|
12350
|
+
*/
|
|
12351
|
+
|
|
12352
|
+
/**
|
|
12353
|
+
* Metadata for Agent LLM execution tools
|
|
12354
|
+
*
|
|
12355
|
+
* @public exported from `@promptbook/core`
|
|
12356
|
+
*/
|
|
12357
|
+
$llmToolsMetadataRegister.register({
|
|
12358
|
+
packageName: '@promptbook/core',
|
|
12359
|
+
className: 'AgentLlmExecutionTools',
|
|
12360
|
+
title: 'Agent',
|
|
12361
|
+
trustLevel: 'UNTRUSTED',
|
|
12362
|
+
order: MODEL_ORDERS.LOW_TIER,
|
|
12363
|
+
envVariables: null,
|
|
12364
|
+
getBoilerplateConfiguration() {
|
|
12365
|
+
return {
|
|
12366
|
+
packageName: '@promptbook/core',
|
|
12367
|
+
className: 'AgentLlmExecutionTools',
|
|
12368
|
+
title: 'Agent',
|
|
12369
|
+
options: {
|
|
12370
|
+
// Note: Agent tools require runtime configuration with underlying tools and agent source
|
|
12371
|
+
// This cannot be provided as a static configuration
|
|
12372
|
+
},
|
|
12373
|
+
};
|
|
12374
|
+
},
|
|
12375
|
+
createConfigurationFromEnv() {
|
|
12376
|
+
// Agent tools cannot be configured from environment variables alone
|
|
12377
|
+
// They require underlying LLM tools and agent source to be provided programmatically
|
|
12378
|
+
return null;
|
|
12379
|
+
},
|
|
12380
|
+
});
|
|
12381
|
+
/**
|
|
12382
|
+
* TODO: [🧠] Consider adding a special trust level for AgentLlmExecutionTools
|
|
12383
|
+
* TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
|
|
12384
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
12385
|
+
*/
|
|
12386
|
+
|
|
12387
|
+
/**
|
|
12388
|
+
* Registration of Agent LLM provider
|
|
12389
|
+
*
|
|
12390
|
+
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available LLM tools
|
|
12391
|
+
*
|
|
12392
|
+
* @public exported from `@promptbook/core`
|
|
12393
|
+
*/
|
|
12394
|
+
$llmToolsRegister.register(createAgentLlmExecutionTools);
|
|
12395
|
+
/**
|
|
12396
|
+
* TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
|
|
12397
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
12398
|
+
*/
|
|
12399
|
+
|
|
12400
|
+
/**
|
|
12401
|
+
* Registration of LLM provider metadata
|
|
12402
|
+
*
|
|
12403
|
+
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available LLM tools
|
|
12404
|
+
*
|
|
12405
|
+
* @public exported from `@promptbook/core`
|
|
12406
|
+
* @public exported from `@promptbook/wizard`
|
|
12407
|
+
* @public exported from `@promptbook/cli`
|
|
12408
|
+
*/
|
|
12409
|
+
$llmToolsMetadataRegister.register({
|
|
12410
|
+
title: 'Anthropic Claude',
|
|
12411
|
+
packageName: '@promptbook/anthropic-claude',
|
|
12412
|
+
className: 'AnthropicClaudeExecutionTools',
|
|
12413
|
+
envVariables: ['ANTHROPIC_CLAUDE_API_KEY'],
|
|
12414
|
+
trustLevel: 'CLOSED',
|
|
12415
|
+
order: MODEL_ORDERS.TOP_TIER,
|
|
12416
|
+
getBoilerplateConfiguration() {
|
|
12417
|
+
return {
|
|
12418
|
+
title: 'Anthropic Claude',
|
|
12419
|
+
packageName: '@promptbook/anthropic-claude',
|
|
12420
|
+
className: 'AnthropicClaudeExecutionTools',
|
|
12421
|
+
options: {
|
|
12422
|
+
apiKey: 'sk-ant-api03-',
|
|
12423
|
+
isProxied: true,
|
|
12424
|
+
remoteServerUrl: DEFAULT_REMOTE_SERVER_URL,
|
|
12425
|
+
maxRequestsPerMinute: DEFAULT_MAX_REQUESTS_PER_MINUTE,
|
|
12426
|
+
},
|
|
12427
|
+
};
|
|
12428
|
+
},
|
|
12429
|
+
createConfigurationFromEnv(env) {
|
|
12430
|
+
// Note: Note using `process.env` BUT `env` to pass in the environment variables dynamically
|
|
12431
|
+
if (typeof env.ANTHROPIC_CLAUDE_API_KEY === 'string') {
|
|
12432
|
+
return {
|
|
12433
|
+
title: 'Claude (from env)',
|
|
12434
|
+
packageName: '@promptbook/anthropic-claude',
|
|
12435
|
+
className: 'AnthropicClaudeExecutionTools',
|
|
12436
|
+
options: {
|
|
12437
|
+
apiKey: env.ANTHROPIC_CLAUDE_API_KEY,
|
|
12438
|
+
},
|
|
12439
|
+
};
|
|
12440
|
+
}
|
|
12441
|
+
return null;
|
|
12442
|
+
},
|
|
12443
|
+
});
|
|
12444
|
+
/**
|
|
12445
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
12446
|
+
*/
|
|
12447
|
+
|
|
12448
|
+
/**
|
|
12449
|
+
* Registration of LLM provider metadata
|
|
12450
|
+
*
|
|
12451
|
+
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available LLM tools
|
|
10698
12452
|
*
|
|
10699
12453
|
* @public exported from `@promptbook/core`
|
|
10700
12454
|
* @public exported from `@promptbook/wizard`
|
|
@@ -11369,7 +13123,7 @@ async function $induceBookDownload(book) {
|
|
|
11369
13123
|
* Note: [🔵] Code in this file should never be published outside of `@promptbook/browser`
|
|
11370
13124
|
*/
|
|
11371
13125
|
|
|
11372
|
-
var css_248z$4 = ".MarkdownContent-module_MarkdownContent__2JuyX h1{font-size:2em}.MarkdownContent-module_MarkdownContent__2JuyX h2{font-size:1.75em}.MarkdownContent-module_MarkdownContent__2JuyX h3{font-size:1.5em}.MarkdownContent-module_MarkdownContent__2JuyX h4{font-size:1.25em}.MarkdownContent-module_MarkdownContent__2JuyX h5{font-size:1.1em}.MarkdownContent-module_MarkdownContent__2JuyX ul{list-style:disc;margin-left:20px}.MarkdownContent-module_MarkdownContent__2JuyX ol{list-style:decimal;margin-left:20px}.MarkdownContent-module_MarkdownContent__2JuyX blockquote,.MarkdownContent-module_MarkdownContent__2JuyX img,.MarkdownContent-module_MarkdownContent__2JuyX pre,.MarkdownContent-module_MarkdownContent__2JuyX table{border-radius:8px;margin-bottom:10px;margin-top:10px}.MarkdownContent-module_MarkdownContent__2JuyX pre{background:#000;border:none;box-shadow:none;color:#fff;display:block;font-size:inherit;line-height:inherit;padding:1em}.MarkdownContent-module_MarkdownContent__2JuyX blockquote{background:#ffffffcc;border:none;box-shadow:none;color:#000;display:block;font-size:inherit;line-height:inherit;padding:1em}.MarkdownContent-module_MarkdownContent__2JuyX code{background:#cccccc55;border:none;box-shadow:none;color:inherit;display:inline-block;font-size:inherit;line-height:inherit;margin:0;padding:0}.MarkdownContent-module_MarkdownContent__2JuyX pre code{background-color:#000000cc;border-radius:8px}.MarkdownContent-module_MarkdownContent__2JuyX .MarkdownContent-module_chat-code-block__ZffFg{background:#181c23;border-color:#23272f;box-shadow:0 2px 8px rgba(0,0,0,.12);color:#f8fafc;font-family:Fira Mono,Menlo,Consolas,Liberation Mono,monospace;font-size:14px;line-height:1.6;overflow-x:auto}.MarkdownContent-module_MarkdownContent__2JuyX .MarkdownContent-module_chat-code-block__ZffFg code{background:none!important;border:none!important;box-shadow:none!important;color:inherit!important;display:block;font-family:inherit!important;font-size:inherit!important;overflow-x:auto;padding:0!important;white-space:pre;word-break:break-word}.MarkdownContent-module_MarkdownContent__2JuyX table{background:#f8fafc;border-collapse:separate;border-spacing:0;box-shadow:0 2px 8px rgba(0,0,0,.08);color:#17223b;font-size:14px;margin:16px 0;width:100%}.MarkdownContent-module_MarkdownContent__2JuyX td,.MarkdownContent-module_MarkdownContent__2JuyX th{background:none;border-bottom:1px solid #d1dbe8;color:#17223b;padding:10px 16px;text-align:left}.MarkdownContent-module_MarkdownContent__2JuyX th{background:linear-gradient(90deg,#eaf3fa 80%,#d1e3f8);border-bottom:2px solid #b5c7de;color:#17223b;font-weight:700}.MarkdownContent-module_MarkdownContent__2JuyX tr:last-child td{border-bottom:none}.MarkdownContent-module_MarkdownContent__2JuyX tr:nth-child(2n) td{background:#eaf3fa}.MarkdownContent-module_MarkdownContent__2JuyX tr:hover td{background:#cbe0f7;transition:background .2s}.MarkdownContent-module_MarkdownContent__2JuyX table{border-radius:12px;overflow:hidden}.MarkdownContent-module_MarkdownContent__2JuyX td:first-child,.MarkdownContent-module_MarkdownContent__2JuyX th:first-child{border-top-left-radius:12px}.MarkdownContent-module_MarkdownContent__2JuyX td:last-child,.MarkdownContent-module_MarkdownContent__2JuyX th:last-child{border-top-right-radius:12px}\n/*# sourceMappingURL=data:application/json;base64,
|
|
13126
|
+
var css_248z$4 = ".MarkdownContent-module_MarkdownContent__2JuyX h1{font-size:2em}.MarkdownContent-module_MarkdownContent__2JuyX h2{font-size:1.75em}.MarkdownContent-module_MarkdownContent__2JuyX h3{font-size:1.5em}.MarkdownContent-module_MarkdownContent__2JuyX h4{font-size:1.25em}.MarkdownContent-module_MarkdownContent__2JuyX h5{font-size:1.1em}.MarkdownContent-module_MarkdownContent__2JuyX p{text-wrap:auto}.MarkdownContent-module_MarkdownContent__2JuyX ul{list-style:disc;margin-left:20px}.MarkdownContent-module_MarkdownContent__2JuyX ol{list-style:decimal;margin-left:20px}.MarkdownContent-module_MarkdownContent__2JuyX blockquote,.MarkdownContent-module_MarkdownContent__2JuyX img,.MarkdownContent-module_MarkdownContent__2JuyX pre,.MarkdownContent-module_MarkdownContent__2JuyX table{border-radius:8px;margin-bottom:10px;margin-top:10px}.MarkdownContent-module_MarkdownContent__2JuyX pre{background:#000;border:none;box-shadow:none;color:#fff;display:block;font-size:inherit;line-height:inherit;padding:1em}.MarkdownContent-module_MarkdownContent__2JuyX blockquote{background:#ffffffcc;border:none;box-shadow:none;color:#000;display:block;font-size:inherit;line-height:inherit;padding:1em}.MarkdownContent-module_MarkdownContent__2JuyX code{background:#cccccc55;border:none;box-shadow:none;color:inherit;display:inline-block;font-size:inherit;line-height:inherit;margin:0;padding:0}.MarkdownContent-module_MarkdownContent__2JuyX pre code{background-color:#000000cc;border-radius:8px}.MarkdownContent-module_MarkdownContent__2JuyX .MarkdownContent-module_chat-code-block__ZffFg{background:#181c23;border-color:#23272f;box-shadow:0 2px 8px rgba(0,0,0,.12);color:#f8fafc;font-family:Fira Mono,Menlo,Consolas,Liberation Mono,monospace;font-size:14px;line-height:1.6;overflow-x:auto}.MarkdownContent-module_MarkdownContent__2JuyX .MarkdownContent-module_chat-code-block__ZffFg code{background:none!important;border:none!important;box-shadow:none!important;color:inherit!important;display:block;font-family:inherit!important;font-size:inherit!important;overflow-x:auto;padding:0!important;white-space:pre;word-break:break-word}.MarkdownContent-module_MarkdownContent__2JuyX table{background:#f8fafc;border-collapse:separate;border-spacing:0;box-shadow:0 2px 8px rgba(0,0,0,.08);color:#17223b;font-size:14px;margin:16px 0;width:100%}.MarkdownContent-module_MarkdownContent__2JuyX td,.MarkdownContent-module_MarkdownContent__2JuyX th{background:none;border-bottom:1px solid #d1dbe8;color:#17223b;padding:10px 16px;text-align:left}.MarkdownContent-module_MarkdownContent__2JuyX th{background:linear-gradient(90deg,#eaf3fa 80%,#d1e3f8);border-bottom:2px solid #b5c7de;color:#17223b;font-weight:700}.MarkdownContent-module_MarkdownContent__2JuyX tr:last-child td{border-bottom:none}.MarkdownContent-module_MarkdownContent__2JuyX tr:nth-child(2n) td{background:#eaf3fa}.MarkdownContent-module_MarkdownContent__2JuyX tr:hover td{background:#cbe0f7;transition:background .2s}.MarkdownContent-module_MarkdownContent__2JuyX table{border-radius:12px;overflow:hidden}.MarkdownContent-module_MarkdownContent__2JuyX td:first-child,.MarkdownContent-module_MarkdownContent__2JuyX th:first-child{border-top-left-radius:12px}.MarkdownContent-module_MarkdownContent__2JuyX td:last-child,.MarkdownContent-module_MarkdownContent__2JuyX th:last-child{border-top-right-radius:12px}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIk1hcmtkb3duQ29udGVudC5tb2R1bGUuY3NzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGtEQUNJLGFBQ0osQ0FFQSxrREFDSSxnQkFDSixDQUVBLGtEQUNJLGVBQ0osQ0FFQSxrREFDSSxnQkFDSixDQUVBLGtEQUNJLGVBQ0osQ0FFQSxpREFDSSxjQUNKLENBRUEsa0RBQ0ksZUFBZ0IsQ0FDaEIsZ0JBQ0osQ0FFQSxrREFDSSxrQkFBbUIsQ0FDbkIsZ0JBQ0osQ0FFQSxxTkFNSSxpQkFBa0IsQ0FEbEIsa0JBQW1CLENBRG5CLGVBR0osQ0FFQSxtREFJSSxlQUFxQixDQUZyQixXQUFZLENBQ1osZUFBZ0IsQ0FJaEIsVUFBVyxDQU5YLGFBQWMsQ0FJZCxpQkFBa0IsQ0FDbEIsbUJBQW9CLENBRXBCLFdBQ0osQ0FFQSwwREFJSSxvQkFBcUIsQ0FGckIsV0FBWSxDQUNaLGVBQWdCLENBSWhCLFVBQVcsQ0FOWCxhQUFjLENBSWQsaUJBQWtCLENBQ2xCLG1CQUFvQixDQUVwQixXQUNKLENBRUEsb0RBTUksb0JBQXFCLENBRnJCLFdBQVksQ0FDWixlQUFnQixDQUloQixhQUFjLENBUmQsb0JBQXFCLENBTXJCLGlCQUFrQixDQUNsQixtQkFBb0IsQ0FOcEIsUUFBUyxDQUNULFNBT0osQ0FFQSx3REFDSSwwQkFBMkIsQ0FDM0IsaUJBQ0osQ0FFQSw4RkFDSSxrQkFBbUIsQ0FLbkIsb0JBQXFCLENBQ3JCLG9DQUF5QyxDQUx6QyxhQUFjLENBTWQsOERBQTJFLENBTDNFLGNBQWUsQ0FDZixlQUFnQixDQUNoQixlQUlKLENBQ0EsbUdBQ0kseUJBQTJCLENBSzNCLHFCQUF1QixDQUN2Qix5QkFBMkIsQ0FMM0IsdUJBQXlCLENBU3pCLGFBQWMsQ0FSZCw2QkFBK0IsQ0FDL0IsMkJBQTZCLENBTTdCLGVBQWdCLENBTGhCLG1CQUFxQixDQUdyQixlQUFnQixDQUNoQixxQkFHSixDQUNBLHFEQUtJLGtCQUFtQixDQUhuQix3QkFBeUIsQ0FDekIsZ0JBQWlCLENBS2pCLG9DQUF5QyxDQUV6QyxhQUFjLENBRGQsY0FBZSxDQUxmLGFBQWMsQ0FIZCxVQVVKLENBQ0Esb0dBTUksZUFBZ0IsQ0FIaEIsK0JBQWdDLENBRWhDLGFBQWMsQ0FIZCxpQkFBa0IsQ0FFbEIsZUFHSixDQUNBLGtEQUNJLHFEQUE2RCxDQUc3RCwrQkFBZ0MsQ0FEaEMsYUFBYyxDQURkLGVBR0osQ0FDQSxnRUFDSSxrQkFDSixDQUNBLG1FQUNJLGtCQUNKLENBQ0EsMkRBQ0ksa0JBQW1CLENBQ25CLHlCQUNKLENBQ0EscURBQ0ksa0JBQW1CLENBQ25CLGVBQ0osQ0FDQSw0SEFFSSwyQkFDSixDQUNBLDBIQUVJLDRCQUNKIiwiZmlsZSI6Ik1hcmtkb3duQ29udGVudC5tb2R1bGUuY3NzIiwic291cmNlc0NvbnRlbnQiOlsiLk1hcmtkb3duQ29udGVudCBoMSB7XG4gICAgZm9udC1zaXplOiAyZW07XG59XG5cbi5NYXJrZG93bkNvbnRlbnQgaDIge1xuICAgIGZvbnQtc2l6ZTogMS43NWVtO1xufVxuXG4uTWFya2Rvd25Db250ZW50IGgzIHtcbiAgICBmb250LXNpemU6IDEuNWVtO1xufVxuXG4uTWFya2Rvd25Db250ZW50IGg0IHtcbiAgICBmb250LXNpemU6IDEuMjVlbTtcbn1cblxuLk1hcmtkb3duQ29udGVudCBoNSB7XG4gICAgZm9udC1zaXplOiAxLjFlbTtcbn1cblxuLk1hcmtkb3duQ29udGVudCBwIHtcbiAgICB0ZXh0LXdyYXA6IGF1dG87XG59XG5cbi5NYXJrZG93bkNvbnRlbnQgdWwge1xuICAgIGxpc3Qtc3R5bGU6IGRpc2M7XG4gICAgbWFyZ2luLWxlZnQ6IDIwcHg7XG59XG5cbi5NYXJrZG93bkNvbnRlbnQgb2wge1xuICAgIGxpc3Qtc3R5bGU6IGRlY2ltYWw7XG4gICAgbWFyZ2luLWxlZnQ6IDIwcHg7XG59XG5cbi5NYXJrZG93bkNvbnRlbnQgaW1nLFxuLk1hcmtkb3duQ29udGVudCBwcmUsXG4uTWFya2Rvd25Db250ZW50IGJsb2NrcXVvdGUsXG4uTWFya2Rvd25Db250ZW50IHRhYmxlIHtcbiAgICBtYXJnaW4tdG9wOiAxMHB4O1xuICAgIG1hcmdpbi1ib3R0b206IDEwcHg7XG4gICAgYm9yZGVyLXJhZGl1czogOHB4O1xufVxuXG4uTWFya2Rvd25Db250ZW50IHByZSB7XG4gICAgZGlzcGxheTogYmxvY2s7XG4gICAgYm9yZGVyOiBub25lO1xuICAgIGJveC1zaGFkb3c6IG5vbmU7XG4gICAgYmFja2dyb3VuZDogIzAwMDAwMGZmO1xuICAgIGZvbnQtc2l6ZTogaW5oZXJpdDtcbiAgICBsaW5lLWhlaWdodDogaW5oZXJpdDtcbiAgICBjb2xvcjogI2ZmZjtcbiAgICBwYWRkaW5nOiAxZW07XG59XG5cbi5NYXJrZG93bkNvbnRlbnQgYmxvY2txdW90ZSB7XG4gICAgZGlzcGxheTogYmxvY2s7XG4gICAgYm9yZGVyOiBub25lO1xuICAgIGJveC1zaGFkb3c6IG5vbmU7XG4gICAgYmFja2dyb3VuZDogI2ZmZmZmZmNjO1xuICAgIGZvbnQtc2l6ZTogaW5oZXJpdDtcbiAgICBsaW5lLWhlaWdodDogaW5oZXJpdDtcbiAgICBjb2xvcjogIzAwMDtcbiAgICBwYWRkaW5nOiAxZW07XG59XG5cbi5NYXJrZG93bkNvbnRlbnQgY29kZSB7XG4gICAgZGlzcGxheTogaW5saW5lLWJsb2NrO1xuICAgIG1hcmdpbjogMDtcbiAgICBwYWRkaW5nOiAwO1xuICAgIGJvcmRlcjogbm9uZTtcbiAgICBib3gtc2hhZG93OiBub25lO1xuICAgIGJhY2tncm91bmQ6ICNjY2NjY2M1NTtcbiAgICBmb250LXNpemU6IGluaGVyaXQ7XG4gICAgbGluZS1oZWlnaHQ6IGluaGVyaXQ7XG4gICAgY29sb3I6IGluaGVyaXQ7XG59XG5cbi5NYXJrZG93bkNvbnRlbnQgcHJlIGNvZGUge1xuICAgIGJhY2tncm91bmQtY29sb3I6ICMwMDAwMDBjYztcbiAgICBib3JkZXItcmFkaXVzOiA4cHg7XG59XG5cbi5NYXJrZG93bkNvbnRlbnQgLmNoYXQtY29kZS1ibG9jayB7XG4gICAgYmFja2dyb3VuZDogIzE4MWMyMztcbiAgICBjb2xvcjogI2Y4ZmFmYztcbiAgICBmb250LXNpemU6IDE0cHg7XG4gICAgbGluZS1oZWlnaHQ6IDEuNjtcbiAgICBvdmVyZmxvdy14OiBhdXRvO1xuICAgIGJvcmRlci1jb2xvcjogIzIzMjcyZjtcbiAgICBib3gtc2hhZG93OiAwIDJweCA4cHggcmdiYSgwLCAwLCAwLCAwLjEyKTtcbiAgICBmb250LWZhbWlseTogJ0ZpcmEgTW9ubycsICdNZW5sbycsICdDb25zb2xhcycsICdMaWJlcmF0aW9uIE1vbm8nLCBtb25vc3BhY2U7XG59XG4uTWFya2Rvd25Db250ZW50IC5jaGF0LWNvZGUtYmxvY2sgY29kZSB7XG4gICAgYmFja2dyb3VuZDogbm9uZSAhaW1wb3J0YW50O1xuICAgIGNvbG9yOiBpbmhlcml0ICFpbXBvcnRhbnQ7XG4gICAgZm9udC1mYW1pbHk6IGluaGVyaXQgIWltcG9ydGFudDtcbiAgICBmb250LXNpemU6IGluaGVyaXQgIWltcG9ydGFudDtcbiAgICBwYWRkaW5nOiAwICFpbXBvcnRhbnQ7XG4gICAgYm9yZGVyOiBub25lICFpbXBvcnRhbnQ7XG4gICAgYm94LXNoYWRvdzogbm9uZSAhaW1wb3J0YW50O1xuICAgIHdoaXRlLXNwYWNlOiBwcmU7XG4gICAgd29yZC1icmVhazogYnJlYWstd29yZDtcbiAgICBvdmVyZmxvdy14OiBhdXRvO1xuICAgIGRpc3BsYXk6IGJsb2NrO1xufVxuLk1hcmtkb3duQ29udGVudCB0YWJsZSB7XG4gICAgd2lkdGg6IDEwMCU7XG4gICAgYm9yZGVyLWNvbGxhcHNlOiBzZXBhcmF0ZTtcbiAgICBib3JkZXItc3BhY2luZzogMDtcbiAgICBtYXJnaW46IDE2cHggMDtcbiAgICBiYWNrZ3JvdW5kOiAjZjhmYWZjOyAvKiBTdHJvbmdlciBsaWdodCBiYWNrZ3JvdW5kIGZvciBjb250cmFzdCAqL1xuICAgIGJvcmRlci1yYWRpdXM6IDEycHg7XG4gICAgb3ZlcmZsb3c6IGhpZGRlbjtcbiAgICBib3gtc2hhZG93OiAwIDJweCA4cHggcmdiYSgwLCAwLCAwLCAwLjA4KTtcbiAgICBmb250LXNpemU6IDE0cHg7XG4gICAgY29sb3I6ICMxNzIyM2I7IC8qIERhcmsgdGV4dCBmb3IgY29udHJhc3QgKi9cbn1cbi5NYXJrZG93bkNvbnRlbnQgdGgsXG4uTWFya2Rvd25Db250ZW50IHRkIHtcbiAgICBwYWRkaW5nOiAxMHB4IDE2cHg7XG4gICAgYm9yZGVyLWJvdHRvbTogMXB4IHNvbGlkICNkMWRiZTg7XG4gICAgdGV4dC1hbGlnbjogbGVmdDtcbiAgICBjb2xvcjogIzE3MjIzYjsgLyogRW5zdXJlIHN0cm9uZyB0ZXh0IGNvbG9yIGZvciBhbGwgY2VsbHMgKi9cbiAgICBiYWNrZ3JvdW5kOiBub25lO1xufVxuLk1hcmtkb3duQ29udGVudCB0aCB7XG4gICAgYmFja2dyb3VuZDogbGluZWFyLWdyYWRpZW50KDkwZGVnLCAjZWFmM2ZhIDgwJSwgI2QxZTNmOCAxMDAlKTtcbiAgICBmb250LXdlaWdodDogNzAwO1xuICAgIGNvbG9yOiAjMTcyMjNiOyAvKiBTdHJvbmcgaGVhZGVyIHRleHQgKi9cbiAgICBib3JkZXItYm90dG9tOiAycHggc29saWQgI2I1YzdkZTtcbn1cbi5NYXJrZG93bkNvbnRlbnQgdHI6bGFzdC1jaGlsZCB0ZCB7XG4gICAgYm9yZGVyLWJvdHRvbTogbm9uZTtcbn1cbi5NYXJrZG93bkNvbnRlbnQgdHI6bnRoLWNoaWxkKGV2ZW4pIHRkIHtcbiAgICBiYWNrZ3JvdW5kOiAjZWFmM2ZhO1xufVxuLk1hcmtkb3duQ29udGVudCB0cjpob3ZlciB0ZCB7XG4gICAgYmFja2dyb3VuZDogI2NiZTBmNztcbiAgICB0cmFuc2l0aW9uOiBiYWNrZ3JvdW5kIDAuMnM7XG59XG4uTWFya2Rvd25Db250ZW50IHRhYmxlIHtcbiAgICBib3JkZXItcmFkaXVzOiAxMnB4O1xuICAgIG92ZXJmbG93OiBoaWRkZW47XG59XG4uTWFya2Rvd25Db250ZW50IHRoOmZpcnN0LWNoaWxkLFxuLk1hcmtkb3duQ29udGVudCB0ZDpmaXJzdC1jaGlsZCB7XG4gICAgYm9yZGVyLXRvcC1sZWZ0LXJhZGl1czogMTJweDtcbn1cbi5NYXJrZG93bkNvbnRlbnQgdGg6bGFzdC1jaGlsZCxcbi5NYXJrZG93bkNvbnRlbnQgdGQ6bGFzdC1jaGlsZCB7XG4gICAgYm9yZGVyLXRvcC1yaWdodC1yYWRpdXM6IDEycHg7XG59XG5cbi8qKlxuICogVE9ETzogW/CfjIldIERSWSBNYXJrZG93biBwcmltaXRpdmVzIHN0eWxpbmdcbiAqL1xuIl19 */";
|
|
11373
13127
|
var styles$3 = {"MarkdownContent":"MarkdownContent-module_MarkdownContent__2JuyX","chat-code-block":"MarkdownContent-module_chat-code-block__ZffFg"};
|
|
11374
13128
|
styleInject(css_248z$4);
|
|
11375
13129
|
|
|
@@ -12456,6 +14210,7 @@ const htmlSaveFormatDefinition = {
|
|
|
12456
14210
|
fileExtension: 'html',
|
|
12457
14211
|
};
|
|
12458
14212
|
/**
|
|
14213
|
+
* TODO: !!! Add QR code with branding to the footer
|
|
12459
14214
|
* TODO: [😬] Take chat save to HTML from existing parallel implementation
|
|
12460
14215
|
*/
|
|
12461
14216
|
|
|
@@ -12515,6 +14270,10 @@ const pdfSaveFormatDefinition = {
|
|
|
12515
14270
|
mimeType: 'application/pdf',
|
|
12516
14271
|
fileExtension: 'pdf',
|
|
12517
14272
|
};
|
|
14273
|
+
/**
|
|
14274
|
+
* TODO: !!! Add QR code with branding to the footer
|
|
14275
|
+
* TODO: !!! Add print option
|
|
14276
|
+
*/
|
|
12518
14277
|
|
|
12519
14278
|
/**
|
|
12520
14279
|
* React <jsx/> export plugin (full metadata)
|