Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add permanent_workflow_id to observer_cruises and observer_thoughts #1396

Merged
merged 3 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"""add workflow_permanent_id to observer_cruises and observer_thoughts

Revision ID: 411dd89f3df9
Revises: c502ecf908c6
Create Date: 2024-12-16 22:20:52.174896+00:00

"""

from typing import Sequence, Union

import sqlalchemy as sa

from alembic import op

# revision identifiers, used by Alembic.
revision: str = "411dd89f3df9"
down_revision: Union[str, None] = "c502ecf908c6"
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.add_column("observer_cruises", sa.Column("workflow_permanent_id", sa.String(), nullable=True))
op.add_column("observer_thoughts", sa.Column("workflow_permanent_id", sa.String(), nullable=True))
# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column("observer_thoughts", "workflow_permanent_id")
op.drop_column("observer_cruises", "workflow_permanent_id")
# ### end Alembic commands ###
7 changes: 7 additions & 0 deletions skyvern/forge/sdk/db/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1793,6 +1793,7 @@ async def create_observer_cruise(
self,
workflow_run_id: str | None = None,
workflow_id: str | None = None,
workflow_permanent_id: str | None = None,
prompt: str | None = None,
url: str | None = None,
organization_id: str | None = None,
Expand All @@ -1801,6 +1802,7 @@ async def create_observer_cruise(
new_observer_cruise = ObserverCruiseModel(
workflow_run_id=workflow_run_id,
workflow_id=workflow_id,
workflow_permanent_id=workflow_permanent_id,
prompt=prompt,
url=url,
organization_id=organization_id,
Expand All @@ -1815,6 +1817,7 @@ async def create_observer_thought(
observer_cruise_id: str,
workflow_run_id: str | None = None,
workflow_id: str | None = None,
workflow_permanent_id: str | None = None,
workflow_run_block_id: str | None = None,
user_input: str | None = None,
observation: str | None = None,
Expand All @@ -1827,6 +1830,7 @@ async def create_observer_thought(
observer_cruise_id=observer_cruise_id,
workflow_run_id=workflow_run_id,
workflow_id=workflow_id,
workflow_permanent_id=workflow_permanent_id,
workflow_run_block_id=workflow_run_block_id,
user_input=user_input,
observation=observation,
Expand All @@ -1845,6 +1849,7 @@ async def update_observer_cruise(
status: ObserverCruiseStatus | None = None,
workflow_run_id: str | None = None,
workflow_id: str | None = None,
workflow_permanent_id: str | None = None,
url: str | None = None,
prompt: str | None = None,
organization_id: str | None = None,
Expand All @@ -1864,6 +1869,8 @@ async def update_observer_cruise(
observer_cruise.workflow_run_id = workflow_run_id
if workflow_id:
observer_cruise.workflow_id = workflow_id
if workflow_permanent_id:
observer_cruise.workflow_permanent_id = workflow_permanent_id
if url:
observer_cruise.url = url
if prompt:
Expand Down
2 changes: 2 additions & 0 deletions skyvern/forge/sdk/db/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,7 @@ class ObserverCruiseModel(Base):
organization_id = Column(String, ForeignKey("organizations.organization_id"), nullable=True)
workflow_run_id = Column(String, ForeignKey("workflow_runs.workflow_run_id"), nullable=True)
workflow_id = Column(String, ForeignKey("workflows.workflow_id"), nullable=True)
workflow_permanent_id = Column(String, nullable=True)
prompt = Column(UnicodeText, nullable=True)
url = Column(String, nullable=True)

Expand All @@ -531,6 +532,7 @@ class ObserverThoughtModel(Base):
workflow_run_id = Column(String, ForeignKey("workflow_runs.workflow_run_id"), nullable=True)
workflow_run_block_id = Column(String, ForeignKey("workflow_run_blocks.workflow_run_block_id"), nullable=True)
workflow_id = Column(String, ForeignKey("workflows.workflow_id"), nullable=True)
workflow_permanent_id = Column(String, nullable=True)
user_input = Column(UnicodeText, nullable=True)
observation = Column(String, nullable=True)
thought = Column(String, nullable=True)
Expand Down
2 changes: 2 additions & 0 deletions skyvern/forge/sdk/schemas/observers.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class ObserverCruise(BaseModel):
organization_id: str | None = None
workflow_run_id: str | None = None
workflow_id: str | None = None
workflow_permanent_id: str | None = None
prompt: str | None = None
url: HttpUrl | None = None

Expand All @@ -39,6 +40,7 @@ class ObserverThought(BaseModel):
workflow_run_id: str | None = None
workflow_run_block_id: str | None = None
workflow_id: str | None = None
workflow_permanent_id: str | None = None
user_input: str | None = None
observation: str | None = None
thought: str | None = None
Expand Down
Loading