(&self, request: ChatRequest)
| 1027 | } |
| 1028 | |
| 1029 | async fn chat_stream(&self, request: ChatRequest) -> Result<StreamResult, ProviderError> { |
| 1030 | // Skip Responses API for OpenAI-compatible providers (non-OpenAI endpoints) |
| 1031 | if self.prefers_legacy_route() { |
| 1032 | return self.chat_stream_legacy(request).await; |
| 1033 | } |
| 1034 | |
| 1035 | let response_model = self.responses_model(&request.model); |
| 1036 | let options = StreamOptions { |
| 1037 | generate: self.responses_generate_options(&request), |
| 1038 | }; |
| 1039 | let model_for_log = request.model.clone(); |
| 1040 | resolve_with_fallback( |
| 1041 | async move { response_model.do_stream(options).await }, |
| 1042 | move |err| async move { |
| 1043 | if get_custom_fetch_proxy("openai").is_some() { |
| 1044 | tracing::warn!( |
| 1045 | model = %model_for_log, |
| 1046 | error = %err, |
| 1047 | "Responses stream failed while custom fetch proxy is active; skipping legacy fallback" |
| 1048 | ); |
| 1049 | return Err(err); |
| 1050 | } |
| 1051 | tracing::warn!( |
| 1052 | model = %model_for_log, |
| 1053 | error = %err, |
| 1054 | "Responses stream failed, falling back to chat completions stream" |
| 1055 | ); |
| 1056 | self.chat_stream_legacy(request).await |
| 1057 | }, |
| 1058 | ) |
| 1059 | .await |
| 1060 | } |
| 1061 | } |
| 1062 | |
| 1063 | fn openai_reasoning_effort(model_id: &str, variant: Option<&str>) -> Option<&'static str> { |
nothing calls this directly
no test coverage detected