@promptbook/core 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.
Files changed (26) hide show
  1. package/esm/index.es.js +2170 -208
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/src/_packages/core.index.d.ts +4 -0
  4. package/esm/typings/src/_packages/types.index.d.ts +5 -1
  5. package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +1 -0
  6. package/esm/typings/src/book-components/Chat/save/html/htmlSaveFormatDefinition.d.ts +1 -0
  7. package/esm/typings/src/book-components/Chat/save/pdf/pdfSaveFormatDefinition.d.ts +4 -0
  8. package/esm/typings/src/book-components/_common/Tooltip/Tooltip.d.ts +47 -0
  9. package/esm/typings/src/errors/0-index.d.ts +3 -0
  10. package/esm/typings/src/errors/NotAllowed.d.ts +9 -0
  11. package/esm/typings/src/execution/AvailableModel.d.ts +1 -0
  12. package/esm/typings/src/execution/Executables.d.ts +3 -0
  13. package/esm/typings/src/execution/ExecutionTools.d.ts +5 -0
  14. package/esm/typings/src/execution/LlmExecutionTools.d.ts +1 -1
  15. package/esm/typings/src/llm-providers/agent/Agent.d.ts +44 -0
  16. package/esm/typings/src/llm-providers/agent/AgentOptions.d.ts +17 -0
  17. package/esm/typings/src/llm-providers/agent/CreateAgentLlmExecutionToolsOptions.d.ts +16 -0
  18. package/esm/typings/src/llm-providers/agent/createAgentLlmExecutionTools.d.ts +1 -15
  19. package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +12 -0
  20. package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionToolsOptions.d.ts +7 -1
  21. package/esm/typings/src/remote-server/startRemoteServer.d.ts +2 -0
  22. package/esm/typings/src/types/Updatable.d.ts +19 -0
  23. package/esm/typings/src/version.d.ts +1 -1
  24. package/package.json +2 -1
  25. package/umd/index.umd.js +2174 -210
  26. package/umd/index.umd.js.map +1 -1
package/esm/index.es.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import spaceTrim, { spaceTrim as spaceTrim$1 } from 'spacetrim';
2
2
  import { randomBytes } from 'crypto';
3
- import { Subject } from 'rxjs';
3
+ import { Subject, BehaviorSubject } from 'rxjs';
4
4
  import { forTime } from 'waitasecond';
5
5
  import hexEncoder from 'crypto-js/enc-hex';
6
6
  import sha256 from 'crypto-js/sha256';
@@ -10,6 +10,8 @@ import { lookup, extension } from 'mime-types';
10
10
  import { parse, unparse } from 'papaparse';
11
11
  import moment from 'moment';
12
12
  import colors from 'colors';
13
+ import Bottleneck from 'bottleneck';
14
+ import OpenAI from 'openai';
13
15
 
14
16
  // ⚠️ WARNING: This code has been generated so that any manual changes will be overwritten
15
17
  /**
@@ -25,13 +27,13 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
25
27
  * @generated
26
28
  * @see https://github.com/webgptorg/promptbook
27
29
  */
28
- const PROMPTBOOK_ENGINE_VERSION = '0.103.0-35';
30
+ const PROMPTBOOK_ENGINE_VERSION = '0.103.0-37';
29
31
  /**
30
32
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
31
33
  * Note: [💞] Ignore a discrepancy between file name and entity name
32
34
  */
33
35
 
34
- 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"}];
36
+ 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"}];
35
37
 
36
38
  /**
37
39
  * Checks if value is valid email
@@ -1246,6 +1248,13 @@ const VALUE_STRINGS = {
1246
1248
  * @public exported from `@promptbook/utils`
1247
1249
  */
1248
1250
  const SMALL_NUMBER = 0.001;
1251
+ // <- TODO: [⏳] Standardize timeouts, Make DEFAULT_TIMEOUT_MS as global constant
1252
+ /**
1253
+ * How many times to retry the connections
1254
+ *
1255
+ * @private within the repository - too low-level in comparison with other `MAX_...`
1256
+ */
1257
+ const CONNECTION_RETRIES_LIMIT = 5;
1249
1258
  /**
1250
1259
  * Short time interval to prevent race conditions in milliseconds
1251
1260
  *
@@ -2083,6 +2092,12 @@ const ORDER_OF_PIPELINE_JSON = [
2083
2092
  * @private within the repository
2084
2093
  */
2085
2094
  const REPLACING_NONCE = 'ptbkauk42kV2dzao34faw7FudQUHYPtW';
2095
+ /**
2096
+ * Nonce which is used as string which is not occurring in normal text
2097
+ *
2098
+ * @private within the repository
2099
+ */
2100
+ const SALT_NONCE = 'ptbkghhewbvruets21t54et5';
2086
2101
  /**
2087
2102
  * Placeholder value indicating a parameter is missing its value.
2088
2103
  *
@@ -2862,6 +2877,19 @@ class LimitReachedError extends Error {
2862
2877
  }
2863
2878
  }
2864
2879
 
2880
+ /**
2881
+ * This error indicates that promptbook operation is not allowed
2882
+ *
2883
+ * @public exported from `@promptbook/core`
2884
+ */
2885
+ class NotAllowed extends Error {
2886
+ constructor(message) {
2887
+ super(message);
2888
+ this.name = 'NotAllowed';
2889
+ Object.setPrototypeOf(this, NotAllowed.prototype);
2890
+ }
2891
+ }
2892
+
2865
2893
  /**
2866
2894
  * This error type indicates that some part of the code is not implemented yet
2867
2895
  *
@@ -2956,6 +2984,7 @@ const PROMPTBOOK_ERRORS = {
2956
2984
  PromptbookFetchError,
2957
2985
  UnexpectedError,
2958
2986
  WrappedError,
2987
+ NotAllowed,
2959
2988
  // TODO: [🪑]> VersionMismatchError,
2960
2989
  };
2961
2990
  /**
@@ -9903,6 +9932,9 @@ const DEFAULT_BOOK = padBook(validateBook(spaceTrim(`
9903
9932
  PERSONA A friendly AI assistant that helps you with your tasks
9904
9933
  `)));
9905
9934
  // <- Note: Not using book`...` notation to avoid strange error in jest unit tests `TypeError: (0 , book_notation_1.book) is not a function`
9935
+ // <- TODO: !!! GENESIS_BOOK
9936
+ // <- !!! Buttons into genesis book
9937
+ // <- TODO: !!! createBookBoilerplate and deprecate `DEFAULT_BOOK`
9906
9938
 
9907
9939
  /**
9908
9940
  * Converts PipelineCollection to serialized JSON
@@ -14725,6 +14757,90 @@ function limitTotalUsage(llmTools, options = {}) {
14725
14757
  * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
14726
14758
  */
14727
14759
 
14760
+ /**
14761
+ * Restricts an Updatable to a (2) BehaviorSubject variant
14762
+ *
14763
+ * @see Updatable
14764
+ * @private internal utility <- TODO: [🧠] Maybe export from `@promptbook/types`
14765
+ */
14766
+ function asUpdatableSubject(value) {
14767
+ if (value instanceof BehaviorSubject) {
14768
+ return value;
14769
+ }
14770
+ else if (Array.isArray(value)) {
14771
+ if (value.length !== 2) {
14772
+ throw new TypeError('`asUpdatableSubject`: Invalid tuple length, expected 2 elements');
14773
+ }
14774
+ if (typeof value[1] !== 'function') {
14775
+ throw new TypeError('`asUpdatableSubject`: Invalid tuple, expected second element to be a function');
14776
+ }
14777
+ const [theValue, setValue] = value;
14778
+ const subject = new BehaviorSubject(theValue);
14779
+ subject.subscribe((newValue) => {
14780
+ setValue(newValue);
14781
+ });
14782
+ return subject;
14783
+ }
14784
+ else {
14785
+ return new BehaviorSubject(value);
14786
+ }
14787
+ }
14788
+ /**
14789
+ * TODO: [🧠] Maybe `BehaviorSubject` is too heavy for this use case, maybe just tuple `[value,setValue]` is enough
14790
+ */
14791
+
14792
+ /**
14793
+ * Note: !!!! `Agent` vs `LlmExecutionTools`
14794
+ *
14795
+ *
14796
+ * @public exported from `@promptbook/core`
14797
+ */
14798
+ class Agent {
14799
+ /**
14800
+ * Not used in Agent, always returns empty array
14801
+ */
14802
+ get parameters() {
14803
+ return [
14804
+ /* [😰] */
14805
+ ];
14806
+ }
14807
+ constructor(options) {
14808
+ this.options = options;
14809
+ /**
14810
+ * Name of the agent
14811
+ */
14812
+ this.agentName = null;
14813
+ /**
14814
+ * Description of the agent
14815
+ */
14816
+ this.personaDescription = null;
14817
+ /**
14818
+ * Metadata like image or color
14819
+ */
14820
+ this.meta = {};
14821
+ this.agentSource = asUpdatableSubject(options.agentSource);
14822
+ this.agentSource.subscribe((source) => {
14823
+ const { agentName, personaDescription, meta } = parseAgentSource(source);
14824
+ this.agentName = agentName;
14825
+ this.personaDescription = personaDescription;
14826
+ this.meta = { ...this.meta, ...meta };
14827
+ });
14828
+ }
14829
+ /**
14830
+ * Creates LlmExecutionTools which exposes the agent as a model
14831
+ */
14832
+ getLlmExecutionTools() {
14833
+ const llmTools = new AgentLlmExecutionTools(getSingleLlmExecutionTools(this.options.executionTools.llm), this.agentSource.value);
14834
+ // TODO: !!!! Add `Agent` simple "mocked" learning by appending to agent source
14835
+ // TODO: !!!! Add `Agent` learning by promptbookAgent
14836
+ return llmTools;
14837
+ }
14838
+ }
14839
+ /**
14840
+ * TODO: [🧠][😰]Agent is not working with the parameters, should it be?
14841
+ * TODO: !!! Agent on remote server
14842
+ */
14843
+
14728
14844
  /**
14729
14845
  * Change ellipsis character to three dots `…` -> `...`
14730
14846
  *
@@ -14865,226 +14981,1936 @@ function promptbookifyAiText(text) {
14865
14981
  */
14866
14982
 
14867
14983
  /**
14868
- * Execution Tools for calling LLM models with a predefined agent "soul"
14869
- * This wraps underlying LLM execution tools and applies agent-specific system prompts and requirements
14984
+ * Helper of usage compute
14870
14985
  *
14871
- * @public exported from `@promptbook/core`
14986
+ * @param content the content of prompt or response
14987
+ * @returns part of UsageCounts
14988
+ *
14989
+ * @private internal utility of LlmExecutionTools
14872
14990
  */
14873
- class AgentLlmExecutionTools {
14874
- /**
14875
- * Creates new AgentLlmExecutionTools
14876
- *
14877
- * @param llmTools The underlying LLM execution tools to wrap
14878
- * @param agentSource The agent source string that defines the agent's behavior
14879
- */
14880
- constructor(llmTools, agentSource) {
14881
- this.llmTools = llmTools;
14882
- this.agentSource = agentSource;
14883
- /**
14884
- * Cached model requirements to avoid re-parsing the agent source
14885
- */
14886
- this._cachedModelRequirements = null;
14887
- /**
14888
- * Cached parsed agent information
14889
- */
14890
- this._cachedAgentInfo = null;
14891
- }
14892
- /**
14893
- * Get cached or parse agent information
14894
- */
14895
- getAgentInfo() {
14896
- if (this._cachedAgentInfo === null) {
14897
- this._cachedAgentInfo = parseAgentSource(this.agentSource);
14898
- }
14899
- return this._cachedAgentInfo;
14900
- }
14901
- /**
14902
- * Get cached or create agent model requirements
14903
- */
14904
- async getAgentModelRequirements() {
14905
- if (this._cachedModelRequirements === null) {
14906
- // Get available models from underlying LLM tools for best model selection
14907
- const availableModels = await this.llmTools.listModels();
14908
- this._cachedModelRequirements = await createAgentModelRequirements(this.agentSource, undefined, // Let the function pick the best model
14909
- availableModels);
14910
- }
14911
- return this._cachedModelRequirements;
14912
- }
14913
- get title() {
14914
- const agentInfo = this.getAgentInfo();
14915
- return (agentInfo.agentName || 'Agent');
14916
- }
14917
- get description() {
14918
- const agentInfo = this.getAgentInfo();
14919
- return agentInfo.personaDescription || 'AI Agent with predefined personality and behavior';
14920
- }
14921
- get profile() {
14922
- const agentInfo = this.getAgentInfo();
14923
- if (!agentInfo.agentName) {
14924
- return undefined;
14925
- }
14926
- return {
14927
- name: agentInfo.agentName.toUpperCase().replace(/\s+/g, '_'),
14928
- fullname: agentInfo.agentName,
14929
- color: agentInfo.meta.color || '#6366f1',
14930
- avatarSrc: agentInfo.meta.image,
14931
- };
14932
- }
14933
- checkConfiguration() {
14934
- // Check underlying tools configuration
14935
- return this.llmTools.checkConfiguration();
14936
- }
14937
- /**
14938
- * Returns a virtual model name representing the agent behavior
14939
- */
14940
- get modelName() {
14941
- const hash = SHA256(hexEncoder.parse(this.agentSource))
14942
- // <- TODO: [🥬] Encapsulate sha256 to some private utility function
14943
- .toString( /* hex */);
14944
- // <- TODO: [🥬] Make some system for hashes and ids of promptbook
14945
- const agentId = hash.substring(0, 10);
14946
- // <- TODO: [🥬] Make some system for hashes and ids of promptbook
14947
- return (normalizeToKebabCase(this.title) + '-' + agentId);
14948
- }
14949
- listModels() {
14950
- return [
14951
- {
14952
- modelName: this.modelName,
14953
- modelVariant: 'CHAT',
14954
- modelTitle: `${this.title} (Agent Chat Default)`,
14955
- modelDescription: `Chat model with agent behavior: ${this.description}`,
14956
- },
14957
- // <- Note: We only list a single "virtual" agent model here as this wrapper only supports chat prompts
14958
- ];
14959
- }
14960
- /**
14961
- * Calls the chat model with agent-specific system prompt and requirements
14962
- */
14963
- async callChatModel(prompt) {
14964
- if (!this.llmTools.callChatModel) {
14965
- throw new Error('Underlying LLM execution tools do not support chat model calls');
14966
- }
14967
- // Ensure we're working with a chat prompt
14968
- if (prompt.modelRequirements.modelVariant !== 'CHAT') {
14969
- throw new Error('AgentLlmExecutionTools only supports chat prompts');
14970
- }
14971
- const chatPrompt = prompt;
14972
- // Get agent model requirements (cached with best model selection)
14973
- const modelRequirements = await this.getAgentModelRequirements();
14974
- // Create modified chat prompt with agent system message
14975
- const modifiedChatPrompt = {
14976
- ...chatPrompt,
14977
- modelRequirements: {
14978
- ...chatPrompt.modelRequirements,
14979
- ...modelRequirements,
14980
- // Prepend agent system message to existing system message
14981
- systemMessage: modelRequirements.systemMessage +
14982
- (chatPrompt.modelRequirements.systemMessage
14983
- ? `\n\n${chatPrompt.modelRequirements.systemMessage}`
14984
- : ''),
14985
- },
14986
- };
14987
- const underlyingLlmResult = await this.llmTools.callChatModel(modifiedChatPrompt);
14988
- let content = underlyingLlmResult.content;
14989
- // Note: Cleanup the AI artifacts from the content
14990
- content = humanizeAiText(content);
14991
- // Note: Make sure the content is Promptbook-like
14992
- content = promptbookifyAiText(content);
14993
- const agentResult = {
14994
- ...underlyingLlmResult,
14995
- content,
14996
- modelName: this.modelName,
14997
- };
14998
- return agentResult;
14999
- }
14991
+ function computeUsageCounts(content) {
14992
+ return {
14993
+ charactersCount: { value: countCharacters(content) },
14994
+ wordsCount: { value: countWords(content) },
14995
+ sentencesCount: { value: countSentences(content) },
14996
+ linesCount: { value: countLines(content) },
14997
+ paragraphsCount: { value: countParagraphs(content) },
14998
+ pagesCount: { value: countPages(content) },
14999
+ };
15000
15000
  }
15001
- /**
15002
- * TODO: [🍚] Implement Destroyable pattern to free resources
15003
- * TODO: [🧠] Adding parameter substitution support (here or should be responsibility of the underlying LLM Tools)
15004
- */
15005
15001
 
15006
15002
  /**
15007
- * Creates new AgentLlmExecutionTools that wrap underlying LLM tools with agent-specific behavior
15003
+ * Make UncertainNumber
15008
15004
  *
15009
- * @public exported from `@promptbook/core`
15010
- */
15011
- const createAgentLlmExecutionTools = Object.assign((options) => {
15012
- return new AgentLlmExecutionTools(options.llmTools, options.agentSource);
15013
- }, {
15014
- packageName: '@promptbook/core',
15015
- className: 'AgentLlmExecutionTools',
15016
- });
15017
- /**
15018
- * TODO: [🧠] Consider adding validation for agent source format
15019
- * TODO: [🧠] Consider adding options for caching behavior
15020
- */
15021
-
15022
- /**
15023
- * Metadata for Agent LLM execution tools
15005
+ * @param value value of the uncertain number, if `NaN` or `undefined`, it will be set to 0 and `isUncertain=true`
15006
+ * @param isUncertain if `true`, the value is uncertain, otherwise depends on the value
15024
15007
  *
15025
- * @public exported from `@promptbook/core`
15026
- */
15027
- const _AgentMetadata = $llmToolsMetadataRegister.register({
15028
- packageName: '@promptbook/core',
15029
- className: 'AgentLlmExecutionTools',
15030
- title: 'Agent',
15031
- trustLevel: 'UNTRUSTED',
15032
- order: MODEL_ORDERS.LOW_TIER,
15033
- envVariables: null,
15034
- getBoilerplateConfiguration() {
15035
- return {
15036
- packageName: '@promptbook/core',
15037
- className: 'AgentLlmExecutionTools',
15038
- title: 'Agent',
15039
- options: {
15040
- // Note: Agent tools require runtime configuration with underlying tools and agent source
15041
- // This cannot be provided as a static configuration
15042
- },
15043
- };
15044
- },
15045
- createConfigurationFromEnv() {
15046
- // Agent tools cannot be configured from environment variables alone
15047
- // They require underlying LLM tools and agent source to be provided programmatically
15048
- return null;
15049
- },
15050
- });
15051
- /**
15052
- * TODO: [🧠] Consider adding a special trust level for AgentLlmExecutionTools
15053
- * TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
15054
- * Note: [💞] Ignore a discrepancy between file name and entity name
15008
+ * @private utility for initializating UncertainNumber
15055
15009
  */
15010
+ function uncertainNumber(value, isUncertain) {
15011
+ if (value === null || value === undefined || Number.isNaN(value)) {
15012
+ return UNCERTAIN_ZERO_VALUE;
15013
+ }
15014
+ if (isUncertain === true) {
15015
+ return { value, isUncertain };
15016
+ }
15017
+ return { value };
15018
+ }
15056
15019
 
15057
15020
  /**
15058
- * Registration of Agent LLM provider
15059
- *
15060
- * Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available LLM tools
15021
+ * Create price per one token based on the string value found on openai page
15061
15022
  *
15062
- * @public exported from `@promptbook/core`
15063
- */
15064
- const _AgentRegistration = $llmToolsRegister.register(createAgentLlmExecutionTools);
15065
- /**
15066
- * TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
15067
- * Note: [💞] Ignore a discrepancy between file name and entity name
15023
+ * @private within the repository, used only as internal helper for `OPENAI_MODELS`
15068
15024
  */
15025
+ function pricing(value) {
15026
+ const [price, tokens] = value.split(' / ');
15027
+ return parseFloat(price.replace('$', '')) / parseFloat(tokens.replace('M tokens', '')) / 1000000;
15028
+ }
15069
15029
 
15070
15030
  /**
15071
- * Registration of LLM provider metadata
15031
+ * List of available OpenAI models with pricing
15072
15032
  *
15073
- * Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available LLM tools
15033
+ * Note: Synced with official API docs at 2025-08-20
15074
15034
  *
15075
- * @public exported from `@promptbook/core`
15076
- * @public exported from `@promptbook/wizard`
15077
- * @public exported from `@promptbook/cli`
15035
+ * @see https://platform.openai.com/docs/models/
15036
+ * @see https://openai.com/api/pricing/
15037
+ * @public exported from `@promptbook/openai`
15078
15038
  */
15079
- const _AnthropicClaudeMetadataRegistration = $llmToolsMetadataRegister.register({
15080
- title: 'Anthropic Claude',
15081
- packageName: '@promptbook/anthropic-claude',
15082
- className: 'AnthropicClaudeExecutionTools',
15083
- envVariables: ['ANTHROPIC_CLAUDE_API_KEY'],
15084
- trustLevel: 'CLOSED',
15085
- order: MODEL_ORDERS.TOP_TIER,
15086
- getBoilerplateConfiguration() {
15087
- return {
15039
+ const OPENAI_MODELS = exportJson({
15040
+ name: 'OPENAI_MODELS',
15041
+ value: [
15042
+ /**/
15043
+ {
15044
+ modelVariant: 'CHAT',
15045
+ modelTitle: 'gpt-5',
15046
+ modelName: 'gpt-5',
15047
+ 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.",
15048
+ pricing: {
15049
+ prompt: pricing(`$1.25 / 1M tokens`),
15050
+ output: pricing(`$10.00 / 1M tokens`),
15051
+ },
15052
+ },
15053
+ /**/
15054
+ /**/
15055
+ {
15056
+ modelVariant: 'CHAT',
15057
+ modelTitle: 'gpt-5-mini',
15058
+ modelName: 'gpt-5-mini',
15059
+ 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.',
15060
+ pricing: {
15061
+ prompt: pricing(`$0.25 / 1M tokens`),
15062
+ output: pricing(`$2.00 / 1M tokens`),
15063
+ },
15064
+ },
15065
+ /**/
15066
+ /**/
15067
+ {
15068
+ modelVariant: 'CHAT',
15069
+ modelTitle: 'gpt-5-nano',
15070
+ modelName: 'gpt-5-nano',
15071
+ 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.',
15072
+ pricing: {
15073
+ prompt: pricing(`$0.05 / 1M tokens`),
15074
+ output: pricing(`$0.40 / 1M tokens`),
15075
+ },
15076
+ },
15077
+ /**/
15078
+ /**/
15079
+ {
15080
+ modelVariant: 'CHAT',
15081
+ modelTitle: 'gpt-4.1',
15082
+ modelName: 'gpt-4.1',
15083
+ 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.',
15084
+ pricing: {
15085
+ prompt: pricing(`$3.00 / 1M tokens`),
15086
+ output: pricing(`$12.00 / 1M tokens`),
15087
+ },
15088
+ },
15089
+ /**/
15090
+ /**/
15091
+ {
15092
+ modelVariant: 'CHAT',
15093
+ modelTitle: 'gpt-4.1-mini',
15094
+ modelName: 'gpt-4.1-mini',
15095
+ 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.',
15096
+ pricing: {
15097
+ prompt: pricing(`$0.80 / 1M tokens`),
15098
+ output: pricing(`$3.20 / 1M tokens`),
15099
+ },
15100
+ },
15101
+ /**/
15102
+ /**/
15103
+ {
15104
+ modelVariant: 'CHAT',
15105
+ modelTitle: 'gpt-4.1-nano',
15106
+ modelName: 'gpt-4.1-nano',
15107
+ 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.',
15108
+ pricing: {
15109
+ prompt: pricing(`$0.20 / 1M tokens`),
15110
+ output: pricing(`$0.80 / 1M tokens`),
15111
+ },
15112
+ },
15113
+ /**/
15114
+ /**/
15115
+ {
15116
+ modelVariant: 'CHAT',
15117
+ modelTitle: 'o3',
15118
+ modelName: 'o3',
15119
+ 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.',
15120
+ pricing: {
15121
+ prompt: pricing(`$15.00 / 1M tokens`),
15122
+ output: pricing(`$60.00 / 1M tokens`),
15123
+ },
15124
+ },
15125
+ /**/
15126
+ /**/
15127
+ {
15128
+ modelVariant: 'CHAT',
15129
+ modelTitle: 'o3-pro',
15130
+ modelName: 'o3-pro',
15131
+ 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.',
15132
+ pricing: {
15133
+ prompt: pricing(`$30.00 / 1M tokens`),
15134
+ output: pricing(`$120.00 / 1M tokens`),
15135
+ },
15136
+ },
15137
+ /**/
15138
+ /**/
15139
+ {
15140
+ modelVariant: 'CHAT',
15141
+ modelTitle: 'o4-mini',
15142
+ modelName: 'o4-mini',
15143
+ 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.',
15144
+ pricing: {
15145
+ prompt: pricing(`$4.00 / 1M tokens`),
15146
+ output: pricing(`$16.00 / 1M tokens`),
15147
+ },
15148
+ },
15149
+ /**/
15150
+ /**/
15151
+ {
15152
+ modelVariant: 'CHAT',
15153
+ modelTitle: 'o3-deep-research',
15154
+ modelName: 'o3-deep-research',
15155
+ 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.',
15156
+ pricing: {
15157
+ prompt: pricing(`$25.00 / 1M tokens`),
15158
+ output: pricing(`$100.00 / 1M tokens`),
15159
+ },
15160
+ },
15161
+ /**/
15162
+ /**/
15163
+ {
15164
+ modelVariant: 'CHAT',
15165
+ modelTitle: 'o4-mini-deep-research',
15166
+ modelName: 'o4-mini-deep-research',
15167
+ 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.',
15168
+ pricing: {
15169
+ prompt: pricing(`$12.00 / 1M tokens`),
15170
+ output: pricing(`$48.00 / 1M tokens`),
15171
+ },
15172
+ },
15173
+ /**/
15174
+ /*/
15175
+ {
15176
+ modelTitle: 'dall-e-3',
15177
+ modelName: 'dall-e-3',
15178
+ },
15179
+ /**/
15180
+ /*/
15181
+ {
15182
+ modelTitle: 'whisper-1',
15183
+ modelName: 'whisper-1',
15184
+ },
15185
+ /**/
15186
+ /**/
15187
+ {
15188
+ modelVariant: 'COMPLETION',
15189
+ modelTitle: 'davinci-002',
15190
+ modelName: 'davinci-002',
15191
+ 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.',
15192
+ pricing: {
15193
+ prompt: pricing(`$2.00 / 1M tokens`),
15194
+ output: pricing(`$2.00 / 1M tokens`),
15195
+ },
15196
+ },
15197
+ /**/
15198
+ /*/
15199
+ {
15200
+ modelTitle: 'dall-e-2',
15201
+ modelName: 'dall-e-2',
15202
+ },
15203
+ /**/
15204
+ /**/
15205
+ {
15206
+ modelVariant: 'CHAT',
15207
+ modelTitle: 'gpt-3.5-turbo-16k',
15208
+ modelName: 'gpt-3.5-turbo-16k',
15209
+ 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.',
15210
+ pricing: {
15211
+ prompt: pricing(`$3.00 / 1M tokens`),
15212
+ output: pricing(`$4.00 / 1M tokens`),
15213
+ },
15214
+ },
15215
+ /**/
15216
+ /*/
15217
+ {
15218
+ modelTitle: 'tts-1-hd-1106',
15219
+ modelName: 'tts-1-hd-1106',
15220
+ },
15221
+ /**/
15222
+ /*/
15223
+ {
15224
+ modelTitle: 'tts-1-hd',
15225
+ modelName: 'tts-1-hd',
15226
+ },
15227
+ /**/
15228
+ /**/
15229
+ {
15230
+ modelVariant: 'CHAT',
15231
+ modelTitle: 'gpt-4',
15232
+ modelName: 'gpt-4',
15233
+ 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.',
15234
+ pricing: {
15235
+ prompt: pricing(`$30.00 / 1M tokens`),
15236
+ output: pricing(`$60.00 / 1M tokens`),
15237
+ },
15238
+ },
15239
+ /**/
15240
+ /**/
15241
+ {
15242
+ modelVariant: 'CHAT',
15243
+ modelTitle: 'gpt-4-32k',
15244
+ modelName: 'gpt-4-32k',
15245
+ 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.',
15246
+ pricing: {
15247
+ prompt: pricing(`$60.00 / 1M tokens`),
15248
+ output: pricing(`$120.00 / 1M tokens`),
15249
+ },
15250
+ },
15251
+ /**/
15252
+ /*/
15253
+ {
15254
+ modelVariant: 'CHAT',
15255
+ modelTitle: 'gpt-4-0613',
15256
+ modelName: 'gpt-4-0613',
15257
+ pricing: {
15258
+ prompt: computeUsage(` / 1M tokens`),
15259
+ output: computeUsage(` / 1M tokens`),
15260
+ },
15261
+ },
15262
+ /**/
15263
+ /**/
15264
+ {
15265
+ modelVariant: 'CHAT',
15266
+ modelTitle: 'gpt-4-turbo-2024-04-09',
15267
+ modelName: 'gpt-4-turbo-2024-04-09',
15268
+ 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.',
15269
+ pricing: {
15270
+ prompt: pricing(`$10.00 / 1M tokens`),
15271
+ output: pricing(`$30.00 / 1M tokens`),
15272
+ },
15273
+ },
15274
+ /**/
15275
+ /**/
15276
+ {
15277
+ modelVariant: 'CHAT',
15278
+ modelTitle: 'gpt-3.5-turbo-1106',
15279
+ modelName: 'gpt-3.5-turbo-1106',
15280
+ 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.',
15281
+ pricing: {
15282
+ prompt: pricing(`$1.00 / 1M tokens`),
15283
+ output: pricing(`$2.00 / 1M tokens`),
15284
+ },
15285
+ },
15286
+ /**/
15287
+ /**/
15288
+ {
15289
+ modelVariant: 'CHAT',
15290
+ modelTitle: 'gpt-4-turbo',
15291
+ modelName: 'gpt-4-turbo',
15292
+ 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.',
15293
+ pricing: {
15294
+ prompt: pricing(`$10.00 / 1M tokens`),
15295
+ output: pricing(`$30.00 / 1M tokens`),
15296
+ },
15297
+ },
15298
+ /**/
15299
+ /**/
15300
+ {
15301
+ modelVariant: 'COMPLETION',
15302
+ modelTitle: 'gpt-3.5-turbo-instruct-0914',
15303
+ modelName: 'gpt-3.5-turbo-instruct-0914',
15304
+ 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.',
15305
+ pricing: {
15306
+ prompt: pricing(`$1.50 / 1M tokens`),
15307
+ output: pricing(`$2.00 / 1M tokens`),
15308
+ },
15309
+ },
15310
+ /**/
15311
+ /**/
15312
+ {
15313
+ modelVariant: 'COMPLETION',
15314
+ modelTitle: 'gpt-3.5-turbo-instruct',
15315
+ modelName: 'gpt-3.5-turbo-instruct',
15316
+ 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.',
15317
+ pricing: {
15318
+ prompt: pricing(`$1.50 / 1M tokens`),
15319
+ output: pricing(`$2.00 / 1M tokens`),
15320
+ },
15321
+ },
15322
+ /**/
15323
+ /*/
15324
+ {
15325
+ modelTitle: 'tts-1',
15326
+ modelName: 'tts-1',
15327
+ },
15328
+ /**/
15329
+ /**/
15330
+ {
15331
+ modelVariant: 'CHAT',
15332
+ modelTitle: 'gpt-3.5-turbo',
15333
+ modelName: 'gpt-3.5-turbo',
15334
+ 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.',
15335
+ pricing: {
15336
+ prompt: pricing(`$0.50 / 1M tokens`),
15337
+ output: pricing(`$1.50 / 1M tokens`),
15338
+ },
15339
+ },
15340
+ /**/
15341
+ /**/
15342
+ {
15343
+ modelVariant: 'CHAT',
15344
+ modelTitle: 'gpt-3.5-turbo-0301',
15345
+ modelName: 'gpt-3.5-turbo-0301',
15346
+ 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.',
15347
+ pricing: {
15348
+ prompt: pricing(`$1.50 / 1M tokens`),
15349
+ output: pricing(`$2.00 / 1M tokens`),
15350
+ },
15351
+ },
15352
+ /**/
15353
+ /**/
15354
+ {
15355
+ modelVariant: 'COMPLETION',
15356
+ modelTitle: 'babbage-002',
15357
+ modelName: 'babbage-002',
15358
+ 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.',
15359
+ pricing: {
15360
+ prompt: pricing(`$0.40 / 1M tokens`),
15361
+ output: pricing(`$0.40 / 1M tokens`),
15362
+ },
15363
+ },
15364
+ /**/
15365
+ /**/
15366
+ {
15367
+ modelVariant: 'CHAT',
15368
+ modelTitle: 'gpt-4-1106-preview',
15369
+ modelName: 'gpt-4-1106-preview',
15370
+ 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.',
15371
+ pricing: {
15372
+ prompt: pricing(`$10.00 / 1M tokens`),
15373
+ output: pricing(`$30.00 / 1M tokens`),
15374
+ },
15375
+ },
15376
+ /**/
15377
+ /**/
15378
+ {
15379
+ modelVariant: 'CHAT',
15380
+ modelTitle: 'gpt-4-0125-preview',
15381
+ modelName: 'gpt-4-0125-preview',
15382
+ 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.',
15383
+ pricing: {
15384
+ prompt: pricing(`$10.00 / 1M tokens`),
15385
+ output: pricing(`$30.00 / 1M tokens`),
15386
+ },
15387
+ },
15388
+ /**/
15389
+ /*/
15390
+ {
15391
+ modelTitle: 'tts-1-1106',
15392
+ modelName: 'tts-1-1106',
15393
+ },
15394
+ /**/
15395
+ /**/
15396
+ {
15397
+ modelVariant: 'CHAT',
15398
+ modelTitle: 'gpt-3.5-turbo-0125',
15399
+ modelName: 'gpt-3.5-turbo-0125',
15400
+ 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.',
15401
+ pricing: {
15402
+ prompt: pricing(`$0.50 / 1M tokens`),
15403
+ output: pricing(`$1.50 / 1M tokens`),
15404
+ },
15405
+ },
15406
+ /**/
15407
+ /**/
15408
+ {
15409
+ modelVariant: 'CHAT',
15410
+ modelTitle: 'gpt-4-turbo-preview',
15411
+ modelName: 'gpt-4-turbo-preview',
15412
+ 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.',
15413
+ pricing: {
15414
+ prompt: pricing(`$10.00 / 1M tokens`),
15415
+ output: pricing(`$30.00 / 1M tokens`),
15416
+ },
15417
+ },
15418
+ /**/
15419
+ /**/
15420
+ {
15421
+ modelVariant: 'EMBEDDING',
15422
+ modelTitle: 'text-embedding-3-large',
15423
+ modelName: 'text-embedding-3-large',
15424
+ 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.",
15425
+ pricing: {
15426
+ prompt: pricing(`$0.13 / 1M tokens`),
15427
+ output: 0,
15428
+ },
15429
+ },
15430
+ /**/
15431
+ /**/
15432
+ {
15433
+ modelVariant: 'EMBEDDING',
15434
+ modelTitle: 'text-embedding-3-small',
15435
+ modelName: 'text-embedding-3-small',
15436
+ 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.',
15437
+ pricing: {
15438
+ prompt: pricing(`$0.02 / 1M tokens`),
15439
+ output: 0,
15440
+ },
15441
+ },
15442
+ /**/
15443
+ /**/
15444
+ {
15445
+ modelVariant: 'CHAT',
15446
+ modelTitle: 'gpt-3.5-turbo-0613',
15447
+ modelName: 'gpt-3.5-turbo-0613',
15448
+ 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.",
15449
+ pricing: {
15450
+ prompt: pricing(`$1.50 / 1M tokens`),
15451
+ output: pricing(`$2.00 / 1M tokens`),
15452
+ },
15453
+ },
15454
+ /**/
15455
+ /**/
15456
+ {
15457
+ modelVariant: 'EMBEDDING',
15458
+ modelTitle: 'text-embedding-ada-002',
15459
+ modelName: 'text-embedding-ada-002',
15460
+ 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.',
15461
+ pricing: {
15462
+ prompt: pricing(`$0.1 / 1M tokens`),
15463
+ output: 0,
15464
+ },
15465
+ },
15466
+ /**/
15467
+ /*/
15468
+ {
15469
+ modelVariant: 'CHAT',
15470
+ modelTitle: 'gpt-4-1106-vision-preview',
15471
+ modelName: 'gpt-4-1106-vision-preview',
15472
+ },
15473
+ /**/
15474
+ /*/
15475
+ {
15476
+ modelVariant: 'CHAT',
15477
+ modelTitle: 'gpt-4-vision-preview',
15478
+ modelName: 'gpt-4-vision-preview',
15479
+ pricing: {
15480
+ prompt: computeUsage(`$10.00 / 1M tokens`),
15481
+ output: computeUsage(`$30.00 / 1M tokens`),
15482
+ },
15483
+ },
15484
+ /**/
15485
+ /**/
15486
+ {
15487
+ modelVariant: 'CHAT',
15488
+ modelTitle: 'gpt-4o-2024-05-13',
15489
+ modelName: 'gpt-4o-2024-05-13',
15490
+ 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.',
15491
+ pricing: {
15492
+ prompt: pricing(`$5.00 / 1M tokens`),
15493
+ output: pricing(`$15.00 / 1M tokens`),
15494
+ },
15495
+ },
15496
+ /**/
15497
+ /**/
15498
+ {
15499
+ modelVariant: 'CHAT',
15500
+ modelTitle: 'gpt-4o',
15501
+ modelName: 'gpt-4o',
15502
+ 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.",
15503
+ pricing: {
15504
+ prompt: pricing(`$5.00 / 1M tokens`),
15505
+ output: pricing(`$15.00 / 1M tokens`),
15506
+ },
15507
+ },
15508
+ /**/
15509
+ /**/
15510
+ {
15511
+ modelVariant: 'CHAT',
15512
+ modelTitle: 'gpt-4o-mini',
15513
+ modelName: 'gpt-4o-mini',
15514
+ 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.',
15515
+ pricing: {
15516
+ prompt: pricing(`$0.15 / 1M tokens`),
15517
+ output: pricing(`$0.60 / 1M tokens`),
15518
+ },
15519
+ },
15520
+ /**/
15521
+ /**/
15522
+ {
15523
+ modelVariant: 'CHAT',
15524
+ modelTitle: 'o1-preview',
15525
+ modelName: 'o1-preview',
15526
+ 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.',
15527
+ pricing: {
15528
+ prompt: pricing(`$15.00 / 1M tokens`),
15529
+ output: pricing(`$60.00 / 1M tokens`),
15530
+ },
15531
+ },
15532
+ /**/
15533
+ /**/
15534
+ {
15535
+ modelVariant: 'CHAT',
15536
+ modelTitle: 'o1-preview-2024-09-12',
15537
+ modelName: 'o1-preview-2024-09-12',
15538
+ 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.',
15539
+ pricing: {
15540
+ prompt: pricing(`$15.00 / 1M tokens`),
15541
+ output: pricing(`$60.00 / 1M tokens`),
15542
+ },
15543
+ },
15544
+ /**/
15545
+ /**/
15546
+ {
15547
+ modelVariant: 'CHAT',
15548
+ modelTitle: 'o1-mini',
15549
+ modelName: 'o1-mini',
15550
+ 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.',
15551
+ pricing: {
15552
+ prompt: pricing(`$3.00 / 1M tokens`),
15553
+ output: pricing(`$12.00 / 1M tokens`),
15554
+ },
15555
+ },
15556
+ /**/
15557
+ /**/
15558
+ {
15559
+ modelVariant: 'CHAT',
15560
+ modelTitle: 'o1',
15561
+ modelName: 'o1',
15562
+ 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.",
15563
+ pricing: {
15564
+ prompt: pricing(`$15.00 / 1M tokens`),
15565
+ output: pricing(`$60.00 / 1M tokens`),
15566
+ },
15567
+ },
15568
+ /**/
15569
+ /**/
15570
+ {
15571
+ modelVariant: 'CHAT',
15572
+ modelTitle: 'o3-mini',
15573
+ modelName: 'o3-mini',
15574
+ 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.',
15575
+ pricing: {
15576
+ prompt: pricing(`$3.00 / 1M tokens`),
15577
+ output: pricing(`$12.00 / 1M tokens`),
15578
+ },
15579
+ },
15580
+ /**/
15581
+ /**/
15582
+ {
15583
+ modelVariant: 'CHAT',
15584
+ modelTitle: 'o1-mini-2024-09-12',
15585
+ modelName: 'o1-mini-2024-09-12',
15586
+ 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.",
15587
+ pricing: {
15588
+ prompt: pricing(`$3.00 / 1M tokens`),
15589
+ output: pricing(`$12.00 / 1M tokens`),
15590
+ },
15591
+ },
15592
+ /**/
15593
+ /**/
15594
+ {
15595
+ modelVariant: 'CHAT',
15596
+ modelTitle: 'gpt-3.5-turbo-16k-0613',
15597
+ modelName: 'gpt-3.5-turbo-16k-0613',
15598
+ 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.",
15599
+ pricing: {
15600
+ prompt: pricing(`$3.00 / 1M tokens`),
15601
+ output: pricing(`$4.00 / 1M tokens`),
15602
+ },
15603
+ },
15604
+ /**/
15605
+ // <- [🕕]
15606
+ ],
15607
+ });
15608
+ /**
15609
+ * Note: [🤖] Add models of new variant
15610
+ * TODO: [🧠] Some mechanism to propagate unsureness
15611
+ * TODO: [🎰] Some mechanism to auto-update available models
15612
+ * TODO: [🎰][👮‍♀️] Make this list dynamic - dynamically can be listed modelNames but not modelVariant, legacy status, context length and pricing
15613
+ * TODO: [🧠][👮‍♀️] Put here more info like description, isVision, trainingDateCutoff, languages, strengths ( Top-level performance, intelligence, fluency, and understanding), contextWindow,...
15614
+ * @see https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4
15615
+ * @see https://openai.com/api/pricing/
15616
+ * @see /other/playground/playground.ts
15617
+ * TODO: [🍓][💩] Make better
15618
+ * TODO: Change model titles to human eg: "gpt-4-turbo-2024-04-09" -> "GPT-4 Turbo (2024-04-09)"
15619
+ * TODO: [🚸] Not all models are compatible with JSON mode, add this information here and use it
15620
+ * Note: [💞] Ignore a discrepancy between file name and entity name
15621
+ */
15622
+
15623
+ /**
15624
+ * Computes the usage of the OpenAI API based on the response from OpenAI
15625
+ *
15626
+ * @param promptContent The content of the prompt
15627
+ * @param resultContent The content of the result (for embedding prompts or failed prompts pass empty string)
15628
+ * @param rawResponse The raw response from OpenAI API
15629
+ * @throws {PipelineExecutionError} If the usage is not defined in the response from OpenAI
15630
+ * @private internal utility of `OpenAiExecutionTools`
15631
+ */
15632
+ function computeOpenAiUsage(promptContent, // <- Note: Intentionally using [] to access type properties to bring jsdoc from Prompt/PromptResult to consumer
15633
+ resultContent, rawResponse) {
15634
+ var _a, _b;
15635
+ if (rawResponse.usage === undefined) {
15636
+ throw new PipelineExecutionError('The usage is not defined in the response from OpenAI');
15637
+ }
15638
+ if (((_a = rawResponse.usage) === null || _a === void 0 ? void 0 : _a.prompt_tokens) === undefined) {
15639
+ throw new PipelineExecutionError('In OpenAI response `usage.prompt_tokens` not defined');
15640
+ }
15641
+ const inputTokens = rawResponse.usage.prompt_tokens;
15642
+ const outputTokens = ((_b = rawResponse.usage) === null || _b === void 0 ? void 0 : _b.completion_tokens) || 0;
15643
+ let isUncertain = false;
15644
+ let modelInfo = OPENAI_MODELS.find((model) => model.modelName === rawResponse.model);
15645
+ if (modelInfo === undefined) {
15646
+ // Note: Model is not in the list of known models, fallback to the family of the models and mark price as uncertain
15647
+ modelInfo = OPENAI_MODELS.find((model) => (rawResponse.model || SALT_NONCE).startsWith(model.modelName));
15648
+ if (modelInfo !== undefined) {
15649
+ isUncertain = true;
15650
+ }
15651
+ }
15652
+ let price;
15653
+ if (modelInfo === undefined || modelInfo.pricing === undefined) {
15654
+ price = uncertainNumber();
15655
+ }
15656
+ else {
15657
+ price = uncertainNumber(inputTokens * modelInfo.pricing.prompt + outputTokens * modelInfo.pricing.output, isUncertain);
15658
+ }
15659
+ return {
15660
+ price,
15661
+ input: {
15662
+ tokensCount: uncertainNumber(rawResponse.usage.prompt_tokens),
15663
+ ...computeUsageCounts(promptContent),
15664
+ },
15665
+ output: {
15666
+ tokensCount: uncertainNumber(outputTokens),
15667
+ ...computeUsageCounts(resultContent),
15668
+ },
15669
+ };
15670
+ }
15671
+ /**
15672
+ * TODO: [🤝] DRY Maybe some common abstraction between `computeOpenAiUsage` and `computeAnthropicClaudeUsage`
15673
+ */
15674
+
15675
+ /**
15676
+ * Parses an OpenAI error message to identify which parameter is unsupported
15677
+ *
15678
+ * @param errorMessage The error message from OpenAI API
15679
+ * @returns The parameter name that is unsupported, or null if not an unsupported parameter error
15680
+ * @private utility of LLM Tools
15681
+ */
15682
+ function parseUnsupportedParameterError(errorMessage) {
15683
+ // Pattern to match "Unsupported value: 'parameter' does not support ..."
15684
+ const unsupportedValueMatch = errorMessage.match(/Unsupported value:\s*'([^']+)'\s*does not support/i);
15685
+ if (unsupportedValueMatch === null || unsupportedValueMatch === void 0 ? void 0 : unsupportedValueMatch[1]) {
15686
+ return unsupportedValueMatch[1];
15687
+ }
15688
+ // Pattern to match "'parameter' of type ... is not supported with this model"
15689
+ const parameterTypeMatch = errorMessage.match(/'([^']+)'\s*of type.*is not supported with this model/i);
15690
+ if (parameterTypeMatch === null || parameterTypeMatch === void 0 ? void 0 : parameterTypeMatch[1]) {
15691
+ return parameterTypeMatch[1];
15692
+ }
15693
+ return null;
15694
+ }
15695
+ /**
15696
+ * Creates a copy of model requirements with the specified parameter removed
15697
+ *
15698
+ * @param modelRequirements Original model requirements
15699
+ * @param unsupportedParameter The parameter to remove
15700
+ * @returns New model requirements without the unsupported parameter
15701
+ * @private utility of LLM Tools
15702
+ */
15703
+ function removeUnsupportedModelRequirement(modelRequirements, unsupportedParameter) {
15704
+ const newRequirements = { ...modelRequirements };
15705
+ // Map of parameter names that might appear in error messages to ModelRequirements properties
15706
+ const parameterMap = {
15707
+ temperature: 'temperature',
15708
+ max_tokens: 'maxTokens',
15709
+ maxTokens: 'maxTokens',
15710
+ seed: 'seed',
15711
+ };
15712
+ const propertyToRemove = parameterMap[unsupportedParameter];
15713
+ if (propertyToRemove && propertyToRemove in newRequirements) {
15714
+ delete newRequirements[propertyToRemove];
15715
+ }
15716
+ return newRequirements;
15717
+ }
15718
+ /**
15719
+ * Checks if an error is an "Unsupported value" error from OpenAI
15720
+ * @param error The error to check
15721
+ * @returns true if this is an unsupported parameter error
15722
+ * @private utility of LLM Tools
15723
+ */
15724
+ function isUnsupportedParameterError(error) {
15725
+ const errorMessage = error.message.toLowerCase();
15726
+ return (errorMessage.includes('unsupported value:') ||
15727
+ errorMessage.includes('is not supported with this model') ||
15728
+ errorMessage.includes('does not support'));
15729
+ }
15730
+
15731
+ /**
15732
+ * Execution Tools for calling OpenAI API or other OpenAI compatible provider
15733
+ *
15734
+ * @public exported from `@promptbook/openai`
15735
+ */
15736
+ class OpenAiCompatibleExecutionTools {
15737
+ // Removed retriedUnsupportedParameters and attemptHistory instance fields
15738
+ /**
15739
+ * Creates OpenAI compatible Execution Tools.
15740
+ *
15741
+ * @param options which are relevant are directly passed to the OpenAI compatible client
15742
+ */
15743
+ constructor(options) {
15744
+ this.options = options;
15745
+ /**
15746
+ * OpenAI API client.
15747
+ */
15748
+ this.client = null;
15749
+ // TODO: Allow configuring rate limits via options
15750
+ this.limiter = new Bottleneck({
15751
+ minTime: 60000 / (this.options.maxRequestsPerMinute || DEFAULT_MAX_REQUESTS_PER_MINUTE),
15752
+ });
15753
+ }
15754
+ async getClient() {
15755
+ if (this.client === null) {
15756
+ // Note: Passing only OpenAI relevant options to OpenAI constructor
15757
+ const openAiOptions = { ...this.options };
15758
+ delete openAiOptions.isVerbose;
15759
+ delete openAiOptions.userId;
15760
+ // Enhanced configuration for better ECONNRESET handling
15761
+ const enhancedOptions = {
15762
+ ...openAiOptions,
15763
+ timeout: API_REQUEST_TIMEOUT,
15764
+ maxRetries: CONNECTION_RETRIES_LIMIT,
15765
+ defaultHeaders: {
15766
+ Connection: 'keep-alive',
15767
+ 'Keep-Alive': 'timeout=30, max=100',
15768
+ ...openAiOptions.defaultHeaders,
15769
+ },
15770
+ };
15771
+ this.client = new OpenAI(enhancedOptions);
15772
+ }
15773
+ return this.client;
15774
+ }
15775
+ /**
15776
+ * Check the `options` passed to `constructor`
15777
+ */
15778
+ async checkConfiguration() {
15779
+ await this.getClient();
15780
+ // TODO: [🎍] Do here a real check that API is online, working and API key is correct
15781
+ }
15782
+ /**
15783
+ * List all available OpenAI compatible models that can be used
15784
+ */
15785
+ async listModels() {
15786
+ const client = await this.getClient();
15787
+ const rawModelsList = await client.models.list();
15788
+ const availableModels = rawModelsList.data
15789
+ .sort((a, b) => (a.created > b.created ? 1 : -1))
15790
+ .map((modelFromApi) => {
15791
+ const modelFromList = this.HARDCODED_MODELS.find(({ modelName }) => modelName === modelFromApi.id ||
15792
+ modelName.startsWith(modelFromApi.id) ||
15793
+ modelFromApi.id.startsWith(modelName));
15794
+ if (modelFromList !== undefined) {
15795
+ return modelFromList;
15796
+ }
15797
+ return {
15798
+ modelVariant: 'CHAT',
15799
+ modelTitle: modelFromApi.id,
15800
+ modelName: modelFromApi.id,
15801
+ modelDescription: '',
15802
+ };
15803
+ });
15804
+ return availableModels;
15805
+ }
15806
+ /**
15807
+ * Calls OpenAI compatible API to use a chat model.
15808
+ */
15809
+ async callChatModel(prompt) {
15810
+ // Deep clone prompt and modelRequirements to avoid mutation across calls
15811
+ const clonedPrompt = JSON.parse(JSON.stringify(prompt));
15812
+ // Use local Set for retried parameters to ensure independence and thread safety
15813
+ const retriedUnsupportedParameters = new Set();
15814
+ return this.callChatModelWithRetry(clonedPrompt, clonedPrompt.modelRequirements, [], retriedUnsupportedParameters);
15815
+ }
15816
+ /**
15817
+ * Internal method that handles parameter retry for chat model calls
15818
+ */
15819
+ async callChatModelWithRetry(prompt, currentModelRequirements, attemptStack = [], retriedUnsupportedParameters = new Set()) {
15820
+ var _a;
15821
+ if (this.options.isVerbose) {
15822
+ console.info(`💬 ${this.title} callChatModel call`, { prompt, currentModelRequirements });
15823
+ }
15824
+ const { content, parameters, format } = prompt;
15825
+ const client = await this.getClient();
15826
+ // TODO: [☂] Use here more modelRequirements
15827
+ if (currentModelRequirements.modelVariant !== 'CHAT') {
15828
+ throw new PipelineExecutionError('Use callChatModel only for CHAT variant');
15829
+ }
15830
+ const modelName = currentModelRequirements.modelName || this.getDefaultChatModel().modelName;
15831
+ const modelSettings = {
15832
+ model: modelName,
15833
+ max_tokens: currentModelRequirements.maxTokens,
15834
+ temperature: currentModelRequirements.temperature,
15835
+ // <- TODO: [🈁] Use `seed` here AND/OR use is `isDeterministic` for entire execution tools
15836
+ // <- Note: [🧆]
15837
+ }; // <- TODO: [💩] Guard here types better
15838
+ if (format === 'JSON') {
15839
+ modelSettings.response_format = {
15840
+ type: 'json_object',
15841
+ };
15842
+ }
15843
+ // <- TODO: [🚸] Not all models are compatible with JSON mode
15844
+ // > 'response_format' of type 'json_object' is not supported with this model.
15845
+ const rawPromptContent = templateParameters(content, { ...parameters, modelName });
15846
+ // Convert thread to OpenAI format if present
15847
+ let threadMessages = [];
15848
+ if ('thread' in prompt && Array.isArray(prompt.thread)) {
15849
+ threadMessages = prompt.thread.map((msg) => ({
15850
+ role: msg.role === 'assistant' ? 'assistant' : 'user',
15851
+ content: msg.content,
15852
+ }));
15853
+ }
15854
+ const rawRequest = {
15855
+ ...modelSettings,
15856
+ messages: [
15857
+ ...(currentModelRequirements.systemMessage === undefined
15858
+ ? []
15859
+ : [
15860
+ {
15861
+ role: 'system',
15862
+ content: currentModelRequirements.systemMessage,
15863
+ },
15864
+ ]),
15865
+ ...threadMessages,
15866
+ {
15867
+ role: 'user',
15868
+ content: rawPromptContent,
15869
+ },
15870
+ ],
15871
+ user: (_a = this.options.userId) === null || _a === void 0 ? void 0 : _a.toString(),
15872
+ };
15873
+ const start = $getCurrentDate();
15874
+ if (this.options.isVerbose) {
15875
+ console.info(colors.bgWhite('rawRequest'), JSON.stringify(rawRequest, null, 4));
15876
+ }
15877
+ try {
15878
+ const rawResponse = await this.limiter
15879
+ .schedule(() => this.makeRequestWithNetworkRetry(() => client.chat.completions.create(rawRequest)))
15880
+ .catch((error) => {
15881
+ assertsError(error);
15882
+ if (this.options.isVerbose) {
15883
+ console.info(colors.bgRed('error'), error);
15884
+ }
15885
+ throw error;
15886
+ });
15887
+ if (this.options.isVerbose) {
15888
+ console.info(colors.bgWhite('rawResponse'), JSON.stringify(rawResponse, null, 4));
15889
+ }
15890
+ const complete = $getCurrentDate();
15891
+ if (!rawResponse.choices[0]) {
15892
+ throw new PipelineExecutionError(`No choises from ${this.title}`);
15893
+ }
15894
+ if (rawResponse.choices.length > 1) {
15895
+ // TODO: This should be maybe only warning
15896
+ throw new PipelineExecutionError(`More than one choise from ${this.title}`);
15897
+ }
15898
+ const resultContent = rawResponse.choices[0].message.content;
15899
+ const usage = this.computeUsage(content || '', resultContent || '', rawResponse);
15900
+ if (resultContent === null) {
15901
+ throw new PipelineExecutionError(`No response message from ${this.title}`);
15902
+ }
15903
+ return exportJson({
15904
+ name: 'promptResult',
15905
+ message: `Result of \`OpenAiCompatibleExecutionTools.callChatModel\``,
15906
+ order: [],
15907
+ value: {
15908
+ content: resultContent,
15909
+ modelName: rawResponse.model || modelName,
15910
+ timing: {
15911
+ start,
15912
+ complete,
15913
+ },
15914
+ usage,
15915
+ rawPromptContent,
15916
+ rawRequest,
15917
+ rawResponse,
15918
+ // <- [🗯]
15919
+ },
15920
+ });
15921
+ }
15922
+ catch (error) {
15923
+ assertsError(error);
15924
+ // Check if this is an unsupported parameter error
15925
+ if (!isUnsupportedParameterError(error)) {
15926
+ // If we have attemptStack, include it in the error message
15927
+ if (attemptStack.length > 0) {
15928
+ throw new PipelineExecutionError(`All attempts failed. Attempt history:\n` +
15929
+ attemptStack
15930
+ .map((a, i) => ` ${i + 1}. Model: ${a.modelName}` +
15931
+ (a.unsupportedParameter ? `, Stripped: ${a.unsupportedParameter}` : '') +
15932
+ `, Error: ${a.errorMessage}` +
15933
+ (a.stripped ? ' (stripped and retried)' : ''))
15934
+ .join('\n') +
15935
+ `\nFinal error: ${error.message}`);
15936
+ }
15937
+ throw error;
15938
+ }
15939
+ // Parse which parameter is unsupported
15940
+ const unsupportedParameter = parseUnsupportedParameterError(error.message);
15941
+ if (!unsupportedParameter) {
15942
+ if (this.options.isVerbose) {
15943
+ console.warn(colors.bgYellow('Warning'), 'Could not parse unsupported parameter from error:', error.message);
15944
+ }
15945
+ throw error;
15946
+ }
15947
+ // Create a unique key for this model + parameter combination to prevent infinite loops
15948
+ const retryKey = `${modelName}-${unsupportedParameter}`;
15949
+ if (retriedUnsupportedParameters.has(retryKey)) {
15950
+ // Already retried this parameter, throw the error with attemptStack
15951
+ attemptStack.push({
15952
+ modelName,
15953
+ unsupportedParameter,
15954
+ errorMessage: error.message,
15955
+ stripped: true,
15956
+ });
15957
+ throw new PipelineExecutionError(`All attempts failed. Attempt history:\n` +
15958
+ attemptStack
15959
+ .map((a, i) => ` ${i + 1}. Model: ${a.modelName}` +
15960
+ (a.unsupportedParameter ? `, Stripped: ${a.unsupportedParameter}` : '') +
15961
+ `, Error: ${a.errorMessage}` +
15962
+ (a.stripped ? ' (stripped and retried)' : ''))
15963
+ .join('\n') +
15964
+ `\nFinal error: ${error.message}`);
15965
+ }
15966
+ // Mark this parameter as retried
15967
+ retriedUnsupportedParameters.add(retryKey);
15968
+ // Log warning in verbose mode
15969
+ if (this.options.isVerbose) {
15970
+ console.warn(colors.bgYellow('Warning'), `Removing unsupported parameter '${unsupportedParameter}' for model '${modelName}' and retrying request`);
15971
+ }
15972
+ // Add to attemptStack
15973
+ attemptStack.push({
15974
+ modelName,
15975
+ unsupportedParameter,
15976
+ errorMessage: error.message,
15977
+ stripped: true,
15978
+ });
15979
+ // Remove the unsupported parameter and retry
15980
+ const modifiedModelRequirements = removeUnsupportedModelRequirement(currentModelRequirements, unsupportedParameter);
15981
+ return this.callChatModelWithRetry(prompt, modifiedModelRequirements, attemptStack, retriedUnsupportedParameters);
15982
+ }
15983
+ }
15984
+ /**
15985
+ * Calls OpenAI API to use a complete model.
15986
+ */
15987
+ async callCompletionModel(prompt) {
15988
+ // Deep clone prompt and modelRequirements to avoid mutation across calls
15989
+ const clonedPrompt = JSON.parse(JSON.stringify(prompt));
15990
+ const retriedUnsupportedParameters = new Set();
15991
+ return this.callCompletionModelWithRetry(clonedPrompt, clonedPrompt.modelRequirements, [], retriedUnsupportedParameters);
15992
+ }
15993
+ /**
15994
+ * Internal method that handles parameter retry for completion model calls
15995
+ */
15996
+ async callCompletionModelWithRetry(prompt, currentModelRequirements, attemptStack = [], retriedUnsupportedParameters = new Set()) {
15997
+ var _a;
15998
+ if (this.options.isVerbose) {
15999
+ console.info(`🖋 ${this.title} callCompletionModel call`, { prompt, currentModelRequirements });
16000
+ }
16001
+ const { content, parameters } = prompt;
16002
+ const client = await this.getClient();
16003
+ // TODO: [☂] Use here more modelRequirements
16004
+ if (currentModelRequirements.modelVariant !== 'COMPLETION') {
16005
+ throw new PipelineExecutionError('Use callCompletionModel only for COMPLETION variant');
16006
+ }
16007
+ const modelName = currentModelRequirements.modelName || this.getDefaultCompletionModel().modelName;
16008
+ const modelSettings = {
16009
+ model: modelName,
16010
+ max_tokens: currentModelRequirements.maxTokens,
16011
+ temperature: currentModelRequirements.temperature,
16012
+ };
16013
+ const rawPromptContent = templateParameters(content, { ...parameters, modelName });
16014
+ const rawRequest = {
16015
+ ...modelSettings,
16016
+ prompt: rawPromptContent,
16017
+ user: (_a = this.options.userId) === null || _a === void 0 ? void 0 : _a.toString(),
16018
+ };
16019
+ const start = $getCurrentDate();
16020
+ if (this.options.isVerbose) {
16021
+ console.info(colors.bgWhite('rawRequest'), JSON.stringify(rawRequest, null, 4));
16022
+ }
16023
+ try {
16024
+ const rawResponse = await this.limiter
16025
+ .schedule(() => this.makeRequestWithNetworkRetry(() => client.completions.create(rawRequest)))
16026
+ .catch((error) => {
16027
+ assertsError(error);
16028
+ if (this.options.isVerbose) {
16029
+ console.info(colors.bgRed('error'), error);
16030
+ }
16031
+ throw error;
16032
+ });
16033
+ if (this.options.isVerbose) {
16034
+ console.info(colors.bgWhite('rawResponse'), JSON.stringify(rawResponse, null, 4));
16035
+ }
16036
+ const complete = $getCurrentDate();
16037
+ if (!rawResponse.choices[0]) {
16038
+ throw new PipelineExecutionError(`No choises from ${this.title}`);
16039
+ }
16040
+ if (rawResponse.choices.length > 1) {
16041
+ throw new PipelineExecutionError(`More than one choise from ${this.title}`);
16042
+ }
16043
+ const resultContent = rawResponse.choices[0].text;
16044
+ const usage = this.computeUsage(content || '', resultContent || '', rawResponse);
16045
+ return exportJson({
16046
+ name: 'promptResult',
16047
+ message: `Result of \`OpenAiCompatibleExecutionTools.callCompletionModel\``,
16048
+ order: [],
16049
+ value: {
16050
+ content: resultContent,
16051
+ modelName: rawResponse.model || modelName,
16052
+ timing: {
16053
+ start,
16054
+ complete,
16055
+ },
16056
+ usage,
16057
+ rawPromptContent,
16058
+ rawRequest,
16059
+ rawResponse,
16060
+ },
16061
+ });
16062
+ }
16063
+ catch (error) {
16064
+ assertsError(error);
16065
+ if (!isUnsupportedParameterError(error)) {
16066
+ if (attemptStack.length > 0) {
16067
+ throw new PipelineExecutionError(`All attempts failed. Attempt history:\n` +
16068
+ attemptStack
16069
+ .map((a, i) => ` ${i + 1}. Model: ${a.modelName}` +
16070
+ (a.unsupportedParameter ? `, Stripped: ${a.unsupportedParameter}` : '') +
16071
+ `, Error: ${a.errorMessage}` +
16072
+ (a.stripped ? ' (stripped and retried)' : ''))
16073
+ .join('\n') +
16074
+ `\nFinal error: ${error.message}`);
16075
+ }
16076
+ throw error;
16077
+ }
16078
+ const unsupportedParameter = parseUnsupportedParameterError(error.message);
16079
+ if (!unsupportedParameter) {
16080
+ if (this.options.isVerbose) {
16081
+ console.warn(colors.bgYellow('Warning'), 'Could not parse unsupported parameter from error:', error.message);
16082
+ }
16083
+ throw error;
16084
+ }
16085
+ const retryKey = `${modelName}-${unsupportedParameter}`;
16086
+ if (retriedUnsupportedParameters.has(retryKey)) {
16087
+ attemptStack.push({
16088
+ modelName,
16089
+ unsupportedParameter,
16090
+ errorMessage: error.message,
16091
+ stripped: true,
16092
+ });
16093
+ throw new PipelineExecutionError(`All attempts failed. Attempt history:\n` +
16094
+ attemptStack
16095
+ .map((a, i) => ` ${i + 1}. Model: ${a.modelName}` +
16096
+ (a.unsupportedParameter ? `, Stripped: ${a.unsupportedParameter}` : '') +
16097
+ `, Error: ${a.errorMessage}` +
16098
+ (a.stripped ? ' (stripped and retried)' : ''))
16099
+ .join('\n') +
16100
+ `\nFinal error: ${error.message}`);
16101
+ }
16102
+ retriedUnsupportedParameters.add(retryKey);
16103
+ if (this.options.isVerbose) {
16104
+ console.warn(colors.bgYellow('Warning'), `Removing unsupported parameter '${unsupportedParameter}' for model '${modelName}' and retrying request`);
16105
+ }
16106
+ attemptStack.push({
16107
+ modelName,
16108
+ unsupportedParameter,
16109
+ errorMessage: error.message,
16110
+ stripped: true,
16111
+ });
16112
+ const modifiedModelRequirements = removeUnsupportedModelRequirement(currentModelRequirements, unsupportedParameter);
16113
+ return this.callCompletionModelWithRetry(prompt, modifiedModelRequirements, attemptStack, retriedUnsupportedParameters);
16114
+ }
16115
+ }
16116
+ /**
16117
+ * Calls OpenAI compatible API to use a embedding model
16118
+ */
16119
+ async callEmbeddingModel(prompt) {
16120
+ // Deep clone prompt and modelRequirements to avoid mutation across calls
16121
+ const clonedPrompt = JSON.parse(JSON.stringify(prompt));
16122
+ const retriedUnsupportedParameters = new Set();
16123
+ return this.callEmbeddingModelWithRetry(clonedPrompt, clonedPrompt.modelRequirements, [], retriedUnsupportedParameters);
16124
+ }
16125
+ /**
16126
+ * Internal method that handles parameter retry for embedding model calls
16127
+ */
16128
+ async callEmbeddingModelWithRetry(prompt, currentModelRequirements, attemptStack = [], retriedUnsupportedParameters = new Set()) {
16129
+ if (this.options.isVerbose) {
16130
+ console.info(`🖋 ${this.title} embedding call`, { prompt, currentModelRequirements });
16131
+ }
16132
+ const { content, parameters } = prompt;
16133
+ const client = await this.getClient();
16134
+ if (currentModelRequirements.modelVariant !== 'EMBEDDING') {
16135
+ throw new PipelineExecutionError('Use embed only for EMBEDDING variant');
16136
+ }
16137
+ const modelName = currentModelRequirements.modelName || this.getDefaultEmbeddingModel().modelName;
16138
+ const rawPromptContent = templateParameters(content, { ...parameters, modelName });
16139
+ const rawRequest = {
16140
+ input: rawPromptContent,
16141
+ model: modelName,
16142
+ };
16143
+ const start = $getCurrentDate();
16144
+ if (this.options.isVerbose) {
16145
+ console.info(colors.bgWhite('rawRequest'), JSON.stringify(rawRequest, null, 4));
16146
+ }
16147
+ try {
16148
+ const rawResponse = await this.limiter
16149
+ .schedule(() => this.makeRequestWithNetworkRetry(() => client.embeddings.create(rawRequest)))
16150
+ .catch((error) => {
16151
+ assertsError(error);
16152
+ if (this.options.isVerbose) {
16153
+ console.info(colors.bgRed('error'), error);
16154
+ }
16155
+ throw error;
16156
+ });
16157
+ if (this.options.isVerbose) {
16158
+ console.info(colors.bgWhite('rawResponse'), JSON.stringify(rawResponse, null, 4));
16159
+ }
16160
+ const complete = $getCurrentDate();
16161
+ if (rawResponse.data.length !== 1) {
16162
+ throw new PipelineExecutionError(`Expected exactly 1 data item in response, got ${rawResponse.data.length}`);
16163
+ }
16164
+ const resultContent = rawResponse.data[0].embedding;
16165
+ const usage = this.computeUsage(content || '', '', rawResponse);
16166
+ return exportJson({
16167
+ name: 'promptResult',
16168
+ message: `Result of \`OpenAiCompatibleExecutionTools.callEmbeddingModel\``,
16169
+ order: [],
16170
+ value: {
16171
+ content: resultContent,
16172
+ modelName: rawResponse.model || modelName,
16173
+ timing: {
16174
+ start,
16175
+ complete,
16176
+ },
16177
+ usage,
16178
+ rawPromptContent,
16179
+ rawRequest,
16180
+ rawResponse,
16181
+ },
16182
+ });
16183
+ }
16184
+ catch (error) {
16185
+ assertsError(error);
16186
+ if (!isUnsupportedParameterError(error)) {
16187
+ if (attemptStack.length > 0) {
16188
+ throw new PipelineExecutionError(`All attempts failed. Attempt history:\n` +
16189
+ attemptStack
16190
+ .map((a, i) => ` ${i + 1}. Model: ${a.modelName}` +
16191
+ (a.unsupportedParameter ? `, Stripped: ${a.unsupportedParameter}` : '') +
16192
+ `, Error: ${a.errorMessage}` +
16193
+ (a.stripped ? ' (stripped and retried)' : ''))
16194
+ .join('\n') +
16195
+ `\nFinal error: ${error.message}`);
16196
+ }
16197
+ throw error;
16198
+ }
16199
+ const unsupportedParameter = parseUnsupportedParameterError(error.message);
16200
+ if (!unsupportedParameter) {
16201
+ if (this.options.isVerbose) {
16202
+ console.warn(colors.bgYellow('Warning'), 'Could not parse unsupported parameter from error:', error.message);
16203
+ }
16204
+ throw error;
16205
+ }
16206
+ const retryKey = `${modelName}-${unsupportedParameter}`;
16207
+ if (retriedUnsupportedParameters.has(retryKey)) {
16208
+ attemptStack.push({
16209
+ modelName,
16210
+ unsupportedParameter,
16211
+ errorMessage: error.message,
16212
+ stripped: true,
16213
+ });
16214
+ throw new PipelineExecutionError(`All attempts failed. Attempt history:\n` +
16215
+ attemptStack
16216
+ .map((a, i) => ` ${i + 1}. Model: ${a.modelName}` +
16217
+ (a.unsupportedParameter ? `, Stripped: ${a.unsupportedParameter}` : '') +
16218
+ `, Error: ${a.errorMessage}` +
16219
+ (a.stripped ? ' (stripped and retried)' : ''))
16220
+ .join('\n') +
16221
+ `\nFinal error: ${error.message}`);
16222
+ }
16223
+ retriedUnsupportedParameters.add(retryKey);
16224
+ if (this.options.isVerbose) {
16225
+ console.warn(colors.bgYellow('Warning'), `Removing unsupported parameter '${unsupportedParameter}' for model '${modelName}' and retrying request`);
16226
+ }
16227
+ attemptStack.push({
16228
+ modelName,
16229
+ unsupportedParameter,
16230
+ errorMessage: error.message,
16231
+ stripped: true,
16232
+ });
16233
+ const modifiedModelRequirements = removeUnsupportedModelRequirement(currentModelRequirements, unsupportedParameter);
16234
+ return this.callEmbeddingModelWithRetry(prompt, modifiedModelRequirements, attemptStack, retriedUnsupportedParameters);
16235
+ }
16236
+ }
16237
+ // <- Note: [🤖] callXxxModel
16238
+ /**
16239
+ * Get the model that should be used as default
16240
+ */
16241
+ getDefaultModel(defaultModelName) {
16242
+ // Note: Match exact or prefix for model families
16243
+ const model = this.HARDCODED_MODELS.find(({ modelName }) => modelName === defaultModelName || modelName.startsWith(defaultModelName));
16244
+ if (model === undefined) {
16245
+ throw new PipelineExecutionError(spaceTrim((block) => `
16246
+ Cannot find model in ${this.title} models with name "${defaultModelName}" which should be used as default.
16247
+
16248
+ Available models:
16249
+ ${block(this.HARDCODED_MODELS.map(({ modelName }) => `- "${modelName}"`).join('\n'))}
16250
+
16251
+ Model "${defaultModelName}" is probably not available anymore, not installed, inaccessible or misconfigured.
16252
+
16253
+ `));
16254
+ }
16255
+ return model;
16256
+ }
16257
+ // <- Note: [🤖] getDefaultXxxModel
16258
+ /**
16259
+ * Makes a request with retry logic for network errors like ECONNRESET
16260
+ */
16261
+ async makeRequestWithNetworkRetry(requestFn) {
16262
+ let lastError;
16263
+ for (let attempt = 1; attempt <= CONNECTION_RETRIES_LIMIT; attempt++) {
16264
+ try {
16265
+ return await requestFn();
16266
+ }
16267
+ catch (error) {
16268
+ assertsError(error);
16269
+ lastError = error;
16270
+ // Check if this is a retryable network error
16271
+ const isRetryableError = this.isRetryableNetworkError(error);
16272
+ if (!isRetryableError || attempt === CONNECTION_RETRIES_LIMIT) {
16273
+ if (this.options.isVerbose && this.isRetryableNetworkError(error)) {
16274
+ console.info(colors.bgRed('Final network error after retries'), `Attempt ${attempt}/${CONNECTION_RETRIES_LIMIT}:`, error);
16275
+ }
16276
+ throw error;
16277
+ }
16278
+ // Calculate exponential backoff delay
16279
+ const baseDelay = 1000; // 1 second
16280
+ const backoffDelay = baseDelay * Math.pow(2, attempt - 1);
16281
+ const jitterDelay = Math.random() * 500; // Add some randomness
16282
+ const totalDelay = backoffDelay + jitterDelay;
16283
+ if (this.options.isVerbose) {
16284
+ console.info(colors.bgYellow('Retrying network request'), `Attempt ${attempt}/${CONNECTION_RETRIES_LIMIT}, waiting ${Math.round(totalDelay)}ms:`, error.message);
16285
+ }
16286
+ // Wait before retrying
16287
+ await new Promise((resolve) => setTimeout(resolve, totalDelay));
16288
+ }
16289
+ }
16290
+ throw lastError;
16291
+ }
16292
+ /**
16293
+ * Determines if an error is retryable (network-related errors)
16294
+ */
16295
+ isRetryableNetworkError(error) {
16296
+ const errorMessage = error.message.toLowerCase();
16297
+ const errorCode = error.code;
16298
+ // Network connection errors that should be retried
16299
+ const retryableErrors = [
16300
+ 'econnreset',
16301
+ 'enotfound',
16302
+ 'econnrefused',
16303
+ 'etimedout',
16304
+ 'socket hang up',
16305
+ 'network error',
16306
+ 'fetch failed',
16307
+ 'connection reset',
16308
+ 'connection refused',
16309
+ 'timeout',
16310
+ ];
16311
+ // Check error message
16312
+ if (retryableErrors.some((retryableError) => errorMessage.includes(retryableError))) {
16313
+ return true;
16314
+ }
16315
+ // Check error code
16316
+ if (errorCode && retryableErrors.includes(errorCode.toLowerCase())) {
16317
+ return true;
16318
+ }
16319
+ // Check for specific HTTP status codes that are retryable
16320
+ const errorWithStatus = error;
16321
+ const httpStatus = errorWithStatus.status || errorWithStatus.statusCode;
16322
+ if (httpStatus && [429, 500, 502, 503, 504].includes(httpStatus)) {
16323
+ return true;
16324
+ }
16325
+ return false;
16326
+ }
16327
+ }
16328
+ /**
16329
+ * TODO: [🛄] Some way how to re-wrap the errors from `OpenAiCompatibleExecutionTools`
16330
+ * TODO: [🛄] Maybe make custom `OpenAiCompatibleError`
16331
+ * TODO: [🧠][🈁] Maybe use `isDeterministic` from options
16332
+ * TODO: [🧠][🌰] Allow to pass `title` for tracking purposes
16333
+ * TODO: [🧠][🦢] Make reverse adapter from LlmExecutionTools to OpenAI-compatible:
16334
+ */
16335
+
16336
+ /**
16337
+ * Profile for OpenAI provider
16338
+ */
16339
+ const OPENAI_PROVIDER_PROFILE = {
16340
+ name: 'OPENAI',
16341
+ fullname: 'OpenAI GPT',
16342
+ color: '#10a37f',
16343
+ };
16344
+ /**
16345
+ * Execution Tools for calling OpenAI API
16346
+ *
16347
+ * @public exported from `@promptbook/openai`
16348
+ */
16349
+ class OpenAiExecutionTools extends OpenAiCompatibleExecutionTools {
16350
+ constructor() {
16351
+ super(...arguments);
16352
+ /**
16353
+ * Computes the usage of the OpenAI API based on the response from OpenAI
16354
+ */
16355
+ this.computeUsage = computeOpenAiUsage;
16356
+ // <- Note: [🤖] getDefaultXxxModel
16357
+ }
16358
+ /* <- TODO: [🍚] `, Destroyable` */
16359
+ get title() {
16360
+ return 'OpenAI';
16361
+ }
16362
+ get description() {
16363
+ return 'Use all models provided by OpenAI';
16364
+ }
16365
+ get profile() {
16366
+ return OPENAI_PROVIDER_PROFILE;
16367
+ }
16368
+ /*
16369
+ Note: Commenting this out to avoid circular dependency
16370
+ /**
16371
+ * Create (sub)tools for calling OpenAI API Assistants
16372
+ *
16373
+ * @param assistantId Which assistant to use
16374
+ * @returns Tools for calling OpenAI API Assistants with same token
16375
+ * /
16376
+ public createAssistantSubtools(assistantId: string_token): OpenAiAssistantExecutionTools {
16377
+ return new OpenAiAssistantExecutionTools({ ...this.options, assistantId });
16378
+ }
16379
+ */
16380
+ /**
16381
+ * List all available models (non dynamically)
16382
+ *
16383
+ * Note: Purpose of this is to provide more information about models than standard listing from API
16384
+ */
16385
+ get HARDCODED_MODELS() {
16386
+ return OPENAI_MODELS;
16387
+ }
16388
+ /**
16389
+ * Default model for chat variant.
16390
+ */
16391
+ getDefaultChatModel() {
16392
+ return this.getDefaultModel('gpt-5');
16393
+ }
16394
+ /**
16395
+ * Default model for completion variant.
16396
+ */
16397
+ getDefaultCompletionModel() {
16398
+ return this.getDefaultModel('gpt-3.5-turbo-instruct');
16399
+ }
16400
+ /**
16401
+ * Default model for completion variant.
16402
+ */
16403
+ getDefaultEmbeddingModel() {
16404
+ return this.getDefaultModel('text-embedding-3-large');
16405
+ }
16406
+ }
16407
+
16408
+ /**
16409
+ * Execution Tools for calling OpenAI API Assistants
16410
+ *
16411
+ * This is useful for calling OpenAI API with a single assistant, for more wide usage use `OpenAiExecutionTools`.
16412
+ *
16413
+ * @public exported from `@promptbook/openai`
16414
+ */
16415
+ class OpenAiAssistantExecutionTools extends OpenAiExecutionTools {
16416
+ /**
16417
+ * Creates OpenAI Execution Tools.
16418
+ *
16419
+ * @param options which are relevant are directly passed to the OpenAI client
16420
+ */
16421
+ constructor(options) {
16422
+ var _a;
16423
+ if (options.isProxied) {
16424
+ throw new NotYetImplementedError(`Proxy mode is not yet implemented for OpenAI assistants`);
16425
+ }
16426
+ super(options);
16427
+ this.isCreatingNewAssistantsAllowed = false;
16428
+ this.assistantId = options.assistantId;
16429
+ this.isCreatingNewAssistantsAllowed = (_a = options.isCreatingNewAssistantsAllowed) !== null && _a !== void 0 ? _a : false;
16430
+ if (this.assistantId === null && !this.isCreatingNewAssistantsAllowed) {
16431
+ throw new NotAllowed(`Assistant ID is null and creating new assistants is not allowed - this configuration does not make sense`);
16432
+ }
16433
+ // <- TODO: !!! `OpenAiAssistantExecutionToolsOptions` - Allow `assistantId: null` together with `isCreatingNewAssistantsAllowed: true`
16434
+ // TODO: [👱] Make limiter same as in `OpenAiExecutionTools`
16435
+ }
16436
+ get title() {
16437
+ return 'OpenAI Assistant';
16438
+ }
16439
+ get description() {
16440
+ return 'Use single assistant provided by OpenAI';
16441
+ }
16442
+ /**
16443
+ * Calls OpenAI API to use a chat model.
16444
+ */
16445
+ async callChatModel(prompt) {
16446
+ var _a, _b, _c;
16447
+ if (this.options.isVerbose) {
16448
+ console.info('💬 OpenAI callChatModel call', { prompt });
16449
+ }
16450
+ const { content, parameters, modelRequirements /*, format*/ } = prompt;
16451
+ const client = await this.getClient();
16452
+ // TODO: [☂] Use here more modelRequirements
16453
+ if (modelRequirements.modelVariant !== 'CHAT') {
16454
+ throw new PipelineExecutionError('Use callChatModel only for CHAT variant');
16455
+ }
16456
+ // TODO: [👨‍👨‍👧‍👧] Remove:
16457
+ for (const key of ['maxTokens', 'modelName', 'seed', 'temperature']) {
16458
+ if (modelRequirements[key] !== undefined) {
16459
+ throw new NotYetImplementedError(`In \`OpenAiAssistantExecutionTools\` you cannot specify \`${key}\``);
16460
+ }
16461
+ }
16462
+ /*
16463
+ TODO: [👨‍👨‍👧‍👧] Implement all of this for Assistants
16464
+ const modelName = modelRequirements.modelName || this.getDefaultChatModel().modelName;
16465
+ const modelSettings = {
16466
+ model: modelName,
16467
+
16468
+ temperature: modelRequirements.temperature,
16469
+
16470
+ // <- TODO: [🈁] Use `seed` here AND/OR use is `isDeterministic` for entire execution tools
16471
+ // <- Note: [🧆]
16472
+ } as OpenAI.Chat.Completions.CompletionCreateParamsNonStreaming; // <- TODO: Guard here types better
16473
+
16474
+ if (format === 'JSON') {
16475
+ modelSettings.response_format = {
16476
+ type: 'json_object',
16477
+ };
16478
+ }
16479
+ */
16480
+ // <- TODO: [🚸] Not all models are compatible with JSON mode
16481
+ // > 'response_format' of type 'json_object' is not supported with this model.
16482
+ const rawPromptContent = templateParameters(content, {
16483
+ ...parameters,
16484
+ modelName: 'assistant',
16485
+ // <- [🧠] What is the best value here
16486
+ });
16487
+ const rawRequest = {
16488
+ // TODO: [👨‍👨‍👧‍👧] ...modelSettings,
16489
+ // TODO: [👨‍👨‍👧‍👧][🧠] What about system message for assistants, does it make sense - combination of OpenAI assistants with Promptbook Personas
16490
+ assistant_id: this.assistantId,
16491
+ thread: {
16492
+ messages: 'thread' in prompt &&
16493
+ Array.isArray(prompt.thread)
16494
+ ? prompt.thread.map((msg) => ({
16495
+ role: msg.role === 'assistant' ? 'assistant' : 'user',
16496
+ content: msg.content,
16497
+ }))
16498
+ : [{ role: 'user', content: rawPromptContent }],
16499
+ },
16500
+ // <- TODO: Add user identification here> user: this.options.user,
16501
+ };
16502
+ const start = $getCurrentDate();
16503
+ let complete;
16504
+ if (this.options.isVerbose) {
16505
+ console.info(colors.bgWhite('rawRequest'), JSON.stringify(rawRequest, null, 4));
16506
+ }
16507
+ const stream = await client.beta.threads.createAndRunStream(rawRequest);
16508
+ stream.on('connect', () => {
16509
+ if (this.options.isVerbose) {
16510
+ console.info('connect', stream.currentEvent);
16511
+ }
16512
+ });
16513
+ stream.on('messageDelta', (messageDelta) => {
16514
+ var _a;
16515
+ if (this.options.isVerbose &&
16516
+ messageDelta &&
16517
+ messageDelta.content &&
16518
+ messageDelta.content[0] &&
16519
+ messageDelta.content[0].type === 'text') {
16520
+ console.info('messageDelta', (_a = messageDelta.content[0].text) === null || _a === void 0 ? void 0 : _a.value);
16521
+ }
16522
+ // <- TODO: [🐚] Make streaming and running tasks working
16523
+ });
16524
+ stream.on('messageCreated', (message) => {
16525
+ if (this.options.isVerbose) {
16526
+ console.info('messageCreated', message);
16527
+ }
16528
+ });
16529
+ stream.on('messageDone', (message) => {
16530
+ if (this.options.isVerbose) {
16531
+ console.info('messageDone', message);
16532
+ }
16533
+ });
16534
+ const rawResponse = await stream.finalMessages();
16535
+ if (this.options.isVerbose) {
16536
+ console.info(colors.bgWhite('rawResponse'), JSON.stringify(rawResponse, null, 4));
16537
+ }
16538
+ if (rawResponse.length !== 1) {
16539
+ throw new PipelineExecutionError(`There is NOT 1 BUT ${rawResponse.length} finalMessages from OpenAI`);
16540
+ }
16541
+ if (rawResponse[0].content.length !== 1) {
16542
+ throw new PipelineExecutionError(`There is NOT 1 BUT ${rawResponse[0].content.length} finalMessages content from OpenAI`);
16543
+ }
16544
+ if (((_a = rawResponse[0].content[0]) === null || _a === void 0 ? void 0 : _a.type) !== 'text') {
16545
+ 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`);
16546
+ }
16547
+ const resultContent = (_c = rawResponse[0].content[0]) === null || _c === void 0 ? void 0 : _c.text.value;
16548
+ // <- TODO: [🧠] There are also annotations, maybe use them
16549
+ // eslint-disable-next-line prefer-const
16550
+ complete = $getCurrentDate();
16551
+ const usage = UNCERTAIN_USAGE;
16552
+ // <- TODO: [🥘] Compute real usage for assistant
16553
+ // ?> const usage = computeOpenAiUsage(content, resultContent || '', rawResponse);
16554
+ if (resultContent === null) {
16555
+ throw new PipelineExecutionError('No response message from OpenAI');
16556
+ }
16557
+ return exportJson({
16558
+ name: 'promptResult',
16559
+ message: `Result of \`OpenAiAssistantExecutionTools.callChatModel\``,
16560
+ order: [],
16561
+ value: {
16562
+ content: resultContent,
16563
+ modelName: 'assistant',
16564
+ // <- TODO: [🥘] Detect used model in assistant
16565
+ // ?> model: rawResponse.model || modelName,
16566
+ timing: {
16567
+ start,
16568
+ complete,
16569
+ },
16570
+ usage,
16571
+ rawPromptContent,
16572
+ rawRequest,
16573
+ rawResponse,
16574
+ // <- [🗯]
16575
+ },
16576
+ });
16577
+ }
16578
+ async createNewAssistant() {
16579
+ if (!this.isCreatingNewAssistantsAllowed) {
16580
+ throw new NotAllowed(`Creating new assistants is not allowed. Set \`isCreatingNewAssistantsAllowed: true\` in options to enable this feature.`);
16581
+ }
16582
+ const client = await this.getClient();
16583
+ /*
16584
+ TODO: !!!
16585
+ async function downloadFile(url: string, folder = './tmp'): Promise<string> {
16586
+ const filename = path.basename(url.split('?')[0]);
16587
+ const filepath = path.join(folder, filename);
16588
+
16589
+ if (!fs.existsSync(folder)) fs.mkdirSync(folder);
16590
+
16591
+ const res = await fetch(url);
16592
+ if (!res.ok) throw new Error(`Download error: ${url}`);
16593
+ const buffer = await res.arrayBuffer();
16594
+ fs.writeFileSync(filepath, Buffer.from(buffer));
16595
+ console.log(`📥 File downloaded: ${filename}`);
16596
+
16597
+ return filepath;
16598
+ }
16599
+
16600
+ async function uploadFileToOpenAI(filepath: string) {
16601
+ const file = await client.files.create({
16602
+ file: fs.createReadStream(filepath),
16603
+ purpose: 'assistants',
16604
+ });
16605
+ console.log(`⬆️ File uploaded to OpenAI: ${file.filename} (${file.id})`);
16606
+ return file;
16607
+ }
16608
+
16609
+ // 🌐 URL addresses of files to upload
16610
+ const fileUrls = [
16611
+ 'https://raw.githubusercontent.com/vercel/next.js/canary/packages/next/README.md',
16612
+ 'https://raw.githubusercontent.com/openai/openai-cookbook/main/examples/How_to_call_the_Assistants_API_with_Node.js.ipynb',
16613
+ ];
16614
+
16615
+ // 1️⃣ Download files from URL
16616
+ const localFiles = [];
16617
+ for (const url of fileUrls) {
16618
+ const filepath = await downloadFile(url);
16619
+ localFiles.push(filepath);
16620
+ }
16621
+
16622
+ // 2️⃣ Upload files to OpenAI
16623
+ const uploadedFiles = [];
16624
+ for (const filepath of localFiles) {
16625
+ const file = await uploadFileToOpenAI(filepath);
16626
+ uploadedFiles.push(file.id);
16627
+ }
16628
+ */
16629
+ // 3️⃣ Create assistant with uploaded files
16630
+ const assistant = await client.beta.assistants.create({
16631
+ name: 'Next.js documentation assistant',
16632
+ description: 'Assistant that can answer questions about Next.js and working with APIs.',
16633
+ model: 'gpt-4o',
16634
+ instructions: spaceTrim(`
16635
+ Answer clearly and comprehensively.
16636
+ Quote parts from uploaded files if needed.
16637
+ `),
16638
+ // <- TODO: !!!! Generate the `instructions` from passed `agentSource` (generate outside of this class)
16639
+ tools: [{ type: 'code_interpreter' }, { type: 'file_search' }],
16640
+ // !!!! file_ids: uploadedFiles,
16641
+ });
16642
+ // TODO: !!!! Change Czech to English
16643
+ console.log(`✅ Assistant created: ${assistant.id}`);
16644
+ return new OpenAiAssistantExecutionTools({
16645
+ ...this.options,
16646
+ isCreatingNewAssistantsAllowed: false,
16647
+ assistantId: assistant.id,
16648
+ });
16649
+ }
16650
+ /**
16651
+ * Discriminant for type guards
16652
+ */
16653
+ get discriminant() {
16654
+ return DISCRIMINANT;
16655
+ }
16656
+ /**
16657
+ * Type guard to check if given `LlmExecutionTools` are instanceof `OpenAiAssistantExecutionTools`
16658
+ *
16659
+ * Note: This is useful when you can possibly have multiple versions of `@promptbook/openai` installed
16660
+ */
16661
+ static isOpenAiAssistantExecutionTools(llmExecutionTools) {
16662
+ return llmExecutionTools.discriminant === DISCRIMINANT;
16663
+ }
16664
+ }
16665
+ /**
16666
+ * Discriminant for type guards
16667
+ *
16668
+ * @private const of `OpenAiAssistantExecutionTools`
16669
+ */
16670
+ const DISCRIMINANT = 'OPEN_AI_ASSISTANT_V1';
16671
+ /**
16672
+ * TODO: [🧠][🧙‍♂️] Maybe there can be some wizard for those who want to use just OpenAI
16673
+ * TODO: Maybe make custom OpenAiError
16674
+ * TODO: [🧠][🈁] Maybe use `isDeterministic` from options
16675
+ * TODO: [🧠][🌰] Allow to pass `title` for tracking purposes
16676
+ */
16677
+
16678
+ /**
16679
+ * Execution Tools for calling LLM models with a predefined agent "soul"
16680
+ * This wraps underlying LLM execution tools and applies agent-specific system prompts and requirements
16681
+ *
16682
+ * @public exported from `@promptbook/core`
16683
+ */
16684
+ class AgentLlmExecutionTools {
16685
+ /**
16686
+ * Creates new AgentLlmExecutionTools
16687
+ *
16688
+ * @param llmTools The underlying LLM execution tools to wrap
16689
+ * @param agentSource The agent source string that defines the agent's behavior
16690
+ */
16691
+ constructor(llmTools, agentSource) {
16692
+ this.llmTools = llmTools;
16693
+ this.agentSource = agentSource;
16694
+ /**
16695
+ * Cached model requirements to avoid re-parsing the agent source
16696
+ */
16697
+ this._cachedModelRequirements = null;
16698
+ /**
16699
+ * Cached parsed agent information
16700
+ */
16701
+ this._cachedAgentInfo = null;
16702
+ // <- TODO: !!!! CreateAgentLlmExecutionToolsOptions
16703
+ // <- TODO: !!!! Leverage `OpenAiAssistantExecutionTools`
16704
+ }
16705
+ /**
16706
+ * Get cached or parse agent information
16707
+ */
16708
+ getAgentInfo() {
16709
+ if (this._cachedAgentInfo === null) {
16710
+ this._cachedAgentInfo = parseAgentSource(this.agentSource);
16711
+ }
16712
+ return this._cachedAgentInfo;
16713
+ }
16714
+ /**
16715
+ * Get cached or create agent model requirements
16716
+ */
16717
+ async getAgentModelRequirements() {
16718
+ if (this._cachedModelRequirements === null) {
16719
+ // Get available models from underlying LLM tools for best model selection
16720
+ const availableModels = await this.llmTools.listModels();
16721
+ this._cachedModelRequirements = await createAgentModelRequirements(this.agentSource, undefined, // Let the function pick the best model
16722
+ availableModels);
16723
+ }
16724
+ return this._cachedModelRequirements;
16725
+ }
16726
+ get title() {
16727
+ const agentInfo = this.getAgentInfo();
16728
+ return (agentInfo.agentName || 'Agent');
16729
+ }
16730
+ get description() {
16731
+ const agentInfo = this.getAgentInfo();
16732
+ return agentInfo.personaDescription || 'AI Agent with predefined personality and behavior';
16733
+ }
16734
+ get profile() {
16735
+ const agentInfo = this.getAgentInfo();
16736
+ if (!agentInfo.agentName) {
16737
+ return undefined;
16738
+ }
16739
+ return {
16740
+ name: agentInfo.agentName.toUpperCase().replace(/\s+/g, '_'),
16741
+ fullname: agentInfo.agentName,
16742
+ color: agentInfo.meta.color || '#6366f1',
16743
+ avatarSrc: agentInfo.meta.image,
16744
+ };
16745
+ }
16746
+ checkConfiguration() {
16747
+ // Check underlying tools configuration
16748
+ return this.llmTools.checkConfiguration();
16749
+ }
16750
+ /**
16751
+ * Returns a virtual model name representing the agent behavior
16752
+ */
16753
+ get modelName() {
16754
+ const hash = SHA256(hexEncoder.parse(this.agentSource))
16755
+ // <- TODO: [🥬] Encapsulate sha256 to some private utility function
16756
+ .toString( /* hex */);
16757
+ // <- TODO: [🥬] Make some system for hashes and ids of promptbook
16758
+ const agentId = hash.substring(0, 10);
16759
+ // <- TODO: [🥬] Make some system for hashes and ids of promptbook
16760
+ return (normalizeToKebabCase(this.title) + '-' + agentId);
16761
+ }
16762
+ listModels() {
16763
+ return [
16764
+ {
16765
+ modelName: this.modelName,
16766
+ modelVariant: 'CHAT',
16767
+ modelTitle: `${this.title} (Agent Chat Default)`,
16768
+ modelDescription: `Chat model with agent behavior: ${this.description}`,
16769
+ },
16770
+ // <- Note: We only list a single "virtual" agent model here as this wrapper only supports chat prompts
16771
+ ];
16772
+ }
16773
+ /**
16774
+ * Calls the chat model with agent-specific system prompt and requirements
16775
+ */
16776
+ async callChatModel(prompt) {
16777
+ if (!this.llmTools.callChatModel) {
16778
+ throw new Error('Underlying LLM execution tools do not support chat model calls');
16779
+ }
16780
+ // Ensure we're working with a chat prompt
16781
+ if (prompt.modelRequirements.modelVariant !== 'CHAT') {
16782
+ throw new Error('AgentLlmExecutionTools only supports chat prompts');
16783
+ }
16784
+ const chatPrompt = prompt;
16785
+ let underlyingLlmResult;
16786
+ if (OpenAiAssistantExecutionTools.isOpenAiAssistantExecutionTools(this.llmTools)) {
16787
+ // <- TODO: !!! Check also `isCreatingNewAssistantsAllowed` and warn about it
16788
+ const assistant = await this.llmTools.createNewAssistant( /* <- TODO: !!!! Generate the `instructions` from passed `agentSource` */);
16789
+ // <- TODO: !!! Cache the assistant in prepareCache
16790
+ underlyingLlmResult = await assistant.callChatModel(chatPrompt);
16791
+ }
16792
+ else {
16793
+ // Get agent model requirements (cached with best model selection)
16794
+ const modelRequirements = await this.getAgentModelRequirements();
16795
+ // Create modified chat prompt with agent system message
16796
+ const modifiedChatPrompt = {
16797
+ ...chatPrompt,
16798
+ modelRequirements: {
16799
+ ...chatPrompt.modelRequirements,
16800
+ ...modelRequirements,
16801
+ // Prepend agent system message to existing system message
16802
+ systemMessage: modelRequirements.systemMessage +
16803
+ (chatPrompt.modelRequirements.systemMessage
16804
+ ? `\n\n${chatPrompt.modelRequirements.systemMessage}`
16805
+ : ''),
16806
+ },
16807
+ };
16808
+ underlyingLlmResult = await this.llmTools.callChatModel(modifiedChatPrompt);
16809
+ }
16810
+ let content = underlyingLlmResult.content;
16811
+ // Note: Cleanup the AI artifacts from the content
16812
+ content = humanizeAiText(content);
16813
+ // Note: Make sure the content is Promptbook-like
16814
+ content = promptbookifyAiText(content);
16815
+ const agentResult = {
16816
+ ...underlyingLlmResult,
16817
+ content,
16818
+ modelName: this.modelName,
16819
+ };
16820
+ return agentResult;
16821
+ }
16822
+ }
16823
+ /**
16824
+ * TODO: [🍚] Implement Destroyable pattern to free resources
16825
+ * TODO: [🧠] Adding parameter substitution support (here or should be responsibility of the underlying LLM Tools)
16826
+ */
16827
+
16828
+ /**
16829
+ * Creates new AgentLlmExecutionTools that wrap underlying LLM tools with agent-specific behavior
16830
+ *
16831
+ * @public exported from `@promptbook/core`
16832
+ */
16833
+ const createAgentLlmExecutionTools = Object.assign((options) => {
16834
+ /*
16835
+ if (llmTools instanceof OpenAiAssistantExecutionTools) {
16836
+ // !!!!! Leverage `OpenAiAssistantExecutionTools` specific features here
16837
+ }*/
16838
+ return new AgentLlmExecutionTools(options.llmTools, options.agentSource);
16839
+ }, {
16840
+ packageName: '@promptbook/core',
16841
+ className: 'AgentLlmExecutionTools',
16842
+ });
16843
+ /**
16844
+ * TODO: [🧠] Consider adding validation for agent source format
16845
+ * TODO: [🧠] Consider adding options for caching behavior
16846
+ */
16847
+
16848
+ /**
16849
+ * Metadata for Agent LLM execution tools
16850
+ *
16851
+ * @public exported from `@promptbook/core`
16852
+ */
16853
+ const _AgentMetadata = $llmToolsMetadataRegister.register({
16854
+ packageName: '@promptbook/core',
16855
+ className: 'AgentLlmExecutionTools',
16856
+ title: 'Agent',
16857
+ trustLevel: 'UNTRUSTED',
16858
+ order: MODEL_ORDERS.LOW_TIER,
16859
+ envVariables: null,
16860
+ getBoilerplateConfiguration() {
16861
+ return {
16862
+ packageName: '@promptbook/core',
16863
+ className: 'AgentLlmExecutionTools',
16864
+ title: 'Agent',
16865
+ options: {
16866
+ // Note: Agent tools require runtime configuration with underlying tools and agent source
16867
+ // This cannot be provided as a static configuration
16868
+ },
16869
+ };
16870
+ },
16871
+ createConfigurationFromEnv() {
16872
+ // Agent tools cannot be configured from environment variables alone
16873
+ // They require underlying LLM tools and agent source to be provided programmatically
16874
+ return null;
16875
+ },
16876
+ });
16877
+ /**
16878
+ * TODO: [🧠] Consider adding a special trust level for AgentLlmExecutionTools
16879
+ * TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
16880
+ * Note: [💞] Ignore a discrepancy between file name and entity name
16881
+ */
16882
+
16883
+ /**
16884
+ * Registration of Agent LLM provider
16885
+ *
16886
+ * Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available LLM tools
16887
+ *
16888
+ * @public exported from `@promptbook/core`
16889
+ */
16890
+ const _AgentRegistration = $llmToolsRegister.register(createAgentLlmExecutionTools);
16891
+ /**
16892
+ * TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
16893
+ * Note: [💞] Ignore a discrepancy between file name and entity name
16894
+ */
16895
+
16896
+ /**
16897
+ * Registration of LLM provider metadata
16898
+ *
16899
+ * Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available LLM tools
16900
+ *
16901
+ * @public exported from `@promptbook/core`
16902
+ * @public exported from `@promptbook/wizard`
16903
+ * @public exported from `@promptbook/cli`
16904
+ */
16905
+ const _AnthropicClaudeMetadataRegistration = $llmToolsMetadataRegister.register({
16906
+ title: 'Anthropic Claude',
16907
+ packageName: '@promptbook/anthropic-claude',
16908
+ className: 'AnthropicClaudeExecutionTools',
16909
+ envVariables: ['ANTHROPIC_CLAUDE_API_KEY'],
16910
+ trustLevel: 'CLOSED',
16911
+ order: MODEL_ORDERS.TOP_TIER,
16912
+ getBoilerplateConfiguration() {
16913
+ return {
15088
16914
  title: 'Anthropic Claude',
15089
16915
  packageName: '@promptbook/anthropic-claude',
15090
16916
  className: 'AnthropicClaudeExecutionTools',
@@ -16034,8 +17860,144 @@ const OpenAiSdkTranspiler = {
16034
17860
  packageName: '@promptbook/core',
16035
17861
  className: 'OpenAiSdkTranspiler',
16036
17862
  async transpileBook(book, tools, options) {
16037
- const { agentName, personaDescription } = await parseAgentSource(book);
17863
+ const { agentName } = await parseAgentSource(book);
16038
17864
  const modelRequirements = await createAgentModelRequirements(book);
17865
+ const { commitments } = parseAgentSourceWithCommitments(book);
17866
+ const knowledgeCommitments = commitments.filter((commitment) => commitment.type === 'KNOWLEDGE');
17867
+ const directKnowledge = knowledgeCommitments
17868
+ .map((commitment) => commitment.content.trim())
17869
+ .filter((content) => {
17870
+ try {
17871
+ new URL(content);
17872
+ return false;
17873
+ }
17874
+ catch (_a) {
17875
+ return true;
17876
+ }
17877
+ });
17878
+ const knowledgeSources = knowledgeCommitments
17879
+ .map((commitment) => commitment.content.trim())
17880
+ .filter((content) => {
17881
+ try {
17882
+ new URL(content);
17883
+ return true;
17884
+ }
17885
+ catch (_a) {
17886
+ return false;
17887
+ }
17888
+ });
17889
+ const KNOWLEDGE_THRESHOLD = 1000;
17890
+ if (directKnowledge.join('\n').length > KNOWLEDGE_THRESHOLD || knowledgeSources.length > 0) {
17891
+ return spaceTrim((block) => `
17892
+ #!/usr/bin/env node
17893
+
17894
+ import * as dotenv from 'dotenv';
17895
+ dotenv.config({ path: '.env' });
17896
+
17897
+ import { spaceTrim } from '@promptbook/utils';
17898
+ import OpenAI from 'openai';
17899
+ import readline from 'readline';
17900
+ import { Document, VectorStoreIndex, SimpleDirectoryReader } from 'llamaindex';
17901
+
17902
+ // ---- CONFIG ----
17903
+ const client = new OpenAI({
17904
+ apiKey: process.env.OPENAI_API_KEY,
17905
+ });
17906
+
17907
+ // ---- KNOWLEDGE ----
17908
+ const knowledge = ${block(JSON.stringify(directKnowledge, null, 4) /* <- TODO: Use here Promptbook stringify */)};
17909
+ const knowledgeSources = ${block(JSON.stringify(knowledgeSources, null, 4) /* <- TODO: Use here Promptbook stringify */)};
17910
+ let index;
17911
+
17912
+ async function setupKnowledge() {
17913
+ const documents = knowledge.map((text) => new Document({ text }));
17914
+
17915
+ for (const source of knowledgeSources) {
17916
+ try {
17917
+ // Note: SimpleDirectoryReader is a bit of a misnomer, it can read single files
17918
+ const reader = new SimpleDirectoryReader();
17919
+ const sourceDocuments = await reader.loadData(source);
17920
+ documents.push(...sourceDocuments);
17921
+ } catch (error) {
17922
+ console.error(\`Error loading knowledge from \${source}:\`, error);
17923
+ }
17924
+ }
17925
+
17926
+ if (documents.length > 0) {
17927
+ index = await VectorStoreIndex.fromDocuments(documents);
17928
+ console.log('🧠 Knowledge base prepared.');
17929
+ }
17930
+ }
17931
+
17932
+ // ---- CLI SETUP ----
17933
+ const rl = readline.createInterface({
17934
+ input: process.stdin,
17935
+ output: process.stdout,
17936
+ });
17937
+
17938
+ const chatHistory = [
17939
+ {
17940
+ role: 'system',
17941
+ content: spaceTrim(\`
17942
+ ${block(modelRequirements.systemMessage)}
17943
+ \`),
17944
+ },
17945
+ ];
17946
+
17947
+ async function ask(question) {
17948
+ let context = '';
17949
+ if (index) {
17950
+ const retriever = index.asRetriever();
17951
+ const relevantNodes = await retriever.retrieve(question);
17952
+ context = relevantNodes.map((node) => node.getContent()).join('\\n\\n');
17953
+ }
17954
+
17955
+ const userMessage = spaceTrim(\`
17956
+ ${block(spaceTrim(`
17957
+ Here is some additional context to help you answer the question:
17958
+ \${context}
17959
+
17960
+ ---
17961
+
17962
+ My question is:
17963
+ \${question}
17964
+ `))}
17965
+ \`);
17966
+
17967
+
17968
+ chatHistory.push({ role: 'user', content: userMessage });
17969
+
17970
+ const response = await client.chat.completions.create({
17971
+ model: 'gpt-4o',
17972
+ messages: chatHistory,
17973
+ temperature: ${modelRequirements.temperature},
17974
+ });
17975
+
17976
+ const answer = response.choices[0].message.content;
17977
+ console.log('\\n🧠 ${agentName}:', answer, '\\n');
17978
+
17979
+ chatHistory.push({ role: 'assistant', content: answer });
17980
+ promptUser();
17981
+ }
17982
+
17983
+ function promptUser() {
17984
+ rl.question('💬 You: ', (input) => {
17985
+ if (input.trim().toLowerCase() === 'exit') {
17986
+ console.log('👋 Bye!');
17987
+ rl.close();
17988
+ return;
17989
+ }
17990
+ ask(input);
17991
+ });
17992
+ }
17993
+
17994
+ (async () => {
17995
+ await setupKnowledge();
17996
+ console.log("🤖 Chat with ${agentName} (type 'exit' to quit)\\n");
17997
+ promptUser();
17998
+ })();
17999
+ `);
18000
+ }
16039
18001
  const source = spaceTrim((block) => `
16040
18002
 
16041
18003
  #!/usr/bin/env node
@@ -16143,5 +18105,5 @@ function aboutPromptbookInformation(options) {
16143
18105
  * TODO: [🗽] Unite branding and make single place for it
16144
18106
  */
16145
18107
 
16146
- export { $bookTranspilersRegister, $llmToolsMetadataRegister, $llmToolsRegister, $scrapersMetadataRegister, $scrapersRegister, ADMIN_EMAIL, ADMIN_GITHUB_NAME, API_REQUEST_TIMEOUT, AbstractFormatError, AgentLlmExecutionTools, AuthenticationError, BIG_DATASET_TRESHOLD, BOOK_LANGUAGE_VERSION, BlackholeStorage, BoilerplateError, BoilerplateFormfactorDefinition, CLAIM, CLI_APP_ID, CallbackInterfaceTools, ChatbotFormfactorDefinition, CollectionError, CompletionFormfactorDefinition, CsvFormatError, CsvFormatParser, DEFAULT_BOOK, DEFAULT_BOOKS_DIRNAME, DEFAULT_BOOK_OUTPUT_PARAMETER_NAME, DEFAULT_BOOK_TITLE, DEFAULT_CSV_SETTINGS, DEFAULT_DOWNLOAD_CACHE_DIRNAME, DEFAULT_EXECUTION_CACHE_DIRNAME, DEFAULT_GET_PIPELINE_COLLECTION_FUNCTION_NAME, DEFAULT_INTERMEDIATE_FILES_STRATEGY, DEFAULT_IS_AUTO_INSTALLED, DEFAULT_IS_VERBOSE, DEFAULT_MAX_EXECUTION_ATTEMPTS, DEFAULT_MAX_FILE_SIZE, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL, DEFAULT_MAX_PARALLEL_COUNT, DEFAULT_MAX_REQUESTS_PER_MINUTE, DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME, DEFAULT_PROMPT_TASK_TITLE, DEFAULT_REMOTE_SERVER_URL, DEFAULT_SCRAPE_CACHE_DIRNAME, DEFAULT_TASK_SIMULATED_DURATION_MS, DEFAULT_TASK_TITLE, EXPECTATION_UNITS, EnvironmentMismatchError, ExecutionReportStringOptionsDefaults, ExpectError, FAILED_VALUE_PLACEHOLDER, FORMFACTOR_DEFINITIONS, FormattedBookInMarkdownTranspiler, GENERIC_PIPELINE_INTERFACE, GeneratorFormfactorDefinition, GenericFormfactorDefinition, ImageGeneratorFormfactorDefinition, KnowledgeScrapeError, LimitReachedError, MANDATORY_CSV_SETTINGS, MAX_FILENAME_LENGTH, MODEL_ORDERS, MODEL_TRUST_LEVELS, MODEL_VARIANTS, MatcherFormfactorDefinition, MemoryStorage, MissingToolsError, MultipleLlmExecutionTools, NAME, NonTaskSectionTypes, NotFoundError, NotYetImplementedCommitmentDefinition, NotYetImplementedError, ORDER_OF_PIPELINE_JSON, OpenAiSdkTranspiler, PADDING_LINES, PENDING_VALUE_PLACEHOLDER, PLAYGROUND_APP_ID, PROMPTBOOK_CHAT_COLOR, PROMPTBOOK_COLOR, PROMPTBOOK_ENGINE_VERSION, PROMPTBOOK_ERRORS, PROMPTBOOK_LOGO_URL, PROMPTBOOK_SYNTAX_COLORS, ParseError, PipelineExecutionError, PipelineLogicError, PipelineUrlError, PrefixStorage, PromptbookFetchError, REMOTE_SERVER_URLS, RESERVED_PARAMETER_NAMES, SET_IS_VERBOSE, SectionTypes, SheetsFormfactorDefinition, TaskTypes, TextFormatParser, TranslatorFormfactorDefinition, UNCERTAIN_USAGE, UNCERTAIN_ZERO_VALUE, USER_CHAT_COLOR, UnexpectedError, WrappedError, ZERO_USAGE, ZERO_VALUE, _AgentMetadata, _AgentRegistration, _AnthropicClaudeMetadataRegistration, _AzureOpenAiMetadataRegistration, _BoilerplateScraperMetadataRegistration, _DeepseekMetadataRegistration, _DocumentScraperMetadataRegistration, _GoogleMetadataRegistration, _LegacyDocumentScraperMetadataRegistration, _MarkdownScraperMetadataRegistration, _MarkitdownScraperMetadataRegistration, _OllamaMetadataRegistration, _OpenAiAssistantMetadataRegistration, _OpenAiCompatibleMetadataRegistration, _OpenAiMetadataRegistration, _PdfScraperMetadataRegistration, _WebsiteScraperMetadataRegistration, aboutPromptbookInformation, addUsage, book, cacheLlmTools, collectionToJson, compilePipeline, computeCosineSimilarity, countUsage, createAgentLlmExecutionTools, createAgentModelRequirements, createAgentModelRequirementsWithCommitments, createBasicAgentModelRequirements, createCollectionFromJson, createCollectionFromPromise, createCollectionFromUrl, createEmptyAgentModelRequirements, createLlmToolsFromConfiguration, createPipelineExecutor, createSubcollection, embeddingVectorToString, executionReportJsonToString, extractParameterNamesFromTask, filterModels, generatePlaceholderAgentProfileImageUrl, getAllCommitmentDefinitions, getAllCommitmentTypes, getCommitmentDefinition, getPipelineInterface, getSingleLlmExecutionTools, identificationToPromptbookToken, isCommitmentSupported, isPassingExpectations, isPipelineImplementingInterface, isPipelineInterfacesEqual, isPipelinePrepared, isValidBook, isValidPipelineString, joinLlmExecutionTools, limitTotalUsage, makeKnowledgeSourceHandler, migratePipeline, padBook, parseAgentSource, parseParameters, parsePipeline, pipelineJsonToString, prepareKnowledgePieces, preparePersona, preparePipeline, prettifyPipelineString, promptbookFetch, promptbookTokenToIdentification, unpreparePipeline, usageToHuman, usageToWorktime, validateBook, validatePipeline, validatePipelineString };
18108
+ export { $bookTranspilersRegister, $llmToolsMetadataRegister, $llmToolsRegister, $scrapersMetadataRegister, $scrapersRegister, ADMIN_EMAIL, ADMIN_GITHUB_NAME, API_REQUEST_TIMEOUT, AbstractFormatError, Agent, AgentLlmExecutionTools, AuthenticationError, BIG_DATASET_TRESHOLD, BOOK_LANGUAGE_VERSION, BlackholeStorage, BoilerplateError, BoilerplateFormfactorDefinition, CLAIM, CLI_APP_ID, CallbackInterfaceTools, ChatbotFormfactorDefinition, CollectionError, CompletionFormfactorDefinition, CsvFormatError, CsvFormatParser, DEFAULT_BOOK, DEFAULT_BOOKS_DIRNAME, DEFAULT_BOOK_OUTPUT_PARAMETER_NAME, DEFAULT_BOOK_TITLE, DEFAULT_CSV_SETTINGS, DEFAULT_DOWNLOAD_CACHE_DIRNAME, DEFAULT_EXECUTION_CACHE_DIRNAME, DEFAULT_GET_PIPELINE_COLLECTION_FUNCTION_NAME, DEFAULT_INTERMEDIATE_FILES_STRATEGY, DEFAULT_IS_AUTO_INSTALLED, DEFAULT_IS_VERBOSE, DEFAULT_MAX_EXECUTION_ATTEMPTS, DEFAULT_MAX_FILE_SIZE, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL, DEFAULT_MAX_PARALLEL_COUNT, DEFAULT_MAX_REQUESTS_PER_MINUTE, DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME, DEFAULT_PROMPT_TASK_TITLE, DEFAULT_REMOTE_SERVER_URL, DEFAULT_SCRAPE_CACHE_DIRNAME, DEFAULT_TASK_SIMULATED_DURATION_MS, DEFAULT_TASK_TITLE, EXPECTATION_UNITS, EnvironmentMismatchError, ExecutionReportStringOptionsDefaults, ExpectError, FAILED_VALUE_PLACEHOLDER, FORMFACTOR_DEFINITIONS, FormattedBookInMarkdownTranspiler, GENERIC_PIPELINE_INTERFACE, GeneratorFormfactorDefinition, GenericFormfactorDefinition, ImageGeneratorFormfactorDefinition, KnowledgeScrapeError, LimitReachedError, MANDATORY_CSV_SETTINGS, MAX_FILENAME_LENGTH, MODEL_ORDERS, MODEL_TRUST_LEVELS, MODEL_VARIANTS, MatcherFormfactorDefinition, MemoryStorage, MissingToolsError, MultipleLlmExecutionTools, NAME, NonTaskSectionTypes, NotAllowed, NotFoundError, NotYetImplementedCommitmentDefinition, NotYetImplementedError, ORDER_OF_PIPELINE_JSON, OpenAiSdkTranspiler, PADDING_LINES, PENDING_VALUE_PLACEHOLDER, PLAYGROUND_APP_ID, PROMPTBOOK_CHAT_COLOR, PROMPTBOOK_COLOR, PROMPTBOOK_ENGINE_VERSION, PROMPTBOOK_ERRORS, PROMPTBOOK_LOGO_URL, PROMPTBOOK_SYNTAX_COLORS, ParseError, PipelineExecutionError, PipelineLogicError, PipelineUrlError, PrefixStorage, PromptbookFetchError, REMOTE_SERVER_URLS, RESERVED_PARAMETER_NAMES, SET_IS_VERBOSE, SectionTypes, SheetsFormfactorDefinition, TaskTypes, TextFormatParser, TranslatorFormfactorDefinition, UNCERTAIN_USAGE, UNCERTAIN_ZERO_VALUE, USER_CHAT_COLOR, UnexpectedError, WrappedError, ZERO_USAGE, ZERO_VALUE, _AgentMetadata, _AgentRegistration, _AnthropicClaudeMetadataRegistration, _AzureOpenAiMetadataRegistration, _BoilerplateScraperMetadataRegistration, _DeepseekMetadataRegistration, _DocumentScraperMetadataRegistration, _GoogleMetadataRegistration, _LegacyDocumentScraperMetadataRegistration, _MarkdownScraperMetadataRegistration, _MarkitdownScraperMetadataRegistration, _OllamaMetadataRegistration, _OpenAiAssistantMetadataRegistration, _OpenAiCompatibleMetadataRegistration, _OpenAiMetadataRegistration, _PdfScraperMetadataRegistration, _WebsiteScraperMetadataRegistration, aboutPromptbookInformation, addUsage, book, cacheLlmTools, collectionToJson, compilePipeline, computeCosineSimilarity, countUsage, createAgentLlmExecutionTools, createAgentModelRequirements, createAgentModelRequirementsWithCommitments, createBasicAgentModelRequirements, createCollectionFromJson, createCollectionFromPromise, createCollectionFromUrl, createEmptyAgentModelRequirements, createLlmToolsFromConfiguration, createPipelineExecutor, createSubcollection, embeddingVectorToString, executionReportJsonToString, extractParameterNamesFromTask, filterModels, generatePlaceholderAgentProfileImageUrl, getAllCommitmentDefinitions, getAllCommitmentTypes, getCommitmentDefinition, getPipelineInterface, getSingleLlmExecutionTools, identificationToPromptbookToken, isCommitmentSupported, isPassingExpectations, isPipelineImplementingInterface, isPipelineInterfacesEqual, isPipelinePrepared, isValidBook, isValidPipelineString, joinLlmExecutionTools, limitTotalUsage, makeKnowledgeSourceHandler, migratePipeline, padBook, parseAgentSource, parseParameters, parsePipeline, pipelineJsonToString, prepareKnowledgePieces, preparePersona, preparePipeline, prettifyPipelineString, promptbookFetch, promptbookTokenToIdentification, unpreparePipeline, usageToHuman, usageToWorktime, validateBook, validatePipeline, validatePipelineString };
16147
18109
  //# sourceMappingURL=index.es.js.map