diff --git a/pen-core.el b/pen-core.el index f13214b40..b86b4d89e 100644 --- a/pen-core.el +++ b/pen-core.el @@ -6,5 +6,8 @@ (defun pen-preceding-text () (str (buffer-substring (point) (max 1 (- (point) 1000))))) +(defun pen-surrounding-text () + (str (buffer-substring (point) (max 1 (- (point) 1000))))) + (provide 'pen-core) \ No newline at end of file diff --git a/pen.el b/pen.el index f3cded0ee..b2ab2f2e4 100644 --- a/pen.el +++ b/pen.el @@ -189,7 +189,7 @@ Function names are prefixed with pen-pf- for easy searching" (progn (if ,(> (length (str2lines example)) 1) (tvipe ;; ,(concat v ": ") - ,example) + ,example) (read-string-hist ,(concat v ": ") ,example)))) `(read-string-hist ,(concat v ": ") ,example))) do @@ -227,7 +227,7 @@ Function names are prefixed with pen-pf- for easy searching" (concat ,(if (sor prettifier) '(if prettify - "PRETTY_PRINT=y " + "PRETTY_PRINT=y " "")) ,(flatten-once (list @@ -244,10 +244,11 @@ Function names are prefixed with pen-pf- for easy searching" "")))) (if (interactive-p) (cond - ((and ,(not filter) - (selectedp) - ,completion) + ((and ,filter + (selectedp)) (replace-region (concat (selection) result))) + (,completion + (etv result)) ((or ,(not filter) (>= (prefix-numeric-value current-prefix-arg) 4) (not (selectedp))) diff --git a/snippets/prompt-description-mode/prompt b/snippets/prompt-description-mode/prompt index c19b76c77..9914bc1ff 100644 --- a/snippets/prompt-description-mode/prompt +++ b/snippets/prompt-description-mode/prompt @@ -8,8 +8,6 @@ in-development: yes title: "${1:title}" todo: design-patterns: -issues: -# - "It appears to not have a large effective window" # future-titles: "" # aims: |+ # - More abstractive rewording @@ -31,6 +29,8 @@ prompt: |+ problems: # Put problems directly after the prompt because the prompt is a multiline string. # - "Struggles with the latter columns." +issues: +# - "It appears to not have a large effective window" # # Additional transformation of prompt after the template # prompt-filter: "sed -z 's/\\s\\+$//'" # # Trailing whitespace is always removed @@ -72,6 +72,7 @@ vars: examples: - "boysenberries" - "strawberries" +# This is the test output after the postprocessor has run # test-output: "both are types of berry" # Completion is for generating a company-mode completion function # completion: on @@ -97,17 +98,19 @@ prefer-external: on # This can be used to train the prompt. # The external command must take arguments, not stdin # So that all variables may be passed into it. -external: "generate-text-from-input.sh" +# external: "generate-text-from-input.sh" # This compares the output of the external script to the output of the LM similarity-test: # This script returns a 0-1 decimal value representing the quality of the generated output. # The input is 2 arguments each containing output # The output is a decimal number from 0 to 1 -quality-script: "my-quality-checker-for-this-prompt.sh" +quality-script: +# quality-script: "my-quality-checker-for-this-prompt.sh" +validation-script: # This script can be used to validate the output. # If the output is accurate, the validation script returns exit code 1. # The input is 2 arguments each containing output -validation-script: "my-validator-for-this-prompt.sh" +# validation-script: "my-validator-for-this-prompt.sh" # Enable running conversation conversation-mode: no # This is the name of an external database-driven pretext generator. @@ -133,8 +136,8 @@ n-test-runs: 5 # prompts are not stitched together / composed but examplary functions are # is the existing generation # <1> is a variable -continuation-function: "list-of <1> " +# continuation-function: "list-of <1> " # \s must be escaped here or it breaks yaml # postprocessor: "sed 's/\\s\\+/ /g' | s join ' '" # Optional extra command to run after the postprocessor -prettifier: "tpp" \ No newline at end of file +# prettifier: "tpp" \ No newline at end of file