-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
[Bug]: Running improve_prompt
on a prompt with template variables fails
#1171
Comments
hello @osheari1 the user input and pattern are combined an then the template system tries to resolve all double brace pairs. {{ }} potentially we could have --novars or something to disable substitution. |
Hello! I'm wondering if in the long run, a more robust solution would be needed... 🤔 Thinking of two cases:
Pattern # Example Output
// Some example explaining Jekyll syntax
{{ jekyll-var-no-sub-wanted }}
# Output
{{ some-fabric-variable }} Input Stuff {{ fabric-var-no-sub-wanted }} Here, Problem
Questions
For example, say you have a pipeline, For example, $ cat stuff.txt | sed 's/{{var}}/subbed/g' | fabric -p do_stuff Solutions?
|
I'll admit, I did not consider folk would want to process jekyll templates when I made the template system.
|
Yeah I think that will work if it applies specifically to INPUT vars. There are two cases where this issue could pop up:
Is there something that could be done about the first case as well? |
Honestly I think it's just easier to not fail on missing vars. |
I think that would be helpful. For this case, what if we added some debugging information about variable substitution when '--dry-run' (or some '--debug' flag) is passed? If we skip var validation entirely, people may unexpectedly not pass Perhaps something like (pseudo-code) $ echo "<user> | fabric --dry-run/debug --pattern <pat> -v=name-1:val-1 -v=name-2:val-2
...
variable,value
name-1,val-2
name-2,val-2
# name 3 was in prompt/input but not passed
name-3, <missing> |
It would be useful to have --debug, I think that is one 1st class option that is missing. |
Solved with #1189 |
What happened?
With a prompt, such as
improve_security_policy
piping into
improve_prompt
returns$ cat system.md | fabric --pattern improve_prompt missing required variable: reqs
Expected behavior:
Improve prompt would work on patters with variables / plugins / other future stuff that may be added to the templating features.
I'm assuming this is because variables are validated after stdin is substituted into the template.
Version check
Relevant log output
No response
Relevant screenshots (optional)
No response
The text was updated successfully, but these errors were encountered: