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

    Chat LangChain

    What can I help with?

    Enter to send·Shift+Enter new line

    Menu

    OverviewCachesCallbacksDocumentsDocument loadersEmbeddingsExceptionsLanguage modelsSerializationOutput parsersPromptsRate limitersRetrieversRunnablesUtilitiesVector stores
    MCP Adapters
    Standard Tests
    Text Splitters
    Language
    Theme
    Pythonlangchain-coreexceptionsModelRefusalErrorfrom_refusal
    Method●Since v1.7

    from_refusal

    Copy
    from_refusal(
      cls,
      refusal: RefusalContentBlock,
      *,
      raw_message: BaseMessage
    ) -> ModelRefusalError
    View source on GitHub

    Parameters

    NameTypeDescription
    refusal*RefusalContentBlock

    The refusal block from the response's content_blocks.

    raw_message*BaseMessage

    The model response that contained the refusal.

    Create a ModelRefusalError from a standard refusal block.