-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat: refactor system prompt sections from markdown to XML format #7427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| export function markdownFormattingSection(): string { | ||
| return `==== | ||
| return `<section name="MARKDOWN RULES"> | ||
|
|
||
| MARKDOWN RULES | ||
| ALL responses MUST show ANY \`language construct\` OR filename reference as clickable, exactly as [\`filename OR language.declaration()\`](relative/file/path.ext:line); line is required for \`syntax\` and optional for filename links. This applies to ALL markdown responses and ALSO those in <attempt_completion> | ||
|
|
||
| ALL responses MUST show ANY \`language construct\` OR filename reference as clickable, exactly as [\`filename OR language.declaration()\`](relative/file/path.ext:line); line is required for \`syntax\` and optional for filename links. This applies to ALL markdown responses and ALSO those in <attempt_completion>` | ||
| </section>` | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,12 +4,14 @@ export function getBrowserActionDescription(args: ToolArgs): string | undefined | |
| if (!args.supportsComputerUse) { | ||
| return undefined | ||
| } | ||
| return `## browser_action | ||
| Description: Request to interact with a Puppeteer-controlled browser. Every action, except \`close\`, will be responded to with a screenshot of the browser's current state, along with any new console logs. You may only perform one browser action per message, and wait for the user's response including a screenshot and logs to determine the next action. | ||
| return `<tool name="browser_action"> | ||
| <description>Request to interact with a Puppeteer-controlled browser. Every action, except \`close\`, will be responded to with a screenshot of the browser's current state, along with any new console logs. You may only perform one browser action per message, and wait for the user's response including a screenshot and logs to determine the next action.</description> | ||
| <important> | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar to my comment on attempt-completion.ts - this tool uses both Could we consider either:
|
||
| - The sequence of actions **must always start with** launching the browser at a URL, and **must always end with** closing the browser. If you need to visit a new URL that is not possible to navigate to from the current webpage, you must first close the browser, then launch again at the new URL. | ||
| - While the browser is active, only the \`browser_action\` tool can be used. No other tools should be called during this time. You may proceed to use other tools only after closing the browser. For example if you run into an error and need to fix a file, you must close the browser, then use other tools to make the necessary changes, then re-launch the browser to verify the result. | ||
| - The browser window has a resolution of **${args.browserViewportSize}** pixels. When performing any click actions, ensure the coordinates are within this resolution range. | ||
| - Before clicking on any elements such as icons, links, or buttons, you must consult the provided screenshot of the page to determine the coordinates of the element. The click should be targeted at the **center of the element**, not on its edges. | ||
| </important> | ||
| Parameters: | ||
| - action: (required) The action to perform. The available actions are: | ||
| * launch: Launch a new Puppeteer-controlled browser instance at the specified URL. This **must always be the first action**. | ||
|
|
@@ -55,5 +57,7 @@ Example: Requesting to click on the element at coordinates 450,300 | |
| <browser_action> | ||
| <action>click</action> | ||
| <coordinate>450,300</coordinate> | ||
| </browser_action>` | ||
| </browser_action> | ||
|
|
||
| </tool>` | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this intentional? I notice this tool uses an
<important>tag for critical notes while other tools embed important information directly in the<description>tag. Could we consider standardizing this approach across all tools for consistency?For example, other tools include warnings like "IMPORTANT: You can read a maximum of 5 files..." directly in the description, but here we have a separate
<important>tag.