qc on meta prompter

Former-commit-id: ba2c415e05
discord-bot-framework
Kye 2 years ago
parent 928c15c8c6
commit 2d8ce207ef

@ -121,17 +121,12 @@ class MetaPrompterAgent:
Returns: Returns:
str: The response from the agent str: The response from the agent
""" """
key_phrases = [ key_phrases = [self.success_phrase, self.failed_phrase]
self.success_phrase,
self.failed_phrase
]
for i in range(self.max_meta_iters): for i in range(self.max_meta_iters):
print(f"[Epsisode: {i+1}/{self.max_meta_iters}]") print(f"[Epsisode: {i+1}/{self.max_meta_iters}]")
chain = self.chain( chain = self.chain(memory=None)
memory=None
)
output = chain.predict(human_input=task) output = chain.predict(human_input=task)
@ -143,9 +138,7 @@ class MetaPrompterAgent:
if self.human_input: if self.human_input:
human_input = input() human_input = input()
if any( if any(phrase in human_input.lower() for phrase in key_phrases):
phrase in human_input.lower() for phrase in key_phrases
):
break break
output = chain.predict(human_input.lower) output = chain.predict(human_input.lower)
@ -155,7 +148,9 @@ class MetaPrompterAgent:
return return
meta_chain = self.initialize_meta_chain() meta_chain = self.initialize_meta_chain()
meta_output = meta_chain.predict(chat_history=self.get_chat_history(chain.memory)) meta_output = meta_chain.predict(
chat_history=self.get_chat_history(chain.memory)
)
print(f"Feedback: {meta_output}") print(f"Feedback: {meta_output}")
self.instructions = self.get_new_instructions(meta_output) self.instructions = self.get_new_instructions(meta_output)

Loading…
Cancel
Save