Skip to content
masterclass Buddy

LangSmith · Function

expect

LangSmith's expect API makes approximate checks on pytest test results. It can compare predictions with references, check values directly, and record expectation feedback.

Last updated

Since
v0.5

Syntax

expect.edit_distance(prediction=..., reference=...).to_be_less_than(...)
expect.value(value).to_contain(...)
expect.value(value).against(check)

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • expect.embedding_distance
  • expect.edit_distance
  • expect.value
  • to_be_less_than
  • to_contain
  • against

Source: _expect | langsmith | LangChain Reference. Checked 2026-11-03.