@promptbook/editable 0.94.0 → 0.98.0-10

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 (75) hide show
  1. package/README.md +6 -2
  2. package/esm/index.es.js +3 -3
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/src/_packages/anthropic-claude.index.d.ts +2 -2
  5. package/esm/typings/src/_packages/cli.index.d.ts +4 -0
  6. package/esm/typings/src/_packages/core.index.d.ts +2 -0
  7. package/esm/typings/src/_packages/openai.index.d.ts +10 -0
  8. package/esm/typings/src/_packages/types.index.d.ts +14 -4
  9. package/esm/typings/src/_packages/{wizzard.index.d.ts → wizard.index.d.ts} +6 -2
  10. package/esm/typings/src/cli/cli-commands/prettify.d.ts +1 -1
  11. package/esm/typings/src/cli/cli-commands/test-command.d.ts +1 -1
  12. package/esm/typings/src/config.d.ts +1 -1
  13. package/esm/typings/src/conversion/archive/loadArchive.d.ts +1 -1
  14. package/esm/typings/src/conversion/archive/saveArchive.d.ts +2 -2
  15. package/esm/typings/src/conversion/prettify/renderPipelineMermaidOptions.d.ts +1 -1
  16. package/esm/typings/src/dialogs/callback/CallbackInterfaceTools.d.ts +1 -1
  17. package/esm/typings/src/execution/AbstractTaskResult.d.ts +2 -2
  18. package/esm/typings/src/execution/createPipelineExecutor/$OngoingTaskResult.d.ts +8 -0
  19. package/esm/typings/src/execution/createPipelineExecutor/00-CreatePipelineExecutorOptions.d.ts +1 -1
  20. package/esm/typings/src/execution/execution-report/ExecutionPromptReportJson.d.ts +2 -2
  21. package/esm/typings/src/execution/translation/automatic-translate/translateMessages.d.ts +1 -1
  22. package/esm/typings/src/execution/utils/validatePromptResult.d.ts +53 -0
  23. package/esm/typings/src/llm-providers/_common/register/{$provideLlmToolsForWizzardOrCli.d.ts → $provideLlmToolsForWizardOrCli.d.ts} +2 -2
  24. package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +3 -3
  25. package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +2 -2
  26. package/esm/typings/src/llm-providers/anthropic-claude/register-configuration.d.ts +1 -1
  27. package/esm/typings/src/llm-providers/anthropic-claude/register-constructor.d.ts +1 -1
  28. package/esm/typings/src/llm-providers/azure-openai/register-configuration.d.ts +1 -1
  29. package/esm/typings/src/llm-providers/azure-openai/register-constructor.d.ts +1 -1
  30. package/esm/typings/src/llm-providers/deepseek/register-configuration.d.ts +1 -1
  31. package/esm/typings/src/llm-providers/deepseek/register-constructor.d.ts +1 -1
  32. package/esm/typings/src/llm-providers/google/register-configuration.d.ts +1 -1
  33. package/esm/typings/src/llm-providers/google/register-constructor.d.ts +1 -1
  34. package/esm/typings/src/llm-providers/ollama/register-configuration.d.ts +1 -1
  35. package/esm/typings/src/llm-providers/ollama/register-constructor.d.ts +1 -1
  36. package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +1 -1
  37. package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionToolsOptions.d.ts +2 -2
  38. package/esm/typings/src/llm-providers/openai/OpenAiCompatibleExecutionTools.d.ts +4 -4
  39. package/esm/typings/src/llm-providers/openai/OpenAiCompatibleExecutionToolsOptions.d.ts +52 -0
  40. package/esm/typings/src/llm-providers/openai/OpenAiExecutionToolsOptions.d.ts +3 -5
  41. package/esm/typings/src/llm-providers/openai/createOpenAiCompatibleExecutionTools.d.ts +74 -0
  42. package/esm/typings/src/llm-providers/openai/register-configuration.d.ts +13 -2
  43. package/esm/typings/src/llm-providers/openai/register-constructor.d.ts +16 -2
  44. package/esm/typings/src/remote-server/socket-types/listModels/PromptbookServer_ListModels_Request.d.ts +1 -1
  45. package/esm/typings/src/scrapers/_boilerplate/createBoilerplateScraper.d.ts +1 -1
  46. package/esm/typings/src/scrapers/_boilerplate/register-constructor.d.ts +1 -1
  47. package/esm/typings/src/scrapers/_boilerplate/register-metadata.d.ts +2 -2
  48. package/esm/typings/src/scrapers/_common/prepareKnowledgePieces.d.ts +1 -1
  49. package/esm/typings/src/scrapers/_common/register/ScraperAndConverterMetadata.d.ts +1 -1
  50. package/esm/typings/src/scrapers/document/createDocumentScraper.d.ts +1 -1
  51. package/esm/typings/src/scrapers/document/register-constructor.d.ts +1 -1
  52. package/esm/typings/src/scrapers/document/register-metadata.d.ts +2 -2
  53. package/esm/typings/src/scrapers/document-legacy/createLegacyDocumentScraper.d.ts +1 -1
  54. package/esm/typings/src/scrapers/document-legacy/register-constructor.d.ts +1 -1
  55. package/esm/typings/src/scrapers/document-legacy/register-metadata.d.ts +2 -2
  56. package/esm/typings/src/scrapers/markdown/createMarkdownScraper.d.ts +1 -4
  57. package/esm/typings/src/scrapers/markdown/register-constructor.d.ts +1 -1
  58. package/esm/typings/src/scrapers/markdown/register-metadata.d.ts +2 -2
  59. package/esm/typings/src/scrapers/markitdown/createMarkitdownScraper.d.ts +1 -1
  60. package/esm/typings/src/scrapers/markitdown/register-constructor.d.ts +1 -1
  61. package/esm/typings/src/scrapers/markitdown/register-metadata.d.ts +2 -2
  62. package/esm/typings/src/scrapers/pdf/createPdfScraper.d.ts +1 -1
  63. package/esm/typings/src/scrapers/pdf/register-constructor.d.ts +1 -1
  64. package/esm/typings/src/scrapers/pdf/register-metadata.d.ts +2 -2
  65. package/esm/typings/src/scrapers/website/createWebsiteScraper.d.ts +1 -1
  66. package/esm/typings/src/scrapers/website/register-constructor.d.ts +1 -1
  67. package/esm/typings/src/scrapers/website/register-metadata.d.ts +2 -2
  68. package/esm/typings/src/types/typeAliases.d.ts +1 -1
  69. package/esm/typings/src/utils/files/listAllFiles.d.ts +1 -1
  70. package/esm/typings/src/version.d.ts +1 -1
  71. package/esm/typings/src/{wizzard → wizard}/$getCompiledBook.d.ts +2 -2
  72. package/esm/typings/src/{wizzard/wizzard.d.ts → wizard/wizard.d.ts} +6 -6
  73. package/package.json +2 -14
  74. package/umd/index.umd.js +3 -3
  75. package/umd/index.umd.js.map +1 -1
