@promptbook/ollama 0.102.0-5 → 0.102.0-6

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 (98) hide show
  1. package/esm/index.es.js +92 -22
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/books/index.d.ts +81 -0
  4. package/esm/typings/src/_packages/components.index.d.ts +2 -0
  5. package/esm/typings/src/_packages/markdown-utils.index.d.ts +4 -0
  6. package/esm/typings/src/_packages/types.index.d.ts +8 -6
  7. package/esm/typings/src/_packages/utils.index.d.ts +12 -14
  8. package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirements.d.ts +1 -1
  9. package/esm/typings/src/book-2.0/utils/generateGravatarUrl.d.ts +1 -1
  10. package/esm/typings/src/book-2.0/utils/generatePlaceholderAgentProfileImageUrl.d.ts +1 -1
  11. package/esm/typings/src/book-components/BookEditor/BookEditor.d.ts +1 -1
  12. package/esm/typings/src/book-components/BookEditor/BookEditorInner.d.ts +1 -1
  13. package/esm/typings/src/book-components/Chat/Chat/Chat.d.ts +1 -5
  14. package/esm/typings/src/book-components/Chat/Chat/ChatMessageItem.d.ts +27 -0
  15. package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +13 -6
  16. package/esm/typings/src/book-components/Chat/Chat/constants.d.ts +7 -0
  17. package/esm/typings/src/book-components/Chat/LlmChat/LlmChatProps.d.ts +1 -1
  18. package/esm/typings/src/book-components/Chat/MockedChat/MockedChat.d.ts +1 -1
  19. package/esm/typings/src/book-components/Chat/MockedChat/constants.d.ts +1 -1
  20. package/esm/typings/src/book-components/Chat/save/_common/ChatSaveFormatDefinition.d.ts +1 -1
  21. package/esm/typings/src/book-components/Chat/save/_common/getChatSaveFormatDefinitions.d.ts +2 -2
  22. package/esm/typings/src/book-components/Chat/save/_common/string_chat_format_name.d.ts +1 -1
  23. package/esm/typings/src/execution/LlmExecutionToolsConstructor.d.ts +1 -1
  24. package/esm/typings/src/execution/execution-report/countWorkingDuration.d.ts +1 -1
  25. package/esm/typings/src/llm-providers/_common/register/$llmToolsMetadataRegister.d.ts +1 -1
  26. package/esm/typings/src/llm-providers/_common/register/$llmToolsRegister.d.ts +1 -1
  27. package/esm/typings/src/llm-providers/_common/register/$registeredLlmToolsMessage.d.ts +1 -2
  28. package/esm/typings/src/llm-providers/_common/register/LlmToolsConfiguration.d.ts +1 -1
  29. package/esm/typings/src/llm-providers/_common/register/LlmToolsMetadata.d.ts +1 -1
  30. package/esm/typings/src/llm-providers/_multiple/joinLlmExecutionTools.d.ts +1 -1
  31. package/esm/typings/src/llm-providers/agent/register-configuration.d.ts +1 -1
  32. package/esm/typings/src/llm-providers/agent/register-constructor.d.ts +1 -1
  33. package/esm/typings/src/llm-providers/anthropic-claude/register-configuration.d.ts +1 -1
  34. package/esm/typings/src/llm-providers/anthropic-claude/register-constructor.d.ts +1 -1
  35. package/esm/typings/src/llm-providers/azure-openai/register-configuration.d.ts +1 -1
  36. package/esm/typings/src/llm-providers/azure-openai/register-constructor.d.ts +1 -1
  37. package/esm/typings/src/llm-providers/deepseek/register-configuration.d.ts +1 -1
  38. package/esm/typings/src/llm-providers/deepseek/register-constructor.d.ts +1 -1
  39. package/esm/typings/src/llm-providers/google/register-configuration.d.ts +1 -1
  40. package/esm/typings/src/llm-providers/google/register-constructor.d.ts +1 -1
  41. package/esm/typings/src/llm-providers/ollama/register-configuration.d.ts +1 -1
  42. package/esm/typings/src/llm-providers/ollama/register-constructor.d.ts +1 -1
  43. package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +1 -3
  44. package/esm/typings/src/llm-providers/openai/OpenAiCompatibleExecutionTools.d.ts +4 -0
  45. package/esm/typings/src/llm-providers/openai/register-configuration.d.ts +1 -1
  46. package/esm/typings/src/llm-providers/openai/register-constructor.d.ts +1 -1
  47. package/esm/typings/src/scrapers/_boilerplate/register-constructor.d.ts +1 -1
  48. package/esm/typings/src/scrapers/_boilerplate/register-metadata.d.ts +1 -1
  49. package/esm/typings/src/scrapers/_common/register/$scrapersMetadataRegister.d.ts +1 -1
  50. package/esm/typings/src/scrapers/_common/register/$scrapersRegister.d.ts +1 -1
  51. package/esm/typings/src/scrapers/_common/register/ScraperAndConverterMetadata.d.ts +2 -4
  52. package/esm/typings/src/scrapers/_common/register/ScraperConstructor.d.ts +1 -1
  53. package/esm/typings/src/scrapers/document/register-constructor.d.ts +1 -1
  54. package/esm/typings/src/scrapers/document/register-metadata.d.ts +1 -1
  55. package/esm/typings/src/scrapers/document-legacy/register-constructor.d.ts +1 -1
  56. package/esm/typings/src/scrapers/document-legacy/register-metadata.d.ts +1 -1
  57. package/esm/typings/src/scrapers/markdown/register-constructor.d.ts +1 -1
  58. package/esm/typings/src/scrapers/markdown/register-metadata.d.ts +1 -1
  59. package/esm/typings/src/scrapers/markitdown/register-constructor.d.ts +1 -1
  60. package/esm/typings/src/scrapers/markitdown/register-metadata.d.ts +1 -1
  61. package/esm/typings/src/scrapers/pdf/register-constructor.d.ts +1 -1
  62. package/esm/typings/src/scrapers/pdf/register-metadata.d.ts +1 -1
  63. package/esm/typings/src/scrapers/website/register-constructor.d.ts +1 -1
  64. package/esm/typings/src/scrapers/website/register-metadata.d.ts +1 -1
  65. package/esm/typings/src/scripting/javascript/postprocessing-functions.d.ts +6 -6
  66. package/esm/typings/src/utils/markdown/createMarkdownChart.d.ts +1 -1
  67. package/esm/typings/src/utils/markdown/humanizeAiText.d.ts +1 -1
  68. package/esm/typings/src/utils/markdown/humanizeAiTextEllipsis.d.ts +1 -1
  69. package/esm/typings/src/utils/markdown/humanizeAiTextEmdashed.d.ts +1 -1
  70. package/esm/typings/src/utils/markdown/humanizeAiTextQuotes.d.ts +1 -1
  71. package/esm/typings/src/utils/markdown/humanizeAiTextWhitespace.d.ts +1 -1
  72. package/esm/typings/src/utils/markdown/promptbookifyAiText.d.ts +1 -1
  73. package/esm/typings/src/utils/{trimCodeBlock.d.ts → markdown/trimCodeBlock.d.ts} +1 -1
  74. package/esm/typings/src/utils/{trimEndOfCodeBlock.d.ts → markdown/trimEndOfCodeBlock.d.ts} +1 -1
  75. package/esm/typings/src/utils/{$Register.d.ts → misc/$Register.d.ts} +2 -2
  76. package/esm/typings/src/utils/{$getCurrentDate.d.ts → misc/$getCurrentDate.d.ts} +1 -1
  77. package/esm/typings/src/utils/{arrayableToArray.d.ts → misc/arrayableToArray.d.ts} +1 -1
  78. package/esm/typings/src/utils/misc/debounce.d.ts +5 -0
  79. package/esm/typings/src/utils/{emojis.d.ts → misc/emojis.d.ts} +1 -1
  80. package/esm/typings/src/utils/misc/injectCssModuleIntoShadowRoot.d.ts +20 -0
  81. package/esm/typings/src/version.d.ts +1 -1
  82. package/package.json +2 -2
  83. package/umd/index.umd.js +92 -22
  84. package/umd/index.umd.js.map +1 -1
  85. package/esm/typings/src/book-components/BookEditor/injectCssModuleIntoShadowRoot.d.ts +0 -11
  86. package/esm/typings/src/book-components/BookEditor/utils.d.ts +0 -8
  87. /package/esm/typings/src/utils/{trimCodeBlock.test.d.ts → markdown/trimCodeBlock.test.d.ts} +0 -0
  88. /package/esm/typings/src/utils/{trimEndOfCodeBlock.test.d.ts → markdown/trimEndOfCodeBlock.test.d.ts} +0 -0
  89. /package/esm/typings/src/utils/{FromtoItems.d.ts → misc/FromtoItems.d.ts} +0 -0
  90. /package/esm/typings/src/utils/{arrayableToArray.test.d.ts → misc/arrayableToArray.test.d.ts} +0 -0
  91. /package/esm/typings/src/utils/{parseNumber.d.ts → misc/parseNumber.d.ts} +0 -0
  92. /package/esm/typings/src/utils/{parseNumber.test.d.ts → misc/parseNumber.test.d.ts} +0 -0
  93. /package/esm/typings/src/utils/{removeEmojis.d.ts → normalization/removeEmojis.d.ts} +0 -0
  94. /package/esm/typings/src/utils/{removeEmojis.test.d.ts → normalization/removeEmojis.test.d.ts} +0 -0
  95. /package/esm/typings/src/utils/{removeQuotes.d.ts → normalization/removeQuotes.d.ts} +0 -0
  96. /package/esm/typings/src/utils/{removeQuotes.test.d.ts → normalization/removeQuotes.test.d.ts} +0 -0
  97. /package/esm/typings/src/utils/{unwrapResult.d.ts → normalization/unwrapResult.d.ts} +0 -0
  98. /package/esm/typings/src/utils/{unwrapResult.test.d.ts → normalization/unwrapResult.test.d.ts} +0 -0
