# create_tagging_chain_pydantic

> **Function** in `langchain_classic`

📖 [View in docs](https://reference.langchain.com/python/langchain-classic/chains/openai_functions/tagging/create_tagging_chain_pydantic)

Create tagging chain from Pydantic schema.

Create a chain that extracts information from a passage
based on a Pydantic schema.

This function is deprecated. Please use `with_structured_output` instead.
See example usage below:

```python
from pydantic import BaseModel, Field
from langchain_anthropic import ChatAnthropic

class Joke(BaseModel):
    setup: str = Field(description="The setup of the joke")
    punchline: str = Field(description="The punchline to the joke")

# Or any other chat model that supports tools.
# Please reference to the documentation of structured_output
# to see an up to date list of which models support
# with_structured_output.
model = ChatAnthropic(model="claude-opus-4-1-20250805", temperature=0)
structured_model = model.with_structured_output(Joke)
structured_model.invoke(
    "Why did the cat cross the road? To get to the other "
    "side... and then lay down in the middle of it!"
)
```

Read more here: https://docs.langchain.com/oss/python/langchain/structured-output

## Signature

```python
create_tagging_chain_pydantic(
    pydantic_schema: Any,
    llm: BaseLanguageModel,
    prompt: ChatPromptTemplate | None = None,
    **kwargs: Any = {},
) -> Chain
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `pydantic_schema` | `Any` | Yes | The Pydantic schema of the entities to extract. |
| `llm` | `BaseLanguageModel` | Yes | The language model to use. |
| `prompt` | `ChatPromptTemplate \| None` | No | The prompt template to use for the chain. (default: `None`) |
| `kwargs` | `Any` | No | Additional keyword arguments to pass to the chain. (default: `{}`) |

## Returns

`Chain`

Chain (`LLMChain`) that can be used to extract information from a passage.

## ⚠️ Deprecated

Deprecated since version 0.2.13. Use ChatModel.with_structured_output(...) instead. Will be removed in version 2.0.0. Available on chat models capable of tool calling. See https://docs.langchain.com/oss/python/langchain/structured-output

---

[View source on GitHub](https://github.com/langchain-ai/langchain/blob/42f8f79293cfb7589e5bc1d74a8ae4dfd0bf15e3/libs/langchain/langchain_classic/chains/openai_functions/tagging.py#L106)