Skip to main content

gproxy_protocol/wire/openai/chat/
mod.rs

1pub mod reasoning;
2pub use reasoning::{ReasoningDetail, ReasoningDetailKind, visible_reasoning};
3pub mod content;
4pub mod request;
5pub mod response;
6pub mod stream;
7pub mod tools;
8
9pub use content::*;
10pub use request::*;
11pub use response::*;
12pub use stream::*;
13pub use tools::*;
14
15/// Select one provider spelling without duplicating reasoning when both are
16/// present. Native passthrough retains both fields independently.
17pub fn reasoning_text<'a>(
18    content: &'a Option<Option<String>>,
19    reasoning: &'a Option<Option<String>>,
20) -> Option<&'a str> {
21    content
22        .as_ref()
23        .and_then(Option::as_deref)
24        .filter(|s| !s.is_empty())
25        .or_else(|| reasoning.as_ref().and_then(Option::as_deref))
26        .or_else(|| content.as_ref().and_then(Option::as_deref))
27}