(&self, request: ChatRequest)
| 510 | } |
| 511 | |
| 512 | async fn chat_stream(&self, request: ChatRequest) -> Result<StreamResult, ProviderError> { |
| 513 | if select_copilot_route(&request.model) == CopilotRoute::Responses { |
| 514 | let response_model = self.responses_model(&request.model); |
| 515 | let options = StreamOptions { |
| 516 | generate: self.responses_generate_options(&request), |
| 517 | }; |
| 518 | let model_for_log = request.model.clone(); |
| 519 | return resolve_with_fallback( |
| 520 | async move { response_model.do_stream(options).await }, |
| 521 | move |err| async move { |
| 522 | if get_custom_fetch_proxy("github-copilot").is_some() { |
| 523 | tracing::warn!( |
| 524 | model = %model_for_log, |
| 525 | error = %err, |
| 526 | "Copilot responses stream failed while custom fetch proxy is active; skipping legacy fallback" |
| 527 | ); |
| 528 | return Err(err); |
| 529 | } |
| 530 | tracing::warn!( |
| 531 | model = %model_for_log, |
| 532 | error = %err, |
| 533 | "Copilot responses stream failed, falling back to chat completions" |
| 534 | ); |
| 535 | self.chat_stream_legacy(request).await |
| 536 | }, |
| 537 | ) |
| 538 | .await; |
| 539 | } |
| 540 | |
| 541 | self.chat_stream_legacy(request).await |
| 542 | } |
| 543 | } |
| 544 | |
| 545 | fn copilot_reasoning_effort(model_id: &str, variant: Option<&str>) -> Option<&'static str> { |
nothing calls this directly
no test coverage detected