@@ -1,4 +1,4 @@
1
- import type { Registration } from '../../utils/$Register';
1
+ import type { Registration } from '../../utils/misc/$Register';
2
2
  /**
3
3
  * Metadata of the scraper
4
4
  *
@@ -1,4 +1,4 @@
1
- import type { Registration } from '../../utils/$Register';
1
+ import type { Registration } from '../../utils/misc/$Register';
2
2
  /**
3
3
  * Registration of known scraper
4
4
  *
@@ -1,4 +1,4 @@
1
- import type { Registration } from '../../utils/$Register';
1
+ import type { Registration } from '../../utils/misc/$Register';
2
2
  /**
3
3
  * Metadata of the scraper
4
4
  *
@@ -1,4 +1,4 @@
1
- import type { Registration } from '../../utils/$Register';
1
+ import type { Registration } from '../../utils/misc/$Register';
2
2
  /**
3
3
  * Registration of known scraper
4
4
  *
@@ -1,4 +1,4 @@
1
- import type { Registration } from '../../utils/$Register';
1
+ import type { Registration } from '../../utils/misc/$Register';
2
2
  /**
3
3
  * Metadata of the scraper
4
4
  *
@@ -1,4 +1,4 @@
1
- import type { Registration } from '../../utils/$Register';
1
+ import type { Registration } from '../../utils/misc/$Register';
2
2
  /**
3
3
  * Registration of known scraper
4
4
  *
@@ -1,4 +1,4 @@
1
- import type { Registration } from '../../utils/$Register';
1
+ import type { Registration } from '../../utils/misc/$Register';
2
2
  /**
3
3
  * Metadata of the scraper
4
4
  *
@@ -1,4 +1,4 @@
1
- import type { Registration } from '../../utils/$Register';
1
+ import type { Registration } from '../../utils/misc/$Register';
2
2
  /**
3
3
  * Registration of known scraper
4
4
  *
@@ -1,4 +1,4 @@
1
- import type { Registration } from '../../utils/$Register';
1
+ import type { Registration } from '../../utils/misc/$Register';
2
2
  /**
3
3
  * Metadata of the scraper
4
4
  *
@@ -1,22 +1,22 @@
1
1
  import spaceTrim from 'spacetrim';
2
2
  import { extractBlock } from '../../postprocessing/utils/extractBlock';
3
3
  import { prettifyMarkdown } from '../../utils/markdown/prettifyMarkdown';
4
+ import { trimCodeBlock } from '../../utils/markdown/trimCodeBlock';
5
+ import { trimEndOfCodeBlock } from '../../utils/markdown/trimEndOfCodeBlock';
4
6
  import { capitalize } from '../../utils/normalization/capitalize';
5
7
  import { decapitalize } from '../../utils/normalization/decapitalize';
6
8
  import { nameToUriPart } from '../../utils/normalization/nameToUriPart';
7
9
  import { nameToUriParts } from '../../utils/normalization/nameToUriParts';
8
10
  import { normalizeToKebabCase } from '../../utils/normalization/normalize-to-kebab-case';
11
+ import { normalizeTo_camelCase } from '../../utils/normalization/normalizeTo_camelCase';
9
12
  import { normalizeTo_PascalCase } from '../../utils/normalization/normalizeTo_PascalCase';
10
13
  import { normalizeTo_SCREAMING_CASE } from '../../utils/normalization/normalizeTo_SCREAMING_CASE';
11
- import { normalizeTo_camelCase } from '../../utils/normalization/normalizeTo_camelCase';
12
14
  import { normalizeTo_snake_case } from '../../utils/normalization/normalizeTo_snake_case';
13
15
  import { normalizeWhitespaces } from '../../utils/normalization/normalizeWhitespaces';
14
16
  import { removeDiacritics } from '../../utils/normalization/removeDiacritics';
15
- import { removeEmojis } from '../../utils/removeEmojis';
16
- import { removeQuotes } from '../../utils/removeQuotes';
17
- import { trimCodeBlock } from '../../utils/trimCodeBlock';
18
- import { trimEndOfCodeBlock } from '../../utils/trimEndOfCodeBlock';
19
- import { unwrapResult } from '../../utils/unwrapResult';
17
+ import { removeEmojis } from '../../utils/normalization/removeEmojis';
18
+ import { removeQuotes } from '../../utils/normalization/removeQuotes';
19
+ import { unwrapResult } from '../../utils/normalization/unwrapResult';
20
20
  /**
21
21
  * Collection of utility functions that can be used for post-processing model outputs.
22
22
  * These functions help transform, extract, or format the raw model responses.
@@ -1,5 +1,5 @@
1
1
  import type { string_markdown } from '../../types/typeAliases';
2
- import type { FromtoItems } from '../FromtoItems';
2
+ import type { FromtoItems } from '../misc/FromtoItems';
3
3
  /**
4
4
  * Options for `CreateMarkdownChartOptions`
5
5
  */
