{"record":{"id":"d318a89f09c070d3","repo":"run-llama/llama_index","slug":"stream-call-is-only-supported-for-llms","errorCode":null,"errorMessage":"stream_call is only supported for LLMs.","messagePattern":"stream_call is only supported for LLMs\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"llama-index-core/llama_index/core/program/function_program.py","lineNumber":327,"sourceCode":"                    \"Multiple outputs found, returning first one. \"\n                    \"If you want to return all outputs, set output_multiple=True.\"\n                )\n            return new_cur_objects[0]\n\n    def stream_call(\n        self, *args: Any, llm_kwargs: Optional[Dict[str, Any]] = None, **kwargs: Any\n    ) -> Generator[\n        Union[Model, List[Model], FlexibleModel, List[FlexibleModel]], None, None\n    ]:\n        \"\"\"\n        Stream object.\n\n        Returns a generator returning partials of the same object\n        or a list of objects until it returns.\n        \"\"\"\n        # TODO: we can extend this to non-function calling LLMs as well, coming soon\n        if not isinstance(self._llm, FunctionCallingLLM):\n            raise ValueError(\"stream_call is only supported for LLMs.\")\n\n        # avoid passing in duplicate kwargs\n        llm_kwargs = llm_kwargs or {}\n        llm_kwargs.pop(\"tool_required\", None)\n        llm_kwargs.pop(\"tool_choice\", None)\n        llm_kwargs.pop(\"allow_parallel_tool_calls\", None)\n\n        tool = get_function_tool(self._output_cls)\n\n        messages = self._prompt.format_messages(llm=self._llm, **kwargs)\n        messages = self._llm._extend_messages(messages)\n\n        chat_response_gen = self._llm.stream_chat_with_tools(\n            [tool],\n            chat_history=messages,\n            verbose=self._verbose,\n            allow_parallel_tool_calls=self._allow_parallel_tool_calls,\n            tool_choice=self._tool_choice,","sourceCodeStart":309,"sourceCodeEnd":345,"githubUrl":"https://github.com/run-llama/llama_index/blob/afd0fef371831f9bda13e5af7167cf4e981278ab/llama-index-core/llama_index/core/program/function_program.py#L309-L345","documentation":"Error \"stream_call is only supported for LLMs.\" thrown in run-llama/llama_index.","triggerScenarios":"Thrown at llama-index-core/llama_index/core/program/function_program.py:327 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Call stream_call only with an LLM-based program.","Use the non-streaming call path for non-LLM programs."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"afd0fef371831f9bda13e5af7167cf4e981278ab","analyzedAt":"2026-08-15T05:42:58.429Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}