Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions common/chat-parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1399,7 +1399,7 @@ static void common_chat_parse_content_only(common_chat_msg_parser & builder) {
builder.add_content(builder.consume_rest());
}

static void common_chat_parse(common_chat_msg_parser & builder) {
static void common_chat_msg_parse(common_chat_msg_parser & builder) {
LOG_DBG("Parsing input with format %s: %s\n", common_chat_format_name(builder.syntax().format), builder.input().c_str());

switch (builder.syntax().format) {
Expand Down Expand Up @@ -1492,7 +1492,7 @@ common_chat_msg common_chat_parse(const std::string & input, bool is_partial, co
}
common_chat_msg_parser builder(input, is_partial, syntax);
try {
common_chat_parse(builder);
common_chat_msg_parse(builder);
} catch (const common_chat_msg_partial_exception & ex) {
LOG_DBG("Partial parse: %s\n", ex.what());
if (!is_partial) {
Expand Down
5 changes: 5 additions & 0 deletions common/chat-parser.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include "chat.h"
#include "peg-parser.h"
#include "chat-parser-xml-toolcall.h"
#include "json-partial.h"
#include "regex-partial.h"
Expand Down Expand Up @@ -131,3 +132,7 @@ class common_chat_msg_parser {

void clear_tools();
};

common_chat_msg common_chat_parse(const std::string & input, bool is_partial, const common_chat_syntax & syntax);
common_chat_msg common_chat_peg_parse(const common_peg_arena & parser, const std::string & input, bool is_partial, const common_chat_syntax & syntax);

2 changes: 0 additions & 2 deletions common/chat.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,6 @@ std::string common_chat_format_example(
const char* common_chat_format_name(common_chat_format format);
const char* common_reasoning_format_name(common_reasoning_format format);
common_reasoning_format common_reasoning_format_from_name(const std::string & format);
common_chat_msg common_chat_parse(const std::string & input, bool is_partial, const common_chat_syntax & syntax);
common_chat_msg common_chat_peg_parse(const common_peg_arena & parser, const std::string & input, bool is_partial, const common_chat_syntax & syntax);

common_chat_tool_choice common_chat_tool_choice_parse_oaicompat(const std::string & tool_choice);

Expand Down
1 change: 1 addition & 0 deletions tests/test-chat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// cmake -B build && cmake --build build --parallel && ./build/bin/test-chat ../minja/build/tests/*.jinja 2>/dev/null
//
#include "chat.h"
#include "chat-parser.h"

#include "log.h"

Expand Down
1 change: 1 addition & 0 deletions tools/server/server-task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "common.h"
#include "llama.h"
#include "chat.h"
#include "chat-parser.h"
#include "sampling.h"
#include "json-schema-to-grammar.h"

Expand Down
Loading