mirror of
https://github.com/ggml-org/llama.cpp.git
synced 2026-10-28 17:56:13 +08:00
* server : add realtime conversation and transcription on /v1/realtime Co-authored-by: Xuan Son Nguyen <son@huggingface.co> Assisted-by: Claude Opus 5.5 * examples : default the realtime client to the server port 9931 Assisted-by: Claude Opus 5.5 * server : sample realtime responses right after their own decode Slots respond in turns on one context: sampling at the start of the next step read the logits of whichever slot decoded last, so concurrent sessions mixed their outputs. Assisted-by: Claude Opus 5.5 * move more stuff to server-realtime, making it self-contained * examples : fix the type check of the realtime client Assisted-by: Claude Opus 5.5 * examples : use the model card prompts in the realtime client Assisted-by: Claude Opus 5.5 --------- Co-authored-by: Xuan Son Nguyen <son@huggingface.co>
29 lines
1.1 KiB
C++
29 lines
1.1 KiB
C++
// Chat conversion functions for server (Responses API, Anthropic API, OAI streaming diffs)
|
|
|
|
#pragma once
|
|
|
|
#include "chat.h"
|
|
#include "server-common.h"
|
|
#include "server-http.h"
|
|
|
|
#include "json.h"
|
|
|
|
// 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 common_chat_templates * tmpls,
|
|
const std::map<std::string, uploaded_file> & in_files,
|
|
std::vector<raw_buffer> & out_files);
|
|
|
|
// prompt of the "asr" chat template, live ASR models (e.g. LFM3-Audio live ASR) transcribe with it
|
|
// empty if the model has no such template, throws on a template error
|
|
llama_tokens server_chat_get_asr_prompt(const llama_model * model);
|
|
|
|
json server_chat_msg_diff_to_json_oaicompat(const common_chat_msg_diff & diff);
|