8000 Force empty body key by hanna-paasivirta · Pull Request #235 · OpenFn/apollo · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Force empty body key #235

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

Merged
merged 6 commits into from
Jun 2, 2025
Merged

Force empty body key #235

merged 6 commits into from
Jun 2, 2025

Conversation

hanna-paasivirta
Copy link
Contributor
@hanna-paasivirta hanna-paasivirta commented Jun 2, 2025

Short Description

Adds a step to override the generated body keys in the workflow generation service to make sure the service does not give job code. Also fixes a simple bug that triggers unnecessary response regenerations when detecting empty YAML keys (see d) below).

Fixes #234

Implementation Details

a) Adds a function override_body_keys to replace the job code body key with "// Add operations here"

b) Adjusts the prompt to tell the LLM that it is not its task to generate job code. It should now refuse and tell the user they can fill it in later and refer to the Workflow Inspector AI Assistant.
I was trying to avoid fiddling with the prompt since we are working on handling job code next. However, I found it necessary to avoid a situation where the LLM claims it filled in the job code but we override it.

c) Adjusts the prompt to avoid the LLM assuming that pipe characters are needed at the beginning of body keys.

d) Fixes unnecessary response regeneration attempts when the LLM decides to give an empty YAML key by changing the key from None or white space " " to an empty string "" for the regeneration attempt.

AI Usage

Please disclose how you've used AI in this work (it's cool, we just want to know!):

  • Code generation (copilot but not intellisense)
  • Learning or fact checking
  • Strategy / design
  • Optimisation / refactoring
  • Translation / spellchecking / doc gen
  • Other
  • I have not used AI

You can read more details in our Responsible AI Policy

@@ -170,6 +174,15 @@ def validate_adaptors(self, yaml_data):
if adaptor not in valid_adaptors:
logger.warning(f"Invalid adaptor found in job '{job_key}': {adaptor}")

def override_body_keys(self, yaml_data):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah so we can edit the yaml! Perfect. This is a great solution.

I am tempted to say we should delete the body key. But let's leave it like this for now and we'll take a closer look at this stuff during the Edit Mode project

@josephjclark
Copy link
Collaborator

@hanna-paasivirta can we have a changeset to go with this please? It doesn't have to be very detailed at this stage: I'd just say something rough like "workflow_chat: prevent job code generation", because that's the general goal of this work

@josephjclark josephjclark merged commit b75b149 into release/next Jun 2, 2025
@josephjclark josephjclark deleted the force-empty-body-key branch June 2, 2025 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0