Skip to content

tool-call: refactor common chat / tool-call api (+ tests / fixes) #11900

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 43 commits into from
Feb 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
36092aa
address clang-tidy lints
Feb 15, 2025
ef9b91a
tool-call: massive refactoring
Feb 15, 2025
2f683f0
rm minja dep from util & common
Feb 15, 2025
7a04ebc
move minja to common/minja
Feb 15, 2025
ece941b
Update utils.hpp
Feb 15, 2025
aa09a3c
add common_chat_tool
Feb 15, 2025
7ae7560
force utf8 encoding in get_chat_template
Feb 15, 2025
646528a
fix json tools parsing
Feb 16, 2025
db2b44e
add json tools / messages parsing helpers to common
Feb 16, 2025
c7c8907
fix common_chat_msgs_parse_oaicompat
Feb 16, 2025
5f17156
concat multipart content in legacy template path
Feb 16, 2025
ee9b9d6
add name & tool_call_id to common_chat_msg
Feb 16, 2025
07f0ad0
Update test-chat.cpp
Feb 16, 2025
1acda5f
test & fix json<->msg conversions
Feb 16, 2025
a58e1fc
fix typo
Feb 16, 2025
103c840
fix content part string concat in legacy template branch
Feb 16, 2025
c154c02
test tools json conversions
Feb 16, 2025
3d41f1b
test content parts in test-chat
Feb 16, 2025
59c8059
fix clang-tidy lints in [test-]chat.*
Feb 16, 2025
1847cae
fix deepseek r1 slow test (no longer <think> opening w/ new template)
Feb 16, 2025
8462a51
fix lints in test-chat-template.cpp
Feb 16, 2025
80c432b
tweak test_calc_result expectations
Feb 16, 2025
42b29e1
fix double bos/eos jinja avoidance hack (was preventing inner bos/eos…
Feb 16, 2025
ce4ccf0
add common_chat_templates_source + rehab server template logs
Feb 16, 2025
cb31f08
fix msg lints
Feb 16, 2025
76f5d27
tool-call: allow empty tools w/ auto + grammar
Feb 16, 2025
34e4e22
fix & test grammar & json_schema w/ & w/o --jinja
Feb 16, 2025
1c6168b
Update test-chat-template.cpp
Feb 16, 2025
ae6b870
test & fix array message.content
Feb 16, 2025
1421037
fix links to prepare merge
Feb 16, 2025
d95a17c
Merge remote-tracking branch 'origin/master' into chat-cleanups
Feb 16, 2025
5a5ed7b
fix merge
Feb 16, 2025
dd5ef85
rm trailing spaces
Feb 16, 2025
2f2f0fa
Add missing <optional> include to chat.cpp
Feb 16, 2025
a58b9e5
tiny fix: somehow llama_token being defined in an extern c makes it l…
Feb 16, 2025
f999ff5
alternative fix for gcc c vs. c++ weirdness
Feb 16, 2025
55a7614
add missing <regex> include to test-chat-template
Feb 16, 2025
9d62f62
Update chat.hpp
Feb 16, 2025
da0982a
have common_chat_templates_init return a unique_ptr
Feb 17, 2025
7ddb454
chat.{hpp -> h}
Feb 17, 2025
d2969b8
build common_chat_templates_ptr earlier
Feb 17, 2025
fd2b8e1
use deleter functor for common_chat_templates_ptr
Feb 17, 2025
9a85439
Merge remote-tracking branch 'origin/master' into chat-cleanups
Feb 18, 2025
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1364,7 +1364,7 @@ llama-server: \
examples/server/index.html.hpp \
examples/server/loading.html.hpp \
common/chat.cpp \
common/chat.hpp \
common/chat.h \
common/chat-template.hpp \
common/json.hpp \
common/minja.hpp \
Expand Down
6 changes: 3 additions & 3 deletions common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ add_library(${TARGET} STATIC
arg.h
base64.hpp
chat.cpp
chat.hpp
chat-template.hpp
chat.h
common.cpp
common.h
console.cpp
Expand All @@ -68,7 +67,8 @@ add_library(${TARGET} STATIC
llguidance.cpp
log.cpp
log.h
minja.hpp
minja/chat-template.hpp
minja/minja.hpp
ngram-cache.cpp
ngram-cache.h
sampling.cpp
Expand Down
1 change: 1 addition & 0 deletions common/arg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "log.h"
#include "sampling.h"
#include "chat.h"

#include <algorithm>
#include <climits>
Expand Down
Loading
Loading