headless_lms_chatbot/azure_chatbot/mod.rs
1//! Runs one chatbot turn against the Azure Responses API and streams it to the client as NDJSON.
2//!
3//! A *turn* is everything the assistant does in answer to one learner message: as many *rounds*
4//! as the model needs, each round one request to Azure and the response it streams back, up to
5//! the answer that ends the turn. A turn is not one HTTP request — one that calls a tool the
6//! client answers suspends, and a later request resumes it from the stored conversation.
7//!
8//! `turn`, `turn::round` and `turn::text_response` hold one `async_stream::try_stream!`
9//! generator each, and the seams are between them, never inside one. A generator exits through `break 'outer` and
10//! `return Err(e)?`, which no extracted helper can carry across a function boundary, so anything
11//! lifted out of one has to be a pure function over values, an async fn that borrows the
12//! connection and returns a value, or another stream. `azure::sse` classifies a response as a
13//! plain async fn precisely because it yields nothing the turn cannot receive as a return value.
14
15pub mod azure;
16mod client_tool_calls;
17pub mod events;
18mod request;
19mod search_grounding;
20#[cfg(test)]
21mod test_helpers;
22pub mod turn;