mirror of
https://github.com/Skyvern-AI/skyvern.git
synced 2025-09-02 02:30:07 +00:00
Use trimmed element tree for info extraction (#641)
This commit is contained in:
parent
1dc37b3425
commit
479a918a8e
3 changed files with 19 additions and 8 deletions
10
poetry.lock
generated
10
poetry.lock
generated
|
@ -1,4 +1,4 @@
|
|||
# This file is automatically @generated by Poetry 1.8.1 and should not be changed by hand.
|
||||
# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand.
|
||||
|
||||
[[package]]
|
||||
name = "aioboto3"
|
||||
|
@ -2943,13 +2943,13 @@ files = [
|
|||
|
||||
[[package]]
|
||||
name = "litellm"
|
||||
version = "1.41.15"
|
||||
version = "1.42.0"
|
||||
description = "Library to easily interface with LLM API providers"
|
||||
optional = false
|
||||
python-versions = "!=2.7.*,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,!=3.7.*,>=3.8"
|
||||
files = [
|
||||
{file = "litellm-1.41.15-py3-none-any.whl", hash = "sha256:5fcab2a507f790309b7ba9fce909be2a73d8e3c4e66104a14fcb886534504b73"},
|
||||
{file = "litellm-1.41.15.tar.gz", hash = "sha256:ab4cf68c24738681fa7ca61ea2056ef17d4847820c9ec3e0260cc6c582d5f31f"},
|
||||
{file = "litellm-1.42.0-py3-none-any.whl", hash = "sha256:e0a0a6481298855557c26ae04f8165bc75d6ac2321daf6d4b27c816979ad32a5"},
|
||||
{file = "litellm-1.42.0.tar.gz", hash = "sha256:c239e27e33c549da7f7a8770c7d6393e16d4e1aeb6e09dc50a259948b0cb432c"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
|
@ -7277,4 +7277,4 @@ testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "p
|
|||
[metadata]
|
||||
lock-version = "2.0"
|
||||
python-versions = "^3.11,<3.12"
|
||||
content-hash = "0cef0a2bf7c08681ef57fdac32efb2d296edaafd0f812a58b59e0b9bdb1c69ed"
|
||||
content-hash = "cea4f41bebe0562c19ab988ba4ec09cdf0a4618e2c9af1dd5988bf42e96324e3"
|
||||
|
|
|
@ -19,7 +19,7 @@ python-multipart = "^0.0.6"
|
|||
toml = "^0.10.2"
|
||||
jinja2 = "^3.1.2"
|
||||
uvicorn = {extras = ["standard"], version = "^0.24.0.post1"}
|
||||
litellm = "1.41.15"
|
||||
litellm = "1.42.0"
|
||||
duckduckgo-search = "^3.8.0"
|
||||
selenium = "^4.13.0"
|
||||
bs4 = "^0.0.1"
|
||||
|
|
|
@ -56,7 +56,7 @@ from skyvern.webeye.actions.actions import (
|
|||
)
|
||||
from skyvern.webeye.actions.responses import ActionFailure, ActionResult, ActionSuccess
|
||||
from skyvern.webeye.browser_factory import BrowserState
|
||||
from skyvern.webeye.scraper.scraper import ScrapedPage
|
||||
from skyvern.webeye.scraper.scraper import ElementTreeFormat, ScrapedPage
|
||||
from skyvern.webeye.utils.dom import AbstractSelectDropdown, DomUtil, SkyvernElement
|
||||
|
||||
LOG = structlog.get_logger()
|
||||
|
@ -1056,11 +1056,22 @@ async def extract_information_for_navigation_goal(
|
|||
"""
|
||||
prompt_template = "extract-information"
|
||||
|
||||
# TODO: we only use HTML element for now, introduce a way to switch in the future
|
||||
element_tree_format = ElementTreeFormat.HTML
|
||||
LOG.info(
|
||||
"Building element tree",
|
||||
task_id=task.task_id,
|
||||
workflow_run_id=task.workflow_run_id,
|
||||
format=element_tree_format,
|
||||
)
|
||||
|
||||
element_tree_in_prompt: str = scraped_page.build_element_tree(element_tree_format)
|
||||
|
||||
extract_information_prompt = prompt_engine.load_prompt(
|
||||
prompt_template,
|
||||
navigation_goal=task.navigation_goal,
|
||||
navigation_payload=task.navigation_payload,
|
||||
elements=scraped_page.element_tree,
|
||||
elements=element_tree_in_prompt,
|
||||
data_extraction_goal=task.data_extraction_goal,
|
||||
extracted_information_schema=task.extracted_information_schema,
|
||||
current_url=scraped_page.url,
|
||||
|
|
Loading…
Add table
Reference in a new issue