# LLMChain

> **Class** in `langchain_classic`

📖 [View in docs](https://reference.langchain.com/python/langchain-classic/chains/llm/LLMChain)

Chain to run queries against LLMs.

This class is deprecated. See below for an example implementation using
LangChain runnables:

    ```python
    from langchain_core.output_parsers import StrOutputParser
    from langchain_core.prompts import PromptTemplate
    from langchain_openai import OpenAI

    prompt_template = "Tell me a {adjective} joke"
    prompt = PromptTemplate(input_variables=["adjective"], template=prompt_template)
    model = OpenAI()
    chain = prompt | model | StrOutputParser()

    chain.invoke("your adjective here")
    ```

## Signature

```python
LLMChain()
```

## Description

**Example:**

```python
from langchain_classic.chains import LLMChain
from langchain_openai import OpenAI
from langchain_core.prompts import PromptTemplate

prompt_template = "Tell me a {adjective} joke"
prompt = PromptTemplate(input_variables=["adjective"], template=prompt_template)
model = LLMChain(llm=OpenAI(), prompt=prompt)
```

## Extends

- `Chain`

## Properties

- `prompt`
- `llm`
- `output_key`
- `output_parser`
- `return_final_only`
- `llm_kwargs`
- `model_config`
- `input_keys`
- `output_keys`

## Methods

- [`is_lc_serializable()`](https://reference.langchain.com/python/langchain-classic/chains/llm/LLMChain/is_lc_serializable)
- [`generate()`](https://reference.langchain.com/python/langchain-classic/chains/llm/LLMChain/generate)
- [`agenerate()`](https://reference.langchain.com/python/langchain-classic/chains/llm/LLMChain/agenerate)
- [`prep_prompts()`](https://reference.langchain.com/python/langchain-classic/chains/llm/LLMChain/prep_prompts)
- [`aprep_prompts()`](https://reference.langchain.com/python/langchain-classic/chains/llm/LLMChain/aprep_prompts)
- [`apply()`](https://reference.langchain.com/python/langchain-classic/chains/llm/LLMChain/apply)
- [`aapply()`](https://reference.langchain.com/python/langchain-classic/chains/llm/LLMChain/aapply)
- [`create_outputs()`](https://reference.langchain.com/python/langchain-classic/chains/llm/LLMChain/create_outputs)
- [`predict()`](https://reference.langchain.com/python/langchain-classic/chains/llm/LLMChain/predict)
- [`apredict()`](https://reference.langchain.com/python/langchain-classic/chains/llm/LLMChain/apredict)
- [`predict_and_parse()`](https://reference.langchain.com/python/langchain-classic/chains/llm/LLMChain/predict_and_parse)
- [`apredict_and_parse()`](https://reference.langchain.com/python/langchain-classic/chains/llm/LLMChain/apredict_and_parse)
- [`apply_and_parse()`](https://reference.langchain.com/python/langchain-classic/chains/llm/LLMChain/apply_and_parse)
- [`aapply_and_parse()`](https://reference.langchain.com/python/langchain-classic/chains/llm/LLMChain/aapply_and_parse)
- [`from_string()`](https://reference.langchain.com/python/langchain-classic/chains/llm/LLMChain/from_string)

## ⚠️ Deprecated

Deprecated since version 0.1.17.

---

[View source on GitHub](https://github.com/langchain-ai/langchain/blob/b302691ff9ad841804e93e5addbdc53b6974473b/libs/langchain/langchain_classic/chains/llm.py#L40)