@@ -1,4 +1,4 @@
1
- import { string_markdown } from '../../types/typeAliases';
1
+ import type { string_markdown } from '../../types/typeAliases';
2
2
  /**
3
3
  * Function `humanizeAiText` will remove traces of AI text generation artifacts
4
4
  *
@@ -1,4 +1,4 @@
1
- import { string_markdown } from '../../types/typeAliases';
1
+ import type { string_markdown } from '../../types/typeAliases';
2
2
  /**
3
3
  * Change ellipsis character to three dots `…` -> `...`
4
4
  *
@@ -1,4 +1,4 @@
1
- import { string_markdown } from '../../types/typeAliases';
1
+ import type { string_markdown } from '../../types/typeAliases';
2
2
  /**
3
3
  * Change em-dashes to regular dashes `—` -> `-`
4
4
  *
@@ -1,4 +1,4 @@
1
- import { string_markdown } from '../../types/typeAliases';
1
+ import type { string_markdown } from '../../types/typeAliases';
2
2
  /**
3
3
  * Change smart quotes to regular quotes
4
4
  *
@@ -1,4 +1,4 @@
1
- import { string_markdown } from '../../types/typeAliases';
1
+ import type { string_markdown } from '../../types/typeAliases';
2
2
  /**
3
3
  * Change unprintable hard spaces to regular spaces
4
4
  *
@@ -1,4 +1,4 @@
1
- import { string_markdown } from '../../types/typeAliases';
1
+ import type { string_markdown } from '../../types/typeAliases';
2
2
  /**
3
3
  * Function `promptbookifyAiText` will slightly modify the text so we know it was processed by Promptbook
4
4
  *
@@ -5,6 +5,6 @@
5
5
  * Note: This is useful for post-processing of the result of the chat LLM model
6
6
  * when the model wraps the result in the (markdown) code block.
7
7
  *
8
- * @public exported from `@promptbook/utils`
8
+ * @public exported from `@promptbook/markdown-utils`
9
9
  */
