@promptbook/remote-server 0.103.0-46 → 0.103.0-48
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 +16 -9
- package/esm/index.es.js.map +1 -1
- package/esm/typings/servers.d.ts +1 -7
- package/esm/typings/src/_packages/components.index.d.ts +4 -0
- package/esm/typings/src/_packages/core.index.d.ts +22 -14
- package/esm/typings/src/_packages/types.index.d.ts +14 -6
- package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +7 -3
- package/esm/typings/src/book-2.0/agent-source/AgentModelRequirements.d.ts +6 -1
- package/esm/typings/src/book-2.0/agent-source/AgentSourceParseResult.d.ts +3 -2
- 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/createCommitmentRegex.d.ts +1 -1
- 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/book-components/Chat/AgentChat/AgentChat.d.ts +14 -0
- package/esm/typings/src/book-components/Chat/AgentChat/AgentChat.test.d.ts +1 -0
- package/esm/typings/src/book-components/Chat/AgentChat/AgentChatProps.d.ts +13 -0
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +1 -60
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentsDatabaseSchema.d.ts +57 -32
- package/esm/typings/src/{book-2.0/commitments → commitments}/ACTION/ACTION.d.ts +1 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/DELETE/DELETE.d.ts +1 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/FORMAT/FORMAT.d.ts +1 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/GOAL/GOAL.d.ts +1 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/KNOWLEDGE/KNOWLEDGE.d.ts +1 -5
- package/esm/typings/src/{book-2.0/commitments → commitments}/MEMORY/MEMORY.d.ts +1 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/MESSAGE/MESSAGE.d.ts +1 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/META/META.d.ts +1 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/META_IMAGE/META_IMAGE.d.ts +1 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/META_LINK/META_LINK.d.ts +1 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/MODEL/MODEL.d.ts +1 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/NOTE/NOTE.d.ts +1 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/PERSONA/PERSONA.d.ts +1 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/RULE/RULE.d.ts +1 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/SAMPLE/SAMPLE.d.ts +1 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/SCENARIO/SCENARIO.d.ts +1 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/STYLE/STYLE.d.ts +1 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/_base/BaseCommitmentDefinition.d.ts +1 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/_base/CommitmentDefinition.d.ts +1 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/_base/NotYetImplementedCommitmentDefinition.d.ts +1 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/_base/createEmptyAgentModelRequirements.d.ts +1 -1
- package/esm/typings/src/execution/LlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/utils/assertUniqueModels.d.ts +12 -0
- package/esm/typings/src/llm-providers/agent/Agent.d.ts +10 -9
- package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +5 -1
- package/esm/typings/src/llm-providers/agent/CreateAgentLlmExecutionToolsOptions.d.ts +1 -1
- package/esm/typings/src/llm-providers/agent/RemoteAgent.d.ts +32 -0
- package/esm/typings/src/llm-providers/agent/RemoteAgentOptions.d.ts +11 -0
- package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +29 -4
- package/esm/typings/src/llm-providers/openai/openai-models.test.d.ts +4 -0
- package/esm/typings/src/remote-server/startAgentServer.d.ts +1 -1
- package/esm/typings/src/remote-server/startRemoteServer.d.ts +1 -2
- package/esm/typings/src/storage/_common/PromptbookStorage.d.ts +1 -0
- package/esm/typings/src/transpilers/openai-sdk/register.d.ts +1 -1
- package/esm/typings/src/types/typeAliases.d.ts +12 -0
- package/esm/typings/src/utils/color/internal-utils/checkChannelValue.d.ts +0 -3
- 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/random/$generateBookBoilerplate.d.ts +2 -2
- package/esm/typings/src/utils/random/$randomFullnameWithColor.d.ts +1 -1
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +19 -12
- package/umd/index.umd.js.map +1 -1
- /package/esm/typings/src/{book-2.0/commitments → commitments}/_base/BookCommitment.d.ts +0 -0
- /package/esm/typings/src/{book-2.0/commitments → commitments}/_base/ParsedCommitment.d.ts +0 -0
- /package/esm/typings/src/{book-2.0/commitments → commitments}/index.d.ts +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AgentModelRequirements } from '../../agent-source/AgentModelRequirements';
|
|
1
|
+
import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
|
|
2
2
|
import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
3
3
|
/**
|
|
4
4
|
* META IMAGE commitment definition
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AgentModelRequirements } from '../../agent-source/AgentModelRequirements';
|
|
1
|
+
import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
|
|
2
2
|
import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
3
3
|
/**
|
|
4
4
|
* META LINK commitment definition
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AgentModelRequirements } from '../../agent-source/AgentModelRequirements';
|
|
1
|
+
import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
|
|
2
2
|
import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
3
3
|
/**
|
|
4
4
|
* MODEL commitment definition
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AgentModelRequirements } from '../../agent-source/AgentModelRequirements';
|
|
1
|
+
import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
|
|
2
2
|
import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
3
3
|
/**
|
|
4
4
|
* NOTE commitment definition
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AgentModelRequirements } from '../../agent-source/AgentModelRequirements';
|
|
1
|
+
import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
|
|
2
2
|
import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
3
3
|
/**
|
|
4
4
|
* PERSONA commitment definition
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AgentModelRequirements } from '../../agent-source/AgentModelRequirements';
|
|
1
|
+
import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
|
|
2
2
|
import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
3
3
|
/**
|
|
4
4
|
* RULE commitment definition
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AgentModelRequirements } from '../../agent-source/AgentModelRequirements';
|
|
1
|
+
import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
|
|
2
2
|
import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
3
3
|
/**
|
|
4
4
|
* SAMPLE commitment definition
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AgentModelRequirements } from '../../agent-source/AgentModelRequirements';
|
|
1
|
+
import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
|
|
2
2
|
import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
3
3
|
/**
|
|
4
4
|
* SCENARIO commitment definition
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AgentModelRequirements } from '../../agent-source/AgentModelRequirements';
|
|
1
|
+
import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
|
|
2
2
|
import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
3
3
|
/**
|
|
4
4
|
* STYLE commitment definition
|
package/esm/typings/src/{book-2.0/commitments → commitments}/_base/BaseCommitmentDefinition.d.ts
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AgentModelRequirements } from '../../agent-source/AgentModelRequirements';
|
|
1
|
+
import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
|
|
2
2
|
import type { CommitmentDefinition } from './CommitmentDefinition';
|
|
3
3
|
/**
|
|
4
4
|
* Base implementation of CommitmentDefinition that provides common functionality
|
package/esm/typings/src/{book-2.0/commitments → commitments}/_base/CommitmentDefinition.d.ts
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AgentModelRequirements } from '../../agent-source/AgentModelRequirements';
|
|
1
|
+
import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
|
|
2
2
|
/**
|
|
3
3
|
* Definition of a commitment that can be applied to agent model requirements
|
|
4
4
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AgentModelRequirements } from '../../agent-source/AgentModelRequirements';
|
|
1
|
+
import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
|
|
2
2
|
import { BaseCommitmentDefinition } from './BaseCommitmentDefinition';
|
|
3
3
|
/**
|
|
4
4
|
* Placeholder commitment definition for commitments that are not yet implemented
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AgentModelRequirements } from '../../agent-source/AgentModelRequirements';
|
|
1
|
+
import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
|
|
2
2
|
/**
|
|
3
3
|
* Creates an empty/basic agent model requirements object
|
|
4
4
|
* This serves as the starting point for the reduce-like pattern
|
|
@@ -9,7 +9,7 @@ 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
|
-
* Note: [🦖] There are several different things in Promptbook:
|
|
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
|
|
@@ -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,12 +2,13 @@ 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_url_image } from '../../types/typeAliases';
|
|
6
|
+
import { AgentLlmExecutionTools } from './AgentLlmExecutionTools';
|
|
6
7
|
import type { AgentOptions } from './AgentOptions';
|
|
7
8
|
/**
|
|
8
9
|
* Represents one AI Agent
|
|
9
10
|
*
|
|
10
|
-
* Note: [🦖] There are several different things in Promptbook:
|
|
11
|
+
* !!! Note: [🦖] There are several different things in Promptbook:
|
|
11
12
|
* - `Agent` - which represents an AI Agent with its source, memories, actions, etc. Agent is a higher-level abstraction which is internally using:
|
|
12
13
|
* - `LlmExecutionTools` - which wraps one or more LLM models and provides an interface to execute them
|
|
13
14
|
* - `AgentLlmExecutionTools` - which is a specific implementation of `LlmExecutionTools` that wraps another LlmExecutionTools and applies agent-specific system prompts and requirements
|
|
@@ -15,16 +16,20 @@ import type { AgentOptions } from './AgentOptions';
|
|
|
15
16
|
*
|
|
16
17
|
* @public exported from `@promptbook/core`
|
|
17
18
|
*/
|
|
18
|
-
export declare class Agent implements AgentBasicInformation {
|
|
19
|
-
private
|
|
19
|
+
export declare class Agent extends AgentLlmExecutionTools implements LlmExecutionTools, AgentBasicInformation {
|
|
20
|
+
private _agentName;
|
|
20
21
|
/**
|
|
21
22
|
* Name of the agent
|
|
22
23
|
*/
|
|
23
|
-
agentName: string_agent_name
|
|
24
|
+
get agentName(): string_agent_name;
|
|
24
25
|
/**
|
|
25
26
|
* Description of the agent
|
|
26
27
|
*/
|
|
27
28
|
personaDescription: string | null;
|
|
29
|
+
/**
|
|
30
|
+
* Computed hash of the agent source for integrity verification
|
|
31
|
+
*/
|
|
32
|
+
get agentHash(): string_agent_hash;
|
|
28
33
|
/**
|
|
29
34
|
* Metadata like image or color
|
|
30
35
|
*/
|
|
@@ -41,10 +46,6 @@ export declare class Agent implements AgentBasicInformation {
|
|
|
41
46
|
get parameters(): BookParameter[];
|
|
42
47
|
readonly agentSource: BehaviorSubject<string_book>;
|
|
43
48
|
constructor(options: AgentOptions);
|
|
44
|
-
/**
|
|
45
|
-
* Creates LlmExecutionTools which exposes the agent as a model
|
|
46
|
-
*/
|
|
47
|
-
getLlmExecutionTools(): LlmExecutionTools;
|
|
48
49
|
}
|
|
49
50
|
/**
|
|
50
51
|
* TODO: [🧠][😰]Agent is not working with the parameters, should it be?
|
|
@@ -10,7 +10,7 @@ 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
|
-
* Note: [🦖] There are several different things in Promptbook:
|
|
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
|
|
@@ -20,6 +20,10 @@ import type { CreateAgentLlmExecutionToolsOptions } from './CreateAgentLlmExecut
|
|
|
20
20
|
*/
|
|
21
21
|
export declare class AgentLlmExecutionTools implements LlmExecutionTools {
|
|
22
22
|
private readonly options;
|
|
23
|
+
/**
|
|
24
|
+
* Cache of OpenAI assistants to avoid creating duplicates
|
|
25
|
+
*/
|
|
26
|
+
private static assistantCache;
|
|
23
27
|
/**
|
|
24
28
|
* Cached model requirements to avoid re-parsing the agent source
|
|
25
29
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { string_book } from '../../book-2.0/agent-source/string_book';
|
|
2
|
-
import { CommonToolsOptions } from '../../execution/CommonToolsOptions';
|
|
2
|
+
import type { CommonToolsOptions } from '../../execution/CommonToolsOptions';
|
|
3
3
|
import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
|
|
4
4
|
import { OpenAiAssistantExecutionTools } from '../openai/OpenAiAssistantExecutionTools';
|
|
5
5
|
/**
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ChatPromptResult } from '../../execution/PromptResult';
|
|
2
|
+
import type { Prompt } from '../../types/Prompt';
|
|
3
|
+
import { Agent } from './Agent';
|
|
4
|
+
import type { RemoteAgentOptions } from './RemoteAgentOptions';
|
|
5
|
+
/**
|
|
6
|
+
* Represents one AI Agent
|
|
7
|
+
*
|
|
8
|
+
* !!!!!! Note: [🦖] There are several different things in Promptbook:
|
|
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
|
+
* - `LlmExecutionTools` - which wraps one or more LLM models and provides an interface to execute them
|
|
12
|
+
* - `AgentLlmExecutionTools` - which is a specific implementation of `LlmExecutionTools` that wraps another LlmExecutionTools and applies agent-specific system prompts and requirements
|
|
13
|
+
* - `OpenAiAssistantExecutionTools` - which is a specific implementation of `LlmExecutionTools` for OpenAI models with assistant capabilities, recommended for usage in `Agent` or `AgentLlmExecutionTools`
|
|
14
|
+
*
|
|
15
|
+
* @public exported from `@promptbook/core`
|
|
16
|
+
*/
|
|
17
|
+
export declare class RemoteAgent extends Agent {
|
|
18
|
+
static connect(options: RemoteAgentOptions): Promise<RemoteAgent>;
|
|
19
|
+
/**
|
|
20
|
+
* The source of the agent
|
|
21
|
+
*/
|
|
22
|
+
private agentUrl;
|
|
23
|
+
private constructor();
|
|
24
|
+
/**
|
|
25
|
+
* Calls the agent on agents remote server
|
|
26
|
+
*/
|
|
27
|
+
callChatModel(prompt: Prompt): Promise<ChatPromptResult>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* TODO: [🧠][😰]Agent is not working with the parameters, should it be?
|
|
31
|
+
* TODO: !!! Agent on remote server
|
|
32
|
+
*/
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CommonToolsOptions } from '../../execution/CommonToolsOptions';
|
|
2
|
+
import type { string_agent_url } from '../../types/typeAliases';
|
|
3
|
+
/**
|
|
4
|
+
* Options for creating a Remote Agent
|
|
5
|
+
*/
|
|
6
|
+
export type RemoteAgentOptions = CommonToolsOptions & {
|
|
7
|
+
/**
|
|
8
|
+
* Url of the remote agent
|
|
9
|
+
*/
|
|
10
|
+
agentUrl: string_agent_url;
|
|
11
|
+
};
|
|
@@ -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,7 +9,7 @@ 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
|
-
* Note: [🦖] There are several different things in Promptbook:
|
|
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
|
|
@@ -18,7 +18,7 @@ import { OpenAiExecutionTools } from './OpenAiExecutionTools';
|
|
|
18
18
|
* @public exported from `@promptbook/openai`
|
|
19
19
|
*/
|
|
20
20
|
export declare class OpenAiAssistantExecutionTools extends OpenAiExecutionTools implements LlmExecutionTools {
|
|
21
|
-
|
|
21
|
+
readonly assistantId: string_token;
|
|
22
22
|
private readonly isCreatingNewAssistantsAllowed;
|
|
23
23
|
/**
|
|
24
24
|
* Creates OpenAI Execution Tools.
|
|
@@ -32,7 +32,10 @@ export declare class OpenAiAssistantExecutionTools extends OpenAiExecutionTools
|
|
|
32
32
|
* Calls OpenAI API to use a chat model.
|
|
33
33
|
*/
|
|
34
34
|
callChatModel(prompt: Pick<Prompt, 'content' | 'parameters' | 'modelRequirements' | 'format'>): Promise<ChatPromptResult>;
|
|
35
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Get an existing assistant tool wrapper
|
|
37
|
+
*/
|
|
38
|
+
getAssistant(assistantId: string_token): OpenAiAssistantExecutionTools;
|
|
36
39
|
createNewAssistant(options: {
|
|
37
40
|
/**
|
|
38
41
|
* Name of the new assistant
|
|
@@ -42,6 +45,28 @@ export declare class OpenAiAssistantExecutionTools extends OpenAiExecutionTools
|
|
|
42
45
|
* Instructions for the new assistant
|
|
43
46
|
*/
|
|
44
47
|
readonly instructions: string_markdown;
|
|
48
|
+
/**
|
|
49
|
+
* Optional list of knowledge source links (URLs or file paths) to attach to the assistant via vector store
|
|
50
|
+
*/
|
|
51
|
+
readonly knowledgeSources?: ReadonlyArray<string>;
|
|
52
|
+
}): Promise<OpenAiAssistantExecutionTools>;
|
|
53
|
+
updateAssistant(options: {
|
|
54
|
+
/**
|
|
55
|
+
* ID of the assistant to update
|
|
56
|
+
*/
|
|
57
|
+
readonly assistantId: string_token;
|
|
58
|
+
/**
|
|
59
|
+
* Name of the assistant
|
|
60
|
+
*/
|
|
61
|
+
readonly name?: string_title;
|
|
62
|
+
/**
|
|
63
|
+
* Instructions for the assistant
|
|
64
|
+
*/
|
|
65
|
+
readonly instructions?: string_markdown;
|
|
66
|
+
/**
|
|
67
|
+
* Optional list of knowledge source links (URLs or file paths) to attach to the assistant via vector store
|
|
68
|
+
*/
|
|
69
|
+
readonly knowledgeSources?: ReadonlyArray<string>;
|
|
45
70
|
}): Promise<OpenAiAssistantExecutionTools>;
|
|
46
71
|
/**
|
|
47
72
|
* Discriminant for type guards
|
|
@@ -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
|
*
|
|
@@ -360,6 +366,12 @@ export type string_base_url = string;
|
|
|
360
366
|
* For example `"https://promptbook.studio/webgpt/"`
|
|
361
367
|
*/
|
|
362
368
|
export type string_pipeline_root_url = string;
|
|
369
|
+
/**
|
|
370
|
+
* Semantic helper
|
|
371
|
+
*
|
|
372
|
+
* For example `"https://s6.ptbk.io/agents/agent-007"`
|
|
373
|
+
*/
|
|
374
|
+
export type string_agent_url = string;
|
|
363
375
|
/**
|
|
364
376
|
* Semantic helper
|
|
365
377
|
*
|
|
@@ -9,6 +9,3 @@
|
|
|
9
9
|
* @private util of `@promptbook/color`
|
|
10
10
|
*/
|
|
11
11
|
export declare function checkChannelValue(channelName: string, value: number): asserts value is number;
|
|
12
|
-
/**
|
|
13
|
-
* TODO: [🧠][🚓] Is/which combination it better to use asserts/check, validate or is utility function?
|
|
14
|
-
*/
|
|
@@ -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,7 +1,7 @@
|
|
|
1
1
|
import type { PartialDeep } from 'type-fest';
|
|
2
2
|
import type { AgentBasicInformation } from '../../book-2.0/agent-source/AgentBasicInformation';
|
|
3
|
-
import { string_book } from '../../book-2.0/agent-source/string_book';
|
|
4
|
-
import { string_agent_name_in_book } from '../../types/typeAliases';
|
|
3
|
+
import type { string_book } from '../../book-2.0/agent-source/string_book';
|
|
4
|
+
import type { string_agent_name_in_book } from '../../types/typeAliases';
|
|
5
5
|
type GenerateBookBoilerplateOptions = PartialDeep<Omit<AgentBasicInformation, 'parameters'>> & {
|
|
6
6
|
/**
|
|
7
7
|
* Name of the parent agent to inherit from
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { string_color, string_person_fullname } from '../../types/typeAliases';
|
|
1
|
+
import type { string_color, string_person_fullname } from '../../types/typeAliases';
|
|
2
2
|
export type RandomFullnameWithColorResult = {
|
|
3
3
|
fullname: string_person_fullname;
|
|
4
4
|
color: string_color;
|
|
@@ -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-47`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/remote-server",
|
|
3
|
-
"version": "0.103.0-
|
|
3
|
+
"version": "0.103.0-48",
|
|
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/remote-server.index.d.ts",
|
|
97
97
|
"peerDependencies": {
|
|
98
|
-
"@promptbook/core": "0.103.0-
|
|
98
|
+
"@promptbook/core": "0.103.0-48"
|
|
99
99
|
},
|
|
100
100
|
"dependencies": {
|
|
101
101
|
"colors": "^1.4.0",
|
package/umd/index.umd.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('child_process'), require('colors'), require('spacetrim'), require('waitasecond'), require('express'), require('express-openapi-validator'), require('http'), require('socket.io'), require('swagger-ui-express'), require('crypto'), require('fs/promises'), require('
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'child_process', 'colors', 'spacetrim', 'waitasecond', 'express', 'express-openapi-validator', 'http', 'socket.io', 'swagger-ui-express', 'crypto', 'fs/promises', '
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-remote-server"] = {}, global.child_process, global.colors, global.spaceTrim, global.waitasecond, global.express, global.OpenApiValidator, global.http, global.socket_io, global.swaggerUi, global.crypto, global.promises, global.
|
|
5
|
-
})(this, (function (exports, child_process, colors, spaceTrim, waitasecond, express, OpenApiValidator, http, socket_io, swaggerUi, crypto, promises,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('path'), require('child_process'), require('colors'), require('spacetrim'), require('waitasecond'), require('express'), require('express-openapi-validator'), require('http'), require('socket.io'), require('swagger-ui-express'), require('crypto'), require('fs/promises'), require('rxjs'), require('crypto-js/enc-hex'), require('crypto-js/sha256'), require('crypto-js'), require('mime-types'), require('papaparse'), require('react'), require('react-dom/server')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'path', 'child_process', 'colors', 'spacetrim', 'waitasecond', 'express', 'express-openapi-validator', 'http', 'socket.io', 'swagger-ui-express', 'crypto', 'fs/promises', 'rxjs', 'crypto-js/enc-hex', 'crypto-js/sha256', 'crypto-js', 'mime-types', 'papaparse', 'react', 'react-dom/server'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-remote-server"] = {}, global.path, global.child_process, global.colors, global.spaceTrim, global.waitasecond, global.express, global.OpenApiValidator, global.http, global.socket_io, global.swaggerUi, global.crypto, global.promises, global.rxjs, global.hexEncoder, global.sha256, global.cryptoJs, global.mimeTypes, global.papaparse, global.react, global.server));
|
|
5
|
+
})(this, (function (exports, path, child_process, colors, spaceTrim, waitasecond, express, OpenApiValidator, http, socket_io, swaggerUi, crypto, promises, rxjs, hexEncoder, sha256, cryptoJs, mimeTypes, papaparse, react, server) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
* @generated
|
|
48
48
|
* @see https://github.com/webgptorg/promptbook
|
|
49
49
|
*/
|
|
50
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.103.0-
|
|
50
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.103.0-48';
|
|
51
51
|
/**
|
|
52
52
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
53
53
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -282,9 +282,6 @@
|
|
|
282
282
|
throw new Error(`${channelName} channel is greater than 255, it is ${value}`);
|
|
283
283
|
}
|
|
284
284
|
}
|
|
285
|
-
/**
|
|
286
|
-
* TODO: [🧠][🚓] Is/which combination it better to use asserts/check, validate or is utility function?
|
|
287
|
-
*/
|
|
288
285
|
|
|
289
286
|
/**
|
|
290
287
|
* Color object represents an RGB color with alpha channel
|
|
@@ -1310,16 +1307,18 @@
|
|
|
1310
1307
|
*
|
|
1311
1308
|
* @see https://github.com/webgptorg/promptbook#remote-server
|
|
1312
1309
|
* @public exported from `@promptbook/remote-server`
|
|
1313
|
-
* <- TODO: !!!!
|
|
1310
|
+
* <- TODO: !!!! Change to `@promptbook/agent-server`
|
|
1314
1311
|
*/
|
|
1315
1312
|
async function startAgentServer(options) {
|
|
1316
1313
|
const { port = 4440 } = options;
|
|
1317
1314
|
// TODO: !!!! [🌕]
|
|
1315
|
+
const agentsServerRoot = path.join(__dirname, '../apps/agents-server');
|
|
1318
1316
|
console.trace(`!!! Starting agents server on port ${port}...`);
|
|
1319
1317
|
console.log(`!!! cwd`, process.cwd());
|
|
1320
1318
|
console.log(`!!! __dirname`, __dirname);
|
|
1319
|
+
console.log(`!!! agentsServerRoot`, agentsServerRoot);
|
|
1321
1320
|
await $execCommand({
|
|
1322
|
-
cwd:
|
|
1321
|
+
cwd: agentsServerRoot,
|
|
1323
1322
|
command: `next dev --port ${port} `,
|
|
1324
1323
|
isVerbose: true,
|
|
1325
1324
|
});
|
|
@@ -4609,6 +4608,8 @@
|
|
|
4609
4608
|
/**
|
|
4610
4609
|
* Converts a given text to kebab-case format.
|
|
4611
4610
|
*
|
|
4611
|
+
* Note: [🔂] This function is idempotent.
|
|
4612
|
+
*
|
|
4612
4613
|
* @param text The text to be converted.
|
|
4613
4614
|
* @returns The kebab-case formatted string.
|
|
4614
4615
|
* @example 'hello-world'
|
|
@@ -4764,6 +4765,8 @@
|
|
|
4764
4765
|
/**
|
|
4765
4766
|
* Converts a title string into a normalized name.
|
|
4766
4767
|
*
|
|
4768
|
+
* Note: [🔂] This function is idempotent.
|
|
4769
|
+
*
|
|
4767
4770
|
* @param value The title string to be converted to a name.
|
|
4768
4771
|
* @returns A normalized name derived from the input title.
|
|
4769
4772
|
* @example 'Hello World!' -> 'hello-world'
|
|
@@ -7866,6 +7869,8 @@
|
|
|
7866
7869
|
/**
|
|
7867
7870
|
* Normalizes a given text to camelCase format.
|
|
7868
7871
|
*
|
|
7872
|
+
* Note: [🔂] This function is idempotent.
|
|
7873
|
+
*
|
|
7869
7874
|
* @param text The text to be normalized.
|
|
7870
7875
|
* @param _isFirstLetterCapital Whether the first letter should be capitalized.
|
|
7871
7876
|
* @returns The camelCase formatted string.
|
|
@@ -7992,6 +7997,9 @@
|
|
|
7992
7997
|
}
|
|
7993
7998
|
|
|
7994
7999
|
/**
|
|
8000
|
+
* Normalizes a given text to PascalCase format.
|
|
8001
|
+
*
|
|
8002
|
+
* Note: [🔂] This function is idempotent.
|
|
7995
8003
|
*
|
|
7996
8004
|
* @param text @public exported from `@promptbook/utils`
|
|
7997
8005
|
* @returns
|
|
@@ -9641,8 +9649,7 @@
|
|
|
9641
9649
|
};
|
|
9642
9650
|
}
|
|
9643
9651
|
/**
|
|
9644
|
-
|
|
9645
|
-
* TODO: !!!! Allow to chat with agents directly via remote server
|
|
9652
|
+
|
|
9646
9653
|
* TODO: [🕋] Use here `aboutPromptbookInformation`
|
|
9647
9654
|
* TODO: [🌡] Add CORS and security - probably via `helmet`
|
|
9648
9655
|
* TODO: Split this file into multiple functions - handler for each request
|