@promptbook/openai 0.100.0-6 → 0.100.0-61

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 (129) hide show
  1. package/README.md +2 -8
  2. package/esm/index.es.js +304 -12
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/src/_packages/color.index.d.ts +50 -0
  5. package/esm/typings/src/_packages/components.index.d.ts +36 -0
  6. package/esm/typings/src/_packages/core.index.d.ts +30 -0
  7. package/esm/typings/src/_packages/types.index.d.ts +38 -0
  8. package/esm/typings/src/book-2.0/agent-source/parseAgentSource.d.ts +30 -0
  9. package/esm/typings/src/book-2.0/agent-source/parseAgentSource.test.d.ts +1 -0
  10. package/esm/typings/src/book-2.0/agent-source/string_book.d.ts +26 -0
  11. package/esm/typings/src/book-2.0/commitments/ACTION/ACTION.d.ts +38 -0
  12. package/esm/typings/src/book-2.0/commitments/FORMAT/FORMAT.d.ts +39 -0
  13. package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/KNOWLEDGE.d.ts +45 -0
  14. package/esm/typings/src/book-2.0/commitments/META_IMAGE/META_IMAGE.d.ts +44 -0
  15. package/esm/typings/src/book-2.0/commitments/META_LINK/META_LINK.d.ts +56 -0
  16. package/esm/typings/src/book-2.0/commitments/MODEL/MODEL.d.ts +39 -0
  17. package/esm/typings/src/book-2.0/commitments/NOTE/NOTE.d.ts +49 -0
  18. package/esm/typings/src/book-2.0/commitments/PERSONA/PERSONA.d.ts +46 -0
  19. package/esm/typings/src/book-2.0/commitments/RULE/RULE.d.ts +44 -0
  20. package/esm/typings/src/book-2.0/commitments/SAMPLE/SAMPLE.d.ts +44 -0
  21. package/esm/typings/src/book-2.0/commitments/STYLE/STYLE.d.ts +38 -0
  22. package/esm/typings/src/book-2.0/commitments/_base/BaseCommitmentDefinition.d.ts +52 -0
  23. package/esm/typings/src/book-2.0/commitments/_base/BookCommitment.d.ts +5 -0
  24. package/esm/typings/src/book-2.0/commitments/_base/CommitmentDefinition.d.ts +48 -0
  25. package/esm/typings/src/book-2.0/commitments/_base/NotYetImplementedCommitmentDefinition.d.ts +22 -0
  26. package/esm/typings/src/book-2.0/commitments/_base/createEmptyAgentModelRequirements.d.ts +19 -0
  27. package/esm/typings/src/book-2.0/commitments/_misc/AgentModelRequirements.d.ts +37 -0
  28. package/esm/typings/src/book-2.0/commitments/_misc/AgentSourceParseResult.d.ts +18 -0
  29. package/esm/typings/src/book-2.0/commitments/_misc/ParsedCommitment.d.ts +22 -0
  30. package/esm/typings/src/book-2.0/commitments/_misc/createAgentModelRequirements.d.ts +62 -0
  31. package/esm/typings/src/book-2.0/commitments/_misc/createAgentModelRequirementsWithCommitments.d.ts +36 -0
  32. package/esm/typings/src/book-2.0/commitments/_misc/createCommitmentRegex.d.ts +20 -0
  33. package/esm/typings/src/book-2.0/commitments/_misc/parseAgentSourceWithCommitments.d.ts +24 -0
  34. package/esm/typings/src/book-2.0/commitments/_misc/removeCommentsFromSystemMessage.d.ts +11 -0
  35. package/esm/typings/src/book-2.0/commitments/index.d.ts +56 -0
  36. package/esm/typings/src/book-2.0/utils/profileImageUtils.d.ts +39 -0
  37. package/esm/typings/src/book-components/AvatarProfile/AvatarChip/AvatarChip.d.ts +35 -0
  38. package/esm/typings/src/book-components/AvatarProfile/AvatarChip/AvatarChipFromSource.d.ts +21 -0
  39. package/esm/typings/src/book-components/AvatarProfile/AvatarChip/index.d.ts +2 -0
  40. package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/AvatarProfile.d.ts +26 -0
  41. package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/AvatarProfileFromSource.d.ts +19 -0
  42. package/esm/typings/src/book-components/BookEditor/BookEditor.d.ts +35 -0
  43. package/esm/typings/src/book-components/BookEditor/BookEditorInner.d.ts +15 -0
  44. package/esm/typings/src/book-components/BookEditor/config.d.ts +10 -0
  45. package/esm/typings/src/book-components/BookEditor/injectCssModuleIntoShadowRoot.d.ts +11 -0
  46. package/esm/typings/src/book-components/Chat/Chat/Chat.d.ts +20 -0
  47. package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +110 -0
  48. package/esm/typings/src/book-components/Chat/LlmChat/LlmChat.d.ts +14 -0
  49. package/esm/typings/src/book-components/Chat/LlmChat/LlmChat.test.d.ts +1 -0
  50. package/esm/typings/src/book-components/Chat/LlmChat/LlmChatProps.d.ts +24 -0
  51. package/esm/typings/src/book-components/Chat/types/ChatMessage.d.ts +16 -0
  52. package/esm/typings/src/book-components/Chat/types/ChatParticipant.d.ts +32 -0
  53. package/esm/typings/src/book-components/Chat/utils/ChatPersistence.d.ts +25 -0
  54. package/esm/typings/src/book-components/Chat/utils/ExportFormat.d.ts +4 -0
  55. package/esm/typings/src/book-components/Chat/utils/addUtmParamsToUrl.d.ts +7 -0
  56. package/esm/typings/src/book-components/Chat/utils/createShortLinkForChat.d.ts +7 -0
  57. package/esm/typings/src/book-components/Chat/utils/downloadFile.d.ts +6 -0
  58. package/esm/typings/src/book-components/Chat/utils/exportChatHistory.d.ts +9 -0
  59. package/esm/typings/src/book-components/Chat/utils/generatePdfContent.d.ts +8 -0
  60. package/esm/typings/src/book-components/Chat/utils/generateQrDataUrl.d.ts +7 -0
  61. package/esm/typings/src/book-components/Chat/utils/getPromptbookBranding.d.ts +6 -0
  62. package/esm/typings/src/book-components/Chat/utils/messagesToHtml.d.ts +8 -0
  63. package/esm/typings/src/book-components/Chat/utils/messagesToJson.d.ts +7 -0
  64. package/esm/typings/src/book-components/Chat/utils/messagesToMarkdown.d.ts +8 -0
  65. package/esm/typings/src/book-components/Chat/utils/messagesToText.d.ts +8 -0
  66. package/esm/typings/src/book-components/_common/react-utils/classNames.d.ts +7 -0
  67. package/esm/typings/src/book-components/_common/react-utils/collectCssTextsForClass.d.ts +7 -0
  68. package/esm/typings/src/book-components/_common/react-utils/escapeHtml.d.ts +6 -0
  69. package/esm/typings/src/book-components/_common/react-utils/escapeRegex.d.ts +6 -0
  70. package/esm/typings/src/config.d.ts +19 -0
  71. package/esm/typings/src/execution/AvailableModel.d.ts +4 -0
  72. package/esm/typings/src/execution/ExecutionTask.d.ts +27 -1
  73. package/esm/typings/src/execution/LlmExecutionTools.d.ts +8 -0
  74. package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +6 -1
  75. package/esm/typings/src/llm-providers/_common/filterModels.d.ts +0 -3
  76. package/esm/typings/src/llm-providers/_common/profiles/llmProviderProfiles.d.ts +81 -0
  77. package/esm/typings/src/llm-providers/_common/profiles/test/llmProviderProfiles.test.d.ts +1 -0
  78. package/esm/typings/src/llm-providers/_multiple/MultipleLlmExecutionTools.d.ts +5 -0
  79. package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +5 -5
  80. package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
  81. package/esm/typings/src/llm-providers/deepseek/deepseek-models.d.ts +1 -1
  82. package/esm/typings/src/llm-providers/google/google-models.d.ts +1 -1
  83. package/esm/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +5 -0
  84. package/esm/typings/src/llm-providers/ollama/ollama-models.d.ts +1 -1
  85. package/esm/typings/src/llm-providers/openai/OpenAiCompatibleExecutionTools.d.ts +8 -0
  86. package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +5 -0
  87. package/esm/typings/src/llm-providers/openai/openai-models.d.ts +1 -1
  88. package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +5 -0
  89. package/esm/typings/src/pipeline/book-notation.d.ts +2 -1
  90. package/esm/typings/src/playground/permanent/error-handling-playground.d.ts +5 -0
  91. package/esm/typings/src/types/ModelRequirements.d.ts +0 -2
  92. package/esm/typings/src/types/typeAliases.d.ts +6 -0
  93. package/esm/typings/src/utils/color/$randomColor.d.ts +11 -0
  94. package/esm/typings/src/utils/color/Color.d.ts +180 -0
  95. package/esm/typings/src/utils/color/css-colors.d.ts +159 -0
  96. package/esm/typings/src/utils/color/internal-utils/checkChannelValue.d.ts +14 -0
  97. package/esm/typings/src/utils/color/internal-utils/hslToRgb.d.ts +17 -0
  98. package/esm/typings/src/utils/color/internal-utils/rgbToHsl.d.ts +17 -0
  99. package/esm/typings/src/utils/color/operators/ColorTransformer.d.ts +5 -0
  100. package/esm/typings/src/utils/color/operators/darken.d.ts +9 -0
  101. package/esm/typings/src/utils/color/operators/furthest.d.ts +16 -0
  102. package/esm/typings/src/utils/color/operators/grayscale.d.ts +9 -0
  103. package/esm/typings/src/utils/color/operators/lighten.d.ts +12 -0
  104. package/esm/typings/src/utils/color/operators/mixWithColor.d.ts +11 -0
  105. package/esm/typings/src/utils/color/operators/nearest.d.ts +10 -0
  106. package/esm/typings/src/utils/color/operators/negative.d.ts +7 -0
  107. package/esm/typings/src/utils/color/operators/negativeLightness.d.ts +7 -0
  108. package/esm/typings/src/utils/color/operators/withAlpha.d.ts +9 -0
  109. package/esm/typings/src/utils/color/utils/areColorsEqual.d.ts +14 -0
  110. package/esm/typings/src/utils/color/utils/colorDistance.d.ts +21 -0
  111. package/esm/typings/src/utils/color/utils/colorHue.d.ts +11 -0
  112. package/esm/typings/src/utils/color/utils/colorHueDistance.d.ts +11 -0
  113. package/esm/typings/src/utils/color/utils/colorHueDistance.test.d.ts +1 -0
  114. package/esm/typings/src/utils/color/utils/colorLuminance.d.ts +9 -0
  115. package/esm/typings/src/utils/color/utils/colorSatulightion.d.ts +7 -0
  116. package/esm/typings/src/utils/color/utils/colorSaturation.d.ts +9 -0
  117. package/esm/typings/src/utils/color/utils/colorToDataUrl.d.ts +10 -0
  118. package/esm/typings/src/utils/color/utils/mixColors.d.ts +11 -0
  119. package/esm/typings/src/utils/organization/preserve.d.ts +21 -0
  120. package/esm/typings/src/utils/take/classes/TakeChain.d.ts +11 -0
  121. package/esm/typings/src/utils/take/interfaces/ITakeChain.d.ts +12 -0
  122. package/esm/typings/src/utils/take/interfaces/Takeable.d.ts +7 -0
  123. package/esm/typings/src/utils/take/take.d.ts +12 -0
  124. package/esm/typings/src/utils/take/take.test.d.ts +1 -0
  125. package/esm/typings/src/version.d.ts +1 -1
  126. package/package.json +2 -2
  127. package/umd/index.umd.js +304 -12
  128. package/umd/index.umd.js.map +1 -1
  129. package/esm/typings/src/scripting/javascript/utils/preserve.d.ts +0 -14
