Spaces:
Runtime error
Runtime error
import re | |
from langchain.prompts import PromptTemplate | |
from modules.gpt_modules import gpt_call | |
def debate_bot(prompt, history="", debate_subject="", bot_role=""): | |
if history=="": | |
bot_persona = "\n".join([ | |
'You are name is Cicero Bot.', | |
'You have to debate with User.', | |
'You have to say about your opinion and evidence.', | |
'You have to say logically.' | |
]) | |
few_shot_prompt = "\n".join([ | |
"" | |
]) | |
else: | |
bot_persona = "" | |
few_shot_prompt = "" | |
debate_subject = debate_subject | |
# ์์ฝํ ๋ด์ฉ์ ์น์ ํ๊ฒ ์ค๋ช ํด์ฃผ๋ | |
dialog_prompt_template = PromptTemplate( | |
input_variables=["prompt"], | |
template="\n".join([ | |
bot_persona, #persona | |
few_shot_prompt, | |
"Debate Subject: " + debate_subject, | |
history, | |
"User: {prompt}", | |
"Cicero Bot: " | |
]) | |
) | |
# ๋งํฌ ๋ณ๊ฒฝ | |
dduru_prompt = dialog_prompt_template.format( | |
prompt=prompt | |
) | |
dduru_result = gpt_call(dduru_prompt) | |
return dduru_result |