| 7 | namespace providers { |
| 8 | |
| 9 | BaseProviderClient::BaseProviderClient( |
| 10 | const ProviderConfig& config, |
| 11 | std::unique_ptr<RequestBuilder> request_builder, |
| 12 | std::unique_ptr<ResponseParser> response_parser) |
| 13 | : config_(config), |
| 14 | request_builder_(std::move(request_builder)), |
| 15 | response_parser_(std::move(response_parser)) { |
| 16 | // Initialize HTTP handler with parsed config |
| 17 | auto http_config = http::HttpRequestHandler::parse_base_url(config.base_url); |
| 18 | |
| 19 | // Apply custom retry config if provided |
| 20 | if (config.retry_config.has_value()) { |
| 21 | http_config.retry_config = config.retry_config.value(); |
| 22 | } |
| 23 | |
| 24 | http_handler_ = std::make_unique<http::HttpRequestHandler>(http_config); |
| 25 | |
| 26 | ai::logger::log_debug( |
| 27 | R"(BaseProviderClient initialized - base_url: {}, |
| 28 | completions_endpoint: {}, embeddings_endpoint: {})", |
| 29 | config.base_url, config.completions_endpoint_path, |
| 30 | config.embeddings_endpoint_path); |
| 31 | } |
| 32 | |
| 33 | GenerateResult BaseProviderClient::generate_text( |
| 34 | const GenerateOptions& options) { |
nothing calls this directly
no test coverage detected