| 8 | namespace python { |
| 9 | |
| 10 | void register_scoring_result(py::module& m) { |
| 11 | py::class_<ScoringResult>(m, "ScoringResult", "A scoring result.") |
| 12 | |
| 13 | .def_readonly("tokens", &ScoringResult::tokens, |
| 14 | "The scored tokens.") |
| 15 | .def_readonly("log_probs", &ScoringResult::tokens_score, |
| 16 | "Log probability of each token") |
| 17 | |
| 18 | .def("__repr__", [](const ScoringResult& result) { |
| 19 | return "ScoringResult(tokens=" + std::string(py::repr(py::cast(result.tokens))) |
| 20 | + ", log_probs=" + std::string(py::repr(py::cast(result.tokens_score))) |
| 21 | + ")"; |
| 22 | }) |
| 23 | ; |
| 24 | |
| 25 | declare_async_wrapper<ScoringResult>(m, "AsyncScoringResult"); |
| 26 | } |
| 27 | |
| 28 | } |
| 29 | } |
no test coverage detected