LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
    • Overview
    • Caches
    • Callbacks
    • Documents
    • Document loaders
    • Embeddings
    • Exceptions
    • Language models
    • Serialization
    • Output parsers
    • Prompts
    • Rate limiters
    • Retrievers
    • Runnables
    • Utilities
    • Vector stores
    MCP Adapters
    Standard Tests
    Text Splitters
    ⌘I

    LangChain Assistant

    Ask a question to get started

    Enter to send•Shift+Enter new line

    Menu

    OverviewCachesCallbacksDocumentsDocument loadersEmbeddingsExceptionsLanguage modelsSerializationOutput parsersPromptsRate limitersRetrieversRunnablesUtilitiesVector stores
    MCP Adapters
    Standard Tests
    Text Splitters
    Language
    Theme
    Pythonlangchain-corerunnablesbaseRunnablewith_types
    Methodā—Since v0.1

    with_types

    Copy
    with_types(
      self,
      *,
      input_type: type[Input] | None = None,
      output_type: type[Output
    View source on GitHub
    ]
    |
    None
    =
    None
    )
    ->
    Runnable
    [
    Input
    ,
    Output
    ]

    Parameters

    NameTypeDescription
    input_typetype[Input] | None
    Default:None
    output_typetype[Output] | None
    Default:None

    Bind input and output types to a Runnable, returning a new Runnable.

    The input type to bind to the Runnable.

    The output type to bind to the Runnable.