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-coretoolsbasecreate_schema_from_function
    Functionā—Since v0.2

    create_schema_from_function

    Copy
    create_schema_from_function(
      model_name: str,
      func: Callable,
      *,
      filter_args: Sequence[str
    View source on GitHub
    ]
    |
    None
    =
    None
    ,
    parse_docstring
    :
    bool
    =
    False
    ,
    error_on_invalid_docstring
    :
    bool
    =
    False
    ,
    include_injected
    :
    bool
    =
    True
    )
    ->
    type
    [
    BaseModel
    ]

    Parameters

    NameTypeDescription
    model_name*str

    Name to assign to the generated Pydantic schema.

    func*Callable

    Function to generate the schema from.

    filter_argsSequence[str] | None
    Default:None

    Optional list of arguments to exclude from the schema.

    Defaults to FILTERED_ARGS.

    parse_docstringbool
    Default:False
    error_on_invalid_docstringbool
    Default:False
    include_injectedbool
    Default:True

    Create a Pydantic schema from a function's signature.

    Whether to parse the function's docstring for descriptions for each argument.

    If parse_docstring is provided, configure whether to raise ValueError on invalid Google Style docstrings.

    Whether to include injected arguments in the schema.

    Defaults to True, since we want to include them in the schema when validating tool inputs.