10
10
  export declare function trimCodeBlock(value: string): string;
@@ -4,6 +4,6 @@
4
4
  * Note: This is useful for post-processing of the result of the completion LLM model
5
5
  * if you want to start code block in the prompt but you don't want to end it in the result.
6
6
  *
7
- * @public exported from `@promptbook/utils`
7
+ * @public exported from `@promptbook/markdown-utils`
8
8
  */
9
9
  export declare function trimEndOfCodeBlock(value: string): string;
@@ -1,6 +1,6 @@
1
1
  import { type IDestroyable } from 'destroyable';
2
- import type { string_name } from '../types/typeAliases';
3
- import type { TODO_string } from './organization/TODO_string';
2
+ import type { string_name } from '../../types/typeAliases';
3
+ import type { TODO_string } from '../organization/TODO_string';
4
4
  /**
5
5
  * Represents an entity in a global registry.
6
6
  * Contains identifying information about the package and class.
@@ -1,4 +1,4 @@
1
- import type { string_date_iso8601 } from '../types/typeAliases';
1
+ import type { string_date_iso8601 } from '../../types/typeAliases';
2
2
  /**
3
3
  * Simple wrapper `new Date().toISOString()`
4
4
  *
@@ -1,4 +1,4 @@
1
- import type { Arrayable } from '../types/Arrayable';
1
+ import type { Arrayable } from '../../types/Arrayable';
2
2
  /**
3
3
  * Takes an item or an array of items and returns an array of items
4
4
  *
@@ -0,0 +1,5 @@
1
+ import type { TODO_any } from '../organization/TODO_any';
2
+ /**
3
+ * @public exported from `@promptbook/utils`
4
+ */
5
+ export declare function debounce<T extends (...args: TODO_any[]) => void>(fn: T, delay: number): (...args: Parameters<T>) => void;
@@ -1,4 +1,4 @@
1
- import type { string_char_emoji } from '../types/typeAliasEmoji';
1
+ import type { string_char_emoji } from '../../types/typeAliasEmoji';
2
2
  /**
3
3
  * All possible emoji chars like "🍆", "🍡", "🍤"...
4
4
  * Note: this will be needed to update annually - now updated at 2022-01-19
@@ -0,0 +1,20 @@
1
+ import type { string_css_class } from '../../types/typeAliases';
2
+ export type InjectCssModuleIntoShadowRootOptions = {
3
+ /**
4
+ * The shadow root where the styles should be injected
5
+ */
6
+ shadowRoot: ShadowRoot;
7
+ /**
8
+ * The imported CSS module styles object
9
+ */
10
+ styles: Record<string_css_class, string_css_class>;
11
+ };
12
+ /**
13
+ * Inject the CSS module rules (derived from imported `styles`) into the provided shadow root.
14
+ * This allows CSS modules (which are normally emitted into the document head) to be
15
+ * available inside the component's shadow DOM.
16
+ *
17
+ * @public exported from `@promptbook/components`
18
+ * <- TODO: [🧠] Make `@promptbook/components-utils`
19
+ */
20
+ export declare function injectCssModuleIntoShadowRoot(options: InjectCssModuleIntoShadowRootOptions): void;
@@ -15,7 +15,7 @@ export declare const BOOK_LANGUAGE_VERSION: string_semantic_version;
15
15
  export declare const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version;
