@promptbook/remote-server 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/remote-server",
|
|
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,
|
|
@@ -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.105.0-
|
|
98
|
+
"@promptbook/core": "0.105.0-12"
|
|
99
99
|
},
|
|
100
100
|
"dependencies": {
|
|
101
101
|
"colors": "1.4.0",
|
package/umd/index.umd.js
CHANGED
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
* @generated
|
|
48
48
|
* @see https://github.com/webgptorg/promptbook
|
|
49
49
|
*/
|
|
50
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.105.0-
|
|
50
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.105.0-12';
|
|
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
|
|
@@ -11507,6 +11507,148 @@
|
|
|
11507
11507
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
11508
11508
|
*/
|
|
11509
11509
|
|
|
11510
|
+
/**
|
|
11511
|
+
* USE IMAGE GENERATOR commitment definition
|
|
11512
|
+
*
|
|
11513
|
+
* The `USE IMAGE GENERATOR` commitment indicates that the agent should utilize an image generation tool
|
|
11514
|
+
* to create images based on text prompts.
|
|
11515
|
+
*
|
|
11516
|
+
* Example usage in agent source:
|
|
11517
|
+
*
|
|
11518
|
+
* ```book
|
|
11519
|
+
* USE IMAGE GENERATOR
|
|
11520
|
+
* USE IMAGE GENERATOR Create realistic images of nature
|
|
11521
|
+
* ```
|
|
11522
|
+
*
|
|
11523
|
+
* @private [🪔] Maybe export the commitments through some package
|
|
11524
|
+
*/
|
|
11525
|
+
class UseImageGeneratorCommitmentDefinition extends BaseCommitmentDefinition {
|
|
11526
|
+
constructor(type = 'USE IMAGE GENERATOR') {
|
|
11527
|
+
super(type, ['USE IMAGE GENERATION', 'IMAGE GENERATOR', 'IMAGE GENERATION', 'USE IMAGE']);
|
|
11528
|
+
}
|
|
11529
|
+
/**
|
|
11530
|
+
* Short one-line description of USE IMAGE GENERATOR.
|
|
11531
|
+
*/
|
|
11532
|
+
get description() {
|
|
11533
|
+
return 'Enable the agent to use an image generation tool for creating images from text prompts.';
|
|
11534
|
+
}
|
|
11535
|
+
/**
|
|
11536
|
+
* Icon for this commitment.
|
|
11537
|
+
*/
|
|
11538
|
+
get icon() {
|
|
11539
|
+
return '🖼️';
|
|
11540
|
+
}
|
|
11541
|
+
/**
|
|
11542
|
+
* Markdown documentation for USE IMAGE GENERATOR commitment.
|
|
11543
|
+
*/
|
|
11544
|
+
get documentation() {
|
|
11545
|
+
return spaceTrim$1.spaceTrim(`
|
|
11546
|
+
# USE IMAGE GENERATOR
|
|
11547
|
+
|
|
11548
|
+
Enables the agent to use an image generation tool to create images based on text prompts.
|
|
11549
|
+
|
|
11550
|
+
## Key aspects
|
|
11551
|
+
|
|
11552
|
+
- The content following \`USE IMAGE GENERATOR\` is an arbitrary text that the agent should know (e.g. style instructions or safety guidelines).
|
|
11553
|
+
- The actual image generation is handled by the agent runtime using LLM execution tools.
|
|
11554
|
+
- Allows the agent to generate visual content based on user requests.
|
|
11555
|
+
- Returns the URL of the generated image.
|
|
11556
|
+
|
|
11557
|
+
## Examples
|
|
11558
|
+
|
|
11559
|
+
\`\`\`book
|
|
11560
|
+
Visual Artist
|
|
11561
|
+
|
|
11562
|
+
PERSONA You are a creative visual artist who can generate images.
|
|
11563
|
+
USE IMAGE GENERATOR
|
|
11564
|
+
RULE Always describe the generated image to the user.
|
|
11565
|
+
\`\`\`
|
|
11566
|
+
|
|
11567
|
+
\`\`\`book
|
|
11568
|
+
Interior Designer
|
|
11569
|
+
|
|
11570
|
+
PERSONA You are an interior designer who helps users visualize their space.
|
|
11571
|
+
USE IMAGE GENERATOR Professional interior design renders.
|
|
11572
|
+
ACTION Generate a preview of the designed room.
|
|
11573
|
+
\`\`\`
|
|
11574
|
+
`);
|
|
11575
|
+
}
|
|
11576
|
+
applyToAgentModelRequirements(requirements, content) {
|
|
11577
|
+
// Get existing tools array or create new one
|
|
11578
|
+
const existingTools = requirements.tools || [];
|
|
11579
|
+
// Add 'generate_image' to tools if not already present
|
|
11580
|
+
const updatedTools = existingTools.some((tool) => tool.name === 'generate_image')
|
|
11581
|
+
? existingTools
|
|
11582
|
+
: [
|
|
11583
|
+
...existingTools,
|
|
11584
|
+
{
|
|
11585
|
+
name: 'generate_image',
|
|
11586
|
+
description: spaceTrim$1.spaceTrim(`
|
|
11587
|
+
Generate an image from a text prompt.
|
|
11588
|
+
Use this tool when the user asks to create, draw, or generate an image.
|
|
11589
|
+
${!content ? '' : `Style instructions / guidelines: ${content}`}
|
|
11590
|
+
`),
|
|
11591
|
+
parameters: {
|
|
11592
|
+
type: 'object',
|
|
11593
|
+
properties: {
|
|
11594
|
+
prompt: {
|
|
11595
|
+
type: 'string',
|
|
11596
|
+
description: 'The detailed description of the image to generate',
|
|
11597
|
+
},
|
|
11598
|
+
},
|
|
11599
|
+
required: ['prompt'],
|
|
11600
|
+
},
|
|
11601
|
+
},
|
|
11602
|
+
];
|
|
11603
|
+
// Return requirements with updated tools and metadata
|
|
11604
|
+
return this.appendToSystemMessage({
|
|
11605
|
+
...requirements,
|
|
11606
|
+
tools: updatedTools,
|
|
11607
|
+
metadata: {
|
|
11608
|
+
...requirements.metadata,
|
|
11609
|
+
useImageGenerator: content || true,
|
|
11610
|
+
},
|
|
11611
|
+
}, spaceTrim$1.spaceTrim(`
|
|
11612
|
+
You have access to an image generator. Use it to create images based on user requests.
|
|
11613
|
+
When you generate an image, you will receive a URL of the generated image.
|
|
11614
|
+
`));
|
|
11615
|
+
}
|
|
11616
|
+
/**
|
|
11617
|
+
* Gets human-readable titles for tool functions provided by this commitment.
|
|
11618
|
+
*/
|
|
11619
|
+
getToolTitles() {
|
|
11620
|
+
return {
|
|
11621
|
+
generate_image: 'Generate image',
|
|
11622
|
+
};
|
|
11623
|
+
}
|
|
11624
|
+
/**
|
|
11625
|
+
* Gets the `generate_image` tool function implementation.
|
|
11626
|
+
*/
|
|
11627
|
+
getToolFunctions() {
|
|
11628
|
+
return {
|
|
11629
|
+
async generate_image(args, ...extra) {
|
|
11630
|
+
console.log('!!!! [Tool] generate_image called', { args });
|
|
11631
|
+
const { prompt } = args;
|
|
11632
|
+
if (!prompt) {
|
|
11633
|
+
throw new Error('Image prompt is required');
|
|
11634
|
+
}
|
|
11635
|
+
const { llmTools } = extra[0] || {};
|
|
11636
|
+
if (!llmTools || !llmTools.callImageGenerationModel) {
|
|
11637
|
+
throw new Error('Image generation is not supported by the current model provider');
|
|
11638
|
+
}
|
|
11639
|
+
const result = await llmTools.callImageGenerationModel({
|
|
11640
|
+
content: prompt,
|
|
11641
|
+
modelName: 'dall-e-3', // Defaulting to dall-e-3, but this could be configurable
|
|
11642
|
+
});
|
|
11643
|
+
return result.content;
|
|
11644
|
+
},
|
|
11645
|
+
};
|
|
11646
|
+
}
|
|
11647
|
+
}
|
|
11648
|
+
/**
|
|
11649
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
11650
|
+
*/
|
|
11651
|
+
|
|
11510
11652
|
/**
|
|
11511
11653
|
* USE MCP commitment definition
|
|
11512
11654
|
*
|
|
@@ -11755,8 +11897,12 @@
|
|
|
11755
11897
|
useSearchEngine: content || true,
|
|
11756
11898
|
},
|
|
11757
11899
|
}, spaceTrim$1.spaceTrim(`
|
|
11758
|
-
|
|
11900
|
+
Tools:
|
|
11901
|
+
You have access to the web search engine via the tool "web_search".
|
|
11902
|
+
Use it to find up-to-date information or facts that you don't know.
|
|
11759
11903
|
When you need to know some information from the internet, use the tool provided to you.
|
|
11904
|
+
Do not make up information when you can search for it.
|
|
11905
|
+
Do not tell the user you cannot search for information, YOU CAN.
|
|
11760
11906
|
`));
|
|
11761
11907
|
}
|
|
11762
11908
|
/**
|
|
@@ -11781,9 +11927,7 @@
|
|
|
11781
11927
|
const searchEngine = new SerpSearchEngine();
|
|
11782
11928
|
const results = await searchEngine.search(query, options);
|
|
11783
11929
|
return spaceTrim$1.spaceTrim((block) => `
|
|
11784
|
-
Search results for "${query}"${Object.keys(options).length === 0
|
|
11785
|
-
? ''
|
|
11786
|
-
: ` with options ${JSON.stringify(options)}`}:
|
|
11930
|
+
Search results for "${query}"${Object.keys(options).length === 0 ? '' : ` with options ${JSON.stringify(options)}`}:
|
|
11787
11931
|
|
|
11788
11932
|
${block(results
|
|
11789
11933
|
.map((result) => spaceTrim$1.spaceTrim(`
|
|
@@ -11887,8 +12031,11 @@
|
|
|
11887
12031
|
...requirements.metadata,
|
|
11888
12032
|
},
|
|
11889
12033
|
}, spaceTrim$1.spaceTrim(`
|
|
11890
|
-
|
|
12034
|
+
Tool:
|
|
12035
|
+
You have access to the current date and time via the tool "get_current_time".
|
|
12036
|
+
Use it to answer questions about the current date and time.
|
|
11891
12037
|
When you need to know the current date or time, use the tool provided to you.
|
|
12038
|
+
Do not make up the current date or time; always use the tool to get accurate information.
|
|
11892
12039
|
`));
|
|
11893
12040
|
}
|
|
11894
12041
|
/**
|
|
@@ -12070,6 +12217,15 @@
|
|
|
12070
12217
|
new UseBrowserCommitmentDefinition(),
|
|
12071
12218
|
new UseSearchEngineCommitmentDefinition(),
|
|
12072
12219
|
new UseTimeCommitmentDefinition(),
|
|
12220
|
+
new UseImageGeneratorCommitmentDefinition('USE IMAGE GENERATOR'),
|
|
12221
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12222
|
+
new UseImageGeneratorCommitmentDefinition('USE IMAGE GENERATION'),
|
|
12223
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12224
|
+
new UseImageGeneratorCommitmentDefinition('IMAGE GENERATOR'),
|
|
12225
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12226
|
+
new UseImageGeneratorCommitmentDefinition('IMAGE GENERATION'),
|
|
12227
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12228
|
+
new UseImageGeneratorCommitmentDefinition('USE IMAGE'),
|
|
12073
12229
|
new UseMcpCommitmentDefinition(),
|
|
12074
12230
|
new UseCommitmentDefinition(),
|
|
12075
12231
|
// Not yet implemented commitments (using placeholder)
|