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
PythonlangsmithclientClientcreate_example
Methodā—Since v0.0

create_example

Create a dataset example in the LangSmith API.

Examples are rows in a dataset, containing the inputs and expected outputs (or other reference information) for a model or chain.

Copy
create_example(
  self,
  inputs: Optional[Mapping[str, Any]] = None,
  dataset_id: Optional[ID_TYPE] = None,
  dataset_name: Optional[str] = None,
  created_at: Optional[datetime.datetime] = None,
  outputs: Optional[Mapping[str, Any]] = None,
  metadata: Optional[Mapping[str, Any]] = None,
  split: Optional[str | list[str]] = None,
  example_id: Optional[ID_TYPE] = None,
  source_run_id: Optional[ID_TYPE] = None,
  use_source_run_io: bool = False,
  use_source_run_attachments: Optional[list[str]] = None,
  attachments: Optional[ls_schemas.Attachments] = None
) -> ls_schemas.Example

Parameters

NameTypeDescription
inputsMapping[str, Any]
Default:None

The input values for the example.

dataset_idOptional[Union[UUID, str]]
Default:None

The ID of the dataset to create the example in.

dataset_nameOptional[str]
Default:None

The name of the dataset to create the example in.

created_atOptional[datetime.datetime]
Default:None

The creation timestamp of the example.

outputsOptional[Mapping[str, Any]]
Default:None

The output values for the example.

metadataOptional[Mapping[str, Any]]
Default:None

The metadata for the example.

splitOptional[str | List[str]]
Default:None

The splits for the example, which are divisions of your dataset such as 'train', 'test', or 'validation'.

example_idOptional[Union[UUID, str]]
Default:None

The ID of the example to create. If not provided, a new example will be created.

source_run_idOptional[Union[UUID, str]]
Default:None

The ID of the source run associated with this example.

use_source_run_iobool
Default:False

Whether to use the inputs, outputs, and attachments from the source run.

use_source_run_attachmentsOptional[List[str]]
Default:None

Which attachments to use from the source run. If use_source_run_io is True, all attachments will be used regardless of this param.

attachmentsOptional[Attachments]
Default:None

The attachments for the example.

View source on GitHub