@promptbook/types 0.103.0-47 → 0.103.0-49
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/typings/src/_packages/core.index.d.ts +6 -0
- package/esm/typings/src/_packages/types.index.d.ts +4 -0
- package/esm/typings/src/_packages/utils.index.d.ts +2 -0
- package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +17 -3
- package/esm/typings/src/book-2.0/agent-source/AgentSourceParseResult.d.ts +2 -1
- package/esm/typings/src/book-2.0/agent-source/computeAgentHash.d.ts +8 -0
- package/esm/typings/src/book-2.0/agent-source/computeAgentHash.test.d.ts +1 -0
- package/esm/typings/src/book-2.0/agent-source/createDefaultAgentName.d.ts +8 -0
- package/esm/typings/src/book-2.0/agent-source/normalizeAgentName.d.ts +9 -0
- package/esm/typings/src/book-2.0/agent-source/normalizeAgentName.test.d.ts +1 -0
- package/esm/typings/src/book-2.0/agent-source/parseAgentSourceWithCommitments.d.ts +1 -1
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +14 -8
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabaseOptions.d.ts +10 -0
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentsDatabaseSchema.d.ts +57 -32
- package/esm/typings/src/commitments/MESSAGE/InitialMessageCommitmentDefinition.d.ts +28 -0
- package/esm/typings/src/commitments/index.d.ts +2 -1
- package/esm/typings/src/config.d.ts +1 -0
- package/esm/typings/src/errors/DatabaseError.d.ts +2 -2
- package/esm/typings/src/errors/WrappedError.d.ts +2 -2
- package/esm/typings/src/execution/ExecutionTask.d.ts +2 -2
- package/esm/typings/src/execution/LlmExecutionTools.d.ts +6 -1
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForWizardOrCli.d.ts +2 -2
- package/esm/typings/src/llm-providers/_common/utils/assertUniqueModels.d.ts +12 -0
- package/esm/typings/src/llm-providers/agent/Agent.d.ts +17 -4
- package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +10 -1
- package/esm/typings/src/llm-providers/agent/RemoteAgent.d.ts +6 -2
- package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +30 -4
- package/esm/typings/src/llm-providers/openai/openai-models.test.d.ts +4 -0
- package/esm/typings/src/remote-server/startAgentServer.d.ts +2 -2
- package/esm/typings/src/remote-server/startRemoteServer.d.ts +1 -2
- package/esm/typings/src/transpilers/openai-sdk/register.d.ts +1 -1
- package/esm/typings/src/types/typeAliases.d.ts +6 -0
- package/esm/typings/src/utils/color/Color.d.ts +7 -0
- package/esm/typings/src/utils/color/Color.test.d.ts +1 -0
- package/esm/typings/src/utils/environment/$getGlobalScope.d.ts +2 -2
- package/esm/typings/src/utils/misc/computeHash.d.ts +11 -0
- package/esm/typings/src/utils/misc/computeHash.test.d.ts +1 -0
- package/esm/typings/src/utils/normalization/normalize-to-kebab-case.d.ts +2 -0
- package/esm/typings/src/utils/normalization/normalizeTo_PascalCase.d.ts +3 -0
- package/esm/typings/src/utils/normalization/normalizeTo_camelCase.d.ts +2 -0
- package/esm/typings/src/utils/normalization/titleToName.d.ts +2 -0
- package/esm/typings/src/utils/organization/$sideEffect.d.ts +2 -2
- package/esm/typings/src/utils/organization/$side_effect.d.ts +2 -2
- package/esm/typings/src/utils/organization/TODO_USE.d.ts +2 -2
- package/esm/typings/src/utils/organization/keepUnused.d.ts +2 -2
- package/esm/typings/src/utils/organization/preserve.d.ts +3 -3
- package/esm/typings/src/utils/organization/really_any.d.ts +7 -0
- package/esm/typings/src/utils/serialization/asSerializable.d.ts +2 -2
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION } from '../version';
|
|
2
|
+
import { computeAgentHash } from '../book-2.0/agent-source/computeAgentHash';
|
|
2
3
|
import { createAgentModelRequirements } from '../book-2.0/agent-source/createAgentModelRequirements';
|
|
3
4
|
import { createAgentModelRequirementsWithCommitments } from '../book-2.0/agent-source/createAgentModelRequirementsWithCommitments';
|
|
5
|
+
import { createDefaultAgentName } from '../book-2.0/agent-source/createDefaultAgentName';
|
|
6
|
+
import { normalizeAgentName } from '../book-2.0/agent-source/normalizeAgentName';
|
|
4
7
|
import { PADDING_LINES } from '../book-2.0/agent-source/padBook';
|
|
5
8
|
import { padBook } from '../book-2.0/agent-source/padBook';
|
|
6
9
|
import { parseAgentSource } from '../book-2.0/agent-source/parseAgentSource';
|
|
@@ -188,8 +191,11 @@ import { aboutPromptbookInformation } from '../utils/misc/aboutPromptbookInforma
|
|
|
188
191
|
import { $generateBookBoilerplate } from '../utils/random/$generateBookBoilerplate';
|
|
189
192
|
import { REMOTE_SERVER_URLS } from '../../servers';
|
|
190
193
|
export { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION };
|
|
194
|
+
export { computeAgentHash };
|
|
191
195
|
export { createAgentModelRequirements };
|
|
192
196
|
export { createAgentModelRequirementsWithCommitments };
|
|
197
|
+
export { createDefaultAgentName };
|
|
198
|
+
export { normalizeAgentName };
|
|
193
199
|
export { PADDING_LINES };
|
|
194
200
|
export { padBook };
|
|
195
201
|
export { parseAgentSource };
|
|
@@ -21,6 +21,7 @@ import type { ChatParticipant } from '../book-components/Chat/types/ChatParticip
|
|
|
21
21
|
import type { MessageButton } from '../book-components/Chat/utils/parseMessageButtons';
|
|
22
22
|
import type { QrCodeOptions } from '../book-components/Qr/useQrCode';
|
|
23
23
|
import type { AgentCollection } from '../collection/agent-collection/AgentCollection';
|
|
24
|
+
import type { AgentCollectionInSupabaseOptions } from '../collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabaseOptions';
|
|
24
25
|
import type { Json } from '../collection/agent-collection/constructors/agent-collection-in-supabase/AgentsDatabaseSchema';
|
|
25
26
|
import type { AgentsDatabaseSchema } from '../collection/agent-collection/constructors/agent-collection-in-supabase/AgentsDatabaseSchema';
|
|
26
27
|
import type { Tables } from '../collection/agent-collection/constructors/agent-collection-in-supabase/AgentsDatabaseSchema';
|
|
@@ -219,6 +220,7 @@ import type { ReservedParameters } from '../types/typeAliases';
|
|
|
219
220
|
import type { string_title } from '../types/typeAliases';
|
|
220
221
|
import type { string_agent_name } from '../types/typeAliases';
|
|
221
222
|
import type { string_agent_name_in_book } from '../types/typeAliases';
|
|
223
|
+
import type { string_agent_hash } from '../types/typeAliases';
|
|
222
224
|
import type { string_persona_description } from '../types/typeAliases';
|
|
223
225
|
import type { string_model_description } from '../types/typeAliases';
|
|
224
226
|
import type { string_knowledge_source_content } from '../types/typeAliases';
|
|
@@ -376,6 +378,7 @@ export type { ChatParticipant };
|
|
|
376
378
|
export type { MessageButton };
|
|
377
379
|
export type { QrCodeOptions };
|
|
378
380
|
export type { AgentCollection };
|
|
381
|
+
export type { AgentCollectionInSupabaseOptions };
|
|
379
382
|
export type { Json };
|
|
380
383
|
export type { AgentsDatabaseSchema };
|
|
381
384
|
export type { Tables };
|
|
@@ -574,6 +577,7 @@ export type { ReservedParameters };
|
|
|
574
577
|
export type { string_title };
|
|
575
578
|
export type { string_agent_name };
|
|
576
579
|
export type { string_agent_name_in_book };
|
|
580
|
+
export type { string_agent_hash };
|
|
577
581
|
export type { string_persona_description };
|
|
578
582
|
export type { string_model_description };
|
|
579
583
|
export type { string_knowledge_source_content };
|
|
@@ -27,6 +27,7 @@ import { countSentences } from '../utils/expectation-counters/countSentences';
|
|
|
27
27
|
import { countWords } from '../utils/expectation-counters/countWords';
|
|
28
28
|
import { CountUtils } from '../utils/expectation-counters/index';
|
|
29
29
|
import { $getCurrentDate } from '../utils/misc/$getCurrentDate';
|
|
30
|
+
import { computeHash } from '../utils/misc/computeHash';
|
|
30
31
|
import { debounce } from '../utils/misc/debounce';
|
|
31
32
|
import { parseNumber } from '../utils/misc/parseNumber';
|
|
32
33
|
import { capitalize } from '../utils/normalization/capitalize';
|
|
@@ -113,6 +114,7 @@ export { countSentences };
|
|
|
113
114
|
export { countWords };
|
|
114
115
|
export { CountUtils };
|
|
115
116
|
export { $getCurrentDate };
|
|
117
|
+
export { computeHash };
|
|
116
118
|
export { debounce };
|
|
117
119
|
export { parseNumber };
|
|
118
120
|
export { capitalize };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { string_agent_name, string_color, string_url_image } from '../../types/typeAliases';
|
|
1
|
+
import type { string_agent_hash, string_agent_name, string_agent_url, string_color, string_url_image } from '../../types/typeAliases';
|
|
2
2
|
/**
|
|
3
3
|
* Unified parameter representation that supports two different notations:
|
|
4
4
|
* 1. @Parameter - single word parameter starting with @
|
|
@@ -28,12 +28,21 @@ export type AgentBasicInformation = {
|
|
|
28
28
|
* Name of the agent
|
|
29
29
|
* This is the first line of the agent source
|
|
30
30
|
*/
|
|
31
|
-
agentName: string_agent_name
|
|
31
|
+
agentName: string_agent_name;
|
|
32
|
+
/**
|
|
33
|
+
* Hash of the agent source for integrity verification
|
|
34
|
+
*/
|
|
35
|
+
agentHash: string_agent_hash;
|
|
32
36
|
/**
|
|
33
37
|
* Optional description of the agent
|
|
34
38
|
* This is the line starting with "PERSONA"
|
|
35
39
|
*/
|
|
36
40
|
personaDescription: string | null;
|
|
41
|
+
/**
|
|
42
|
+
* The initial message shown to the user when the chat starts
|
|
43
|
+
* This is the line starting with "INITIAL MESSAGE"
|
|
44
|
+
*/
|
|
45
|
+
initialMessage: string | null;
|
|
37
46
|
/**
|
|
38
47
|
* Metadata commitments parsed from META lines
|
|
39
48
|
* Each META commitment has the format "META TYPE content"
|
|
@@ -44,6 +53,11 @@ export type AgentBasicInformation = {
|
|
|
44
53
|
color?: string_color;
|
|
45
54
|
[key: string]: string | undefined;
|
|
46
55
|
};
|
|
56
|
+
/**
|
|
57
|
+
* Links found in the agent source
|
|
58
|
+
* This corresponds to META LINK commitments
|
|
59
|
+
*/
|
|
60
|
+
links: Array<string_agent_url>;
|
|
47
61
|
/**
|
|
48
62
|
* Parameters found in the agent source
|
|
49
63
|
* Supports two different notations for the same syntax feature:
|
|
@@ -53,6 +67,6 @@ export type AgentBasicInformation = {
|
|
|
53
67
|
parameters: BookParameter[];
|
|
54
68
|
};
|
|
55
69
|
/**
|
|
56
|
-
* TODO:
|
|
70
|
+
* TODO: [🐱🚀] Make all properties of `AgentBasicInformation` readonly
|
|
57
71
|
* TODO: [🕛] Unite `AgentBasicInformation`, `ChatParticipant`, `LlmExecutionTools` + `LlmToolsMetadata`
|
|
58
72
|
*/
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ParsedCommitment } from '../../commitments/_base/ParsedCommitment';
|
|
2
|
+
import { string_agent_name } from '../../types/typeAliases';
|
|
2
3
|
/**
|
|
3
4
|
* Result of parsing agent source for commitments
|
|
4
5
|
*
|
|
@@ -8,7 +9,7 @@ export type AgentSourceParseResult = {
|
|
|
8
9
|
/**
|
|
9
10
|
* The agent name (first line)
|
|
10
11
|
*/
|
|
11
|
-
agentName:
|
|
12
|
+
agentName: string_agent_name | null;
|
|
12
13
|
/**
|
|
13
14
|
* All parsed commitments
|
|
14
15
|
*/
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { string_agent_hash } from '../../types/typeAliases';
|
|
2
|
+
import { string_book } from './string_book';
|
|
3
|
+
/**
|
|
4
|
+
* Computes SHA-256 hash of the agent source
|
|
5
|
+
*
|
|
6
|
+
* @public exported from `@promptbook/core`
|
|
7
|
+
*/
|
|
8
|
+
export declare function computeAgentHash(agentSource: string_book): string_agent_hash;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { string_agent_name } from '../../types/typeAliases';
|
|
2
|
+
import { string_book } from './string_book';
|
|
3
|
+
/**
|
|
4
|
+
* Creates temporary default agent name based on agent source hash
|
|
5
|
+
*
|
|
6
|
+
* @public exported from `@promptbook/core`
|
|
7
|
+
*/
|
|
8
|
+
export declare function createDefaultAgentName(agentSource: string_book): string_agent_name;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { string_agent_name } from '../../types/typeAliases';
|
|
2
|
+
/**
|
|
3
|
+
* Normalizes agent name from arbitrary string to valid agent name
|
|
4
|
+
*
|
|
5
|
+
* Note: [🔂] This function is idempotent.
|
|
6
|
+
*
|
|
7
|
+
* @public exported from `@promptbook/core`
|
|
8
|
+
*/
|
|
9
|
+
export declare function normalizeAgentName(rawAgentName: string): string_agent_name;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -6,4 +6,4 @@ import type { string_book } from './string_book';
|
|
|
6
6
|
*
|
|
7
7
|
* @private internal utility of `parseAgentSource`
|
|
8
8
|
*/
|
|
9
|
-
export declare function parseAgentSourceWithCommitments(agentSource: string_book): AgentSourceParseResult
|
|
9
|
+
export declare function parseAgentSourceWithCommitments(agentSource: string_book): Omit<AgentSourceParseResult, 'agentHash'>;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { SupabaseClient } from '@supabase/supabase-js';
|
|
2
2
|
import type { AgentBasicInformation } from '../../../../book-2.0/agent-source/AgentBasicInformation';
|
|
3
3
|
import type { string_book } from '../../../../book-2.0/agent-source/string_book';
|
|
4
|
-
import type { CommonToolsOptions } from '../../../../execution/CommonToolsOptions';
|
|
5
|
-
import type { PrepareAndScrapeOptions } from '../../../../prepare/PrepareAndScrapeOptions';
|
|
6
4
|
import type { string_agent_name } from '../../../../types/typeAliases';
|
|
5
|
+
import { AgentCollectionInSupabaseOptions } from './AgentCollectionInSupabaseOptions';
|
|
7
6
|
import type { AgentsDatabaseSchema } from './AgentsDatabaseSchema';
|
|
8
7
|
/**
|
|
9
8
|
* Agent collection stored in Supabase table
|
|
@@ -11,23 +10,23 @@ import type { AgentsDatabaseSchema } from './AgentsDatabaseSchema';
|
|
|
11
10
|
* Note: This object can work both from Node.js and browser environment depending on the Supabase client provided
|
|
12
11
|
*
|
|
13
12
|
* @public exported from `@promptbook/core`
|
|
14
|
-
* <- TODO:
|
|
13
|
+
* <- TODO: [🐱🚀] Move to `@promptbook/supabase` package
|
|
15
14
|
*/
|
|
16
15
|
export declare class AgentCollectionInSupabase {
|
|
17
16
|
private readonly supabaseClient;
|
|
18
|
-
readonly options?:
|
|
17
|
+
readonly options?: AgentCollectionInSupabaseOptions | undefined;
|
|
19
18
|
/**
|
|
20
19
|
* @param rootPath - path to the directory with agents
|
|
21
|
-
* @param tools - Execution tools to be used in
|
|
20
|
+
* @param tools - Execution tools to be used in [🐱🚀] `Agent` itself and listing the agents
|
|
22
21
|
* @param options - Options for the collection creation
|
|
23
22
|
*/
|
|
24
|
-
constructor(supabaseClient: SupabaseClient<AgentsDatabaseSchema>, options?:
|
|
23
|
+
constructor(supabaseClient: SupabaseClient<AgentsDatabaseSchema>, options?: AgentCollectionInSupabaseOptions | undefined);
|
|
25
24
|
/**
|
|
26
25
|
* Gets all agents in the collection
|
|
27
26
|
*/
|
|
28
27
|
listAgents(): Promise<ReadonlyArray<AgentBasicInformation>>;
|
|
29
28
|
/**
|
|
30
|
-
*
|
|
29
|
+
* [🐱🚀]@@@
|
|
31
30
|
*/
|
|
32
31
|
getAgentSource(agentName: string_agent_name): Promise<string_book>;
|
|
33
32
|
/**
|
|
@@ -44,9 +43,16 @@ export declare class AgentCollectionInSupabase {
|
|
|
44
43
|
* Deletes an agent from the collection
|
|
45
44
|
*/
|
|
46
45
|
deleteAgent(agentName: string_agent_name): Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* Get the Supabase table name with prefix
|
|
48
|
+
*
|
|
49
|
+
* @param tableName - The original table name
|
|
50
|
+
* @returns The prefixed table name
|
|
51
|
+
*/
|
|
52
|
+
private getTableName;
|
|
47
53
|
}
|
|
48
54
|
/**
|
|
49
|
-
* TODO:
|
|
55
|
+
* TODO: [🐱🚀] Implement it here correctly and update JSDoc comments here, and on interface + other implementations
|
|
50
56
|
* TODO: Write unit test
|
|
51
57
|
* TODO: [🧠][🚙] `AgentXxx` vs `AgentsXxx` naming convention
|
|
52
58
|
*/
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CommonToolsOptions } from '../../../../execution/CommonToolsOptions';
|
|
2
|
+
import type { PrepareAndScrapeOptions } from '../../../../prepare/PrepareAndScrapeOptions';
|
|
3
|
+
export type AgentCollectionInSupabaseOptions = PrepareAndScrapeOptions & CommonToolsOptions & {
|
|
4
|
+
/**
|
|
5
|
+
* The Supabase tables prefix to use
|
|
6
|
+
*
|
|
7
|
+
* @default ''
|
|
8
|
+
*/
|
|
9
|
+
tablePrefix?: string;
|
|
10
|
+
};
|
|
@@ -1,65 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AUTO-GENERATED SUBSET TYPES FROM `/apps/agents-server/src/database/schema.ts`
|
|
3
|
+
* Source of truth: `/apps/agents-server/src/database/schema.sql` *(do not edit table structure here manually)*
|
|
4
|
+
*
|
|
5
|
+
* [💽] Prompt:
|
|
6
|
+
* Re-generate this sub-schema
|
|
7
|
+
* Generate Supabase TypeScript schema which is a subset of `AgentsServerDatabase`
|
|
8
|
+
* containing only tables `Agent` and `AgentHistory`
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This file intentionally omits all other tables (EnvironmentVariable, ChatHistory, ChatFeedback)
|
|
11
|
+
* and any extra schemas (e.g. `graphql_public`) to remain a strict subset.
|
|
12
|
+
*/
|
|
1
13
|
export type Json = string | number | boolean | null | {
|
|
2
14
|
[key: string]: Json | undefined;
|
|
3
15
|
} | Json[];
|
|
4
16
|
export type AgentsDatabaseSchema = {
|
|
5
|
-
graphql_public: {
|
|
6
|
-
Tables: {
|
|
7
|
-
[_ in never]: never;
|
|
8
|
-
};
|
|
9
|
-
Views: {
|
|
10
|
-
[_ in never]: never;
|
|
11
|
-
};
|
|
12
|
-
Functions: {
|
|
13
|
-
graphql: {
|
|
14
|
-
Args: {
|
|
15
|
-
operationName?: string;
|
|
16
|
-
query?: string;
|
|
17
|
-
variables?: Json;
|
|
18
|
-
extensions?: Json;
|
|
19
|
-
};
|
|
20
|
-
Returns: Json;
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
Enums: {
|
|
24
|
-
[_ in never]: never;
|
|
25
|
-
};
|
|
26
|
-
CompositeTypes: {
|
|
27
|
-
[_ in never]: never;
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
17
|
public: {
|
|
31
18
|
Tables: {
|
|
32
|
-
|
|
19
|
+
Agent: {
|
|
33
20
|
Row: {
|
|
34
21
|
id: number;
|
|
35
22
|
agentName: string;
|
|
36
|
-
agentProfile: Json;
|
|
37
23
|
createdAt: string;
|
|
38
24
|
updatedAt: string | null;
|
|
39
|
-
|
|
25
|
+
agentHash: string;
|
|
26
|
+
agentSource: string;
|
|
27
|
+
agentProfile: Json;
|
|
40
28
|
promptbookEngineVersion: string;
|
|
41
29
|
usage: Json | null;
|
|
42
|
-
|
|
30
|
+
preparedModelRequirements: Json | null;
|
|
31
|
+
preparedExternals: Json | null;
|
|
43
32
|
};
|
|
44
33
|
Insert: {
|
|
45
34
|
id?: number;
|
|
46
35
|
agentName: string;
|
|
47
36
|
createdAt: string;
|
|
48
37
|
updatedAt?: string | null;
|
|
49
|
-
|
|
38
|
+
agentHash: string;
|
|
39
|
+
agentSource: string;
|
|
40
|
+
agentProfile: Json;
|
|
50
41
|
promptbookEngineVersion: string;
|
|
51
42
|
usage?: Json | null;
|
|
52
|
-
|
|
43
|
+
preparedModelRequirements?: Json | null;
|
|
44
|
+
preparedExternals?: Json | null;
|
|
53
45
|
};
|
|
54
46
|
Update: {
|
|
55
47
|
id?: number;
|
|
56
48
|
agentName?: string;
|
|
57
49
|
createdAt?: string;
|
|
58
50
|
updatedAt?: string | null;
|
|
59
|
-
|
|
51
|
+
agentHash?: string;
|
|
52
|
+
agentSource?: string;
|
|
53
|
+
agentProfile?: Json;
|
|
60
54
|
promptbookEngineVersion?: string;
|
|
61
55
|
usage?: Json | null;
|
|
56
|
+
preparedModelRequirements?: Json | null;
|
|
57
|
+
preparedExternals?: Json | null;
|
|
58
|
+
};
|
|
59
|
+
Relationships: [];
|
|
60
|
+
};
|
|
61
|
+
AgentHistory: {
|
|
62
|
+
Row: {
|
|
63
|
+
id: number;
|
|
64
|
+
createdAt: string;
|
|
65
|
+
agentName: string;
|
|
66
|
+
agentHash: string;
|
|
67
|
+
previousAgentHash: string | null;
|
|
68
|
+
agentSource: string;
|
|
69
|
+
promptbookEngineVersion: string;
|
|
70
|
+
};
|
|
71
|
+
Insert: {
|
|
72
|
+
id?: number;
|
|
73
|
+
createdAt: string;
|
|
74
|
+
agentName: string;
|
|
75
|
+
agentHash: string;
|
|
76
|
+
previousAgentHash?: string | null;
|
|
77
|
+
agentSource: string;
|
|
78
|
+
promptbookEngineVersion: string;
|
|
79
|
+
};
|
|
80
|
+
Update: {
|
|
81
|
+
id?: number;
|
|
82
|
+
createdAt?: string;
|
|
83
|
+
agentName?: string;
|
|
84
|
+
agentHash?: string;
|
|
85
|
+
previousAgentHash?: string | null;
|
|
62
86
|
agentSource?: string;
|
|
87
|
+
promptbookEngineVersion?: string;
|
|
63
88
|
};
|
|
64
89
|
Relationships: [];
|
|
65
90
|
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
|
|
2
|
+
import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
3
|
+
/**
|
|
4
|
+
* INITIAL MESSAGE commitment definition
|
|
5
|
+
*
|
|
6
|
+
* The INITIAL MESSAGE commitment defines the first message that the user sees when opening the chat.
|
|
7
|
+
* It is used to greet the user and set the tone of the conversation.
|
|
8
|
+
*
|
|
9
|
+
* Example usage in agent source:
|
|
10
|
+
*
|
|
11
|
+
* ```book
|
|
12
|
+
* INITIAL MESSAGE Hello! I am ready to help you with your tasks.
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* @private [🪔] Maybe export the commitments through some package
|
|
16
|
+
*/
|
|
17
|
+
export declare class InitialMessageCommitmentDefinition extends BaseCommitmentDefinition<'INITIAL MESSAGE'> {
|
|
18
|
+
constructor();
|
|
19
|
+
/**
|
|
20
|
+
* Short one-line description of INITIAL MESSAGE.
|
|
21
|
+
*/
|
|
22
|
+
get description(): string;
|
|
23
|
+
/**
|
|
24
|
+
* Markdown documentation for INITIAL MESSAGE commitment.
|
|
25
|
+
*/
|
|
26
|
+
get documentation(): string;
|
|
27
|
+
applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
|
|
28
|
+
}
|
|
@@ -6,6 +6,7 @@ import { FormatCommitmentDefinition } from './FORMAT/FORMAT';
|
|
|
6
6
|
import { GoalCommitmentDefinition } from './GOAL/GOAL';
|
|
7
7
|
import { KnowledgeCommitmentDefinition } from './KNOWLEDGE/KNOWLEDGE';
|
|
8
8
|
import { MemoryCommitmentDefinition } from './MEMORY/MEMORY';
|
|
9
|
+
import { InitialMessageCommitmentDefinition } from './MESSAGE/InitialMessageCommitmentDefinition';
|
|
9
10
|
import { MessageCommitmentDefinition } from './MESSAGE/MESSAGE';
|
|
10
11
|
import { MetaCommitmentDefinition } from './META/META';
|
|
11
12
|
import { ModelCommitmentDefinition } from './MODEL/MODEL';
|
|
@@ -23,7 +24,7 @@ import { NotYetImplementedCommitmentDefinition } from './_base/NotYetImplemented
|
|
|
23
24
|
*
|
|
24
25
|
* @private Use functions to access commitments instead of this array directly
|
|
25
26
|
*/
|
|
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">];
|
|
27
|
+
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, InitialMessageCommitmentDefinition, MessageCommitmentDefinition, MessageCommitmentDefinition, ScenarioCommitmentDefinition, ScenarioCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, NotYetImplementedCommitmentDefinition<"EXPECT">, NotYetImplementedCommitmentDefinition<"BEHAVIOUR">, NotYetImplementedCommitmentDefinition<"BEHAVIOURS">, NotYetImplementedCommitmentDefinition<"AVOID">, NotYetImplementedCommitmentDefinition<"AVOIDANCE">, NotYetImplementedCommitmentDefinition<"CONTEXT">];
|
|
27
28
|
/**
|
|
28
29
|
* Gets a commitment definition by its type
|
|
29
30
|
* @param type The commitment type to look up
|
|
@@ -54,6 +54,7 @@ export declare const PROMPTBOOK_COLOR: import("./utils/take/interfaces/ITakeChai
|
|
|
54
54
|
export declare const PROMPTBOOK_SYNTAX_COLORS: {
|
|
55
55
|
readonly TITLE: import("./utils/take/interfaces/ITakeChain").WithTake<Color>;
|
|
56
56
|
readonly LINE: import("./utils/take/interfaces/ITakeChain").WithTake<Color>;
|
|
57
|
+
readonly SEPARATOR: import("./utils/take/interfaces/ITakeChain").WithTake<Color>;
|
|
57
58
|
readonly COMMITMENT: import("./utils/take/interfaces/ITakeChain").WithTake<Color>;
|
|
58
59
|
readonly PARAMETER: import("./utils/take/interfaces/ITakeChain").WithTake<Color>;
|
|
59
60
|
};
|
|
@@ -8,5 +8,5 @@ export declare class DatabaseError extends Error {
|
|
|
8
8
|
constructor(message: string);
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
|
-
* TODO:
|
|
12
|
-
*/
|
|
11
|
+
* TODO: [🐱🚀] Explain that NotFoundError ([🐱🚀] and other specific errors) has priority over DatabaseError in some contexts
|
|
12
|
+
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { chococake } from '../utils/organization/really_any';
|
|
2
2
|
/**
|
|
3
3
|
* This error type indicates that somewhere in the code non-Error object was thrown and it was wrapped into the `WrappedError`
|
|
4
4
|
*
|
|
@@ -6,5 +6,5 @@ import type { really_any } from '../utils/organization/really_any';
|
|
|
6
6
|
*/
|
|
7
7
|
export declare class WrappedError extends Error {
|
|
8
8
|
readonly name = "WrappedError";
|
|
9
|
-
constructor(whatWasThrown:
|
|
9
|
+
constructor(whatWasThrown: chococake);
|
|
10
10
|
}
|
|
@@ -3,7 +3,7 @@ import { PartialDeep } from 'type-fest';
|
|
|
3
3
|
import type { LlmCall } from '../types/LlmCall';
|
|
4
4
|
import type { number_percent, task_id } from '../types/typeAliases';
|
|
5
5
|
import type { string_SCREAMING_CASE } from '../utils/normalization/normalizeTo_SCREAMING_CASE';
|
|
6
|
-
import type {
|
|
6
|
+
import type { chococake } from '../utils/organization/really_any';
|
|
7
7
|
import type { string_promptbook_version } from '../version';
|
|
8
8
|
import type { AbstractTaskResult } from './AbstractTaskResult';
|
|
9
9
|
import type { PipelineExecutorResult } from './PipelineExecutorResult';
|
|
@@ -144,7 +144,7 @@ export type AbstractTask<TTaskResult extends AbstractTaskResult> = {
|
|
|
144
144
|
/**
|
|
145
145
|
* Optional nonce to correlate logs with version of the Promptbook engine
|
|
146
146
|
*/
|
|
147
|
-
readonly ptbkNonce?:
|
|
147
|
+
readonly ptbkNonce?: chococake;
|
|
148
148
|
};
|
|
149
149
|
export type Task = ExecutionTask | PreparationTask;
|
|
150
150
|
export {};
|
|
@@ -9,11 +9,12 @@ import type { ChatPromptResult, CompletionPromptResult, EmbeddingPromptResult }
|
|
|
9
9
|
* On its interface it exposes common methods for prompt execution.
|
|
10
10
|
* Inside (in constructor) it calls OpenAI, Azure, GPU, proxy, cache, logging,...
|
|
11
11
|
*
|
|
12
|
-
*
|
|
12
|
+
* Note: [🦖] There are several different things in Promptbook:
|
|
13
13
|
* - `Agent` - which represents an AI Agent with its source, memories, actions, etc. Agent is a higher-level abstraction which is internally using:
|
|
14
14
|
* - `LlmExecutionTools` - which wraps one or more LLM models and provides an interface to execute them
|
|
15
15
|
* - `AgentLlmExecutionTools` - which is a specific implementation of `LlmExecutionTools` that wraps another LlmExecutionTools and applies agent-specific system prompts and requirements
|
|
16
16
|
* - `OpenAiAssistantExecutionTools` - which is a specific implementation of `LlmExecutionTools` for OpenAI models with assistant capabilities, recommended for usage in `Agent` or `AgentLlmExecutionTools`
|
|
17
|
+
* - `RemoteAgent` - which is an `Agent` that connects to a Promptbook Agents Server
|
|
17
18
|
*
|
|
18
19
|
* @see https://github.com/webgptorg/promptbook#llm-execution-tools
|
|
19
20
|
*/
|
|
@@ -52,6 +53,10 @@ export type LlmExecutionTools = {
|
|
|
52
53
|
* Calls a chat model
|
|
53
54
|
*/
|
|
54
55
|
callChatModel?(prompt: Prompt): Promise<ChatPromptResult>;
|
|
56
|
+
/**
|
|
57
|
+
* Calls a chat model with streaming
|
|
58
|
+
*/
|
|
59
|
+
callChatModelStream?(prompt: Prompt, onProgress: (chunk: ChatPromptResult) => void): Promise<ChatPromptResult>;
|
|
55
60
|
/**
|
|
56
61
|
* Calls a completion model
|
|
57
62
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Promisable } from 'type-fest';
|
|
2
2
|
import type { Identification } from '../../../remote-server/socket-types/_subtypes/Identification';
|
|
3
3
|
import type { string_app_id, string_url } from '../../../types/typeAliases';
|
|
4
|
-
import type {
|
|
4
|
+
import type { chococake } from '../../../utils/organization/really_any';
|
|
5
5
|
import type { CacheLlmToolsOptions } from '../utils/cache/CacheLlmToolsOptions';
|
|
6
6
|
import type { LlmExecutionToolsWithTotalUsage } from '../utils/count-total-usage/LlmExecutionToolsWithTotalUsage';
|
|
7
7
|
type ProvideLlmToolsForWizardOrCliOptions = {
|
|
@@ -38,7 +38,7 @@ type ProvideLlmToolsForWizardOrCliOptions = {
|
|
|
38
38
|
*
|
|
39
39
|
* Note: When login prompt fails, `process.exit(1)` is called
|
|
40
40
|
*/
|
|
41
|
-
loginPrompt(): Promisable<Identification<
|
|
41
|
+
loginPrompt(): Promisable<Identification<chococake>>;
|
|
42
42
|
});
|
|
43
43
|
/**
|
|
44
44
|
* Returns LLM tools for CLI
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AvailableModel } from '../../../execution/AvailableModel';
|
|
2
|
+
/**
|
|
3
|
+
* Utility to assert that all models in the provided array have unique `modelName` values.
|
|
4
|
+
*
|
|
5
|
+
* This is internal utility for unit tests to ensure no duplicate model names exist.
|
|
6
|
+
*
|
|
7
|
+
* @private internal utility of unit tests
|
|
8
|
+
*/
|
|
9
|
+
export declare function assertUniqueModels(models: ReadonlyArray<AvailableModel>): void;
|
|
10
|
+
/**
|
|
11
|
+
* Note: [⚪] This should never be in any released package
|
|
12
|
+
*/
|
|
@@ -2,29 +2,43 @@ import { BehaviorSubject } from 'rxjs';
|
|
|
2
2
|
import type { AgentBasicInformation, BookParameter } from '../../book-2.0/agent-source/AgentBasicInformation';
|
|
3
3
|
import type { string_book } from '../../book-2.0/agent-source/string_book';
|
|
4
4
|
import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
|
|
5
|
-
import type { string_agent_name, string_url_image } from '../../types/typeAliases';
|
|
5
|
+
import type { string_agent_hash, string_agent_name, string_agent_url, string_url_image } from '../../types/typeAliases';
|
|
6
6
|
import { AgentLlmExecutionTools } from './AgentLlmExecutionTools';
|
|
7
7
|
import type { AgentOptions } from './AgentOptions';
|
|
8
8
|
/**
|
|
9
9
|
* Represents one AI Agent
|
|
10
10
|
*
|
|
11
|
-
*
|
|
11
|
+
* Note: [🦖] There are several different things in Promptbook:
|
|
12
12
|
* - `Agent` - which represents an AI Agent with its source, memories, actions, etc. Agent is a higher-level abstraction which is internally using:
|
|
13
13
|
* - `LlmExecutionTools` - which wraps one or more LLM models and provides an interface to execute them
|
|
14
14
|
* - `AgentLlmExecutionTools` - which is a specific implementation of `LlmExecutionTools` that wraps another LlmExecutionTools and applies agent-specific system prompts and requirements
|
|
15
15
|
* - `OpenAiAssistantExecutionTools` - which is a specific implementation of `LlmExecutionTools` for OpenAI models with assistant capabilities, recommended for usage in `Agent` or `AgentLlmExecutionTools`
|
|
16
|
+
* - `RemoteAgent` - which is an `Agent` that connects to a Promptbook Agents Server
|
|
16
17
|
*
|
|
17
18
|
* @public exported from `@promptbook/core`
|
|
18
19
|
*/
|
|
19
20
|
export declare class Agent extends AgentLlmExecutionTools implements LlmExecutionTools, AgentBasicInformation {
|
|
21
|
+
private _agentName;
|
|
20
22
|
/**
|
|
21
23
|
* Name of the agent
|
|
22
24
|
*/
|
|
23
|
-
agentName: string_agent_name
|
|
25
|
+
get agentName(): string_agent_name;
|
|
24
26
|
/**
|
|
25
27
|
* Description of the agent
|
|
26
28
|
*/
|
|
27
29
|
personaDescription: string | null;
|
|
30
|
+
/**
|
|
31
|
+
* The initial message shown to the user when the chat starts
|
|
32
|
+
*/
|
|
33
|
+
initialMessage: string | null;
|
|
34
|
+
/**
|
|
35
|
+
* Links found in the agent source
|
|
36
|
+
*/
|
|
37
|
+
links: Array<string_agent_url>;
|
|
38
|
+
/**
|
|
39
|
+
* Computed hash of the agent source for integrity verification
|
|
40
|
+
*/
|
|
41
|
+
get agentHash(): string_agent_hash;
|
|
28
42
|
/**
|
|
29
43
|
* Metadata like image or color
|
|
30
44
|
*/
|
|
@@ -44,5 +58,4 @@ export declare class Agent extends AgentLlmExecutionTools implements LlmExecutio
|
|
|
44
58
|
}
|
|
45
59
|
/**
|
|
46
60
|
* TODO: [🧠][😰]Agent is not working with the parameters, should it be?
|
|
47
|
-
* TODO: !!! Agent on remote server
|
|
48
61
|
*/
|
|
@@ -10,16 +10,21 @@ import type { CreateAgentLlmExecutionToolsOptions } from './CreateAgentLlmExecut
|
|
|
10
10
|
* Execution Tools for calling LLM models with a predefined agent "soul"
|
|
11
11
|
* This wraps underlying LLM execution tools and applies agent-specific system prompts and requirements
|
|
12
12
|
*
|
|
13
|
-
*
|
|
13
|
+
* Note: [🦖] There are several different things in Promptbook:
|
|
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
|
* - `OpenAiAssistantExecutionTools` - which is a specific implementation of `LlmExecutionTools` for OpenAI models with assistant capabilities, recommended for usage in `Agent` or `AgentLlmExecutionTools`
|
|
18
|
+
* - `RemoteAgent` - which is an `Agent` that connects to a Promptbook Agents Server
|
|
18
19
|
*
|
|
19
20
|
* @public exported from `@promptbook/core`
|
|
20
21
|
*/
|
|
21
22
|
export declare class AgentLlmExecutionTools implements LlmExecutionTools {
|
|
22
23
|
private readonly options;
|
|
24
|
+
/**
|
|
25
|
+
* Cache of OpenAI assistants to avoid creating duplicates
|
|
26
|
+
*/
|
|
27
|
+
private static assistantCache;
|
|
23
28
|
/**
|
|
24
29
|
* Cached model requirements to avoid re-parsing the agent source
|
|
25
30
|
*/
|
|
@@ -56,6 +61,10 @@ export declare class AgentLlmExecutionTools implements LlmExecutionTools {
|
|
|
56
61
|
* Calls the chat model with agent-specific system prompt and requirements
|
|
57
62
|
*/
|
|
58
63
|
callChatModel(prompt: Prompt): Promise<ChatPromptResult>;
|
|
64
|
+
/**
|
|
65
|
+
* Calls the chat model with agent-specific system prompt and requirements with streaming
|
|
66
|
+
*/
|
|
67
|
+
callChatModelStream(prompt: Prompt, onProgress: (chunk: ChatPromptResult) => void): Promise<ChatPromptResult>;
|
|
59
68
|
}
|
|
60
69
|
/**
|
|
61
70
|
* TODO: [🍚] Implement Destroyable pattern to free resources
|
|
@@ -5,12 +5,12 @@ import type { RemoteAgentOptions } from './RemoteAgentOptions';
|
|
|
5
5
|
/**
|
|
6
6
|
* Represents one AI Agent
|
|
7
7
|
*
|
|
8
|
-
*
|
|
8
|
+
* Note: [🦖] There are several different things in Promptbook:
|
|
9
9
|
* - `Agent` - which represents an AI Agent with its source, memories, actions, etc. Agent is a higher-level abstraction which is internally using:
|
|
10
|
-
* !!!! `RemoteAgent`
|
|
11
10
|
* - `LlmExecutionTools` - which wraps one or more LLM models and provides an interface to execute them
|
|
12
11
|
* - `AgentLlmExecutionTools` - which is a specific implementation of `LlmExecutionTools` that wraps another LlmExecutionTools and applies agent-specific system prompts and requirements
|
|
13
12
|
* - `OpenAiAssistantExecutionTools` - which is a specific implementation of `LlmExecutionTools` for OpenAI models with assistant capabilities, recommended for usage in `Agent` or `AgentLlmExecutionTools`
|
|
13
|
+
* - `RemoteAgent` - which is an `Agent` that connects to a Promptbook Agents Server
|
|
14
14
|
*
|
|
15
15
|
* @public exported from `@promptbook/core`
|
|
16
16
|
*/
|
|
@@ -25,6 +25,10 @@ export declare class RemoteAgent extends Agent {
|
|
|
25
25
|
* Calls the agent on agents remote server
|
|
26
26
|
*/
|
|
27
27
|
callChatModel(prompt: Prompt): Promise<ChatPromptResult>;
|
|
28
|
+
/**
|
|
29
|
+
* Calls the agent on agents remote server with streaming
|
|
30
|
+
*/
|
|
31
|
+
callChatModelStream(prompt: Prompt, onProgress: (chunk: ChatPromptResult) => void): Promise<ChatPromptResult>;
|
|
28
32
|
}
|
|
29
33
|
/**
|
|
30
34
|
* TODO: [🧠][😰]Agent is not working with the parameters, should it be?
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
|
|
2
2
|
import type { ChatPromptResult } from '../../execution/PromptResult';
|
|
3
3
|
import type { Prompt } from '../../types/Prompt';
|
|
4
|
-
import type { string_markdown, string_markdown_text, string_title } from '../../types/typeAliases';
|
|
4
|
+
import type { string_markdown, string_markdown_text, string_title, string_token } from '../../types/typeAliases';
|
|
5
5
|
import type { OpenAiAssistantExecutionToolsOptions } from './OpenAiAssistantExecutionToolsOptions';
|
|
6
6
|
import { OpenAiExecutionTools } from './OpenAiExecutionTools';
|
|
7
7
|
/**
|
|
@@ -9,16 +9,17 @@ import { OpenAiExecutionTools } from './OpenAiExecutionTools';
|
|
|
9
9
|
*
|
|
10
10
|
* This is useful for calling OpenAI API with a single assistant, for more wide usage use `OpenAiExecutionTools`.
|
|
11
11
|
*
|
|
12
|
-
*
|
|
12
|
+
* Note: [🦖] There are several different things in Promptbook:
|
|
13
13
|
* - `Agent` - which represents an AI Agent with its source, memories, actions, etc. Agent is a higher-level abstraction which is internally using:
|
|
14
14
|
* - `LlmExecutionTools` - which wraps one or more LLM models and provides an interface to execute them
|
|
15
15
|
* - `AgentLlmExecutionTools` - which is a specific implementation of `LlmExecutionTools` that wraps another LlmExecutionTools and applies agent-specific system prompts and requirements
|
|
16
16
|
* - `OpenAiAssistantExecutionTools` - which is a specific implementation of `LlmExecutionTools` for OpenAI models with assistant capabilities, recommended for usage in `Agent` or `AgentLlmExecutionTools`
|
|
17
|
+
* - `RemoteAgent` - which is an `Agent` that connects to a Promptbook Agents Server
|
|
17
18
|
*
|
|
18
19
|
* @public exported from `@promptbook/openai`
|
|
19
20
|
*/
|
|
20
21
|
export declare class OpenAiAssistantExecutionTools extends OpenAiExecutionTools implements LlmExecutionTools {
|
|
21
|
-
|
|
22
|
+
readonly assistantId: string_token;
|
|
22
23
|
private readonly isCreatingNewAssistantsAllowed;
|
|
23
24
|
/**
|
|
24
25
|
* Creates OpenAI Execution Tools.
|
|
@@ -32,7 +33,14 @@ export declare class OpenAiAssistantExecutionTools extends OpenAiExecutionTools
|
|
|
32
33
|
* Calls OpenAI API to use a chat model.
|
|
33
34
|
*/
|
|
34
35
|
callChatModel(prompt: Pick<Prompt, 'content' | 'parameters' | 'modelRequirements' | 'format'>): Promise<ChatPromptResult>;
|
|
35
|
-
|
|
36
|
+
/**
|
|
37
|
+
* Calls OpenAI API to use a chat model with streaming.
|
|
38
|
+
*/
|
|
39
|
+
callChatModelStream(prompt: Pick<Prompt, 'content' | 'parameters' | 'modelRequirements' | 'format'>, onProgress: (chunk: ChatPromptResult) => void): Promise<ChatPromptResult>;
|
|
40
|
+
/**
|
|
41
|
+
* Get an existing assistant tool wrapper
|
|
42
|
+
*/
|
|
43
|
+
getAssistant(assistantId: string_token): OpenAiAssistantExecutionTools;
|
|
36
44
|
createNewAssistant(options: {
|
|
37
45
|
/**
|
|
38
46
|
* Name of the new assistant
|
|
@@ -47,6 +55,24 @@ export declare class OpenAiAssistantExecutionTools extends OpenAiExecutionTools
|
|
|
47
55
|
*/
|
|
48
56
|
readonly knowledgeSources?: ReadonlyArray<string>;
|
|
49
57
|
}): Promise<OpenAiAssistantExecutionTools>;
|
|
58
|
+
updateAssistant(options: {
|
|
59
|
+
/**
|
|
60
|
+
* ID of the assistant to update
|
|
61
|
+
*/
|
|
62
|
+
readonly assistantId: string_token;
|
|
63
|
+
/**
|
|
64
|
+
* Name of the assistant
|
|
65
|
+
*/
|
|
66
|
+
readonly name?: string_title;
|
|
67
|
+
/**
|
|
68
|
+
* Instructions for the assistant
|
|
69
|
+
*/
|
|
70
|
+
readonly instructions?: string_markdown;
|
|
71
|
+
/**
|
|
72
|
+
* Optional list of knowledge source links (URLs or file paths) to attach to the assistant via vector store
|
|
73
|
+
*/
|
|
74
|
+
readonly knowledgeSources?: ReadonlyArray<string>;
|
|
75
|
+
}): Promise<OpenAiAssistantExecutionTools>;
|
|
50
76
|
/**
|
|
51
77
|
* Discriminant for type guards
|
|
52
78
|
*/
|
|
@@ -9,7 +9,7 @@ type AgentsServerOptions = {
|
|
|
9
9
|
port: number_port;
|
|
10
10
|
};
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* [🐱🚀]
|
|
13
13
|
* Remote server is a proxy server that uses its execution tools internally and exposes the executor interface externally.
|
|
14
14
|
*
|
|
15
15
|
* You can simply use `RemoteExecutionTools` on client-side javascript and connect to your remote server.
|
|
@@ -17,7 +17,7 @@ type AgentsServerOptions = {
|
|
|
17
17
|
*
|
|
18
18
|
* @see https://github.com/webgptorg/promptbook#remote-server
|
|
19
19
|
* @public exported from `@promptbook/remote-server`
|
|
20
|
-
* <- TODO:
|
|
20
|
+
* <- TODO: [🐱🚀] Change to `@promptbook/agent-server`
|
|
21
21
|
*/
|
|
22
22
|
export declare function startAgentServer(options: AgentsServerOptions): Promise<TODO_any>;
|
|
23
23
|
export {};
|
|
@@ -11,8 +11,7 @@ import type { RemoteServerOptions } from './types/RemoteServerOptions';
|
|
|
11
11
|
*/
|
|
12
12
|
export declare function startRemoteServer<TCustomOptions = undefined>(options: RemoteServerOptions<TCustomOptions>): RemoteServer;
|
|
13
13
|
/**
|
|
14
|
-
|
|
15
|
-
* TODO: !!!! Allow to chat with agents directly via remote server
|
|
14
|
+
|
|
16
15
|
* TODO: [🕋] Use here `aboutPromptbookInformation`
|
|
17
16
|
* TODO: [🌡] Add CORS and security - probably via `helmet`
|
|
18
17
|
* TODO: Split this file into multiple functions - handler for each request
|
|
@@ -7,7 +7,7 @@ import type { Registration } from '../../utils/misc/$Register';
|
|
|
7
7
|
* @public exported from `@promptbook/wizard`
|
|
8
8
|
* @public exported from `@promptbook/cli`
|
|
9
9
|
*
|
|
10
|
-
* TODO:
|
|
10
|
+
* TODO: [🧠] Which package should export this?
|
|
11
11
|
*/
|
|
12
12
|
export declare const _OpenAiSdkTranspilerRegistration: Registration;
|
|
13
13
|
/**
|
|
@@ -148,6 +148,12 @@ export type string_agent_name = string;
|
|
|
148
148
|
* For example `"My AI Assistant"`
|
|
149
149
|
*/
|
|
150
150
|
export type string_agent_name_in_book = string;
|
|
151
|
+
/**
|
|
152
|
+
* Semantic helper
|
|
153
|
+
*
|
|
154
|
+
* For example `"b126926439c5fcb83609888a11283723c1ef137c0ad599a77a1be81812bd221d"`
|
|
155
|
+
*/
|
|
156
|
+
export type string_agent_hash = string_sha256;
|
|
151
157
|
/**
|
|
152
158
|
* Unstructured description of the persona
|
|
153
159
|
*
|
|
@@ -59,6 +59,13 @@ export declare class Color {
|
|
|
59
59
|
* @returns Color object
|
|
60
60
|
*/
|
|
61
61
|
private static fromHex3;
|
|
62
|
+
/**
|
|
63
|
+
* Creates a new Color instance from color in hex format with 4 digits (with alpha channel)
|
|
64
|
+
*
|
|
65
|
+
* @param color in hex for example `09df`
|
|
66
|
+
* @returns Color object
|
|
67
|
+
*/
|
|
68
|
+
private static fromHex4;
|
|
62
69
|
/**
|
|
63
70
|
* Creates a new Color instance from color in hex format with 6 color digits (without alpha channel)
|
|
64
71
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { chococake } from '../organization/really_any';
|
|
2
2
|
/**
|
|
3
3
|
* Safely retrieves the global scope object (window in browser, global in Node.js)
|
|
4
4
|
* regardless of the JavaScript environment in which the code is running
|
|
@@ -7,4 +7,4 @@ import type { really_any } from '../organization/really_any';
|
|
|
7
7
|
*
|
|
8
8
|
* @private internal function of `$Register`
|
|
9
9
|
*/
|
|
10
|
-
export declare function $getGlobalScope():
|
|
10
|
+
export declare function $getGlobalScope(): chococake;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { string_sha256 } from '../../types/typeAliases';
|
|
2
|
+
import { really_unknown } from '../organization/really_unknown';
|
|
3
|
+
/**
|
|
4
|
+
* Computes SHA-256 hash of the given object
|
|
5
|
+
*
|
|
6
|
+
* @public exported from `@promptbook/utils`
|
|
7
|
+
*/
|
|
8
|
+
export declare function computeHash(value: really_unknown): string_sha256;
|
|
9
|
+
/**
|
|
10
|
+
* TODO: [🥬][🥬] Use this ACRY
|
|
11
|
+
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -9,6 +9,8 @@ export type string_kebab_case = string;
|
|
|
9
9
|
/**
|
|
10
10
|
* Converts a given text to kebab-case format.
|
|
11
11
|
*
|
|
12
|
+
* Note: [🔂] This function is idempotent.
|
|
13
|
+
*
|
|
12
14
|
* @param text The text to be converted.
|
|
13
15
|
* @returns The kebab-case formatted string.
|
|
14
16
|
* @example 'hello-world'
|
|
@@ -9,6 +9,8 @@ export type string_camelCase = string;
|
|
|
9
9
|
/**
|
|
10
10
|
* Normalizes a given text to camelCase format.
|
|
11
11
|
*
|
|
12
|
+
* Note: [🔂] This function is idempotent.
|
|
13
|
+
*
|
|
12
14
|
* @param text The text to be normalized.
|
|
13
15
|
* @param _isFirstLetterCapital Whether the first letter should be capitalized.
|
|
14
16
|
* @returns The camelCase formatted string.
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Converts a title string into a normalized name.
|
|
3
3
|
*
|
|
4
|
+
* Note: [🔂] This function is idempotent.
|
|
5
|
+
*
|
|
4
6
|
* @param value The title string to be converted to a name.
|
|
5
7
|
* @returns A normalized name derived from the input title.
|
|
6
8
|
* @example 'Hello World!' -> 'hello-world'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { chococake } from './really_any';
|
|
2
2
|
/**
|
|
3
3
|
* Just says that the variable is not used directlys but should be kept because the existence of the variable is important
|
|
4
4
|
*
|
|
@@ -6,4 +6,4 @@ import type { really_any } from './really_any';
|
|
|
6
6
|
* @returns void
|
|
7
7
|
* @private within the repository
|
|
8
8
|
*/
|
|
9
|
-
export declare function $sideEffect(...sideEffectSubjects: ReadonlyArray<
|
|
9
|
+
export declare function $sideEffect(...sideEffectSubjects: ReadonlyArray<chococake>): void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { chococake } from './really_any';
|
|
2
2
|
/**
|
|
3
3
|
* Organizational helper to mark a function that produces side effects
|
|
4
4
|
*
|
|
5
5
|
* @private within the repository
|
|
6
6
|
*/
|
|
7
|
-
export type $side_effect = void |
|
|
7
|
+
export type $side_effect = void | chococake;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { chococake } from './really_any';
|
|
2
2
|
/**
|
|
3
3
|
* Just marks a place of place where should be something implemented
|
|
4
4
|
* No side effects.
|
|
@@ -9,4 +9,4 @@ import type { really_any } from './really_any';
|
|
|
9
9
|
* @returns void
|
|
10
10
|
* @private within the repository
|
|
11
11
|
*/
|
|
12
|
-
export declare function TODO_USE(...value: ReadonlyArray<
|
|
12
|
+
export declare function TODO_USE(...value: ReadonlyArray<chococake>): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { chococake } from './really_any';
|
|
2
2
|
/**
|
|
3
3
|
* Just says that the variable is not used but should be kept
|
|
4
4
|
* No side effects.
|
|
@@ -13,4 +13,4 @@ import type { really_any } from './really_any';
|
|
|
13
13
|
* @returns void
|
|
14
14
|
* @private within the repository
|
|
15
15
|
*/
|
|
16
|
-
export declare function keepUnused<TTypeToKeep1 =
|
|
16
|
+
export declare function keepUnused<TTypeToKeep1 = chococake, TTypeToKeep2 = chococake, TTypeToKeep3 = chococake>(...valuesToKeep: ReadonlyArray<chococake>): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { chococake } from './really_any';
|
|
2
2
|
/**
|
|
3
3
|
* Does nothing, but preserves the function in the bundle
|
|
4
4
|
* Compiler is tricked into thinking the function is used
|
|
@@ -7,7 +7,7 @@ import type { really_any } from './really_any';
|
|
|
7
7
|
* @returns nothing
|
|
8
8
|
* @private within the repository
|
|
9
9
|
*/
|
|
10
|
-
export declare function $preserve(...value: Array<
|
|
10
|
+
export declare function $preserve(...value: Array<chococake>): void;
|
|
11
11
|
/**
|
|
12
12
|
* DO NOT USE THIS FUNCTION
|
|
13
13
|
* Only purpose of this function is to trick the compiler and javascript engine
|
|
@@ -15,7 +15,7 @@ export declare function $preserve(...value: Array<really_any>): void;
|
|
|
15
15
|
*
|
|
16
16
|
* @private internal for `preserve`
|
|
17
17
|
*/
|
|
18
|
-
export declare function __DO_NOT_USE_getPreserved(): Array<
|
|
18
|
+
export declare function __DO_NOT_USE_getPreserved(): Array<chococake>;
|
|
19
19
|
/**
|
|
20
20
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
21
21
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { chococake } from '../organization/really_any';
|
|
2
2
|
/**
|
|
3
3
|
* Function `asSerializable` will convert values which are not serializable to serializable values
|
|
4
4
|
* It walks deeply through the object and converts all values
|
|
@@ -12,4 +12,4 @@ import type { really_any } from '../organization/really_any';
|
|
|
12
12
|
*
|
|
13
13
|
* @private Internal helper function
|
|
14
14
|
*/
|
|
15
|
-
export declare function asSerializable(value:
|
|
15
|
+
export declare function asSerializable(value: chococake): chococake;
|
|
@@ -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.103.0-
|
|
18
|
+
* It follows semantic versioning (e.g., `0.103.0-48`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/types",
|
|
3
|
-
"version": "0.103.0-
|
|
3
|
+
"version": "0.103.0-49",
|
|
4
4
|
"description": "Promptbook: Turn your company's scattered knowledge into AI ready books",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -92,6 +92,6 @@
|
|
|
92
92
|
},
|
|
93
93
|
"typings": "./esm/typings/src/_packages/types.index.d.ts",
|
|
94
94
|
"peerDependencies": {
|
|
95
|
-
"@promptbook/core": "0.103.0-
|
|
95
|
+
"@promptbook/core": "0.103.0-49"
|
|
96
96
|
}
|
|
97
97
|
}
|