16
16
  /**
17
17
  * Represents the version string of the Promptbook engine.
18
- * It follows semantic versioning (e.g., `0.102.0-4`).
18
+ * It follows semantic versioning (e.g., `0.102.0-5`).
19
19
  *
20
20
  * @generated
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/ollama",
3
- "version": "0.102.0-5",
3
+ "version": "0.102.0-6",
4
4
  "description": "Promptbook: Run AI apps in plain human language across multiple models and platforms",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -94,7 +94,7 @@
94
94
  "module": "./esm/index.es.js",
95
95
  "typings": "./esm/typings/src/_packages/ollama.index.d.ts",
96
96
  "peerDependencies": {
97
- "@promptbook/core": "0.102.0-5"
97
+ "@promptbook/core": "0.102.0-6"
98
98
  },
99
99
  "dependencies": {
100
100
  "bottleneck": "^2.19.5",
package/umd/index.umd.js CHANGED
@@ -25,7 +25,7 @@
25
25
  * @generated
26
26
  * @see https://github.com/webgptorg/promptbook
27
27
  */
28
- const PROMPTBOOK_ENGINE_VERSION = '0.102.0-5';
28
+ const PROMPTBOOK_ENGINE_VERSION = '0.102.0-6';
29
29
  /**
30
30
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
31
31
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -1996,6 +1996,10 @@
1996
1996
  * Tracks models and parameters that have already been retried to prevent infinite loops
1997
1997
  */
