(base_url: Option<&str>, path: &str)
| 536 | } |
| 537 | |
| 538 | fn responses_url(base_url: Option<&str>, path: &str) -> String { |
| 539 | let path = path.trim_start_matches('/'); |
| 540 | match base_url { |
| 541 | None => format!("https://api.openai.com/v1/{}", path), |
| 542 | Some(base) => { |
| 543 | if base.ends_with("/chat/completions") { |
| 544 | return format!("{}/{}", base.trim_end_matches("/chat/completions"), path); |
| 545 | } |
| 546 | if base.ends_with("/v1") { |
| 547 | return format!("{}/{}", base.trim_end_matches('/'), path); |
| 548 | } |
| 549 | if base.ends_with('/') { |
| 550 | format!("{}{}", base, path) |
| 551 | } else { |
| 552 | format!("{}/{}", base, path) |
| 553 | } |
| 554 | } |
| 555 | } |
| 556 | } |
| 557 | |
| 558 | fn chat_completions_url(base_url: Option<&str>) -> String { |
| 559 | match base_url { |
nothing calls this directly
no outgoing calls
no test coverage detected