@@ -69,7 +69,7 @@ def mock_sample(*args, **kwargs):
69
69
n = 0 # reset
70
70
chunks = list (llama .create_completion (text , max_tokens = 20 , stream = True ))
71
71
assert "" .join (chunk ["choices" ][0 ]["text" ] for chunk in chunks ) == output_text
72
- # assert chunks[-1]["choices"][0]["finish_reason"] == "stop"
72
+ assert chunks [- 1 ]["choices" ][0 ]["finish_reason" ] == "stop"
73
73
74
74
## Test basic completion until stop sequence
75
75
n = 0 # reset
@@ -83,19 +83,19 @@ def mock_sample(*args, **kwargs):
83
83
assert (
84
84
"" .join (chunk ["choices" ][0 ]["text" ] for chunk in chunks ) == " jumps over the "
85
85
)
86
- # assert chunks[-1]["choices"][0]["finish_reason"] == "stop"
86
+ assert chunks [- 1 ]["choices" ][0 ]["finish_reason" ] == "stop"
87
87
88
88
## Test basic completion until length
89
89
n = 0 # reset
90
90
completion = llama .create_completion (text , max_tokens = 2 )
91
91
assert completion ["choices" ][0 ]["text" ] == " jumps"
92
- # assert completion["choices"][0]["finish_reason"] == "length"
92
+ assert completion ["choices" ][0 ]["finish_reason" ] == "length"
93
93
94
94
## Test streaming completion until length
95
95
n = 0 # reset
96
96
chunks = list (llama .create_completion (text , max_tokens = 2 , stream = True ))
97
97
assert "" .join (chunk ["choices" ][0 ]["text" ] for chunk in chunks ) == " jumps"
98
- # assert chunks[-1]["choices"][0]["finish_reason"] == "length"
98
+ assert chunks [- 1 ]["choices" ][0 ]["finish_reason" ] == "length"
99
99
100
100
101
101
def test_llama_pickle ():
0 commit comments