Skip to content
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

Prompt Optimization #165

Merged
merged 2 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/helpers/rpc/domActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,15 +231,15 @@ export class DomActions {
public async scrollUp() {
await this.sendCommand("Runtime.evaluate", {
expression:
'window.scrollBy({left: 0, top: -window.innerHeight/2, behavior: "smooth"})',
'window.scrollBy({left: 0, top: -window.innerHeight/1.5, behavior: "smooth"})',
});
await sleep(300);
}

public async scrollDown() {
await this.sendCommand("Runtime.evaluate", {
expression:
'window.scrollBy({left: 0, top: window.innerHeight/2, behavior: "smooth"})',
'window.scrollBy({left: 0, top: window.innerHeight/1.5, behavior: "smooth"})',
});
await sleep(300);
}
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/vision-agent/determineNextAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ You can use the following tools:
${allToolsDescriptions}

You will be given a task to perform, and an image. The image will contain two parts: on the left is a clean screenshot of the current page, and on the right is the same screenshot with interactive elements annotated with corresponding label.
You will also be given previous actions that you have taken. You may retry a failed action up to one time.
You will also be given previous actions that you have taken. If something does not work, try find an alternative solution. For example, instead of searching for a specific item that the user requested, perform a general search and apply filters, or simply browse the results page.
You will also be given additional information of annotations.

This is one example of expected response from you:
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/vision-agent/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const scrollSchema = z.object({
name: z.literal("scroll"),
description: z
.literal(
'Scroll the page to see the other parts. Use "up" or "down" to scroll half the height of the window. Use "top" or "bottom" to quickly scroll to the top or bottom of the page.',
'Scroll the page to see the other parts. Use "up" or "down" to scroll 2/3 of height of the window. Use "top" or "bottom" to quickly scroll to the top or bottom of the page.',
)
.optional(),
args: z.object({
Expand Down
Loading