mirror of
https://github.com/Skyvern-AI/skyvern.git
synced 2025-09-02 10:41:04 +00:00
optimize auto completion trigger (#1359)
This commit is contained in:
parent
20f30d1224
commit
4a422766d7
4 changed files with 12 additions and 4 deletions
|
@ -15,6 +15,7 @@ DOWNLOAD_FILE_PREFIX = "downloads"
|
||||||
SAVE_DOWNLOADED_FILES_TIMEOUT = 180
|
SAVE_DOWNLOADED_FILES_TIMEOUT = 180
|
||||||
GET_DOWNLOADED_FILES_TIMEOUT = 30
|
GET_DOWNLOADED_FILES_TIMEOUT = 30
|
||||||
NAVIGATION_MAX_RETRY_TIME = 5
|
NAVIGATION_MAX_RETRY_TIME = 5
|
||||||
|
AUTO_COMPLETION_POTENTIAL_VALUES_COUNT = 5
|
||||||
|
|
||||||
# reserved fields for navigation payload
|
# reserved fields for navigation payload
|
||||||
SPECIAL_FIELD_VERIFICATION_CODE = "verification_code"
|
SPECIAL_FIELD_VERIFICATION_CODE = "verification_code"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
You're doing an auto completion input action on HTML page. The current filled value doesn't match any option.
|
You're doing an auto completion input action on HTML page. The current filled value doesn't match any option.
|
||||||
Based on the context, current value, user goal and user details, give ten most potential values with the same meaning as the current value.
|
Based on the context, current value, user goal and user details, give {{ potential_value_count }} most potential values with the same meaning as the current value.
|
||||||
You can provide values like:
|
You can provide values like:
|
||||||
- Subset or superset meaning from the current value
|
- Subset or superset meaning from the current value
|
||||||
- Summarized from the current value
|
- Summarized from the current value
|
||||||
|
|
|
@ -8,7 +8,7 @@ Reply in the following JSON format:
|
||||||
"field": str, // Which field is this action intended to fill out?
|
"field": str, // Which field is this action intended to fill out?
|
||||||
"is_required": bool, // True if this is a required field, otherwise false.
|
"is_required": bool, // True if this is a required field, otherwise false.
|
||||||
"is_search_bar": bool, // True if the element to take the action is a search bar, otherwise false.
|
"is_search_bar": bool, // True if the element to take the action is a search bar, otherwise false.
|
||||||
"is_location_input": bool, // True if the element is asking user to input where he lives, otherwise false. For example, it is asking for location, or address, or other similar information. Output False if it only requires ZIP code.
|
"is_location_input": bool, // True if the element is asking user to input where he lives, otherwise false. For example, it is asking for location, or address, or other similar information. Output False if it only requires ZIP code or postal code.
|
||||||
}
|
}
|
||||||
|
|
||||||
Existing reasoning context:
|
Existing reasoning context:
|
||||||
|
|
|
@ -14,7 +14,12 @@ from playwright.async_api import FileChooser, Frame, Locator, Page, TimeoutError
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
from skyvern.config import settings
|
from skyvern.config import settings
|
||||||
from skyvern.constants import BROWSER_DOWNLOAD_TIMEOUT, REPO_ROOT_DIR, SKYVERN_ID_ATTR
|
from skyvern.constants import (
|
||||||
|
AUTO_COMPLETION_POTENTIAL_VALUES_COUNT,
|
||||||
|
BROWSER_DOWNLOAD_TIMEOUT,
|
||||||
|
REPO_ROOT_DIR,
|
||||||
|
SKYVERN_ID_ATTR,
|
||||||
|
)
|
||||||
from skyvern.exceptions import (
|
from skyvern.exceptions import (
|
||||||
EmptySelect,
|
EmptySelect,
|
||||||
ErrEmptyTweakValue,
|
ErrEmptyTweakValue,
|
||||||
|
@ -1597,6 +1602,7 @@ async def input_or_auto_complete_input(
|
||||||
|
|
||||||
prompt = prompt_engine.load_prompt(
|
prompt = prompt_engine.load_prompt(
|
||||||
"auto-completion-potential-answers",
|
"auto-completion-potential-answers",
|
||||||
|
potential_value_count=AUTO_COMPLETION_POTENTIAL_VALUES_COUNT,
|
||||||
field_information=input_or_select_context.field,
|
field_information=input_or_select_context.field,
|
||||||
current_value=current_value,
|
current_value=current_value,
|
||||||
navigation_goal=task.navigation_goal,
|
navigation_goal=task.navigation_goal,
|
||||||
|
@ -1604,10 +1610,11 @@ async def input_or_auto_complete_input(
|
||||||
)
|
)
|
||||||
|
|
||||||
LOG.info(
|
LOG.info(
|
||||||
"Ask LLM to give 10 potential values based on the current value",
|
"Ask LLM to give potential values based on the current value",
|
||||||
current_value=current_value,
|
current_value=current_value,
|
||||||
step_id=step.step_id,
|
step_id=step.step_id,
|
||||||
task_id=task.task_id,
|
task_id=task.task_id,
|
||||||
|
potential_value_count=AUTO_COMPLETION_POTENTIAL_VALUES_COUNT,
|
||||||
)
|
)
|
||||||
json_respone = await app.SECONDARY_LLM_API_HANDLER(prompt=prompt, step=step)
|
json_respone = await app.SECONDARY_LLM_API_HANDLER(prompt=prompt, step=step)
|
||||||
values: list[dict] = json_respone.get("potential_values", [])
|
values: list[dict] = json_respone.get("potential_values", [])
|
||||||
|
|
Loading…
Add table
Reference in a new issue