@promptbook/remote-client 0.104.0 → 0.105.0-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/esm/index.es.js +6 -3
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +2 -0
- package/esm/typings/src/book-2.0/agent-source/AgentModelRequirements.d.ts +4 -0
- package/esm/typings/src/book-components/Chat/types/ChatMessage.d.ts +17 -0
- package/esm/typings/src/commitments/IMPORT/IMPORT.d.ts +34 -0
- package/esm/typings/src/commitments/index.d.ts +2 -1
- package/esm/typings/src/config.d.ts +6 -0
- package/esm/typings/src/errors/utils/deserializeError.d.ts +1 -1
- package/esm/typings/src/execution/PromptResult.d.ts +24 -1
- package/esm/typings/src/llm-providers/openai/OpenAiCompatibleExecutionToolsOptions.d.ts +5 -0
- package/esm/typings/src/types/LlmToolDefinition.d.ts +8 -1
- package/esm/typings/src/types/Prompt.d.ts +13 -0
- package/esm/typings/src/utils/misc/parseNumber.d.ts +1 -1
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +6 -3
- package/umd/index.umd.js.map +1 -1
|
@@ -47,6 +47,7 @@ import { PENDING_VALUE_PLACEHOLDER } from '../config';
|
|
|
47
47
|
import { MAX_FILENAME_LENGTH } from '../config';
|
|
48
48
|
import { DEFAULT_INTERMEDIATE_FILES_STRATEGY } from '../config';
|
|
49
49
|
import { DEFAULT_MAX_PARALLEL_COUNT } from '../config';
|
|
50
|
+
import { DEFAULT_MAX_RECURSION } from '../config';
|
|
50
51
|
import { DEFAULT_MAX_EXECUTION_ATTEMPTS } from '../config';
|
|
51
52
|
import { DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH } from '../config';
|
|
52
53
|
import { DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL } from '../config';
|
|
@@ -244,6 +245,7 @@ export { PENDING_VALUE_PLACEHOLDER };
|
|
|
244
245
|
export { MAX_FILENAME_LENGTH };
|
|
245
246
|
export { DEFAULT_INTERMEDIATE_FILES_STRATEGY };
|
|
246
247
|
export { DEFAULT_MAX_PARALLEL_COUNT };
|
|
248
|
+
export { DEFAULT_MAX_RECURSION };
|
|
247
249
|
export { DEFAULT_MAX_EXECUTION_ATTEMPTS };
|
|
248
250
|
export { DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH };
|
|
249
251
|
export { DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL };
|
|
@@ -28,6 +28,10 @@ export type AgentModelRequirements = {
|
|
|
28
28
|
* - 3) `parentAgentUrl` is not defined `undefined`, the default ancestor agent, Adam, will be used
|
|
29
29
|
*/
|
|
30
30
|
readonly parentAgentUrl?: string_agent_url | null;
|
|
31
|
+
/**
|
|
32
|
+
* List of imported agent URLs
|
|
33
|
+
*/
|
|
34
|
+
readonly importedAgentUrls?: ReadonlyArray<string_agent_url>;
|
|
31
35
|
/**
|
|
32
36
|
* Optional list of knowledge source links that the agent can use
|
|
33
37
|
*/
|
|
@@ -33,6 +33,23 @@ export type ChatMessage = Omit<Message<id>, 'direction' | 'recipients' | 'thread
|
|
|
33
33
|
* Indicates if the message was sent via a voice call
|
|
34
34
|
*/
|
|
35
35
|
isVoiceCall?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Optional file attachments
|
|
38
|
+
*/
|
|
39
|
+
attachments?: Array<{
|
|
40
|
+
/**
|
|
41
|
+
* The name of the file
|
|
42
|
+
*/
|
|
43
|
+
name: string;
|
|
44
|
+
/**
|
|
45
|
+
* The type of the file
|
|
46
|
+
*/
|
|
47
|
+
type: string;
|
|
48
|
+
/**
|
|
49
|
+
* The URL where the file is stored
|
|
50
|
+
*/
|
|
51
|
+
url: string;
|
|
52
|
+
}>;
|
|
36
53
|
};
|
|
37
54
|
/**
|
|
38
55
|
* TODO: Make all fields readonly
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
|
|
2
|
+
import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
3
|
+
/**
|
|
4
|
+
* IMPORT commitment definition
|
|
5
|
+
*
|
|
6
|
+
* The IMPORT commitment tells the agent to import content from another agent at the current location.
|
|
7
|
+
*
|
|
8
|
+
* Example usage in agent source:
|
|
9
|
+
*
|
|
10
|
+
* ```book
|
|
11
|
+
* IMPORT https://s6.ptbk.io/benjamin-white
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* @private [🪔] Maybe export the commitments through some package
|
|
15
|
+
*/
|
|
16
|
+
export declare class ImportCommitmentDefinition extends BaseCommitmentDefinition<'IMPORT' | 'IMPORTS'> {
|
|
17
|
+
constructor(type?: 'IMPORT' | 'IMPORTS');
|
|
18
|
+
/**
|
|
19
|
+
* Short one-line description of IMPORT.
|
|
20
|
+
*/
|
|
21
|
+
get description(): string;
|
|
22
|
+
/**
|
|
23
|
+
* Icon for this commitment.
|
|
24
|
+
*/
|
|
25
|
+
get icon(): string;
|
|
26
|
+
/**
|
|
27
|
+
* Markdown documentation for IMPORT 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
|
+
*/
|
|
@@ -7,6 +7,7 @@ import { DeleteCommitmentDefinition } from './DELETE/DELETE';
|
|
|
7
7
|
import { DictionaryCommitmentDefinition } from './DICTIONARY/DICTIONARY';
|
|
8
8
|
import { FormatCommitmentDefinition } from './FORMAT/FORMAT';
|
|
9
9
|
import { FromCommitmentDefinition } from './FROM/FROM';
|
|
10
|
+
import { ImportCommitmentDefinition } from './IMPORT/IMPORT';
|
|
10
11
|
import { GoalCommitmentDefinition } from './GOAL/GOAL';
|
|
11
12
|
import { KnowledgeCommitmentDefinition } from './KNOWLEDGE/KNOWLEDGE';
|
|
12
13
|
import { LanguageCommitmentDefinition } from './LANGUAGE/LANGUAGE';
|
|
@@ -40,7 +41,7 @@ import { NotYetImplementedCommitmentDefinition } from './_base/NotYetImplemented
|
|
|
40
41
|
*
|
|
41
42
|
* @private Use functions to access commitments instead of this array directly
|
|
42
43
|
*/
|
|
43
|
-
export declare const COMMITMENT_REGISTRY: readonly [PersonaCommitmentDefinition, PersonaCommitmentDefinition, KnowledgeCommitmentDefinition, MemoryCommitmentDefinition, MemoryCommitmentDefinition, StyleCommitmentDefinition, StyleCommitmentDefinition, RuleCommitmentDefinition, RuleCommitmentDefinition, LanguageCommitmentDefinition, LanguageCommitmentDefinition, SampleCommitmentDefinition, SampleCommitmentDefinition, FormatCommitmentDefinition, FormatCommitmentDefinition, FromCommitmentDefinition, ModelCommitmentDefinition, ModelCommitmentDefinition, ActionCommitmentDefinition, ActionCommitmentDefinition, ComponentCommitmentDefinition, MetaImageCommitmentDefinition, MetaColorCommitmentDefinition, MetaFontCommitmentDefinition, MetaLinkCommitmentDefinition, MetaCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, GoalCommitmentDefinition, GoalCommitmentDefinition, InitialMessageCommitmentDefinition, UserMessageCommitmentDefinition, AgentMessageCommitmentDefinition, MessageCommitmentDefinition, MessageCommitmentDefinition, ScenarioCommitmentDefinition, ScenarioCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DictionaryCommitmentDefinition, OpenCommitmentDefinition, ClosedCommitmentDefinition, UseBrowserCommitmentDefinition, UseSearchEngineCommitmentDefinition, UseMcpCommitmentDefinition, UseCommitmentDefinition, NotYetImplementedCommitmentDefinition<"EXPECT">, NotYetImplementedCommitmentDefinition<"BEHAVIOUR">, NotYetImplementedCommitmentDefinition<"BEHAVIOURS">, NotYetImplementedCommitmentDefinition<"AVOID">, NotYetImplementedCommitmentDefinition<"AVOIDANCE">, NotYetImplementedCommitmentDefinition<"CONTEXT">];
|
|
44
|
+
export declare const COMMITMENT_REGISTRY: readonly [PersonaCommitmentDefinition, PersonaCommitmentDefinition, KnowledgeCommitmentDefinition, MemoryCommitmentDefinition, MemoryCommitmentDefinition, StyleCommitmentDefinition, StyleCommitmentDefinition, RuleCommitmentDefinition, RuleCommitmentDefinition, LanguageCommitmentDefinition, LanguageCommitmentDefinition, SampleCommitmentDefinition, SampleCommitmentDefinition, FormatCommitmentDefinition, FormatCommitmentDefinition, FromCommitmentDefinition, ImportCommitmentDefinition, ImportCommitmentDefinition, ModelCommitmentDefinition, ModelCommitmentDefinition, ActionCommitmentDefinition, ActionCommitmentDefinition, ComponentCommitmentDefinition, MetaImageCommitmentDefinition, MetaColorCommitmentDefinition, MetaFontCommitmentDefinition, MetaLinkCommitmentDefinition, MetaCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, GoalCommitmentDefinition, GoalCommitmentDefinition, InitialMessageCommitmentDefinition, UserMessageCommitmentDefinition, AgentMessageCommitmentDefinition, MessageCommitmentDefinition, MessageCommitmentDefinition, ScenarioCommitmentDefinition, ScenarioCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DictionaryCommitmentDefinition, OpenCommitmentDefinition, ClosedCommitmentDefinition, UseBrowserCommitmentDefinition, UseSearchEngineCommitmentDefinition, UseMcpCommitmentDefinition, UseCommitmentDefinition, NotYetImplementedCommitmentDefinition<"EXPECT">, NotYetImplementedCommitmentDefinition<"BEHAVIOUR">, NotYetImplementedCommitmentDefinition<"BEHAVIOURS">, NotYetImplementedCommitmentDefinition<"AVOID">, NotYetImplementedCommitmentDefinition<"AVOIDANCE">, NotYetImplementedCommitmentDefinition<"CONTEXT">];
|
|
44
45
|
/**
|
|
45
46
|
* Gets a commitment definition by its type
|
|
46
47
|
* @param type The commitment type to look up
|
|
@@ -213,6 +213,12 @@ export declare const DEFAULT_INTERMEDIATE_FILES_STRATEGY: IntermediateFilesStrat
|
|
|
213
213
|
* @public exported from `@promptbook/core`
|
|
214
214
|
*/
|
|
215
215
|
export declare const DEFAULT_MAX_PARALLEL_COUNT = 5;
|
|
216
|
+
/**
|
|
217
|
+
* The maximum depth to which recursion can occur
|
|
218
|
+
*
|
|
219
|
+
* @public exported from `@promptbook/core`
|
|
220
|
+
*/
|
|
221
|
+
export declare const DEFAULT_MAX_RECURSION = 10;
|
|
216
222
|
/**
|
|
217
223
|
* The maximum number of attempts to execute LLM task before giving up
|
|
218
224
|
*
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { string_date_iso8601, string_model_name, string_prompt } from '../types/typeAliases';
|
|
2
|
+
import type { TODO_any } from '../utils/organization/TODO_any';
|
|
2
3
|
import type { TODO_object } from '../utils/organization/TODO_object';
|
|
3
4
|
import type { EmbeddingVector } from './EmbeddingVector';
|
|
4
5
|
import type { Usage } from './Usage';
|
|
@@ -21,7 +22,29 @@ export type CompletionPromptResult = CommonPromptResult;
|
|
|
21
22
|
*
|
|
22
23
|
* Note: [🚉] This is fully serializable as JSON
|
|
23
24
|
*/
|
|
24
|
-
export type ChatPromptResult = CommonPromptResult & {
|
|
25
|
+
export type ChatPromptResult = CommonPromptResult & {
|
|
26
|
+
/**
|
|
27
|
+
* Optional tool calls made during the execution
|
|
28
|
+
*/
|
|
29
|
+
readonly toolCalls?: ReadonlyArray<{
|
|
30
|
+
/**
|
|
31
|
+
* Name of the tool
|
|
32
|
+
*/
|
|
33
|
+
readonly name: string;
|
|
34
|
+
/**
|
|
35
|
+
* Arguments of the tool call
|
|
36
|
+
*/
|
|
37
|
+
readonly arguments: string;
|
|
38
|
+
/**
|
|
39
|
+
* Result of the tool call
|
|
40
|
+
*/
|
|
41
|
+
readonly result: string;
|
|
42
|
+
/**
|
|
43
|
+
* Raw tool call from the model
|
|
44
|
+
*/
|
|
45
|
+
readonly rawToolCall: TODO_any;
|
|
46
|
+
}>;
|
|
47
|
+
};
|
|
25
48
|
/**
|
|
26
49
|
* Image prompt result
|
|
27
50
|
*
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ClientOptions } from 'openai';
|
|
2
2
|
import type { CommonToolsOptions } from '../../execution/CommonToolsOptions';
|
|
3
|
+
import type { ExecutionTools } from '../../execution/ExecutionTools';
|
|
3
4
|
import type { RemoteClientOptions } from '../../remote-server/types/RemoteClientOptions';
|
|
4
5
|
/**
|
|
5
6
|
* Options for `createOpenAiCompatibleExecutionTools` and `OpenAiCompatibleExecutionTools`
|
|
@@ -28,6 +29,10 @@ export type OpenAiCompatibleExecutionToolsNonProxiedOptions = CommonToolsOptions
|
|
|
28
29
|
* @example 'https://api.deepseek.com/v1' (DeepSeek)
|
|
29
30
|
*/
|
|
30
31
|
baseURL?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Tools for executing the scripts
|
|
34
|
+
*/
|
|
35
|
+
readonly executionTools?: Pick<ExecutionTools, 'script'>;
|
|
31
36
|
isProxied?: false;
|
|
32
37
|
};
|
|
33
38
|
/**
|
|
@@ -16,5 +16,12 @@ export type LlmToolDefinition = {
|
|
|
16
16
|
/**
|
|
17
17
|
* Parameters of the tool in JSON Schema format
|
|
18
18
|
*/
|
|
19
|
-
readonly parameters:
|
|
19
|
+
readonly parameters: {
|
|
20
|
+
readonly type: 'object';
|
|
21
|
+
readonly properties: Record<string, {
|
|
22
|
+
type: string;
|
|
23
|
+
description?: string;
|
|
24
|
+
}>;
|
|
25
|
+
readonly required?: string[];
|
|
26
|
+
};
|
|
20
27
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { FormatCommand } from '../commands/FORMAT/FormatCommand';
|
|
2
2
|
import type { ChatMessage } from '../book-components/Chat/types/ChatMessage';
|
|
3
3
|
import type { Expectations } from '../pipeline/PipelineJson/Expectations';
|
|
4
|
+
import type { LlmToolDefinition } from './LlmToolDefinition';
|
|
4
5
|
import type { ChatModelRequirements } from './ModelRequirements';
|
|
5
6
|
import type { CompletionModelRequirements } from './ModelRequirements';
|
|
6
7
|
import type { EmbeddingModelRequirements } from './ModelRequirements';
|
|
@@ -44,6 +45,18 @@ export type ChatPrompt = CommonPrompt & {
|
|
|
44
45
|
* Optional chat thread (history of previous messages)
|
|
45
46
|
*/
|
|
46
47
|
thread?: ChatMessage[];
|
|
48
|
+
/**
|
|
49
|
+
* Optional file attachments
|
|
50
|
+
*/
|
|
51
|
+
attachments?: Array<{
|
|
52
|
+
name: string;
|
|
53
|
+
type: string;
|
|
54
|
+
url: string;
|
|
55
|
+
}>;
|
|
56
|
+
/**
|
|
57
|
+
* Optional tools that can be called by the model
|
|
58
|
+
*/
|
|
59
|
+
tools?: Array<LlmToolDefinition>;
|
|
47
60
|
};
|
|
48
61
|
/**
|
|
49
62
|
* Image prompt
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*
|
|
11
11
|
* @public exported from `@promptbook/utils`
|
|
12
12
|
*/
|
|
13
|
-
export declare function parseNumber(value: string | number): number;
|
|
13
|
+
export declare function parseNumber(value: string | number | null | undefined): number;
|
|
14
14
|
/**
|
|
15
15
|
* TODO: Maybe use sth. like safe-eval in fraction/calculation case @see https://www.npmjs.com/package/safe-eval
|
|
16
16
|
* TODO: [🧠][🌻] Maybe export through `@promptbook/markdown-utils` not `@promptbook/utils`
|
|
@@ -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.104.0
|
|
18
|
+
* It follows semantic versioning (e.g., `0.104.0`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/remote-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.105.0-0",
|
|
4
4
|
"description": "Promptbook: Turn your company's scattered knowledge into AI ready books",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"module": "./esm/index.es.js",
|
|
101
101
|
"typings": "./esm/typings/src/_packages/remote-client.index.d.ts",
|
|
102
102
|
"peerDependencies": {
|
|
103
|
-
"@promptbook/core": "0.
|
|
103
|
+
"@promptbook/core": "0.105.0-0"
|
|
104
104
|
},
|
|
105
105
|
"dependencies": {
|
|
106
106
|
"crypto": "1.0.1",
|
package/umd/index.umd.js
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* @generated
|
|
24
24
|
* @see https://github.com/webgptorg/promptbook
|
|
25
25
|
*/
|
|
26
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.
|
|
26
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.105.0-0';
|
|
27
27
|
/**
|
|
28
28
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
29
29
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -1492,7 +1492,7 @@
|
|
|
1492
1492
|
*
|
|
1493
1493
|
* @public exported from `@promptbook/utils`
|
|
1494
1494
|
*/
|
|
1495
|
-
function deserializeError(error) {
|
|
1495
|
+
function deserializeError(error, isStackAddedToMessage = true) {
|
|
1496
1496
|
const { name, stack, id } = error; // Added id
|
|
1497
1497
|
let { message } = error;
|
|
1498
1498
|
let ErrorClass = ALL_ERRORS[error.name];
|
|
@@ -1500,7 +1500,7 @@
|
|
|
1500
1500
|
ErrorClass = Error;
|
|
1501
1501
|
message = `${name}: ${message}`;
|
|
1502
1502
|
}
|
|
1503
|
-
if (stack !== undefined && stack !== '') {
|
|
1503
|
+
if (isStackAddedToMessage && stack !== undefined && stack !== '') {
|
|
1504
1504
|
message = spaceTrim__default["default"]((block) => `
|
|
1505
1505
|
${block(message)}
|
|
1506
1506
|
|
|
@@ -2601,6 +2601,9 @@
|
|
|
2601
2601
|
* @public exported from `@promptbook/utils`
|
|
2602
2602
|
*/
|
|
2603
2603
|
function parseNumber(value) {
|
|
2604
|
+
if (value === null || value === undefined) {
|
|
2605
|
+
return 0;
|
|
2606
|
+
}
|
|
2604
2607
|
const originalValue = value;
|
|
2605
2608
|
if (typeof value === 'number') {
|
|
2606
2609
|
value = value.toString(); // <- TODO: Maybe more efficient way to do this
|