Skip to content

Commit

Permalink
Update meta_prompting prompt
Browse files Browse the repository at this point in the history
there appears to be, at least in ChatGPT-3.5 a meta-cognitive 'think step-by-step' approach in every response.

I couldn't get def split_into_steps to output the correct answer with anything but the prompt in its current form.
  • Loading branch information
MeDott29 authored Nov 26, 2023
1 parent 5cd1053 commit 027b29b
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions examples/meta_prompting.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,18 @@ def split_into_steps(question, model_name: str):
@text.prompt
def solve(question):
"""{{question}}
Let's solve this problem by splitting it into steps.
Rephrase : : as a true or false statement, identify an Object, relationship and subject
"""

model = models.openai(model_name)

prompt = solve(question)
answer = model(prompt, 500)
prompt += (
answer
+ "\n what is the only option that displays the same type of relationship as : :?"
)
answer = model(prompt, 500)
completed = prompt + answer

return completed
Expand Down Expand Up @@ -131,18 +136,14 @@ def run_example(model_fn, question, model_name):
parser.add_argument(
"--model",
type=str,
default="gpt-3.5-turbo",
default="gpt-3.5-turbo-1106",
help="The Large Language Model to use to run the examples.",
)
args = parser.parse_args()

math_q = "f(x) = x*x. What is f(f(3))?"
sat_q = """
Directions: In the following question, a related pair of words or phrases \
is followed by five pairs of words or phrases. Choose the pair that best \
expresses a relationship similar to that in the original pair. \
BRAGGART :: MODESTY
A) FLEDGLING : EXPERIENCE
B) EMBEZZLER : GREED
Expand All @@ -156,7 +157,7 @@ def run_example(model_fn, question, model_name):

run_example(split_into_steps, math_q, args.model)
run_example(
split_into_steps, sat_q, args.model
split_into_steps, sat_q.lower(), args.model
) # gpt>3.5 usually gets this one right
run_example(fill_in_the_blanks, sat_q, args.model)
run_example(ask_an_expert, alignment_q, args.model)
Expand Down

0 comments on commit 027b29b

Please sign in to comment.