diff --git a/docs/src/content/docs/reference/scripts/choices.md b/docs/src/content/docs/reference/scripts/choices.md index 4f5f5a1aec..a4f7e1ea46 100644 --- a/docs/src/content/docs/reference/scripts/choices.md +++ b/docs/src/content/docs/reference/scripts/choices.md @@ -2,6 +2,8 @@ title: Choices description: Specify a list of preferred token choices for a script. keywords: choices, preferred words, logit bias +sidebar: + order: 20 --- You can specify a list of preferred words (choices) in the script metadata. It will increase the probability of the model generating the specified words. diff --git a/docs/src/content/docs/reference/vscode/github-copilot-chat.mdx b/docs/src/content/docs/reference/vscode/github-copilot-chat.mdx index 9f66fc4c80..c783f29de9 100644 --- a/docs/src/content/docs/reference/vscode/github-copilot-chat.mdx +++ b/docs/src/content/docs/reference/vscode/github-copilot-chat.mdx @@ -41,6 +41,47 @@ The context selected by the user in Copilot Chat is converted to variables and p - the current editor selection is passed in `env.vars["copilot.selection"]` - all other file references are passed in `env.files` +### Examples + +- `mermaid` will generate a diagram from the user prompt. + +```js title="mermaid.genai.mjs" wrap +def("CODE", env.files) +$`Generate a class diagram using mermaid of the code symbols in the CODE.` +``` + +- `websearcher` will search the web for the user prompt +and use the file in context in the answer. + +```js title="websearcher.genai.mjs" wrap +const res = await retrieval.webSearch(env.vars.question) +def("QUESTION", env.vars.question) +def("WEB_SEARCH", res) +def("FILE", env.files, { ignoreEmpty: true}) +$`Answer QUESTION using WEB_SEARCH and FILE.` +``` + +- `dataanalyst` uses the Python code interpreter tools to + resolve a data computation question. + +```js title="dataanalyst.genai.mjs" wrap +script({ + tools: [ + "fs_read_file", + "python_code_interpreter_copy_files_to_container", + "python_code_interpreter_read_file", + "python_code_interpreter_run", + ], +}) +def("DATA", env.files.map(({ filename }) => filename).join("\n")) +def("QUESTION", env.vars.question) + +$`Run python code to answer the data analyst question +in QUESTION using the data in DATA. +Return the python code that was used to compute the answer. +` +``` + ### History The history of messages is passed in `env.vars["copilot.history"]`. It is an array of `HistoryMessageUser | HistoryMessageAssistant`: @@ -73,5 +114,5 @@ The following script can used as a starter template to create the default script The following features are currently not supported in the chat participant: -- Tools (`#tool`) -- `Workspace` reference +- Tools (`#tool`) +- `Workspace` reference