@@ -0,0 +1,14 @@
1
+ import type { LlmChatProps } from './LlmChatProps';
2
+ /**
3
+ * LlmChat component that provides chat functionality with LLM integration
4
+ *
5
+ * This component internally manages messages, participants, and task progress,
6
+ * and uses the provided LLM tools to generate responses via `LlmExecutionTools.callChatModel`.
7
+ *
8
+ * Note: There are multiple chat components:
9
+ * - `<Chat/>` renders chat as it is without any logic
10
+ * - `<LlmChat/>` connected to LLM Execution Tools of Promptbook
11
+ *
12
+ * @public exported from `@promptbook/components`
13
+ */
14
+ export declare function LlmChat(props: LlmChatProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,24 @@
1
+ import type { LlmExecutionTools } from '../../../execution/LlmExecutionTools';
2
+ import type { ChatProps } from '../Chat/ChatProps';
3
+ import type { ChatMessage } from '../types/ChatMessage';
4
+ import type { ChatParticipant } from '../types/ChatParticipant';
5
+ /**
6
+ * Props for LlmChat component, derived from ChatProps but with LLM-specific modifications
7
+ *
8
+ * @public exported from `@promptbook/components`
9
+ */
10
+ export type LlmChatProps = Omit<ChatProps, 'messages' | 'onMessage' | 'onChange'> & {
11
+ /**
12
+ * LLM execution tools for chatting with the model
13
+ */
14
+ readonly llmTools: LlmExecutionTools;
15
+ /**
16
+ * Optional key for persisting conversation in localStorage
17
+ * When provided, the conversation will be saved and restored from localStorage
18
+ */
19
+ readonly persistenceKey?: string;
20
+ /**
21
+ * Called when the chat state changes (messages, participants, etc.)
22
+ */
23
+ onChange?(messages: ReadonlyArray<ChatMessage>, participants: ReadonlyArray<ChatParticipant>): void;
24
+ };
@@ -0,0 +1,16 @@
1
+ import type { string_markdown } from '../../../types/typeAliases';
2
+ import type { string_name } from '../../../types/typeAliases';
3
+ /**
4
+ * A message in the chat
5
+ *
6
+ * @public exported from `@promptbook/components`
7
+ */
8
+ export type ChatMessage = {
9
+ id: string;
10
+ date: Date;
11
+ from: string_name;
12
+ content: string_markdown;
13
+ isComplete?: boolean;
14
+ expectedAnswer?: string;
15
+ isVoiceCall?: boolean;
16
+ };
@@ -0,0 +1,32 @@
1
+ import type { string_color } from '../../../types/typeAliases';
2
+ import type { string_name } from '../../../types/typeAliases';
3
+ import type { string_person_fullname } from '../../../types/typeAliases';
4
+ import type { string_url_image } from '../../../types/typeAliases';
5
+ import { Color } from '../../../utils/color/Color';
6
+ /**
7
+ * A participant in the chat
8
+ *
9
+ * @public exported from `@promptbook/components`
10
+ */
11
+ export type ChatParticipant = {
12
+ /**
13
+ * Identifies the participant by their name, same as `message.from`
14
+ */
15
+ name: string_name;
16
+ /**
17
+ * Full name of the participant
18
+ */
19
+ fullname: string_person_fullname;
20
+ /**
21
+ * Am I the participant? (i.e. is this the user)
22
+ */
23
+ isMe?: boolean;
24
+ /**
25
+ * Profile picture
26
+ */
27
+ avatarSrc?: string_url_image;
28
+ /**
29
+ * Color associated with the participant
30
+ */
31
+ color: string_color | Color;
32
+ };
@@ -0,0 +1,25 @@
1
+ import type { ChatMessage } from '../types/ChatMessage';
2
+ /**
3
+ * Utility functions for persisting chat conversations in localStorage
4
+ *
5
+ * @private util of `LlmChat`
6
+ */
7
+ export declare class ChatPersistence {
8
+ private static readonly STORAGE_PREFIX;
9
+ /**
10
+ * Save messages to localStorage under the given key
11
+ */
12
+ static saveMessages(persistenceKey: string, messages: ReadonlyArray<ChatMessage>): void;
13
+ /**
14
+ * Load messages from localStorage for the given key
15
+ */
16
+ static loadMessages(persistenceKey: string): ChatMessage[];
17
+ /**
18
+ * Clear messages from localStorage for the given key
19
+ */
20
+ static clearMessages(persistenceKey: string): void;
21
+ /**
22
+ * Check if localStorage is available
23
+ */
24
+ static isAvailable(): boolean;
25
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @private utility of `<Chat/>` component
3
+ */
4
+ export type ExportFormat = 'pdf' | 'txt' | 'md' | 'html' | 'json';
@@ -0,0 +1,7 @@
1
+ import type { ExportFormat } from './ExportFormat';
2
+ /**
3
+ * Utility: add UTM parameters to a URL for tracking
4
+ *
5
+ * @private utility of `<Chat/>` component
6
+ */
7
+ export declare function addUtmParamsToUrl(baseUrl: string, format: ExportFormat): string;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Create a short link for chat sharing.
3
+ * Simplified version without Supabase dependency.
4
+ *
5
+ * @private utility of `<Chat/>` component
6
+ */
7
+ export declare function createShortLinkForChat(utmUrl: string): Promise<string>;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Downloads a file with the given content and filename
3
+ *
4
+ * @private utility of `<Chat/>` component
5
+ */
6
+ export declare function downloadFile(content: string, filename: string, mimeType: string): void;
@@ -0,0 +1,9 @@
1
+ import type { ChatMessage } from '../types/ChatMessage';
2
+ import type { ChatParticipant } from '../types/ChatParticipant';
3
+ import type { ExportFormat } from './ExportFormat';
4
+ /**
5
+ * Exports chat messages in the specified format
6
+ *
7
+ * @private utility of `<Chat/>` component
8
+ */
9
+ export declare function exportChatHistory(messages: ChatMessage[], format: ExportFormat, headerMarkdown?: string, participants?: ReadonlyArray<ChatParticipant>): Promise<void>;
@@ -0,0 +1,8 @@
1
+ import type { ChatMessage } from '../types/ChatMessage';
2
+ import type { ChatParticipant } from '../types/ChatParticipant';
3
+ /**
4
+ * Generates PDF content using HTML and triggers print dialog
5
+ *
6
+ * @private utility of `<Chat/>` component
7
+ */
8
+ export declare function generatePdfContent(messages: ChatMessage[], shareUrl: string, qrDataUrl?: string | null, headerMarkdown?: string, participants?: ReadonlyArray<ChatParticipant>): void;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Utility: generate a QR code data URL for a given text
3
+ * Simplified version without QR code library dependency
4
+ *
5
+ * @private utility of `<Chat/>` component
6
+ */
7
+ export declare function generateQrDataUrl(text: string): Promise<string | null>;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Generates Promptbook branding header for exported files
3
+ *
4
+ * @private utility of `<Chat/>` component
5
+ */
6
+ export declare function getPromptbookBranding(shareUrl: string): string;
@@ -0,0 +1,8 @@
1
+ import type { ChatMessage } from '../types/ChatMessage';
2
+ import type { ChatParticipant } from '../types/ChatParticipant';
3
+ /**
4
+ * Converts chat messages to HTML format
5
+ *
6
+ * @private utility of `<Chat/>` component
7
+ */
8
+ export declare function messagesToHtml(messages: ChatMessage[], shareUrl: string, qrDataUrl?: string | null, headerMarkdown?: string, participants?: ReadonlyArray<ChatParticipant>): string;
@@ -0,0 +1,7 @@
1
+ import type { ChatMessage } from '../types/ChatMessage';
2
+ /**
3
+ * Converts chat messages to JSON format
4
+ *
5
+ * @private utility of `<Chat/>` component
6
+ */
7
+ export declare function messagesToJson(messages: ChatMessage[], shareUrl: string): string;
@@ -0,0 +1,8 @@
1
+ import type { ChatMessage } from '../types/ChatMessage';
2
+ import type { ChatParticipant } from '../types/ChatParticipant';
3
+ /**
4
+ * Converts chat messages to Markdown format
5
+ *
6
+ * @private utility of `<Chat/>` component
7
+ */
8
+ export declare function messagesToMarkdown(messages: ChatMessage[], shareUrl: string, qrDataUrl?: string | null, headerMarkdown?: string, participants?: ReadonlyArray<ChatParticipant>): string;
@@ -0,0 +1,8 @@
1
+ import type { ChatMessage } from '../types/ChatMessage';
2
+ import type { ChatParticipant } from '../types/ChatParticipant';
3
+ /**
4
+ * Converts chat messages to plain text format
5
+ *
6
+ * @private utility of `<Chat/>` component
7
+ */
8
+ export declare function messagesToText(messages: ChatMessage[], shareUrl: string, headerMarkdown?: string, participants?: ReadonlyArray<ChatParticipant>): string;
@@ -0,0 +1,7 @@
1
+ import type { string_css_class } from '../../../types/typeAliases';
2
+ /**
3
+ * Utility function for joining multiple truthy class names into one string
4
+ *
5
+ * @private within the `@promptbook/components`
6
+ */
7
+ export declare function classNames(...classes: Array<string_css_class | undefined | false | null>): string_css_class;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Collect matching CSS texts from document stylesheets for a given class.
3
+ * This will skip cross-origin stylesheets (they throw when accessed).
4
+ *
5
+ * @private within the promptbook components <- TODO: Maybe make promptbook util from this
6
+ */
7
+ export declare function collectCssTextsForClass(className: string): string[];
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Escape HTML to safely render user text inside a <pre> with dangerouslySetInnerHTML.
3
+ *
4
+ * @private within the promptbook components <- TODO: Maybe make promptbook util from this
5
+ */
6
+ export declare function escapeHtml(input: string): string;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Escape text for safe use inside a RegExp pattern.
3
+ *
4
+ * @private within the promptbook components <- TODO: Maybe make promptbook util from this
5
+ */
6
+ export declare function escapeRegex(input: string): string;
@@ -281,6 +281,12 @@ export declare function SET_IS_VERBOSE(isVerbose: boolean): void;
281
281
  * @public exported from `@promptbook/core`
282
282
  */
283
283
  export declare const DEFAULT_IS_AUTO_INSTALLED = false;
284
+ /**
285
+ * Default simulated duration for a task in milliseconds (used for progress reporting)
286
+ *
287
+ * @public exported from `@promptbook/core`
288
+ */
289
+ export declare const DEFAULT_TASK_SIMULATED_DURATION_MS: number;
284
290
  /**
285
291
  * Function name for generated function via `ptbk make` to get the pipeline collection
286
292
  *
@@ -295,6 +301,19 @@ export declare const DEFAULT_GET_PIPELINE_COLLECTION_FUNCTION_NAME = "getPipelin
295
301
  * @public exported from `@promptbook/core`
296
302
  */
297
303
  export declare const DEFAULT_MAX_REQUESTS_PER_MINUTE = 60;
304
+ /**
305
+ * API request timeout in milliseconds
306
+ * Can be overridden via API_REQUEST_TIMEOUT environment variable
307
+ *
308
+ * @public exported from `@promptbook/core`
309
+ */
310
+ export declare const API_REQUEST_TIMEOUT: number;
311
+ /**
312
+ * URL of the Promptbook logo
313
+ *
314
+ * @public exported from `@promptbook/core`
315
+ */
316
+ export declare const PROMPTBOOK_LOGO_URL = "https://promptbook.studio/logos/logo-blue-white-256.png";
298
317
  /**
299
318
  * Indicates whether pipeline logic validation is enabled. When true, the pipeline logic is checked for consistency.
300
319
  *
@@ -40,6 +40,10 @@ export type AvailableModel = {
40
40
  readonly prompt: number_usd;
41
41
  readonly output: number_usd;
42
42
  };
43
+ /**
44
+ * If the model is deprecated, it should not be used for new tasks
45
+ */
46
+ readonly isDeprecated?: boolean;
43
47
  };
44
48
  /**
45
49
  * TODO: [🧠] Maybe rename to something else - like `ModelInformation` or `ModelMetadata`
@@ -1,5 +1,6 @@
1
1
  import type { Observable } from 'rxjs';
2
2
  import { PartialDeep } from 'type-fest';
3
+ import type { number_percent } from '../types/typeAliases';
3
4
  import type { task_id } from '../types/typeAliases';
4
5
  import type { string_SCREAMING_CASE } from '../utils/normalization/normalizeTo_SCREAMING_CASE';
5
6
  import type { string_promptbook_version } from '../version';
@@ -19,7 +20,8 @@ type CreateTaskOptions<TTaskResult extends AbstractTaskResult> = {
19
20
  readonly title: AbstractTask<TTaskResult>['title'];
20
21
  /**
21
22
  * Callback that processes the task and updates the ongoing result
22
- * @param ongoingResult The partial result of the task processing
23
+ * @param updateOngoingResult Function to update the partial result of the task processing
24
+ * @param updateTldr Function to update tldr progress information
23
25
  * @returns The final task result
24
26
  */
25
27
  taskProcessCallback(updateOngoingResult: (newOngoingResult: PartialDeep<TTaskResult> & {
@@ -27,6 +29,9 @@ type CreateTaskOptions<TTaskResult extends AbstractTaskResult> = {
27
29
  * Optional update of the task title
28
30
  */
29
31
  readonly title?: AbstractTask<TTaskResult>['title'];
32
+ }) => void, updateTldr: (tldrInfo: {
33
+ readonly percent: number_percent;
34
+ readonly message: string;
30
35
  }) => void): Promise<TTaskResult>;
31
36
  };
32
37
  /**
@@ -80,6 +85,19 @@ export type AbstractTask<TTaskResult extends AbstractTaskResult> = {
80
85
  * Status of the task
81
86
  */
82
87
  readonly status: task_status;
88
+ /**
89
+ * Short summary of the task status for quick overview in the UI
90
+ */
91
+ readonly tldr: {
92
+ /**
93
+ * Progress in percentage from 0 to 1 (100%) that can be used to display a progress bar
94
+ */
95
+ readonly percent: number_percent;
96
+ /**
97
+ * Short summary message of the task status that can be displayed in the UI
98
+ */
99
+ readonly message: string;
100
+ };
83
101
  /**
84
102
  * Date when the task was created
85
103
  */
@@ -92,6 +110,14 @@ export type AbstractTask<TTaskResult extends AbstractTaskResult> = {
92
110
  * Gets a promise that resolves with the task result
93
111
  */
94
112
  asPromise(options?: {
113
+ /**
114
+ * Do the task throws on error
115
+ *
116
+ * - If `true` when error occurs the returned promise will rejects
117
+ * - If `false` the promise will resolve with object with all listed errors and warnings and partial result
118
+ *
119
+ * @default true
120
+ */
95
121
  readonly isCrashedOnError?: boolean;
96
122
  }): Promise<TTaskResult>;
97
123
  /**
@@ -1,4 +1,5 @@
1
1
  import type { Promisable } from 'type-fest';
2
+ import type { ChatParticipant } from '../book-components/Chat/types/ChatParticipant';
2
3
  import type { Prompt } from '../types/Prompt';
3
4
  import type { string_markdown } from '../types/typeAliases';
4
5
  import type { string_markdown_text } from '../types/typeAliases';
@@ -27,6 +28,13 @@ export type LlmExecutionTools = {
27
28
  * @example "Use all models from OpenAI"
28
29
  */
29
30
  readonly description?: string_markdown;
31
+ /**
32
+ * Profile representing the model as a virtual persona for chat interfaces
33
+ * This includes visual identity like avatar, colors, and display information
34
+ *
35
+ * @example { name: 'OPENAI', fullname: 'OpenAI GPT', color: '#10a37f', avatarSrc: '/openai-logo.png' }
36
+ */
37
+ readonly profile?: ChatParticipant;
30
38
  /**
31
39
  * Check comfiguration
32
40
  *
@@ -1,10 +1,11 @@
1
- import type { ReadonlyDeep, WritableDeep } from 'type-fest';
1
+ import type { PartialDeep, Promisable, ReadonlyDeep, WritableDeep } from 'type-fest';
2
2
  import type { PipelineJson } from '../../pipeline/PipelineJson/PipelineJson';
3
3
  import type { TaskJson } from '../../pipeline/PipelineJson/TaskJson';
4
4
  import type { Parameters } from '../../types/typeAliases';
5
5
  import type { string_parameter_name } from '../../types/typeAliases';
6
6
  import type { TODO_string } from '../../utils/organization/TODO_string';
7
7
  import type { ExecutionReportJson } from '../execution-report/ExecutionReportJson';
8
+ import type { PipelineExecutorResult } from '../PipelineExecutorResult';
8
9
  import type { CreatePipelineExecutorOptions } from './00-CreatePipelineExecutorOptions';
9
10
  /**
10
11
  * Options for executing attempts of a pipeline task, including configuration for jokers, priority,
@@ -46,6 +47,10 @@ export type ExecuteAttemptsOptions = Required<Omit<CreatePipelineExecutorOptions
46
47
  * The pipeline structure prepared for execution, as a deeply immutable PipelineJson object.
47
48
  */
48
49
  readonly preparedPipeline: ReadonlyDeep<PipelineJson>;
50
+ /**
51
+ * Callback invoked with partial results as the execution progresses.
52
+ */
53
+ onProgress(newOngoingResult: PartialDeep<PipelineExecutorResult>): Promisable<void>;
49
54
  /**
50
55
  * The execution report object, which is updated during execution.
51
56
  */
@@ -10,6 +10,3 @@ import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
10
10
  * @public exported from `@promptbook/core`
11
11
  */
12
12
  export declare function filterModels<TLlmTools extends LlmExecutionTools>(llmTools: TLlmTools, predicate: (model: AvailableModel) => boolean): TLlmTools;
13
- /**
14
- * TODO: !!! [models] Test that this is working
15
- */
@@ -0,0 +1,81 @@
1
+ import type { ChatParticipant } from '../../../book-components/Chat/types/ChatParticipant';
2
+ /**
3
+ * Predefined profiles for LLM providers to maintain consistency across the application
4
+ * These profiles represent each provider as a virtual persona in chat interfaces
5
+ *
6
+ * @private !!!!
7
+ */
8
+ export declare const LLM_PROVIDER_PROFILES: {
9
+ readonly OPENAI: {
10
+ name: string;
11
+ fullname: string;
12
+ color: string;
13
+ };
14
+ readonly ANTHROPIC: {
15
+ name: string;
16
+ fullname: string;
17
+ color: string;
18
+ };
19
+ readonly AZURE_OPENAI: {
20
+ name: string;
21
+ fullname: string;
22
+ color: string;
23
+ };
24
+ readonly GOOGLE: {
25
+ name: string;
26
+ fullname: string;
27
+ color: string;
28
+ };
29
+ readonly DEEPSEEK: {
30
+ name: string;
31
+ fullname: string;
32
+ color: string;
33
+ };
34
+ readonly OLLAMA: {
35
+ name: string;
36
+ fullname: string;
37
+ color: string;
38
+ };
39
+ readonly REMOTE: {
40
+ name: string;
41
+ fullname: string;
42
+ color: string;
43
+ };
44
+ readonly MOCKED_ECHO: {
45
+ name: string;
46
+ fullname: string;
47
+ color: string;
48
+ };
49
+ readonly MOCKED_FAKE: {
50
+ name: string;
51
+ fullname: string;
52
+ color: string;
53
+ };
54
+ readonly VERCEL: {
55
+ name: string;
56
+ fullname: string;
57
+ color: string;
58
+ };
59
+ readonly MULTIPLE: {
60
+ name: string;
61
+ fullname: string;
62
+ color: string;
63
+ };
64
+ };
65
+ /**
66
+ * Helper function to get a profile by provider name with fallback
67
+ *
68
+ * @private !!!!
69
+ */
70
+ export declare function getLlmProviderProfile(providerKey: keyof typeof LLM_PROVIDER_PROFILES): ChatParticipant;
71
+ /**
72
+ * Creates a custom profile based on a provider profile but with custom properties
73
+ *
74
+ * @private !!!!
75
+ */
76
+ export declare function createCustomLlmProfile(baseProfile: ChatParticipant, overrides: Partial<ChatParticipant>): ChatParticipant;
77
+ /**
78
+ * TODO: Refactor this - each profile must be alongside the provider definition
79
+ * TODO: Unite `AvatarProfileProps` and `ChatParticipant`
80
+ * Note: [💞] Ignore a discrepancy between file name and entity name
81
+ */
@@ -28,6 +28,11 @@ export declare class MultipleLlmExecutionTools implements LlmExecutionTools {
28
28
  constructor(...llmExecutionTools: ReadonlyArray<LlmExecutionTools>);
29
29
  get title(): string_title & string_markdown_text;
30
30
  get description(): string_markdown;
31
+ get profile(): {
32
+ name: string;
33
+ fullname: string;
34
+ color: string;
35
+ };
31
36
  /**
32
37
  * Check the configuration of all execution tools
33
38
  */
@@ -2,7 +2,6 @@ import Anthropic from '@anthropic-ai/sdk';
2
2
  import type { AvailableModel } from '../../execution/AvailableModel';
3
3
  import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
4
4
  import type { ChatPromptResult } from '../../execution/PromptResult';
5
- import type { CompletionPromptResult } from '../../execution/PromptResult';
6
5
  import type { Prompt } from '../../types/Prompt';
7
6
  import type { string_markdown } from '../../types/typeAliases';
8
7
  import type { string_markdown_text } from '../../types/typeAliases';
@@ -29,6 +28,11 @@ export declare class AnthropicClaudeExecutionTools implements LlmExecutionTools
29
28
  constructor(options?: AnthropicClaudeExecutionToolsNonProxiedOptions);
30
29
  get title(): string_title & string_markdown_text;
31
30
  get description(): string_markdown;
31
+ get profile(): {
32
+ name: string;
33
+ fullname: string;
34
+ color: string;
35
+ };
32
36
  getClient(): Promise<Anthropic>;
33
37
  /**
34
38
  * Check the `options` passed to `constructor`
@@ -42,10 +46,6 @@ export declare class AnthropicClaudeExecutionTools implements LlmExecutionTools
42
46
  * Calls Anthropic Claude API to use a chat model.
43
47
  */
44
48
  callChatModel(prompt: Pick<Prompt, 'content' | 'parameters' | 'modelRequirements'>): Promise<ChatPromptResult>;
45
- /**
46
- * Calls Anthropic Claude API to use a completion model.
47
- */
48
- callCompletionModel(prompt: Pick<Prompt, 'content' | 'parameters' | 'modelRequirements'>): Promise<CompletionPromptResult>;
49
49
  /**
50
50
  * Get the model that should be used as default
51
51
  */
@@ -3,7 +3,7 @@ import type { number_usd } from '../../types/typeAliases';
3
3
  /**
4
4
  * List of available Anthropic Claude models with pricing
5
5
  *
6
- * Note: Done at 2025-05-06
6
+ * Note: Synced with official API docs at 2025-08-20
7
7
  *
8
8
  * @see https://docs.anthropic.com/en/docs/models-overview
9
9
  * @public exported from `@promptbook/anthropic-claude`
@@ -3,7 +3,7 @@ import type { number_usd } from '../../types/typeAliases';
3
3
  /**
4
4
  * List of available Deepseek models with descriptions
5
5
  *
6
- * Note: Done at 2025-05-06
6
+ * Note: Synced with official API docs at 2025-08-20
7
7
  *
8
8
  * @see https://www.deepseek.com/models
9
9
  * @public exported from `@promptbook/deepseek`
@@ -3,7 +3,7 @@ import type { number_usd } from '../../types/typeAliases';
3
3
  /**
4
4
  * List of available Google models with descriptions
5
5
  *
6
- * Note: Done at 2025-05-06
6
+ * Note: Synced with official API docs at 2025-08-20
7
7
  *
8
8
  * @see https://ai.google.dev/models/gemini
9
9
  * @public exported from `@promptbook/google`
@@ -17,6 +17,11 @@ export declare class MockedEchoLlmExecutionTools implements LlmExecutionTools {
17
17
  constructor(options?: CommonToolsOptions);
18
18
  get title(): string_title & string_markdown_text;
19
19
  get description(): string_markdown;
20
+ get profile(): {
21
+ name: string;
22
+ fullname: string;
23
+ color: string;
24
+ };
20
25
  /**
21
26
  * Does nothing, just to implement the interface
22
27
  */
@@ -2,7 +2,7 @@ import type { AvailableModel } from '../../execution/AvailableModel';
2
2
  /**
3
3
  * List of available models in Ollama library
4
4
  *
5
- * Note: Done at 2025-05-19
5
+ * Note: Synced with official API docs at 2025-08-20
6
6
  *
7
7
  * @see https://ollama.com/library
8
8
  * @public exported from `@promptbook/ollama`
@@ -82,6 +82,14 @@ export declare abstract class OpenAiCompatibleExecutionTools implements LlmExecu
82
82
  * Default model for completion variant.
83
83
  */
84
84
  protected abstract getDefaultEmbeddingModel(): AvailableModel;
85
+ /**
86
+ * Makes a request with retry logic for network errors like ECONNRESET
87
+ */
88
+ private makeRequestWithRetry;
89
+ /**
90
+ * Determines if an error is retryable (network-related errors)
91
+ */
92
+ private isRetryableNetworkError;
85
93
  }
86
94
  /**
87
95
  * TODO: [🛄] Some way how to re-wrap the errors from `OpenAiCompatibleExecutionTools`
@@ -13,6 +13,11 @@ import { OpenAiCompatibleExecutionTools } from './OpenAiCompatibleExecutionTools
13
13
  export declare class OpenAiExecutionTools extends OpenAiCompatibleExecutionTools implements LlmExecutionTools {
14
14
  get title(): string_title & string_markdown_text;
15
15
  get description(): string_markdown;
16
+ get profile(): {
17
+ name: string;
18
+ fullname: string;
19
+ color: string;
20
+ };
16
21
  /**
17
22
  * List all available models (non dynamically)
18
23
  *
@@ -2,7 +2,7 @@ import type { AvailableModel } from '../../execution/AvailableModel';
2
2
  /**
3
3
  * List of available OpenAI models with pricing
4
4
  *
5
- * Note: Done at 2025-05-06
5
+ * Note: Synced with official API docs at 2025-08-20
6
6
  *
7
7
  * @see https://platform.openai.com/docs/models/
8
8
  * @see https://openai.com/api/pricing/