Automate browser based workflows with AI
Python aiapiautomationbrowserbrowser-automationcomputergptllmplaywrightpowerautomatepuppeteerpythonrpaseleniumvisionworkflow
add select agent llm handler (#1713)
Shuchang Zheng430c6b7851e7
diff --git a/skyvern/config.py b/skyvern/config.pyindex 215428b18..f3a5c7593 100644--- a/skyvern/config.py+++ b/skyvern/config.py@@ -94,6 +94,7 @@ class Settings(BaseSettings):# ACTIVE LLM PROVIDERLLM_KEY: str = "OPENAI_GPT4O"SECONDARY_LLM_KEY: str | None = None+ SELECT_AGENT_LLM_KEY: str | None = None# COMMONLLM_CONFIG_TIMEOUT: int = 300LLM_CONFIG_MAX_TOKENS: int = 4096diff --git a/skyvern/forge/app.py b/skyvern/forge/app.pyindex 926e63498..bc6d00cf5 100644--- a/skyvern/forge/app.py+++ b/skyvern/forge/app.py@@ -35,6 +35,11 @@ LLM_API_HANDLER = LLMAPIHandlerFactory.get_llm_api_handler(SettingsManager.get_sSECONDARY_LLM_API_HANDLER = LLMAPIHandlerFactory.get_llm_api_handler(SETTINGS_MANAGER.SECONDARY_LLM_KEY if SETTINGS_MANAGER.SECONDARY_LLM_KEY else SETTINGS_MANAGER.LLM_KEY)+SELECT_AGENT_LLM_API_HANDLER = (+ LLMAPIHandlerFactory.get_llm_api_handler(SETTINGS_MANAGER.SELECT_AGENT_LLM_KEY)+ if SETTINGS_MANAGER.SELECT_AGENT_LLM_KEY+ else SECONDARY_LLM_API_HANDLER+)WORKFLOW_CONTEXT_MANAGER = WorkflowContextManager()WORKFLOW_SERVICE = WorkflowService()AGENT_FUNCTION = AgentFunction()diff --git a/skyvern/webeye/actions/handler.py b/skyvern/webeye/actions/handler.pyindex 21e09de01..dc4f958c4 100644--- a/skyvern/webeye/actions/handler.py+++ b/skyvern/webeye/actions/handler.py@@ -2161,12 +2161,7 @@ async def select_from_dropdown(step_id=step.step_id,task_id=task.task_id,)- if context.is_date_related:- # HACK: according to the test, secondary LLM is not doing well on the date picker- # using the main LLM to handle the case- json_response = await app.LLM_API_HANDLER(prompt=prompt, step=step, prompt_name="custom-select")- else:- json_response = await app.SECONDARY_LLM_API_HANDLER(prompt=prompt, step=step, prompt_name="custom-select")+ json_response = await app.SELECT_AGENT_LLM_API_HANDLER(prompt=prompt, step=step, prompt_name="custom-select")value: str | None = json_response.get("value", None)single_select_result.value = valueselect_reason: str | None = json_response.get("reasoning", None)@@ -2618,7 +2613,7 @@ async def normal_select(options=options_html,)- json_response = await app.LLM_API_HANDLER(prompt=prompt, step=step, prompt_name="custom-select")+ json_response = await app.SELECT_AGENT_LLM_API_HANDLER(prompt=prompt, step=step, prompt_name="custom-select")index: int | None = json_response.get("index")value: str | None = json_response.get("value")