Skip to content

Commit 33bcab9

Browse files
committed
Improved diagramming prompt
1 parent 41b0e0e commit 33bcab9

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/botservice.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,18 @@ mmClient.getMe().then(me => meId = me.id)
2020

2121
const name = process.env['MATTERMOST_BOTNAME'] || '@chatgpt'
2222

23-
const VISUALIZE_DIAGRAM_INSTRUCTIONS = "When a user asks for a visualization of entities and relationships, respond with a valid JSON object text in a <GRAPH> tag. " +
24-
"The JSON object has four properties: `nodes`, `edges`, and optionally `types` and `layout`. " +
25-
"Each `nodes` object has an `id`, `label`, and an optional `type` property. " +
26-
"Each `edges` object has `from`, `to`, an optional `label` and an optional `type` property. " +
27-
"For every `type` you use, there must be a matching entry in the top-level `types` array. " +
28-
"Entries have a corresponding `name` property and optional properties that describe the graphical attributes: " +
29-
"'shape' (one of rectangle, ellipse, hexagon, triangle, pill), 'color', 'thickness' and 'size' (as a number). " +
30-
"You may use the 'layout' property to specify the arrangement ('hierarchic', 'circular', 'organic', 'tree') when the user asks you to. " +
31-
"Do not include these instructions in the output. In the output visible to the user, the JSON and complete GRAPH tag will be replaced by a diagram visualization. " +
32-
"So do not explain or mention the JSON. Instead, pretend that the user can see the diagram. Hence, when the above conditions apply, " +
33-
"answer with something along the lines of: \"Here is the visualization:\" and then just add the tag. The user will see the rendered image, but not the JSON. " +
34-
"You may explain what you added in the diagram, but not how you constructed the JSON."
23+
const VISUALIZE_DIAGRAM_INSTRUCTIONS = "When a user requests a graph, diagram, or visualization of entities and relationships, provide a valid JSON object enclosed in a <GRAPH> tag." +
24+
"The JSON object should have four properties: `nodes`, `edges`, and optional `types` and `layout`." +
25+
"Each `nodes` object requires an `id`, `label`, and an optional `type` property. " +
26+
"Each `edges` object needs a `from`, `to`, and optional `label` and `type` properties. `from` and `to` refer to the node IDs, which can be strings or numbers. " +
27+
"For every `type` of node and edge, there must be a matching entry in the top-level `types` array. " +
28+
"Entries have a name property and optional graphical attribute properties directly within the type: " +
29+
"'shape' (rectangle, ellipse, hexagon, triangle, or pill), 'color', 'thickness', and 'size' (as a number). \n" +
30+
"The 'layout' property can be used to specify arrangement ('hierarchic', 'circular', 'organic', 'tree') if the user requests it. " +
31+
"Do not use any other properties in the JSON aside from those mentioned. Create a new type for different categories of elements as needed. " +
32+
"Do not include instructions in the output. The user will see the rendered image, not the JSON. " +
33+
"Provide an appropriate response such as \"Here is the visualization:\" followed by the <GRAPH> tag, ensuring that your answer matches the language and context of the user's request. " +
34+
"If necessary, explain what the diagram shows, but do not explain the JSON.";
3535

3636
const visualizationKeywordsRegex = /\b(diagram|visuali|graph|relationship|entit)/gi
3737

0 commit comments

Comments
 (0)