Skip to main content
Some users prefer to manage their datasets and run their experiments outside of LangSmith, but want to use the LangSmith UI to view the results. This is supported via our endpoint. This guide will show you how to upload evals using the REST API, using the requests library in Python as an example. However, the same principles apply to any language.

Request body schema

Uploading an experiment requires specifying the relevant high-level information for your experiment and dataset, along with the individual data for your examples and runs within the experiment. Each object in the results represents a “row” in the experiment - a single dataset example, along with an associated run. Note that dataset_id and dataset_name refer to your dataset identifier in your external system and will be used to group external experiments together in a single dataset. They should not refer to an existing dataset in LangSmith (unless that dataset was created via this endpoint). You may use the following schema to upload experiments to the /datasets/upload-experiment endpoint:
The response JSON will be a dict with keys experiment and dataset, each of which is an object that contains relevant information about the experiment and dataset that was created.

Considerations

You may upload multiple experiments to the same dataset by providing the same dataset_id or dataset_name between multiple calls. Your experiments will be grouped together under a single dataset, and you will be able to use the comparison view to compare results between experiments. Ensure that the start and end times of your individual rows are all between the start and end time of your experiment. You must provide either a dataset_id or a dataset_name. If you only provide an ID and the dataset does not yet exist, we will generate a name for you, and vice versa if you only provide a name. You may not upload experiments to a dataset that was not created via this endpoint. Uploading experiments is only supported for externally-managed datasets.

Example request

Below is an example of a simple call to the /datasets/upload-experiment. This is a basic example that just uses the most important fields as an illustration.
Below is the response received:
Note that the latency and feedback stats in the experiment results are null because the runs haven’t had a chance to be persisted yet, which may take a few seconds. If you save the experiment id and query again in a few seconds, you will see all the stats (although tokens/cost will still be null, because we don’t ask for this information in the request body).

View the experiment in the UI

Now, login to the UI and click on your newly-created dataset! You should see a single experiment: Uploaded experiments table Your examples will have been uploaded: Uploaded examples Clicking on your experiment will bring you to the comparison view: Uploaded experiment comparison view As you upload more experiments to your dataset, you will be able to compare the results and easily identify regressions in the comparison view.