@promptbook/google 0.105.0-1 → 0.105.0-3
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 +2 -1
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +2 -0
- package/esm/typings/src/_packages/types.index.d.ts +4 -0
- package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +10 -3
- package/esm/typings/src/book-2.0/agent-source/AgentModelRequirements.d.ts +11 -1
- package/esm/typings/src/book-2.0/agent-source/communication-samples.test.d.ts +1 -0
- package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.blocks.test.d.ts +1 -0
- package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.import.test.d.ts +1 -0
- package/esm/typings/src/book-2.0/agent-source/parseAgentSource.import.test.d.ts +1 -0
- package/esm/typings/src/book-2.0/agent-source/parseAgentSourceWithCommitments.blocks.test.d.ts +1 -0
- package/esm/typings/src/commitments/USE_TIME/USE_TIME.d.ts +40 -0
- package/esm/typings/src/commitments/USE_TIME/USE_TIME.test.d.ts +1 -0
- package/esm/typings/src/commitments/_base/BaseCommitmentDefinition.d.ts +8 -0
- package/esm/typings/src/commitments/_base/CommitmentDefinition.d.ts +8 -0
- package/esm/typings/src/commitments/index.d.ts +11 -2
- package/esm/typings/src/config.d.ts +1 -0
- package/esm/typings/src/import-plugins/$fileImportPlugins.d.ts +7 -0
- package/esm/typings/src/import-plugins/AgentFileImportPlugin.d.ts +7 -0
- package/esm/typings/src/import-plugins/FileImportPlugin.d.ts +24 -0
- package/esm/typings/src/import-plugins/JsonFileImportPlugin.d.ts +7 -0
- package/esm/typings/src/import-plugins/TextFileImportPlugin.d.ts +7 -0
- package/esm/typings/src/llm-providers/_common/utils/cache/cacheLlmTools.d.ts +2 -1
- package/esm/typings/src/llm-providers/_common/utils/count-total-usage/countUsage.d.ts +2 -2
- package/esm/typings/src/llm-providers/agent/Agent.d.ts +9 -2
- package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +3 -1
- package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +10 -0
- package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/scripting/javascript/JavascriptExecutionToolsOptions.d.ts +6 -1
- package/esm/typings/src/types/ModelRequirements.d.ts +6 -12
- package/esm/typings/src/utils/execCommand/$execCommandNormalizeOptions.d.ts +2 -3
- package/esm/typings/src/utils/execCommand/ExecCommandOptions.d.ts +7 -1
- package/esm/typings/src/utils/organization/keepImported.d.ts +9 -0
- package/esm/typings/src/utils/organization/keepTypeImported.d.ts +0 -1
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +2 -1
- package/umd/index.umd.js.map +1 -1
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { string_mime_type } from '../types/typeAliases';
|
|
2
|
+
/**
|
|
3
|
+
* Type for file import plugins
|
|
4
|
+
*
|
|
5
|
+
* Each plugin handles a specific set of MIME types or file extensions.
|
|
6
|
+
*/
|
|
7
|
+
export type FileImportPlugin = {
|
|
8
|
+
/**
|
|
9
|
+
* Unique name of the plugin
|
|
10
|
+
*/
|
|
11
|
+
readonly name: string;
|
|
12
|
+
/**
|
|
13
|
+
* Checks if the plugin can handle the given MIME type or file extension
|
|
14
|
+
*/
|
|
15
|
+
canImport(mimeType: string_mime_type): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Processes the file content and returns the string to be placed in the agent book
|
|
18
|
+
*
|
|
19
|
+
* @param content - The raw content of the file
|
|
20
|
+
* @param mimeType - The MIME type of the file
|
|
21
|
+
* @returns The processed content (e.g. wrapped in code block)
|
|
22
|
+
*/
|
|
23
|
+
import(content: string, mimeType: string_mime_type): string | Promise<string>;
|
|
24
|
+
};
|
|
@@ -4,9 +4,10 @@ import type { CacheLlmToolsOptions } from './CacheLlmToolsOptions';
|
|
|
4
4
|
* Intercepts LLM tools and counts total usage of the tools
|
|
5
5
|
*
|
|
6
6
|
* Note: It can take extended `LlmExecutionTools` and cache the
|
|
7
|
+
* Note: Returns full proxy of all LLM tool properties and methods
|
|
7
8
|
*
|
|
8
9
|
* @param llmTools LLM tools to be intercepted with usage counting, it can contain extra methods like `totalUsage`
|
|
9
|
-
* @returns LLM tools with same functionality with added
|
|
10
|
+
* @returns Full proxy of LLM tools with same functionality with added caching
|
|
10
11
|
* @public exported from `@promptbook/core`
|
|
11
12
|
*/
|
|
12
13
|
export declare function cacheLlmTools<TLlmTools extends LlmExecutionTools>(llmTools: TLlmTools, options?: Partial<CacheLlmToolsOptions>): TLlmTools;
|
|
@@ -8,10 +8,10 @@ import type { LlmExecutionToolsWithTotalUsage } from './LlmExecutionToolsWithTot
|
|
|
8
8
|
* in real-time through an observable.
|
|
9
9
|
*
|
|
10
10
|
* @param llmTools - The LLM tools to be intercepted and tracked
|
|
11
|
-
* @returns
|
|
11
|
+
* @returns Full proxy of the tools with added usage tracking capabilities
|
|
12
12
|
* @public exported from `@promptbook/core`
|
|
13
13
|
*/
|
|
14
|
-
export declare function countUsage(llmTools:
|
|
14
|
+
export declare function countUsage<TLlmTools extends LlmExecutionTools>(llmTools: TLlmTools): TLlmTools & LlmExecutionToolsWithTotalUsage;
|
|
15
15
|
/**
|
|
16
16
|
* TODO: [🧠][💸] Maybe make some common abstraction `interceptLlmTools` and use here (or use javascript Proxy?)
|
|
17
17
|
* TODO: [🧠] Is there some meaningfull way how to test this util
|
|
@@ -42,7 +42,14 @@ export declare class Agent extends AgentLlmExecutionTools implements LlmExecutio
|
|
|
42
42
|
* Capabilities of the agent
|
|
43
43
|
* This is parsed from commitments like USE BROWSER, USE SEARCH ENGINE, KNOWLEDGE, etc.
|
|
44
44
|
*/
|
|
45
|
-
capabilities: AgentCapability
|
|
45
|
+
capabilities: Array<AgentCapability>;
|
|
46
|
+
/**
|
|
47
|
+
* List of sample conversations (question/answer pairs)
|
|
48
|
+
*/
|
|
49
|
+
samples: Array<{
|
|
50
|
+
question: string | null;
|
|
51
|
+
answer: string;
|
|
52
|
+
}>;
|
|
46
53
|
/**
|
|
47
54
|
* Computed hash of the agent source for integrity verification
|
|
48
55
|
*/
|
|
@@ -63,7 +70,7 @@ export declare class Agent extends AgentLlmExecutionTools implements LlmExecutio
|
|
|
63
70
|
/**
|
|
64
71
|
* Not used in Agent, always returns empty array
|
|
65
72
|
*/
|
|
66
|
-
get parameters(): BookParameter
|
|
73
|
+
get parameters(): Array<BookParameter>;
|
|
67
74
|
readonly agentSource: BehaviorSubject<string_book>;
|
|
68
75
|
constructor(options: AgentOptions);
|
|
69
76
|
/**
|
|
@@ -54,8 +54,10 @@ export declare class AgentLlmExecutionTools implements LlmExecutionTools {
|
|
|
54
54
|
private getAgentInfo;
|
|
55
55
|
/**
|
|
56
56
|
* Get cached or create agent model requirements
|
|
57
|
+
*
|
|
58
|
+
* Note: [🐤] This is names `getModelRequirements` *(not `getAgentModelRequirements`)* because in future these two will be united
|
|
57
59
|
*/
|
|
58
|
-
|
|
60
|
+
getModelRequirements(): Promise<AgentModelRequirements>;
|
|
59
61
|
get title(): string_title & string_markdown_text;
|
|
60
62
|
get description(): string_markdown;
|
|
61
63
|
get profile(): ChatParticipant | undefined;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
|
|
2
2
|
import type { ChatPromptResult } from '../../execution/PromptResult';
|
|
3
|
+
import type { ModelRequirements } from '../../types/ModelRequirements';
|
|
3
4
|
import type { Prompt } from '../../types/Prompt';
|
|
4
5
|
import type { string_markdown, string_markdown_text, string_title, string_token } from '../../types/typeAliases';
|
|
5
6
|
import type { OpenAiAssistantExecutionToolsOptions } from './OpenAiAssistantExecutionToolsOptions';
|
|
@@ -54,6 +55,10 @@ export declare class OpenAiAssistantExecutionTools extends OpenAiExecutionTools
|
|
|
54
55
|
* Optional list of knowledge source links (URLs or file paths) to attach to the assistant via vector store
|
|
55
56
|
*/
|
|
56
57
|
readonly knowledgeSources?: ReadonlyArray<string>;
|
|
58
|
+
/**
|
|
59
|
+
* Optional list of tools to attach to the assistant
|
|
60
|
+
*/
|
|
61
|
+
readonly tools?: ModelRequirements['tools'];
|
|
57
62
|
}): Promise<OpenAiAssistantExecutionTools>;
|
|
58
63
|
updateAssistant(options: {
|
|
59
64
|
/**
|
|
@@ -72,6 +77,10 @@ export declare class OpenAiAssistantExecutionTools extends OpenAiExecutionTools
|
|
|
72
77
|
* Optional list of knowledge source links (URLs or file paths) to attach to the assistant via vector store
|
|
73
78
|
*/
|
|
74
79
|
readonly knowledgeSources?: ReadonlyArray<string>;
|
|
80
|
+
/**
|
|
81
|
+
* Optional list of tools to attach to the assistant
|
|
82
|
+
*/
|
|
83
|
+
readonly tools?: ModelRequirements['tools'];
|
|
75
84
|
}): Promise<OpenAiAssistantExecutionTools>;
|
|
76
85
|
/**
|
|
77
86
|
* Discriminant for type guards
|
|
@@ -85,6 +94,7 @@ export declare class OpenAiAssistantExecutionTools extends OpenAiExecutionTools
|
|
|
85
94
|
static isOpenAiAssistantExecutionTools(llmExecutionTools: LlmExecutionTools): llmExecutionTools is OpenAiAssistantExecutionTools;
|
|
86
95
|
}
|
|
87
96
|
/**
|
|
97
|
+
* TODO: [🙎] In `OpenAiAssistantExecutionTools` Allow to create abstract assistants with `isCreatingNewAssistantsAllowed`
|
|
88
98
|
* TODO: [🧠][🧙♂️] Maybe there can be some wizard for those who want to use just OpenAI
|
|
89
99
|
* TODO: Maybe make custom OpenAiError
|
|
90
100
|
* TODO: [🧠][🈁] Maybe use `isDeterministic` from options
|
|
@@ -46,7 +46,7 @@ export declare class RemoteLlmExecutionTools<TCustomOptions = undefined> impleme
|
|
|
46
46
|
private callCommonModel;
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
|
-
* TODO:
|
|
49
|
+
* TODO: [🕴] Deprecate pipeline server and all of its components
|
|
50
50
|
* TODO: Maybe use `$exportJson`
|
|
51
51
|
* TODO: [🧠][🛍] Maybe not `isAnonymous: boolean` BUT `mode: 'ANONYMOUS'|'COLLECTION'`
|
|
52
52
|
* TODO: [🍓] Allow to list compatible models with each variant
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Promisable } from 'type-fest';
|
|
2
|
+
import { TODO_any } from '../../_packages/types.index';
|
|
2
3
|
import type { CommonToolsOptions } from '../../execution/CommonToolsOptions';
|
|
3
4
|
import type { string_postprocessing_function_name } from '../../types/typeAliases';
|
|
4
5
|
/**
|
|
@@ -15,12 +16,16 @@ export type JavascriptExecutionToolsOptions = CommonToolsOptions & {
|
|
|
15
16
|
* Note: There are also some built-in functions available:
|
|
16
17
|
* @see ./JavascriptEvalExecutionTools.ts
|
|
17
18
|
*/
|
|
18
|
-
functions?: Record<string_postprocessing_function_name, PostprocessingFunction>;
|
|
19
|
+
functions?: Record<string_postprocessing_function_name, PostprocessingFunction | ToolFunction>;
|
|
19
20
|
};
|
|
20
21
|
/**
|
|
21
22
|
* Function that can be used to postprocess the output of the LLM
|
|
22
23
|
*/
|
|
23
24
|
export type PostprocessingFunction = ((value: string) => Promisable<string>) | Function;
|
|
25
|
+
/**
|
|
26
|
+
* Function that can be used as tool for AI model
|
|
27
|
+
*/
|
|
28
|
+
export type ToolFunction = (args: TODO_any) => Promise<TODO_any>;
|
|
24
29
|
/**
|
|
25
30
|
* TODO: [🧠][💙] Distinct between options passed into ExecutionTools and to ExecutionTools.execute
|
|
26
31
|
*/
|
|
@@ -29,12 +29,6 @@ export type CompletionModelRequirements = CommonModelRequirements & {
|
|
|
29
29
|
* Maximum number of tokens that can be generated by the model
|
|
30
30
|
*/
|
|
31
31
|
readonly maxTokens?: number;
|
|
32
|
-
/**
|
|
33
|
-
* Tools available for the model
|
|
34
|
-
*
|
|
35
|
-
* Note: [🚉] This is fully serializable as JSON
|
|
36
|
-
*/
|
|
37
|
-
readonly tools?: LlmToolDefinition[];
|
|
38
32
|
};
|
|
39
33
|
/**
|
|
40
34
|
* Model requirements for the chat variant
|
|
@@ -60,12 +54,6 @@ export type ChatModelRequirements = CommonModelRequirements & {
|
|
|
60
54
|
* Maximum number of tokens that can be generated by the model
|
|
61
55
|
*/
|
|
62
56
|
readonly maxTokens?: number;
|
|
63
|
-
/**
|
|
64
|
-
* Tools available for the model
|
|
65
|
-
*
|
|
66
|
-
* Note: [🚉] This is fully serializable as JSON
|
|
67
|
-
*/
|
|
68
|
-
readonly tools?: LlmToolDefinition[];
|
|
69
57
|
};
|
|
70
58
|
/**
|
|
71
59
|
* Model requirements for the image generation variant
|
|
@@ -135,6 +123,12 @@ export type CommonModelRequirements = {
|
|
|
135
123
|
* Seed for the model
|
|
136
124
|
*/
|
|
137
125
|
readonly seed?: number_seed;
|
|
126
|
+
/**
|
|
127
|
+
* Tools available for the model
|
|
128
|
+
*
|
|
129
|
+
* Note: [🚉] This is fully serializable as JSON
|
|
130
|
+
*/
|
|
131
|
+
readonly tools?: LlmToolDefinition[];
|
|
138
132
|
};
|
|
139
133
|
/**
|
|
140
134
|
* TODO: [🧠][🈁] `seed` should maybe be somewhere else (not in `ModelRequirements`) (similar that `user` identification is not here)
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { ExecCommandOptions } from './ExecCommandOptions';
|
|
2
|
-
import type { ExecCommandOptionsAdvanced } from './ExecCommandOptions';
|
|
1
|
+
import type { ExecCommandOptions, ExecCommandOptionsAdvanced } from './ExecCommandOptions';
|
|
3
2
|
/**
|
|
4
3
|
* Normalize options for `execCommand` and `execCommands`
|
|
5
4
|
*
|
|
@@ -7,6 +6,6 @@ import type { ExecCommandOptionsAdvanced } from './ExecCommandOptions';
|
|
|
7
6
|
*
|
|
8
7
|
* @private internal utility of `execCommand` and `execCommands`
|
|
9
8
|
*/
|
|
10
|
-
export declare function $execCommandNormalizeOptions(options: ExecCommandOptions): Pick<ExecCommandOptionsAdvanced, 'command' | 'args' | 'cwd' | 'crashOnError' | 'timeout' | 'isVerbose'> & {
|
|
9
|
+
export declare function $execCommandNormalizeOptions(options: ExecCommandOptions): Pick<ExecCommandOptionsAdvanced, 'command' | 'args' | 'cwd' | 'crashOnError' | 'timeout' | 'isVerbose' | 'env'> & {
|
|
11
10
|
humanReadableCommand: string;
|
|
12
11
|
};
|
|
@@ -5,7 +5,7 @@ type RequiredAndOptional<TBase, TRequired extends keyof TBase, TOptional extends
|
|
|
5
5
|
/**
|
|
6
6
|
* Simple options for `execCommand`
|
|
7
7
|
*/
|
|
8
|
-
export type ExecCommandOptions = string | RequiredAndOptional<ExecCommandOptionsAdvanced, 'command', 'args' | 'cwd' | 'crashOnError' | 'timeout' | 'isVerbose'>;
|
|
8
|
+
export type ExecCommandOptions = string | RequiredAndOptional<ExecCommandOptionsAdvanced, 'command', 'args' | 'cwd' | 'crashOnError' | 'timeout' | 'isVerbose' | 'env'>;
|
|
9
9
|
/**
|
|
10
10
|
* Advanced options for `execCommand`
|
|
11
11
|
*/
|
|
@@ -38,6 +38,12 @@ export type ExecCommandOptionsAdvanced = {
|
|
|
38
38
|
* @default false
|
|
39
39
|
*/
|
|
40
40
|
readonly isVerbose?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Environment variables to pass to the command
|
|
43
|
+
*
|
|
44
|
+
* Note: These will be merged with process.env
|
|
45
|
+
*/
|
|
46
|
+
readonly env?: Record<string, string>;
|
|
41
47
|
};
|
|
42
48
|
export {};
|
|
43
49
|
/**
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { chococake } from './really_any';
|
|
2
|
+
/**
|
|
3
|
+
* Just says that the dependency is imported, not used but should be kept
|
|
4
|
+
*
|
|
5
|
+
* @param dependenciesToKeep any values
|
|
6
|
+
* @returns void
|
|
7
|
+
* @private within the repository
|
|
8
|
+
*/
|
|
9
|
+
export declare function keepImported(...dependenciesToKeep: ReadonlyArray<chococake>): void;
|
|
@@ -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-2`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/google",
|
|
3
|
-
"version": "0.105.0-
|
|
3
|
+
"version": "0.105.0-3",
|
|
4
4
|
"description": "Promptbook: Turn your company's scattered knowledge into AI ready books",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
"module": "./esm/index.es.js",
|
|
96
96
|
"typings": "./esm/typings/src/_packages/google.index.d.ts",
|
|
97
97
|
"peerDependencies": {
|
|
98
|
-
"@promptbook/core": "0.105.0-
|
|
98
|
+
"@promptbook/core": "0.105.0-3"
|
|
99
99
|
},
|
|
100
100
|
"dependencies": {
|
|
101
101
|
"@ai-sdk/google": "1.0.17",
|
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.105.0-
|
|
26
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.105.0-3';
|
|
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
|
|
@@ -1535,6 +1535,7 @@
|
|
|
1535
1535
|
SEPARATOR: Color.fromHex('#cccccc'),
|
|
1536
1536
|
COMMITMENT: Color.fromHex('#DA0F78'),
|
|
1537
1537
|
PARAMETER: Color.fromHex('#8e44ad'),
|
|
1538
|
+
CODE_BLOCK: Color.fromHex('#7700ffff'),
|
|
1538
1539
|
});
|
|
1539
1540
|
// <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
|
|
1540
1541
|
/**
|