Skip to content

Commit a6e9984

Browse files
authored
Fix CodeGen non stream output issue (opea-project#2058)
Signed-off-by: Wang, Xigui <[email protected]>
1 parent 1f06dca commit a6e9984

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

CodeGen/codegen.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ async def handle_request(self, request: Request):
282282
last_node = runtime_graph.all_leaves()[-1]
283283

284284
try:
285-
response = result_dict[last_node]["choices"][0]["text"]
285+
response = result_dict[last_node]["choices"][0]["message"]["content"]
286286
except (KeyError, IndexError, TypeError):
287287
try:
288288
response = result_dict[last_node]["text"]

CodeGen/tests/test_compose_on_xeon.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,14 @@ function validate_megaservice() {
138138
"codegen-xeon-backend-server" \
139139
'{"messages": "def print_hello_world():", "max_tokens": 256}'
140140

141+
# Curl the Mega Service with stream as false
142+
validate_services \
143+
"${ip_address}:7778/v1/codegen" \
144+
"" \
145+
"mega-codegen" \
146+
"codegen-xeon-backend-server" \
147+
'{ "messages": "def print_hello_world():", "max_tokens": 256, "stream": false}'
148+
141149
# Curl the Mega Service with index_name and agents_flag
142150
validate_services \
143151
"${ip_address}:7778/v1/codegen" \

0 commit comments

Comments
 (0)