@@ -61,6 +61,8 @@ import type { Usage } from '../execution/Usage';
61
61
  import type { UsageCounts } from '../execution/Usage';
62
62
  import type { UserInterfaceTools } from '../execution/UserInterfaceTools';
63
63
  import type { UserInterfaceToolsPromptDialogOptions } from '../execution/UserInterfaceTools';
64
+ import type { ValidatePromptResultOptions } from '../execution/utils/validatePromptResult';
65
+ import type { ValidatePromptResultResult } from '../execution/utils/validatePromptResult';
64
66
  import type { FormatSubvalueParser } from '../formats/_common/FormatSubvalueParser';
65
67
  import type { FormatSubvalueParserMapValuesOptions } from '../formats/_common/FormatSubvalueParser';
66
68
  import type { CsvSettings } from '../formats/csv/CsvSettings';
@@ -74,13 +76,16 @@ import type { CacheItem } from '../llm-providers/_common/utils/cache/CacheItem';
74
76
  import type { CacheLlmToolsOptions } from '../llm-providers/_common/utils/cache/CacheLlmToolsOptions';
75
77
  import type { LlmExecutionToolsWithTotalUsage } from '../llm-providers/_common/utils/count-total-usage/LlmExecutionToolsWithTotalUsage';
76
78
  import type { AnthropicClaudeExecutionToolsOptions } from '../llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions';
77
- import type { AnthropicClaudeExecutionToolsDirectOptions } from '../llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions';
79
+ import type { AnthropicClaudeExecutionToolsNonProxiedOptions } from '../llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions';
78
80
  import type { AnthropicClaudeExecutionToolsProxiedOptions } from '../llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions';
79
81
  import type { AzureOpenAiExecutionToolsOptions } from '../llm-providers/azure-openai/AzureOpenAiExecutionToolsOptions';
80
82
  import type { DeepseekExecutionToolsOptions } from '../llm-providers/deepseek/DeepseekExecutionToolsOptions';
81
83
  import type { GoogleExecutionToolsOptions } from '../llm-providers/google/GoogleExecutionToolsOptions';
82
84
  import type { OllamaExecutionToolsOptions } from '../llm-providers/ollama/OllamaExecutionToolsOptions';
83
85
  import type { OpenAiAssistantExecutionToolsOptions } from '../llm-providers/openai/OpenAiAssistantExecutionToolsOptions';
86
+ import type { OpenAiCompatibleExecutionToolsOptions } from '../llm-providers/openai/OpenAiCompatibleExecutionToolsOptions';
87
+ import type { OpenAiCompatibleExecutionToolsNonProxiedOptions } from '../llm-providers/openai/OpenAiCompatibleExecutionToolsOptions';
88
+ import type { OpenAiCompatibleExecutionToolsProxiedOptions } from '../llm-providers/openai/OpenAiCompatibleExecutionToolsOptions';
84
89
  import type { OpenAiExecutionToolsOptions } from '../llm-providers/openai/OpenAiExecutionToolsOptions';
85
90
  import type { VercelExecutionToolsOptions } from '../llm-providers/vercel/VercelExecutionToolsOptions';
86
91
  import type { VercelProvider } from '../llm-providers/vercel/VercelProvider';
@@ -262,7 +267,7 @@ import type { number_percent } from '../types/typeAliases';
262
267
  import type { number_model_temperature } from '../types/typeAliases';
263
268
  import type { number_seed } from '../types/typeAliases';
264
269
  import type { number_likeness } from '../types/typeAliases';
265
- import type { number_miliseconds } from '../types/typeAliases';
270
+ import type { number_milliseconds } from '../types/typeAliases';
266
271
  import type { number_seconds } from '../types/typeAliases';
267
272
  import type { number_minutes } from '../types/typeAliases';
268
273
  import type { number_hours } from '../types/typeAliases';
@@ -360,6 +365,8 @@ export type { Usage };
360
365
  export type { UsageCounts };
361
366
  export type { UserInterfaceTools };
362
367
  export type { UserInterfaceToolsPromptDialogOptions };
368
+ export type { ValidatePromptResultOptions };
369
+ export type { ValidatePromptResultResult };
363
370
  export type { FormatSubvalueParser };
364
371
  export type { FormatSubvalueParserMapValuesOptions };
365
372
  export type { CsvSettings };
@@ -373,13 +380,16 @@ export type { CacheItem };
373
380
  export type { CacheLlmToolsOptions };
374
381
  export type { LlmExecutionToolsWithTotalUsage };
375
382
  export type { AnthropicClaudeExecutionToolsOptions };
376
- export type { AnthropicClaudeExecutionToolsDirectOptions };
383
+ export type { AnthropicClaudeExecutionToolsNonProxiedOptions };
377
384
  export type { AnthropicClaudeExecutionToolsProxiedOptions };
378
385
  export type { AzureOpenAiExecutionToolsOptions };
379
386
  export type { DeepseekExecutionToolsOptions };
380
387
  export type { GoogleExecutionToolsOptions };
381
388
  export type { OllamaExecutionToolsOptions };
382
389
  export type { OpenAiAssistantExecutionToolsOptions };
390
+ export type { OpenAiCompatibleExecutionToolsOptions };
391
+ export type { OpenAiCompatibleExecutionToolsNonProxiedOptions };
392
+ export type { OpenAiCompatibleExecutionToolsProxiedOptions };
383
393
  export type { OpenAiExecutionToolsOptions };
384
394
  export type { VercelExecutionToolsOptions };
385
395
  export type { VercelProvider };
@@ -561,7 +571,7 @@ export type { number_percent };
561
571
  export type { number_model_temperature };
562
572
  export type { number_seed };
563
573
  export type { number_likeness };
564
- export type { number_miliseconds };
574
+ export type { number_milliseconds };
565
575
  export type { number_seconds };
566
576
  export type { number_minutes };
567
577
  export type { number_hours };
@@ -11,8 +11,10 @@ import { _OllamaMetadataRegistration } from '../llm-providers/ollama/register-co
11
11
  import { _OllamaRegistration } from '../llm-providers/ollama/register-constructor';
12
12
  import { _OpenAiMetadataRegistration } from '../llm-providers/openai/register-configuration';
13
13
  import { _OpenAiAssistantMetadataRegistration } from '../llm-providers/openai/register-configuration';
14
+ import { _OpenAiCompatibleMetadataRegistration } from '../llm-providers/openai/register-configuration';
14
15
  import { _OpenAiRegistration } from '../llm-providers/openai/register-constructor';
15
16
  import { _OpenAiAssistantRegistration } from '../llm-providers/openai/register-constructor';
17
+ import { _OpenAiCompatibleRegistration } from '../llm-providers/openai/register-constructor';
16
18
  import { _BoilerplateScraperRegistration } from '../scrapers/_boilerplate/register-constructor';
17
19
  import { _BoilerplateScraperMetadataRegistration } from '../scrapers/_boilerplate/register-metadata';
18
20
  import { _LegacyDocumentScraperRegistration } from '../scrapers/document-legacy/register-constructor';
@@ -27,7 +29,7 @@ import { _PdfScraperRegistration } from '../scrapers/pdf/register-constructor';
27
29
  import { _PdfScraperMetadataRegistration } from '../scrapers/pdf/register-metadata';
28
30
  import { _WebsiteScraperRegistration } from '../scrapers/website/register-constructor';
29
31
  import { _WebsiteScraperMetadataRegistration } from '../scrapers/website/register-metadata';
30
- import { wizzard } from '../wizzard/wizzard';
32
+ import { wizard } from '../wizard/wizard';
31
33
  export { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION };
32
34
  export { _AnthropicClaudeMetadataRegistration };
33
35
  export { _AnthropicClaudeRegistration };
@@ -41,8 +43,10 @@ export { _OllamaMetadataRegistration };
41
43
  export { _OllamaRegistration };
42
44
  export { _OpenAiMetadataRegistration };
43
45
  export { _OpenAiAssistantMetadataRegistration };
46
+ export { _OpenAiCompatibleMetadataRegistration };
44
47
  export { _OpenAiRegistration };
45
48
  export { _OpenAiAssistantRegistration };
49
+ export { _OpenAiCompatibleRegistration };
46
50
  export { _BoilerplateScraperRegistration };
47
51
  export { _BoilerplateScraperMetadataRegistration };
