diff --git a/langfuse/_client/client.py b/langfuse/_client/client.py index f8267ea45..42d861fd4 100644 --- a/langfuse/_client/client.py +++ b/langfuse/_client/client.py @@ -3272,7 +3272,7 @@ def run_batched_evaluation( resume_from: Optional[BatchEvaluationResumeToken] = None, verbose: bool = False, ) -> BatchEvaluationResult: - """Fetch traces or observations and run evaluations on each item. + """Fetch traces or observations using legacy read APIs and evaluate each item. This method provides a powerful way to evaluate existing data in Langfuse at scale. It fetches items based on filters, transforms them using a mapper function, runs @@ -3288,6 +3288,11 @@ def run_batched_evaluation( it memory-efficient for large datasets. It includes comprehensive error handling, retry logic, and resume capability for long-running evaluations. + Legacy platform compatibility: + This method reads traces from `GET /api/public/traces` and observations + from the legacy `GET /api/public/observations` endpoint. It is supported + with Langfuse platform v3 and is not yet supported with platform v4. + Args: scope: The type of items to evaluate. Must be one of: - "traces": Evaluate complete traces with all their observations diff --git a/langfuse/batch_evaluation.py b/langfuse/batch_evaluation.py index b75f0b3d2..723b45757 100644 --- a/langfuse/batch_evaluation.py +++ b/langfuse/batch_evaluation.py @@ -855,12 +855,16 @@ async def run_async( verbose: bool = False, resume_from: Optional[BatchEvaluationResumeToken] = None, ) -> BatchEvaluationResult: - """Run batch evaluation asynchronously. + """Run batch evaluation asynchronously using legacy read APIs. This is the main implementation method that orchestrates the entire batch evaluation process: fetching items, mapping, evaluating, creating scores, and tracking statistics. + This runner reads traces from `GET /api/public/traces` and observations + from the legacy `GET /api/public/observations` endpoint. It is supported + with Langfuse platform v3 and is not yet supported with platform v4. + Args: scope: The type of items to evaluate ("traces", "observations"). mapper: Function to transform API response items to evaluator inputs.