From f88755eb93147741e9a126a520117e5147157e3f Mon Sep 17 00:00:00 2001 From: Xi Yan Date: Wed, 12 Mar 2025 01:16:03 -0700 Subject: [PATCH] scoring job --- llama_stack/apis/scoring/scoring.py | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/llama_stack/apis/scoring/scoring.py b/llama_stack/apis/scoring/scoring.py index d442d21d7..fec7f9d86 100644 --- a/llama_stack/apis/scoring/scoring.py +++ b/llama_stack/apis/scoring/scoring.py @@ -68,15 +68,15 @@ class ScoringFunctionStore(Protocol): class Scoring(Protocol): scoring_function_store: ScoringFunctionStore - @webmethod(route="/scoring/score-batch", method="POST") - async def score_batch( + @webmethod(route="/scoring/jobs", method="POST") + async def score_dataset( self, dataset_id: str, scoring_functions: List[ScoringFnParams], ) -> ScoringJob: ... - @webmethod(route="/scoring/score", method="POST") - async def score( + @webmethod(route="/scoring/rows", method="POST") + async def score_rows( self, input_rows: List[Dict[str, Any]], scoring_functions: List[ScoringFnParams], @@ -88,3 +88,20 @@ class Scoring(Protocol): :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. + """ + ...