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
Pythonlangsmith_expect_Expectscore
Method●Since v0.1

score

Log a numeric score to LangSmith.

Copy
score(
  self,
  score: Union[float, int, bool],
  *,
  key: str = 'score',
  source_run_id: Optional[ls_client.ID_TYPE] = None,
  comment: Optional[str] = None
) -> _Matcher

Example:

expect.score(0.8)  # doctest: +ELLIPSIS
<langsmith._expect._Matcher object at ...>

expect.score(0.8, key="similarity").to_be_greater_than(0.7)

Parameters

NameTypeDescription
score*Union[float, int, bool]

The score value to log.

keystr
Default:'score'

The key to use for logging the score. Defaults to 'score'.

View source on GitHub