@promptbook/fake-llm 0.105.0-10 → 0.105.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 +162 -6
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +1 -1
- package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +8 -4
- package/esm/typings/src/book-components/Chat/utils/getToolCallChipletText.d.ts +22 -0
- package/esm/typings/src/commitments/USE_IMAGE_GENERATOR/USE_IMAGE_GENERATOR.d.ts +46 -0
- package/esm/typings/src/commitments/USE_IMAGE_GENERATOR/USE_IMAGE_GENERATOR.test.d.ts +1 -0
- package/esm/typings/src/commitments/index.d.ts +2 -1
- package/esm/typings/src/execution/AvailableModel.d.ts +5 -4
- package/esm/typings/src/llm-providers/google/createGoogleExecutionTools.d.ts +1 -0
- package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +2 -2
- package/esm/typings/src/llm-providers/openai/utils/uploadFilesToOpenAi.d.ts +7 -0
- package/esm/typings/src/speech-recognition/OpenAiSpeechRecognition.d.ts +3 -0
- package/esm/typings/src/types/Prompt.d.ts +4 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +162 -6
- package/umd/index.umd.js.map +1 -1
|
@@ -31,7 +31,7 @@ export type AgentCapability = {
|
|
|
31
31
|
/**
|
|
32
32
|
* The type of the capability
|
|
33
33
|
*/
|
|
34
|
-
type: 'browser' | 'search-engine' | 'knowledge' | 'time' | 'inheritance' | 'import';
|
|
34
|
+
type: 'browser' | 'search-engine' | 'knowledge' | 'time' | 'inheritance' | 'import' | 'image-generator';
|
|
35
35
|
/**
|
|
36
36
|
* The label to display for this capability
|
|
37
37
|
*/
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { CSSProperties, ReactNode } from 'react';
|
|
2
2
|
import type { Promisable } from 'type-fest';
|
|
3
|
-
import type { string_chat_format_name } from '../save/_common/string_chat_format_name';
|
|
4
|
-
import type { ChatMessage } from '../types/ChatMessage';
|
|
5
|
-
import type { ChatParticipant } from '../types/ChatParticipant';
|
|
6
|
-
import { string_color } from '../../../types/typeAliases';
|
|
7
3
|
import { Color } from '../../../_packages/color.index';
|
|
8
4
|
import { SpeechRecognition } from '../../../types/SpeechRecognition';
|
|
5
|
+
import { string_color } from '../../../types/typeAliases';
|
|
9
6
|
import type { TODO_any } from '../../../utils/organization/TODO_any';
|
|
7
|
+
import type { string_chat_format_name } from '../save/_common/string_chat_format_name';
|
|
8
|
+
import type { ChatMessage } from '../types/ChatMessage';
|
|
9
|
+
import type { ChatParticipant } from '../types/ChatParticipant';
|
|
10
10
|
/**
|
|
11
11
|
* @public exported from `@promptbook/components`
|
|
12
12
|
*/
|
|
@@ -203,6 +203,10 @@ export type ChatProps = {
|
|
|
203
203
|
arguments?: TODO_any;
|
|
204
204
|
result?: TODO_any;
|
|
205
205
|
}) => void;
|
|
206
|
+
/**
|
|
207
|
+
* Visual style of the chat component
|
|
208
|
+
*/
|
|
209
|
+
readonly visual: 'STANDALONE' | 'FULL_PAGE';
|
|
206
210
|
};
|
|
207
211
|
/**
|
|
208
212
|
* TODO: [☁️] Export component prop types only to `@promptbook/components` (not `@promptbook/types`)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { TODO_any } from '../../../utils/organization/TODO_any';
|
|
2
|
+
/**
|
|
3
|
+
* Utility to format tool call information for user-friendly display.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Technical to user-friendly tool names and emojis
|
|
7
|
+
*
|
|
8
|
+
* @private [🧠] Maybe public?
|
|
9
|
+
*/
|
|
10
|
+
export declare const TOOL_TITLES: Record<string, {
|
|
11
|
+
title: string;
|
|
12
|
+
emoji: string;
|
|
13
|
+
}>;
|
|
14
|
+
/**
|
|
15
|
+
* Gets the user-friendly text for a tool call chiplet.
|
|
16
|
+
*
|
|
17
|
+
* @private [🧠] Maybe public?
|
|
18
|
+
*/
|
|
19
|
+
export declare function getToolCallChipletText(toolCall: {
|
|
20
|
+
name: string;
|
|
21
|
+
arguments?: string | Record<string, TODO_any>;
|
|
22
|
+
}): string;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { string_javascript_name } from '../../_packages/types.index';
|
|
2
|
+
import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
|
|
3
|
+
import { ToolFunction } from '../../scripting/javascript/JavascriptExecutionToolsOptions';
|
|
4
|
+
import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
5
|
+
/**
|
|
6
|
+
* USE IMAGE GENERATOR commitment definition
|
|
7
|
+
*
|
|
8
|
+
* The `USE IMAGE GENERATOR` commitment indicates that the agent should utilize an image generation tool
|
|
9
|
+
* to create images based on text prompts.
|
|
10
|
+
*
|
|
11
|
+
* Example usage in agent source:
|
|
12
|
+
*
|
|
13
|
+
* ```book
|
|
14
|
+
* USE IMAGE GENERATOR
|
|
15
|
+
* USE IMAGE GENERATOR Create realistic images of nature
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @private [🪔] Maybe export the commitments through some package
|
|
19
|
+
*/
|
|
20
|
+
export declare class UseImageGeneratorCommitmentDefinition extends BaseCommitmentDefinition<'USE IMAGE GENERATOR' | 'USE IMAGE GENERATION' | 'IMAGE GENERATOR' | 'IMAGE GENERATION' | 'USE IMAGE'> {
|
|
21
|
+
constructor(type?: 'USE IMAGE GENERATOR' | 'USE IMAGE GENERATION' | 'IMAGE GENERATOR' | 'IMAGE GENERATION' | 'USE IMAGE');
|
|
22
|
+
/**
|
|
23
|
+
* Short one-line description of USE IMAGE GENERATOR.
|
|
24
|
+
*/
|
|
25
|
+
get description(): string;
|
|
26
|
+
/**
|
|
27
|
+
* Icon for this commitment.
|
|
28
|
+
*/
|
|
29
|
+
get icon(): string;
|
|
30
|
+
/**
|
|
31
|
+
* Markdown documentation for USE IMAGE GENERATOR commitment.
|
|
32
|
+
*/
|
|
33
|
+
get documentation(): string;
|
|
34
|
+
applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
|
|
35
|
+
/**
|
|
36
|
+
* Gets human-readable titles for tool functions provided by this commitment.
|
|
37
|
+
*/
|
|
38
|
+
getToolTitles(): Record<string_javascript_name, string>;
|
|
39
|
+
/**
|
|
40
|
+
* Gets the `generate_image` tool function implementation.
|
|
41
|
+
*/
|
|
42
|
+
getToolFunctions(): Record<string_javascript_name, ToolFunction>;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
46
|
+
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -33,6 +33,7 @@ import { ScenarioCommitmentDefinition } from './SCENARIO/SCENARIO';
|
|
|
33
33
|
import { StyleCommitmentDefinition } from './STYLE/STYLE';
|
|
34
34
|
import { UseCommitmentDefinition } from './USE/USE';
|
|
35
35
|
import { UseBrowserCommitmentDefinition } from './USE_BROWSER/USE_BROWSER';
|
|
36
|
+
import { UseImageGeneratorCommitmentDefinition } from './USE_IMAGE_GENERATOR/USE_IMAGE_GENERATOR';
|
|
36
37
|
import { UseMcpCommitmentDefinition } from './USE_MCP/USE_MCP';
|
|
37
38
|
import { UseSearchEngineCommitmentDefinition } from './USE_SEARCH_ENGINE/USE_SEARCH_ENGINE';
|
|
38
39
|
import { UseTimeCommitmentDefinition } from './USE_TIME/USE_TIME';
|
|
@@ -44,7 +45,7 @@ import { NotYetImplementedCommitmentDefinition } from './_base/NotYetImplemented
|
|
|
44
45
|
*
|
|
45
46
|
* @private Use functions to access commitments instead of this array directly
|
|
46
47
|
*/
|
|
47
|
-
export declare const COMMITMENT_REGISTRY: readonly [PersonaCommitmentDefinition, PersonaCommitmentDefinition, KnowledgeCommitmentDefinition, MemoryCommitmentDefinition, MemoryCommitmentDefinition, StyleCommitmentDefinition, StyleCommitmentDefinition, RuleCommitmentDefinition, RuleCommitmentDefinition, LanguageCommitmentDefinition, LanguageCommitmentDefinition, SampleCommitmentDefinition, SampleCommitmentDefinition, FormatCommitmentDefinition, FormatCommitmentDefinition, FromCommitmentDefinition, ImportCommitmentDefinition, ImportCommitmentDefinition, ModelCommitmentDefinition, ModelCommitmentDefinition, ActionCommitmentDefinition, ActionCommitmentDefinition, ComponentCommitmentDefinition, MetaImageCommitmentDefinition, MetaColorCommitmentDefinition, MetaFontCommitmentDefinition, MetaLinkCommitmentDefinition, MetaCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, GoalCommitmentDefinition, GoalCommitmentDefinition, InitialMessageCommitmentDefinition, UserMessageCommitmentDefinition, AgentMessageCommitmentDefinition, MessageCommitmentDefinition, MessageCommitmentDefinition, ScenarioCommitmentDefinition, ScenarioCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DictionaryCommitmentDefinition, OpenCommitmentDefinition, ClosedCommitmentDefinition, UseBrowserCommitmentDefinition, UseSearchEngineCommitmentDefinition, UseTimeCommitmentDefinition, UseMcpCommitmentDefinition, UseCommitmentDefinition, NotYetImplementedCommitmentDefinition<"EXPECT">, NotYetImplementedCommitmentDefinition<"BEHAVIOUR">, NotYetImplementedCommitmentDefinition<"BEHAVIOURS">, NotYetImplementedCommitmentDefinition<"AVOID">, NotYetImplementedCommitmentDefinition<"AVOIDANCE">, NotYetImplementedCommitmentDefinition<"CONTEXT">];
|
|
48
|
+
export declare const COMMITMENT_REGISTRY: readonly [PersonaCommitmentDefinition, PersonaCommitmentDefinition, KnowledgeCommitmentDefinition, MemoryCommitmentDefinition, MemoryCommitmentDefinition, StyleCommitmentDefinition, StyleCommitmentDefinition, RuleCommitmentDefinition, RuleCommitmentDefinition, LanguageCommitmentDefinition, LanguageCommitmentDefinition, SampleCommitmentDefinition, SampleCommitmentDefinition, FormatCommitmentDefinition, FormatCommitmentDefinition, FromCommitmentDefinition, ImportCommitmentDefinition, ImportCommitmentDefinition, ModelCommitmentDefinition, ModelCommitmentDefinition, ActionCommitmentDefinition, ActionCommitmentDefinition, ComponentCommitmentDefinition, MetaImageCommitmentDefinition, MetaColorCommitmentDefinition, MetaFontCommitmentDefinition, MetaLinkCommitmentDefinition, MetaCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, GoalCommitmentDefinition, GoalCommitmentDefinition, InitialMessageCommitmentDefinition, UserMessageCommitmentDefinition, AgentMessageCommitmentDefinition, MessageCommitmentDefinition, MessageCommitmentDefinition, ScenarioCommitmentDefinition, ScenarioCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DictionaryCommitmentDefinition, OpenCommitmentDefinition, ClosedCommitmentDefinition, UseBrowserCommitmentDefinition, UseSearchEngineCommitmentDefinition, UseTimeCommitmentDefinition, UseImageGeneratorCommitmentDefinition, UseImageGeneratorCommitmentDefinition, UseImageGeneratorCommitmentDefinition, UseImageGeneratorCommitmentDefinition, UseImageGeneratorCommitmentDefinition, UseMcpCommitmentDefinition, UseCommitmentDefinition, NotYetImplementedCommitmentDefinition<"EXPECT">, NotYetImplementedCommitmentDefinition<"BEHAVIOUR">, NotYetImplementedCommitmentDefinition<"BEHAVIOURS">, NotYetImplementedCommitmentDefinition<"AVOID">, NotYetImplementedCommitmentDefinition<"AVOIDANCE">, NotYetImplementedCommitmentDefinition<"CONTEXT">];
|
|
48
49
|
/**
|
|
49
50
|
* Gets a commitment definition by its type
|
|
50
51
|
* @param type The commitment type to look up
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import type { ModelVariant } from '../types/ModelVariant';
|
|
2
|
-
import type { number_usd } from '../types/typeAliases';
|
|
3
|
-
import type { string_model_description } from '../types/typeAliases';
|
|
4
|
-
import type { string_model_name } from '../types/typeAliases';
|
|
5
|
-
import type { string_title } from '../types/typeAliases';
|
|
2
|
+
import type { number_usd, string_model_description, string_model_name, string_title, string_url } from '../types/typeAliases';
|
|
6
3
|
/**
|
|
7
4
|
* Represents a model that can be used for prompt execution
|
|
8
5
|
*/
|
|
@@ -40,6 +37,10 @@ export type AvailableModel = {
|
|
|
40
37
|
readonly prompt: number_usd;
|
|
41
38
|
readonly output: number_usd;
|
|
42
39
|
};
|
|
40
|
+
/**
|
|
41
|
+
* URL to the model (or provider) documentation
|
|
42
|
+
*/
|
|
43
|
+
readonly documentationUrl?: string_url;
|
|
43
44
|
/**
|
|
44
45
|
* If the model is deprecated, it should not be used for new tasks
|
|
45
46
|
*/
|
|
@@ -10,5 +10,6 @@ export declare const createGoogleExecutionTools: ((options: GoogleExecutionTools
|
|
|
10
10
|
className: string;
|
|
11
11
|
};
|
|
12
12
|
/**
|
|
13
|
+
* TODO: !!!!! Rename to `createGoogleLlmExecutionTools`, `...GoogleLlmExecutionTools`
|
|
13
14
|
* TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
|
|
14
15
|
*/
|
|
@@ -33,11 +33,11 @@ export declare class OpenAiAssistantExecutionTools extends OpenAiExecutionTools
|
|
|
33
33
|
/**
|
|
34
34
|
* Calls OpenAI API to use a chat model.
|
|
35
35
|
*/
|
|
36
|
-
callChatModel(prompt:
|
|
36
|
+
callChatModel(prompt: Prompt): Promise<ChatPromptResult>;
|
|
37
37
|
/**
|
|
38
38
|
* Calls OpenAI API to use a chat model with streaming.
|
|
39
39
|
*/
|
|
40
|
-
callChatModelStream(prompt:
|
|
40
|
+
callChatModelStream(prompt: Prompt, onProgress: (chunk: ChatPromptResult) => void): Promise<ChatPromptResult>;
|
|
41
41
|
/**
|
|
42
42
|
* Get an existing assistant tool wrapper
|
|
43
43
|
*/
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import OpenAI from 'openai';
|
|
2
|
+
/**
|
|
3
|
+
* Uploads files to OpenAI and returns their IDs
|
|
4
|
+
*
|
|
5
|
+
* @private utility for `OpenAiAssistantExecutionTools` and `OpenAiCompatibleExecutionTools`
|
|
6
|
+
*/
|
|
7
|
+
export declare function uploadFilesToOpenAi(client: OpenAI, files: Array<File>): Promise<Array<string>>;
|
|
@@ -19,6 +19,9 @@ export type OpenAiSpeechRecognitionOptions = {
|
|
|
19
19
|
export declare class OpenAiSpeechRecognition implements SpeechRecognition {
|
|
20
20
|
private readonly options;
|
|
21
21
|
private mediaRecorder;
|
|
22
|
+
private audioContext;
|
|
23
|
+
private analyser;
|
|
24
|
+
private silenceTimeout;
|
|
22
25
|
private audioChunks;
|
|
23
26
|
private callbacks;
|
|
24
27
|
private _state;
|
|
@@ -15,7 +15,7 @@ export declare const BOOK_LANGUAGE_VERSION: string_semantic_version;
|
|
|
15
15
|
export declare const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version;
|
|
16
16
|
/**
|
|
17
17
|
* Represents the version string of the Promptbook engine.
|
|
18
|
-
* It follows semantic versioning (e.g., `0.105.0-
|
|
18
|
+
* It follows semantic versioning (e.g., `0.105.0-11`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/fake-llm",
|
|
3
|
-
"version": "0.105.0-
|
|
3
|
+
"version": "0.105.0-12",
|
|
4
4
|
"description": "Promptbook: Turn your company's scattered knowledge into AI ready books",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"module": "./esm/index.es.js",
|
|
97
97
|
"typings": "./esm/typings/src/_packages/fake-llm.index.d.ts",
|
|
98
98
|
"peerDependencies": {
|
|
99
|
-
"@promptbook/core": "0.105.0-
|
|
99
|
+
"@promptbook/core": "0.105.0-12"
|
|
100
100
|
},
|
|
101
101
|
"dependencies": {
|
|
102
102
|
"crypto": "1.0.1",
|
package/umd/index.umd.js
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* @generated
|
|
23
23
|
* @see https://github.com/webgptorg/promptbook
|
|
24
24
|
*/
|
|
25
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.105.0-
|
|
25
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.105.0-12';
|
|
26
26
|
/**
|
|
27
27
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
28
28
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -6109,6 +6109,148 @@
|
|
|
6109
6109
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
6110
6110
|
*/
|
|
6111
6111
|
|
|
6112
|
+
/**
|
|
6113
|
+
* USE IMAGE GENERATOR commitment definition
|
|
6114
|
+
*
|
|
6115
|
+
* The `USE IMAGE GENERATOR` commitment indicates that the agent should utilize an image generation tool
|
|
6116
|
+
* to create images based on text prompts.
|
|
6117
|
+
*
|
|
6118
|
+
* Example usage in agent source:
|
|
6119
|
+
*
|
|
6120
|
+
* ```book
|
|
6121
|
+
* USE IMAGE GENERATOR
|
|
6122
|
+
* USE IMAGE GENERATOR Create realistic images of nature
|
|
6123
|
+
* ```
|
|
6124
|
+
*
|
|
6125
|
+
* @private [🪔] Maybe export the commitments through some package
|
|
6126
|
+
*/
|
|
6127
|
+
class UseImageGeneratorCommitmentDefinition extends BaseCommitmentDefinition {
|
|
6128
|
+
constructor(type = 'USE IMAGE GENERATOR') {
|
|
6129
|
+
super(type, ['USE IMAGE GENERATION', 'IMAGE GENERATOR', 'IMAGE GENERATION', 'USE IMAGE']);
|
|
6130
|
+
}
|
|
6131
|
+
/**
|
|
6132
|
+
* Short one-line description of USE IMAGE GENERATOR.
|
|
6133
|
+
*/
|
|
6134
|
+
get description() {
|
|
6135
|
+
return 'Enable the agent to use an image generation tool for creating images from text prompts.';
|
|
6136
|
+
}
|
|
6137
|
+
/**
|
|
6138
|
+
* Icon for this commitment.
|
|
6139
|
+
*/
|
|
6140
|
+
get icon() {
|
|
6141
|
+
return '🖼️';
|
|
6142
|
+
}
|
|
6143
|
+
/**
|
|
6144
|
+
* Markdown documentation for USE IMAGE GENERATOR commitment.
|
|
6145
|
+
*/
|
|
6146
|
+
get documentation() {
|
|
6147
|
+
return spaceTrim$1.spaceTrim(`
|
|
6148
|
+
# USE IMAGE GENERATOR
|
|
6149
|
+
|
|
6150
|
+
Enables the agent to use an image generation tool to create images based on text prompts.
|
|
6151
|
+
|
|
6152
|
+
## Key aspects
|
|
6153
|
+
|
|
6154
|
+
- The content following \`USE IMAGE GENERATOR\` is an arbitrary text that the agent should know (e.g. style instructions or safety guidelines).
|
|
6155
|
+
- The actual image generation is handled by the agent runtime using LLM execution tools.
|
|
6156
|
+
- Allows the agent to generate visual content based on user requests.
|
|
6157
|
+
- Returns the URL of the generated image.
|
|
6158
|
+
|
|
6159
|
+
## Examples
|
|
6160
|
+
|
|
6161
|
+
\`\`\`book
|
|
6162
|
+
Visual Artist
|
|
6163
|
+
|
|
6164
|
+
PERSONA You are a creative visual artist who can generate images.
|
|
6165
|
+
USE IMAGE GENERATOR
|
|
6166
|
+
RULE Always describe the generated image to the user.
|
|
6167
|
+
\`\`\`
|
|
6168
|
+
|
|
6169
|
+
\`\`\`book
|
|
6170
|
+
Interior Designer
|
|
6171
|
+
|
|
6172
|
+
PERSONA You are an interior designer who helps users visualize their space.
|
|
6173
|
+
USE IMAGE GENERATOR Professional interior design renders.
|
|
6174
|
+
ACTION Generate a preview of the designed room.
|
|
6175
|
+
\`\`\`
|
|
6176
|
+
`);
|
|
6177
|
+
}
|
|
6178
|
+
applyToAgentModelRequirements(requirements, content) {
|
|
6179
|
+
// Get existing tools array or create new one
|
|
6180
|
+
const existingTools = requirements.tools || [];
|
|
6181
|
+
// Add 'generate_image' to tools if not already present
|
|
6182
|
+
const updatedTools = existingTools.some((tool) => tool.name === 'generate_image')
|
|
6183
|
+
? existingTools
|
|
6184
|
+
: [
|
|
6185
|
+
...existingTools,
|
|
6186
|
+
{
|
|
6187
|
+
name: 'generate_image',
|
|
6188
|
+
description: spaceTrim$1.spaceTrim(`
|
|
6189
|
+
Generate an image from a text prompt.
|
|
6190
|
+
Use this tool when the user asks to create, draw, or generate an image.
|
|
6191
|
+
${!content ? '' : `Style instructions / guidelines: ${content}`}
|
|
6192
|
+
`),
|
|
6193
|
+
parameters: {
|
|
6194
|
+
type: 'object',
|
|
6195
|
+
properties: {
|
|
6196
|
+
prompt: {
|
|
6197
|
+
type: 'string',
|
|
6198
|
+
description: 'The detailed description of the image to generate',
|
|
6199
|
+
},
|
|
6200
|
+
},
|
|
6201
|
+
required: ['prompt'],
|
|
6202
|
+
},
|
|
6203
|
+
},
|
|
6204
|
+
];
|
|
6205
|
+
// Return requirements with updated tools and metadata
|
|
6206
|
+
return this.appendToSystemMessage({
|
|
6207
|
+
...requirements,
|
|
6208
|
+
tools: updatedTools,
|
|
6209
|
+
metadata: {
|
|
6210
|
+
...requirements.metadata,
|
|
6211
|
+
useImageGenerator: content || true,
|
|
6212
|
+
},
|
|
6213
|
+
}, spaceTrim$1.spaceTrim(`
|
|
6214
|
+
You have access to an image generator. Use it to create images based on user requests.
|
|
6215
|
+
When you generate an image, you will receive a URL of the generated image.
|
|
6216
|
+
`));
|
|
6217
|
+
}
|
|
6218
|
+
/**
|
|
6219
|
+
* Gets human-readable titles for tool functions provided by this commitment.
|
|
6220
|
+
*/
|
|
6221
|
+
getToolTitles() {
|
|
6222
|
+
return {
|
|
6223
|
+
generate_image: 'Generate image',
|
|
6224
|
+
};
|
|
6225
|
+
}
|
|
6226
|
+
/**
|
|
6227
|
+
* Gets the `generate_image` tool function implementation.
|
|
6228
|
+
*/
|
|
6229
|
+
getToolFunctions() {
|
|
6230
|
+
return {
|
|
6231
|
+
async generate_image(args, ...extra) {
|
|
6232
|
+
console.log('!!!! [Tool] generate_image called', { args });
|
|
6233
|
+
const { prompt } = args;
|
|
6234
|
+
if (!prompt) {
|
|
6235
|
+
throw new Error('Image prompt is required');
|
|
6236
|
+
}
|
|
6237
|
+
const { llmTools } = extra[0] || {};
|
|
6238
|
+
if (!llmTools || !llmTools.callImageGenerationModel) {
|
|
6239
|
+
throw new Error('Image generation is not supported by the current model provider');
|
|
6240
|
+
}
|
|
6241
|
+
const result = await llmTools.callImageGenerationModel({
|
|
6242
|
+
content: prompt,
|
|
6243
|
+
modelName: 'dall-e-3', // Defaulting to dall-e-3, but this could be configurable
|
|
6244
|
+
});
|
|
6245
|
+
return result.content;
|
|
6246
|
+
},
|
|
6247
|
+
};
|
|
6248
|
+
}
|
|
6249
|
+
}
|
|
6250
|
+
/**
|
|
6251
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
6252
|
+
*/
|
|
6253
|
+
|
|
6112
6254
|
/**
|
|
6113
6255
|
* USE MCP commitment definition
|
|
6114
6256
|
*
|
|
@@ -6357,8 +6499,12 @@
|
|
|
6357
6499
|
useSearchEngine: content || true,
|
|
6358
6500
|
},
|
|
6359
6501
|
}, spaceTrim$1.spaceTrim(`
|
|
6360
|
-
|
|
6502
|
+
Tools:
|
|
6503
|
+
You have access to the web search engine via the tool "web_search".
|
|
6504
|
+
Use it to find up-to-date information or facts that you don't know.
|
|
6361
6505
|
When you need to know some information from the internet, use the tool provided to you.
|
|
6506
|
+
Do not make up information when you can search for it.
|
|
6507
|
+
Do not tell the user you cannot search for information, YOU CAN.
|
|
6362
6508
|
`));
|
|
6363
6509
|
}
|
|
6364
6510
|
/**
|
|
@@ -6383,9 +6529,7 @@
|
|
|
6383
6529
|
const searchEngine = new SerpSearchEngine();
|
|
6384
6530
|
const results = await searchEngine.search(query, options);
|
|
6385
6531
|
return spaceTrim$1.spaceTrim((block) => `
|
|
6386
|
-
Search results for "${query}"${Object.keys(options).length === 0
|
|
6387
|
-
? ''
|
|
6388
|
-
: ` with options ${JSON.stringify(options)}`}:
|
|
6532
|
+
Search results for "${query}"${Object.keys(options).length === 0 ? '' : ` with options ${JSON.stringify(options)}`}:
|
|
6389
6533
|
|
|
6390
6534
|
${block(results
|
|
6391
6535
|
.map((result) => spaceTrim$1.spaceTrim(`
|
|
@@ -6489,8 +6633,11 @@
|
|
|
6489
6633
|
...requirements.metadata,
|
|
6490
6634
|
},
|
|
6491
6635
|
}, spaceTrim$1.spaceTrim(`
|
|
6492
|
-
|
|
6636
|
+
Tool:
|
|
6637
|
+
You have access to the current date and time via the tool "get_current_time".
|
|
6638
|
+
Use it to answer questions about the current date and time.
|
|
6493
6639
|
When you need to know the current date or time, use the tool provided to you.
|
|
6640
|
+
Do not make up the current date or time; always use the tool to get accurate information.
|
|
6494
6641
|
`));
|
|
6495
6642
|
}
|
|
6496
6643
|
/**
|
|
@@ -6672,6 +6819,15 @@
|
|
|
6672
6819
|
new UseBrowserCommitmentDefinition(),
|
|
6673
6820
|
new UseSearchEngineCommitmentDefinition(),
|
|
6674
6821
|
new UseTimeCommitmentDefinition(),
|
|
6822
|
+
new UseImageGeneratorCommitmentDefinition('USE IMAGE GENERATOR'),
|
|
6823
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6824
|
+
new UseImageGeneratorCommitmentDefinition('USE IMAGE GENERATION'),
|
|
6825
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6826
|
+
new UseImageGeneratorCommitmentDefinition('IMAGE GENERATOR'),
|
|
6827
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6828
|
+
new UseImageGeneratorCommitmentDefinition('IMAGE GENERATION'),
|
|
6829
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6830
|
+
new UseImageGeneratorCommitmentDefinition('USE IMAGE'),
|
|
6675
6831
|
new UseMcpCommitmentDefinition(),
|
|
6676
6832
|
new UseCommitmentDefinition(),
|
|
6677
6833
|
// Not yet implemented commitments (using placeholder)
|