1998
1998
  this.retriedUnsupportedParameters = new Set();
1999
+ /**
2000
+ * Tracks the history of attempts for error reporting
2001
+ */
2002
+ this.attemptHistory = [];
1999
2003
  // TODO: Allow configuring rate limits via options
2000
2004
  this.limiter = new Bottleneck__default["default"]({
2001
2005
  minTime: 60000 / (this.options.maxRequestsPerMinute || DEFAULT_MAX_REQUESTS_PER_MINUTE),
@@ -2062,7 +2066,7 @@
2062
2066
  /**
2063
2067
  * Internal method that handles parameter retry for chat model calls
2064
2068
  */
2065
- async callChatModelWithRetry(prompt, currentModelRequirements) {
2069
+ async callChatModelWithRetry(prompt, currentModelRequirements, attemptStack = []) {
2066
2070
  var _a;
2067
2071
  if (this.options.isVerbose) {
2068
2072
  console.info(`💬 ${this.title} callChatModel call`, { prompt, currentModelRequirements });
@@ -2169,6 +2173,15 @@
2169
2173
  assertsError(error);
2170
2174
  // Check if this is an unsupported parameter error
2171
2175
  if (!isUnsupportedParameterError(error)) {
2176
+ // If we have attemptStack, include it in the error message
2177
+ if (attemptStack.length > 0) {
2178
+ throw new PipelineExecutionError(`All attempts failed. Attempt history:\n` +
2179
+ attemptStack.map((a, i) => ` ${i + 1}. Model: ${a.modelName}` +
2180
+ (a.unsupportedParameter ? `, Stripped: ${a.unsupportedParameter}` : '') +
2181
+ `, Error: ${a.errorMessage}` +
2182
+ (a.stripped ? ' (stripped and retried)' : '')).join('\n') +
2183
+ `\nFinal error: ${error.message}`);
2184
+ }
2172
2185
  throw error;
2173
2186
  }
2174
2187
  // Parse which parameter is unsupported
@@ -2182,11 +2195,19 @@
2182
2195
  // Create a unique key for this model + parameter combination to prevent infinite loops
2183
2196
  const retryKey = `${modelName}-${unsupportedParameter}`;
2184
2197
  if (this.retriedUnsupportedParameters.has(retryKey)) {
2185
- // Already retried this parameter, throw the error
2186
- if (this.options.isVerbose) {
2187
- console.warn(colors__default["default"].bgRed('Error'), `Parameter '${unsupportedParameter}' for model '${modelName}' already retried once, throwing error:`, error.message);
2188
- }
2189
- throw error;
2198
+ // Already retried this parameter, throw the error with attemptStack
2199
+ attemptStack.push({
2200
+ modelName,
2201
+ unsupportedParameter,
2202
+ errorMessage: error.message,
2203
+ stripped: true,
2204
+ });
2205
+ throw new PipelineExecutionError(`All attempts failed. Attempt history:\n` +
2206
+ attemptStack.map((a, i) => ` ${i + 1}. Model: ${a.modelName}` +
2207
+ (a.unsupportedParameter ? `, Stripped: ${a.unsupportedParameter}` : '') +
2208
+ `, Error: ${a.errorMessage}` +
2209
+ (a.stripped ? ' (stripped and retried)' : '')).join('\n') +
2210
+ `\nFinal error: ${error.message}`);
2190
2211
  }
2191
2212
  // Mark this parameter as retried
2192
2213
  this.retriedUnsupportedParameters.add(retryKey);
@@ -2194,9 +2215,16 @@
2194
2215
  if (this.options.isVerbose) {
2195
2216
  console.warn(colors__default["default"].bgYellow('Warning'), `Removing unsupported parameter '${unsupportedParameter}' for model '${modelName}' and retrying request`);
2196
2217
  }
2218
+ // Add to attemptStack
2219
+ attemptStack.push({
2220
+ modelName,
2221
+ unsupportedParameter,
2222
+ errorMessage: error.message,
2223
+ stripped: true,
2224
+ });
2197
2225
  // Remove the unsupported parameter and retry
2198
2226
  const modifiedModelRequirements = removeUnsupportedModelRequirement(currentModelRequirements, unsupportedParameter);
2199
- return this.callChatModelWithRetry(prompt, modifiedModelRequirements);
2227
+ return this.callChatModelWithRetry(prompt, modifiedModelRequirements, attemptStack);
2200
2228
  }
2201
2229
  }
2202
2230
  /**
@@ -2208,7 +2236,7 @@
2208
2236
  /**
2209
2237
  * Internal method that handles parameter retry for completion model calls
2210
2238
  */
2211
- async callCompletionModelWithRetry(prompt, currentModelRequirements) {
2239
+ async callCompletionModelWithRetry(prompt, currentModelRequirements, attemptStack = []) {
2212
2240
  var _a;
2213
2241
  if (this.options.isVerbose) {
2214
2242
  console.info(`🖋 ${this.title} callCompletionModel call`, { prompt, currentModelRequirements });
@@ -2283,6 +2311,14 @@
2283
2311
  assertsError(error);
2284
2312
  // Check if this is an unsupported parameter error
2285
2313
  if (!isUnsupportedParameterError(error)) {
2314
+ if (attemptStack.length > 0) {
2315
+ throw new PipelineExecutionError(`All attempts failed. Attempt history:\n` +
2316
+ attemptStack.map((a, i) => ` ${i + 1}. Model: ${a.modelName}` +
2317
+ (a.unsupportedParameter ? `, Stripped: ${a.unsupportedParameter}` : '') +
2318
+ `, Error: ${a.errorMessage}` +
2319
+ (a.stripped ? ' (stripped and retried)' : '')).join('\n') +
2320
+ `\nFinal error: ${error.message}`);
2321
+ }
2286
2322
  throw error;
2287
2323
  }
2288
2324
  // Parse which parameter is unsupported
@@ -2296,11 +2332,18 @@
2296
2332
  // Create a unique key for this model + parameter combination to prevent infinite loops
2297
2333
  const retryKey = `${modelName}-${unsupportedParameter}`;
2298
2334
  if (this.retriedUnsupportedParameters.has(retryKey)) {
2299
- // Already retried this parameter, throw the error
2300
- if (this.options.isVerbose) {
2301
- console.warn(colors__default["default"].bgRed('Error'), `Parameter '${unsupportedParameter}' for model '${modelName}' already retried once, throwing error:`, error.message);
2302
- }
2303
- throw error;
2335
+ attemptStack.push({
2336
+ modelName,
2337
+ unsupportedParameter,
2338
+ errorMessage: error.message,
2339
+ stripped: true,
2340
+ });
2341
+ throw new PipelineExecutionError(`All attempts failed. Attempt history:\n` +
2342
+ attemptStack.map((a, i) => ` ${i + 1}. Model: ${a.modelName}` +
2343
+ (a.unsupportedParameter ? `, Stripped: ${a.unsupportedParameter}` : '') +
2344
+ `, Error: ${a.errorMessage}` +
2345
+ (a.stripped ? ' (stripped and retried)' : '')).join('\n') +
2346
+ `\nFinal error: ${error.message}`);
2304
2347
  }
2305
2348
  // Mark this parameter as retried
2306
2349
  this.retriedUnsupportedParameters.add(retryKey);
@@ -2308,9 +2351,15 @@
2308
2351
  if (this.options.isVerbose) {
2309
2352
  console.warn(colors__default["default"].bgYellow('Warning'), `Removing unsupported parameter '${unsupportedParameter}' for model '${modelName}' and retrying request`);
2310
2353
  }
2354
+ attemptStack.push({
2355
+ modelName,
2356
+ unsupportedParameter,
2357
+ errorMessage: error.message,
2358
+ stripped: true,
2359
+ });
2311
2360
  // Remove the unsupported parameter and retry
2312
2361
  const modifiedModelRequirements = removeUnsupportedModelRequirement(currentModelRequirements, unsupportedParameter);
2313
- return this.callCompletionModelWithRetry(prompt, modifiedModelRequirements);
2362
+ return this.callCompletionModelWithRetry(prompt, modifiedModelRequirements, attemptStack);
2314
2363
  }
2315
2364
  }
2316
2365
  /**
@@ -2322,7 +2371,7 @@
2322
2371
  /**
2323
2372
  * Internal method that handles parameter retry for embedding model calls
2324
2373
  */
2325
- async callEmbeddingModelWithRetry(prompt, currentModelRequirements) {
2374
+ async callEmbeddingModelWithRetry(prompt, currentModelRequirements, attemptStack = []) {
2326
2375
  if (this.options.isVerbose) {
2327
2376
  console.info(`🖋 ${this.title} embedding call`, { prompt, currentModelRequirements });
2328
2377
  }
@@ -2386,6 +2435,14 @@
2386
2435
  assertsError(error);
2387
2436
  // Check if this is an unsupported parameter error
2388
2437
  if (!isUnsupportedParameterError(error)) {
2438
+ if (attemptStack.length > 0) {
2439
+ throw new PipelineExecutionError(`All attempts failed. Attempt history:\n` +
2440
+ attemptStack.map((a, i) => ` ${i + 1}. Model: ${a.modelName}` +
2441
+ (a.unsupportedParameter ? `, Stripped: ${a.unsupportedParameter}` : '') +
2442
+ `, Error: ${a.errorMessage}` +
2443
+ (a.stripped ? ' (stripped and retried)' : '')).join('\n') +
2444
+ `\nFinal error: ${error.message}`);
2445
+ }
2389
2446
  throw error;
2390
2447
  }
2391
2448
  // Parse which parameter is unsupported
@@ -2399,11 +2456,18 @@
2399
2456
  // Create a unique key for this model + parameter combination to prevent infinite loops
2400
2457
  const retryKey = `${modelName}-${unsupportedParameter}`;
2401
2458
  if (this.retriedUnsupportedParameters.has(retryKey)) {
2402
- // Already retried this parameter, throw the error
2403
- if (this.options.isVerbose) {
2404
- console.warn(colors__default["default"].bgRed('Error'), `Parameter '${unsupportedParameter}' for model '${modelName}' already retried once, throwing error:`, error.message);
2405
- }
2406
- throw error;
2459
+ attemptStack.push({
2460
+ modelName,
2461
+ unsupportedParameter,
2462
+ errorMessage: error.message,
2463
+ stripped: true,
2464
+ });
2465
+ throw new PipelineExecutionError(`All attempts failed. Attempt history:\n` +
2466
+ attemptStack.map((a, i) => ` ${i + 1}. Model: ${a.modelName}` +
2467
+ (a.unsupportedParameter ? `, Stripped: ${a.unsupportedParameter}` : '') +
2468
+ `, Error: ${a.errorMessage}` +
2469
+ (a.stripped ? ' (stripped and retried)' : '')).join('\n') +
2470
+ `\nFinal error: ${error.message}`);
2407
2471
  }
2408
2472
  // Mark this parameter as retried
2409
2473
  this.retriedUnsupportedParameters.add(retryKey);
@@ -2411,9 +2475,15 @@
2411
2475
  if (this.options.isVerbose) {
2412
2476
  console.warn(colors__default["default"].bgYellow('Warning'), `Removing unsupported parameter '${unsupportedParameter}' for model '${modelName}' and retrying request`);
2413
2477
  }
2478
+ attemptStack.push({
2479
+ modelName,
2480
+ unsupportedParameter,
2481
+ errorMessage: error.message,
2482
+ stripped: true,
2483
+ });
2414
2484
  // Remove the unsupported parameter and retry
2415
2485
  const modifiedModelRequirements = removeUnsupportedModelRequirement(currentModelRequirements, unsupportedParameter);
2416
- return this.callEmbeddingModelWithRetry(prompt, modifiedModelRequirements);
2486
+ return this.callEmbeddingModelWithRetry(prompt, modifiedModelRequirements, attemptStack);
2417
2487
  }
2418
2488
  }
2419
2489
  // <- Note: [🤖] callXxxModel