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
  • RemoteGraph
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

OverviewClientAsyncClientRun HelpersRun TreesEvaluationSchemasUtilitiesWrappersAnonymizerTestingExpect APIMiddlewarePytest PluginDeployment SDKRemoteGraph
Language
Theme
Pythonlangsmithevaluationstring_evaluatorStringEvaluator
Class●Since v0.0

StringEvaluator

Copy
StringEvaluator()

Bases

RunEvaluatorBaseModel

Attributes

Methods

Inherited fromRunEvaluator

Methods

Maevaluate_run
—

Evaluate a run asynchronously.

View source on GitHub
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