mirror of
https://github.com/LostRuins/koboldcpp.git
synced 2026-05-19 16:31:59 +00:00
Support for Codex CLI by skipping unsupported Responses tools (#23041)
Some checks are pending
Python Type-Check / python type-check (push) Waiting to run
Some checks are pending
Python Type-Check / python type-check (push) Waiting to run
* Support for Codex CLI by skipping unsupported Responses tools * Warn on skipped Responses tools and preserve gpt-oss apply_patch rejection * Revert gpt-oss apply_patch special handling
This commit is contained in:
parent
7155a49771
commit
91e84fed64
2 changed files with 85 additions and 3 deletions
|
|
@ -257,8 +257,11 @@ json server_chat_convert_responses_to_chatcmpl(const json & response_body) {
|
|||
for (json resp_tool : response_body.at("tools")) {
|
||||
json chatcmpl_tool;
|
||||
|
||||
if (json_value(resp_tool, "type", std::string()) != "function") {
|
||||
throw std::invalid_argument("'type' of tool must be 'function'");
|
||||
const std::string type = json_value(resp_tool, "type", std::string());
|
||||
if (type != "function") {
|
||||
// Non-function Responses tools have no Chat Completions equivalent.
|
||||
SRV_WRN("unsupported Responses tool type '%s' skipped\n", type.c_str());
|
||||
continue;
|
||||
}
|
||||
resp_tool.erase("type");
|
||||
chatcmpl_tool["type"] = "function";
|
||||
|
|
@ -270,7 +273,9 @@ json server_chat_convert_responses_to_chatcmpl(const json & response_body) {
|
|||
chatcmpl_tools.push_back(chatcmpl_tool);
|
||||
}
|
||||
chatcmpl_body.erase("tools");
|
||||
chatcmpl_body["tools"] = chatcmpl_tools;
|
||||
if (!chatcmpl_tools.empty()) {
|
||||
chatcmpl_body["tools"] = chatcmpl_tools;
|
||||
}
|
||||
}
|
||||
|
||||
if (response_body.contains("max_output_tokens")) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue