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

similar_examples

Retrieve the dataset examples whose inputs best match the current inputs.

Note

Must have few-shot indexing enabled for the dataset. See client.index_dataset().

Copy
similar_examples(
  self,
  inputs: dict,
  ,
  *,
  limit: int,
  dataset_id: ls_client.ID_TYPE,
  filter: Optional[str] = None,
  **kwargs: Any = {}
) -> list[ls_schemas.ExampleSearch]

Parameters

NameTypeDescription
inputs*dict

The inputs to use as a search query.

Must match the dataset input schema.

Must be JSON serializable.

limit*int

The maximum number of examples to return.

dataset_id*Union[UUID, str]

The ID of the dataset to search over.

filterOptional[str]
Default:None

A filter string to apply to the search results.

Uses the same syntax as the filter parameter in list_runs().

Only a subset of operations are supported.

kwargsAny
Default:{}

Additional keyword args to pass as part of request body.

View source on GitHub