mirror of
https://github.com/ikawrakow/ik_llama.cpp.git
synced 2026-06-28 04:30:15 -05:00
common/chat, server: refactor, move all conversion functions to common, add tests (#20690) jinja : remove unused header (#22310) common : fix jinja warnings with clang 21 (#22313) Signed-off-by: Adrien Gallouët <angt@huggingface.co> chat: fix handling of space in reasoning markers (#22353) * chat: fix handling of space in reasoning markers common : re-arm reasoning budget after DONE on new <think> (#22323) common : determine generation prompt using longest common prefix (#22657) common/autoparser: fixes for newline handling / forced tool calls (#22654) * chat/autoparser: the fixes * Move optspace() to chat-peg-parser, comment out server tests invalidated due to content now allowed with forced tool calls. * Trim whitespace on apply instead common/chat : preserve media markers for typed-content templates (#22634) common : revert reasoning budget +inf logit bias (#22740) common : do not wrap raw strings in schema parser for tagged parsers (#22827) common : enable streaming JSON argument values (#23173) * common : remove atomic from json arguments * common : remove parsing logic on JSON arguments common : do not pass prompt tokens to reasoning budget sampler (#22488) reasoning-budget: clone should do a deep-copy (#23095) Co-authored-by: Piotr Wilkin (ilintar) <piotr.wilkin@syndatis.com>
25 lines
837 B
C++
25 lines
837 B
C++
// Chat conversion functions for server (Responses API, Anthropic API, OAI streaming diffs)
|
|
|
|
#pragma once
|
|
|
|
#include "chat.h"
|
|
#include "server-common.h"
|
|
|
|
#include <nlohmann/json_fwd.hpp>
|
|
|
|
using json = nlohmann::ordered_json;
|
|
|
|
// Convert OpenAI Responses API format to OpenAI Chat Completions API format
|
|
json server_chat_convert_responses_to_chatcmpl(const json & body);
|
|
|
|
// Convert Anthropic Messages API format to OpenAI Chat Completions API format
|
|
json server_chat_convert_anthropic_to_oai(const json & body);
|
|
|
|
// convert OpenAI transcriptions API format to OpenAI Chat Completions API format
|
|
json convert_transcriptions_to_chatcmpl(
|
|
const json & body,
|
|
const std::map<std::string, raw_buffer> & in_files,
|
|
std::vector<raw_buffer> & out_files);
|
|
|
|
json server_chat_msg_diff_to_json_oaicompat(const common_chat_msg_diff & diff);
|