@promptbook/wizard 0.101.0-2 → 0.101.0-20

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 (76) hide show
  1. package/esm/index.es.js +329 -174
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/src/_packages/components.index.d.ts +20 -0
  4. package/esm/typings/src/_packages/core.index.d.ts +14 -0
  5. package/esm/typings/src/_packages/types.index.d.ts +14 -0
  6. package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +41 -3
  7. package/esm/typings/src/book-2.0/agent-source/AgentModelRequirements.d.ts +3 -0
  8. package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirements.d.ts +4 -22
  9. package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.d.ts +1 -26
  10. package/esm/typings/src/book-2.0/agent-source/parseParameters.d.ts +13 -0
  11. package/esm/typings/src/book-2.0/commitments/ACTION/ACTION.d.ts +8 -2
  12. package/esm/typings/src/book-2.0/commitments/DELETE/DELETE.d.ts +59 -0
  13. package/esm/typings/src/book-2.0/commitments/FORMAT/FORMAT.d.ts +8 -2
  14. package/esm/typings/src/book-2.0/commitments/GOAL/GOAL.d.ts +45 -0
  15. package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/KNOWLEDGE.d.ts +1 -1
  16. package/esm/typings/src/book-2.0/commitments/MEMORY/MEMORY.d.ts +46 -0
  17. package/esm/typings/src/book-2.0/commitments/MESSAGE/MESSAGE.d.ts +47 -0
  18. package/esm/typings/src/book-2.0/commitments/META/META.d.ts +62 -0
  19. package/esm/typings/src/book-2.0/commitments/MODEL/MODEL.d.ts +31 -4
  20. package/esm/typings/src/book-2.0/commitments/NOTE/NOTE.d.ts +20 -2
  21. package/esm/typings/src/book-2.0/commitments/PERSONA/PERSONA.d.ts +8 -2
  22. package/esm/typings/src/book-2.0/commitments/SCENARIO/SCENARIO.d.ts +46 -0
  23. package/esm/typings/src/book-2.0/commitments/STYLE/STYLE.d.ts +8 -2
  24. package/esm/typings/src/book-2.0/commitments/index.d.ts +7 -3
  25. package/esm/typings/src/book-2.0/utils/generatePlaceholderAgentProfileImageUrl.d.ts +3 -0
  26. package/esm/typings/src/book-components/AvatarProfile/AvatarChip/AvatarChip.d.ts +2 -2
  27. package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/MockedChat.d.ts +63 -0
  28. package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/index.d.ts +3 -0
  29. package/esm/typings/src/book-components/BookEditor/BookEditor.d.ts +15 -0
  30. package/esm/typings/src/book-components/BookEditor/BookEditorInner.d.ts +4 -0
  31. package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +26 -0
  32. package/esm/typings/src/book-components/Chat/LlmChat/LlmChatProps.d.ts +13 -0
  33. package/esm/typings/src/book-components/Chat/hooks/index.d.ts +2 -0
  34. package/esm/typings/src/book-components/Chat/hooks/useChatAutoScroll.d.ts +41 -0
  35. package/esm/typings/src/book-components/Chat/hooks/useSendMessageToLlmChat.d.ts +44 -0
  36. package/esm/typings/src/book-components/Chat/utils/parseMessageButtons.d.ts +22 -0
  37. package/esm/typings/src/book-components/icons/PauseIcon.d.ts +8 -0
  38. package/esm/typings/src/book-components/icons/PlayIcon.d.ts +8 -0
  39. package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +1 -2
  40. package/esm/typings/src/execution/createPipelineExecutor/getKnowledgeForTask.d.ts +1 -3
  41. package/esm/typings/src/formats/csv/CsvFormatError.d.ts +1 -1
  42. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsConfigurationFromEnv.d.ts +1 -1
  43. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForTestingAndScriptsAndPlayground.d.ts +1 -1
  44. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForWizardOrCli.d.ts +1 -2
  45. package/esm/typings/src/llm-providers/_common/register/createLlmToolsFromConfiguration.d.ts +8 -2
  46. package/esm/typings/src/llm-providers/_common/utils/removeUnsupportedModelRequirements.d.ts +25 -0
  47. package/esm/typings/src/llm-providers/_multiple/MultipleLlmExecutionTools.d.ts +5 -13
  48. package/esm/typings/src/llm-providers/_multiple/getSingleLlmExecutionTools.d.ts +11 -0
  49. package/esm/typings/src/llm-providers/_multiple/joinLlmExecutionTools.d.ts +2 -1
  50. package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +54 -0
  51. package/esm/typings/src/llm-providers/agent/createAgentLlmExecutionTools.d.ts +29 -0
  52. package/esm/typings/src/llm-providers/agent/playground/playground.d.ts +8 -0
  53. package/esm/typings/src/llm-providers/agent/register-configuration.d.ts +11 -0
  54. package/esm/typings/src/llm-providers/agent/register-constructor.d.ts +13 -0
  55. package/esm/typings/src/llm-providers/mocked/$fakeTextToExpectations.d.ts +1 -0
  56. package/esm/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +2 -5
  57. package/esm/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +2 -6
  58. package/esm/typings/src/llm-providers/openai/OpenAiCompatibleExecutionTools.d.ts +15 -8
  59. package/esm/typings/src/personas/preparePersona.d.ts +1 -0
  60. package/esm/typings/src/remote-server/openapi-types.d.ts +31 -31
  61. package/esm/typings/src/scrapers/markdown/MarkdownScraper.d.ts +1 -2
  62. package/esm/typings/src/types/ModelRequirements.d.ts +2 -4
  63. package/esm/typings/src/utils/color/utils/colorSaturation.d.ts +1 -1
  64. package/esm/typings/src/utils/editable/edit-pipeline-string/addPipelineCommand.d.ts +1 -1
  65. package/esm/typings/src/utils/markdown/humanizeAiText.d.ts +1 -0
  66. package/esm/typings/src/version.d.ts +1 -1
  67. package/package.json +2 -2
  68. package/umd/index.umd.js +329 -174
  69. package/umd/index.umd.js.map +1 -1
  70. package/esm/typings/src/book-2.0/utils/extractAgentMetadata.d.ts +0 -17
  71. package/esm/typings/src/book-2.0/utils/extractProfileImageFromSystemMessage.d.ts +0 -12
  72. package/esm/typings/src/llm-providers/mocked/test/joker.test.d.ts +0 -4
  73. package/esm/typings/src/llm-providers/mocked/test/mocked-chat.test.d.ts +0 -5
  74. package/esm/typings/src/llm-providers/mocked/test/mocked-completion.test.d.ts +0 -4
  75. package/esm/typings/src/scripting/_test/postprocessing.test.d.ts +0 -1
  76. /package/esm/typings/src/{cli/test/ptbk.test.d.ts → llm-providers/_common/utils/removeUnsupportedModelRequirements.test.d.ts} +0 -0
