(&self, model_id: &str)
| 644 | } |
| 645 | |
| 646 | fn responses_model(&self, model_id: &str) -> OpenAIResponsesLanguageModel { |
| 647 | let api_key = self.config.api_key.clone(); |
| 648 | let org = self.config.organization.clone(); |
| 649 | let base_url = self.config.base_url.clone(); |
| 650 | let client = self.client.clone(); |
| 651 | |
| 652 | OpenAIResponsesLanguageModel::new( |
| 653 | model_id.to_string(), |
| 654 | OpenAIResponsesConfig { |
| 655 | provider: "openai".to_string(), |
| 656 | url: Arc::new(move |path, _model| Self::responses_url(base_url.as_deref(), path)), |
| 657 | headers: Arc::new(move || { |
| 658 | let mut h = HashMap::new(); |
| 659 | h.insert("Authorization".to_string(), format!("Bearer {}", api_key)); |
| 660 | if let Some(org) = &org { |
| 661 | h.insert("OpenAI-Organization".to_string(), org.clone()); |
| 662 | } |
| 663 | h |
| 664 | }), |
| 665 | client: Some(client), |
| 666 | file_id_prefixes: Some(vec!["file-".to_string()]), |
| 667 | generate_id: None, |
| 668 | metadata_extractor: None, |
| 669 | }, |
| 670 | ) |
| 671 | } |
| 672 | |
| 673 | fn finish_reason_to_string(reason: FinishReason) -> String { |
| 674 | match reason { |
no test coverage detected