generate description for cached action (#3603)
This commit is contained in:
20
skyvern/forge/prompts/skyvern/generate-action-reasoning.j2
Normal file
20
skyvern/forge/prompts/skyvern/generate-action-reasoning.j2
Normal file
@@ -0,0 +1,20 @@
|
||||
Generating a user-facing description for an browser action to help users understand what the action is doing and why.
|
||||
|
||||
Action Information:
|
||||
- Action Type: {{ action_type }}
|
||||
{% if intention %}- Intention: {{ intention }}{% endif %}
|
||||
{% if text %}- Text/Value: {{ text }}{% endif %}
|
||||
{% if select_option %}- Selected Option: {{ select_option }}{% endif %}
|
||||
{% if file_url %}- File URL: {{ file_url }}{% endif %}
|
||||
{% if data_extraction_goal %}- Data Extraction Goal: {{ data_extraction_goal }}{% endif %}
|
||||
{% if data_extraction_schema %}- Data Extraction Schema: {{ data_extraction_schema }}{% endif %}
|
||||
|
||||
MAKE SURE YOU OUTPUT VALID JSON. No text before or after JSON, no trailing commas, no comments (//), no unnecessary quotes, etc.
|
||||
|
||||
Respond with the following JSON format:
|
||||
```
|
||||
{
|
||||
"reasoning": str // A clear, user-friendly explanation (one sentence, 20 words max) of what this action is doing. Use present tense like "Clicking the submit button" or "Entering the email address". Focus on the action and its purpose.
|
||||
}
|
||||
```
|
||||
|
||||
@@ -2673,6 +2673,25 @@ class AgentDB:
|
||||
await session.refresh(new_action)
|
||||
return Action.model_validate(new_action)
|
||||
|
||||
async def update_action_reasoning(
|
||||
self,
|
||||
organization_id: str,
|
||||
action_id: str,
|
||||
reasoning: str,
|
||||
) -> Action:
|
||||
async with self.Session() as session:
|
||||
action = (
|
||||
await session.scalars(
|
||||
select(ActionModel).filter_by(action_id=action_id).filter_by(organization_id=organization_id)
|
||||
)
|
||||
).first()
|
||||
if action:
|
||||
action.reasoning = reasoning
|
||||
await session.commit()
|
||||
await session.refresh(action)
|
||||
return Action.model_validate(action)
|
||||
raise NotFoundError(f"Action {action_id}")
|
||||
|
||||
async def retrieve_action_plan(self, task: Task) -> list[Action]:
|
||||
async with self.Session() as session:
|
||||
subquery = (
|
||||
|
||||
Reference in New Issue
Block a user