48
52
  export { _LegacyDocumentScraperRegistration };
@@ -57,4 +61,4 @@ export { _PdfScraperRegistration };
57
61
  export { _PdfScraperMetadataRegistration };
58
62
  export { _WebsiteScraperRegistration };
59
63
  export { _WebsiteScraperMetadataRegistration };
60
- export { wizzard };
64
+ export { wizard };
@@ -8,7 +8,7 @@ import type { Command as Program } from 'commander';
8
8
  */
9
9
  export declare function $initializePrettifyCommand(program: Program): void;
10
10
  /**
11
- * TODO: [😶] Unite floder listing
11
+ * TODO: [😶] Unite folder listing
12
12
  * Note: [💞] Ignore a discrepancy between file name and entity name
13
13
  * Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
14
14
  * TODO: [🖇] What about symlinks? Maybe flag --follow-symlinks
@@ -8,7 +8,7 @@ import type { Command as Program } from 'commander';
8
8
  */
9
9
  export declare function $initializeTestCommand(program: Program): void;
10
10
  /**
11
- * TODO: [😶] Unite floder listing
11
+ * TODO: [😶] Unite folder listing
12
12
  * Note: [💞] Ignore a discrepancy between file name and entity name
13
13
  * Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
14
14
  * TODO: [🖇] What about symlinks? Maybe flag --follow-symlinks
@@ -176,7 +176,7 @@ export declare const DEFAULT_MAX_PARALLEL_COUNT = 5;
176
176
  *
177
177
  * @public exported from `@promptbook/core`
178
178
  */
179
- export declare const DEFAULT_MAX_EXECUTION_ATTEMPTS = 10;
179
+ export declare const DEFAULT_MAX_EXECUTION_ATTEMPTS = 7;
180
180
  /**
181
181
  * The maximum depth to which knowledge sources will be scraped when building a knowledge base.
182
182
  * This prevents infinite recursion and limits resource usage.
@@ -8,7 +8,7 @@ import type { string_filename } from '../../types/typeAliases';
8
8
  * @param fs Filesystem tools
9
9
  * @returns Pipelines loaded from the archive
10
10
  *
11
- * @private utility of Prompbook
11
+ * @private utility of Promptbook
12
12
  */
13
13
  export declare function loadArchive(filePath: string_filename, fs: FilesystemTools): Promise<ReadonlyArray<PipelineJson>>;
14
14
  /**
@@ -1,6 +1,6 @@
1
+ import type { FilesystemTools } from '../../execution/FilesystemTools';
1
2
  import type { PipelineJson } from '../../pipeline/PipelineJson/PipelineJson';
2
3
  import type { string_filename } from '../../types/typeAliases';
3
- import type { FilesystemTools } from '../../execution/FilesystemTools';
4
4
  /**
5
5
  * Saves the given books into an archive file with `.bookc` extension
6
6
  *
@@ -8,7 +8,7 @@ import type { FilesystemTools } from '../../execution/FilesystemTools';
8
8
  * @param books Pipelines to be saved in the archive
9
9
  * @param fs Filesystem tools
10
10
  *
11
- * @private utility of Prompbook
11
+ * @private utility of Promptbook
12
12
  */
13
13
  export declare function saveArchive(filePath: string_filename, collectionJson: ReadonlyArray<PipelineJson>, fs: FilesystemTools): Promise<void>;
14
14
  /**
@@ -2,7 +2,7 @@ import type { PipelineJson } from '../../pipeline/PipelineJson/PipelineJson';
2
2
  import type { TaskJson } from '../../pipeline/PipelineJson/TaskJson';
3
3
  import type { string_href } from '../../types/typeAliases';
4
4
  /**
5
- * Addtional options for rendering Mermaid graph
5
+ * Additional options for rendering Mermaid graph
6
6
  */
7
7
  export type renderPipelineMermaidOptions = {
8
8
  /**
@@ -2,7 +2,7 @@ import type { UserInterfaceTools } from '../../execution/UserInterfaceTools';
2
2
  import type { UserInterfaceToolsPromptDialogOptions } from '../../execution/UserInterfaceTools';
3
3
  import type { CallbackInterfaceToolsOptions } from './CallbackInterfaceToolsOptions';
4
4
  /**
5
- * Delagates the user interaction to a async callback function
5
+ * Delegates the user interaction to a async callback function
6
6
  * You need to provide your own implementation of this callback function and its bind to UI.
7
7
  *
8
8
  * @public exported from `@promptbook/core`
@@ -11,11 +11,11 @@ export type AbstractTaskResult = {
11
11
  */
12
12
  readonly isSuccessful: boolean;
13
13
  /**
14
- * Errors that occured during the execution, details are available in `executionReport`
14
+ * Errors that occurred during the execution, details are available in `executionReport`
15
15
  */
16
16
  readonly errors: ReadonlyDeep<ReadonlyArray<ErrorJson>>;
17
17
  /**
18
- * Warnings that occured during the execution, details are available in `executionReport`
18
+ * Warnings that occurred during the execution, details are available in `executionReport`
19
19
  */
20
20
  readonly warnings: ReadonlyDeep<ReadonlyArray<ErrorJson>>;
21
21
  };
