Do LLMs Have the Generalization Ability in Conducting Causal Inference?