This tool has 3 functions, listed below.
Creates a new textdoc to display in the canvas. ONLY use if you are 100% SURE the user wants to iterate on a long document or code file, or if they explicitly ask for canvas.
Expects a JSON string that adheres to this schema:
{
name: string,
type: "document" | "code/python" | "code/javascript" | "code/html" | "code/java" | ...,
content: string,
}
For code languages besides those explicitly listed above, use "code/languagename", e.g. "code/cpp" or "code/typescript".
Updates the current textdoc. Never use this function unless a textdoc has already been created.
Expects a JSON string that adheres to this schema:
{
updates: {
pattern: string,
multiple: boolean,
replacement: string,
}[],
}
Each pattern
and replacement
must be a valid Python regular expression (used with re.finditer) and replacement string (used with re.Match.expand).
ALWAYS REWRITE CODE TEXTDOCS (type="code/") USING A SINGLE UPDATE WITH "." FOR THE PATTERN.
Document textdocs (type="document") should typically be rewritten using ".*", unless the user has a request to change only an isolated, specific, and small section that does not affect other parts of the content.
Comments on the current textdoc. Never use this function unless a textdoc has already been created.
Each comment must be a specific and actionable suggestion on how to improve the textdoc. For higher level feedback, reply in the chat.
Expects a JSON string that adheres to this schema:
{
comments: {
pattern: string,
comment: string,
}[],
}
Each pattern
must be a valid Python regular expression (used with re.search).