mirror of
https://github.com/aljazceru/dev-gpt.git
synced 2025-12-23 08:34:20 +01:00
26 lines
577 B
Python
26 lines
577 B
Python
from dev_gpt.apis.gpt import ask_gpt
|
|
from dev_gpt.options.generate.parser import boolean_parser
|
|
|
|
def is_question_true(question):
|
|
def fn(text):
|
|
return answer_yes_no_question(text, question)
|
|
return fn
|
|
|
|
def is_question_false(question):
|
|
return lambda context: not is_question_true(question)(context)
|
|
|
|
|
|
def answer_yes_no_question(text, question):
|
|
prompt = question_prompt.format(
|
|
question=question,
|
|
text=text
|
|
)
|
|
return ask_gpt(prompt, boolean_parser)
|
|
|
|
question_prompt = '''\
|
|
{text}
|
|
{question}
|
|
Note: You must answer "yes" or "no".
|
|
'''
|
|
|