@@ -45,4 +45,12 @@ export type $OngoingTaskResult = {
45
45
  * List of errors encountered during script postprocessing or execution.
46
46
  */
47
47
  $scriptPipelineExecutionErrors: Array<Error>;
48
+ /**
49
+ * Array of all failed attempts, storing both the result string and the error for each failure
50
+ */
51
+ $failedResults: Array<{
52
+ attemptIndex: number;
53
+ result: string | null;
54
+ error: ExpectError;
55
+ }>;
48
56
  };
@@ -35,7 +35,7 @@ export type CreatePipelineExecutorOptions = PrepareAndScrapeOptions & {
35
35
  *
36
36
  * @default false
37
37
  */
38
- readonly isNotPreparedWarningSupressed?: boolean;
38
+ readonly isNotPreparedWarningSuppressed?: boolean;
39
39
  };
40
40
  /**
41
41
  * TODO: [🧎][🧠] Move `csvSettings` to some better place
@@ -8,7 +8,7 @@ import type { PromptResult } from '../PromptResult';
8
8
  */
9
9
  export type ExecutionPromptReportJson = {
10
10
  /**
11
- * The prompt wich was executed
11
+ * The prompt which was executed
12
12
  */
13
13
  readonly prompt: Omit<Prompt, 'pipelineUrl'>;
14
14
  /**
@@ -16,7 +16,7 @@ export type ExecutionPromptReportJson = {
16
16
  */
17
17
  readonly result?: PromptResult;
18
18
  /**
19
- * The error which occured during LLM execution or during postprocessing or expectation checking
19
+ * The error which occurred during LLM execution or during postprocessing or expectation checking
20
20
  *
21
21
  * Note: It makes sense to have both error and result defined, for example when the result not pass expectations
22
22
  */
@@ -7,6 +7,6 @@ export declare function translateMessages({ automaticTranslator, from, to, }: {
7
7
  automaticTranslator: AutomaticTranslator;
8
8
  } & TranslatorOptions): Promise<void>;
9
9
  /**
10
- * TODO: [😶] Unite floder listing
10
+ * TODO: [😶] Unite folder listing
11
11
  * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
12
12
  */
@@ -0,0 +1,53 @@
1
+ import type { FormatCommand } from '../../commands/FORMAT/FormatCommand';
2
+ import { ExpectError } from '../../errors/ExpectError';
3
+ import type { Expectations } from '../../pipeline/PipelineJson/Expectations';
4
+ import type { string_postprocessing_function_name } from '../../types/typeAliases';
5
+ /**
6
+ * Options for validating a prompt result
7
+ */
8
+ export interface ValidatePromptResultOptions {
9
+ /**
10
+ * The result string to validate
11
+ */
12
+ resultString: string;
13
+ /**
14
+ * Expectations for the result (word count, sentence count, etc.)
15
+ */
16
+ expectations?: Expectations;
17
+ /**
18
+ * Expected format of the result (e.g., 'JSON')
19
+ */
20
+ format?: FormatCommand['format'];
21
+ /**
22
+ * List of postprocessing function names that should be applied
23
+ * Note: This is for validation purposes only - postprocessing should be done before calling this function
24
+ */
25
+ postprocessingFunctionNames?: ReadonlyArray<string_postprocessing_function_name>;
26
+ }
27
+ /**
28
+ * Result of prompt result validation
29
+ */
30
+ export interface ValidatePromptResultResult {
31
+ /**
32
+ * Whether the result is valid (passes all expectations and format checks)
33
+ */
34
+ isValid: boolean;
35
+ /**
36
+ * The processed result string (may be modified if format extraction was needed)
37
+ */
38
+ processedResultString: string;
39
+ /**
40
+ * Error that occurred during validation, if any
41
+ */
42
+ error?: ExpectError;
43
+ }
44
+ /**
45
+ * Validates a prompt result against expectations and format requirements.
46
+ * This function provides a common abstraction for result validation that can be used
47
+ * by both execution logic and caching logic to ensure consistency.
48
+ *
49
+ * @param options - The validation options including result string, expectations, and format
50
+ * @returns Validation result with processed string and validity status
51
+ * @private internal function of `createPipelineExecutor` and `cacheLlmTools`
52
+ */
53
+ export declare function validatePromptResult(options: ValidatePromptResultOptions): ValidatePromptResultResult;
@@ -5,7 +5,7 @@ import type { string_url } from '../../../types/typeAliases';
5
5
  import type { really_any } from '../../../utils/organization/really_any';
6
6
  import type { CacheLlmToolsOptions } from '../utils/cache/CacheLlmToolsOptions';
7
7
  import type { LlmExecutionToolsWithTotalUsage } from '../utils/count-total-usage/LlmExecutionToolsWithTotalUsage';
8
- type ProvideLlmToolsForWizzardOrCliOptions = {
8
+ type ProvideLlmToolsForWizardOrCliOptions = {
9
9
  /**
10
10
  * If true, user will be always prompted for login
11
11
  *
@@ -48,7 +48,7 @@ type ProvideLlmToolsForWizzardOrCliOptions = {
48
48
  *
49
49
  * @private within the repository - for CLI utils
50
50
  */
51
- export declare function $provideLlmToolsForWizzardOrCli(options?: ProvideLlmToolsForWizzardOrCliOptions): Promise<LlmExecutionToolsWithTotalUsage>;
51
+ export declare function $provideLlmToolsForWizardOrCli(options?: ProvideLlmToolsForWizardOrCliOptions): Promise<LlmExecutionToolsWithTotalUsage>;
52
52
  export {};
53
53
  /**
54
54
  * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
@@ -7,7 +7,7 @@ import type { Prompt } from '../../types/Prompt';
7
7
  import type { string_markdown } from '../../types/typeAliases';
8
8
  import type { string_markdown_text } from '../../types/typeAliases';
9
9
  import type { string_title } from '../../types/typeAliases';
10
- import type { AnthropicClaudeExecutionToolsDirectOptions } from './AnthropicClaudeExecutionToolsOptions';
10
+ import type { AnthropicClaudeExecutionToolsNonProxiedOptions } from './AnthropicClaudeExecutionToolsOptions';
11
11
  /**
12
12
  * Execution Tools for calling Anthropic Claude API.
13
13
  *
@@ -15,7 +15,7 @@ import type { AnthropicClaudeExecutionToolsDirectOptions } from './AnthropicClau
15
15
  * @deprecated use `createAnthropicClaudeExecutionTools` instead
16
16
  */
17
17
  export declare class AnthropicClaudeExecutionTools implements LlmExecutionTools {
18
- protected readonly options: AnthropicClaudeExecutionToolsDirectOptions;
18
+ protected readonly options: AnthropicClaudeExecutionToolsNonProxiedOptions;
19
19
  /**
20
20
  * Anthropic Claude API client.
21
21
  */
@@ -26,7 +26,7 @@ export declare class AnthropicClaudeExecutionTools implements LlmExecutionTools
26
26
  *
27
27
  * @param options which are relevant are directly passed to the Anthropic Claude client
28
28
  */
29
- constructor(options?: AnthropicClaudeExecutionToolsDirectOptions);
29
+ constructor(options?: AnthropicClaudeExecutionToolsNonProxiedOptions);
30
30
  get title(): string_title & string_markdown_text;
31
31
  get description(): string_markdown;
32
32
  getClient(): Promise<Anthropic>;
@@ -7,14 +7,14 @@ import type { RemoteClientOptions } from '../../remote-server/types/RemoteClient
7
7
  * This extends Anthropic's `ClientOptions` with are directly passed to the Anthropic client.
8
8
  * @public exported from `@promptbook/anthropic-claude`
9
9
  */
10
- export type AnthropicClaudeExecutionToolsOptions = AnthropicClaudeExecutionToolsDirectOptions | AnthropicClaudeExecutionToolsProxiedOptions;
10
+ export type AnthropicClaudeExecutionToolsOptions = AnthropicClaudeExecutionToolsNonProxiedOptions | AnthropicClaudeExecutionToolsProxiedOptions;
11
11
  /**
12
12
  * Options for directly used `AnthropicClaudeExecutionTools`
13
13
  *
14
14
  * This extends Anthropic's `ClientOptions` with are directly passed to the Anthropic client.
15
15
  * @public exported from `@promptbook/anthropic-claude`
16
16
  */
17
- export type AnthropicClaudeExecutionToolsDirectOptions = CommonToolsOptions & ClientOptions & {
17
+ export type AnthropicClaudeExecutionToolsNonProxiedOptions = CommonToolsOptions & ClientOptions & {
18
18
  isProxied?: false;
19
19
  };
20
20
  /**
@@ -5,7 +5,7 @@ import type { Registration } from '../../utils/$Register';
5
5
  * Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available LLM tools
6
6
  *
7
7
  * @public exported from `@promptbook/core`
8
- * @public exported from `@promptbook/wizzard`
8
+ * @public exported from `@promptbook/wizard`
9
9
  * @public exported from `@promptbook/cli`
10
10
  */
11
11
  export declare const _AnthropicClaudeMetadataRegistration: Registration;
@@ -5,7 +5,7 @@ import type { Registration } from '../../utils/$Register';
5
5
  * Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available LLM tools
6
6
  *
7
7
  * @public exported from `@promptbook/anthropic-claude`
8
- * @public exported from `@promptbook/wizzard`
8
+ * @public exported from `@promptbook/wizard`
9
9
  * @public exported from `@promptbook/cli`
10
10
  *
11
11
  */
@@ -5,7 +5,7 @@ import type { Registration } from '../../utils/$Register';
5
5
  * Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available LLM tools
6
6
  *
7
7
  * @public exported from `@promptbook/core`
8
- * @public exported from `@promptbook/wizzard`
8
+ * @public exported from `@promptbook/wizard`
9
9
  * @public exported from `@promptbook/cli`
10
10
  */
11
11
  export declare const _AzureOpenAiMetadataRegistration: Registration;
@@ -5,7 +5,7 @@ import type { Registration } from '../../utils/$Register';
5
5
  * Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available LLM tools
6
6
  *
7
7
  * @public exported from `@promptbook/azure-openai`
8
- * @public exported from `@promptbook/wizzard`
8
+ * @public exported from `@promptbook/wizard`
9
9
  * @public exported from `@promptbook/cli`
10
10
  */
11
11
  export declare const _AzureOpenAiRegistration: Registration;
@@ -5,7 +5,7 @@ import type { Registration } from '../../utils/$Register';
5
5
  * Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available LLM tools
6
6
  *
7
7
  * @public exported from `@promptbook/core`
8
- * @public exported from `@promptbook/wizzard`
8
+ * @public exported from `@promptbook/wizard`
9
9
  * @public exported from `@promptbook/cli`
10
10
  */
11
11
  export declare const _DeepseekMetadataRegistration: Registration;
@@ -5,7 +5,7 @@ import type { Registration } from '../../utils/$Register';
5
5
  * Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available LLM tools
6
6
  *
7
7
  * @public exported from `@promptbook/deepseek`
8
- * @public exported from `@promptbook/wizzard`
8
+ * @public exported from `@promptbook/wizard`
9
9
  * @public exported from `@promptbook/cli`
10
10
  */
11
11
  export declare const _DeepseekRegistration: Registration;
@@ -5,7 +5,7 @@ import type { Registration } from '../../utils/$Register';
5
5
  * Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available LLM tools
6
6
  *
7
7
  * @public exported from `@promptbook/core`
8
- * @public exported from `@promptbook/wizzard`
8
+ * @public exported from `@promptbook/wizard`
9
9
  * @public exported from `@promptbook/cli`
10
10
  */
11
11
  export declare const _GoogleMetadataRegistration: Registration;
@@ -5,7 +5,7 @@ import type { Registration } from '../../utils/$Register';
5
5
  * Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available LLM tools
6
6
  *
7
7
  * @public exported from `@promptbook/google`
8
- * @public exported from `@promptbook/wizzard`
8
+ * @public exported from `@promptbook/wizard`
9
9
  * @public exported from `@promptbook/cli`
10
10
  */
11
11
  export declare const _GoogleRegistration: Registration;
@@ -5,7 +5,7 @@ import type { Registration } from '../../utils/$Register';
5
5
  * Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available LLM tools
6
6
  *
7
7
  * @public exported from `@promptbook/core`
8
- * @public exported from `@promptbook/wizzard`
8
+ * @public exported from `@promptbook/wizard`
9
9
  * @public exported from `@promptbook/cli`
10
10
  */
11
11
  export declare const _OllamaMetadataRegistration: Registration;
@@ -5,7 +5,7 @@ import type { Registration } from '../../utils/$Register';
5
5
  * Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available LLM tools
6
6
  *
7
7
  * @public exported from `@promptbook/ollama`
8
- * @public exported from `@promptbook/wizzard`
8
+ * @public exported from `@promptbook/wizard`
9
9
  * @public exported from `@promptbook/cli`
10
10
  */
11
11
  export declare const _OllamaRegistration: Registration;
@@ -29,7 +29,7 @@ export declare class OpenAiAssistantExecutionTools extends OpenAiExecutionTools
29
29
  callChatModel(prompt: Pick<Prompt, 'content' | 'parameters' | 'modelRequirements' | 'format'>): Promise<ChatPromptResult>;
30
30
  }
31
31
  /**
32
- * TODO: [🧠][🧙‍♂️] Maybe there can be some wizzard for thoose who want to use just OpenAI
32
+ * TODO: [🧠][🧙‍♂️] Maybe there can be some wizard for those who want to use just OpenAI
33
33
  * TODO: Maybe make custom OpenAiError
34
34
  * TODO: [🧠][🈁] Maybe use `isDeterministic` from options
35
35
  * TODO: [🧠][🌰] Allow to pass `title` for tracking purposes
@@ -1,12 +1,12 @@
1
1
  import type { ClientOptions } from 'openai';
2
2
  import type { string_token } from '../../types/typeAliases';
3
- import type { OpenAiExecutionToolsOptions } from './OpenAiExecutionToolsOptions';
3
+ import type { OpenAiCompatibleExecutionToolsOptions } from './OpenAiCompatibleExecutionToolsOptions';
4
4
  /**
5
5
  * Options for `createOpenAiAssistantExecutionTools` and `OpenAiAssistantExecutionTools`
6
6
  *
7
7
  * @public exported from `@promptbook/openai`
8
8
  */
9
- export type OpenAiAssistantExecutionToolsOptions = OpenAiExecutionToolsOptions & ClientOptions & {
9
+ export type OpenAiAssistantExecutionToolsOptions = OpenAiCompatibleExecutionToolsOptions & ClientOptions & {
10
10
  /**
11
11
  * Which assistant to use
12
12
  */
@@ -11,14 +11,14 @@ import type { string_markdown_text } from '../../types/typeAliases';
11
11
  import type { string_model_name } from '../../types/typeAliases';
12
12
  import type { string_title } from '../../types/typeAliases';
13
13
  import { computeOpenAiUsage } from './computeOpenAiUsage';
14
- import type { OpenAiExecutionToolsOptions } from './OpenAiExecutionToolsOptions';
14
+ import type { OpenAiCompatibleExecutionToolsNonProxiedOptions } from './OpenAiCompatibleExecutionToolsOptions';
15
15
  /**
16
- * Execution Tools for calling OpenAI API or other OpeenAI compatible provider
16
+ * Execution Tools for calling OpenAI API or other OpenAI compatible provider
17
17
  *
18
18
  * @public exported from `@promptbook/openai`
19
19
  */
20
20
  export declare abstract class OpenAiCompatibleExecutionTools implements LlmExecutionTools {
21
- protected readonly options: OpenAiExecutionToolsOptions;
21
+ protected readonly options: OpenAiCompatibleExecutionToolsNonProxiedOptions;
22
22
  /**
23
23
  * OpenAI API client.
24
24
  */
@@ -32,7 +32,7 @@ export declare abstract class OpenAiCompatibleExecutionTools implements LlmExecu
32
32
  *
33
33
  * @param options which are relevant are directly passed to the OpenAI compatible client
34
34
  */
35
- constructor(options: OpenAiExecutionToolsOptions);
35
+ constructor(options: OpenAiCompatibleExecutionToolsNonProxiedOptions);
36
36
  abstract get title(): string_title & string_markdown_text;
37
37
  abstract get description(): string_markdown;
38
38
  getClient(): Promise<OpenAI>;
@@ -0,0 +1,52 @@
1
+ import type { ClientOptions } from 'openai';
2
+ import type { CommonToolsOptions } from '../../execution/CommonToolsOptions';
3
+ import type { RemoteClientOptions } from '../../remote-server/types/RemoteClientOptions';
4
+ /**
5
+ * Options for `createOpenAiCompatibleExecutionTools` and `OpenAiCompatibleExecutionTools`
6
+ *
7
+ * This extends OpenAI's `ClientOptions` with are directly passed to the OpenAI client.
8
+ * Rest is used by the `OpenAiCompatibleExecutionTools`.
9
+ *
10
+ * @public exported from `@promptbook/openai`
11
+ */
12
+ export type OpenAiCompatibleExecutionToolsOptions = OpenAiCompatibleExecutionToolsNonProxiedOptions | OpenAiCompatibleExecutionToolsProxiedOptions;
13
+ /**
14
+ * Options for directly used `OpenAiCompatibleExecutionTools`
15
+ *
16
+ * This extends OpenAI's `ClientOptions` with are directly passed to the OpenAI client.
17
+ * @public exported from `@promptbook/openai`
18
+ */
19
+ export type OpenAiCompatibleExecutionToolsNonProxiedOptions = CommonToolsOptions & ClientOptions & {
20
+ /**
21
+ * Base URL for the OpenAI-compatible API endpoint
22
+ *
23
+ * This allows connecting to any OpenAI-compatible LLM service by specifying their API endpoint.
24
+ *
25
+ * @example 'https://https://promptbook.s5.ptbk.io/' (Promptbook)
26
+ * @example 'https://api.openai.com/v1' (OpenAI)
27
+ * @example 'http://localhost:11434/v1' (Ollama)
28
+ * @example 'https://api.deepseek.com/v1' (DeepSeek)
29
+ */
30
+ baseURL?: string;
31
+ isProxied?: false;
32
+ };
33
+ /**
34
+ * Options for proxied `OpenAiCompatibleExecutionTools`
35
+ *
36
+ * This extends OpenAI's `ClientOptions` with are directly passed to the OpenAI client.
37
+ * @public exported from `@promptbook/openai`
38
+ */
39
+ export type OpenAiCompatibleExecutionToolsProxiedOptions = CommonToolsOptions & ClientOptions & {
40
+ /**
41
+ * Base URL for the OpenAI-compatible API endpoint
42
+ *
43
+ * This allows connecting to any OpenAI-compatible LLM service by specifying their API endpoint.
44
+ *
45
+ * @example 'https://https://promptbook.s5.ptbk.io/' (Promptbook)
46
+ * @example 'https://api.openai.com/v1' (OpenAI)
47
+ * @example 'http://localhost:11434/v1' (Ollama)
48
+ * @example 'https://api.deepseek.com/v1' (DeepSeek)
49
+ */
50
+ baseURL?: string;
51
+ isProxied: true;
52
+ } & Pick<RemoteClientOptions<undefined>, 'remoteServerUrl'>;
@@ -1,11 +1,9 @@
1
- import type { ClientOptions } from 'openai';
2
- import type { CommonToolsOptions } from '../../execution/CommonToolsOptions';
1
+ import type { OpenAiCompatibleExecutionToolsOptions } from './OpenAiCompatibleExecutionToolsOptions';
3
2
  /**
4
3
  * Options for `createOpenAiExecutionTools` and `OpenAiExecutionTools`
5
4
  *
6
- * This extends OpenAI's `ClientOptions` with are directly passed to the OpenAI client.
7
- * Rest is used by the `OpenAiExecutionTools`.
5
+ * This extends OpenAiCompatibleExecutionToolsOptions.
8
6
  *
9
7
  * @public exported from `@promptbook/openai`
10
8
  */
11
- export type OpenAiExecutionToolsOptions = CommonToolsOptions & ClientOptions;
9
+ export type OpenAiExecutionToolsOptions = OpenAiCompatibleExecutionToolsOptions;