common/chat, server: refactor, move all conversion functions to common, add tests (#20690)

* Refactor conversion functions
This commit is contained in:
Piotr Wilkin (ilintar)
2026-04-22 10:28:45 +02:00
committed by GitHub
parent ca7f7b7b94
commit 134d6e54d4
11 changed files with 772 additions and 639 deletions
-12
View File
@@ -307,18 +307,6 @@ json oaicompat_chat_params_parse(
const server_chat_params & opt,
std::vector<raw_buffer> & out_files);
// convert OpenAI Responses API format to OpenAI Chat Completions API format
json convert_responses_to_chatcmpl(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);
// convert Anthropic Messages API format to OpenAI Chat Completions API format
json convert_anthropic_to_oai(const json & body);
// TODO: move it to server-task.cpp
json format_embeddings_response_oaicompat(
const json & request,