From 880dabd110e9fad804bd6411188871bbeea11375 Mon Sep 17 00:00:00 2001 From: Stanislas Polu Date: Thu, 19 Dec 2024 12:23:35 +0100 Subject: [PATCH] Visualization use-case directives (#9480) * Testing Viz prompt edit * Update * testing balise * Viz instructions * Simplify * Different approach * iterating * iterating * iterating * Custom Viz instructions for Claude * Custom Viz instructions for Claude * More general iteration * iteration --------- Co-authored-by: Edouard Wautier <4435185+Duncid@users.noreply.github.com> --- front/lib/api/assistant/generation.ts | 1 + front/lib/api/assistant/visualization.ts | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/front/lib/api/assistant/generation.ts b/front/lib/api/assistant/generation.ts index 799121f5d51c..5347ecc1d259 100644 --- a/front/lib/api/assistant/generation.ts +++ b/front/lib/api/assistant/generation.ts @@ -83,6 +83,7 @@ export async function constructPromptMultiActions( // INSTRUCTIONS section let instructions = "INSTRUCTIONS:\n"; + if (agentConfiguration.instructions) { instructions += `${agentConfiguration.instructions}\n`; } else if (fallbackPrompt) { diff --git a/front/lib/api/assistant/visualization.ts b/front/lib/api/assistant/visualization.ts index 43426f962839..6e36c49275ed 100644 --- a/front/lib/api/assistant/visualization.ts +++ b/front/lib/api/assistant/visualization.ts @@ -86,7 +86,7 @@ export async function getVisualizationPrompt({ export const visualizationSystemPrompt = (jitActionsEnabled: boolean) => `\ It is possible to generate visualizations for the user (using React components executed in a react-runner environment) that will be rendered in the user's browser by using the :::visualization container block markdown directive. -Guidelines using the :::visualization tag: +Guidelines using the :::visualization directive: - The generated component should always be exported as default - There is no internet access in the visualization environment - Supported React features: @@ -126,7 +126,9 @@ Guidelines using the :::visualization tag: - Images from the web cannot be rendered or used in the visualization (no internet access). - When parsing dates, the date format should be accounted for based on the format seen in the \`\` tag. - If needed, the application must contain buttons or other navigation elements to allow the user to scroll/cycle through the content. - +- When to use the :::visualization directive: + - The visualization directive is particularly adapted to use-cases involving data visualizations such as graphs, charts, and plots. + - The visualization directive should not be used for anything that can be achieved with regular markdown. Example using the \`useFile\` hook: