),f"{response.choices[0].logprobs.tokens[0]} is not a string"
ifnot(is_firstandecho):
ifnot(is_firstandecho):
assertisinstance(
assertisinstance(
response.choices[0].logprobs.top_logprobs[0],dict
response.choices[0].logprobs.top_logprobs[0],dict
)
),f"top_logprobs was not a dictionary"
ret_num_top_logprobs=len(
ret_num_top_logprobs=len(
response.choices[0].logprobs.top_logprobs[0]
response.choices[0].logprobs.top_logprobs[0]
)
)
# FIXME: Sometimes, some top_logprobs are missing in the return value. The reason is that some output id maps to the same output token and duplicate in the map
# FIXME: Sometimes, some top_logprobs are missing in the return value. The reason is that some output id maps to the same output token and duplicate in the map
# assert ret_num_top_logprobs == logprobs, f"{ret_num_top_logprobs} vs {logprobs}"
# assert ret_num_top_logprobs == logprobs, f"{ret_num_top_logprobs} vs {logprobs}"
assertret_num_top_logprobs>0
assertret_num_top_logprobs>0,f"ret_num_top_logprobs was 0"
ifis_first:
ifis_first:
ifecho:
ifecho:
...
@@ -165,8 +170,8 @@ class TestOpenAIServer(CustomTestCase):
...
@@ -165,8 +170,8 @@ class TestOpenAIServer(CustomTestCase):
prompt
prompt
),f"{response.choices[0].text} and all args {echo}{logprobs}{token_input}{is_first}"
),f"{response.choices[0].text} and all args {echo}{logprobs}{token_input}{is_first}"