@promptbook/wizard 0.101.0-9 → 0.101.0
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.
- package/README.md +0 -4
- package/esm/index.es.js +423 -250
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/components.index.d.ts +14 -0
- package/esm/typings/src/_packages/core.index.d.ts +12 -0
- package/esm/typings/src/_packages/types.index.d.ts +8 -0
- package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +11 -4
- package/esm/typings/src/book-2.0/agent-source/AgentModelRequirements.d.ts +3 -0
- package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirements.d.ts +4 -22
- package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.d.ts +1 -26
- package/esm/typings/src/book-2.0/commitments/ACTION/ACTION.d.ts +0 -12
- package/esm/typings/src/book-2.0/commitments/DELETE/DELETE.d.ts +0 -24
- package/esm/typings/src/book-2.0/commitments/FORMAT/FORMAT.d.ts +0 -12
- package/esm/typings/src/book-2.0/commitments/GOAL/GOAL.d.ts +0 -12
- package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/KNOWLEDGE.d.ts +0 -6
- package/esm/typings/src/book-2.0/commitments/MEMORY/MEMORY.d.ts +0 -12
- package/esm/typings/src/book-2.0/commitments/MESSAGE/MESSAGE.d.ts +0 -12
- package/esm/typings/src/book-2.0/commitments/META/META.d.ts +0 -6
- package/esm/typings/src/book-2.0/commitments/META_IMAGE/META_IMAGE.d.ts +0 -6
- package/esm/typings/src/book-2.0/commitments/META_LINK/META_LINK.d.ts +0 -6
- package/esm/typings/src/book-2.0/commitments/MODEL/MODEL.d.ts +23 -14
- package/esm/typings/src/book-2.0/commitments/NOTE/NOTE.d.ts +2 -14
- package/esm/typings/src/book-2.0/commitments/PERSONA/PERSONA.d.ts +0 -12
- package/esm/typings/src/book-2.0/commitments/RULE/RULE.d.ts +0 -12
- package/esm/typings/src/book-2.0/commitments/SAMPLE/SAMPLE.d.ts +0 -12
- package/esm/typings/src/book-2.0/commitments/SCENARIO/SCENARIO.d.ts +0 -12
- package/esm/typings/src/book-2.0/commitments/STYLE/STYLE.d.ts +0 -12
- package/esm/typings/src/book-2.0/commitments/_base/createEmptyAgentModelRequirements.d.ts +1 -1
- package/esm/typings/src/book-2.0/commitments/index.d.ts +1 -1
- package/esm/typings/src/book-2.0/utils/generatePlaceholderAgentProfileImageUrl.d.ts +3 -0
- package/esm/typings/src/book-components/AvatarProfile/AvatarChip/AvatarChip.d.ts +5 -2
- package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/AvatarProfile.d.ts +3 -0
- package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/MockedChat.d.ts +18 -1
- package/esm/typings/src/book-components/BookEditor/BookEditor.d.ts +8 -0
- package/esm/typings/src/book-components/BookEditor/BookEditorInner.d.ts +2 -15
- package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +9 -0
- package/esm/typings/src/book-components/Chat/LlmChat/LlmChatProps.d.ts +13 -0
- package/esm/typings/src/book-components/Chat/hooks/index.d.ts +2 -0
- package/esm/typings/src/book-components/Chat/hooks/useChatAutoScroll.d.ts +41 -0
- package/esm/typings/src/book-components/Chat/hooks/useSendMessageToLlmChat.d.ts +44 -0
- package/esm/typings/src/book-components/Chat/utils/parseMessageButtons.d.ts +22 -0
- package/esm/typings/src/book-components/icons/PauseIcon.d.ts +8 -0
- package/esm/typings/src/book-components/icons/PlayIcon.d.ts +8 -0
- package/esm/typings/src/execution/PromptResult.d.ts +2 -4
- package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +1 -2
- package/esm/typings/src/execution/createPipelineExecutor/getKnowledgeForTask.d.ts +1 -3
- package/esm/typings/src/formats/csv/CsvFormatError.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsConfigurationFromEnv.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForTestingAndScriptsAndPlayground.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForWizardOrCli.d.ts +1 -2
- package/esm/typings/src/llm-providers/_common/register/createLlmToolsFromConfiguration.d.ts +8 -2
- package/esm/typings/src/llm-providers/_common/utils/removeUnsupportedModelRequirements.d.ts +25 -0
- package/esm/typings/src/llm-providers/_multiple/MultipleLlmExecutionTools.d.ts +7 -18
- package/esm/typings/src/llm-providers/_multiple/getSingleLlmExecutionTools.d.ts +11 -0
- package/esm/typings/src/llm-providers/_multiple/joinLlmExecutionTools.d.ts +2 -1
- package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +58 -0
- package/esm/typings/src/llm-providers/agent/createAgentLlmExecutionTools.d.ts +29 -0
- package/esm/typings/src/llm-providers/agent/playground/playground.d.ts +8 -0
- package/esm/typings/src/llm-providers/agent/register-configuration.d.ts +11 -0
- package/esm/typings/src/llm-providers/agent/register-constructor.d.ts +13 -0
- package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +3 -8
- package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +4 -5
- package/esm/typings/src/llm-providers/mocked/$fakeTextToExpectations.d.ts +1 -0
- package/esm/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +4 -10
- package/esm/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +4 -6
- package/esm/typings/src/llm-providers/ollama/OllamaExecutionTools.d.ts +3 -3
- package/esm/typings/src/llm-providers/openai/OpenAiCompatibleExecutionTools.d.ts +16 -8
- package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +3 -8
- package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +5 -14
- package/esm/typings/src/personas/preparePersona.d.ts +1 -0
- package/esm/typings/src/remote-server/openapi-types.d.ts +31 -31
- package/esm/typings/src/scrapers/markdown/MarkdownScraper.d.ts +1 -2
- package/esm/typings/src/types/ModelRequirements.d.ts +2 -4
- package/esm/typings/src/utils/color/utils/colorSaturation.d.ts +1 -1
- package/esm/typings/src/utils/editable/edit-pipeline-string/addPipelineCommand.d.ts +1 -1
- package/esm/typings/src/utils/markdown/humanizeAiText.d.ts +0 -1
- package/esm/typings/src/utils/markdown/promptbookifyAiText.d.ts +2 -2
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +423 -250
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/book-2.0/utils/extractAgentMetadata.d.ts +0 -17
- package/esm/typings/src/book-2.0/utils/extractProfileImageFromSystemMessage.d.ts +0 -12
- package/esm/typings/src/book-components/Chat/examples/ChatMarkdownDemo.d.ts +0 -16
- package/esm/typings/src/expectations/drafts/isDomainNameFree.d.ts +0 -10
- package/esm/typings/src/expectations/drafts/isGithubNameFree.d.ts +0 -10
- package/esm/typings/src/llm-providers/_common/profiles/llmProviderProfiles.d.ts +0 -81
- /package/esm/typings/src/llm-providers/_common/{profiles/test/llmProviderProfiles.test.d.ts → utils/removeUnsupportedModelRequirements.test.d.ts} +0 -0
@@ -9,7 +9,7 @@ export type AvatarChipProps = {
|
|
9
9
|
/**
|
10
10
|
* Avatar to be shown
|
11
11
|
*/
|
12
|
-
readonly avatarBasicInformation: AgentBasicInformation
|
12
|
+
readonly avatarBasicInformation: Omit<AgentBasicInformation, 'parameters'>;
|
13
13
|
/**
|
14
14
|
* Whether this chip is a template avatar
|
15
15
|
*/
|
@@ -21,7 +21,7 @@ export type AvatarChipProps = {
|
|
21
21
|
/**
|
22
22
|
* Called when chip is clicked
|
23
23
|
*/
|
24
|
-
readonly onSelect?: (avatar: AgentBasicInformation) => void;
|
24
|
+
readonly onSelect?: (avatar: Omit<AgentBasicInformation, 'parameters'>) => void;
|
25
25
|
/**
|
26
26
|
* Whether this chip is selected
|
27
27
|
*/
|
@@ -33,3 +33,6 @@ export type AvatarChipProps = {
|
|
33
33
|
* @public exported from `@promptbook/components`
|
34
34
|
*/
|
35
35
|
export declare function AvatarChip(props: AvatarChipProps): import("react/jsx-runtime").JSX.Element;
|
36
|
+
/**
|
37
|
+
* TODO: [☁️] Export component prop types only to `@promptbook/components` (not `@promptbook/types`)
|
38
|
+
*/
|
@@ -21,3 +21,6 @@ export type AvatarProfileProps = {
|
|
21
21
|
* @public exported from `@promptbook/components`
|
22
22
|
*/
|
23
23
|
export declare function AvatarProfile(props: AvatarProfileProps): import("react/jsx-runtime").JSX.Element;
|
24
|
+
/**
|
25
|
+
* TODO: [☁️] Export component prop types only to `@promptbook/components` (not `@promptbook/types`)
|
26
|
+
*/
|
@@ -31,11 +31,28 @@ export type MockedChatDelayConfig = {
|
|
31
31
|
*
|
32
32
|
* @public exported from `@promptbook/components`
|
33
33
|
*/
|
34
|
-
export type MockedChatProps = ChatProps & {
|
34
|
+
export type MockedChatProps = Omit<ChatProps, 'onReset' | /*'onMessage' | */ 'onUseTemplate' | 'isVoiceRecognitionButtonShown'> & {
|
35
|
+
/**
|
36
|
+
* Whether the chat can be reset via the "New chat" button.
|
37
|
+
*
|
38
|
+
* When true (default), the reset button is shown and clicking it restarts the simulated flow.
|
39
|
+
* When false, the reset button is hidden (read-only simulation without manual restart).
|
40
|
+
*
|
41
|
+
* @default true
|
42
|
+
*/
|
43
|
+
isResettable?: boolean;
|
35
44
|
/**
|
36
45
|
* Optional delays configuration for emulating typing behavior
|
37
46
|
*/
|
38
47
|
delayConfig?: MockedChatDelayConfig;
|
48
|
+
/**
|
49
|
+
* When true, shows Pause/Resume control and allows pausing the simulated flow.
|
50
|
+
* Pausing finishes the currently typing message first (transitions via PAUSING state),
|
51
|
+
* then prevents new messages from starting until resumed.
|
52
|
+
*
|
53
|
+
* @default true
|
54
|
+
*/
|
55
|
+
isPausable?: boolean;
|
39
56
|
};
|
40
57
|
/**
|
41
58
|
* MockedChat component that shows the same chat as Chat but emulates ongoing discussion
|
@@ -41,6 +41,11 @@ export type BookEditorProps = {
|
|
41
41
|
* If true, disables border radius making the editor have sharp corners
|
42
42
|
*/
|
43
43
|
readonly isBorderRadiusDisabled?: boolean;
|
44
|
+
/**
|
45
|
+
* If true, shows the footer with book title and version information.
|
46
|
+
* By default, the footer is hidden.
|
47
|
+
*/
|
48
|
+
readonly isFooterShown?: boolean;
|
44
49
|
};
|
45
50
|
/**
|
46
51
|
* Renders a book editor
|
@@ -48,3 +53,6 @@ export type BookEditorProps = {
|
|
48
53
|
* @public exported from `@promptbook/components`
|
49
54
|
*/
|
50
55
|
export declare function BookEditor(props: BookEditorProps): import("react/jsx-runtime").JSX.Element;
|
56
|
+
/**
|
57
|
+
* TODO: [☁️] Export component prop types only to `@promptbook/components` (not `@promptbook/types`)
|
58
|
+
*/
|
@@ -1,18 +1,5 @@
|
|
1
|
-
import {
|
2
|
-
import type { string_book } from '../../book-2.0/agent-source/string_book';
|
1
|
+
import { BookEditorProps } from './BookEditor';
|
3
2
|
/**
|
4
3
|
* @private util of `<BookEditor />`
|
5
4
|
*/
|
6
|
-
export
|
7
|
-
className?: string;
|
8
|
-
fontClassName?: string;
|
9
|
-
value?: string_book;
|
10
|
-
onChange?(value: string_book): void;
|
11
|
-
onFileUpload?(file: File): Promisable<string>;
|
12
|
-
isVerbose?: boolean;
|
13
|
-
isBorderRadiusDisabled?: boolean;
|
14
|
-
};
|
15
|
-
/**
|
16
|
-
* @private util of `<BookEditor />`
|
17
|
-
*/
|
18
|
-
export declare function BookEditorInner(props: BookEditorInnerProps): import("react/jsx-runtime").JSX.Element;
|
5
|
+
export declare function BookEditorInner(props: BookEditorProps): import("react/jsx-runtime").JSX.Element;
|
@@ -66,6 +66,12 @@ export type ChatProps = {
|
|
66
66
|
* If not provided, the chat bar will not be rendered
|
67
67
|
*/
|
68
68
|
readonly children?: ReactNode;
|
69
|
+
/**
|
70
|
+
* Extra action buttons/elements rendered in the actions toolbar
|
71
|
+
* (next to reset / template buttons). Keeps consumers DRY when
|
72
|
+
* adding feature–specific controls (e.g. Pause / Resume in MockedChat).
|
73
|
+
*/
|
74
|
+
readonly extraActions?: ReactNode;
|
69
75
|
/**
|
70
76
|
* Optional CSS class name which will be added to root <div/> element
|
71
77
|
*/
|
@@ -140,3 +146,6 @@ export type ChatProps = {
|
|
140
146
|
url: string;
|
141
147
|
}): Promisable<void>;
|
142
148
|
};
|
149
|
+
/**
|
150
|
+
* TODO: [☁️] Export component prop types only to `@promptbook/components` (not `@promptbook/types`)
|
151
|
+
*/
|
@@ -2,6 +2,7 @@ import type { LlmExecutionTools } from '../../../execution/LlmExecutionTools';
|
|
2
2
|
import type { ChatProps } from '../Chat/ChatProps';
|
3
3
|
import type { ChatMessage } from '../types/ChatMessage';
|
4
4
|
import type { ChatParticipant } from '../types/ChatParticipant';
|
5
|
+
import type { SendMessageToLlmChatFunction } from '../hooks/useSendMessageToLlmChat';
|
5
6
|
/**
|
6
7
|
* Props for LlmChat component, derived from ChatProps but with LLM-specific modifications
|
7
8
|
*
|
@@ -17,8 +18,20 @@ export type LlmChatProps = Omit<ChatProps, 'messages' | 'onMessage' | 'onChange'
|
|
17
18
|
* When provided, the conversation will be saved and restored from localStorage
|
18
19
|
*/
|
19
20
|
readonly persistenceKey?: string;
|
21
|
+
/**
|
22
|
+
* Optional initial messages to pre-populate the chat.
|
23
|
+
* - They can include both USER and ASSISTANT messages.
|
24
|
+
* - They are only used when there is no persisted conversation (persistence takes precedence).
|
25
|
+
* - They are not automatically persisted until the user sends a new message.
|
26
|
+
*/
|
27
|
+
readonly initialMessages?: ReadonlyArray<ChatMessage>;
|
20
28
|
/**
|
21
29
|
* Called when the chat state changes (messages, participants, etc.)
|
22
30
|
*/
|
23
31
|
onChange?(messages: ReadonlyArray<ChatMessage>, participants: ReadonlyArray<ChatParticipant>): void;
|
32
|
+
/**
|
33
|
+
* Optional external sendMessage function produced by useSendMessageToLlmChat hook.
|
34
|
+
* When provided, LlmChat will attach its internal handler to it (no React context needed).
|
35
|
+
*/
|
36
|
+
readonly sendMessage?: SendMessageToLlmChatFunction;
|
24
37
|
};
|
@@ -0,0 +1,41 @@
|
|
1
|
+
/**
|
2
|
+
* Configuration for the auto-scroll behavior
|
3
|
+
*/
|
4
|
+
export type ChatAutoScrollConfig = {
|
5
|
+
/**
|
6
|
+
* Threshold in pixels from bottom to consider as "at bottom"
|
7
|
+
* @default 100
|
8
|
+
*/
|
9
|
+
bottomThreshold?: number;
|
10
|
+
/**
|
11
|
+
* Whether to use smooth scrolling
|
12
|
+
* @default true
|
13
|
+
*/
|
14
|
+
smoothScroll?: boolean;
|
15
|
+
/**
|
16
|
+
* Delay before checking scroll position after new messages (in milliseconds)
|
17
|
+
* @default 100
|
18
|
+
*/
|
19
|
+
scrollCheckDelay?: number;
|
20
|
+
};
|
21
|
+
/**
|
22
|
+
* Hook for managing auto-scroll behavior in chat components
|
23
|
+
*
|
24
|
+
* This hook provides:
|
25
|
+
* - Automatic scrolling to bottom when new messages arrive (if user is already at bottom)
|
26
|
+
* - Detection of when user scrolls away from bottom
|
27
|
+
* - Scroll-to-bottom functionality with smooth animation
|
28
|
+
* - Mobile-optimized scrolling behavior
|
29
|
+
*
|
30
|
+
* @public exported from `@promptbook/components`
|
31
|
+
*/
|
32
|
+
export declare function useChatAutoScroll(config?: ChatAutoScrollConfig): {
|
33
|
+
isAutoScrolling: boolean;
|
34
|
+
chatMessagesRef: (element: HTMLDivElement | null) => void;
|
35
|
+
handleScroll: (event: React.UIEvent<HTMLDivElement>) => void;
|
36
|
+
handleMessagesChange: () => void;
|
37
|
+
scrollToBottom: () => void;
|
38
|
+
enableAutoScroll: () => void;
|
39
|
+
disableAutoScroll: () => void;
|
40
|
+
isMobile: boolean;
|
41
|
+
};
|
@@ -0,0 +1,44 @@
|
|
1
|
+
/**
|
2
|
+
* Function type for sending a message to LlmChat.
|
3
|
+
*
|
4
|
+
* Implementation detail: The returned function is "attachable".
|
5
|
+
* LlmChat will call the internal `_attach` method (if present) to bind
|
6
|
+
* its real message handler. Messages sent before attachment are queued
|
7
|
+
* and flushed after attachment.
|
8
|
+
*
|
9
|
+
* @public exported from `@promptbook/components`
|
10
|
+
*/
|
11
|
+
export type SendMessageToLlmChatFunction = {
|
12
|
+
/**
|
13
|
+
* Send a message to the bound LlmChat instance (or queue it until attached).
|
14
|
+
*/
|
15
|
+
(message: string): void;
|
16
|
+
/**
|
17
|
+
* Internal method used by the <LlmChat/> component to attach its handler.
|
18
|
+
* Not intended for consumer usage.
|
19
|
+
*
|
20
|
+
* @internal
|
21
|
+
*/
|
22
|
+
_attach?: (handler: (message: string) => Promise<void> | void) => void;
|
23
|
+
};
|
24
|
+
/**
|
25
|
+
* Hook to create a sendMessage function for an <LlmChat/> component WITHOUT needing any React Context.
|
26
|
+
*
|
27
|
+
* Usage pattern:
|
28
|
+
* ```tsx
|
29
|
+
* const sendMessage = useSendMessageToLlmChat();
|
30
|
+
* return (
|
31
|
+
* <>
|
32
|
+
* <button onClick={() => sendMessage('Hello!')}>Hello</button>
|
33
|
+
* <LlmChat llmTools={llmTools} sendMessage={sendMessage} />
|
34
|
+
* </>
|
35
|
+
* );
|
36
|
+
* ```
|
37
|
+
*
|
38
|
+
* - No provider wrapping needed.
|
39
|
+
* - Safe to call before the <LlmChat/> mounts (messages will be queued).
|
40
|
+
* - Keeps DRY by letting <LlmChat/> reuse its internal `handleMessage` logic.
|
41
|
+
*
|
42
|
+
* @public exported from `@promptbook/components`
|
43
|
+
*/
|
44
|
+
export declare function useSendMessageToLlmChat(): SendMessageToLlmChatFunction;
|
@@ -0,0 +1,22 @@
|
|
1
|
+
/**
|
2
|
+
* Represents a parsed message button from markdown
|
3
|
+
*
|
4
|
+
* @public exported from `@promptbook/components`
|
5
|
+
*/
|
6
|
+
export type MessageButton = {
|
7
|
+
text: string;
|
8
|
+
message: string;
|
9
|
+
};
|
10
|
+
/**
|
11
|
+
* Parses markdown buttons in the format [Button Text](?message=Message%20to%20send)
|
12
|
+
* Returns both the content without buttons and the extracted buttons
|
13
|
+
*
|
14
|
+
* @param content The markdown content that may contain buttons
|
15
|
+
* @returns Object with contentWithoutButtons and buttons array
|
16
|
+
*
|
17
|
+
* @public exported from `@promptbook/components`
|
18
|
+
*/
|
19
|
+
export declare function parseMessageButtons(content: string): {
|
20
|
+
contentWithoutButtons: string;
|
21
|
+
buttons: MessageButton[];
|
22
|
+
};
|
@@ -1,6 +1,4 @@
|
|
1
|
-
import type { string_date_iso8601 } from '../types/typeAliases';
|
2
|
-
import type { string_model_name } from '../types/typeAliases';
|
3
|
-
import type { string_prompt } from '../types/typeAliases';
|
1
|
+
import type { string_date_iso8601, string_model_name, string_prompt } from '../types/typeAliases';
|
4
2
|
import type { TODO_object } from '../utils/organization/TODO_object';
|
5
3
|
import type { EmbeddingVector } from './EmbeddingVector';
|
6
4
|
import type { Usage } from './Usage';
|
@@ -44,7 +42,7 @@ export type EmbeddingPromptResult = Omit<CommonPromptResult, 'content'> & {
|
|
44
42
|
*/
|
45
43
|
export type CommonPromptResult = {
|
46
44
|
/**
|
47
|
-
*
|
45
|
+
* Text response from the model
|
48
46
|
*/
|
49
47
|
readonly content: string;
|
50
48
|
/**
|
@@ -1,8 +1,7 @@
|
|
1
1
|
import type { PartialDeep, Promisable, ReadonlyDeep, WritableDeep } from 'type-fest';
|
2
2
|
import type { PipelineJson } from '../../pipeline/PipelineJson/PipelineJson';
|
3
3
|
import type { TaskJson } from '../../pipeline/PipelineJson/TaskJson';
|
4
|
-
import type { Parameters } from '../../types/typeAliases';
|
5
|
-
import type { string_parameter_name } from '../../types/typeAliases';
|
4
|
+
import type { Parameters, string_parameter_name } from '../../types/typeAliases';
|
6
5
|
import type { TODO_string } from '../../utils/organization/TODO_string';
|
7
6
|
import type { ExecutionReportJson } from '../execution-report/ExecutionReportJson';
|
8
7
|
import type { PipelineExecutorResult } from '../PipelineExecutorResult';
|
@@ -1,9 +1,7 @@
|
|
1
1
|
import type { ReadonlyDeep } from 'type-fest';
|
2
2
|
import type { PipelineJson } from '../../pipeline/PipelineJson/PipelineJson';
|
3
3
|
import type { TaskJson } from '../../pipeline/PipelineJson/TaskJson';
|
4
|
-
import type { Parameters } from '../../types/typeAliases';
|
5
|
-
import type { string_markdown } from '../../types/typeAliases';
|
6
|
-
import type { string_parameter_value } from '../../types/typeAliases';
|
4
|
+
import type { Parameters, string_markdown, string_parameter_value } from '../../types/typeAliases';
|
7
5
|
import type { ExecutionTools } from '../ExecutionTools';
|
8
6
|
/**
|
9
7
|
* Options for retrieving relevant knowledge for a specific task during pipeline execution.
|
package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsConfigurationFromEnv.d.ts
CHANGED
@@ -16,4 +16,4 @@ import type { LlmToolsConfiguration } from './LlmToolsConfiguration';
|
|
16
16
|
export declare function $provideLlmToolsConfigurationFromEnv(): Promise<LlmToolsConfiguration>;
|
17
17
|
/**
|
18
18
|
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
19
|
-
*/
|
19
|
+
*/
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import { Promisable } from 'type-fest';
|
2
2
|
import type { Identification } from '../../../remote-server/socket-types/_subtypes/Identification';
|
3
|
-
import type { string_app_id } from '../../../types/typeAliases';
|
4
|
-
import type { string_url } from '../../../types/typeAliases';
|
3
|
+
import type { string_app_id, string_url } from '../../../types/typeAliases';
|
5
4
|
import type { really_any } from '../../../utils/organization/really_any';
|
6
5
|
import type { CacheLlmToolsOptions } from '../utils/cache/CacheLlmToolsOptions';
|
7
6
|
import type { LlmExecutionToolsWithTotalUsage } from '../utils/count-total-usage/LlmExecutionToolsWithTotalUsage';
|
@@ -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,9 @@
|
|
1
|
+
import type { ChatParticipant } from '../../book-components/Chat/types/ChatParticipant';
|
1
2
|
import type { AvailableModel } from '../../execution/AvailableModel';
|
2
3
|
import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
|
3
|
-
import type { ChatPromptResult } from '../../execution/PromptResult';
|
4
|
-
import type {
|
5
|
-
import type {
|
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';
|
4
|
+
import type { ChatPromptResult, CompletionPromptResult, EmbeddingPromptResult, PromptResult } from '../../execution/PromptResult';
|
5
|
+
import type { ChatPrompt, CompletionPrompt, EmbeddingPrompt, Prompt } from '../../types/Prompt';
|
6
|
+
import type { string_markdown, string_markdown_text, string_title } from '../../types/typeAliases';
|
14
7
|
/**
|
15
8
|
* Multiple LLM Execution Tools is a proxy server that uses multiple execution tools internally and exposes the executor interface externally.
|
16
9
|
*
|
@@ -18,6 +11,7 @@ import type { string_title } from '../../types/typeAliases';
|
|
18
11
|
* @public exported from `@promptbook/core`
|
19
12
|
*/
|
20
13
|
export declare class MultipleLlmExecutionTools implements LlmExecutionTools {
|
14
|
+
readonly title: string_title & string_markdown_text;
|
21
15
|
/**
|
22
16
|
* Array of execution tools in order of priority
|
23
17
|
*/
|
@@ -25,14 +19,9 @@ export declare class MultipleLlmExecutionTools implements LlmExecutionTools {
|
|
25
19
|
/**
|
26
20
|
* Gets array of execution tools in order of priority
|
27
21
|
*/
|
28
|
-
constructor(...llmExecutionTools: ReadonlyArray<LlmExecutionTools>);
|
29
|
-
get title(): string_title & string_markdown_text;
|
22
|
+
constructor(title: string_title & string_markdown_text, ...llmExecutionTools: ReadonlyArray<LlmExecutionTools>);
|
30
23
|
get description(): string_markdown;
|
31
|
-
get profile():
|
32
|
-
name: string;
|
33
|
-
fullname: string;
|
34
|
-
color: string;
|
35
|
-
};
|
24
|
+
get profile(): ChatParticipant;
|
36
25
|
/**
|
37
26
|
* Check the configuration of all execution tools
|
38
27
|
*/
|
@@ -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,58 @@
|
|
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_model_name, 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
|
+
/**
|
46
|
+
* Returns a virtual model name representing the agent behavior
|
47
|
+
*/
|
48
|
+
get modelName(): string_model_name;
|
49
|
+
listModels(): Promisable<ReadonlyArray<AvailableModel>>;
|
50
|
+
/**
|
51
|
+
* Calls the chat model with agent-specific system prompt and requirements
|
52
|
+
*/
|
53
|
+
callChatModel(prompt: Prompt): Promise<ChatPromptResult>;
|
54
|
+
}
|
55
|
+
/**
|
56
|
+
* TODO: [🍚] Implement Destroyable pattern to free resources
|
57
|
+
* TODO: [🧠] Adding parameter substitution support (here or should be responsibility of the underlying LLM Tools)
|
58
|
+
*/
|
@@ -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,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
|
+
*/
|
@@ -1,11 +1,10 @@
|
|
1
1
|
import Anthropic from '@anthropic-ai/sdk';
|
2
|
+
import type { ChatParticipant } from '../../book-components/Chat/types/ChatParticipant';
|
2
3
|
import type { AvailableModel } from '../../execution/AvailableModel';
|
3
4
|
import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
|
4
5
|
import type { ChatPromptResult } from '../../execution/PromptResult';
|
5
6
|
import type { Prompt } from '../../types/Prompt';
|
6
|
-
import type { string_markdown } from '../../types/typeAliases';
|
7
|
-
import type { string_markdown_text } from '../../types/typeAliases';
|
8
|
-
import type { string_title } from '../../types/typeAliases';
|
7
|
+
import type { string_markdown, string_markdown_text, string_title } from '../../types/typeAliases';
|
9
8
|
import type { AnthropicClaudeExecutionToolsNonProxiedOptions } from './AnthropicClaudeExecutionToolsOptions';
|
10
9
|
/**
|
11
10
|
* Execution Tools for calling Anthropic Claude API.
|
@@ -28,11 +27,7 @@ export declare class AnthropicClaudeExecutionTools implements LlmExecutionTools
|
|
28
27
|
constructor(options?: AnthropicClaudeExecutionToolsNonProxiedOptions);
|
29
28
|
get title(): string_title & string_markdown_text;
|
30
29
|
get description(): string_markdown;
|
31
|
-
get profile():
|
32
|
-
name: string;
|
33
|
-
fullname: string;
|
34
|
-
color: string;
|
35
|
-
};
|
30
|
+
get profile(): ChatParticipant;
|
36
31
|
getClient(): Promise<Anthropic>;
|
37
32
|
/**
|
38
33
|
* Check the `options` passed to `constructor`
|