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

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

Parameters

NameTypeDescription
score*Union[float, int, bool]
keystr
Default:'score'

Log a numeric score to LangSmith.

Example:

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

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

The score value to log.

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