-
Notifications
You must be signed in to change notification settings - Fork 945
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add actions db model and caching V0 (#980)
- Loading branch information
1 parent
e7583ac
commit 9048cdf
Showing
19 changed files
with
731 additions
and
90 deletions.
There are no files selected for viewing
81 changes: 81 additions & 0 deletions
81
alembic/versions/2024_10_15_1903-137eee1d3b3e_actions_table.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
"""actions table | ||
Revision ID: 137eee1d3b3e | ||
Revises: 12fb2dede685 | ||
Create Date: 2024-10-15 19:03:29.086340+00:00 | ||
""" | ||
|
||
from typing import Sequence, Union | ||
|
||
import sqlalchemy as sa | ||
|
||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = "137eee1d3b3e" | ||
down_revision: Union[str, None] = "12fb2dede685" | ||
branch_labels: Union[str, Sequence[str], None] = None | ||
depends_on: Union[str, Sequence[str], None] = None | ||
|
||
|
||
def upgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.create_table( | ||
"actions", | ||
sa.Column("action_id", sa.String(), nullable=False), | ||
sa.Column("action_type", sa.String(), nullable=False), | ||
sa.Column("source_action_id", sa.String(), nullable=True), | ||
sa.Column("organization_id", sa.String(), nullable=True), | ||
sa.Column("workflow_run_id", sa.String(), nullable=True), | ||
sa.Column("task_id", sa.String(), nullable=False), | ||
sa.Column("step_id", sa.String(), nullable=False), | ||
sa.Column("step_order", sa.Integer(), nullable=False), | ||
sa.Column("action_order", sa.Integer(), nullable=False), | ||
sa.Column("status", sa.String(), nullable=False), | ||
sa.Column("reasoning", sa.String(), nullable=True), | ||
sa.Column("intention", sa.String(), nullable=True), | ||
sa.Column("response", sa.String(), nullable=True), | ||
sa.Column("element_id", sa.String(), nullable=True), | ||
sa.Column("skyvern_element_hash", sa.String(), nullable=True), | ||
sa.Column("skyvern_element_data", sa.JSON(), nullable=True), | ||
sa.Column("action_json", sa.JSON(), nullable=True), | ||
sa.Column("created_at", sa.DateTime(), nullable=False), | ||
sa.Column("modified_at", sa.DateTime(), nullable=False), | ||
sa.ForeignKeyConstraint( | ||
["organization_id"], | ||
["organizations.organization_id"], | ||
), | ||
sa.ForeignKeyConstraint( | ||
["source_action_id"], | ||
["actions.action_id"], | ||
), | ||
sa.ForeignKeyConstraint( | ||
["step_id"], | ||
["steps.step_id"], | ||
), | ||
sa.ForeignKeyConstraint( | ||
["task_id"], | ||
["tasks.task_id"], | ||
), | ||
sa.ForeignKeyConstraint( | ||
["workflow_run_id"], | ||
["workflow_runs.workflow_run_id"], | ||
), | ||
sa.PrimaryKeyConstraint("action_id"), | ||
) | ||
op.create_index("action_org_task_step_index", "actions", ["organization_id", "task_id", "step_id"], unique=False) | ||
op.create_index(op.f("ix_actions_action_id"), "actions", ["action_id"], unique=False) | ||
op.create_index(op.f("ix_actions_source_action_id"), "actions", ["source_action_id"], unique=False) | ||
op.create_index(op.f("ix_actions_task_id"), "actions", ["task_id"], unique=False) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_index(op.f("ix_actions_task_id"), table_name="actions") | ||
op.drop_index(op.f("ix_actions_source_action_id"), table_name="actions") | ||
op.drop_index(op.f("ix_actions_action_id"), table_name="actions") | ||
op.drop_index("action_org_task_step_index", table_name="actions") | ||
op.drop_table("actions") | ||
# ### end Alembic commands ### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
skyvern/forge/prompts/skyvern/answer-user-detail-questions.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
You will be given information about a user's goal and details. | ||
|
||
Your job is to answer the user's questions based on the information provided. | ||
|
||
The user's questions will be provided in JSON format. | ||
|
||
Your answers should be direct and to the point. No need to explain the answer. | ||
|
||
Your response should be in JSON format. Basically fill in the answer part and return the JSON. | ||
|
||
User's goal: {{ navigation_goal }} | ||
|
||
User's details: {{ navigation_payload }} | ||
|
||
User's questions: {{ queries_and_answers }} | ||
|
||
YOUR RESPONSE HAS TO BE IN JSON FORMAT. DO NOT RETURN ANYTHING ELSE. | ||
THESE ANSWERS WILL BE USED TO FILL OUT INFORMATION ON A WEBPAGE. DO NOT INCLUDE ANY UNRELATED INFORMATION OR UNNECESSARY DETAILS IN YOUR ANSWERS. | ||
|
||
EXAMPLE RESPONSE FORMAT: | ||
{ | ||
"question_1": "answer_1", | ||
"question_2": "answer_2", | ||
"question_3": "answer_3" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import hashlib | ||
|
||
|
||
def calculate_sha256(data: str) -> str: | ||
"""Helper function to calculate SHA256 hash of a string.""" | ||
sha256_hash = hashlib.sha256() | ||
sha256_hash.update(data.encode()) | ||
return sha256_hash.hexdigest() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.