aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/chatbot/tools/CreateDocumentTool.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/nodes/chatbot/tools/CreateDocumentTool.ts')
-rw-r--r--src/client/views/nodes/chatbot/tools/CreateDocumentTool.ts46
1 files changed, 29 insertions, 17 deletions
diff --git a/src/client/views/nodes/chatbot/tools/CreateDocumentTool.ts b/src/client/views/nodes/chatbot/tools/CreateDocumentTool.ts
index 28c0eb32e..7d6964f44 100644
--- a/src/client/views/nodes/chatbot/tools/CreateDocumentTool.ts
+++ b/src/client/views/nodes/chatbot/tools/CreateDocumentTool.ts
@@ -1,8 +1,11 @@
import { BaseTool } from './BaseTool';
import { Observation } from '../types/types';
-import { ParametersType } from '../types/tool_types';
+import { ParametersType, ToolInfo } from '../types/tool_types';
import { parsedDoc } from '../chatboxcomponents/ChatBox';
+/**
+ * List of supported document types that can be created via text LLM.
+ */
export enum supportedDocumentTypes {
flashcard = 'flashcard',
text = 'text',
@@ -12,6 +15,8 @@ export enum supportedDocumentTypes {
dataviz = 'dataviz',
notetaking = 'notetaking',
audio = 'audio',
+ video = 'video',
+ pdf = 'pdf',
rtf = 'rtf',
message = 'message',
collection = 'collection',
@@ -19,6 +24,8 @@ export enum supportedDocumentTypes {
deck = 'deck',
web = 'web',
comparison = 'comparison',
+ mermaid = 'mermaid',
+ script = 'script',
}
/**
* Tthe CreateDocTool class is responsible for creating
@@ -309,13 +316,13 @@ const createDocToolParams = [
required: true,
},
{
- name: 'background_color',
+ name: 'backgroundColor',
type: 'string',
description: 'The background color of the document as a hex string.',
required: false,
},
{
- name: 'font_color',
+ name: 'fontColor',
type: 'string',
description: 'The font color of the document as a hex string.',
required: false,
@@ -357,14 +364,11 @@ const createListDocToolParams = [
type CreateListDocToolParamsType = typeof createListDocToolParams;
-// Tool class for creating documents
-export class CreateDocTool extends BaseTool<CreateListDocToolParamsType> {
- private _addLinkedDoc: (doc: parsedDoc) => void;
+type CreateDocumentToolParamsType = typeof createDocToolParams;
- constructor(addLinkedDoc: (doc: parsedDoc) => void) {
- super(
- 'createDoc',
- `Creates one or more documents that best fit the user’s request.
+const createDocToolInfo: ToolInfo<CreateDocumentToolParamsType> = {
+ name: 'createAnyDocument',
+ description: `Creates one or more documents that best fit the user’s request.
If the user requests a "dashboard," first call the search tool and then generate a variety of document types individually, with absolutely a minimum of 20 documents
with two stacks of flashcards that are small and it should have a couple nested freeform collections of things, each with different content and color schemes.
For example, create multiple individual documents like "text," "deck," "web", "equation," and "comparison."
@@ -374,19 +378,27 @@ export class CreateDocTool extends BaseTool<CreateListDocToolParamsType> {
Take into account the width and height of each document, spacing them appropriately to prevent collisions.
Use a systematic approach, such as placing each document in a grid cell based on its order, where cell dimensions match the document dimensions plus a fixed margin for spacing.
Do not nest all documents within a single collection unless explicitly requested by the user.
- Instead, create a set of independent documents with diverse document types. Each type should appear separately unless specified otherwise.`,
- createListDocToolParams,
- `Use the "data" parameter for document content and include title, color, and document dimensions.
+ Instead, create a set of independent documents with diverse document types. Each type should appear separately unless specified otherwise.
+ Use the "data" parameter for document content and include title, color, and document dimensions.
Ensure web documents use URLs from the search tool if relevant. Each document in a dashboard should be unique and well-differentiated in type and content,
- without repetition of similar types in any single collection.`,
- `When creating a dashboard, ensure that it consists of a broad range of document types.
+ without repetition of similar types in any single collection.
+ When creating a dashboard, ensure that it consists of a broad range of document types.
Include a variety of documents, such as text, web, deck, comparison, image, simulation, and equation documents,
each with distinct titles and colors, following the user’s preferences.
Do not overuse collections or nest all document types within a single collection; instead, represent document types individually. Use this example for reference:
${finalJsonString} .
Which documents are created should be random with different numbers of each document type and different for each dashboard.
- Must use search tool before creating a dashboard.`
- );
+ Must use search tool before creating a dashboard.`,
+ parameterRules: createDocToolParams,
+ citationRules: 'No citation needed.',
+};
+
+// Tool class for creating documents
+export class CreateDocTool extends BaseTool<CreateListDocToolParamsType> {
+ private _addLinkedDoc: (doc: parsedDoc) => void;
+
+ constructor(addLinkedDoc: (doc: parsedDoc) => void) {
+ super(createDocToolInfo);
this._addLinkedDoc = addLinkedDoc;
}