{"record":{"id":"6ecb5782bb9c8cad","repo":"run-llama/llama_index","slug":"query-and-response-must-be-provided-6ecb57","errorCode":null,"errorMessage":"query and response must be provided","messagePattern":"query and response must be provided","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"llama-index-core/llama_index/core/evaluation/guideline.py","lineNumber":101,"sourceCode":"\n    def _update_prompts(self, prompts: PromptDictType) -> None:\n        \"\"\"Update prompts.\"\"\"\n        if \"eval_template\" in prompts:\n            self._eval_template = prompts[\"eval_template\"]\n\n    async def aevaluate(\n        self,\n        query: Optional[str] = None,\n        response: Optional[str] = None,\n        contexts: Optional[Sequence[str]] = None,\n        sleep_time_in_seconds: int = 0,\n        **kwargs: Any,\n    ) -> EvaluationResult:\n        \"\"\"Evaluate whether the query and response pair passes the guidelines.\"\"\"\n        del contexts  # Unused\n        del kwargs  # Unused\n        if query is None or response is None:\n            raise ValueError(\"query and response must be provided\")\n\n        logger.debug(\"prompt: %s\", self._eval_template)\n        logger.debug(\"query: %s\", query)\n        logger.debug(\"response: %s\", response)\n        logger.debug(\"guidelines: %s\", self._guidelines)\n\n        await asyncio.sleep(sleep_time_in_seconds)\n\n        eval_response = await self._llm.apredict(\n            self._eval_template,\n            query=query,\n            response=response,\n            guidelines=self._guidelines,\n        )\n        eval_data = self._output_parser.parse(eval_response)\n        eval_data = cast(EvaluationData, eval_data)\n\n        return EvaluationResult(","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/run-llama/llama_index/blob/afd0fef371831f9bda13e5af7167cf4e981278ab/llama-index-core/llama_index/core/evaluation/guideline.py#L83-L119","documentation":"Thrown by GuidelineEvaluator.aevaluate when query or response is None (contexts is discarded). The evaluator formats the guideline prompt with the query/response pair, so both are required before the LLM call.","triggerScenarios":"Calling await evaluator.aevaluate(query=q, response=None) or with a missing query; via BatchRunner where per-item responses can be None (failed generations) and are forwarded as-is.","commonSituations":"Batch pipelines where some queries produced no answer; stringifying a None response object; datasets with empty answer fields passed without cleaning.","solutions":["Ensure both query and response are non-None strings at the call site.","Filter batch items first: skip pairs where either side is missing instead of evaluating them.","Log and count skipped items so silent data gaps become visible."],"exampleFix":"# before\nresult = await evaluator.aevaluate(query=q, response=resp)  # resp None for failed gens\n\n# after\nif q and resp:\n    result = await evaluator.aevaluate(query=q, response=str(resp))\nelse:\n    skipped.append(q)","handlingStrategy":"validation","validationCode":"if not (query and response):\n    return None\nresult = await evaluator.aevaluate(query=query, response=str(response))","typeGuard":"def guideline_evaluable(query, response) -> bool:\n    return query is not None and response is not None","tryCatchPattern":null,"preventionTips":["Filter (query, response) pairs before batch evaluation; count and log skipped items.","Coerce responses with str() at the boundary so None never reaches the evaluator."],"tags":["evaluation","guideline","input-validation"],"backgroundTag":null,"analyzedSha":"afd0fef371831f9bda13e5af7167cf4e981278ab","analyzedAt":"2026-08-15T05:42:58.429Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}