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_Expect
Class●Since v0.1

_Expect

A class for setting expectations on test results.

Copy
_Expect(
    self,
    *,
    client: Optional[ls_client.Client] = None,
)

Constructors

constructor
__init__
NameType
clientOptional[ls_client.Client]

Attributes

attribute
executor

Methods

method
embedding_distance

Compute the embedding distance between the prediction and reference.

This logs the embedding distance to LangSmith and returns a _Matcher instance for making assertions on the distance value.

By default, this uses the OpenAI API for computing embeddings.

method
edit_distance

Compute the string distance between the prediction and reference.

This logs the string distance (Damerau-Levenshtein) to LangSmith and returns a _Matcher instance for making assertions on the distance value.

This depends on the rapidfuzz package for string distance computation.

method
value

Create a _Matcher instance for making assertions on the given value.

method
score

Log a numeric score to LangSmith.

View source on GitHub