Add organization_name and workflow_permanent_id to skyvern context, pass workflow_permanet_id when deciding which identifier to use with which llm (#2245)
This commit is contained in:
@@ -211,7 +211,7 @@ async def initialize_task_v2(
|
||||
request_id=None,
|
||||
workflow_request=WorkflowRequestBody(),
|
||||
workflow_permanent_id=new_workflow.workflow_permanent_id,
|
||||
organization_id=organization.organization_id,
|
||||
organization=organization,
|
||||
version=None,
|
||||
max_steps_override=max_steps_override,
|
||||
parent_workflow_run_id=parent_workflow_run_id,
|
||||
@@ -1491,7 +1491,6 @@ async def _summarize_task_v2(
|
||||
)
|
||||
task_v2_summary_resp = await app.LLM_API_HANDLER(
|
||||
prompt=task_v2_summary_prompt,
|
||||
screenshots=screenshots,
|
||||
thought=thought,
|
||||
prompt_name="task_v2_summary",
|
||||
)
|
||||
|
||||
@@ -3,6 +3,7 @@ from fastapi import BackgroundTasks, Request
|
||||
|
||||
from skyvern.forge import app
|
||||
from skyvern.forge.sdk.executor.factory import AsyncExecutorFactory
|
||||
from skyvern.forge.sdk.schemas.organizations import Organization
|
||||
from skyvern.forge.sdk.workflow.exceptions import InvalidTemplateWorkflowPermanentId
|
||||
from skyvern.forge.sdk.workflow.models.workflow import WorkflowRequestBody, WorkflowRun
|
||||
from skyvern.schemas.runs import RunType
|
||||
@@ -12,7 +13,7 @@ LOG = structlog.get_logger(__name__)
|
||||
|
||||
async def run_workflow(
|
||||
workflow_id: str,
|
||||
organization_id: str,
|
||||
organization: Organization,
|
||||
workflow_request: WorkflowRequestBody, # this is the deprecated workflow request body
|
||||
template: bool = False,
|
||||
version: int | None = None,
|
||||
@@ -30,19 +31,19 @@ async def run_workflow(
|
||||
request_id=request_id,
|
||||
workflow_request=workflow_request,
|
||||
workflow_permanent_id=workflow_id,
|
||||
organization_id=organization_id,
|
||||
organization=organization,
|
||||
version=version,
|
||||
max_steps_override=max_steps,
|
||||
is_template_workflow=template,
|
||||
)
|
||||
workflow = await app.WORKFLOW_SERVICE.get_workflow_by_permanent_id(
|
||||
workflow_permanent_id=workflow_id,
|
||||
organization_id=None if template else organization_id,
|
||||
organization_id=None if template else organization.organization_id,
|
||||
version=version,
|
||||
)
|
||||
await app.DATABASE.create_task_run(
|
||||
task_run_type=RunType.workflow_run,
|
||||
organization_id=organization_id,
|
||||
organization_id=organization.organization_id,
|
||||
run_id=workflow_run.workflow_run_id,
|
||||
title=workflow.title,
|
||||
)
|
||||
@@ -51,7 +52,7 @@ async def run_workflow(
|
||||
await AsyncExecutorFactory.get_executor().execute_workflow(
|
||||
request=request,
|
||||
background_tasks=background_tasks,
|
||||
organization_id=organization_id,
|
||||
organization=organization,
|
||||
workflow_id=workflow_run.workflow_id,
|
||||
workflow_run_id=workflow_run.workflow_run_id,
|
||||
max_steps_override=max_steps,
|
||||
|
||||
Reference in New Issue
Block a user