Skip to main content

llama_rs_parse_chat_message

Function llama_rs_parse_chat_message 

Source
pub unsafe extern "C" fn llama_rs_parse_chat_message(
    model: *const llama_model,
    tools_json: *const c_char,
    input: *const c_char,
    is_partial: c_int,
    out_handle: *mut llama_rs_parsed_chat_handle,
    out_error: *mut *mut c_char,
) -> llama_rs_status
Expand description

Parse a chat-completion turn from raw assistant output using llama.cpp’s common_chat_parse, driven by the model’s autoparser-built peg parser.

tools_json is a serialized JSON array of OpenAI-style tool definitions (or empty / null when the request had no tools). is_partial switches between mid-stream parses (partial accepts incomplete payloads) and final parses (rejects malformed input).

On success, *out_handle owns the parsed message; free via llama_rs_parsed_chat_free. On failure, *out_error carries an exception message; free via llama_rs_string_free.