Skip to content
Draft
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
8 changes: 8 additions & 0 deletions examples/thinker/critique_answer.llm
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Create a Gendo subroutine called critique_answer that accepts one string
parameter named candidate and returns a critique string. Inside use prompt with
model gpt-4 and temperature 0.0 asking the LLM to act as a strict logician who
inspects the supplied candidate for logical, factual or reasoning errors. If
the candidate is flawless the LLM must reply exactly with No issues found.
Otherwise it must list the problems it detects in plain text sentences. The
subroutine simply outputs whatever the LLM returns so later stages can decide
whether refinement is required.
9 changes: 9 additions & 0 deletions examples/thinker/generate_candidates.llm
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Create a Gendo subroutine named generate_candidates that takes a single string
parameter called question and returns an array of three candidate answers.
Inside the subroutine call prompt with model gpt-4, temperature 0.7 and n set
to 3. The prompt must instruct the LLM to think step by step, label its
reasoning with the exact tag THOUGHT and its conclusion with the exact tag
ANSWER, and to follow that format without any extra text. Each of the three
completions should be collected into a list so the caller receives
candidates[0], candidates[1] and candidates[2] as separate strings in
THOUGHT / ANSWER format.
9 changes: 9 additions & 0 deletions examples/thinker/judge_best.llm
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Create a Gendo subroutine named judge_best that receives an array called
candidates containing three candidate strings and returns the best candidate’s
ANSWER text. Call prompt with model gpt-4 and temperature 0.0, giving the LLM
the three numbered candidates and asking it to choose which is most correct and
logically sound. Instruct it to respond in two lines where the first begins
with BEST_ANSWER: followed by the full THOUGHT / ANSWER content of the chosen
candidate and the second begins with REASON: followed by a brief justification.
After the prompt call extract only the text after BEST_ANSWER: and return that
as the final answer.
9 changes: 9 additions & 0 deletions examples/thinker/reasoning_loop.llm
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Create a top-level Gendo routine called reasoning_loop that accepts the user’s
question string and produces a final answer string. The routine must call
generate_candidates to obtain an array of candidates, map critique_answer
across that array to gather critiques, iterate through the indexes 0 to 2 and
for each position either keep the original candidate if its critique is No
issues found. or call refine_answer to replace it with a corrected version,
collect the resulting candidates into a new array and pass that array to
judge_best, then output the string returned by judge_best. The routine ends by
printing the final answer so users see only the selected, vetted ANSWER.
9 changes: 9 additions & 0 deletions examples/thinker/refine_answer.llm
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Create a Gendo subroutine called refine_answer that takes two string
parameters, candidate and critique, and returns a revised candidate. If the
critique text equals No issues found. the subroutine should bypass any LLM call
and return the original candidate unchanged. Otherwise call prompt with model
gpt-4, temperature 0.5 and include both the original candidate and the critique
in the prompt. Instruct the LLM to rewrite the answer fixing every listed issue
while preserving as much correct reasoning as possible, and to output the
result in the exact THOUGHT / ANSWER template. The revised text becomes the
return value.