LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • MCP Adapters
    Standard Tests
    Text Splitters
    • Overview
    • Agents
    • Callbacks
    • Chains
    • Chat models
    • Embeddings
    • Evaluation
    • Globals
    • Hub
    • Memory
    • Output parsers
    • Retrievers
    • Runnables
    • LangSmith
    • Storage
    ⌘I

    LangChain Assistant

    Ask a question to get started

    Enter to send•Shift+Enter new line

    Menu

    MCP Adapters
    Standard Tests
    Text Splitters
    OverviewAgentsCallbacksChainsChat modelsEmbeddingsEvaluationGlobalsHubMemoryOutput parsersRetrieversRunnablesLangSmithStorage
    Language
    Theme
    Pythonlangchain-classicevaluationexact_matchbaseExactMatchStringEvaluator
    Class●Since v1.0

    ExactMatchStringEvaluator

    Copy
    ExactMatchStringEvaluator(
      self,
      *,
      ignore_case: bool = False,
      ignore_punctuation: bool = False,
      

    Bases

    StringEvaluator

    Constructors

    Attributes

    Inherited fromStringEvaluator

    Methods

    Mevaluate_strings
    —

    Evaluate Chain or LLM output, based on optional input and label.

    Maevaluate_strings
    —

    Asynchronously evaluate Chain or LLM output, based on optional input and label.

    View source on GitHub
    ignore_numbers
    :
    bool
    =
    False
    ,
    **
    _
    :
    Any
    =
    {
    }
    )

    Parameters

    NameTypeDescription
    ignore_casebool
    Default:False
    ignore_punctuationbool
    Default:False
    ignore_numbersbool
    Default:False
    constructor
    __init__
    NameType
    ignore_casebool
    ignore_punctuationbool
    ignore_numbersbool
    attribute
    ignore_case: ignore_case
    attribute
    ignore_punctuation: ignore_punctuation
    attribute
    ignore_numbers: ignore_numbers
    attribute
    requires_input: bool
    attribute
    requires_reference: bool
    attribute
    input_keys: list[str]
    attribute
    evaluation_name: str

    Compute an exact match between the prediction and the reference.

    Examples:

    evaluator = ExactMatchChain() evaluator.evaluate_strings( prediction="Mindy is the CTO", reference="Mindy is the CTO", ) # This will return {'score': 1.0}

    evaluator.evaluate_strings( prediction="Mindy is the CTO", reference="Mindy is the CEO", ) # This will return {'score': 0.0}

    Whether to ignore case when comparing strings.

    Whether to ignore punctuation when comparing strings.

    Whether to ignore numbers when comparing strings.

    This evaluator does not require input.

    This evaluator requires a reference.

    Get the input keys.

    Get the evaluation name.