| 17 | namespace rabitqlib::python_bindings { |
| 18 | |
| 19 | inline rabitqlib::MetricType metric_from_string(const std::string& metric) { |
| 20 | if (metric == "l2") { |
| 21 | return rabitqlib::METRIC_L2; |
| 22 | } |
| 23 | if (metric == "ip" || metric == "innerproduct") { |
| 24 | return rabitqlib::METRIC_IP; |
| 25 | } |
| 26 | throw std::invalid_argument("Unsupported metric. Use 'l2' or 'ip'."); |
| 27 | } |
| 28 | |
| 29 | inline std::string metric_to_string(rabitqlib::MetricType metric) { |
| 30 | return metric == rabitqlib::METRIC_IP ? "ip" : "l2"; |
no outgoing calls
no test coverage detected