Skip to content

Commit

Permalink
Thu 15 Apr 2021 09:21:12
Browse files Browse the repository at this point in the history
  • Loading branch information
mullikine committed Apr 14, 2021
1 parent 97b697f commit fe8d624
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
3 changes: 3 additions & 0 deletions pen-core.el
Original file line number Diff line number Diff line change
Expand Up @@ -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)
11 changes: 6 additions & 5 deletions pen.el
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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)))
Expand Down
17 changes: 10 additions & 7 deletions snippets/prompt-description-mode/prompt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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.
Expand All @@ -133,8 +136,8 @@ n-test-runs: 5
# prompts are not stitched together / composed but examplary functions are
# <g> is the existing generation
# <1> is a variable
continuation-function: "list-of <1> <g>"
# continuation-function: "list-of <1> <g>"
# \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"
# prettifier: "tpp"

0 comments on commit fe8d624

Please sign in to comment.