@promptbook/google 0.104.0-9 → 0.104.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -4
- package/esm/index.es.js +3 -3
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/components.index.d.ts +0 -6
- package/esm/typings/src/_packages/core.index.d.ts +8 -6
- package/esm/typings/src/_packages/types.index.d.ts +8 -0
- package/esm/typings/src/_packages/utils.index.d.ts +2 -0
- package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +24 -0
- package/esm/typings/src/book-2.0/agent-source/AgentModelRequirements.d.ts +12 -2
- package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirements.tools.test.d.ts +1 -0
- package/esm/typings/src/book-2.0/utils/generatePlaceholderAgentProfileImageUrl.d.ts +1 -1
- package/esm/typings/src/book-components/Chat/save/_common/string_chat_format_name.d.ts +1 -1
- package/esm/typings/src/book-components/Chat/types/ChatMessage.d.ts +6 -3
- package/esm/typings/src/book-components/_common/Dropdown/Dropdown.d.ts +5 -1
- package/esm/typings/src/book-components/_common/HamburgerMenu/HamburgerMenu.d.ts +5 -1
- package/esm/typings/src/book-components/icons/AboutIcon.d.ts +5 -1
- package/esm/typings/src/book-components/icons/AttachmentIcon.d.ts +6 -2
- package/esm/typings/src/book-components/icons/CameraIcon.d.ts +6 -2
- package/esm/typings/src/book-components/icons/DownloadIcon.d.ts +5 -1
- package/esm/typings/src/book-components/icons/MenuIcon.d.ts +5 -1
- package/esm/typings/src/book-components/icons/SaveIcon.d.ts +6 -2
- package/esm/typings/src/collection/agent-collection/AgentCollection.d.ts +1 -1
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +9 -7
- package/esm/typings/src/commands/_common/types/Command.d.ts +1 -1
- package/esm/typings/src/commitments/META/META_DESCRIPTION.d.ts +41 -0
- package/esm/typings/src/commitments/USE_SEARCH_ENGINE/USE_SEARCH_ENGINE.d.ts +2 -2
- package/esm/typings/src/commitments/_base/BookCommitment.d.ts +1 -1
- package/esm/typings/src/config.d.ts +8 -1
- package/esm/typings/src/formfactors/_common/FormfactorDefinition.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForTestingAndScriptsAndPlayground.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForWizardOrCli.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/utils/count-total-usage/LlmExecutionToolsWithTotalUsage.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/utils/count-total-usage/countUsage.d.ts +8 -4
- package/esm/typings/src/llm-providers/_common/utils/count-total-usage/limitTotalUsage.d.ts +1 -1
- package/esm/typings/src/llm-providers/_multiple/getSingleLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/_multiple/joinLlmExecutionTools.d.ts +12 -8
- package/esm/typings/src/llm-providers/agent/Agent.d.ts +7 -1
- package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/utils/mapToolsToOpenAi.d.ts +8 -0
- package/esm/typings/src/remote-server/ui/ServerApp.d.ts +5 -1
- package/esm/typings/src/scrapers/_common/utils/promptbookFetch.test.d.ts +1 -0
- package/esm/typings/src/search-engines/SearchEngine.d.ts +9 -0
- package/esm/typings/src/search-engines/SearchResult.d.ts +18 -0
- package/esm/typings/src/search-engines/bing/BingSearchEngine.d.ts +15 -0
- package/esm/typings/src/search-engines/dummy/DummySearchEngine.d.ts +15 -0
- package/esm/typings/src/types/LlmToolDefinition.d.ts +20 -0
- package/esm/typings/src/types/ModelRequirements.d.ts +13 -0
- package/esm/typings/src/types/typeAliasEmoji.d.ts +2 -2
- package/esm/typings/src/utils/random/$randomAgentPersona.d.ts +7 -2
- package/esm/typings/src/utils/random/$randomItem.d.ts +1 -1
- package/esm/typings/src/utils/random/$randomSeed.d.ts +1 -1
- package/esm/typings/src/utils/validators/url/isValidAgentUrl.d.ts +16 -0
- package/esm/typings/src/utils/validators/url/isValidAgentUrl.test.d.ts +1 -0
- package/esm/typings/src/utils/validators/url/isValidPipelineUrl.d.ts +2 -1
- package/esm/typings/src/utils/validators/url/isValidUrl.d.ts +4 -3
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +3 -3
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/servers.d.ts +0 -50
|
@@ -4,8 +4,12 @@ type HamburgerMenuProps = {
|
|
|
4
4
|
className?: string;
|
|
5
5
|
};
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* An animated hamburger menu button component.
|
|
8
8
|
*
|
|
9
|
+
* This component renders a 3-bar hamburger icon that animates into an "X" when
|
|
10
|
+
* the menu is open.
|
|
11
|
+
*
|
|
12
|
+
* @param props - Contains the open state, an optional click handler, and optional className
|
|
9
13
|
* @private Internal component
|
|
10
14
|
*/
|
|
11
15
|
export declare function HamburgerMenu({ isOpen, onClick, className }: HamburgerMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { SVGProps } from 'react';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Renders an information/about icon.
|
|
4
4
|
*
|
|
5
|
+
* This icon is typically used in UI elements that provide additional information
|
|
6
|
+
* or "about" details to the user.
|
|
7
|
+
*
|
|
8
|
+
* @param props - SVG properties augmented with an optional `size`
|
|
5
9
|
* @private internal subcomponent used by various components
|
|
6
10
|
*/
|
|
7
11
|
export declare function AboutIcon(props: SVGProps<SVGSVGElement> & {
|
|
@@ -3,9 +3,13 @@ type AttachmentIconProps = {
|
|
|
3
3
|
color?: string;
|
|
4
4
|
};
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Renders an attachment icon.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
8
|
+
* This icon is typically used in chat interfaces to indicate the ability to
|
|
9
|
+
* upload or view files associated with a message.
|
|
10
|
+
*
|
|
11
|
+
* @param props - SVG properties augmented with an optional `size`
|
|
12
|
+
* @private internal subcomponent used by various components
|
|
9
13
|
*/
|
|
10
14
|
export declare function AttachmentIcon({ size, color }: AttachmentIconProps): import("react/jsx-runtime").JSX.Element;
|
|
11
15
|
export {};
|
|
@@ -3,9 +3,13 @@ type CameraIconProps = {
|
|
|
3
3
|
color?: string;
|
|
4
4
|
};
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Renders a camera icon.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
8
|
+
* This icon is typically used in buttons or inputs that trigger image capture
|
|
9
|
+
* or selection.
|
|
10
|
+
*
|
|
11
|
+
* @param props - SVG properties augmented with an optional `size`
|
|
12
|
+
* @private internal subcomponent used by various components
|
|
9
13
|
*/
|
|
10
14
|
export declare function CameraIcon({ size, color }: CameraIconProps): import("react/jsx-runtime").JSX.Element;
|
|
11
15
|
export {};
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { SVGProps } from 'react';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Renders a download icon.
|
|
4
4
|
*
|
|
5
|
+
* This icon is typically used in buttons or links that trigger the downloading
|
|
6
|
+
* of files or assets.
|
|
7
|
+
*
|
|
8
|
+
* @param props - SVG properties augmented with an optional `size`
|
|
5
9
|
* @private internal subcomponent used by various components
|
|
6
10
|
*/
|
|
7
11
|
export declare function DownloadIcon(props: SVGProps<SVGSVGElement> & {
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { SVGProps } from 'react';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Renders a menu icon.
|
|
4
4
|
*
|
|
5
|
+
* This icon is typically used in buttons that toggle the visibility of
|
|
6
|
+
* navigation menus or dropdowns.
|
|
7
|
+
*
|
|
8
|
+
* @param props - SVG properties augmented with an optional `size`
|
|
5
9
|
* @private internal subcomponent used by various components
|
|
6
10
|
*/
|
|
7
11
|
export declare function MenuIcon(props: SVGProps<SVGSVGElement> & {
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Renders a save icon.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
5
|
+
* This icon is typically used in buttons that trigger the saving of data,
|
|
6
|
+
* configurations, or agent sources.
|
|
7
|
+
*
|
|
8
|
+
* @param props - SVG properties augmented with an optional `size`
|
|
9
|
+
* @private internal subcomponent used by various components
|
|
6
10
|
*/
|
|
7
11
|
export declare function SaveIcon({ size, color, ...props }: {
|
|
8
12
|
size?: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AgentCollectionInSupabase } from './constructors/agent-collection-in-supabase/AgentCollectionInSupabase';
|
|
1
|
+
import type { AgentCollectionInSupabase } from './constructors/agent-collection-in-supabase/AgentCollectionInSupabase';
|
|
2
2
|
/**
|
|
3
3
|
* Collection that groups together multiple AI Agents
|
|
4
4
|
*
|
|
@@ -5,9 +5,12 @@ import type { string_agent_name, string_agent_permanent_id } from '../../../../t
|
|
|
5
5
|
import { AgentCollectionInSupabaseOptions } from './AgentCollectionInSupabaseOptions';
|
|
6
6
|
import type { AgentsDatabaseSchema } from './AgentsDatabaseSchema';
|
|
7
7
|
/**
|
|
8
|
-
* Agent collection stored in Supabase table
|
|
8
|
+
* Agent collection stored in a Supabase table.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
10
|
+
* This class provides a way to manage a collection of agents (pipelines) using Supabase
|
|
11
|
+
* as the storage backend. It supports listing, creating, updating, and soft-deleting agents.
|
|
12
|
+
*
|
|
13
|
+
* Note: This object can work both from Node.js and browser environment depending on the Supabase client provided.
|
|
11
14
|
*
|
|
12
15
|
* @public exported from `@promptbook/core`
|
|
13
16
|
* <- TODO: [🐱🚀] Move to `@promptbook/supabase` package
|
|
@@ -16,9 +19,8 @@ export declare class AgentCollectionInSupabase {
|
|
|
16
19
|
private readonly supabaseClient;
|
|
17
20
|
readonly options?: AgentCollectionInSupabaseOptions | undefined;
|
|
18
21
|
/**
|
|
19
|
-
* @param
|
|
20
|
-
* @param
|
|
21
|
-
* @param options - Options for the collection creation
|
|
22
|
+
* @param supabaseClient - The initialized Supabase client
|
|
23
|
+
* @param options - Configuration options for the collection (e.g., table prefix, verbosity)
|
|
22
24
|
*/
|
|
23
25
|
constructor(supabaseClient: SupabaseClient<AgentsDatabaseSchema>, options?: AgentCollectionInSupabaseOptions | undefined);
|
|
24
26
|
/**
|
|
@@ -26,11 +28,11 @@ export declare class AgentCollectionInSupabase {
|
|
|
26
28
|
*/
|
|
27
29
|
listAgents(): Promise<ReadonlyArray<AgentBasicInformation>>;
|
|
28
30
|
/**
|
|
29
|
-
*
|
|
31
|
+
* Retrieves the permanent ID of an agent by its name or permanent ID.
|
|
30
32
|
*/
|
|
31
33
|
getAgentPermanentId(agentNameOrPermanentId: string_agent_name | string_agent_permanent_id): Promise<string_agent_permanent_id>;
|
|
32
34
|
/**
|
|
33
|
-
*
|
|
35
|
+
* Retrieves the source code of an agent by its name or permanent ID.
|
|
34
36
|
*/
|
|
35
37
|
getAgentSource(agentNameOrPermanentId: string_agent_name | string_agent_permanent_id): Promise<string_book>;
|
|
36
38
|
/**
|
|
@@ -3,4 +3,4 @@ import { COMMANDS } from '../../index';
|
|
|
3
3
|
* Command is one piece of the book file section which adds some logic to the task or the whole pipeline.
|
|
4
4
|
* It is parsed from the markdown from ul/ol items - one command per one item.
|
|
5
5
|
*/
|
|
6
|
-
export type Command = ReturnType<typeof COMMANDS[number]['parse']>;
|
|
6
|
+
export type Command = ReturnType<(typeof COMMANDS)[number]['parse']>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
|
|
2
|
+
import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
3
|
+
/**
|
|
4
|
+
* META DESCRIPTION commitment definition
|
|
5
|
+
*
|
|
6
|
+
* The META DESCRIPTION commitment sets the agent's meta description for the profile page.
|
|
7
|
+
* This commitment is special because it doesn't affect the system message,
|
|
8
|
+
* but is handled separately in the parsing logic.
|
|
9
|
+
*
|
|
10
|
+
* Example usage in agent source:
|
|
11
|
+
*
|
|
12
|
+
* ```book
|
|
13
|
+
* META DESCRIPTION An AI assistant specialized in business tasks
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @private [🪔] Maybe export the commitments through some package
|
|
17
|
+
*/
|
|
18
|
+
export declare class MetaDescriptionCommitmentDefinition extends BaseCommitmentDefinition<'META DESCRIPTION'> {
|
|
19
|
+
constructor();
|
|
20
|
+
/**
|
|
21
|
+
* Short one-line description of META DESCRIPTION.
|
|
22
|
+
*/
|
|
23
|
+
get description(): string;
|
|
24
|
+
/**
|
|
25
|
+
* Icon for this commitment.
|
|
26
|
+
*/
|
|
27
|
+
get icon(): string;
|
|
28
|
+
/**
|
|
29
|
+
* Markdown documentation for META DESCRIPTION commitment.
|
|
30
|
+
*/
|
|
31
|
+
get documentation(): string;
|
|
32
|
+
applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
|
|
33
|
+
/**
|
|
34
|
+
* Extracts the meta description from the content
|
|
35
|
+
* This is used by the parsing logic
|
|
36
|
+
*/
|
|
37
|
+
extractMetaDescription(content: string): string | null;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
41
|
+
*/
|
|
@@ -6,13 +6,13 @@ import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
|
6
6
|
* The `USE SEARCH ENGINE` commitment indicates that the agent should utilize a search engine tool
|
|
7
7
|
* to access and retrieve up-to-date information from the internet when necessary.
|
|
8
8
|
*
|
|
9
|
-
* The content following `USE SEARCH ENGINE` is
|
|
9
|
+
* The content following `USE SEARCH ENGINE` is an arbitrary text that the agent should know (e.g. search scope or instructions).
|
|
10
10
|
*
|
|
11
11
|
* Example usage in agent source:
|
|
12
12
|
*
|
|
13
13
|
* ```book
|
|
14
14
|
* USE SEARCH ENGINE
|
|
15
|
-
* USE SEARCH ENGINE
|
|
15
|
+
* USE SEARCH ENGINE Hledej informace o Přemyslovcích
|
|
16
16
|
* ```
|
|
17
17
|
*
|
|
18
18
|
* @private [🪔] Maybe export the commitments through some package
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CsvSettings } from './formats/csv/CsvSettings';
|
|
2
2
|
import type { IntermediateFilesStrategy } from './types/IntermediateFilesStrategy';
|
|
3
|
-
import type { string_app_id, string_email, string_name, string_promptbook_server_url } from './types/typeAliases';
|
|
3
|
+
import type { string_app_id, string_email, string_legal_entity, string_name, string_promptbook_server_url } from './types/typeAliases';
|
|
4
4
|
import { Color } from './utils/color/Color';
|
|
5
5
|
/**
|
|
6
6
|
* Warning message for the generated sections and files files
|
|
@@ -22,6 +22,12 @@ export declare const NAME = "Promptbook";
|
|
|
22
22
|
* @public exported from `@promptbook/core`
|
|
23
23
|
*/
|
|
24
24
|
export declare const ADMIN_EMAIL: string_email;
|
|
25
|
+
/**
|
|
26
|
+
* Email of the responsible person
|
|
27
|
+
*
|
|
28
|
+
* @public exported from `@promptbook/core`
|
|
29
|
+
*/
|
|
30
|
+
export declare const PROMPTBOOK_LEGAL_ENTITY: string_legal_entity;
|
|
25
31
|
/**
|
|
26
32
|
* Name of the responsible person for the Promptbook on GitHub
|
|
27
33
|
*
|
|
@@ -295,6 +301,7 @@ export declare const MOMENT_ARG_THRESHOLDS: {
|
|
|
295
301
|
/**
|
|
296
302
|
* Default remote server URL for the Promptbook
|
|
297
303
|
*
|
|
304
|
+
* @deprecated TODO: !!! Deprecate all things related to pipelines and pipelines server
|
|
298
305
|
* @public exported from `@promptbook/core`
|
|
299
306
|
*/
|
|
300
307
|
export declare const DEFAULT_REMOTE_SERVER_URL: string_promptbook_server_url;
|
|
@@ -7,4 +7,4 @@ import { FORMFACTOR_DEFINITIONS } from '../index';
|
|
|
7
7
|
* Note: [🚉] This is fully serializable as JSON
|
|
8
8
|
* @see https://github.com/webgptorg/promptbook/discussions/172
|
|
9
9
|
*/
|
|
10
|
-
export type FormfactorDefinition = typeof FORMFACTOR_DEFINITIONS[number];
|
|
10
|
+
export type FormfactorDefinition = (typeof FORMFACTOR_DEFINITIONS)[number];
|
|
@@ -21,7 +21,7 @@ export declare function $provideLlmToolsForTestingAndScriptsAndPlayground(option
|
|
|
21
21
|
export {};
|
|
22
22
|
/**
|
|
23
23
|
* Note: [⚪] This should never be in any released package
|
|
24
|
-
* TODO: [👷♂️]
|
|
24
|
+
* TODO: [👷♂️] Write a comprehensive manual about the construction of LLM tools
|
|
25
25
|
* TODO: This should be maybe not under `_common` but under `utils-internal` / `utils/internal`
|
|
26
26
|
* TODO: [®] DRY Register logi
|
|
27
27
|
*/
|
|
@@ -51,7 +51,7 @@ export declare function $provideLlmToolsForWizardOrCli(options?: ProvideLlmTools
|
|
|
51
51
|
export {};
|
|
52
52
|
/**
|
|
53
53
|
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
54
|
-
* TODO: [👷♂️]
|
|
54
|
+
* TODO: [👷♂️] Write a comprehensive manual about the construction of LLM tools
|
|
55
55
|
* TODO: [🥃] Allow `ptbk make` without llm tools
|
|
56
56
|
* TODO: This should be maybe not under `_common` but under `utils-internal` / `utils/internal`
|
|
57
57
|
* TODO: [®] DRY Register logic
|
|
@@ -17,6 +17,6 @@ export type LlmExecutionToolsWithTotalUsage = LlmExecutionTools & {
|
|
|
17
17
|
spending(): Observable<Usage>;
|
|
18
18
|
};
|
|
19
19
|
/**
|
|
20
|
-
* TODO: [👷♂️]
|
|
20
|
+
* TODO: [👷♂️] Write a comprehensive manual about the construction of LLM tools
|
|
21
21
|
* Note: [🥫] Not using getter `get totalUsage` but `getTotalUsage` to allow this object to be proxied
|
|
22
22
|
*/
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import type { LlmExecutionTools } from '../../../../execution/LlmExecutionTools';
|
|
2
2
|
import type { LlmExecutionToolsWithTotalUsage } from './LlmExecutionToolsWithTotalUsage';
|
|
3
3
|
/**
|
|
4
|
-
* Intercepts LLM tools and counts total usage of the tools
|
|
4
|
+
* Intercepts LLM tools and counts total usage of the tools.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* This function wraps the provided `LlmExecutionTools` with a proxy that tracks the cumulative
|
|
7
|
+
* usage (tokens, cost, etc.) across all model calls. It provides a way to monitor spending
|
|
8
|
+
* in real-time through an observable.
|
|
9
|
+
*
|
|
10
|
+
* @param llmTools - The LLM tools to be intercepted and tracked
|
|
11
|
+
* @returns An augmented version of the tools that includes usage tracking capabilities
|
|
8
12
|
* @public exported from `@promptbook/core`
|
|
9
13
|
*/
|
|
10
14
|
export declare function countUsage(llmTools: LlmExecutionTools): LlmExecutionToolsWithTotalUsage;
|
|
@@ -13,5 +17,5 @@ export declare function countUsage(llmTools: LlmExecutionTools): LlmExecutionToo
|
|
|
13
17
|
* TODO: [🧠] Is there some meaningfull way how to test this util
|
|
14
18
|
* TODO: [🧠][🌯] Maybe a way how to hide ability to `get totalUsage`
|
|
15
19
|
* > const [llmToolsWithUsage,getUsage] = countTotalUsage(llmTools);
|
|
16
|
-
* TODO: [👷♂️]
|
|
20
|
+
* TODO: [👷♂️] Write a comprehensive manual explaining the construction and usage of LLM tools in the Promptbook ecosystem
|
|
17
21
|
*/
|
|
@@ -32,5 +32,5 @@ export {};
|
|
|
32
32
|
* TODO: [🧠][💸] Maybe make some common abstraction `interceptLlmTools` and use here (or use javascript Proxy?)
|
|
33
33
|
* TODO: [🧠] Is there some meaningfull way how to test this util
|
|
34
34
|
* TODO: [🧠][🌯] Maybe a way how to hide ability to `get totalUsage`
|
|
35
|
-
* TODO: [👷♂️]
|
|
35
|
+
* TODO: [👷♂️] Write a comprehensive manual about the construction of LLM tools
|
|
36
36
|
*/
|
|
@@ -8,5 +8,5 @@ import { MultipleLlmExecutionTools } from './MultipleLlmExecutionTools';
|
|
|
8
8
|
export declare function getSingleLlmExecutionTools(oneOrMoreLlmExecutionTools: undefined | LlmExecutionTools | ReadonlyArray<LlmExecutionTools>): LlmExecutionTools | MultipleLlmExecutionTools;
|
|
9
9
|
/**
|
|
10
10
|
* TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
|
|
11
|
-
* TODO: [👷♂️]
|
|
11
|
+
* TODO: [👷♂️] Write a comprehensive manual about how to construct and use LLM execution tools in Promptbook
|
|
12
12
|
*/
|
|
@@ -2,22 +2,26 @@ import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
|
|
|
2
2
|
import type { string_markdown_text, string_title } from '../../types/typeAliases';
|
|
3
3
|
import { MultipleLlmExecutionTools } from './MultipleLlmExecutionTools';
|
|
4
4
|
/**
|
|
5
|
-
* Joins multiple LLM Execution Tools into one
|
|
5
|
+
* Joins multiple LLM Execution Tools into one.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
7
|
+
* This function takes a list of `LlmExecutionTools` and returns a single unified
|
|
8
|
+
* `MultipleLlmExecutionTools` object. It provides failover and aggregation logic:
|
|
8
9
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* 2
|
|
12
|
-
* 3
|
|
10
|
+
* 1. **Failover**: When a model call is made, it tries providers in the order they were provided.
|
|
11
|
+
* If the first provider doesn't support the requested model or fails, it tries the next one.
|
|
12
|
+
* 2. **Aggregation**: `listModels` returns a combined list of all models available from all providers.
|
|
13
|
+
* 3. **Empty case**: If no tools are provided, it logs a warning (as Promptbook requires LLMs to function).
|
|
13
14
|
*
|
|
15
|
+
* @param title - A descriptive title for this collection of joined tools
|
|
16
|
+
* @param llmExecutionTools - An array of execution tools to be joined
|
|
17
|
+
* @returns A single unified execution tool wrapper
|
|
14
18
|
*
|
|
15
|
-
* Tip: You don't have to use this function directly, just pass an array of LlmExecutionTools to the `ExecutionTools
|
|
19
|
+
* Tip: You don't have to use this function directly, just pass an array of LlmExecutionTools to the `ExecutionTools`.
|
|
16
20
|
*
|
|
17
21
|
* @public exported from `@promptbook/core`
|
|
18
22
|
*/
|
|
19
23
|
export declare function joinLlmExecutionTools(title: string_title & string_markdown_text, ...llmExecutionTools: ReadonlyArray<LlmExecutionTools>): MultipleLlmExecutionTools;
|
|
20
24
|
/**
|
|
21
25
|
* TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
|
|
22
|
-
* TODO: [👷♂️]
|
|
26
|
+
* TODO: [👷♂️] Write a comprehensive manual about how to construct and use LLM execution tools in Promptbook
|
|
23
27
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BehaviorSubject } from 'rxjs';
|
|
2
|
-
import type { AgentBasicInformation, BookParameter } from '../../book-2.0/agent-source/AgentBasicInformation';
|
|
2
|
+
import type { AgentBasicInformation, AgentCapability, 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
5
|
import type { ChatPromptResult } from '../../execution/PromptResult';
|
|
@@ -20,6 +20,7 @@ import type { AgentOptions } from './AgentOptions';
|
|
|
20
20
|
* @public exported from `@promptbook/core`
|
|
21
21
|
*/
|
|
22
22
|
export declare class Agent extends AgentLlmExecutionTools implements LlmExecutionTools, AgentBasicInformation {
|
|
23
|
+
#private;
|
|
23
24
|
private _agentName;
|
|
24
25
|
/**
|
|
25
26
|
* Name of the agent
|
|
@@ -37,6 +38,11 @@ export declare class Agent extends AgentLlmExecutionTools implements LlmExecutio
|
|
|
37
38
|
* Links found in the agent source
|
|
38
39
|
*/
|
|
39
40
|
links: Array<string_agent_url>;
|
|
41
|
+
/**
|
|
42
|
+
* Capabilities of the agent
|
|
43
|
+
* This is parsed from commitments like USE BROWSER, USE SEARCH ENGINE, KNOWLEDGE, etc.
|
|
44
|
+
*/
|
|
45
|
+
capabilities: AgentCapability[];
|
|
40
46
|
/**
|
|
41
47
|
* Computed hash of the agent source for integrity verification
|
|
42
48
|
*/
|
|
@@ -22,7 +22,7 @@ import type { CreateAgentLlmExecutionToolsOptions } from './CreateAgentLlmExecut
|
|
|
22
22
|
* @public exported from `@promptbook/core`
|
|
23
23
|
*/
|
|
24
24
|
export declare class AgentLlmExecutionTools implements LlmExecutionTools {
|
|
25
|
-
|
|
25
|
+
protected readonly options: CreateAgentLlmExecutionToolsOptions;
|
|
26
26
|
/**
|
|
27
27
|
* Cache of OpenAI assistants to avoid creating duplicates
|
|
28
28
|
*/
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type OpenAI from 'openai';
|
|
2
|
+
import type { LlmToolDefinition } from '../../../types/LlmToolDefinition';
|
|
3
|
+
/**
|
|
4
|
+
* Maps Promptbook tools to OpenAI tools.
|
|
5
|
+
*
|
|
6
|
+
* @private
|
|
7
|
+
*/
|
|
8
|
+
export declare function mapToolsToOpenAi(tools: ReadonlyArray<LlmToolDefinition>): Array<OpenAI.Chat.Completions.ChatCompletionTool>;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import type { ServerInfo } from './types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Renders the full HTML document for the Promptbook Server UI.
|
|
4
4
|
*
|
|
5
|
+
* This component provides the root structure of the server information page,
|
|
6
|
+
* including necessary meta tags, Tailwind CSS styling, and the server details body.
|
|
7
|
+
*
|
|
8
|
+
* @param props - Contains server information such as versions, port, and pipelines
|
|
5
9
|
* @private internal utility of Remote Server
|
|
6
10
|
*/
|
|
7
11
|
export declare function HtmlDoc({ info }: {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Promisable } from 'type-fest';
|
|
2
|
+
import type { string_markdown, string_markdown_text, string_title } from '../types/typeAliases';
|
|
3
|
+
import type { SearchResult } from './SearchResult';
|
|
4
|
+
export type SearchEngine = {
|
|
5
|
+
readonly title: string_title & string_markdown_text;
|
|
6
|
+
readonly description?: string_markdown;
|
|
7
|
+
checkConfiguration(): Promisable<void>;
|
|
8
|
+
search(query: string): Promise<SearchResult[]>;
|
|
9
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { string_url } from '../types/typeAliases';
|
|
2
|
+
/**
|
|
3
|
+
* Represents a search result from a search engine.
|
|
4
|
+
*/
|
|
5
|
+
export type SearchResult = {
|
|
6
|
+
/**
|
|
7
|
+
* The title of the search result.
|
|
8
|
+
*/
|
|
9
|
+
title: string;
|
|
10
|
+
/**
|
|
11
|
+
* The URL of the search result.
|
|
12
|
+
*/
|
|
13
|
+
url: string_url;
|
|
14
|
+
/**
|
|
15
|
+
* A short snippet or description of the search result.
|
|
16
|
+
*/
|
|
17
|
+
snippet: string;
|
|
18
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Promisable } from 'type-fest';
|
|
2
|
+
import type { string_markdown, string_markdown_text, string_title } from '../../types/typeAliases';
|
|
3
|
+
import type { SearchEngine } from '../SearchEngine';
|
|
4
|
+
import type { SearchResult } from '../SearchResult';
|
|
5
|
+
/**
|
|
6
|
+
* A search engine implementation that uses the Bing Web Search API.
|
|
7
|
+
*
|
|
8
|
+
* @private <- TODO: !!!! Export via some package
|
|
9
|
+
*/
|
|
10
|
+
export declare class BingSearchEngine implements SearchEngine {
|
|
11
|
+
get title(): string_title & string_markdown_text;
|
|
12
|
+
get description(): string_markdown;
|
|
13
|
+
checkConfiguration(): Promisable<void>;
|
|
14
|
+
search(query: string): Promise<SearchResult[]>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Promisable } from 'type-fest';
|
|
2
|
+
import type { string_markdown, string_markdown_text, string_title } from '../../types/typeAliases';
|
|
3
|
+
import type { SearchEngine } from '../SearchEngine';
|
|
4
|
+
import type { SearchResult } from '../SearchResult';
|
|
5
|
+
/**
|
|
6
|
+
* A dummy implementation of SearchEngine for testing purposes.
|
|
7
|
+
*
|
|
8
|
+
* @private <- TODO: !!!! Export via some package, maybe `@promptbook/search-engines` or `@promptbook/fake-llm`
|
|
9
|
+
*/
|
|
10
|
+
export declare class DummySearchEngine implements SearchEngine {
|
|
11
|
+
get title(): string_title & string_markdown_text;
|
|
12
|
+
get description(): string_markdown;
|
|
13
|
+
checkConfiguration(): Promisable<void>;
|
|
14
|
+
search(query: string): Promise<SearchResult[]>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { string_markdown_text, string_name } from './typeAliases';
|
|
2
|
+
/**
|
|
3
|
+
* Definition of a tool that can be used by the model
|
|
4
|
+
*
|
|
5
|
+
* Note: [🚉] This is fully serializable as JSON
|
|
6
|
+
*/
|
|
7
|
+
export type LlmToolDefinition = {
|
|
8
|
+
/**
|
|
9
|
+
* Name of the tool
|
|
10
|
+
*/
|
|
11
|
+
readonly name: string_name;
|
|
12
|
+
/**
|
|
13
|
+
* Description of the tool
|
|
14
|
+
*/
|
|
15
|
+
readonly description: string_markdown_text;
|
|
16
|
+
/**
|
|
17
|
+
* Parameters of the tool in JSON Schema format
|
|
18
|
+
*/
|
|
19
|
+
readonly parameters: Record<string, unknown>;
|
|
20
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { LlmToolDefinition } from './LlmToolDefinition';
|
|
1
2
|
import type { ModelVariant } from './ModelVariant';
|
|
2
3
|
import type { number_model_temperature, number_seed, string_model_name, string_system_message } from './typeAliases';
|
|
3
4
|
/**
|
|
@@ -28,6 +29,12 @@ export type CompletionModelRequirements = CommonModelRequirements & {
|
|
|
28
29
|
* Maximum number of tokens that can be generated by the model
|
|
29
30
|
*/
|
|
30
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[];
|
|
31
38
|
};
|
|
32
39
|
/**
|
|
33
40
|
* Model requirements for the chat variant
|
|
@@ -53,6 +60,12 @@ export type ChatModelRequirements = CommonModelRequirements & {
|
|
|
53
60
|
* Maximum number of tokens that can be generated by the model
|
|
54
61
|
*/
|
|
55
62
|
readonly maxTokens?: number;
|
|
63
|
+
/**
|
|
64
|
+
* Tools available for the model
|
|
65
|
+
*
|
|
66
|
+
* Note: [🚉] This is fully serializable as JSON
|
|
67
|
+
*/
|
|
68
|
+
readonly tools?: LlmToolDefinition[];
|
|
56
69
|
};
|
|
57
70
|
/**
|
|
58
71
|
* Model requirements for the image generation variant
|