langchain/llms/base.py/LLM/_generate
class LLM:    def _generate(
        self,
        prompts: List[str],
        stop: Optional[List[str]] = None,
        run_manager: Optional[CallbackManagerForLLMRun] = None,
    ) -> LLMResult:
        """Run the LLM on the given prompt and input."""
        # TODO: add caching here.
        generations = []
        new_arg_supported = inspect.signature(self._call).parameters.get("run_manager")
        for prompt in prompts:
            text = (
                self._call(prompt, stop=stop, run_manager=run_manager)
                if new_arg_supported
                else self._call(prompt, stop=stop)
            )
            generations.append([Generation(text=text)])
        return LLMResult(generations=generations)