scoring job

This commit is contained in:
Xi Yan 2025-03-12 01:16:03 -07:00
parent 5f330c3971
commit f88755eb93

View file

@ -68,15 +68,15 @@ class ScoringFunctionStore(Protocol):
class Scoring(Protocol): class Scoring(Protocol):
scoring_function_store: ScoringFunctionStore scoring_function_store: ScoringFunctionStore
@webmethod(route="/scoring/score-batch", method="POST") @webmethod(route="/scoring/jobs", method="POST")
async def score_batch( async def score_dataset(
self, self,
dataset_id: str, dataset_id: str,
scoring_functions: List[ScoringFnParams], scoring_functions: List[ScoringFnParams],
) -> ScoringJob: ... ) -> ScoringJob: ...
@webmethod(route="/scoring/score", method="POST") @webmethod(route="/scoring/rows", method="POST")
async def score( async def score_rows(
self, self,
input_rows: List[Dict[str, Any]], input_rows: List[Dict[str, Any]],
scoring_functions: List[ScoringFnParams], scoring_functions: List[ScoringFnParams],
@ -88,3 +88,20 @@ class Scoring(Protocol):
:return: ScoreResponse object containing rows and aggregated results :return: ScoreResponse object containing rows and aggregated results
""" """
... ...
@webmethod(route="/scoring/jobs/{job_id}", method="GET")
async def get_job(self, job_id: str) -> Optional[ScoringJob]:
"""Get the ScoringJob object for a given job id.
:param job_id: The ID of the job to get the status of.
:return: ScoringJob object indicating its status
"""
...
@webmethod(route="/scoring/jobs/{job_id}", method="DELETE")
async def cancel_job(self, job_id: str) -> None:
"""Cancel a job.
:param job_id: The ID of the job to cancel.
"""
...