MCPcopy Create free account
hub / github.com/AI45Lab/Code / drain_to_done

Function drain_to_done

core/src/llm/openai.rs:1280–1298  ·  view source on GitHub ↗
(client: &OpenAiClient)

Source from the content-addressed store, hash-verified

1278 }
1279
1280 async fn drain_to_done(client: &OpenAiClient) -> crate::llm::LlmResponse {
1281 use crate::llm::{LlmClient, StreamEvent};
1282 let mut rx = client
1283 .complete_streaming(
1284 &[Message::user("go")],
1285 None,
1286 &[],
1287 tokio_util::sync::CancellationToken::new(),
1288 )
1289 .await
1290 .expect("stream opened");
1291 let mut done = None;
1292 while let Some(ev) = rx.recv().await {
1293 if let StreamEvent::Done(resp) = ev {
1294 done = Some(resp);
1295 }
1296 }
1297 done.expect("a Done event")
1298 }
1299
1300 #[tokio::test]
1301 async fn streaming_reasoning_does_not_leak_into_content_and_keeps_tool_call() {

Calls 2

expectMethod · 0.80
complete_streamingMethod · 0.45

Tested by

no test coverage detected