Skip to content

Commit d6e680a

Browse files
author
ochafik
committed
nits + docs
1 parent eaeed7d commit d6e680a

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

common/chat-parser.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
#include "chat-parser.h"
22
#include "common.h"
33
#include "log.h"
4-
// #include "json-partial.h"
54
#include "regex-partial.h"
65

7-
#include <cstdio>
86
#include <optional>
97
#include <stdexcept>
108
#include <string>

common/chat-parser.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,22 @@ class common_chat_msg_parser {
4242
pos_ -= n;
4343
}
4444

45+
// Get the substring of the input at the given range
4546
std::string str(const common_string_range & rng) const;
4647

48+
// Appends to the result.content field
4749
void add_content(const std::string & content);
50+
51+
// Appends to the result.reasoning_content field
4852
void add_reasoning_content(const std::string & reasoning_content);
4953

54+
// Adds a tool call to the result. If the tool call is too incomplete (e.g. name empty), it won't add anything.
5055
bool add_tool_call(const std::string & name, const std::string & id, const std::string & arguments, const common_healing_marker & healing_marker);
56+
57+
// Adds a tool call using the "name", "id" and "arguments" fields of the json object
5158
bool add_tool_call(const nlohmann::ordered_json & tool_call, const common_healing_marker & healing_marker);
59+
60+
// Adds an array of tool calls using their "name", "id" and "arguments" fields.
5261
bool add_tool_calls(const nlohmann::ordered_json & arr, const common_healing_marker & healing_marker);
5362

5463
void finish();

common/regex-partial.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ common_regex_match common_regex::search(const std::string & input, size_t pos, b
4949
return {};
5050
}
5151

52-
/*xz
52+
/*
5353
Transforms a regex pattern to a partial match pattern that operates on a reversed input string to find partial final matches of the original pattern.
5454
5555
Ideally we'd like to use boost::match_partial (https://beta.boost.org/doc/libs/1_59_0/libs/regex/doc/html/boost_regex/partial_matches.html)

0 commit comments

Comments
 (0)