LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • Client
  • AsyncClient
  • Run Helpers
  • Run Trees
  • Evaluation
  • Schemas
  • Utilities
  • Wrappers
  • Anonymizer
  • Testing
  • Expect API
  • Middleware
  • Pytest Plugin
  • Deployment SDK
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

OverviewClientAsyncClientRun HelpersRun TreesEvaluationSchemasUtilitiesWrappersAnonymizerTestingExpect APIMiddlewarePytest PluginDeployment SDK
Language
Theme
Pythonlangsmithevaluationstring_evaluatorStringEvaluator
Classā—Since v0.0

StringEvaluator

Copy
StringEvaluator()

Bases

RunEvaluatorBaseModel

Attributes

Methods

Inherited fromRunEvaluator

Methods

Maevaluate_run
—

Evaluate an example asynchronously.

Inherited fromBaseModel

Attributes

Amodel_fields_set: set[str]Amodel_config
View source on GitHub
: ConfigDict
Amodel_construct: construct

Methods

Mto_dict
—

Recursively generate a dictionary representation of the model, optionally specifying which fields to include or exclude.

Mto_json
—

Generates a JSON string representing this model as it would be received from or sent to the API (but with indentation).

MconstructMmodel_dump
—

Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump

Mmodel_dump_json
—

Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump_json

Classes

CConfig
attribute
evaluation_name: Optional[str]

The name evaluation, such as 'Accuracy' or 'Salience'.

attribute
input_key: str

The key in the run inputs to extract the input string.

attribute
prediction_key: str

The key in the run outputs to extra the prediction string.

attribute
answer_key: Optional[str]

The key in the example outputs the answer string.

attribute
grading_function: Callable[[str, str, Optional[str]], dict]

Function that grades the run output against the example output.

method
evaluate_run

Evaluate a single run.

Grades the run's string input, output, and optional answer.

.. deprecated:: 0.5.0

StringEvaluator is deprecated. Use openevals instead: https://github.com/langchain-ai/openevals