Spaces:
Running
Running
File size: 692 Bytes
926675f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
from nodes.LLMNode import LLMNode
from prompts.solver import *
class Solver(LLMNode):
def __init__(self, prefix=DEFAULT_PREFIX, suffix=DEFAULT_SUFFIX, model_name="text-davinci-003", stop=None):
super().__init__("Solver", model_name, stop, input_type=str, output_type=str)
self.prefix = prefix
self.suffix = suffix
def run(self, input, worker_log, log=False):
assert isinstance(input, self.input_type)
prompt = self.prefix + input + "\n" + worker_log + self.suffix + input + '\n'
response = self.call_llm(prompt, self.stop)
completion = response["output"]
if log:
return response
return completion
|