@promptbook/javascript 0.110.0-1 → 0.110.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.
- package/esm/index.es.js +1 -1
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/components.index.d.ts +4 -0
- package/esm/typings/src/_packages/core.index.d.ts +2 -2
- package/esm/typings/src/_packages/openai.index.d.ts +8 -4
- package/esm/typings/src/_packages/types.index.d.ts +12 -4
- package/esm/typings/src/book-2.0/agent-source/AgentModelRequirements.d.ts +22 -21
- package/esm/typings/src/book-2.0/agent-source/AgentReferenceResolver.d.ts +18 -0
- package/esm/typings/src/book-2.0/agent-source/CreateAgentModelRequirementsOptions.d.ts +12 -0
- package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirements.d.ts +8 -2
- package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.agentReferenceResolver.test.d.ts +1 -0
- package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.d.ts +4 -5
- package/esm/typings/src/book-components/Chat/AgentChip/AgentChip.d.ts +5 -1
- package/esm/typings/src/book-components/Chat/Chat/ChatActionsBar.d.ts +4 -2
- package/esm/typings/src/book-components/Chat/Chat/ChatInputArea.d.ts +1 -0
- package/esm/typings/src/book-components/Chat/Chat/ChatMessageItem.d.ts +4 -0
- package/esm/typings/src/book-components/Chat/Chat/ChatMessageList.d.ts +1 -0
- package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +15 -0
- package/esm/typings/src/book-components/Chat/Chat/ChatSoundToggle.d.ts +31 -0
- package/esm/typings/src/book-components/Chat/LlmChat/LlmChatProps.d.ts +10 -1
- package/esm/typings/src/book-components/Chat/SourceChip/SourceChip.d.ts +5 -1
- package/esm/typings/src/book-components/Chat/utils/collectTeamToolCallSummary.d.ts +69 -0
- package/esm/typings/src/book-components/Chat/utils/getToolCallChipletInfo.d.ts +13 -13
- package/esm/typings/src/book-components/Chat/utils/parseCitationsFromContent.d.ts +9 -0
- package/esm/typings/src/book-components/Chat/utils/toolCallParsing.d.ts +4 -0
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentsDatabaseSchema.d.ts +0 -3
- package/esm/typings/src/commitments/_base/BaseCommitmentDefinition.d.ts +9 -0
- package/esm/typings/src/execution/LlmExecutionTools.d.ts +2 -1
- package/esm/typings/src/llm-providers/agent/Agent.d.ts +1 -1
- package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +5 -1
- package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.test.d.ts +1 -0
- package/esm/typings/src/llm-providers/agent/AgentOptions.d.ts +10 -0
- package/esm/typings/src/llm-providers/agent/CreateAgentLlmExecutionToolsOptions.d.ts +13 -2
- package/esm/typings/src/llm-providers/agent/RemoteAgent.d.ts +2 -1
- package/esm/typings/src/llm-providers/openai/OpenAiAgentKitExecutionTools.d.ts +150 -0
- package/esm/typings/src/llm-providers/openai/OpenAiAgentKitExecutionToolsOptions.d.ts +15 -0
- package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +3 -3
- package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionToolsOptions.d.ts +3 -4
- package/esm/typings/src/llm-providers/openai/OpenAiVectorStoreHandler.d.ts +135 -0
- package/esm/typings/src/llm-providers/openai/utils/mapToolsToOpenAi.d.ts +1 -1
- package/esm/typings/src/types/LlmToolDefinition.d.ts +1 -0
- package/esm/typings/src/types/ModelRequirements.d.ts +9 -0
- package/esm/typings/src/utils/DEFAULT_THINKING_MESSAGES.d.ts +8 -0
- package/esm/typings/src/utils/agents/resolveAgentAvatarImageUrl.d.ts +29 -0
- package/esm/typings/src/utils/knowledge/inlineKnowledgeSource.d.ts +38 -0
- package/esm/typings/src/utils/knowledge/inlineKnowledgeSource.test.d.ts +1 -0
- package/esm/typings/src/utils/language/getBrowserPreferredSpeechRecognitionLanguage.d.ts +35 -0
- package/esm/typings/src/utils/toolCalls/getToolCallIdentity.d.ts +10 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +5 -2
- package/umd/index.umd.js +1 -1
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/llm-providers/openai/OpenAiAgentExecutionTools.d.ts +0 -43
- package/esm/typings/src/llm-providers/openai/createOpenAiAgentExecutionTools.d.ts +0 -11
|
@@ -2,17 +2,23 @@ import type { AvailableModel } from '../../execution/AvailableModel';
|
|
|
2
2
|
import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
|
|
3
3
|
import type { string_agent_name, string_model_name, string_system_message, string_url_image } from '../../types/typeAliases';
|
|
4
4
|
import type { AgentModelRequirements } from './AgentModelRequirements';
|
|
5
|
+
import type { CreateAgentModelRequirementsOptions } from './CreateAgentModelRequirementsOptions';
|
|
5
6
|
import type { string_book } from './string_book';
|
|
6
7
|
/**
|
|
7
|
-
* Creates model requirements for an agent based on its source
|
|
8
|
+
* Creates model requirements for an agent based on its source.
|
|
8
9
|
*
|
|
9
10
|
* There are 2 similar functions:
|
|
10
11
|
* - `parseAgentSource` which is a lightweight parser for agent source, it parses basic information and its purpose is to be quick and synchronous. The commitments there are hardcoded.
|
|
11
12
|
* - `createAgentModelRequirements` which is an asynchronous function that creates model requirements it applies each commitment one by one and works asynchronous.
|
|
12
13
|
*
|
|
14
|
+
* @param agentSource - Book describing the agent.
|
|
15
|
+
* @param modelName - Optional override for the agent's model.
|
|
16
|
+
* @param availableModels - Models that could fulfill the agent.
|
|
17
|
+
* @param llmTools - Execution tools used when selecting a best model.
|
|
18
|
+
* @param options - Optional hooks such as the agent reference resolver.
|
|
13
19
|
* @public exported from `@promptbook/core`
|
|
14
20
|
*/
|
|
15
|
-
export declare function createAgentModelRequirements(agentSource: string_book, modelName?: string_model_name, availableModels?: readonly AvailableModel[], llmTools?: LlmExecutionTools): Promise<AgentModelRequirements>;
|
|
21
|
+
export declare function createAgentModelRequirements(agentSource: string_book, modelName?: string_model_name, availableModels?: readonly AvailableModel[], llmTools?: LlmExecutionTools, options?: CreateAgentModelRequirementsOptions): Promise<AgentModelRequirements>;
|
|
16
22
|
/**
|
|
17
23
|
* Extracts MCP servers from agent source
|
|
18
24
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import type { string_model_name } from '../../types/typeAliases';
|
|
2
2
|
import type { AgentModelRequirements } from './AgentModelRequirements';
|
|
3
|
+
import type { CreateAgentModelRequirementsOptions } from './CreateAgentModelRequirementsOptions';
|
|
3
4
|
import type { string_book } from './string_book';
|
|
4
5
|
/**
|
|
5
|
-
*
|
|
6
|
-
* This function uses a reduce-like pattern where each commitment applies its changes
|
|
7
|
-
* to build the final requirements starting from a basic empty model
|
|
6
|
+
* @@@
|
|
8
7
|
*
|
|
9
|
-
* @
|
|
8
|
+
* @private @@@
|
|
10
9
|
*/
|
|
11
|
-
export declare function createAgentModelRequirementsWithCommitments(agentSource: string_book, modelName?: string_model_name): Promise<AgentModelRequirements>;
|
|
10
|
+
export declare function createAgentModelRequirementsWithCommitments(agentSource: string_book, modelName?: string_model_name, options?: CreateAgentModelRequirementsOptions): Promise<AgentModelRequirements>;
|
|
@@ -45,6 +45,10 @@ export type AgentChipProps = {
|
|
|
45
45
|
* Additional CSS class name
|
|
46
46
|
*/
|
|
47
47
|
className?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Optional suffix appended to the agent label (e.g., " (2x)").
|
|
50
|
+
*/
|
|
51
|
+
labelSuffix?: string;
|
|
48
52
|
};
|
|
49
53
|
/**
|
|
50
54
|
* AgentChip component - displays a chip with agent avatar and name
|
|
@@ -64,4 +68,4 @@ export type AgentChipProps = {
|
|
|
64
68
|
*
|
|
65
69
|
* @private utility of `ChatMessageItem` component
|
|
66
70
|
*/
|
|
67
|
-
export declare function AgentChip({ agent, isOngoing, isClickable, onClick, className }: AgentChipProps): import("react/jsx-runtime").JSX.Element;
|
|
71
|
+
export declare function AgentChip({ agent, isOngoing, isClickable, onClick, className, labelSuffix, }: AgentChipProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,7 +3,6 @@ import type { Promisable } from 'type-fest';
|
|
|
3
3
|
import type { string_chat_format_name } from '../save/_common/string_chat_format_name';
|
|
4
4
|
import type { ChatMessage } from '../types/ChatMessage';
|
|
5
5
|
import type { ChatParticipant } from '../types/ChatParticipant';
|
|
6
|
-
import type { ChatSoundSystem } from './ChatProps';
|
|
7
6
|
/**
|
|
8
7
|
* Props for the Chat actions toolbar.
|
|
9
8
|
*
|
|
@@ -21,8 +20,11 @@ export type ChatActionsBarProps = {
|
|
|
21
20
|
saveFormats?: Array<string_chat_format_name>;
|
|
22
21
|
isSaveButtonEnabled: boolean;
|
|
23
22
|
shouldFadeActions: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Disables action interactions while scroll is active.
|
|
25
|
+
*/
|
|
26
|
+
shouldDisableActions: boolean;
|
|
24
27
|
onButtonClick: (handler?: (event: MouseEvent<HTMLButtonElement>) => void) => (event: MouseEvent<HTMLButtonElement>) => void;
|
|
25
|
-
soundSystem?: ChatSoundSystem;
|
|
26
28
|
};
|
|
27
29
|
/**
|
|
28
30
|
* Renders the action buttons row for Chat.
|
|
@@ -29,6 +29,7 @@ export type ChatInputAreaProps = {
|
|
|
29
29
|
onChange?: ChatProps['onChange'];
|
|
30
30
|
onFileUpload?: ChatProps['onFileUpload'];
|
|
31
31
|
speechRecognition?: ChatProps['speechRecognition'];
|
|
32
|
+
speechRecognitionLanguage?: ChatProps['speechRecognitionLanguage'];
|
|
32
33
|
defaultMessage?: string;
|
|
33
34
|
placeholderMessageContent?: string;
|
|
34
35
|
isFocusedOnLoad?: boolean;
|
|
@@ -52,6 +52,10 @@ type ChatMessageItemProps = Pick<ChatProps, 'onMessage' | 'participants'> & {
|
|
|
52
52
|
* Called when a source citation chip is clicked.
|
|
53
53
|
*/
|
|
54
54
|
onCitationClick?: (citation: ParsedCitation) => void;
|
|
55
|
+
/**
|
|
56
|
+
* Optional sound system for triggering tool chip events.
|
|
57
|
+
*/
|
|
58
|
+
soundSystem?: ChatProps['soundSystem'];
|
|
55
59
|
};
|
|
56
60
|
/**
|
|
57
61
|
* Metadata for a teammate agent tool.
|
|
@@ -27,6 +27,7 @@ export type ChatMessageListProps = {
|
|
|
27
27
|
teammates?: ChatProps['teammates'];
|
|
28
28
|
onToolCallClick?: (toolCall: NonNullable<ChatMessage['toolCalls']>[number]) => void;
|
|
29
29
|
onCitationClick?: (citation: ParsedCitation) => void;
|
|
30
|
+
soundSystem?: ChatProps['soundSystem'];
|
|
30
31
|
setChatMessagesElement: (element: HTMLDivElement | null) => void;
|
|
31
32
|
onScroll: (event: UIEvent<HTMLDivElement>) => void;
|
|
32
33
|
chatMessagesClassName?: string;
|
|
@@ -20,6 +20,16 @@ export type ChatSoundSystem = {
|
|
|
20
20
|
isEnabled(): boolean;
|
|
21
21
|
setEnabled(enabled: boolean): void;
|
|
22
22
|
toggle(): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Optional helpers for haptic vibration state.
|
|
25
|
+
*/
|
|
26
|
+
isVibrationEnabled?(): boolean;
|
|
27
|
+
setVibrationEnabled?(enabled: boolean): void;
|
|
28
|
+
toggleVibration?(): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Optional vibration helper to stay in sync with sound events.
|
|
31
|
+
*/
|
|
32
|
+
vibrate?(event: string): void;
|
|
23
33
|
};
|
|
24
34
|
/**
|
|
25
35
|
* @public exported from `@promptbook/components`
|
|
@@ -66,6 +76,11 @@ export type ChatProps = {
|
|
|
66
76
|
* Speech recognition provider
|
|
67
77
|
*/
|
|
68
78
|
readonly speechRecognition?: SpeechRecognition;
|
|
79
|
+
/**
|
|
80
|
+
* Optional language tag (BCP 47) to force speech recognition to use a specific language.
|
|
81
|
+
* When not provided, the browser preferences are used with a fallback to `en-US`.
|
|
82
|
+
*/
|
|
83
|
+
readonly speechRecognitionLanguage?: string;
|
|
69
84
|
/**
|
|
70
85
|
* Optional placeholder message for the textarea
|
|
71
86
|
*
|
|
@@ -21,3 +21,34 @@ export type ChatSoundToggleProps = {
|
|
|
21
21
|
* @public exported from `@promptbook/components`
|
|
22
22
|
*/
|
|
23
23
|
export declare function ChatSoundToggle(props: ChatSoundToggleProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
/**
|
|
25
|
+
* Props for the chat vibration toggle.
|
|
26
|
+
*/
|
|
27
|
+
export type ChatVibrationToggleProps = {
|
|
28
|
+
/**
|
|
29
|
+
* The sound system instance that supports vibration helpers.
|
|
30
|
+
*/
|
|
31
|
+
soundSystem: ChatSoundSystem;
|
|
32
|
+
/**
|
|
33
|
+
* Optional CSS class name.
|
|
34
|
+
*/
|
|
35
|
+
className?: string;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* ChatVibrationToggle component that controls haptic feedback.
|
|
39
|
+
*
|
|
40
|
+
* @public exported from `@promptbook/components`
|
|
41
|
+
*/
|
|
42
|
+
export declare function ChatVibrationToggle(props: ChatVibrationToggleProps): import("react/jsx-runtime").JSX.Element | null;
|
|
43
|
+
/**
|
|
44
|
+
* Props for the combined sound and vibration control panel.
|
|
45
|
+
*/
|
|
46
|
+
export type ChatSoundAndVibrationPanelProps = {
|
|
47
|
+
readonly soundSystem: ChatSoundSystem;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Renders a compact control panel that surfaces both sound and haptic toggles with richer affordances.
|
|
51
|
+
*
|
|
52
|
+
* @public exported from `@promptbook/components`
|
|
53
|
+
*/
|
|
54
|
+
export declare function ChatSoundAndVibrationPanel(props: ChatSoundAndVibrationPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -62,6 +62,12 @@ export type LlmChatProps = Omit<ChatProps, 'messages' | 'onMessage' | 'onChange'
|
|
|
62
62
|
* e.g., { "web_search": "Searching the web..." }
|
|
63
63
|
*/
|
|
64
64
|
readonly toolTitles?: Record<string, string>;
|
|
65
|
+
/**
|
|
66
|
+
* Custom variants for the placeholder thinking message shown while the agent buffers its response.
|
|
67
|
+
*
|
|
68
|
+
* @default Shared thinking message variants
|
|
69
|
+
*/
|
|
70
|
+
readonly thinkingMessages?: ReadonlyArray<string>;
|
|
65
71
|
/**
|
|
66
72
|
* Optional custom error handler that will be called when an error occurs during chat.
|
|
67
73
|
* If not provided, errors will be displayed as messages in the chat.
|
|
@@ -69,5 +75,8 @@ export type LlmChatProps = Omit<ChatProps, 'messages' | 'onMessage' | 'onChange'
|
|
|
69
75
|
* @param error - The error that occurred
|
|
70
76
|
* @param retry - Function to retry the last failed message
|
|
71
77
|
*/
|
|
72
|
-
onError?(error: unknown, retry: () => void
|
|
78
|
+
onError?(error: unknown, retry: () => void, failedMessage: {
|
|
79
|
+
content: string;
|
|
80
|
+
attachments: ChatMessage['attachments'];
|
|
81
|
+
}): void;
|
|
73
82
|
};
|
|
@@ -15,6 +15,10 @@ export type SourceChipProps = {
|
|
|
15
15
|
* Additional CSS class name
|
|
16
16
|
*/
|
|
17
17
|
className?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Optional suffix text to display after the citation label.
|
|
20
|
+
*/
|
|
21
|
+
suffix?: string;
|
|
18
22
|
};
|
|
19
23
|
/**
|
|
20
24
|
* SourceChip component - displays a chip with source document information
|
|
@@ -32,4 +36,4 @@ export type SourceChipProps = {
|
|
|
32
36
|
*
|
|
33
37
|
* @private utility of `ChatMessageItem` component
|
|
34
38
|
*/
|
|
35
|
-
export declare function SourceChip({ citation, onClick, className }: SourceChipProps): import("react/jsx-runtime").JSX.Element;
|
|
39
|
+
export declare function SourceChip({ citation, onClick, className, suffix }: SourceChipProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { type ToolCall } from '../../../types/ToolCall';
|
|
2
|
+
import type { ParsedCitation } from './parseCitationsFromContent';
|
|
3
|
+
/**
|
|
4
|
+
* Origin metadata for a tool call or citation executed by a teammate.
|
|
5
|
+
*
|
|
6
|
+
* @private utility of `<Chat/>`
|
|
7
|
+
*/
|
|
8
|
+
export type ToolCallOrigin = {
|
|
9
|
+
/**
|
|
10
|
+
* Human-readable label for the teammate.
|
|
11
|
+
*/
|
|
12
|
+
label: string;
|
|
13
|
+
/**
|
|
14
|
+
* Optional teammate URL.
|
|
15
|
+
*/
|
|
16
|
+
url?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Optional tool name for the teammate.
|
|
19
|
+
*/
|
|
20
|
+
toolName?: string;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Tool call data enriched with its teammate origin.
|
|
24
|
+
*
|
|
25
|
+
* @private utility of `<Chat/>`
|
|
26
|
+
*/
|
|
27
|
+
export type TransitiveToolCall = {
|
|
28
|
+
/**
|
|
29
|
+
* Tool call executed by the teammate.
|
|
30
|
+
*/
|
|
31
|
+
toolCall: ToolCall;
|
|
32
|
+
/**
|
|
33
|
+
* Teammate origin metadata for the tool call.
|
|
34
|
+
*/
|
|
35
|
+
origin: ToolCallOrigin;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Citation data enriched with its teammate origin.
|
|
39
|
+
*
|
|
40
|
+
* @private utility of `<Chat/>`
|
|
41
|
+
*/
|
|
42
|
+
export type TransitiveCitation = ParsedCitation & {
|
|
43
|
+
/**
|
|
44
|
+
* Teammate origin metadata for the citation.
|
|
45
|
+
*/
|
|
46
|
+
origin: ToolCallOrigin;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Aggregated teammate tool calls and citations derived from TEAM tool results.
|
|
50
|
+
*
|
|
51
|
+
* @private utility of `<Chat/>`
|
|
52
|
+
*/
|
|
53
|
+
export type TeamToolCallSummary = {
|
|
54
|
+
/**
|
|
55
|
+
* Tool calls executed by teammates, flattened transitively.
|
|
56
|
+
*/
|
|
57
|
+
toolCalls: TransitiveToolCall[];
|
|
58
|
+
/**
|
|
59
|
+
* Citations referenced by teammates, flattened transitively.
|
|
60
|
+
*/
|
|
61
|
+
citations: TransitiveCitation[];
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Collects tool calls and citations from TEAM tool call results, resolving nested teammate chains.
|
|
65
|
+
*
|
|
66
|
+
* @param toolCalls - Tool calls from the top-level agent message.
|
|
67
|
+
* @private utility of `<Chat/>`
|
|
68
|
+
*/
|
|
69
|
+
export declare function collectTeamToolCallSummary(toolCalls: ReadonlyArray<ToolCall> | undefined): TeamToolCallSummary;
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
import { type ToolCall } from '../../../types/ToolCall';
|
|
2
2
|
import type { AgentChipData } from '../AgentChip';
|
|
3
|
-
/**
|
|
4
|
-
* Utility to format tool call information for user-friendly display.
|
|
5
|
-
*/
|
|
6
3
|
/**
|
|
7
4
|
* Tool call chiplet information including agent data for team tools
|
|
5
|
+
*
|
|
6
|
+
* @private utility of `<Chat/>`
|
|
8
7
|
*/
|
|
9
8
|
export type ToolCallChipletInfo = {
|
|
10
9
|
/**
|
|
11
|
-
* Display text for the chiplet
|
|
10
|
+
* Display text for the chiplet.
|
|
12
11
|
*/
|
|
13
12
|
text: string;
|
|
14
13
|
/**
|
|
15
|
-
* Agent data for team tools (if applicable)
|
|
14
|
+
* Agent data for team tools (if applicable).
|
|
16
15
|
*/
|
|
17
16
|
agentData?: AgentChipData;
|
|
18
|
-
/**
|
|
19
|
-
* Whether to wrap the chip text in brackets when rendering.
|
|
20
|
-
*
|
|
21
|
-
* @default true
|
|
22
|
-
*/
|
|
23
|
-
wrapInBrackets?: boolean;
|
|
24
17
|
};
|
|
18
|
+
/**
|
|
19
|
+
* Builds display text for a tool call chiplet.
|
|
20
|
+
*
|
|
21
|
+
* @param chipletInfo - Chiplet metadata for the tool call.
|
|
22
|
+
*
|
|
23
|
+
* @private utility of `<Chat/>`
|
|
24
|
+
*/
|
|
25
|
+
export declare function buildToolCallChipText(chipletInfo: ToolCallChipletInfo): string;
|
|
25
26
|
/**
|
|
26
27
|
* Technical to user-friendly tool names and emojis
|
|
27
28
|
*
|
|
28
|
-
* @private [🧠] Maybe public?
|
|
29
|
+
* @private utility of `<Chat/>` [🧠] Maybe public?
|
|
29
30
|
*/
|
|
30
31
|
export declare const TOOL_TITLES: Record<string, {
|
|
31
32
|
title: string;
|
|
32
33
|
emoji: string;
|
|
33
|
-
wrapInBrackets?: boolean;
|
|
34
34
|
}>;
|
|
35
35
|
/**
|
|
36
36
|
* Gets the chiplet information including text and agent data (for team tools).
|
|
@@ -39,6 +39,15 @@ export declare function parseCitationsFromContent(content: string): ParsedCitati
|
|
|
39
39
|
* @private utility for internal use
|
|
40
40
|
*/
|
|
41
41
|
export declare function stripCitationsFromContent(content: string): string;
|
|
42
|
+
/**
|
|
43
|
+
* Deduplicates citations by source while preserving the first-seen order.
|
|
44
|
+
*
|
|
45
|
+
* @param citations - Parsed citations to deduplicate.
|
|
46
|
+
* @returns Deduplicated citations in original order.
|
|
47
|
+
*
|
|
48
|
+
* @private utility for internal use
|
|
49
|
+
*/
|
|
50
|
+
export declare function dedupeCitationsBySource(citations: ReadonlyArray<ParsedCitation>): ParsedCitation[];
|
|
42
51
|
/**
|
|
43
52
|
* Extracts citations from a chat message if not already present
|
|
44
53
|
*
|
|
@@ -25,6 +25,10 @@ export type TeamToolResult = {
|
|
|
25
25
|
};
|
|
26
26
|
request?: string;
|
|
27
27
|
response?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Tool calls executed by the teammate while answering.
|
|
30
|
+
*/
|
|
31
|
+
toolCalls?: ReadonlyArray<ToolCall>;
|
|
28
32
|
error?: string | null;
|
|
29
33
|
conversation?: Array<{
|
|
30
34
|
sender?: string;
|
|
@@ -36,7 +36,6 @@ export type AgentsDatabaseSchema = {
|
|
|
36
36
|
promptbookEngineVersion: string;
|
|
37
37
|
usage: Json | null;
|
|
38
38
|
preparedModelRequirements: Json | null;
|
|
39
|
-
preparedExternals: Json | null;
|
|
40
39
|
folderId: number | null;
|
|
41
40
|
sortOrder: number;
|
|
42
41
|
deletedAt: string | null;
|
|
@@ -54,7 +53,6 @@ export type AgentsDatabaseSchema = {
|
|
|
54
53
|
promptbookEngineVersion: string;
|
|
55
54
|
usage?: Json | null;
|
|
56
55
|
preparedModelRequirements?: Json | null;
|
|
57
|
-
preparedExternals?: Json | null;
|
|
58
56
|
folderId?: number | null;
|
|
59
57
|
sortOrder?: number;
|
|
60
58
|
deletedAt?: string | null;
|
|
@@ -72,7 +70,6 @@ export type AgentsDatabaseSchema = {
|
|
|
72
70
|
promptbookEngineVersion?: string;
|
|
73
71
|
usage?: Json | null;
|
|
74
72
|
preparedModelRequirements?: Json | null;
|
|
75
|
-
preparedExternals?: Json | null;
|
|
76
73
|
folderId?: number | null;
|
|
77
74
|
sortOrder?: number;
|
|
78
75
|
deletedAt?: string | null;
|
|
@@ -57,6 +57,15 @@ export declare abstract class BaseCommitmentDefinition<TBookCommitment extends s
|
|
|
57
57
|
* Helper method to append content to the system message
|
|
58
58
|
*/
|
|
59
59
|
protected appendToSystemMessage(requirements: AgentModelRequirements, content: string, separator?: string): AgentModelRequirements;
|
|
60
|
+
/**
|
|
61
|
+
* Helper method to create a new requirements object with updated prompt suffix
|
|
62
|
+
*/
|
|
63
|
+
protected updatePromptSuffix(requirements: AgentModelRequirements, contentUpdate: string | ((currentSuffix: string) => string)): AgentModelRequirements;
|
|
64
|
+
/**
|
|
65
|
+
* Helper method to append content to the prompt suffix
|
|
66
|
+
* Default separator is a single newline for bullet lists.
|
|
67
|
+
*/
|
|
68
|
+
protected appendToPromptSuffix(requirements: AgentModelRequirements, content: string, separator?: string): AgentModelRequirements;
|
|
60
69
|
/**
|
|
61
70
|
* Helper method to add a comment section to the system message
|
|
62
71
|
* Comments are lines starting with # that will be removed from the final system message
|
|
@@ -13,7 +13,8 @@ import type { ChatPromptResult, CompletionPromptResult, EmbeddingPromptResult, I
|
|
|
13
13
|
* - `Agent` - which represents an AI Agent with its source, memories, actions, etc. Agent is a higher-level abstraction which is internally using:
|
|
14
14
|
* - `LlmExecutionTools` - which wraps one or more LLM models and provides an interface to execute them
|
|
15
15
|
* - `AgentLlmExecutionTools` - which is a specific implementation of `LlmExecutionTools` that wraps another LlmExecutionTools and applies agent-specific system prompts and requirements
|
|
16
|
-
* - `OpenAiAssistantExecutionTools` - which is a specific implementation of `LlmExecutionTools` for OpenAI models with assistant capabilities
|
|
16
|
+
* - `OpenAiAssistantExecutionTools` - (Deprecated) which is a specific implementation of `LlmExecutionTools` for OpenAI models with assistant capabilities
|
|
17
|
+
* - `OpenAiAgentKitExecutionTools` - which is a specific implementation of `LlmExecutionTools` backed by OpenAI AgentKit
|
|
17
18
|
* - `RemoteAgent` - which is an `Agent` that connects to a Promptbook Agents Server
|
|
18
19
|
*
|
|
19
20
|
* @see https://github.com/webgptorg/promptbook#llm-execution-tools
|
|
@@ -14,8 +14,8 @@ import type { AgentOptions } from './AgentOptions';
|
|
|
14
14
|
* - `Agent` - which represents an AI Agent with its source, memories, actions, etc. Agent is a higher-level abstraction which is internally using:
|
|
15
15
|
* - `LlmExecutionTools` - which wraps one or more LLM models and provides an interface to execute them
|
|
16
16
|
* - `AgentLlmExecutionTools` - which is a specific implementation of `LlmExecutionTools` that wraps another LlmExecutionTools and applies agent-specific system prompts and requirements
|
|
17
|
-
* - `OpenAiAgentExecutionTools` - which is a specific implementation of `LlmExecutionTools` for OpenAI models with agent capabilities (using Responses API), recommended for usage in `Agent` or `AgentLlmExecutionTools`
|
|
18
17
|
* - `OpenAiAssistantExecutionTools` - (Deprecated) which is a specific implementation of `LlmExecutionTools` for OpenAI models with assistant capabilities
|
|
18
|
+
* - `OpenAiAgentKitExecutionTools` - which is a specific implementation of `LlmExecutionTools` backed by OpenAI AgentKit
|
|
19
19
|
* - `RemoteAgent` - which is an `Agent` that connects to a Promptbook Agents Server
|
|
20
20
|
*
|
|
21
21
|
* @public exported from `@promptbook/core`
|
|
@@ -16,14 +16,18 @@ import type { CreateAgentLlmExecutionToolsOptions } from './CreateAgentLlmExecut
|
|
|
16
16
|
* - `Agent` - which represents an AI Agent with its source, memories, actions, etc. Agent is a higher-level abstraction which is internally using:
|
|
17
17
|
* - `LlmExecutionTools` - which wraps one or more LLM models and provides an interface to execute them
|
|
18
18
|
* - `AgentLlmExecutionTools` - which is a specific implementation of `LlmExecutionTools` that wraps another LlmExecutionTools and applies agent-specific system prompts and requirements
|
|
19
|
-
* - `OpenAiAgentExecutionTools` - which is a specific implementation of `LlmExecutionTools` for OpenAI models with agent capabilities (using Responses API), recommended for usage in `Agent` or `AgentLlmExecutionTools`
|
|
20
19
|
* - `OpenAiAssistantExecutionTools` - (Deprecated) which is a specific implementation of `LlmExecutionTools` for OpenAI models with assistant capabilities
|
|
20
|
+
* - `OpenAiAgentKitExecutionTools` - which is a specific implementation of `LlmExecutionTools` backed by OpenAI AgentKit
|
|
21
21
|
* - `RemoteAgent` - which is an `Agent` that connects to a Promptbook Agents Server
|
|
22
22
|
*
|
|
23
23
|
* @public exported from `@promptbook/core`
|
|
24
24
|
*/
|
|
25
25
|
export declare class AgentLlmExecutionTools implements LlmExecutionTools {
|
|
26
26
|
protected readonly options: CreateAgentLlmExecutionToolsOptions;
|
|
27
|
+
/**
|
|
28
|
+
* Cached AgentKit agents to avoid rebuilding identical instances.
|
|
29
|
+
*/
|
|
30
|
+
private static agentKitAgentCache;
|
|
27
31
|
/**
|
|
28
32
|
* Cache of OpenAI assistants to avoid creating duplicates
|
|
29
33
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -13,6 +13,16 @@ export type AgentOptions = CommonToolsOptions & {
|
|
|
13
13
|
* Here the agent has access to various LLM models, browser, scrapers, LibreOffice, tools, etc.
|
|
14
14
|
*/
|
|
15
15
|
executionTools: ExecutionTools;
|
|
16
|
+
/**
|
|
17
|
+
* How to manage OpenAI assistant/AgentKit preparation when using OpenAiAssistantExecutionTools
|
|
18
|
+
* or OpenAiAgentKitExecutionTools.
|
|
19
|
+
*
|
|
20
|
+
* Use `external` when an external cache manager already created the assistant/AgentKit agent
|
|
21
|
+
* and the agent should use it as-is.
|
|
22
|
+
*
|
|
23
|
+
* @default internal
|
|
24
|
+
*/
|
|
25
|
+
assistantPreparationMode?: 'internal' | 'external';
|
|
16
26
|
/**
|
|
17
27
|
* The source of the agent
|
|
18
28
|
*/
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { string_book } from '../../book-2.0/agent-source/string_book';
|
|
2
2
|
import type { CommonToolsOptions } from '../../execution/CommonToolsOptions';
|
|
3
3
|
import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
|
|
4
|
-
import {
|
|
4
|
+
import type { OpenAiAgentKitExecutionTools } from '../openai/OpenAiAgentKitExecutionTools';
|
|
5
|
+
import type { OpenAiAssistantExecutionTools } from '../openai/OpenAiAssistantExecutionTools';
|
|
5
6
|
/**
|
|
6
7
|
* Options for creating AgentLlmExecutionTools
|
|
7
8
|
*/
|
|
@@ -9,7 +10,17 @@ export type CreateAgentLlmExecutionToolsOptions = CommonToolsOptions & {
|
|
|
9
10
|
/**
|
|
10
11
|
* The underlying LLM execution tools to wrap
|
|
11
12
|
*/
|
|
12
|
-
llmTools: LlmExecutionTools | OpenAiAssistantExecutionTools;
|
|
13
|
+
llmTools: LlmExecutionTools | OpenAiAssistantExecutionTools | OpenAiAgentKitExecutionTools;
|
|
14
|
+
/**
|
|
15
|
+
* How to manage OpenAI assistant/AgentKit preparation when using OpenAiAssistantExecutionTools
|
|
16
|
+
* or OpenAiAgentKitExecutionTools.
|
|
17
|
+
*
|
|
18
|
+
* Use `external` when an external cache manager already created the assistant/AgentKit agent
|
|
19
|
+
* and the agent should use it as-is.
|
|
20
|
+
*
|
|
21
|
+
* @default internal
|
|
22
|
+
*/
|
|
23
|
+
assistantPreparationMode?: 'internal' | 'external';
|
|
13
24
|
/**
|
|
14
25
|
* The agent source string that defines the agent's behavior
|
|
15
26
|
*/
|
|
@@ -10,7 +10,8 @@ import type { RemoteAgentOptions } from './RemoteAgentOptions';
|
|
|
10
10
|
* - `Agent` - which represents an AI Agent with its source, memories, actions, etc. Agent is a higher-level abstraction which is internally using:
|
|
11
11
|
* - `LlmExecutionTools` - which wraps one or more LLM models and provides an interface to execute them
|
|
12
12
|
* - `AgentLlmExecutionTools` - which is a specific implementation of `LlmExecutionTools` that wraps another LlmExecutionTools and applies agent-specific system prompts and requirements
|
|
13
|
-
* - `OpenAiAssistantExecutionTools` - which is a specific implementation of `LlmExecutionTools` for OpenAI models with assistant capabilities
|
|
13
|
+
* - `OpenAiAssistantExecutionTools` - (Deprecated) which is a specific implementation of `LlmExecutionTools` for OpenAI models with assistant capabilities
|
|
14
|
+
* - `OpenAiAgentKitExecutionTools` - which is a specific implementation of `LlmExecutionTools` backed by OpenAI AgentKit
|
|
14
15
|
* - `RemoteAgent` - which is an `Agent` that connects to a Promptbook Agents Server
|
|
15
16
|
*
|
|
16
17
|
* @public exported from `@promptbook/core`
|