Skip to content

Commit 03ffc5e

Browse files
committed
Output the 'human' part of LLM output
1 parent 6e01708 commit 03ffc5e

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

config.py

+2
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@
22

33
is_debug = False
44

5+
END_LINE = os.linesep
6+
57
PATH_TO_PNG_OUTDIR = f".{os.sep}temp"

core.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def create_command_messages(expert_commands):
1414

1515
def process_response(rsp, prompt_id):
1616
if service_dot_parser.is_dot_response(rsp):
17-
return service_dot_parser.parse(rsp, prompt_id)
17+
return service_dot_parser.parse_dot_and_return_human(rsp, prompt_id)
1818
return rsp
1919

2020
def execute_prompt(user_prompt, previous_messages, command_messages, prompt_id):

service_dot_parser.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,18 @@ def write_dot_to_file(dot_string, prompt_id):
2424
def is_dot_response(rsp):
2525
return DOT_GRAPH_START in rsp
2626

27-
def parse(rsp, prompt_id):
27+
def parse_dot_and_return_human(rsp, prompt_id):
2828
parts = rsp.split(DOT_GRAPH_START)
29+
human_output = parts[0].replace(DOT_SECTION_DELIMITER, "").strip()
2930
dot_string = DOT_GRAPH_START + parts[1]
3031
if DOT_SECTION_DELIMITER in dot_string:
31-
dot_string = dot_string.split(DOT_SECTION_DELIMITER)[0]
32+
parts_after_dot = dot_string.split(DOT_SECTION_DELIMITER)
33+
dot_string = parts_after_dot[0]
34+
human_output += config.END_LINE + config.END_LINE.join(parts_after_dot[1:])
35+
print(f" == BEGIN DOT ==")
36+
print(dot_string)
37+
print(f" == END DOT ==")
3238
write_dot_to_file(dot_string, prompt_id)
3339
generate_png_from_dot(dot_string, prompt_id)
3440

35-
return dot_string
41+
return human_output

0 commit comments

Comments
 (0)