@promptbook/ollama 0.104.0-10 → 0.104.0-12
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 +22 -2
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/types.index.d.ts +8 -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 +5 -0
- package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirements.tools.test.d.ts +1 -0
- package/esm/typings/src/book-components/Chat/types/ChatMessage.d.ts +2 -2
- package/esm/typings/src/book-components/_common/Dropdown/Dropdown.d.ts +1 -1
- package/esm/typings/src/book-components/_common/HamburgerMenu/HamburgerMenu.d.ts +1 -1
- package/esm/typings/src/book-components/icons/AboutIcon.d.ts +1 -1
- package/esm/typings/src/book-components/icons/AttachmentIcon.d.ts +1 -1
- package/esm/typings/src/book-components/icons/CameraIcon.d.ts +1 -1
- package/esm/typings/src/book-components/icons/DownloadIcon.d.ts +1 -1
- package/esm/typings/src/book-components/icons/MenuIcon.d.ts +1 -1
- package/esm/typings/src/book-components/icons/SaveIcon.d.ts +1 -1
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +2 -2
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentsDatabaseSchema.d.ts +0 -54
- 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/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 +1 -1
- 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 +1 -1
- package/esm/typings/src/llm-providers/agent/Agent.d.ts +6 -1
- package/esm/typings/src/llm-providers/openai/utils/mapToolsToOpenAi.d.ts +8 -0
- package/esm/typings/src/remote-server/ui/ServerApp.d.ts +1 -1
- 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/utils/random/$randomAgentPersona.d.ts +3 -2
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +22 -2
- package/umd/index.umd.js.map +1 -1
|
@@ -23,6 +23,24 @@ export type BookParameter = {
|
|
|
23
23
|
*/
|
|
24
24
|
description?: string;
|
|
25
25
|
};
|
|
26
|
+
/**
|
|
27
|
+
* Capability of the agent
|
|
28
|
+
* This is parsed from commitments like USE BROWSER, USE SEARCH ENGINE, KNOWLEDGE, etc.
|
|
29
|
+
*/
|
|
30
|
+
export type AgentCapability = {
|
|
31
|
+
/**
|
|
32
|
+
* The type of the capability
|
|
33
|
+
*/
|
|
34
|
+
type: 'browser' | 'search-engine' | 'knowledge';
|
|
35
|
+
/**
|
|
36
|
+
* The label to display for this capability
|
|
37
|
+
*/
|
|
38
|
+
label: string;
|
|
39
|
+
/**
|
|
40
|
+
* The name of the icon to display for this capability
|
|
41
|
+
*/
|
|
42
|
+
iconName: string;
|
|
43
|
+
};
|
|
26
44
|
export type AgentBasicInformation = {
|
|
27
45
|
/**
|
|
28
46
|
* Name of the agent
|
|
@@ -55,6 +73,7 @@ export type AgentBasicInformation = {
|
|
|
55
73
|
*/
|
|
56
74
|
meta: {
|
|
57
75
|
fullname?: string;
|
|
76
|
+
description?: string;
|
|
58
77
|
image?: string_url_image;
|
|
59
78
|
font?: string_fonts;
|
|
60
79
|
color?: string_color;
|
|
@@ -72,6 +91,11 @@ export type AgentBasicInformation = {
|
|
|
72
91
|
* - {parameterName} or {parameter with multiple words} or {parameterName: description text}
|
|
73
92
|
*/
|
|
74
93
|
parameters: BookParameter[];
|
|
94
|
+
/**
|
|
95
|
+
* Capabilities of the agent
|
|
96
|
+
* This is parsed from commitments like USE BROWSER, USE SEARCH ENGINE, KNOWLEDGE, etc.
|
|
97
|
+
*/
|
|
98
|
+
capabilities: AgentCapability[];
|
|
75
99
|
};
|
|
76
100
|
/**
|
|
77
101
|
* TODO: [🐱🚀] Make all properties of `AgentBasicInformation` readonly
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { LlmToolDefinition } from '../../types/LlmToolDefinition';
|
|
1
2
|
import type { string_knowledge_source_link } from '../../types/typeAliases';
|
|
2
3
|
import type { TODO_any } from '../../utils/organization/TODO_any';
|
|
3
4
|
/**
|
|
@@ -45,6 +46,10 @@ export type AgentModelRequirements = {
|
|
|
45
46
|
* Top-k sampling value for the agent's responses
|
|
46
47
|
*/
|
|
47
48
|
readonly topK?: number;
|
|
49
|
+
/**
|
|
50
|
+
* Tools available for the agent
|
|
51
|
+
*/
|
|
52
|
+
readonly tools?: ReadonlyArray<LlmToolDefinition>;
|
|
48
53
|
/**
|
|
49
54
|
* Arbitrary metadata storage for commitments
|
|
50
55
|
* Each commitment can store its own data here
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -23,11 +23,11 @@ export type ChatMessage = Omit<Message<id>, 'direction' | 'recipients' | 'thread
|
|
|
23
23
|
*/
|
|
24
24
|
isComplete?: boolean;
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
26
|
+
* The expected answer for the message (used for testing or validation)
|
|
27
27
|
*/
|
|
28
28
|
expectedAnswer?: string;
|
|
29
29
|
/**
|
|
30
|
-
*
|
|
30
|
+
* Indicates if the message was sent via a voice call
|
|
31
31
|
*/
|
|
32
32
|
isVoiceCall?: boolean;
|
|
33
33
|
};
|
|
@@ -26,11 +26,11 @@ export declare class AgentCollectionInSupabase {
|
|
|
26
26
|
*/
|
|
27
27
|
listAgents(): Promise<ReadonlyArray<AgentBasicInformation>>;
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
29
|
+
* Retrieves the permanent ID of an agent by its name or permanent ID.
|
|
30
30
|
*/
|
|
31
31
|
getAgentPermanentId(agentNameOrPermanentId: string_agent_name | string_agent_permanent_id): Promise<string_agent_permanent_id>;
|
|
32
32
|
/**
|
|
33
|
-
*
|
|
33
|
+
* Retrieves the source code of an agent by its name or permanent ID.
|
|
34
34
|
*/
|
|
35
35
|
getAgentSource(agentNameOrPermanentId: string_agent_name | string_agent_permanent_id): Promise<string_book>;
|
|
36
36
|
/**
|
|
@@ -108,60 +108,6 @@ export type AgentsDatabaseSchema = {
|
|
|
108
108
|
}
|
|
109
109
|
];
|
|
110
110
|
};
|
|
111
|
-
GenerationLock: {
|
|
112
|
-
Row: {
|
|
113
|
-
id: number;
|
|
114
|
-
createdAt: string;
|
|
115
|
-
updatedAt: string;
|
|
116
|
-
lockKey: string;
|
|
117
|
-
expiresAt: string;
|
|
118
|
-
};
|
|
119
|
-
Insert: {
|
|
120
|
-
id?: number;
|
|
121
|
-
createdAt?: string;
|
|
122
|
-
updatedAt?: string;
|
|
123
|
-
lockKey: string;
|
|
124
|
-
expiresAt: string;
|
|
125
|
-
};
|
|
126
|
-
Update: {
|
|
127
|
-
id?: number;
|
|
128
|
-
createdAt?: string;
|
|
129
|
-
updatedAt?: string;
|
|
130
|
-
lockKey?: string;
|
|
131
|
-
expiresAt?: string;
|
|
132
|
-
};
|
|
133
|
-
Relationships: [];
|
|
134
|
-
};
|
|
135
|
-
Image: {
|
|
136
|
-
Row: {
|
|
137
|
-
id: number;
|
|
138
|
-
createdAt: string;
|
|
139
|
-
updatedAt: string;
|
|
140
|
-
filename: string;
|
|
141
|
-
prompt: string;
|
|
142
|
-
cdnUrl: string;
|
|
143
|
-
cdnKey: string;
|
|
144
|
-
};
|
|
145
|
-
Insert: {
|
|
146
|
-
id?: number;
|
|
147
|
-
createdAt?: string;
|
|
148
|
-
updatedAt?: string;
|
|
149
|
-
filename: string;
|
|
150
|
-
prompt: string;
|
|
151
|
-
cdnUrl: string;
|
|
152
|
-
cdnKey: string;
|
|
153
|
-
};
|
|
154
|
-
Update: {
|
|
155
|
-
id?: number;
|
|
156
|
-
createdAt?: string;
|
|
157
|
-
updatedAt?: string;
|
|
158
|
-
filename?: string;
|
|
159
|
-
prompt?: string;
|
|
160
|
-
cdnUrl?: string;
|
|
161
|
-
cdnKey?: string;
|
|
162
|
-
};
|
|
163
|
-
Relationships: [];
|
|
164
|
-
};
|
|
165
111
|
};
|
|
166
112
|
Views: Record<string, never>;
|
|
167
113
|
Functions: Record<string, never>;
|
|
@@ -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
|
|
@@ -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
|
*/
|
|
@@ -13,5 +13,5 @@ export declare function countUsage(llmTools: LlmExecutionTools): LlmExecutionToo
|
|
|
13
13
|
* TODO: [🧠] Is there some meaningfull way how to test this util
|
|
14
14
|
* TODO: [🧠][🌯] Maybe a way how to hide ability to `get totalUsage`
|
|
15
15
|
* > const [llmToolsWithUsage,getUsage] = countTotalUsage(llmTools);
|
|
16
|
-
* TODO: [👷♂️]
|
|
16
|
+
* TODO: [👷♂️] Write a comprehensive manual explaining the construction and usage of LLM tools in the Promptbook ecosystem
|
|
17
17
|
*/
|
|
@@ -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
|
*/
|
|
@@ -19,5 +19,5 @@ import { MultipleLlmExecutionTools } from './MultipleLlmExecutionTools';
|
|
|
19
19
|
export declare function joinLlmExecutionTools(title: string_title & string_markdown_text, ...llmExecutionTools: ReadonlyArray<LlmExecutionTools>): MultipleLlmExecutionTools;
|
|
20
20
|
/**
|
|
21
21
|
* TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
|
|
22
|
-
* TODO: [👷♂️]
|
|
22
|
+
* TODO: [👷♂️] Write a comprehensive manual about how to construct and use LLM execution tools in Promptbook
|
|
23
23
|
*/
|
|
@@ -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';
|
|
@@ -37,6 +37,11 @@ export declare class Agent extends AgentLlmExecutionTools implements LlmExecutio
|
|
|
37
37
|
* Links found in the agent source
|
|
38
38
|
*/
|
|
39
39
|
links: Array<string_agent_url>;
|
|
40
|
+
/**
|
|
41
|
+
* Capabilities of the agent
|
|
42
|
+
* This is parsed from commitments like USE BROWSER, USE SEARCH ENGINE, KNOWLEDGE, etc.
|
|
43
|
+
*/
|
|
44
|
+
capabilities: AgentCapability[];
|
|
40
45
|
/**
|
|
41
46
|
* Computed hash of the agent source for integrity verification
|
|
42
47
|
*/
|
|
@@ -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>;
|
|
@@ -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
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import type { string_persona_description } from '../../types/typeAliases';
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
+
* Generates a random agent persona description.
|
|
3
4
|
*
|
|
4
5
|
* @private internal helper function
|
|
5
6
|
*/
|
|
6
|
-
export declare function $randomAgentPersona():
|
|
7
|
+
export declare function $randomAgentPersona(): string_persona_description;
|
|
7
8
|
/**
|
|
8
9
|
* TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
|
|
9
10
|
*/
|
|
@@ -15,7 +15,7 @@ export declare const BOOK_LANGUAGE_VERSION: string_semantic_version;
|
|
|
15
15
|
export declare const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version;
|
|
16
16
|
/**
|
|
17
17
|
* Represents the version string of the Promptbook engine.
|
|
18
|
-
* It follows semantic versioning (e.g., `0.104.0-
|
|
18
|
+
* It follows semantic versioning (e.g., `0.104.0-11`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/ollama",
|
|
3
|
-
"version": "0.104.0-
|
|
3
|
+
"version": "0.104.0-12",
|
|
4
4
|
"description": "Promptbook: Turn your company's scattered knowledge into AI ready books",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
"module": "./esm/index.es.js",
|
|
95
95
|
"typings": "./esm/typings/src/_packages/ollama.index.d.ts",
|
|
96
96
|
"peerDependencies": {
|
|
97
|
-
"@promptbook/core": "0.104.0-
|
|
97
|
+
"@promptbook/core": "0.104.0-12"
|
|
98
98
|
},
|
|
99
99
|
"dependencies": {
|
|
100
100
|
"bottleneck": "2.19.5",
|
package/umd/index.umd.js
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
* @generated
|
|
26
26
|
* @see https://github.com/webgptorg/promptbook
|
|
27
27
|
*/
|
|
28
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.104.0-
|
|
28
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.104.0-12';
|
|
29
29
|
/**
|
|
30
30
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
31
31
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -2865,6 +2865,22 @@
|
|
|
2865
2865
|
return replacedTemplates;
|
|
2866
2866
|
}
|
|
2867
2867
|
|
|
2868
|
+
/**
|
|
2869
|
+
* Maps Promptbook tools to OpenAI tools.
|
|
2870
|
+
*
|
|
2871
|
+
* @private
|
|
2872
|
+
*/
|
|
2873
|
+
function mapToolsToOpenAi(tools) {
|
|
2874
|
+
return tools.map((tool) => ({
|
|
2875
|
+
type: 'function',
|
|
2876
|
+
function: {
|
|
2877
|
+
name: tool.name,
|
|
2878
|
+
description: tool.description,
|
|
2879
|
+
parameters: tool.parameters,
|
|
2880
|
+
},
|
|
2881
|
+
}));
|
|
2882
|
+
}
|
|
2883
|
+
|
|
2868
2884
|
/**
|
|
2869
2885
|
* Parses an OpenAI error message to identify which parameter is unsupported
|
|
2870
2886
|
*
|
|
@@ -3062,6 +3078,9 @@
|
|
|
3062
3078
|
},
|
|
3063
3079
|
],
|
|
3064
3080
|
user: (_a = this.options.userId) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
3081
|
+
tools: currentModelRequirements.tools === undefined
|
|
3082
|
+
? undefined
|
|
3083
|
+
: mapToolsToOpenAi(currentModelRequirements.tools),
|
|
3065
3084
|
};
|
|
3066
3085
|
const start = $getCurrentDate();
|
|
3067
3086
|
if (this.options.isVerbose) {
|
|
@@ -3206,6 +3225,7 @@
|
|
|
3206
3225
|
const rawPromptContent = templateParameters(content, { ...parameters, modelName });
|
|
3207
3226
|
const rawRequest = {
|
|
3208
3227
|
...modelSettings,
|
|
3228
|
+
model: modelName,
|
|
3209
3229
|
prompt: rawPromptContent,
|
|
3210
3230
|
user: (_a = this.options.userId) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
3211
3231
|
};
|
|
@@ -3460,8 +3480,8 @@
|
|
|
3460
3480
|
const rawPromptContent = templateParameters(content, { ...parameters, modelName });
|
|
3461
3481
|
const rawRequest = {
|
|
3462
3482
|
...modelSettings,
|
|
3463
|
-
size: modelSettings.size || '1024x1024',
|
|
3464
3483
|
prompt: rawPromptContent,
|
|
3484
|
+
size: modelSettings.size || '1024x1024',
|
|
3465
3485
|
user: (_a = this.options.userId) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
3466
3486
|
response_format: 'url', // TODO: [🧠] Maybe allow b64_json
|
|
3467
3487
|
};
|