Cleanup ENABLE_TASKV2_METADATA_CURRENT_URL_VALIDATION experiment (#3836)

This commit is contained in:
Stanislav Novosad
2025-10-28 17:21:01 -06:00
committed by GitHub
parent 1f90055672
commit 47899085cf
3 changed files with 21 additions and 61 deletions

View File

@@ -1,12 +1,12 @@
You're to assist the user to achieve the user goal in the browser. Given the user input, what is the url to type into the browser? Also come up with a proper title for this goal to achieve.
You're to assist the user to achieve the user goal in the browser. Given the user input and the current url of the browser, what is the url to type into the browser? Also come up with a proper title for this goal to achieve.
MAKE SURE YOU OUTPUT VALID JSON. No text before or after JSON, no trailing commas, no comments (//), no unnecessary quotes, etc.
Reply in JSON format with the following keys:
{
"thoughts": str, // Think step by step. Has the user specify a url to go? If yes, what is the complete url user specified? If not, to achieve what the user wants to do, what is most likely website url for achieving the goal?
"url": str, // The initial url to type into the browser. If the user specified one, use exactly that url.
"title": str, // A descriptive and informative title for the goal. Use no more than 5 words
"thoughts": str, // Think step by step. What is the current browser url? Does it already achieve the user goal? Has the user specify a url to go? If yes, what is the complete url user specified? If not, to achieve what the user wants to do, what is most likely website url for achieving the goal?
"url": str, // The initial url to type into the browser. If the user specified one, use exactly that url. If the "current browser url" achieves the user goal, use exactly the "current browser url".
"title": str // A descriptive and informative title for the goal. Use no more than 5 words
}
User goal:
@@ -18,3 +18,10 @@ Starting url provided by user:
```
{{ user_url }}
```{% endif %}
{% if current_browser_url %}
Current browser url:
```
{{ current_browser_url }}
```
{% endif %}

View File

@@ -1,27 +0,0 @@
You're to assist the user to achieve the user goal in the browser. Given the user input and the current url of the browser, what is the url to type into the browser? Also come up with a proper title for this goal to achieve.
MAKE SURE YOU OUTPUT VALID JSON. No text before or after JSON, no trailing commas, no comments (//), no unnecessary quotes, etc.
Reply in JSON format with the following keys:
{
"thoughts": str, // Think step by step. What is the current browser url? Does it already achieve the user goal? Has the user specify a url to go? If yes, what is the complete url user specified? If not, to achieve what the user wants to do, what is most likely website url for achieving the goal?
"url": str, // The initial url to type into the browser. If the user specified one, use exactly that url. If the "current browser url" achieves the user goal, use exactly the "current browser url".
"title": str // A descriptive and informative title for the goal. Use no more than 5 words
}
User goal:
```
{{ user_goal }}
```{% if user_url %}
Starting url provided by user:
```
{{ user_url }}
```{% endif %}
{% if current_browser_url %}
Current browser url:
```
{{ current_browser_url }}
```
{% endif %}

View File

@@ -263,7 +263,6 @@ async def initialize_task_v2_metadata(
user_prompt: str | None,
current_browser_url: str | None,
user_url: str | None,
current_run_id: str,
) -> TaskV2:
thought = await app.DATABASE.create_thought(
task_v2_id=task_v2.observer_cruise_id,
@@ -272,35 +271,17 @@ async def initialize_task_v2_metadata(
thought_scenario=ThoughtScenario.generate_metadata,
)
enable_current_url_validation = await app.EXPERIMENTATION_PROVIDER.is_feature_enabled_cached(
"ENABLE_TASKV2_METADATA_CURRENT_URL_VALIDATION",
current_run_id,
properties={"organization_id": task_v2.organization_id},
metadata_prompt = prompt_engine.load_prompt(
"task_v2_generate_metadata",
user_goal=user_prompt,
current_browser_url=current_browser_url or "about:blank",
user_url=user_url,
)
metadata_response = await app.LLM_API_HANDLER(
prompt=metadata_prompt,
thought=thought,
prompt_name="task_v2_generate_metadata",
)
if enable_current_url_validation:
metadata_prompt = prompt_engine.load_prompt(
"task_v2_generate_metadata_with_current_url",
user_goal=user_prompt,
current_browser_url=current_browser_url or "about:blank",
user_url=user_url,
)
metadata_response = await app.LLM_API_HANDLER(
prompt=metadata_prompt,
thought=thought,
prompt_name="task_v2_generate_metadata_with_current_url",
)
else:
metadata_prompt = prompt_engine.load_prompt(
"task_v2_generate_metadata",
user_goal=user_prompt,
user_url=user_url,
)
metadata_response = await app.LLM_API_HANDLER(
prompt=metadata_prompt,
thought=thought,
prompt_name="task_v2_generate_metadata",
)
# validate
LOG.info(f"Initialized task v2 initial response: {metadata_response}")
@@ -587,7 +568,6 @@ async def run_task_v2_helper(
user_prompt=task_v2.prompt,
current_browser_url=current_url,
user_url=task_v2.url,
current_run_id=current_run_id,
)
url = str(task_v2.url)