From 69a255adf91e8c21d95d8a487d878440e8672f51 Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Fri, 11 Oct 2024 13:48:24 +0000 Subject: [PATCH] =?UTF-8?q?docs:=20=F0=9F=92=A1=20Add=20comments=20to=20cl?= =?UTF-8?q?arify=20script=20components=20and=20tools?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../content/docs/reference/scripts/system.mdx | 27 +++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/docs/src/content/docs/reference/scripts/system.mdx b/docs/src/content/docs/reference/scripts/system.mdx index e371caf46c..059ddcacc3 100644 --- a/docs/src/content/docs/reference/scripts/system.mdx +++ b/docs/src/content/docs/reference/scripts/system.mdx @@ -89,6 +89,7 @@ generating annotations. If unspecified, GenAIScript looks for specific keywords `````js wrap title="copilot_chat_participant" script({ system: [ + // List of system components and tools available for the script "system", "system.tools", "system.files", @@ -98,17 +99,18 @@ script({ "system.github_info", "system.safety_harmful_content", ], - tools: ["agent"], - group: "infrastructure", + tools: ["agent"], // Tools that the script can use + group: "infrastructure", // Group categorization for the script parameters: { question: { - type: "string", - description: "the user question", + type: "string", // Type of the parameter + description: "the user question", // Description of the parameter }, }, - flexTokens: 20000, + flexTokens: 20000, // Flexible token limit for the script }) +// Extract the 'question' parameter from the environment variables const { question } = env.vars $`## task @@ -122,7 +124,11 @@ $`## task - do NOT skip any steps ` +// Define a variable QUESTION with the value of 'question' def("QUESTION", question) + +// Define a variable FILE with the file data from the environment variables +// The { ignoreEmpty: true, flex: 1 } options specify to ignore empty files and to use flexible token allocation def("FILE", env.files, { ignoreEmpty: true, flex: 1 }) ````` @@ -1900,22 +1906,29 @@ Modified meta-prompt tool from https://platform.openai.com/docs/guides/prompt-ge - tool `meta_prompt`: Tool that applies OpenAI's meta prompt guidelines to a user prompt. Modified from https://platform.openai.com/docs/guides/prompt-generation?context=text-out. `````js wrap title="system.meta_prompt" +// This module defines a system tool that applies OpenAI's meta prompt guidelines to a user-provided prompt. +// The tool refines a given prompt to create a detailed system prompt designed to guide a language model for task completion. + system({ + // Metadata for the tool title: "Tool that applies OpenAI's meta prompt guidelines to a user prompt", description: "Modified meta-prompt tool from https://platform.openai.com/docs/guides/prompt-generation?context=text-out.", }) +// Define the 'meta_prompt' tool with its properties and functionality defTool( "meta_prompt", "Tool that applies OpenAI's meta prompt guidelines to a user prompt. Modified from https://platform.openai.com/docs/guides/prompt-generation?context=text-out.", { + // Input parameter for the tool prompt: { type: "string", description: "User prompt to be converted to a detailed system prompt using OpenAI's meta prompt guidelines", }, }, + // Asynchronous function that processes the user prompt async ({ prompt: userPrompt }) => { const res = await runPrompt( (_) => { @@ -1964,11 +1977,15 @@ The final prompt you output should adhere to the following structure below. Do n _.def("USER_PROMPT", userPrompt) }, { + // Specify the model to be used model: "large", + // Label for the prompt run label: "meta-prompt", + // System configuration, including safety mechanisms system: ["system.safety_jailbreak"], } ) + // Log the result or any errors for debugging purposes console.log(res.text ?? res.error) return res }