(&self, model_id: &str)
| 292 | } |
| 293 | |
| 294 | fn responses_model(&self, model_id: &str) -> OpenAIResponsesLanguageModel { |
| 295 | let token = self.config.oauth_token.clone(); |
| 296 | let base_url = self.config.base_url.clone(); |
| 297 | let client = self.client.clone(); |
| 298 | |
| 299 | OpenAIResponsesLanguageModel::new( |
| 300 | model_id.to_string(), |
| 301 | OpenAIResponsesConfig { |
| 302 | provider: "github-copilot".to_string(), |
| 303 | url: Arc::new(move |path, _model| Self::responses_url(base_url.as_deref(), path)), |
| 304 | headers: Arc::new(move || { |
| 305 | let mut h = HashMap::new(); |
| 306 | h.insert("Authorization".to_string(), format!("Bearer {}", token)); |
| 307 | h.insert( |
| 308 | "Copilot-Integration-Id".to_string(), |
| 309 | "vscode-chat".to_string(), |
| 310 | ); |
| 311 | h |
| 312 | }), |
| 313 | client: Some(client), |
| 314 | file_id_prefixes: Some(vec!["file-".to_string()]), |
| 315 | generate_id: None, |
| 316 | metadata_extractor: None, |
| 317 | }, |
| 318 | ) |
| 319 | } |
| 320 | |
| 321 | fn finish_reason_to_string(reason: FinishReason) -> String { |
| 322 | match reason { |
no test coverage detected