@promptbook/vercel 0.101.0-2 → 0.101.0-21
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 +10 -1
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/components.index.d.ts +20 -0
- package/esm/typings/src/_packages/core.index.d.ts +14 -0
- package/esm/typings/src/_packages/types.index.d.ts +14 -0
- package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +41 -3
- 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/agent-source/parseParameters.d.ts +13 -0
- package/esm/typings/src/book-2.0/commitments/ACTION/ACTION.d.ts +2 -8
- package/esm/typings/src/book-2.0/commitments/DELETE/DELETE.d.ts +35 -0
- package/esm/typings/src/book-2.0/commitments/FORMAT/FORMAT.d.ts +2 -8
- package/esm/typings/src/book-2.0/commitments/GOAL/GOAL.d.ts +33 -0
- 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 +34 -0
- package/esm/typings/src/book-2.0/commitments/MESSAGE/MESSAGE.d.ts +35 -0
- package/esm/typings/src/book-2.0/commitments/META/META.d.ts +56 -0
- 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 +25 -10
- package/esm/typings/src/book-2.0/commitments/NOTE/NOTE.d.ts +2 -8
- package/esm/typings/src/book-2.0/commitments/PERSONA/PERSONA.d.ts +2 -8
- 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 +34 -0
- package/esm/typings/src/book-2.0/commitments/STYLE/STYLE.d.ts +2 -8
- 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 +7 -3
- 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 +63 -0
- package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/index.d.ts +3 -0
- package/esm/typings/src/book-components/BookEditor/BookEditor.d.ts +18 -0
- package/esm/typings/src/book-components/BookEditor/BookEditorInner.d.ts +2 -12
- package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +29 -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 +1 -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 +10 -1
- 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
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { AgentModelRequirements } from '../../agent-source/AgentModelRequirements';
|
|
2
|
+
import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
3
|
+
/**
|
|
4
|
+
* MEMORY commitment definition
|
|
5
|
+
*
|
|
6
|
+
* The MEMORY commitment is similar to KNOWLEDGE but has a focus on remembering past
|
|
7
|
+
* interactions and user preferences. It helps the agent maintain context about the
|
|
8
|
+
* user's history, preferences, and previous conversations.
|
|
9
|
+
*
|
|
10
|
+
* Example usage in agent source:
|
|
11
|
+
*
|
|
12
|
+
* ```book
|
|
13
|
+
* MEMORY User prefers detailed technical explanations
|
|
14
|
+
* MEMORY Previously worked on React projects
|
|
15
|
+
* MEMORY Timezone: UTC-5 (Eastern Time)
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @private [🪔] Maybe export the commitments through some package
|
|
19
|
+
*/
|
|
20
|
+
export declare class MemoryCommitmentDefinition extends BaseCommitmentDefinition<'MEMORY' | 'MEMORIES'> {
|
|
21
|
+
constructor(type?: 'MEMORY' | 'MEMORIES');
|
|
22
|
+
/**
|
|
23
|
+
* Short one-line description of MEMORY.
|
|
24
|
+
*/
|
|
25
|
+
get description(): string;
|
|
26
|
+
/**
|
|
27
|
+
* Markdown documentation for MEMORY commitment.
|
|
28
|
+
*/
|
|
29
|
+
get documentation(): string;
|
|
30
|
+
applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
34
|
+
*/
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { AgentModelRequirements } from '../../agent-source/AgentModelRequirements';
|
|
2
|
+
import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
3
|
+
/**
|
|
4
|
+
* MESSAGE commitment definition
|
|
5
|
+
*
|
|
6
|
+
* The MESSAGE commitment contains 1:1 text of the message which AI assistant already
|
|
7
|
+
* sent during the conversation. Later messages are later in the conversation.
|
|
8
|
+
* It is similar to EXAMPLE but it is not example, it is the real message which
|
|
9
|
+
* AI assistant already sent.
|
|
10
|
+
*
|
|
11
|
+
* Example usage in agent source:
|
|
12
|
+
*
|
|
13
|
+
* ```book
|
|
14
|
+
* MESSAGE Hello! How can I help you today?
|
|
15
|
+
* MESSAGE I understand you're looking for information about our services.
|
|
16
|
+
* MESSAGE Based on your requirements, I'd recommend our premium package.
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @private [🪔] Maybe export the commitments through some package
|
|
20
|
+
*/
|
|
21
|
+
export declare class MessageCommitmentDefinition extends BaseCommitmentDefinition<'MESSAGE' | 'MESSAGES'> {
|
|
22
|
+
constructor(type?: 'MESSAGE' | 'MESSAGES');
|
|
23
|
+
/**
|
|
24
|
+
* Short one-line description of MESSAGE.
|
|
25
|
+
*/
|
|
26
|
+
get description(): string;
|
|
27
|
+
/**
|
|
28
|
+
* Markdown documentation for MESSAGE commitment.
|
|
29
|
+
*/
|
|
30
|
+
get documentation(): string;
|
|
31
|
+
applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
35
|
+
*/
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { AgentModelRequirements } from '../../agent-source/AgentModelRequirements';
|
|
2
|
+
import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
3
|
+
/**
|
|
4
|
+
* META commitment definition
|
|
5
|
+
*
|
|
6
|
+
* The META commitment handles all meta-information about the agent such as:
|
|
7
|
+
* - META IMAGE: Sets the agent's avatar/profile image URL
|
|
8
|
+
* - META LINK: Provides profile/source links for the person the agent models
|
|
9
|
+
* - META TITLE: Sets the agent's display title
|
|
10
|
+
* - META DESCRIPTION: Sets the agent's description
|
|
11
|
+
* - META [ANYTHING]: Any other meta information in uppercase format
|
|
12
|
+
*
|
|
13
|
+
* These commitments are special because they don't affect the system message,
|
|
14
|
+
* but are handled separately in the parsing logic for profile display.
|
|
15
|
+
*
|
|
16
|
+
* Example usage in agent source:
|
|
17
|
+
*
|
|
18
|
+
* ```book
|
|
19
|
+
* META IMAGE https://example.com/avatar.jpg
|
|
20
|
+
* META LINK https://twitter.com/username
|
|
21
|
+
* META TITLE Professional Assistant
|
|
22
|
+
* META DESCRIPTION An AI assistant specialized in business tasks
|
|
23
|
+
* META AUTHOR John Doe
|
|
24
|
+
* META VERSION 1.0
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @private [🪔] Maybe export the commitments through some package
|
|
28
|
+
*/
|
|
29
|
+
export declare class MetaCommitmentDefinition extends BaseCommitmentDefinition<`META${string}`> {
|
|
30
|
+
constructor();
|
|
31
|
+
/**
|
|
32
|
+
* Short one-line description of META commitments.
|
|
33
|
+
*/
|
|
34
|
+
get description(): string;
|
|
35
|
+
/**
|
|
36
|
+
* Markdown documentation for META commitment.
|
|
37
|
+
*/
|
|
38
|
+
get documentation(): string;
|
|
39
|
+
applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
|
|
40
|
+
/**
|
|
41
|
+
* Extracts meta information from the content based on the meta type
|
|
42
|
+
* This is used by the parsing logic
|
|
43
|
+
*/
|
|
44
|
+
extractMetaValue(metaType: string, content: string): string | null;
|
|
45
|
+
/**
|
|
46
|
+
* Validates if the provided content is a valid URL (for IMAGE and LINK types)
|
|
47
|
+
*/
|
|
48
|
+
isValidUrl(content: string): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Checks if this is a known meta type
|
|
51
|
+
*/
|
|
52
|
+
isKnownMetaType(metaType: string): boolean;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
56
|
+
*/
|
|
@@ -33,12 +33,6 @@ export declare class MetaImageCommitmentDefinition extends BaseCommitmentDefinit
|
|
|
33
33
|
*/
|
|
34
34
|
extractProfileImageUrl(content: string): string | null;
|
|
35
35
|
}
|
|
36
|
-
/**
|
|
37
|
-
* Singleton instance of the META IMAGE commitment definition
|
|
38
|
-
*
|
|
39
|
-
* @private [🪔] Maybe export the commitments through some package
|
|
40
|
-
*/
|
|
41
|
-
export declare const MetaImageCommitment: MetaImageCommitmentDefinition;
|
|
42
36
|
/**
|
|
43
37
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
44
38
|
*/
|
|
@@ -45,12 +45,6 @@ export declare class MetaLinkCommitmentDefinition extends BaseCommitmentDefiniti
|
|
|
45
45
|
*/
|
|
46
46
|
isValidUrl(content: string): boolean;
|
|
47
47
|
}
|
|
48
|
-
/**
|
|
49
|
-
* Singleton instance of the META LINK commitment definition
|
|
50
|
-
*
|
|
51
|
-
* @private [🪔] Maybe export the commitments through some package
|
|
52
|
-
*/
|
|
53
|
-
export declare const MetaLinkCommitment: MetaLinkCommitmentDefinition;
|
|
54
48
|
/**
|
|
55
49
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
56
50
|
*/
|
|
@@ -4,20 +4,29 @@ import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
|
4
4
|
* MODEL commitment definition
|
|
5
5
|
*
|
|
6
6
|
* The MODEL commitment specifies which AI model to use and can also set
|
|
7
|
-
* model-specific parameters like temperature, topP, and
|
|
7
|
+
* model-specific parameters like temperature, topP, topK, and maxTokens.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
9
|
+
* Supports multiple syntax variations:
|
|
10
10
|
*
|
|
11
|
+
* Single-line format:
|
|
11
12
|
* ```book
|
|
12
13
|
* MODEL gpt-4
|
|
13
14
|
* MODEL claude-3-opus temperature=0.3
|
|
14
15
|
* MODEL gpt-3.5-turbo temperature=0.8 topP=0.9
|
|
15
16
|
* ```
|
|
16
17
|
*
|
|
18
|
+
* Multi-line named parameter format:
|
|
19
|
+
* ```book
|
|
20
|
+
* MODEL NAME gpt-4
|
|
21
|
+
* MODEL TEMPERATURE 0.7
|
|
22
|
+
* MODEL TOP_P 0.9
|
|
23
|
+
* MODEL MAX_TOKENS 2048
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
17
26
|
* @private [🪔] Maybe export the commitments through some package
|
|
18
27
|
*/
|
|
19
|
-
export declare class ModelCommitmentDefinition extends BaseCommitmentDefinition<'MODEL'> {
|
|
20
|
-
constructor();
|
|
28
|
+
export declare class ModelCommitmentDefinition extends BaseCommitmentDefinition<'MODEL' | 'MODELS'> {
|
|
29
|
+
constructor(type?: 'MODEL' | 'MODELS');
|
|
21
30
|
/**
|
|
22
31
|
* Short one-line description of MODEL.
|
|
23
32
|
*/
|
|
@@ -27,13 +36,19 @@ export declare class ModelCommitmentDefinition extends BaseCommitmentDefinition<
|
|
|
27
36
|
*/
|
|
28
37
|
get documentation(): string;
|
|
29
38
|
applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
|
|
39
|
+
/**
|
|
40
|
+
* Check if the first part is a known named parameter
|
|
41
|
+
*/
|
|
42
|
+
private isNamedParameter;
|
|
43
|
+
/**
|
|
44
|
+
* Parse the new named parameter format: "MODEL TEMPERATURE 0.7"
|
|
45
|
+
*/
|
|
46
|
+
private parseNamedParameter;
|
|
47
|
+
/**
|
|
48
|
+
* Parse the legacy format: "MODEL gpt-4 temperature=0.3 topP=0.9"
|
|
49
|
+
*/
|
|
50
|
+
private parseLegacyFormat;
|
|
30
51
|
}
|
|
31
|
-
/**
|
|
32
|
-
* Singleton instance of the MODEL commitment definition
|
|
33
|
-
*
|
|
34
|
-
* @private [🪔] Maybe export the commitments through some package
|
|
35
|
-
*/
|
|
36
|
-
export declare const ModelCommitment: ModelCommitmentDefinition;
|
|
37
52
|
/**
|
|
38
53
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
39
54
|
*/
|
|
@@ -26,8 +26,8 @@ import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
|
26
26
|
*
|
|
27
27
|
* @private [🪔] Maybe export the commitments through some package
|
|
28
28
|
*/
|
|
29
|
-
export declare class NoteCommitmentDefinition extends BaseCommitmentDefinition<'NOTE'> {
|
|
30
|
-
constructor();
|
|
29
|
+
export declare class NoteCommitmentDefinition extends BaseCommitmentDefinition<'NOTE' | 'NOTES' | 'COMMENT' | 'NONCE'> {
|
|
30
|
+
constructor(type?: 'NOTE' | 'NOTES' | 'COMMENT' | 'NONCE');
|
|
31
31
|
/**
|
|
32
32
|
* Short one-line description of NOTE.
|
|
33
33
|
*/
|
|
@@ -38,12 +38,6 @@ export declare class NoteCommitmentDefinition extends BaseCommitmentDefinition<'
|
|
|
38
38
|
get documentation(): string;
|
|
39
39
|
applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
|
|
40
40
|
}
|
|
41
|
-
/**
|
|
42
|
-
* Singleton instance of the NOTE commitment definition
|
|
43
|
-
*
|
|
44
|
-
* @private [🪔] Maybe export the commitments through some package
|
|
45
|
-
*/
|
|
46
|
-
export declare const NoteCommitment: NoteCommitmentDefinition;
|
|
47
41
|
/**
|
|
48
42
|
* [💞] Ignore a discrepancy between file name and entity name
|
|
49
43
|
*/
|
|
@@ -23,8 +23,8 @@ import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
|
23
23
|
*
|
|
24
24
|
* @private [🪔] Maybe export the commitments through some package
|
|
25
25
|
*/
|
|
26
|
-
export declare class PersonaCommitmentDefinition extends BaseCommitmentDefinition<'PERSONA'> {
|
|
27
|
-
constructor();
|
|
26
|
+
export declare class PersonaCommitmentDefinition extends BaseCommitmentDefinition<'PERSONA' | 'PERSONAE'> {
|
|
27
|
+
constructor(type?: 'PERSONA' | 'PERSONAE');
|
|
28
28
|
/**
|
|
29
29
|
* Short one-line description of PERSONA.
|
|
30
30
|
*/
|
|
@@ -35,12 +35,6 @@ export declare class PersonaCommitmentDefinition extends BaseCommitmentDefinitio
|
|
|
35
35
|
get documentation(): string;
|
|
36
36
|
applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
|
|
37
37
|
}
|
|
38
|
-
/**
|
|
39
|
-
* Singleton instance of the PERSONA commitment definition
|
|
40
|
-
*
|
|
41
|
-
* @private [🪔] Maybe export the commitments through some package
|
|
42
|
-
*/
|
|
43
|
-
export declare const PersonaCommitment: PersonaCommitmentDefinition;
|
|
44
38
|
/**
|
|
45
39
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
46
40
|
*/
|
|
@@ -27,18 +27,6 @@ export declare class RuleCommitmentDefinition extends BaseCommitmentDefinition<'
|
|
|
27
27
|
get documentation(): string;
|
|
28
28
|
applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
|
|
29
29
|
}
|
|
30
|
-
/**
|
|
31
|
-
* Singleton instances of the RULE commitment definitions
|
|
32
|
-
*
|
|
33
|
-
* @private [🪔] Maybe export the commitments through some package
|
|
34
|
-
*/
|
|
35
|
-
export declare const RuleCommitment: RuleCommitmentDefinition;
|
|
36
|
-
/**
|
|
37
|
-
* Singleton instances of the RULE commitment definitions
|
|
38
|
-
*
|
|
39
|
-
* @private [🪔] Maybe export the commitments through some package
|
|
40
|
-
*/
|
|
41
|
-
export declare const RulesCommitment: RuleCommitmentDefinition;
|
|
42
30
|
/**
|
|
43
31
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
44
32
|
*/
|
|
@@ -27,18 +27,6 @@ export declare class SampleCommitmentDefinition extends BaseCommitmentDefinition
|
|
|
27
27
|
get documentation(): string;
|
|
28
28
|
applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
|
|
29
29
|
}
|
|
30
|
-
/**
|
|
31
|
-
* Singleton instances of the SAMPLE commitment definitions
|
|
32
|
-
*
|
|
33
|
-
* @private [🪔] Maybe export the commitments through some package
|
|
34
|
-
*/
|
|
35
|
-
export declare const SampleCommitment: SampleCommitmentDefinition;
|
|
36
|
-
/**
|
|
37
|
-
* Singleton instances of the SAMPLE commitment definitions
|
|
38
|
-
*
|
|
39
|
-
* @private [🪔] Maybe export the commitments through some package
|
|
40
|
-
*/
|
|
41
|
-
export declare const ExampleCommitment: SampleCommitmentDefinition;
|
|
42
30
|
/**
|
|
43
31
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
44
32
|
*/
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { AgentModelRequirements } from '../../agent-source/AgentModelRequirements';
|
|
2
|
+
import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
3
|
+
/**
|
|
4
|
+
* SCENARIO commitment definition
|
|
5
|
+
*
|
|
6
|
+
* The SCENARIO commitment defines a specific situation or context in which the AI
|
|
7
|
+
* assistant should operate. It helps to set the scene for the AI's responses.
|
|
8
|
+
* Later scenarios are more important than earlier scenarios.
|
|
9
|
+
*
|
|
10
|
+
* Example usage in agent source:
|
|
11
|
+
*
|
|
12
|
+
* ```book
|
|
13
|
+
* SCENARIO You are in a customer service call center during peak hours
|
|
14
|
+
* SCENARIO The customer is frustrated and has been on hold for 20 minutes
|
|
15
|
+
* SCENARIO This is the customer's third call about the same issue
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @private [🪔] Maybe export the commitments through some package
|
|
19
|
+
*/
|
|
20
|
+
export declare class ScenarioCommitmentDefinition extends BaseCommitmentDefinition<'SCENARIO' | 'SCENARIOS'> {
|
|
21
|
+
constructor(type?: 'SCENARIO' | 'SCENARIOS');
|
|
22
|
+
/**
|
|
23
|
+
* Short one-line description of SCENARIO.
|
|
24
|
+
*/
|
|
25
|
+
get description(): string;
|
|
26
|
+
/**
|
|
27
|
+
* Markdown documentation for SCENARIO commitment.
|
|
28
|
+
*/
|
|
29
|
+
get documentation(): string;
|
|
30
|
+
applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
34
|
+
*/
|
|
@@ -15,8 +15,8 @@ import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
|
15
15
|
*
|
|
16
16
|
* @private [🪔] Maybe export the commitments through some package
|
|
17
17
|
*/
|
|
18
|
-
export declare class StyleCommitmentDefinition extends BaseCommitmentDefinition<'STYLE'> {
|
|
19
|
-
constructor();
|
|
18
|
+
export declare class StyleCommitmentDefinition extends BaseCommitmentDefinition<'STYLE' | 'STYLES'> {
|
|
19
|
+
constructor(type?: 'STYLE' | 'STYLES');
|
|
20
20
|
/**
|
|
21
21
|
* Short one-line description of STYLE.
|
|
22
22
|
*/
|
|
@@ -27,12 +27,6 @@ export declare class StyleCommitmentDefinition extends BaseCommitmentDefinition<
|
|
|
27
27
|
get documentation(): string;
|
|
28
28
|
applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
|
|
29
29
|
}
|
|
30
|
-
/**
|
|
31
|
-
* Singleton instance of the STYLE commitment definition
|
|
32
|
-
*
|
|
33
|
-
* @private [🪔] Maybe export the commitments through some package
|
|
34
|
-
*/
|
|
35
|
-
export declare const StyleCommitment: StyleCommitmentDefinition;
|
|
36
30
|
/**
|
|
37
31
|
* [💞] Ignore a discrepancy between file name and entity name
|
|
38
32
|
*/
|
|
@@ -15,5 +15,5 @@ export declare function createEmptyAgentModelRequirements(): AgentModelRequireme
|
|
|
15
15
|
*/
|
|
16
16
|
export declare function createBasicAgentModelRequirements(agentName: string | null): AgentModelRequirements;
|
|
17
17
|
/**
|
|
18
|
-
* TODO:
|
|
18
|
+
* TODO: [🐤] Deduplicate `AgentModelRequirements` and `ModelRequirements` model requirements
|
|
19
19
|
*/
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import type { BookCommitment } from './_base/BookCommitment';
|
|
2
2
|
import type { CommitmentDefinition } from './_base/CommitmentDefinition';
|
|
3
3
|
import { ActionCommitmentDefinition } from './ACTION/ACTION';
|
|
4
|
+
import { DeleteCommitmentDefinition } from './DELETE/DELETE';
|
|
4
5
|
import { FormatCommitmentDefinition } from './FORMAT/FORMAT';
|
|
6
|
+
import { GoalCommitmentDefinition } from './GOAL/GOAL';
|
|
5
7
|
import { KnowledgeCommitmentDefinition } from './KNOWLEDGE/KNOWLEDGE';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
+
import { MemoryCommitmentDefinition } from './MEMORY/MEMORY';
|
|
9
|
+
import { MessageCommitmentDefinition } from './MESSAGE/MESSAGE';
|
|
10
|
+
import { MetaCommitmentDefinition } from './META/META';
|
|
8
11
|
import { ModelCommitmentDefinition } from './MODEL/MODEL';
|
|
9
12
|
import { NoteCommitmentDefinition } from './NOTE/NOTE';
|
|
10
13
|
import { PersonaCommitmentDefinition } from './PERSONA/PERSONA';
|
|
11
14
|
import { RuleCommitmentDefinition } from './RULE/RULE';
|
|
12
15
|
import { SampleCommitmentDefinition } from './SAMPLE/SAMPLE';
|
|
16
|
+
import { ScenarioCommitmentDefinition } from './SCENARIO/SCENARIO';
|
|
13
17
|
import { StyleCommitmentDefinition } from './STYLE/STYLE';
|
|
14
18
|
import { NotYetImplementedCommitmentDefinition } from './_base/NotYetImplementedCommitmentDefinition';
|
|
15
19
|
/**
|
|
@@ -19,7 +23,7 @@ import { NotYetImplementedCommitmentDefinition } from './_base/NotYetImplemented
|
|
|
19
23
|
*
|
|
20
24
|
* @private Use functions to access commitments instead of this array directly
|
|
21
25
|
*/
|
|
22
|
-
export declare const COMMITMENT_REGISTRY: readonly [PersonaCommitmentDefinition, KnowledgeCommitmentDefinition, StyleCommitmentDefinition, RuleCommitmentDefinition, RuleCommitmentDefinition, SampleCommitmentDefinition, SampleCommitmentDefinition, FormatCommitmentDefinition, ModelCommitmentDefinition, ActionCommitmentDefinition,
|
|
26
|
+
export declare const COMMITMENT_REGISTRY: readonly [PersonaCommitmentDefinition, PersonaCommitmentDefinition, KnowledgeCommitmentDefinition, MemoryCommitmentDefinition, MemoryCommitmentDefinition, StyleCommitmentDefinition, StyleCommitmentDefinition, RuleCommitmentDefinition, RuleCommitmentDefinition, SampleCommitmentDefinition, SampleCommitmentDefinition, FormatCommitmentDefinition, FormatCommitmentDefinition, ModelCommitmentDefinition, ModelCommitmentDefinition, ActionCommitmentDefinition, ActionCommitmentDefinition, MetaCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, GoalCommitmentDefinition, GoalCommitmentDefinition, MessageCommitmentDefinition, MessageCommitmentDefinition, ScenarioCommitmentDefinition, ScenarioCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, NotYetImplementedCommitmentDefinition<"EXPECT">, NotYetImplementedCommitmentDefinition<"BEHAVIOUR">, NotYetImplementedCommitmentDefinition<"BEHAVIOURS">, NotYetImplementedCommitmentDefinition<"AVOID">, NotYetImplementedCommitmentDefinition<"AVOIDANCE">, NotYetImplementedCommitmentDefinition<"CONTEXT">];
|
|
23
27
|
/**
|
|
24
28
|
* Gets a commitment definition by its type
|
|
25
29
|
* @param type The commitment type to look up
|
|
@@ -8,3 +8,6 @@ import { string_agent_name, string_url_image } from '../../types/typeAliases';
|
|
|
8
8
|
* @public exported from `@promptbook/core`
|
|
9
9
|
*/
|
|
10
10
|
export declare function generatePlaceholderAgentProfileImageUrl(agentName?: string_agent_name): string_url_image;
|
|
11
|
+
/**
|
|
12
|
+
* TODO: [🤹] Figure out best placeholder image generator https://i.pravatar.cc/1000?u=568
|
|
13
|
+
*/
|
|
@@ -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
|
+
*/
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { ChatProps } from '../../Chat/Chat/ChatProps';
|
|
2
|
+
/**
|
|
3
|
+
* Delay configuration for the MockedChat component
|
|
4
|
+
*
|
|
5
|
+
* @public exported from `@promptbook/components`
|
|
6
|
+
*/
|
|
7
|
+
export type MockedChatDelayConfig = {
|
|
8
|
+
/**
|
|
9
|
+
* Delay before showing the first message (in milliseconds)
|
|
10
|
+
* @default 1000
|
|
11
|
+
*/
|
|
12
|
+
beforeFirstMessage?: number;
|
|
13
|
+
/**
|
|
14
|
+
* Emulated thinking time between messages (in milliseconds)
|
|
15
|
+
* @default 2000
|
|
16
|
+
*/
|
|
17
|
+
thinkingBetweenMessages?: number;
|
|
18
|
+
/**
|
|
19
|
+
* Wait time after each written word (in milliseconds)
|
|
20
|
+
* @default 100
|
|
21
|
+
*/
|
|
22
|
+
waitAfterWord?: number;
|
|
23
|
+
/**
|
|
24
|
+
* Extra delay on top of the word waiting (in milliseconds)
|
|
25
|
+
* @default 50
|
|
26
|
+
*/
|
|
27
|
+
extraWordDelay?: number;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Props for MockedChat component
|
|
31
|
+
*
|
|
32
|
+
* @public exported from `@promptbook/components`
|
|
33
|
+
*/
|
|
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;
|
|
44
|
+
/**
|
|
45
|
+
* Optional delays configuration for emulating typing behavior
|
|
46
|
+
*/
|
|
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;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* MockedChat component that shows the same chat as Chat but emulates ongoing discussion
|
|
59
|
+
* with realistic typing delays and thinking pauses.
|
|
60
|
+
*
|
|
61
|
+
* @public exported from `@promptbook/components`
|
|
62
|
+
*/
|
|
63
|
+
export declare function MockedChat(props: MockedChatProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { CSSProperties } from 'react';
|
|
2
|
+
import type { Promisable } from 'type-fest';
|
|
2
3
|
import type { string_book } from '../../book-2.0/agent-source/string_book';
|
|
4
|
+
import { string_knowledge_source_content } from '../../types/typeAliases';
|
|
3
5
|
/**
|
|
4
6
|
* Props of `BookEditor`
|
|
5
7
|
*
|
|
@@ -27,10 +29,23 @@ export type BookEditorProps = {
|
|
|
27
29
|
* Callback function to handle changes in the book content.
|
|
28
30
|
*/
|
|
29
31
|
onChange?(value: string_book): void;
|
|
32
|
+
/**
|
|
33
|
+
* returns the URL of the uploaded file on CDN or storage
|
|
34
|
+
*/
|
|
35
|
+
onFileUpload?(file: File): Promisable<string_knowledge_source_content>;
|
|
30
36
|
/**
|
|
31
37
|
* If true, logs verbose debug info to the console and shows additional visual cues
|
|
32
38
|
*/
|
|
33
39
|
readonly isVerbose?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* If true, disables border radius making the editor have sharp corners
|
|
42
|
+
*/
|
|
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;
|
|
34
49
|
};
|
|
35
50
|
/**
|
|
36
51
|
* Renders a book editor
|
|
@@ -38,3 +53,6 @@ export type BookEditorProps = {
|
|
|
38
53
|
* @public exported from `@promptbook/components`
|
|
39
54
|
*/
|
|
40
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,15 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { BookEditorProps } from './BookEditor';
|
|
2
2
|
/**
|
|
3
3
|
* @private util of `<BookEditor />`
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
6
|
-
className?: string;
|
|
7
|
-
fontClassName?: string;
|
|
8
|
-
value?: string_book;
|
|
9
|
-
onChange?(value: string_book): void;
|
|
10
|
-
isVerbose?: boolean;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* @private util of `<BookEditor />`
|
|
14
|
-
*/
|
|
15
|
-
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
|
*/
|
|
@@ -119,4 +125,27 @@ export type ChatProps = {
|
|
|
119
125
|
* Keys should match ChatMessage.from values (e.g., 'USER', 'AGENT_{id}', etc.)
|
|
120
126
|
*/
|
|
121
127
|
readonly participants?: ReadonlyArray<ChatParticipant>;
|
|
128
|
+
/**
|
|
129
|
+
* Optional callback for handling user feedback on messages
|
|
130
|
+
* When provided, star rating buttons (1-5 stars) will be displayed next to each message
|
|
131
|
+
*
|
|
132
|
+
* @param feedback - Object containing the feedback data
|
|
133
|
+
* @param feedback.message - The message being rated
|
|
134
|
+
* @param feedback.rating - Star rating from 1 to 5
|
|
135
|
+
* @param feedback.textRating - Optional text feedback/note from user
|
|
136
|
+
* @param feedback.chatThread - Complete chat thread as string
|
|
137
|
+
* @param feedback.expectedAnswer - Optional expected answer provided by user
|
|
138
|
+
* @param feedback.url - Current page URL where feedback was given
|
|
139
|
+
*/
|
|
140
|
+
onFeedback?(feedback: {
|
|
141
|
+
message: ChatMessage;
|
|
142
|
+
rating: number;
|
|
143
|
+
textRating: string;
|
|
144
|
+
chatThread: string;
|
|
145
|
+
expectedAnswer: string | null;
|
|
146
|
+
url: string;
|
|
147
|
+
}): Promisable<void>;
|
|
122
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
|
};
|