Skip to main content

detect_response_kind

Function detect_response_kind 

Source
pub(crate) async fn detect_response_kind<'a>(
    lines: Pin<Box<LinesStream<StreamReader<BoxStream<'a, Result<Bytes, Error>>, Bytes>>>>,
) -> ChatbotResult<ClassifiedResponse<'a>>
Expand description

Reads the head of lines until it is clear whether the round is a tool call or a text answer, and hands the rest of the stream on to the parser that suits it.

Errors if the response fails, arrives incomplete, or ends without classifying.