Skip to content

Commit 3cd6ebd

Browse files
authored
fixed import path (#128)
1 parent de3ed4d commit 3cd6ebd

File tree

5 files changed

+25
-6
lines changed

5 files changed

+25
-6
lines changed

workflows/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "workflow-use"
3-
version = "0.2.3"
3+
version = "0.2.4"
44
authors = [{ name = "Gregor Zunic" }]
55
description = "Create, edit, run deterministic workflows"
66
readme = "README.md"
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
HEALING_AGENT_SYSTEM_PROMPT = open('workflow_use/healing/_agent/agent_prompt.md').read()
1+
import os
2+
from pathlib import Path
3+
4+
# Use __file__ to get absolute path relative to this file's location
5+
_PROMPTS_DIR = Path(__file__).parent / '_agent'
6+
HEALING_AGENT_SYSTEM_PROMPT = (_PROMPTS_DIR / 'agent_prompt.md').read_text()

workflows/workflow_use/healing/service.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import hashlib
22
import json
3+
from pathlib import Path
34
from typing import Any, Dict, List, Sequence, Union
45

56
import aiofiles
@@ -16,6 +17,9 @@
1617
from workflow_use.healing.views import ParsedAgentStep, SimpleDomElement, SimpleResult
1718
from workflow_use.schema.views import SelectorWorkflowSteps, WorkflowDefinitionSchema
1819

20+
# Get the absolute path to the prompts directory
21+
_PROMPTS_DIR = Path(__file__).parent / 'prompts'
22+
1923

2024
class HealingService:
2125
def __init__(
@@ -141,7 +145,9 @@ def _populate_selector_fields(self, workflow_definition: WorkflowDefinitionSchem
141145
async def create_workflow_definition(
142146
self, task: str, history_list: AgentHistoryList, extract_variables: bool = True
143147
) -> WorkflowDefinitionSchema:
144-
async with aiofiles.open('workflow_use/healing/prompts/workflow_creation_prompt.md', mode='r') as f:
148+
# Load prompt using absolute path
149+
prompt_file = _PROMPTS_DIR / 'workflow_creation_prompt.md'
150+
async with aiofiles.open(prompt_file, mode='r') as f:
145151
prompt_content = await f.read()
146152

147153
prompt_content = prompt_content.format(goal=task, actions=BuilderService._get_available_actions_markdown())

workflows/workflow_use/healing/tests/test_exploration_agent.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import asyncio
22
import logging
33
import os
4+
from pathlib import Path
45

56
from browser_use import Agent, Browser
67
from browser_use.llm import ChatBrowserUse
@@ -26,7 +27,9 @@
2627
temperature=0.0,
2728
)
2829

29-
system_prompt = open('workflow_use/healing/_agent/agent_prompt.md').read()
30+
# Use absolute path for prompt file
31+
_PROMPT_FILE = Path(__file__).parent.parent / '_agent' / 'agent_prompt.md'
32+
system_prompt = _PROMPT_FILE.read_text()
3033

3134

3235
async def explore_page():

workflows/workflow_use/healing/validator.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"""
99

1010
import json
11+
from pathlib import Path
1112
from typing import List, Optional
1213

1314
import aiofiles
@@ -17,6 +18,9 @@
1718

1819
from workflow_use.schema.views import WorkflowDefinitionSchema
1920

21+
# Get the absolute path to the prompts directory
22+
_PROMPTS_DIR = Path(__file__).parent / 'prompts'
23+
2024

2125
class WorkflowIssue(BaseModel):
2226
"""Represents an issue found in a workflow."""
@@ -56,8 +60,9 @@ async def validate_workflow(
5660
Returns:
5761
WorkflowValidationResult with identified issues and optional corrections
5862
"""
59-
# Load validation prompt
60-
async with aiofiles.open('workflow_use/healing/prompts/workflow_validation_prompt.md', mode='r') as f:
63+
# Load validation prompt using absolute path
64+
prompt_file = _PROMPTS_DIR / 'workflow_validation_prompt.md'
65+
async with aiofiles.open(prompt_file, mode='r') as f:
6166
prompt_content = await f.read()
6267

6368
# Prepare workflow JSON for review

0 commit comments

Comments
 (0)