@@ -1,4 +1,4 @@
1
- import type { string_user_id } from '../../../types/typeAliases';
1
+ import type { string_markdown_text, string_mime_type_with_wildcard, string_user_id } from '../../../types/typeAliases';
2
2
  import { MultipleLlmExecutionTools } from '../../_multiple/MultipleLlmExecutionTools';
3
3
  import type { LlmToolsConfiguration } from './LlmToolsConfiguration';
4
4
  /**
@@ -7,12 +7,18 @@ import type { LlmToolsConfiguration } from './LlmToolsConfiguration';
7
7
  * @private internal type for `$provideLlmToolsFromEnv` and `$provideLlmToolsForTestingAndScriptsAndPlayground`
8
8
  */
9
9
  export type CreateLlmToolsFromConfigurationOptions = {
10
+ /**
11
+ * Title of the LLM tools
12
+ *
13
+ * @default 'LLM Tools from Configuration'
14
+ */
15
+ readonly title?: string_mime_type_with_wildcard & string_markdown_text;
10
16
  /**
11
17
  * This will will be passed to the created `LlmExecutionTools`
12
18
  *
13
19
  * @default false
14
20
  */
15
- isVerbose?: boolean;
21
+ readonly isVerbose?: boolean;
16
22
  /**
17
23
  * Identifier of the end user
18
24
  *
@@ -0,0 +1,25 @@
1
+ import type { ModelRequirements } from '../../../types/ModelRequirements';
2
+ /**
3
+ * Parses an OpenAI error message to identify which parameter is unsupported
4
+ *
5
+ * @param errorMessage The error message from OpenAI API
6
+ * @returns The parameter name that is unsupported, or null if not an unsupported parameter error
7
+ * @private utility of LLM Tools
8
+ */
9
+ export declare function parseUnsupportedParameterError(errorMessage: string): string | null;
10
+ /**
11
+ * Creates a copy of model requirements with the specified parameter removed
12
+ *
13
+ * @param modelRequirements Original model requirements
14
+ * @param unsupportedParameter The parameter to remove
15
+ * @returns New model requirements without the unsupported parameter
16
+ * @private utility of LLM Tools
17
+ */
18
+ export declare function removeUnsupportedModelRequirement(modelRequirements: ModelRequirements, unsupportedParameter: string): ModelRequirements;
19
+ /**
20
+ * Checks if an error is an "Unsupported value" error from OpenAI
21
+ * @param error The error to check
22
+ * @returns true if this is an unsupported parameter error
23
+ * @private utility of LLM Tools
24
+ */
25
+ export declare function isUnsupportedParameterError(error: Error): boolean;
@@ -1,16 +1,8 @@
1
1
  import type { AvailableModel } from '../../execution/AvailableModel';
2
2
  import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
3
- import type { ChatPromptResult } from '../../execution/PromptResult';
4
- import type { CompletionPromptResult } from '../../execution/PromptResult';
5
- import type { EmbeddingPromptResult } from '../../execution/PromptResult';
6
- import type { PromptResult } from '../../execution/PromptResult';
7
- import type { ChatPrompt } from '../../types/Prompt';
8
- import type { CompletionPrompt } from '../../types/Prompt';
9
- import type { EmbeddingPrompt } from '../../types/Prompt';
10
- import type { Prompt } from '../../types/Prompt';
11
- import type { string_markdown } from '../../types/typeAliases';
12
- import type { string_markdown_text } from '../../types/typeAliases';
13
- import type { string_title } from '../../types/typeAliases';
3
+ import type { ChatPromptResult, CompletionPromptResult, EmbeddingPromptResult, PromptResult } from '../../execution/PromptResult';
4
+ import type { ChatPrompt, CompletionPrompt, EmbeddingPrompt, Prompt } from '../../types/Prompt';
5
+ import type { string_markdown, string_markdown_text, string_title } from '../../types/typeAliases';
14
6
  /**
15
7
  * Multiple LLM Execution Tools is a proxy server that uses multiple execution tools internally and exposes the executor interface externally.
16
8
  *
@@ -18,6 +10,7 @@ import type { string_title } from '../../types/typeAliases';
18
10
  * @public exported from `@promptbook/core`
19
11
  */
20
12
  export declare class MultipleLlmExecutionTools implements LlmExecutionTools {
13
+ readonly title: string_title & string_markdown_text;
21
14
  /**
22
15
  * Array of execution tools in order of priority
23
16
  */
@@ -25,8 +18,7 @@ export declare class MultipleLlmExecutionTools implements LlmExecutionTools {
25
18
  /**
26
19
  * Gets array of execution tools in order of priority
27
20
  */
28
- constructor(...llmExecutionTools: ReadonlyArray<LlmExecutionTools>);
29
- get title(): string_title & string_markdown_text;
21
+ constructor(title: string_title & string_markdown_text, ...llmExecutionTools: ReadonlyArray<LlmExecutionTools>);
30
22
  get description(): string_markdown;
31
23
  get profile(): {
32
24
  name: string;
@@ -0,0 +1,11 @@
1
+ import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
2
+ import { MultipleLlmExecutionTools } from './MultipleLlmExecutionTools';
3
+ /**
4
+ * Just returns the given `LlmExecutionTools` or joins multiple into one
5
+ *
6
+ * @public exported from `@promptbook/core`
7
+ */
8
+ export declare function getSingleLlmExecutionTools(oneOrMoreLlmExecutionTools: undefined | LlmExecutionTools | ReadonlyArray<LlmExecutionTools>): LlmExecutionTools | MultipleLlmExecutionTools;
9
+ /**
10
+ * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
11
+ */
@@ -1,4 +1,5 @@
1
1
  import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
2
+ import { string_markdown_text, string_title } from '../../types/typeAliases';
2
3
  import { MultipleLlmExecutionTools } from './MultipleLlmExecutionTools';
3
4
  /**
4
5
  * Joins multiple LLM Execution Tools into one
@@ -15,7 +16,7 @@ import { MultipleLlmExecutionTools } from './MultipleLlmExecutionTools';
15
16
  *
16
17
  * @public exported from `@promptbook/core`
17
18
  */
18
- export declare function joinLlmExecutionTools(...llmExecutionTools: ReadonlyArray<LlmExecutionTools>): MultipleLlmExecutionTools;
19
+ export declare function joinLlmExecutionTools(title: string_title & string_markdown_text, ...llmExecutionTools: ReadonlyArray<LlmExecutionTools>): MultipleLlmExecutionTools;
19
20
  /**
20
21
  * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
21
22
  */
@@ -0,0 +1,54 @@
1
+ import type { Promisable } from 'type-fest';
2
+ import type { string_book } from '../../book-2.0/agent-source/string_book';
3
+ import type { ChatParticipant } from '../../book-components/Chat/types/ChatParticipant';
4
+ import type { AvailableModel } from '../../execution/AvailableModel';
5
+ import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
6
+ import type { ChatPromptResult } from '../../execution/PromptResult';
7
+ import type { Prompt } from '../../types/Prompt';
8
+ import type { string_markdown, string_markdown_text, string_title } from '../../types/typeAliases';
9
+ /**
10
+ * Execution Tools for calling LLM models with a predefined agent "soul"
11
+ * This wraps underlying LLM execution tools and applies agent-specific system prompts and requirements
12
+ *
13
+ * @public exported from `@promptbook/core`
14
+ */
15
+ export declare class AgentLlmExecutionTools implements LlmExecutionTools {
16
+ private readonly llmTools;
17
+ private readonly agentSource;
18
+ /**
19
+ * Cached model requirements to avoid re-parsing the agent source
20
+ */
21
+ private _cachedModelRequirements;
22
+ /**
23
+ * Cached parsed agent information
24
+ */
25
+ private _cachedAgentInfo;
26
+ /**
27
+ * Creates new AgentLlmExecutionTools
28
+ *
29
+ * @param llmTools The underlying LLM execution tools to wrap
30
+ * @param agentSource The agent source string that defines the agent's behavior
31
+ */
32
+ constructor(llmTools: LlmExecutionTools, agentSource: string_book);
33
+ /**
34
+ * Get cached or parse agent information
35
+ */
36
+ private getAgentInfo;
37
+ /**
38
+ * Get cached or create agent model requirements
39
+ */
40
+ private getAgentModelRequirements;
41
+ get title(): string_title & string_markdown_text;
42
+ get description(): string_markdown;
43
+ get profile(): ChatParticipant | undefined;
44
+ checkConfiguration(): Promisable<void>;
45
+ listModels(): Promisable<ReadonlyArray<AvailableModel>>;
46
+ /**
47
+ * Calls the chat model with agent-specific system prompt and requirements
48
+ */
49
+ callChatModel(prompt: Prompt): Promise<ChatPromptResult>;
50
+ }
51
+ /**
52
+ * TODO: [🍚] Implement Destroyable pattern to free resources
53
+ * TODO: !!!! adding parameter substitution support
54
+ */
@@ -0,0 +1,29 @@
1
+ import type { string_book } from '../../book-2.0/agent-source/string_book';
2
+ import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
3
+ import { AgentLlmExecutionTools } from './AgentLlmExecutionTools';
4
+ /**
5
+ * Options for creating AgentLlmExecutionTools
6
+ */
7
+ export type CreateAgentLlmExecutionToolsOptions = {
8
+ /**
9
+ * The underlying LLM execution tools to wrap
10
+ */
11
+ llmTools: LlmExecutionTools;
12
+ /**
13
+ * The agent source string that defines the agent's behavior
14
+ */
15
+ agentSource: string_book;
16
+ };
17
+ /**
18
+ * Creates new AgentLlmExecutionTools that wrap underlying LLM tools with agent-specific behavior
19
+ *
20
+ * @public exported from `@promptbook/core`
21
+ */
22
+ export declare const createAgentLlmExecutionTools: ((options: CreateAgentLlmExecutionToolsOptions) => AgentLlmExecutionTools) & {
23
+ packageName: string;
24
+ className: string;
25
+ };
26
+ /**
27
+ * TODO: [🧠] Consider adding validation for agent source format
28
+ * TODO: [🧠] Consider adding options for caching behavior
29
+ */
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ts-node
2
+ export {};
3
+ /**
4
+ * TODO: [🧠] Add more complex agent scenarios
5
+ * TODO: [🧠] Add parameter substitution demo
6
+ * TODO: [🧠] Add multi-turn conversation demo
7
+ * Note: [⚫] Code in this file should never be published in any package
8
+ */
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Metadata for Agent LLM execution tools
3
+ *
4
+ * @public exported from `@promptbook/core`
5
+ */
6
+ export declare const _AgentMetadata: import("../../utils/$Register").Registration;
7
+ /**
8
+ * TODO: [🧠] Consider adding a special trust level for AgentLlmExecutionTools
9
+ * TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
10
+ * Note: [💞] Ignore a discrepancy between file name and entity name
11
+ */
@@ -0,0 +1,13 @@
1
+ import type { Registration } from '../../utils/$Register';
2
+ /**
3
+ * Registration of Agent LLM provider
4
+ *
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
+ *
7
+ * @public exported from `@promptbook/core`
8
+ */
9
+ export declare const _AgentRegistration: Registration;
10
+ /**
11
+ * TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
12
+ * Note: [💞] Ignore a discrepancy between file name and entity name
13
+ */
@@ -11,5 +11,6 @@ import type { string_postprocessing_function_name } from '../../types/typeAliase
11
11
  */
12
12
  export declare function $fakeTextToExpectations(expectations: Expectations, postprocessingFunctionNames?: ReadonlyArray<string_postprocessing_function_name>): Promise<string>;
13
13
  /**
14
+ * TODO: Do not use LoremIpsum, but use some faked text that looks more human-promptbook-like
14
15
  * TODO: [💝] Unite object for expecting amount and format - use here also a format
15
16
  */
@@ -1,12 +1,9 @@
1
1
  import type { AvailableModel } from '../../execution/AvailableModel';
2
2
  import type { CommonToolsOptions } from '../../execution/CommonToolsOptions';
3
3
  import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
4
- import type { ChatPromptResult } from '../../execution/PromptResult';
5
- import type { CompletionPromptResult } from '../../execution/PromptResult';
4
+ import type { ChatPromptResult, CompletionPromptResult } from '../../execution/PromptResult';
6
5
  import type { Prompt } from '../../types/Prompt';
7
- import type { string_markdown } from '../../types/typeAliases';
8
- import type { string_markdown_text } from '../../types/typeAliases';
9
- import type { string_title } from '../../types/typeAliases';
6
+ import type { string_markdown, string_markdown_text, string_title } from '../../types/typeAliases';
10
7
  /**
11
8
  * Mocked execution Tools for just echoing the requests for testing purposes.
12
9
  *
@@ -1,13 +1,9 @@
1
1
  import type { AvailableModel } from '../../execution/AvailableModel';
2
2
  import type { CommonToolsOptions } from '../../execution/CommonToolsOptions';
3
3
  import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
4
- import type { ChatPromptResult } from '../../execution/PromptResult';
5
- import type { CompletionPromptResult } from '../../execution/PromptResult';
6
- import type { EmbeddingPromptResult } from '../../execution/PromptResult';
4
+ import type { ChatPromptResult, CompletionPromptResult, EmbeddingPromptResult } from '../../execution/PromptResult';
7
5
  import type { Prompt } from '../../types/Prompt';
8
- import type { string_markdown } from '../../types/typeAliases';
9
- import type { string_markdown_text } from '../../types/typeAliases';
10
- import type { string_title } from '../../types/typeAliases';
6
+ import type { string_markdown, string_markdown_text, string_title } from '../../types/typeAliases';
11
7
  /**
12
8
  * Mocked execution Tools for just faking expected responses for testing purposes
13
9
  *
@@ -1,15 +1,10 @@
1
1
  import OpenAI from 'openai';
2
2
  import type { AvailableModel } from '../../execution/AvailableModel';
3
3
  import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
4
- import type { ChatPromptResult } from '../../execution/PromptResult';
5
- import type { CompletionPromptResult } from '../../execution/PromptResult';
6
- import type { EmbeddingPromptResult } from '../../execution/PromptResult';
4
+ import type { ChatPromptResult, CompletionPromptResult, EmbeddingPromptResult } from '../../execution/PromptResult';
7
5
  import type { Usage } from '../../execution/Usage';
8
6
  import type { Prompt } from '../../types/Prompt';
9
- import type { string_markdown } from '../../types/typeAliases';
10
- import type { string_markdown_text } from '../../types/typeAliases';
11
- import type { string_model_name } from '../../types/typeAliases';
12
- import type { string_title } from '../../types/typeAliases';
7
+ import type { string_markdown, string_markdown_text, string_model_name, string_title } from '../../types/typeAliases';
13
8
  import { computeOpenAiUsage } from './computeOpenAiUsage';
14
9
  import type { OpenAiCompatibleExecutionToolsNonProxiedOptions } from './OpenAiCompatibleExecutionToolsOptions';
15
10
  /**
@@ -27,6 +22,10 @@ export declare abstract class OpenAiCompatibleExecutionTools implements LlmExecu
27
22
  * Rate limiter instance
28
23
  */
29
24
  private limiter;
25
+ /**
26
+ * Tracks models and parameters that have already been retried to prevent infinite loops
27
+ */
28
+ private retriedUnsupportedParameters;
30
29
  /**
31
30
  * Creates OpenAI compatible Execution Tools.
32
31
  *
@@ -48,10 +47,18 @@ export declare abstract class OpenAiCompatibleExecutionTools implements LlmExecu
48
47
  * Calls OpenAI compatible API to use a chat model.
49
48
  */
50
49
  callChatModel(prompt: Pick<Prompt, 'content' | 'parameters' | 'modelRequirements' | 'format'>): Promise<ChatPromptResult>;
50
+ /**
51
+ * Internal method that handles parameter retry for chat model calls
52
+ */
53
+ private callChatModelWithRetry;
51
54
  /**
52
55
  * Calls OpenAI API to use a complete model.
53
56
  */
54
57
  callCompletionModel(prompt: Pick<Prompt, 'content' | 'parameters' | 'modelRequirements'>): Promise<CompletionPromptResult>;
58
+ /**
59
+ * Internal method that handles parameter retry for completion model calls
60
+ */
61
+ private callCompletionModelWithRetry;
55
62
  /**
56
63
  * Calls OpenAI compatible API to use a embedding model
57
64
  */
@@ -85,7 +92,7 @@ export declare abstract class OpenAiCompatibleExecutionTools implements LlmExecu
85
92
  /**
86
93
  * Makes a request with retry logic for network errors like ECONNRESET
87
94
  */
88
- private makeRequestWithRetry;
95
+ private makeRequestWithNetworkRetry;
89
96
  /**
90
97
  * Determines if an error is retryable (network-related errors)
91
98
  */
@@ -10,6 +10,7 @@ import type { string_persona_description } from '../types/typeAliases';
10
10
  */
11
11
  export declare function preparePersona(personaDescription: string_persona_description, tools: Pick<ExecutionTools, 'llm'>, options: PrepareAndScrapeOptions): Promise<Pick<PersonaPreparedJson, 'modelsRequirements'>>;
12
12
  /**
13
+ * TODO: [😩] DRY `preparePersona` and `selectBestModelFromAvailable`
13
14
  * TODO: [🔃][main] If the persona was prepared with different version or different set of models, prepare it once again
14
15
  * TODO: [🏢] Check validity of `modelName` in pipeline
15
16
  * TODO: [🏢] Check validity of `systemMessage` in pipeline
@@ -3,7 +3,7 @@
3
3
  * Do not make direct changes to the file.
4
4
  */
5
5
  export type paths = {
6
- readonly "/": {
6
+ readonly '/': {
7
7
  readonly parameters: {
8
8
  readonly query?: never;
9
9
  readonly header?: never;
@@ -29,7 +29,7 @@ export type paths = {
29
29
  readonly [name: string]: unknown;
30
30
  };
31
31
  content: {
32
- readonly "text/markdown": string;
32
+ readonly 'text/markdown': string;
33
33
  };
34
34
  };
35
35
  };
@@ -42,7 +42,7 @@ export type paths = {
42
42
  readonly patch?: never;
43
43
  readonly trace?: never;
44
44
  };
45
- readonly "/login": {
45
+ readonly '/login': {
46
46
  readonly parameters: {
47
47
  readonly query?: never;
48
48
  readonly header?: never;
@@ -64,7 +64,7 @@ export type paths = {
64
64
  };
65
65
  readonly requestBody: {
66
66
  readonly content: {
67
- readonly "application/json": {
67
+ readonly 'application/json': {
68
68
  readonly username?: string;
69
69
  readonly password?: string;
70
70
  readonly appId?: string;
@@ -78,7 +78,7 @@ export type paths = {
78
78
  readonly [name: string]: unknown;
79
79
  };
80
80
  content: {
81
- readonly "application/json": {
81
+ readonly 'application/json': {
82
82
  readonly isSuccess?: boolean;
83
83
  readonly message?: string;
84
84
  readonly error?: Record<string, never>;
@@ -92,7 +92,7 @@ export type paths = {
92
92
  readonly [name: string]: unknown;
93
93
  };
94
94
  content: {
95
- readonly "application/json": {
95
+ readonly 'application/json': {
96
96
  readonly error?: Record<string, never>;
97
97
  };
98
98
  };
@@ -103,7 +103,7 @@ export type paths = {
103
103
  readonly [name: string]: unknown;
104
104
  };
105
105
  content: {
106
- readonly "application/json": {
106
+ readonly 'application/json': {
107
107
  /** @enum {boolean} */
108
108
  readonly isSuccess?: false;
109
109
  readonly message?: string;
@@ -119,7 +119,7 @@ export type paths = {
119
119
  readonly patch?: never;
120
120
  readonly trace?: never;
121
121
  };
122
- readonly "/books": {
122
+ readonly '/books': {
123
123
  readonly parameters: {
124
124
  readonly query?: never;
125
125
  readonly header?: never;
@@ -145,7 +145,7 @@ export type paths = {
145
145
  readonly [name: string]: unknown;
146
146
  };
147
147
  content: {
148
- readonly "application/json": readonly string[];
148
+ readonly 'application/json': readonly string[];
149
149
  };
150
150
  };
151
151
  /** @description No collection available */
@@ -154,7 +154,7 @@ export type paths = {
154
154
  readonly [name: string]: unknown;
155
155
  };
156
156
  content: {
157
- readonly "text/plain": string;
157
+ readonly 'text/plain': string;
158
158
  };
159
159
  };
160
160
  };
@@ -167,7 +167,7 @@ export type paths = {
167
167
  readonly patch?: never;
168
168
  readonly trace?: never;
169
169
  };
170
- readonly "/books/{bookId}": {
170
+ readonly '/books/{bookId}': {
171
171
  readonly parameters: {
172
172
  readonly query?: never;
173
173
  readonly header?: never;
@@ -196,7 +196,7 @@ export type paths = {
196
196
  readonly [name: string]: unknown;
197
197
  };
198
198
  content: {
199
- readonly "text/markdown": string;
199
+ readonly 'text/markdown': string;
200
200
  };
201
201
  };
202
202
  /** @description Book not found. */
@@ -205,7 +205,7 @@ export type paths = {
205
205
  readonly [name: string]: unknown;
206
206
  };
207
207
  content: {
208
- readonly "application/json": {
208
+ readonly 'application/json': {
209
209
  readonly error?: Record<string, never>;
210
210
  };
211
211
  };
@@ -216,7 +216,7 @@ export type paths = {
216
216
  readonly [name: string]: unknown;
217
217
  };
218
218
  content: {
219
- readonly "text/plain": string;
219
+ readonly 'text/plain': string;
220
220
  };
221
221
  };
222
222
  };
@@ -229,7 +229,7 @@ export type paths = {
229
229
  readonly patch?: never;
230
230
  readonly trace?: never;
231
231
  };
232
- readonly "/executions": {
232
+ readonly '/executions': {
233
233
  readonly parameters: {
234
234
  readonly query?: never;
235
235
  readonly header?: never;
@@ -255,7 +255,7 @@ export type paths = {
255
255
  readonly [name: string]: unknown;
256
256
  };
257
257
  content: {
258
- readonly "application/json": readonly {
258
+ readonly 'application/json': readonly {
259
259
  readonly nonce?: string;
260
260
  readonly taskId?: string;
261
261
  readonly taskType?: string;
@@ -277,7 +277,7 @@ export type paths = {
277
277
  readonly patch?: never;
278
278
  readonly trace?: never;
279
279
  };
280
- readonly "/executions/last": {
280
+ readonly '/executions/last': {
281
281
  readonly parameters: {
282
282
  readonly query?: never;
283
283
  readonly header?: never;
@@ -303,7 +303,7 @@ export type paths = {
303
303
  readonly [name: string]: unknown;
304
304
  };
305
305
  content: {
306
- readonly "application/json": {
306
+ readonly 'application/json': {
307
307
  readonly nonce?: string;
308
308
  readonly taskId?: string;
309
309
  readonly taskType?: string;
@@ -324,7 +324,7 @@ export type paths = {
324
324
  readonly [name: string]: unknown;
325
325
  };
326
326
  content: {
327
- readonly "text/plain": string;
327
+ readonly 'text/plain': string;
328
328
  };
329
329
  };
330
330
  };
@@ -337,7 +337,7 @@ export type paths = {
337
337
  readonly patch?: never;
338
338
  readonly trace?: never;
339
339
  };
340
- readonly "/executions/{taskId}": {
340
+ readonly '/executions/{taskId}': {
341
341
  readonly parameters: {
342
342
  readonly query?: never;
343
343
  readonly header?: never;
@@ -366,7 +366,7 @@ export type paths = {
366
366
  readonly [name: string]: unknown;
367
367
  };
368
368
  content: {
369
- readonly "application/json": {
369
+ readonly 'application/json': {
370
370
  readonly nonce?: string;
371
371
  readonly taskId?: string;
372
372
  readonly taskType?: string;
@@ -387,7 +387,7 @@ export type paths = {
387
387
  readonly [name: string]: unknown;
388
388
  };
389
389
  content: {
390
- readonly "text/plain": string;
390
+ readonly 'text/plain': string;
391
391
  };
392
392
  };
393
393
  };
@@ -400,7 +400,7 @@ export type paths = {
400
400
  readonly patch?: never;
401
401
  readonly trace?: never;
402
402
  };
403
- readonly "/executions/new": {
403
+ readonly '/executions/new': {
404
404
  readonly parameters: {
405
405
  readonly query?: never;
406
406
  readonly header?: never;
@@ -422,7 +422,7 @@ export type paths = {
422
422
  };
423
423
  readonly requestBody: {
424
424
  readonly content: {
425
- readonly "application/json": {
425
+ readonly 'application/json': {
426
426
  /** @description URL of the pipeline to execute */
427
427
  readonly pipelineUrl?: string;
428
428
  /** @description Alternative field for pipelineUrl */
@@ -441,7 +441,7 @@ export type paths = {
441
441
  readonly [name: string]: unknown;
442
442
  };
443
443
  content: {
444
- readonly "application/json": Record<string, never>;
444
+ readonly 'application/json': Record<string, never>;
445
445
  };
446
446
  };
447
447
  /** @description Invalid input. */
@@ -450,7 +450,7 @@ export type paths = {
450
450
  readonly [name: string]: unknown;
451
451
  };
452
452
  content: {
453
- readonly "application/json": {
453
+ readonly 'application/json': {
454
454
  readonly error?: Record<string, never>;
455
455
  };
456
456
  };
@@ -461,7 +461,7 @@ export type paths = {
461
461
  readonly [name: string]: unknown;
462
462
  };
463
463
  content: {
464
- readonly "text/plain": string;
464
+ readonly 'text/plain': string;
465
465
  };
466
466
  };
467
467
  };
@@ -472,7 +472,7 @@ export type paths = {
472
472
  readonly patch?: never;
473
473
  readonly trace?: never;
474
474
  };
475
- readonly "/api-docs": {
475
+ readonly '/api-docs': {
476
476
  readonly parameters: {
477
477
  readonly query?: never;
478
478
  readonly header?: never;
@@ -509,7 +509,7 @@ export type paths = {
509
509
  readonly patch?: never;
510
510
  readonly trace?: never;
511
511
  };
512
- readonly "/swagger": {
512
+ readonly '/swagger': {
513
513
  readonly parameters: {
514
514
  readonly query?: never;
515
515
  readonly header?: never;
@@ -546,7 +546,7 @@ export type paths = {
546
546
  readonly patch?: never;
547
547
  readonly trace?: never;
548
548
  };
549
- readonly "/openapi": {
549
+ readonly '/openapi': {
550
550
  readonly parameters: {
551
551
  readonly query?: never;
552
552
  readonly header?: never;
@@ -572,7 +572,7 @@ export type paths = {
572
572
  readonly [name: string]: unknown;
573
573
  };
574
574
  content: {
575
- readonly "application/json": Record<string, never>;
575
+ readonly 'application/json': Record<string, never>;
576
576
  };
577
577
  };
578
578
  };
@@ -1,6 +1,5 @@
1
1
  import type { KnowledgePiecePreparedJson } from '../../pipeline/PipelineJson/KnowledgePieceJson';
2
- import type { Scraper } from '../_common/Scraper';
3
- import type { ScraperSourceHandler } from '../_common/Scraper';
2
+ import type { Scraper, ScraperSourceHandler } from '../_common/Scraper';
4
3
  import type { ExecutionTools } from '../../execution/ExecutionTools';
5
4
  import type { PrepareAndScrapeOptions } from '../../prepare/PrepareAndScrapeOptions';
6
5
  import type { ScraperAndConverterMetadata } from '../_common/register/ScraperAndConverterMetadata';
@@ -1,8 +1,5 @@
1
1
  import type { ModelVariant } from './ModelVariant';
2
- import type { number_model_temperature } from './typeAliases';
3
- import type { number_seed } from './typeAliases';
4
- import type { string_model_name } from './typeAliases';
5
- import type { string_system_message } from './typeAliases';
2
+ import type { number_model_temperature, number_seed, string_model_name, string_system_message } from './typeAliases';
6
3
  /**
7
4
  * Abstract way to specify the LLM.
8
5
  * It does not specify the LLM with concrete version itself, only the requirements for the LLM.
@@ -99,4 +96,5 @@ export type CommonModelRequirements = {
99
96
  * TODO: Add here more requirement options like max context size, max tokens, etc.
100
97
  * TODO: [💕][🧠] Just selecting gpt3 or gpt4 level of model
101
98
  * TODO: [🧄] Replace all "github.com/webgptorg/promptbook#xxx" with "ptbk.io/xxx"
99
+ * TODO: [🐤] DRY `AgentModelRequirements` and `ModelRequirements`
102
100
  */
@@ -1,4 +1,4 @@
1
- import { Color } from "../Color";
1
+ import { Color } from '../Color';
2
2
  /**
3
3
  * Calculates saturation of the color
4
4
  *