Skip to content
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
2 changes: 1 addition & 1 deletion services/testing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Two rules of thumb:
the service payload, calls the service via `ApolloClient`, and runs the judge.
For inspection, three artifacts are written to a `tmp/` folder next to the
spec file:
- `<spec_id>.yaml` — any project YAML in the response (`response_yaml`,
- `<spec_id>.yaml` — any workflow YAML in the response (`response_yaml`,
`workflow_yaml`, `content_yaml`, or a `workflow_yaml` attachment).
- `<spec_id>.txt` — the response text, prefixed with the agent path
(e.g. `agents: router -> planner -> job_code_agent`).
Expand Down
6 changes: 3 additions & 3 deletions services/testing/spec_collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def runtest(self):
response, spec.id, self.run_index, spec.runs, tmp_dir, experiment
)
if yaml_path is not None:
print(f" ✓ project YAML saved to {yaml_path}")
print(f" ✓ workflow YAML saved to {yaml_path}")

text_path = _capture_response_text(
response, spec.id, self.run_index, spec.runs, tmp_dir, experiment
Expand Down Expand Up @@ -186,7 +186,7 @@ def _build_payload(spec: Spec) -> dict:


def _extract_yaml_from_response(response: dict) -> str | None:
"""Pull the full project YAML out of a service response, if any.
"""Pull the full workflow YAML out of a service response, if any.

Different services use different keys:
- workflow_chat: `response_yaml`
Expand Down Expand Up @@ -222,7 +222,7 @@ def _capture_response_yaml(
output_dir: Path,
experiment: str = "",
) -> Path | None:
"""Write the response's project YAML to `output_dir/<spec_id>.yaml`.
"""Write the response's workflow YAML to `output_dir/<spec_id>.yaml`.

For multi-run specs, appends `__run-N` to the filename so each run is
preserved. `experiment` (already a `__<label>` suffix or '') is appended
Expand Down
2 changes: 1 addition & 1 deletion services/workflow_chat/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ alternatively, the conversation history, given the error message in `errors`. It
will return an answer whatever information is given, but it is best to give it
the `existing_yaml` and conversation `history`.

See the `fix_yaml_error_system_prompt` in `gen_project_prompts.yaml` to see the
See the `fix_yaml_error_system_prompt` in `prompts.yaml` to see the
exact instructions.

````json
Expand Down
2 changes: 1 addition & 1 deletion services/workflow_chat/config_loader.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import yaml

class ConfigLoader:
def __init__(self, config_path="gen_project_config.yaml", prompts_path="gen_project_prompts.yaml"):
def __init__(self, config_path="config.yaml", prompts_path="prompts.yaml"):
self.config = self.load_yaml(config_path)
self.prompts = self.load_yaml(prompts_path)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
from .config_loader import ConfigLoader

base_dir = os.path.dirname(os.path.abspath(__file__))
config_path = os.path.join(base_dir, "gen_project_config.yaml")
prompts_path = os.path.join(base_dir, "gen_project_prompts.yaml")
config_path = os.path.join(base_dir, "config.yaml")
prompts_path = os.path.join(base_dir, "prompts.yaml")

config_loader = ConfigLoader(config_path=config_path, prompts_path=prompts_path)
config = config_loader.config
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
prompts_version: 1.4.0
prompts_version: 1.4.1
prompts:
main_system_prompt: |
You are an expert assistant for the OpenFn workflow automation platform.
Expand All @@ -11,7 +11,7 @@ prompts:
2. Determine appropriate adaptors for each job
3. Set up proper trigger mechanisms (webhook or cron). Note that ONLY ONE node/job can come from the trigger.
4. Create the connections (edges) between jobs
5. Generate a valid project.yaml file that follows OpenFn's structure
5. Generate a valid workflow YAML that follows OpenFn's structure

When describing your overall purpose to the user, use simple language and explain your task is to help them create an OpenFn workflow. Avoid mentioning YAMLs, as the user does not see the YAML, but a chart drawn based on it.

Expand All @@ -29,11 +29,11 @@ prompts:

yaml_structure_with_ids: |

## OpenFn Project.yaml Structure
## OpenFn Workflow YAML Structure

A valid project.yaml must follow this structure:
A valid workflow YAML must follow this structure:
```
name: open-project
name: my-workflow
jobs:
job-one:
id: '__ID_JOB_job-one__'
Expand Down Expand Up @@ -83,11 +83,11 @@ prompts:
Webhook triggers may include optional sub-keys (e.g. `custom_path`, `webhook_reply`, `webhook_response_config`) — preserve any such sub-keys EXACTLY, including ones not described here. See the webhook sub-key sections below.

yaml_structure_without_ids: |
## OpenFn Project.yaml Structure
## OpenFn Workflow YAML Structure

A valid project.yaml must follow this structure:
A valid workflow YAML must follow this structure:
```
name: open-project
name: my-workflow
jobs:
job-one:
name: First Job
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest
from name_rules import UNICODE_FLAG_ENV, describe_rule_for_prompt
from workflow_chat.gen_project_prompt import build_prompt
from workflow_chat.prompt import build_prompt


def test_build_prompt_normal_mode():
Expand Down Expand Up @@ -58,7 +58,7 @@ def test_build_prompt_subagent_strips_inspector_instruction():

# The go-elsewhere phrasing must not be in context at all, in any of the
# prompt sections it appears in — if this fails, the sentence in
# gen_project_prompts.yaml and the replace() in build_prompt have drifted
# prompts.yaml and the replace() in build_prompt have drifted
assert "navigate to the specific job's code page in the Inspector" not in system_msg
assert "DECLINE" not in system_msg
assert 'If the user asks for job code, set "handover"' in system_msg
Expand Down Expand Up @@ -143,16 +143,16 @@ def test_a_prompt_that_drops_the_name_rule_token_is_rejected_loudly(
The prompt would then state no naming rule at all while the sanitizer
carried on enforcing one, and the model would be left guessing.
"""
from workflow_chat import gen_project_prompt
from workflow_chat import prompt as prompt_module

monkeypatch.setattr(
gen_project_prompt.config_loader,
prompt_module.config_loader,
"get_prompt",
lambda name: "no token here {adaptors}" if name == "general_knowledge" else "x",
)

with pytest.raises(ValueError, match="did not render the step-name rule"):
gen_project_prompt.build_prompt(content="Create a workflow")
prompt_module.build_prompt(content="Create a workflow")

def test_build_prompt_describes_webhook_custom_path():
system_msg, _ = build_prompt(
Expand Down
4 changes: 2 additions & 2 deletions services/workflow_chat/workflow_chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from models import resolve_model

_dir = os.path.dirname(os.path.abspath(__file__))
with open(os.path.join(_dir, "gen_project_config.yaml")) as _f:
with open(os.path.join(_dir, "config.yaml")) as _f:
_service_config = yaml.safe_load(_f)

_MODEL = resolve_model(_service_config.get("model", "claude-sonnet"))
Expand Down Expand Up @@ -72,7 +72,7 @@
)
from util import ApolloError, create_logger, add_page_prefix, APOLLO_VERSION
from yaml_utils import _remove_ids
from .gen_project_prompt import build_prompt
from .prompt import build_prompt
from workflow_chat.available_adaptors import get_available_adaptors
from streaming_util import (
StreamManager,
Expand Down
Loading