Skip to content

Commit 9b8c2a3

Browse files
committed
Fix unconvential using
1 parent 33cd9f2 commit 9b8c2a3

File tree

6 files changed

+26
-26
lines changed

6 files changed

+26
-26
lines changed

src/llm/io_processing/base_output_parser.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ struct ToolCall {
4040
};
4141

4242
using ToolsSchemas_t = std::map<std::string, std::pair<rapidjson::Value*, std::string>>;
43-
using ToolCalls = std::vector<ToolCall>;
43+
using ToolCalls_t = std::vector<ToolCall>;
4444

4545
struct ParsedOutput {
4646
// Content without tool calls and reasoning
4747
std::string content;
4848
// Tool calls extracted from the response
49-
ToolCalls toolCalls;
49+
ToolCalls_t toolCalls;
5050
// Decoded reasoning from the response
5151
std::string reasoning;
5252
};

src/llm/io_processing/gptoss/harmony.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ std::string Harmony::getReasoning() {
9191
Tool calls are extracted from messages in channel "commentary" that contain "to=functions.NAME" in the channel content; example:
9292
<|channel|>commentary to=functions.get_humidity <|message|>{"location":"Paris"}<|end|>
9393
*/
94-
ToolCalls Harmony::getToolCalls() {
94+
ToolCalls_t Harmony::getToolCalls() {
9595
static const std::string tool_prefix = "to=functions.";
96-
ToolCalls toolCalls;
96+
ToolCalls_t toolCalls;
9797
for (const auto& msg : messages) {
9898
if (startsWith(msg.getChannel(), "commentary")) {
9999
size_t marker = msg.getChannel().find(tool_prefix);

src/llm/io_processing/gptoss/harmony.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class Harmony {
4949
// Intermediate state during parsing of each message, not used in final accessors
5050
std::string content;
5151
std::string reasoning;
52-
ToolCalls toolCalls;
52+
ToolCalls_t toolCalls;
5353

5454
public:
5555
Harmony(ov::genai::Tokenizer& tokenizer, const std::vector<int64_t>& tokens);
@@ -58,7 +58,7 @@ class Harmony {
5858

5959
std::string getContent();
6060
std::string getReasoning();
61-
ToolCalls getToolCalls();
61+
ToolCalls_t getToolCalls();
6262

6363
static const std::string TOKEN_START;
6464
static const std::string TOKEN_END;

src/llm/io_processing/qwen3coder/qwen3coder_tool_parser.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ static std::string setCorrectValueType(std::string& inputValue, const std::strin
159159
break; \
160160
}
161161

162-
bool Qwen3CoderToolParserImpl::parseUntilStateChange(ToolCalls& toolCalls) {
162+
bool Qwen3CoderToolParserImpl::parseUntilStateChange(ToolCalls_t& toolCalls) {
163163
SPDLOG_TRACE("State: {}", this->currentState);
164164
auto previousState = this->currentState;
165165
switch (this->currentState) {
@@ -237,11 +237,11 @@ bool Qwen3CoderToolParserImpl::parseUntilStateChange(ToolCalls& toolCalls) {
237237
}
238238
return previousState != this->currentState;
239239
}
240-
std::optional<ToolCalls> Qwen3CoderToolParserImpl::parseChunk(const std::string& chunk) {
240+
std::optional<ToolCalls_t> Qwen3CoderToolParserImpl::parseChunk(const std::string& chunk) {
241241
if (chunk.empty()) {
242242
return std::nullopt;
243243
}
244-
ToolCalls toolCalls;
244+
ToolCalls_t toolCalls;
245245
this->streamContent += chunk;
246246
while (parseUntilStateChange(toolCalls)) {
247247
}
@@ -315,7 +315,7 @@ std::optional<std::string> Qwen3CoderToolParserImpl::getCurrentFunctionName() co
315315
}
316316
return this->currentFunction.name;
317317
}
318-
std::optional<rapidjson::Document> Qwen3CoderToolParser::sendFullDelta(std::optional<ToolCalls>& toolCallsOpt) {
318+
std::optional<rapidjson::Document> Qwen3CoderToolParser::sendFullDelta(std::optional<ToolCalls_t>& toolCallsOpt) {
319319
auto& toolCalls = toolCallsOpt.value();
320320
if (toolCalls.size() != 1) {
321321
SPDLOG_ERROR("For streaming we expected one tool call, got: {}", toolCalls.size());

src/llm/io_processing/qwen3coder/qwen3coder_tool_parser.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ C->ITC->IFN->IF->IPN->IP->AF->C
8686
* Return all tool calls found in agreggated content so far
8787
* that were not returned before
8888
*/
89-
std::optional<ToolCalls> parseChunk(const std::string& chunk);
89+
std::optional<ToolCalls_t> parseChunk(const std::string& chunk);
9090
std::optional<std::string> getCurrentFunctionName() const;
9191
Status removeToolCallsFromContentIfNeeded(std::string& outContent);
9292
State getCurrentState() const {
@@ -116,7 +116,7 @@ C->ITC->IFN->IF->IPN->IP->AF->C
116116
* return true if state changed, false otherwise
117117
* false means no more state changes possible with current content
118118
*/
119-
bool parseUntilStateChange(ToolCalls& toolCalls);
119+
bool parseUntilStateChange(ToolCalls_t& toolCalls);
120120
};
121121

122122
class Qwen3CoderToolParser : public BaseOutputParser {
@@ -136,7 +136,7 @@ class Qwen3CoderToolParser : public BaseOutputParser {
136136
// for streaming parsing we need to keep parser as a member
137137
Qwen3CoderToolParserImpl streamParser;
138138
int toolCallIndex{-1};
139-
ToolCalls currentToolCalls;
139+
ToolCalls_t currentToolCalls;
140140
rapidjson::Document currentJson;
141141
std::set<int> returnedFirstDeltas;
142142
std::set<int> returnedCompleteDeltas;
@@ -161,7 +161,7 @@ class Qwen3CoderToolParser : public BaseOutputParser {
161161

162162
private:
163163
std::optional<rapidjson::Document> sendFirstDeltaIfNeeded(const std::string& currentFunctionName);
164-
std::optional<rapidjson::Document> sendFullDelta(std::optional<ToolCalls>& toolCallsOpt);
164+
std::optional<rapidjson::Document> sendFullDelta(std::optional<ToolCalls_t>& toolCallsOpt);
165165
void lazyFillInitToolParametersTypesMap();
166166
};
167167
} // namespace ovms

src/test/llm/output_parsers/qwen3coder_output_parser_test.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ value1
172172
ovms::Qwen3CoderToolParserImpl parser(toolsParametersTypeMap);
173173
auto callsOpt = parser.parseChunk(content);
174174
ASSERT_TRUE(callsOpt.has_value());
175-
ToolCalls& calls = callsOpt.value();
175+
ToolCalls_t& calls = callsOpt.value();
176176
auto status = parser.removeToolCallsFromContentIfNeeded(content);
177177
EXPECT_TRUE(status.ok()) << status.string();
178178
ASSERT_EQ(calls.size(), 1) << input;
@@ -212,7 +212,7 @@ After)";
212212
ovms::Qwen3CoderToolParserImpl parser(toolsParametersTypeMap);
213213
auto callsOpt = parser.parseChunk(content);
214214
ASSERT_TRUE(callsOpt.has_value());
215-
ToolCalls& calls = callsOpt.value();
215+
ToolCalls_t& calls = callsOpt.value();
216216
auto status = parser.removeToolCallsFromContentIfNeeded(content);
217217
EXPECT_TRUE(status.ok()) << status.string();
218218
EXPECT_EQ(calls.size(), 1) << input;
@@ -241,7 +241,7 @@ value1
241241
ovms::Qwen3CoderToolParserImpl parser(toolsParametersTypeMap);
242242
auto callsOpt = parser.parseChunk(content);
243243
ASSERT_TRUE(callsOpt.has_value());
244-
ToolCalls& calls = callsOpt.value();
244+
ToolCalls_t& calls = callsOpt.value();
245245
auto status = parser.removeToolCallsFromContentIfNeeded(content);
246246
EXPECT_TRUE(status.ok()) << status.string();
247247
EXPECT_EQ(calls.size(), 1) << input;
@@ -264,7 +264,7 @@ TEST_F(Qwen3CoderOutputParserTest, TestJustParserImplUnaryWithJsonObjectArgument
264264
ovms::Qwen3CoderToolParserImpl parser(toolsParametersTypeMap);
265265
auto callsOpt = parser.parseChunk(content);
266266
ASSERT_TRUE(callsOpt.has_value());
267-
ToolCalls& calls = callsOpt.value();
267+
ToolCalls_t& calls = callsOpt.value();
268268
auto status = parser.removeToolCallsFromContentIfNeeded(content);
269269
EXPECT_TRUE(status.ok()) << status.string();
270270
EXPECT_EQ(calls.size(), 1) << input;
@@ -298,7 +298,7 @@ data
298298
ovms::Qwen3CoderToolParserImpl parser(toolsParametersTypeMap);
299299
auto callsOpt = parser.parseChunk(content);
300300
ASSERT_TRUE(callsOpt.has_value());
301-
ToolCalls& calls = callsOpt.value();
301+
ToolCalls_t& calls = callsOpt.value();
302302
auto status = parser.removeToolCallsFromContentIfNeeded(content);
303303
EXPECT_TRUE(status.ok()) << status.string();
304304
EXPECT_EQ(calls.size(), 2) << input;
@@ -331,7 +331,7 @@ True
331331
ovms::Qwen3CoderToolParserImpl parser(toolsParametersTypeMap);
332332
auto callsOpt = parser.parseChunk(content);
333333
ASSERT_TRUE(callsOpt.has_value());
334-
ToolCalls& calls = callsOpt.value();
334+
ToolCalls_t& calls = callsOpt.value();
335335
auto status = parser.removeToolCallsFromContentIfNeeded(content);
336336
EXPECT_TRUE(status.ok()) << status.string();
337337
ASSERT_EQ(calls.size(), 1) << input;
@@ -359,7 +359,7 @@ value2
359359
ovms::Qwen3CoderToolParserImpl parser(toolsParametersTypeMap);
360360
auto callsOpt = parser.parseChunk(content);
361361
ASSERT_TRUE(callsOpt.has_value());
362-
ToolCalls& calls = callsOpt.value();
362+
ToolCalls_t& calls = callsOpt.value();
363363
auto status = parser.removeToolCallsFromContentIfNeeded(content);
364364
EXPECT_TRUE(status.ok()) << status.string();
365365
ASSERT_EQ(calls.size(), 1) << input;
@@ -370,7 +370,7 @@ value2
370370
EXPECT_EQ(content, "\n");
371371
}
372372
TEST_F(Qwen3CoderOutputParserTest, TestJustParserImplStreamStepWithMoreThan1StateChange) {
373-
ToolCalls calls;
373+
ToolCalls_t calls;
374374
ovms::Qwen3CoderToolParserImpl parser(toolsParametersTypeMap);
375375
const std::string input = R"(
376376
<tool_call>
@@ -392,7 +392,7 @@ value1
392392
EXPECT_EQ(parser.getLastProcessedPosition(), input.find("</tool_call>") + std::string("</tool_call>").size());
393393
}
394394
TEST_F(Qwen3CoderOutputParserTest, TestJustParserImplStreamStepWithNoStateChange) {
395-
ToolCalls calls;
395+
ToolCalls_t calls;
396396
ovms::Qwen3CoderToolParserImpl parser(toolsParametersTypeMap);
397397
const std::string input = R"("Some content without tool calls")";
398398
auto content = input;
@@ -402,7 +402,7 @@ TEST_F(Qwen3CoderOutputParserTest, TestJustParserImplStreamStepWithNoStateChange
402402
EXPECT_EQ(parser.getLastProcessedPosition(), 0);
403403
}
404404
TEST_F(Qwen3CoderOutputParserTest, TestJustParserImplStreamStepWithPartialToolCall) {
405-
ToolCalls calls;
405+
ToolCalls_t calls;
406406
ovms::Qwen3CoderToolParserImpl parser(toolsParametersTypeMap);
407407
const std::string input = R"(
408408
<tool_call>
@@ -419,7 +419,7 @@ value1
419419
EXPECT_EQ(parser.getCurrentFunctionName().value(), "string_tool");
420420
}
421421
TEST_F(Qwen3CoderOutputParserTest, TestJustParserImplStreamStepWithTwoToolCalls) {
422-
ToolCalls calls;
422+
ToolCalls_t calls;
423423
ovms::Qwen3CoderToolParserImpl parser(toolsParametersTypeMap);
424424
const std::string input = R"(
425425
<tool_call>
@@ -494,7 +494,7 @@ TEST_P(Qwen3CoderOutputParserParametrizedTest, TestJustParserImplWithVariousArgu
494494
ovms::Qwen3CoderToolParserImpl parser(toolsParametersTypeMap);
495495
auto callsOpt = parser.parseChunk(content);
496496
ASSERT_TRUE(callsOpt.has_value());
497-
ToolCalls& calls = callsOpt.value();
497+
ToolCalls_t& calls = callsOpt.value();
498498
auto status = parser.removeToolCallsFromContentIfNeeded(content);
499499
EXPECT_TRUE(status.ok()) << status.string();
500500
EXPECT_EQ(calls.size(), 1) << input;

0 commit comments

Comments
 (0)