@promptbook/color 0.105.0-3 → 0.105.0-31
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 +36 -77
- package/esm/index.es.js +1 -1
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/browser.index.d.ts +4 -0
- package/esm/typings/src/_packages/components.index.d.ts +20 -0
- package/esm/typings/src/_packages/core.index.d.ts +19 -11
- package/esm/typings/src/_packages/node.index.d.ts +2 -0
- package/esm/typings/src/_packages/openai.index.d.ts +2 -0
- package/esm/typings/src/_packages/types.index.d.ts +44 -2
- package/esm/typings/src/_packages/utils.index.d.ts +4 -0
- package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +6 -1
- package/esm/typings/src/book-2.0/agent-source/parseTeamCommitment.d.ts +28 -0
- package/esm/typings/src/book-components/Chat/AgentChat/AgentChatProps.d.ts +5 -0
- package/esm/typings/src/book-components/Chat/AgentChip/AgentChip.d.ts +67 -0
- package/esm/typings/src/book-components/Chat/AgentChip/index.d.ts +2 -0
- package/esm/typings/src/book-components/Chat/Chat/ChatMessageItem.d.ts +33 -1
- package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +89 -11
- package/esm/typings/src/book-components/Chat/Chat/ChatSoundToggle.d.ts +23 -0
- package/esm/typings/src/book-components/Chat/Chat/ClockIcon.d.ts +9 -0
- package/esm/typings/src/book-components/Chat/LlmChat/FriendlyErrorMessage.d.ts +20 -0
- package/esm/typings/src/book-components/Chat/LlmChat/LlmChatProps.d.ts +13 -0
- package/esm/typings/src/book-components/Chat/SourceChip/SourceChip.d.ts +35 -0
- package/esm/typings/src/book-components/Chat/SourceChip/index.d.ts +2 -0
- package/esm/typings/src/book-components/Chat/effects/ChatEffectsSystem.d.ts +14 -0
- package/esm/typings/src/book-components/Chat/effects/components/ConfettiEffect.d.ts +18 -0
- package/esm/typings/src/book-components/Chat/effects/components/HeartsEffect.d.ts +18 -0
- package/esm/typings/src/book-components/Chat/effects/configs/defaultEffectConfigs.d.ts +7 -0
- package/esm/typings/src/book-components/Chat/effects/index.d.ts +18 -0
- package/esm/typings/src/book-components/Chat/effects/types/ChatEffect.d.ts +20 -0
- package/esm/typings/src/book-components/Chat/effects/types/ChatEffectConfig.d.ts +21 -0
- package/esm/typings/src/book-components/Chat/effects/types/ChatEffectType.d.ts +6 -0
- package/esm/typings/src/book-components/Chat/effects/types/ChatEffectsSystemProps.d.ts +32 -0
- package/esm/typings/src/book-components/Chat/effects/utils/detectEffects.d.ts +12 -0
- package/esm/typings/src/book-components/Chat/types/ChatMessage.d.ts +37 -0
- package/esm/typings/src/book-components/Chat/utils/createTeamToolNameFromUrl.d.ts +12 -0
- package/esm/typings/src/book-components/Chat/utils/getToolCallChipletText.d.ts +40 -0
- package/esm/typings/src/book-components/Chat/utils/loadAgentProfile.d.ts +69 -0
- package/esm/typings/src/book-components/Chat/utils/parseCitationsFromContent.d.ts +53 -0
- package/esm/typings/src/book-components/Chat/utils/resolveCitationUrl.d.ts +11 -0
- package/esm/typings/src/book-components/Chat/utils/toolCallParsing.d.ts +64 -0
- package/esm/typings/src/book-components/icons/EmailIcon.d.ts +15 -0
- package/esm/typings/src/commitments/NOTE/NOTE.d.ts +2 -2
- package/esm/typings/src/commitments/TEAM/TEAM.d.ts +45 -0
- package/esm/typings/src/commitments/TEMPLATE/TEMPLATE.d.ts +44 -0
- package/esm/typings/src/commitments/TEMPLATE/TEMPLATE.test.d.ts +1 -0
- package/esm/typings/src/commitments/USE_BROWSER/USE_BROWSER.d.ts +19 -1
- package/esm/typings/src/commitments/USE_BROWSER/fetchUrlContent.d.ts +22 -0
- package/esm/typings/src/commitments/USE_BROWSER/fetchUrlContentViaBrowser.d.ts +13 -0
- package/esm/typings/src/commitments/USE_EMAIL/USE_EMAIL.d.ts +48 -0
- package/esm/typings/src/commitments/USE_EMAIL/resolveSendEmailToolForNode.d.ts +11 -0
- package/esm/typings/src/commitments/USE_EMAIL/sendEmailViaBrowser.d.ts +18 -0
- package/esm/typings/src/commitments/USE_IMAGE_GENERATOR/USE_IMAGE_GENERATOR.d.ts +46 -0
- package/esm/typings/src/commitments/USE_IMAGE_GENERATOR/USE_IMAGE_GENERATOR.test.d.ts +1 -0
- package/esm/typings/src/commitments/USE_SEARCH_ENGINE/USE_SEARCH_ENGINE.d.ts +11 -0
- package/esm/typings/src/commitments/USE_SEARCH_ENGINE/USE_SEARCH_ENGINE.test.d.ts +1 -0
- package/esm/typings/src/commitments/USE_TIME/USE_TIME.d.ts +6 -0
- package/esm/typings/src/commitments/_base/BaseCommitmentDefinition.d.ts +6 -0
- package/esm/typings/src/commitments/_base/CommitmentDefinition.d.ts +6 -0
- package/esm/typings/src/commitments/_base/formatOptionalInstructionBlock.d.ts +6 -0
- package/esm/typings/src/commitments/_common/commitmentToolFunctions.d.ts +26 -0
- package/esm/typings/src/commitments/_common/getAllCommitmentDefinitions.d.ts +8 -0
- package/esm/typings/src/commitments/_common/getAllCommitmentTypes.d.ts +8 -0
- package/esm/typings/src/commitments/_common/getAllCommitmentsToolFunctionsForBrowser.d.ts +9 -0
- package/esm/typings/src/commitments/_common/getAllCommitmentsToolFunctionsForNode.d.ts +13 -0
- package/esm/typings/src/commitments/_common/getAllCommitmentsToolTitles.d.ts +7 -0
- package/esm/typings/src/commitments/_common/getCommitmentDefinition.d.ts +10 -0
- package/esm/typings/src/commitments/_common/getGroupedCommitmentDefinitions.d.ts +17 -0
- package/esm/typings/src/commitments/_common/isCommitmentSupported.d.ts +9 -0
- package/esm/typings/src/commitments/index.d.ts +5 -58
- package/esm/typings/src/constants.d.ts +129 -0
- package/esm/typings/src/executables/$provideExecutablesForNode.d.ts +1 -0
- package/esm/typings/src/execution/AvailableModel.d.ts +5 -4
- package/esm/typings/src/execution/LlmExecutionTools.d.ts +3 -1
- package/esm/typings/src/execution/PromptResult.d.ts +2 -19
- package/esm/typings/src/execution/utils/$provideExecutionToolsForNode.d.ts +1 -0
- package/esm/typings/src/llm-providers/agent/Agent.d.ts +7 -1
- package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +6 -1
- package/esm/typings/src/llm-providers/agent/AgentOptions.d.ts +7 -0
- package/esm/typings/src/llm-providers/agent/RemoteAgent.d.ts +1 -0
- package/esm/typings/src/llm-providers/agent/RemoteAgentOptions.d.ts +1 -1
- package/esm/typings/src/llm-providers/google/createGoogleExecutionTools.d.ts +1 -0
- package/esm/typings/src/llm-providers/openai/OpenAiAgentExecutionTools.d.ts +43 -0
- package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +4 -2
- package/esm/typings/src/llm-providers/openai/OpenAiCompatibleExecutionTools.d.ts +8 -1
- package/esm/typings/src/llm-providers/openai/utils/uploadFilesToOpenAi.d.ts +7 -0
- package/esm/typings/src/pipeline/prompt-notation.d.ts +27 -2
- package/esm/typings/src/pipeline/prompt-notation.test.d.ts +1 -1
- package/esm/typings/src/scrapers/_common/register/$provideFilesystemForNode.d.ts +1 -0
- package/esm/typings/src/scrapers/_common/register/$provideScrapersForNode.d.ts +1 -0
- package/esm/typings/src/scrapers/_common/register/$provideScriptingForNode.d.ts +1 -0
- package/esm/typings/src/search-engines/SearchEngine.d.ts +1 -1
- package/esm/typings/src/search-engines/_index.d.ts +6 -0
- package/esm/typings/src/search-engines/bing/BingSearchEngine.d.ts +1 -1
- package/esm/typings/src/search-engines/dummy/DummySearchEngine.d.ts +1 -1
- package/esm/typings/src/search-engines/google/GoogleSearchEngine.d.ts +18 -0
- package/esm/typings/src/search-engines/serp/SerpSearchEngine.d.ts +15 -0
- package/esm/typings/src/speech-recognition/BrowserSpeechRecognition.d.ts +21 -0
- package/esm/typings/src/speech-recognition/OpenAiSpeechRecognition.d.ts +35 -0
- package/esm/typings/src/types/ModelRequirements.d.ts +6 -0
- package/esm/typings/src/types/Prompt.d.ts +12 -0
- package/esm/typings/src/types/SpeechRecognition.d.ts +58 -0
- package/esm/typings/src/types/ToolCall.d.ts +37 -0
- package/esm/typings/src/types/typeAliases.d.ts +4 -0
- package/esm/typings/src/utils/misc/linguisticHash.d.ts +6 -0
- package/esm/typings/src/utils/misc/linguisticHash.test.d.ts +1 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/esm/typings/src/wizard/wizard.d.ts +1 -4
- package/package.json +2 -2
- package/umd/index.umd.js +1 -1
- package/umd/index.umd.js.map +1 -1
|
@@ -14,7 +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
|
-
* - `
|
|
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
|
+
* - `OpenAiAssistantExecutionTools` - (Deprecated) which is a specific implementation of `LlmExecutionTools` for OpenAI models with assistant capabilities
|
|
18
19
|
* - `RemoteAgent` - which is an `Agent` that connects to a Promptbook Agents Server
|
|
19
20
|
*
|
|
20
21
|
* @public exported from `@promptbook/core`
|
|
@@ -67,11 +68,16 @@ export declare class Agent extends AgentLlmExecutionTools implements LlmExecutio
|
|
|
67
68
|
description?: string;
|
|
68
69
|
[key: string]: string | undefined;
|
|
69
70
|
};
|
|
71
|
+
/**
|
|
72
|
+
* Human-readable titles for tool functions
|
|
73
|
+
*/
|
|
74
|
+
toolTitles: Record<string, string>;
|
|
70
75
|
/**
|
|
71
76
|
* Not used in Agent, always returns empty array
|
|
72
77
|
*/
|
|
73
78
|
get parameters(): Array<BookParameter>;
|
|
74
79
|
readonly agentSource: BehaviorSubject<string_book>;
|
|
80
|
+
private readonly teacherAgent;
|
|
75
81
|
constructor(options: AgentOptions);
|
|
76
82
|
/**
|
|
77
83
|
* Calls the chat model with agent-specific system prompt and requirements with streaming
|
|
@@ -16,7 +16,8 @@ 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
|
-
* - `
|
|
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
|
+
* - `OpenAiAssistantExecutionTools` - (Deprecated) which is a specific implementation of `LlmExecutionTools` for OpenAI models with assistant capabilities
|
|
20
21
|
* - `RemoteAgent` - which is an `Agent` that connects to a Promptbook Agents Server
|
|
21
22
|
*
|
|
22
23
|
* @public exported from `@promptbook/core`
|
|
@@ -27,6 +28,10 @@ export declare class AgentLlmExecutionTools implements LlmExecutionTools {
|
|
|
27
28
|
* Cache of OpenAI assistants to avoid creating duplicates
|
|
28
29
|
*/
|
|
29
30
|
private static assistantCache;
|
|
31
|
+
/**
|
|
32
|
+
* Cache of OpenAI vector stores to avoid creating duplicates
|
|
33
|
+
*/
|
|
34
|
+
private static vectorStoreCache;
|
|
30
35
|
/**
|
|
31
36
|
* Cached model requirements to avoid re-parsing the agent source
|
|
32
37
|
*/
|
|
@@ -2,6 +2,7 @@ import type { string_book } from '../../book-2.0/agent-source/string_book';
|
|
|
2
2
|
import type { CommonToolsOptions } from '../../execution/CommonToolsOptions';
|
|
3
3
|
import type { ExecutionTools } from '../../execution/ExecutionTools';
|
|
4
4
|
import type { Updatable } from '../../types/Updatable';
|
|
5
|
+
import { Agent } from './Agent';
|
|
5
6
|
/**
|
|
6
7
|
* Options for creating an Agent
|
|
7
8
|
*/
|
|
@@ -16,4 +17,10 @@ export type AgentOptions = CommonToolsOptions & {
|
|
|
16
17
|
* The source of the agent
|
|
17
18
|
*/
|
|
18
19
|
agentSource: Updatable<string_book>;
|
|
20
|
+
/**
|
|
21
|
+
* Teacher agent for self-learning
|
|
22
|
+
*
|
|
23
|
+
* Note: If provided, the agent can do full self-learning from the teacher agent during its operation.
|
|
24
|
+
*/
|
|
25
|
+
teacherAgent: Agent | null;
|
|
19
26
|
};
|
|
@@ -23,6 +23,7 @@ export declare class RemoteAgent extends Agent {
|
|
|
23
23
|
private agentUrl;
|
|
24
24
|
private _remoteAgentName;
|
|
25
25
|
private _remoteAgentHash;
|
|
26
|
+
toolTitles: Record<string, string>;
|
|
26
27
|
private _isVoiceCallingEnabled;
|
|
27
28
|
private constructor();
|
|
28
29
|
get agentName(): string_agent_name;
|
|
@@ -3,7 +3,7 @@ import type { string_agent_url } from '../../types/typeAliases';
|
|
|
3
3
|
/**
|
|
4
4
|
* Options for creating a Remote Agent
|
|
5
5
|
*/
|
|
6
|
-
export type RemoteAgentOptions = CommonToolsOptions & {
|
|
6
|
+
export type RemoteAgentOptions = Omit<CommonToolsOptions, 'teacherAgent'> & {
|
|
7
7
|
/**
|
|
8
8
|
* Url of the remote agent
|
|
9
9
|
*/
|
|
@@ -10,5 +10,6 @@ export declare const createGoogleExecutionTools: ((options: GoogleExecutionTools
|
|
|
10
10
|
className: string;
|
|
11
11
|
};
|
|
12
12
|
/**
|
|
13
|
+
* TODO: !!!!! Rename to `createGoogleLlmExecutionTools`, `...GoogleLlmExecutionTools`
|
|
13
14
|
* TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
|
|
14
15
|
*/
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import OpenAI from 'openai';
|
|
2
|
+
import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
|
|
3
|
+
import type { ChatPromptResult } from '../../execution/PromptResult';
|
|
4
|
+
import type { Prompt } from '../../types/Prompt';
|
|
5
|
+
import type { string_markdown, string_markdown_text, string_title } from '../../types/typeAliases';
|
|
6
|
+
import type { OpenAiCompatibleExecutionToolsNonProxiedOptions } from './OpenAiCompatibleExecutionToolsOptions';
|
|
7
|
+
import { OpenAiExecutionTools } from './OpenAiExecutionTools';
|
|
8
|
+
/**
|
|
9
|
+
* Options for OpenAiAgentExecutionTools
|
|
10
|
+
*/
|
|
11
|
+
export type OpenAiAgentExecutionToolsOptions = OpenAiCompatibleExecutionToolsNonProxiedOptions & {
|
|
12
|
+
/**
|
|
13
|
+
* ID of the vector store to use for file search
|
|
14
|
+
*/
|
|
15
|
+
readonly vectorStoreId?: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Execution Tools for calling OpenAI API using the Responses API (Agents)
|
|
19
|
+
*
|
|
20
|
+
* @public exported from `@promptbook/openai`
|
|
21
|
+
*/
|
|
22
|
+
export declare class OpenAiAgentExecutionTools extends OpenAiExecutionTools implements LlmExecutionTools {
|
|
23
|
+
readonly vectorStoreId?: string;
|
|
24
|
+
constructor(options: OpenAiAgentExecutionToolsOptions);
|
|
25
|
+
get title(): string_title & string_markdown_text;
|
|
26
|
+
get description(): string_markdown;
|
|
27
|
+
/**
|
|
28
|
+
* Calls OpenAI API to use a chat model with streaming.
|
|
29
|
+
*/
|
|
30
|
+
callChatModelStream(prompt: Prompt, onProgress: (chunk: ChatPromptResult) => void): Promise<ChatPromptResult>;
|
|
31
|
+
/**
|
|
32
|
+
* Creates a vector store from knowledge sources
|
|
33
|
+
*/
|
|
34
|
+
static createVectorStore(client: OpenAI, name: string, knowledgeSources: ReadonlyArray<string>): Promise<string>;
|
|
35
|
+
/**
|
|
36
|
+
* Discriminant for type guards
|
|
37
|
+
*/
|
|
38
|
+
protected get discriminant(): string;
|
|
39
|
+
/**
|
|
40
|
+
* Type guard to check if given `LlmExecutionTools` are instanceof `OpenAiAgentExecutionTools`
|
|
41
|
+
*/
|
|
42
|
+
static isOpenAiAgentExecutionTools(llmExecutionTools: LlmExecutionTools): llmExecutionTools is OpenAiAgentExecutionTools;
|
|
43
|
+
}
|
|
@@ -18,6 +18,7 @@ import { OpenAiExecutionTools } from './OpenAiExecutionTools';
|
|
|
18
18
|
* - `RemoteAgent` - which is an `Agent` that connects to a Promptbook Agents Server
|
|
19
19
|
*
|
|
20
20
|
* @public exported from `@promptbook/openai`
|
|
21
|
+
* @deprecated Use `OpenAiAgentExecutionTools` instead which uses the new OpenAI Responses API
|
|
21
22
|
*/
|
|
22
23
|
export declare class OpenAiAssistantExecutionTools extends OpenAiExecutionTools implements LlmExecutionTools {
|
|
23
24
|
readonly assistantId: string_token;
|
|
@@ -33,11 +34,11 @@ export declare class OpenAiAssistantExecutionTools extends OpenAiExecutionTools
|
|
|
33
34
|
/**
|
|
34
35
|
* Calls OpenAI API to use a chat model.
|
|
35
36
|
*/
|
|
36
|
-
callChatModel(prompt:
|
|
37
|
+
callChatModel(prompt: Prompt): Promise<ChatPromptResult>;
|
|
37
38
|
/**
|
|
38
39
|
* Calls OpenAI API to use a chat model with streaming.
|
|
39
40
|
*/
|
|
40
|
-
callChatModelStream(prompt:
|
|
41
|
+
callChatModelStream(prompt: Prompt, onProgress: (chunk: ChatPromptResult) => void): Promise<ChatPromptResult>;
|
|
41
42
|
/**
|
|
42
43
|
* Get an existing assistant tool wrapper
|
|
43
44
|
*/
|
|
@@ -94,6 +95,7 @@ export declare class OpenAiAssistantExecutionTools extends OpenAiExecutionTools
|
|
|
94
95
|
static isOpenAiAssistantExecutionTools(llmExecutionTools: LlmExecutionTools): llmExecutionTools is OpenAiAssistantExecutionTools;
|
|
95
96
|
}
|
|
96
97
|
/**
|
|
98
|
+
* TODO: !!!!! [✨🥚] Knowledge should work both with and without scrapers
|
|
97
99
|
* TODO: [🙎] In `OpenAiAssistantExecutionTools` Allow to create abstract assistants with `isCreatingNewAssistantsAllowed`
|
|
98
100
|
* TODO: [🧠][🧙♂️] Maybe there can be some wizard for those who want to use just OpenAI
|
|
99
101
|
* TODO: Maybe make custom OpenAiError
|
|
@@ -39,10 +39,17 @@ export declare abstract class OpenAiCompatibleExecutionTools implements LlmExecu
|
|
|
39
39
|
* List all available OpenAI compatible models that can be used
|
|
40
40
|
*/
|
|
41
41
|
listModels(): Promise<ReadonlyArray<AvailableModel>>;
|
|
42
|
+
/**
|
|
43
|
+
* Calls OpenAI compatible API to use a chat model.
|
|
44
|
+
*/
|
|
42
45
|
/**
|
|
43
46
|
* Calls OpenAI compatible API to use a chat model.
|
|
44
47
|
*/
|
|
45
48
|
callChatModel(prompt: Prompt): Promise<ChatPromptResult>;
|
|
49
|
+
/**
|
|
50
|
+
* Calls OpenAI compatible API to use a chat model with streaming.
|
|
51
|
+
*/
|
|
52
|
+
callChatModelStream(prompt: Prompt, onProgress: (chunk: ChatPromptResult) => void): Promise<ChatPromptResult>;
|
|
46
53
|
/**
|
|
47
54
|
* Internal method that handles parameter retry for chat model calls
|
|
48
55
|
*/
|
|
@@ -66,7 +73,7 @@ export declare abstract class OpenAiCompatibleExecutionTools implements LlmExecu
|
|
|
66
73
|
/**
|
|
67
74
|
* Calls OpenAI compatible API to use a image generation model
|
|
68
75
|
*/
|
|
69
|
-
callImageGenerationModel(prompt:
|
|
76
|
+
callImageGenerationModel(prompt: Prompt): Promise<ImagePromptResult>;
|
|
70
77
|
/**
|
|
71
78
|
* Internal method that handles parameter retry for image generation model calls
|
|
72
79
|
*/
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import OpenAI from 'openai';
|
|
2
|
+
/**
|
|
3
|
+
* Uploads files to OpenAI and returns their IDs
|
|
4
|
+
*
|
|
5
|
+
* @private utility for `OpenAiAssistantExecutionTools` and `OpenAiCompatibleExecutionTools`
|
|
6
|
+
*/
|
|
7
|
+
export declare function uploadFilesToOpenAi(client: OpenAI, files: Array<File>): Promise<Array<string>>;
|
|
@@ -1,4 +1,28 @@
|
|
|
1
1
|
import type { string_prompt } from '../types/typeAliases';
|
|
2
|
+
import type { really_unknown } from '../utils/organization/really_unknown';
|
|
3
|
+
/**
|
|
4
|
+
* Prompt string wrapper to retain prompt context across interpolations.
|
|
5
|
+
*
|
|
6
|
+
* @public exported from `@promptbook/utils`
|
|
7
|
+
*/
|
|
8
|
+
export declare class PromptString extends String {
|
|
9
|
+
/**
|
|
10
|
+
* @param value Prompt content.
|
|
11
|
+
*/
|
|
12
|
+
constructor(value: string_prompt);
|
|
13
|
+
/**
|
|
14
|
+
* Returns the prompt as a primitive string.
|
|
15
|
+
*/
|
|
16
|
+
toString(): string_prompt;
|
|
17
|
+
/**
|
|
18
|
+
* Returns the prompt as a primitive string for implicit coercion.
|
|
19
|
+
*/
|
|
20
|
+
valueOf(): string_prompt;
|
|
21
|
+
/**
|
|
22
|
+
* Ensures template literal coercion returns the raw string.
|
|
23
|
+
*/
|
|
24
|
+
[Symbol.toPrimitive](): string_prompt;
|
|
25
|
+
}
|
|
2
26
|
/**
|
|
3
27
|
* Tag function for notating a prompt as template literal
|
|
4
28
|
*
|
|
@@ -9,10 +33,10 @@ import type { string_prompt } from '../types/typeAliases';
|
|
|
9
33
|
*
|
|
10
34
|
* @param strings
|
|
11
35
|
* @param values
|
|
12
|
-
* @returns
|
|
36
|
+
* @returns prompt content wrapped as a PromptString
|
|
13
37
|
* @public exported from `@promptbook/utils`
|
|
14
38
|
*/
|
|
15
|
-
export declare function prompt(strings: TemplateStringsArray, ...values: Array<
|
|
39
|
+
export declare function prompt(strings: TemplateStringsArray, ...values: Array<really_unknown>): PromptString;
|
|
16
40
|
/**
|
|
17
41
|
* Tag function for notating a prompt as template literal
|
|
18
42
|
*
|
|
@@ -26,6 +50,7 @@ export declare function prompt(strings: TemplateStringsArray, ...values: Array<s
|
|
|
26
50
|
*/
|
|
27
51
|
export declare const promptTemplate: typeof prompt;
|
|
28
52
|
/**
|
|
53
|
+
* TODO: Maybe split into multiple files
|
|
29
54
|
* TODO: [🧠][🈴] Where is the best location for this file
|
|
30
55
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
31
56
|
*/
|
|
@@ -9,4 +9,5 @@ import type { PrepareAndScrapeOptions } from '../../../prepare/PrepareAndScrapeO
|
|
|
9
9
|
export declare function $provideFilesystemForNode(options?: Pick<PrepareAndScrapeOptions, 'isVerbose'>): FilesystemTools;
|
|
10
10
|
/**
|
|
11
11
|
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
12
|
+
* TODO: [🏓] Unite `xxxForServer` and `xxxForNode` naming
|
|
12
13
|
*/
|
|
@@ -10,4 +10,5 @@ import type { Scraper } from '../Scraper';
|
|
|
10
10
|
export declare function $provideScrapersForNode(tools: Pick<ExecutionTools, 'fs' | 'llm' | 'executables'>, options?: PrepareAndScrapeOptions): Promise<ReadonlyArray<Scraper>>;
|
|
11
11
|
/**
|
|
12
12
|
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
13
|
+
* TODO: [🏓] Unite `xxxForServer` and `xxxForNode` naming
|
|
13
14
|
*/
|
|
@@ -8,4 +8,5 @@ import type { PrepareAndScrapeOptions } from '../../../prepare/PrepareAndScrapeO
|
|
|
8
8
|
export declare function $provideScriptingForNode(options?: PrepareAndScrapeOptions): Promise<ReadonlyArray<ScriptExecutionTools>>;
|
|
9
9
|
/**
|
|
10
10
|
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
11
|
+
* TODO: [🏓] Unite `xxxForServer` and `xxxForNode` naming
|
|
11
12
|
*/
|
|
@@ -5,5 +5,5 @@ export type SearchEngine = {
|
|
|
5
5
|
readonly title: string_title & string_markdown_text;
|
|
6
6
|
readonly description?: string_markdown;
|
|
7
7
|
checkConfiguration(): Promisable<void>;
|
|
8
|
-
search(query: string): Promise<SearchResult[]>;
|
|
8
|
+
search(query: string, options?: Record<string, unknown>): Promise<SearchResult[]>;
|
|
9
9
|
};
|
|
@@ -11,5 +11,5 @@ export declare class BingSearchEngine implements SearchEngine {
|
|
|
11
11
|
get title(): string_title & string_markdown_text;
|
|
12
12
|
get description(): string_markdown;
|
|
13
13
|
checkConfiguration(): Promisable<void>;
|
|
14
|
-
search(query: string): Promise<SearchResult[]>;
|
|
14
|
+
search(query: string, options?: Record<string, unknown>): Promise<SearchResult[]>;
|
|
15
15
|
}
|
|
@@ -11,5 +11,5 @@ export declare class DummySearchEngine implements SearchEngine {
|
|
|
11
11
|
get title(): string_title & string_markdown_text;
|
|
12
12
|
get description(): string_markdown;
|
|
13
13
|
checkConfiguration(): Promisable<void>;
|
|
14
|
-
search(query: string): Promise<SearchResult[]>;
|
|
14
|
+
search(query: string, options?: Record<string, unknown>): Promise<SearchResult[]>;
|
|
15
15
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Promisable } from 'type-fest';
|
|
2
|
+
import type { string_markdown, string_markdown_text, string_title } from '../../types/typeAliases';
|
|
3
|
+
import type { SearchEngine } from '../SearchEngine';
|
|
4
|
+
import type { SearchResult } from '../SearchResult';
|
|
5
|
+
/**
|
|
6
|
+
* A search engine implementation that uses the Google Custom Search JSON API.
|
|
7
|
+
*
|
|
8
|
+
* @private <- TODO: !!!! Export via some package
|
|
9
|
+
*/
|
|
10
|
+
export declare class GoogleSearchEngine implements SearchEngine {
|
|
11
|
+
get title(): string_title & string_markdown_text;
|
|
12
|
+
get description(): string_markdown;
|
|
13
|
+
/**
|
|
14
|
+
* @see https://developers.google.com/custom-search/v1/overview
|
|
15
|
+
*/
|
|
16
|
+
checkConfiguration(): Promisable<void>;
|
|
17
|
+
search(query: string, options?: Record<string, unknown>): Promise<SearchResult[]>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Promisable } from 'type-fest';
|
|
2
|
+
import type { string_markdown, string_markdown_text, string_title } from '../../types/typeAliases';
|
|
3
|
+
import type { SearchEngine } from '../SearchEngine';
|
|
4
|
+
import type { SearchResult } from '../SearchResult';
|
|
5
|
+
/**
|
|
6
|
+
* A search engine implementation that uses the SerpApi to fetch Google search results.
|
|
7
|
+
*
|
|
8
|
+
* @private <- TODO: !!!! Export via some package
|
|
9
|
+
*/
|
|
10
|
+
export declare class SerpSearchEngine implements SearchEngine {
|
|
11
|
+
get title(): string_title & string_markdown_text;
|
|
12
|
+
get description(): string_markdown;
|
|
13
|
+
checkConfiguration(): Promisable<void>;
|
|
14
|
+
search(query: string, options?: Record<string, unknown>): Promise<SearchResult[]>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { SpeechRecognition, SpeechRecognitionEvent, SpeechRecognitionStartOptions, SpeechRecognitionState } from '../types/SpeechRecognition';
|
|
2
|
+
/**
|
|
3
|
+
* Speech recognition using Web Speech API `SpeechRecognition` available in modern browsers
|
|
4
|
+
*
|
|
5
|
+
* @public exported from `@promptbook/browser`
|
|
6
|
+
*/
|
|
7
|
+
export declare class BrowserSpeechRecognition implements SpeechRecognition {
|
|
8
|
+
private recognition;
|
|
9
|
+
private callbacks;
|
|
10
|
+
private _state;
|
|
11
|
+
get state(): SpeechRecognitionState;
|
|
12
|
+
constructor();
|
|
13
|
+
$start(options?: SpeechRecognitionStartOptions): void;
|
|
14
|
+
$stop(): void;
|
|
15
|
+
subscribe(callback: (event: SpeechRecognitionEvent) => void): () => void;
|
|
16
|
+
private emit;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* TODO: !!!! Search ACRY for `window` and put -> [🔵]
|
|
20
|
+
* Note: [🔵] Code in this file should never be published outside of `@promptbook/browser`
|
|
21
|
+
*/
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { SpeechRecognition, SpeechRecognitionEvent, SpeechRecognitionStartOptions, SpeechRecognitionState } from '../types/SpeechRecognition';
|
|
2
|
+
/**
|
|
3
|
+
* Options for OpenAiSpeechRecognition
|
|
4
|
+
*/
|
|
5
|
+
export type OpenAiSpeechRecognitionOptions = {
|
|
6
|
+
/**
|
|
7
|
+
* OpenAI API base URL or proxy endpoint
|
|
8
|
+
* @default '/api/openai/v1'
|
|
9
|
+
*/
|
|
10
|
+
readonly baseUrl?: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Speech recognition using OpenAI Whisper API to transcribe audio into text
|
|
14
|
+
*
|
|
15
|
+
* @private because it requires server-client communication with a proxy endpoint
|
|
16
|
+
*
|
|
17
|
+
* Note: This implementation uses a server-side proxy to avoid exposing the OpenAI API key on the client.
|
|
18
|
+
*/
|
|
19
|
+
export declare class OpenAiSpeechRecognition implements SpeechRecognition {
|
|
20
|
+
private readonly options;
|
|
21
|
+
private mediaRecorder;
|
|
22
|
+
private audioContext;
|
|
23
|
+
private analyser;
|
|
24
|
+
private silenceTimeout;
|
|
25
|
+
private audioChunks;
|
|
26
|
+
private callbacks;
|
|
27
|
+
private _state;
|
|
28
|
+
get state(): SpeechRecognitionState;
|
|
29
|
+
constructor(options?: OpenAiSpeechRecognitionOptions);
|
|
30
|
+
$start(options?: SpeechRecognitionStartOptions): Promise<void>;
|
|
31
|
+
$stop(): void;
|
|
32
|
+
private transcribe;
|
|
33
|
+
subscribe(callback: (event: SpeechRecognitionEvent) => void): () => void;
|
|
34
|
+
private emit;
|
|
35
|
+
}
|
|
@@ -129,6 +129,12 @@ export type CommonModelRequirements = {
|
|
|
129
129
|
* Note: [🚉] This is fully serializable as JSON
|
|
130
130
|
*/
|
|
131
131
|
readonly tools?: LlmToolDefinition[];
|
|
132
|
+
/**
|
|
133
|
+
* Optional list of knowledge source links that the model can use
|
|
134
|
+
*
|
|
135
|
+
* Note: [🚉] This is fully serializable as JSON
|
|
136
|
+
*/
|
|
137
|
+
readonly knowledgeSources?: string[];
|
|
132
138
|
};
|
|
133
139
|
/**
|
|
134
140
|
* TODO: [🧠][🈁] `seed` should maybe be somewhere else (not in `ModelRequirements`) (similar that `user` identification is not here)
|
|
@@ -57,6 +57,10 @@ export type ChatPrompt = CommonPrompt & {
|
|
|
57
57
|
* Optional tools that can be called by the model
|
|
58
58
|
*/
|
|
59
59
|
tools?: Array<LlmToolDefinition>;
|
|
60
|
+
/**
|
|
61
|
+
* Optional file attachments
|
|
62
|
+
*/
|
|
63
|
+
files?: Array<File>;
|
|
60
64
|
};
|
|
61
65
|
/**
|
|
62
66
|
* Image prompt
|
|
@@ -68,6 +72,14 @@ export type ImagePrompt = CommonPrompt & {
|
|
|
68
72
|
* Requirements for image generation model
|
|
69
73
|
*/
|
|
70
74
|
modelRequirements: ImageGenerationModelRequirements;
|
|
75
|
+
/**
|
|
76
|
+
* Optional file attachments
|
|
77
|
+
*/
|
|
78
|
+
attachments?: Array<{
|
|
79
|
+
name: string;
|
|
80
|
+
type: string;
|
|
81
|
+
url: string;
|
|
82
|
+
}>;
|
|
71
83
|
};
|
|
72
84
|
/**
|
|
73
85
|
* Embedding prompt
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { string_language } from './typeAliases';
|
|
2
|
+
/**
|
|
3
|
+
* Interface for speech-to-text recognition
|
|
4
|
+
*
|
|
5
|
+
* @🚉 fully serializable as JSON
|
|
6
|
+
*/
|
|
7
|
+
export type SpeechRecognition = {
|
|
8
|
+
/**
|
|
9
|
+
* Start the speech recognition
|
|
10
|
+
*/
|
|
11
|
+
$start(options: SpeechRecognitionStartOptions): void;
|
|
12
|
+
/**
|
|
13
|
+
* Stop the speech recognition
|
|
14
|
+
*/
|
|
15
|
+
$stop(): void;
|
|
16
|
+
/**
|
|
17
|
+
* Current state of the speech recognition
|
|
18
|
+
*/
|
|
19
|
+
readonly state: SpeechRecognitionState;
|
|
20
|
+
/**
|
|
21
|
+
* Subscribe to speech recognition events
|
|
22
|
+
*/
|
|
23
|
+
subscribe(callback: (event: SpeechRecognitionEvent) => void): () => void;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Options for starting speech recognition
|
|
27
|
+
*/
|
|
28
|
+
export type SpeechRecognitionStartOptions = {
|
|
29
|
+
/**
|
|
30
|
+
* Language for speech recognition
|
|
31
|
+
* @default 'en-US'
|
|
32
|
+
*/
|
|
33
|
+
readonly language?: string_language;
|
|
34
|
+
/**
|
|
35
|
+
* Whether to return interim results
|
|
36
|
+
* @default true
|
|
37
|
+
*/
|
|
38
|
+
readonly interimResults?: boolean;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Current state of the speech recognition
|
|
42
|
+
*/
|
|
43
|
+
export type SpeechRecognitionState = 'IDLE' | 'STARTING' | 'RECORDING' | 'TRANSCRIBING' | 'ERROR';
|
|
44
|
+
/**
|
|
45
|
+
* Event emitted by speech recognition
|
|
46
|
+
*/
|
|
47
|
+
export type SpeechRecognitionEvent = {
|
|
48
|
+
readonly type: 'START';
|
|
49
|
+
} | {
|
|
50
|
+
readonly type: 'RESULT';
|
|
51
|
+
readonly text: string;
|
|
52
|
+
readonly isFinal: boolean;
|
|
53
|
+
} | {
|
|
54
|
+
readonly type: 'ERROR';
|
|
55
|
+
readonly message: string;
|
|
56
|
+
} | {
|
|
57
|
+
readonly type: 'STOP';
|
|
58
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { string_date_iso8601 } from './typeAliases';
|
|
2
|
+
import type { TODO_any } from '../utils/organization/TODO_any';
|
|
3
|
+
/**
|
|
4
|
+
* Represents a single tool call with its inputs, outputs, and timing.
|
|
5
|
+
*
|
|
6
|
+
* Note: This is fully serializable as JSON.
|
|
7
|
+
*/
|
|
8
|
+
export type ToolCall = {
|
|
9
|
+
/**
|
|
10
|
+
* Name of the tool.
|
|
11
|
+
*/
|
|
12
|
+
readonly name: string;
|
|
13
|
+
/**
|
|
14
|
+
* Arguments for the tool call.
|
|
15
|
+
*/
|
|
16
|
+
readonly arguments?: string | Record<string, TODO_any>;
|
|
17
|
+
/**
|
|
18
|
+
* Result of the tool call.
|
|
19
|
+
*/
|
|
20
|
+
readonly result?: TODO_any;
|
|
21
|
+
/**
|
|
22
|
+
* Raw tool call payload from the model.
|
|
23
|
+
*/
|
|
24
|
+
readonly rawToolCall?: TODO_any;
|
|
25
|
+
/**
|
|
26
|
+
* Timestamp when the tool call was initiated.
|
|
27
|
+
*/
|
|
28
|
+
readonly createdAt?: string_date_iso8601;
|
|
29
|
+
/**
|
|
30
|
+
* Errors thrown during tool execution.
|
|
31
|
+
*/
|
|
32
|
+
readonly errors?: ReadonlyArray<TODO_any>;
|
|
33
|
+
/**
|
|
34
|
+
* Warnings reported during tool execution.
|
|
35
|
+
*/
|
|
36
|
+
readonly warnings?: ReadonlyArray<TODO_any>;
|
|
37
|
+
};
|
|
@@ -668,6 +668,10 @@ export type string_license_token = string_token;
|
|
|
668
668
|
export type string_password = string;
|
|
669
669
|
export type string_ssh_key = string;
|
|
670
670
|
export type string_pgp_key = string;
|
|
671
|
+
/**
|
|
672
|
+
* Language as a string, e.g. 'en-US', 'cs-CZ', 'en'
|
|
673
|
+
*/
|
|
674
|
+
export type string_language = string;
|
|
671
675
|
/**
|
|
672
676
|
* Semantic helper for `Date.toISOString()` result
|
|
673
677
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -15,7 +15,7 @@ export declare const BOOK_LANGUAGE_VERSION: string_semantic_version;
|
|
|
15
15
|
export declare const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version;
|
|
16
16
|
/**
|
|
17
17
|
* Represents the version string of the Promptbook engine.
|
|
18
|
-
* It follows semantic versioning (e.g., `0.105.0-
|
|
18
|
+
* It follows semantic versioning (e.g., `0.105.0-30`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
|
@@ -2,10 +2,7 @@ import type { ExecutionTools } from '../execution/ExecutionTools';
|
|
|
2
2
|
import type { PipelineExecutorResult } from '../execution/PipelineExecutorResult';
|
|
3
3
|
import type { PipelineJson } from '../pipeline/PipelineJson/PipelineJson';
|
|
4
4
|
import type { PipelineString } from '../pipeline/PipelineString';
|
|
5
|
-
import type { InputParameters } from '../types/typeAliases';
|
|
6
|
-
import type { string_filename } from '../types/typeAliases';
|
|
7
|
-
import type { string_parameter_value } from '../types/typeAliases';
|
|
8
|
-
import type { string_pipeline_url } from '../types/typeAliases';
|
|
5
|
+
import type { InputParameters, string_filename, string_parameter_value, string_pipeline_url } from '../types/typeAliases';
|
|
9
6
|
/**
|
|
10
7
|
* Options for wizard methods
|
|
11
8
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/color",
|
|
3
|
-
"version": "0.105.0-
|
|
3
|
+
"version": "0.105.0-31",
|
|
4
4
|
"description": "Promptbook: Turn your company's scattered knowledge into AI ready books",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"module": "./esm/index.es.js",
|
|
92
92
|
"typings": "./esm/typings/src/_packages/color.index.d.ts",
|
|
93
93
|
"peerDependencies": {
|
|
94
|
-
"@promptbook/core": "0.105.0-
|
|
94
|
+
"@promptbook/core": "0.105.0-31"
|
|
95
95
|
},
|
|
96
96
|
"dependencies": {
|
|
97
97
|
"spacetrim": "0.11.60"
|
package/umd/index.umd.js
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* @generated
|
|
19
19
|
* @see https://github.com/webgptorg/promptbook
|
|
20
20
|
*/
|
|
21
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.105.0-
|
|
21
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.105.0-31';
|
|
22
22
|
/**
|
|
23
23
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
24
24
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|