MCPcopy Create free account
hub / github.com/ZinYY/TreeLoRA / process_response

Function process_response

inference/chatbot.py:73–82  ·  view source on GitHub ↗
(response, num_rounds)

Source from the content-addressed store, hash-verified

71
72
73def process_response(response, num_rounds):
74 output = str(response[0]["generated_text"])
75 output = output.replace("<|endoftext|></s>", "")
76 all_positions = [m.start() for m in re.finditer("Human: ", output)]
77 place_of_second_q = -1
78 if len(all_positions) > num_rounds:
79 place_of_second_q = all_positions[num_rounds]
80 if place_of_second_q != -1:
81 output = output[0:place_of_second_q]
82 return output
83
84
85def main(args):

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected