Skip to content

Commit 95abd07

Browse files
fix
1 parent 84a2622 commit 95abd07

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/test/http_openai_handler_test.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,6 +1018,7 @@ TEST_F(HttpOpenAIHandlerParsingTest, serializeUnaryResponseEncodedResultsReturns
10181018

10191019
ov::genai::EncodedResults results;
10201020
results.tokens = {createHermes3ToolCallTokens(*tokenizer)};
1021+
results.finish_reasons = {ov::genai::GenerationFinishReason::STOP};
10211022
std::string serialized = apiHandler->serializeUnaryResponse(results);
10221023

10231024
ASSERT_NE(serialized.find("\"finish_reason\":\"tool_calls\""), std::string::npos) << serialized;
@@ -1049,6 +1050,7 @@ TEST_F(HttpOpenAIHandlerParsingTest, serializeUnaryResponseVLMSupportsToolCallsF
10491050
ov::genai::VLMDecodedResults results;
10501051
std::string toolCall = R"(<tool_call>{"name": "example_tool", "arguments": {"arg1": "value1", "arg2": 42}}</tool_call>)";
10511052
results.texts = {toolCall};
1053+
results.finish_reasons = {ov::genai::GenerationFinishReason::STOP};
10521054
std::string serialized = apiHandler->serializeUnaryResponse(results, toolCall);
10531055

10541056
ASSERT_NE(serialized.find("\"finish_reason\":\"tool_calls\""), std::string::npos) << serialized;
@@ -1076,6 +1078,7 @@ TEST_F(HttpOpenAIHandlerParsingTest, serializeUnaryResponseForResponsesContainsO
10761078
ASSERT_EQ(outputIds.get_element_type(), ov::element::i64);
10771079
int64_t* outputIdsData = reinterpret_cast<int64_t*>(outputIds.data());
10781080
results.tokens = {std::vector<int64_t>(outputIdsData, outputIdsData + outputIds.get_shape()[1])};
1081+
results.finish_reasons = {ov::genai::GenerationFinishReason::STOP};
10791082

10801083
std::string serialized = apiHandler->serializeUnaryResponse(results);
10811084
ASSERT_NE(serialized.find("\"object\":\"response\""), std::string::npos) << serialized;
@@ -1107,6 +1110,7 @@ TEST_F(HttpOpenAIHandlerParsingTest, serializeUnaryResponseForResponsesContainsR
11071110
ASSERT_EQ(outputIds.get_element_type(), ov::element::i64);
11081111
int64_t* outputIdsData = reinterpret_cast<int64_t*>(outputIds.data());
11091112
results.tokens = {std::vector<int64_t>(outputIdsData, outputIdsData + outputIds.get_shape()[1])};
1113+
results.finish_reasons = {ov::genai::GenerationFinishReason::STOP};
11101114

11111115
std::string serialized = apiHandler->serializeUnaryResponse(results);
11121116
ASSERT_NE(serialized.find("\"object\":\"response\""), std::string::npos) << serialized;
@@ -1145,6 +1149,7 @@ TEST_F(HttpOpenAIHandlerParsingTest, serializeUnaryResponseForResponsesOmitsReas
11451149
ASSERT_EQ(outputIds.get_element_type(), ov::element::i64);
11461150
int64_t* outputIdsData = reinterpret_cast<int64_t*>(outputIds.data());
11471151
results.tokens = {std::vector<int64_t>(outputIdsData, outputIdsData + outputIds.get_shape()[1])};
1152+
results.finish_reasons = {ov::genai::GenerationFinishReason::STOP};
11481153

11491154
std::string serialized = apiHandler->serializeUnaryResponse(results);
11501155
ASSERT_NE(serialized.find("\"object\":\"response\""), std::string::npos) << serialized;
@@ -2741,6 +2746,7 @@ TEST_F(HttpOpenAIHandlerParsingTest, SerializeResponsesUnaryResponseContainsFunc
27412746
ASSERT_EQ(outputIds.get_element_type(), ov::element::i64);
27422747
int64_t* outputIdsData = reinterpret_cast<int64_t*>(outputIds.data());
27432748
results.tokens = {std::vector<int64_t>(outputIdsData, outputIdsData + outputIds.get_shape()[1])};
2749+
results.finish_reasons = {ov::genai::GenerationFinishReason::STOP};
27442750

27452751
std::string serialized = apiHandler->serializeUnaryResponse(results);
27462752
ASSERT_NE(serialized.find("\"object\":\"response\""), std::string::npos) << serialized;
@@ -2786,6 +2792,7 @@ TEST_F(HttpOpenAIHandlerParsingTest, SerializeResponsesUnaryResponseContainsFunc
27862792
ASSERT_EQ(outputIds.get_element_type(), ov::element::i64);
27872793
int64_t* outputIdsData = reinterpret_cast<int64_t*>(outputIds.data());
27882794
results.tokens = {std::vector<int64_t>(outputIdsData, outputIdsData + outputIds.get_shape()[1])};
2795+
results.finish_reasons = {ov::genai::GenerationFinishReason::STOP};
27892796

27902797
std::string serialized = apiHandler->serializeUnaryResponse(results);
27912798
ASSERT_NE(serialized.find("\"tool_choice\":{"), std::string::npos) << serialized;
@@ -3095,6 +3102,7 @@ TEST_F(HttpOpenAIHandlerParsingTest, SerializeUnaryResponseVLMDecodedResultsWith
30953102
std::string vlmText =
30963103
"I will call a tool.<tool_call>{\"name\":\"get_weather\",\"arguments\":{\"location\":\"Paris\"}}</tool_call>";
30973104
results.texts.push_back(vlmText);
3105+
results.finish_reasons = {ov::genai::GenerationFinishReason::STOP};
30983106

30993107
std::string serialized = apiHandler->serializeUnaryResponse(results, vlmText);
31003108

0 commit comments

Comments
 (0)