gproxy-protocol 1.0.20

Wire-format types and cross-protocol transforms for Claude, OpenAI, and Gemini LLM APIs.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use crate::gemini::generate_content::response::ResponseBody as GeminiGenerateContentResponseBody;
use crate::gemini::types::JsonObject;

pub fn parse_json_object_or_empty(input: &str) -> JsonObject {
    serde_json::from_str::<JsonObject>(input).unwrap_or_default()
}

/// Placeholder "done" sentinel — callers that need to signal stream end
/// can use `is_finished()` on the converter instead.  This is kept only
/// for the `nonstream_to_stream` path that still needs to materialise a
/// final chunk, which is simply an empty body.
pub fn empty_chunk() -> GeminiGenerateContentResponseBody {
    GeminiGenerateContentResponseBody::default()
}