@@ -162,7 +162,9 @@ def __init__(
162162 progress_bar = progress_bar ,
163163 )
164164
165- @component .output_types (score = float , results = list [dict [str , Any ]])
165+ @component .output_types (
166+ score = float , individual_scores = list [float ], results = list [dict [str , Any ]], meta = list [dict [str , Any ]] | None
167+ )
166168 def run (self , ** inputs : Any ) -> dict [str , Any ]:
167169 """
168170 Run the LLM evaluator.
@@ -174,14 +176,17 @@ def run(self, **inputs: Any) -> dict[str, Any]:
174176 :returns:
175177 A dictionary with the following outputs:
176178 - `score`: Mean context relevance score over all the provided input questions.
179+ - `individual_scores`: A list of context relevance scores for each input question.
177180 - `results`: A list of dictionaries with `relevant_statements`, `score`, and `status` for each input
178181 context. `status` is `evaluated` for valid results and `error` for failed evaluations.
179182 """
180183 result = super (ContextRelevanceEvaluator , self ).run (** inputs ) # noqa: UP008
181184 # Post-process the raw results to calculate relevance metrics and scores
182185 return self ._postprocess_results (result )
183186
184- @component .output_types (score = float , results = list [dict [str , Any ]])
187+ @component .output_types (
188+ score = float , individual_scores = list [float ], results = list [dict [str , Any ]], meta = list [dict [str , Any ]] | None
189+ )
185190 async def run_async (self , ** inputs : Any ) -> dict [str , Any ]:
186191 """
187192 Run the LLM evaluator asynchronously.
@@ -193,6 +198,7 @@ async def run_async(self, **inputs: Any) -> dict[str, Any]:
193198 :returns:
194199 A dictionary with the following outputs:
195200 - `score`: Mean context relevance score over all the provided input questions.
201+ - `individual_scores`: A list of context relevance scores for each input question.
196202 - `results`: A list of dictionaries with `relevant_statements`, `score`, and `status` for each input
197203 context. `status` is `evaluated` for valid results and `error` for failed evaluations.
198204 """
0 commit comments