# create_structured_runnable

> **Function** in `langchain_google_vertexai`

📖 [View in docs](https://reference.langchain.com/python/langchain-google-vertexai/chains/create_structured_runnable)

Create a runnable sequence that uses OpenAI functions.

## Signature

```python
create_structured_runnable(
    function: type[BaseModel] | Sequence[type[BaseModel]],
    llm: Runnable,
    *,
    prompt: BasePromptTemplate | None = None,
    use_extra_step: bool = False,
) -> Runnable
```

## Description

**Example:**

```python
from typing import Optional

from langchain_google_vertexai import ChatVertexAI, create_structured_runnable
from langchain_core.prompts import ChatPromptTemplate
from pydantic import BaseModel, Field

class RecordPerson(BaseModel):
    """Record some identifying information about a person."""

    name: str = Field(..., description="The person's name")
    age: int = Field(..., description="The person's age")
    fav_food: Optional[str] = Field(None, description="The person's favorite food")

class RecordDog(BaseModel):
    """Record some identifying information about a dog."""

    name: str = Field(..., description="The dog's name")
    color: str = Field(..., description="The dog's color")
    fav_food: Optional[str] = Field(None, description="The dog's favorite food")

llm = ChatVertexAI(model="gemini-2.5-flash")
prompt = ChatPromptTemplate.from_template("""
You are a world class algorithm for recording entities.
Make calls to the relevant function to record the entities in the following input: {input}
Tip: Make sure to answer in the correct format"""
                            )
chain = create_structured_runnable([RecordPerson, RecordDog], llm, prompt=prompt)
chain.invoke({"input": "Harry was a chubby brown beagle who loved chicken"})
# -> RecordDog(name="Harry", color="brown", fav_food="chicken")
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `function` | `type[BaseModel] \| Sequence[type[BaseModel]]` | Yes | Either a single `pydantic.BaseModel` class or a sequence of `pydantic.BaseModels` classes. For best results, `pydantic.BaseModels` should have descriptions of the parameters. |
| `llm` | `Runnable` | Yes | Language model to use, assumed to support the Google Vertex function-calling API. |
| `prompt` | `BasePromptTemplate \| None` | No | `BasePromptTemplate` to pass to the model. (default: `None`) |
| `use_extra_step` | `bool` | No | Whether to make an extra step to parse output into a function. (default: `False`) |

## Returns

`Runnable`

A `Runnable` sequence that will pass in the given functions to the model when run.

## ⚠️ Deprecated

Deprecated since version 3.2.1. Use with_structured_output instead. Will be removed in version 3.2.2.

---

[View source on GitHub](https://github.com/langchain-ai/langchain-google/blob/4519f3c4b7fb2bb93f13ca48d35c423b6afd3b03/libs/vertexai/langchain_google_vertexai/chains.py#L88)