@promptbook/pdf 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 +3 -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 +3 -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/pdf",
|
|
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,
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
"module": "./esm/index.es.js",
|
|
95
95
|
"typings": "./esm/typings/src/_packages/pdf.index.d.ts",
|
|
96
96
|
"peerDependencies": {
|
|
97
|
-
"@promptbook/core": "0.
|
|
97
|
+
"@promptbook/core": "0.105.0-0"
|
|
98
98
|
},
|
|
99
99
|
"dependencies": {
|
|
100
100
|
"crypto": "1.0.1",
|
package/umd/index.umd.js
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
* @generated
|
|
25
25
|
* @see https://github.com/webgptorg/promptbook
|
|
26
26
|
*/
|
|
27
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.
|
|
27
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.105.0-0';
|
|
28
28
|
/**
|
|
29
29
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
30
30
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -3425,7 +3425,7 @@
|
|
|
3425
3425
|
*
|
|
3426
3426
|
* @public exported from `@promptbook/utils`
|
|
3427
3427
|
*/
|
|
3428
|
-
function deserializeError(error) {
|
|
3428
|
+
function deserializeError(error, isStackAddedToMessage = true) {
|
|
3429
3429
|
const { name, stack, id } = error; // Added id
|
|
3430
3430
|
let { message } = error;
|
|
3431
3431
|
let ErrorClass = ALL_ERRORS[error.name];
|
|
@@ -3433,7 +3433,7 @@
|
|
|
3433
3433
|
ErrorClass = Error;
|
|
3434
3434
|
message = `${name}: ${message}`;
|
|
3435
3435
|
}
|
|
3436
|
-
if (stack !== undefined && stack !== '') {
|
|
3436
|
+
if (isStackAddedToMessage && stack !== undefined && stack !== '') {
|
|
3437
3437
|
message = spaceTrim__default["default"]((block) => `
|
|
3438
3438
|
${block(message)}
|
|
3439
3439
|
|