npx skills add ...
npx skills add langchain-ai/langsmith-skills --skill langsmith-dataset
INVOKE THIS SKILL when creating evaluation datasets, uploading datasets to LangSmith, or managing existing datasets. Covers dataset types (final_response, single_step, trajectory, RAG), CLI management commands, SDK-based creation, and example management. Uses the langsmith CLI tool.
npx skills add langchain-ai/langsmith-skills --skill langsmith-dataset
Authentication is REQUIRED: either set the LANGSMITH_API_KEY environment variable, or pass the --api-key flag to CLI commands (preferred):
IMPORTANT: Always check the environment variables or .env file for LANGSMITH_PROJECT before querying or interacting with LangSmith. This tells you which project contains the relevant traces and data. If the LangSmith project is not available, use your best judgement to identify the right one.
Python Dependencies
JavaScript Dependencies
CLI Tool
langsmith dataset list - List datasets in LangSmithlangsmith dataset get <name-or-id> - View dataset detailslangsmith dataset create --name <name> - Create a new empty datasetlangsmith dataset delete <name-or-id> - Delete a datasetlangsmith dataset export <name-or-id> <output-file> - Export dataset to local JSON filelangsmith dataset upload <file> --name <name> - Upload a local JSON file as a datasetlangsmith example list --dataset <name> - List examples in a datasetlangsmith example create --dataset <name> --inputs <json> - Add an example to a datasetlangsmith example delete <example-id> - Delete an examplelangsmith experiment list --dataset <name> - List experiments for a datasetlangsmith experiment get <name> - View experiment results--limit N - Limit number of results--yes - Skip confirmation prompts (use with caution)IMPORTANT - Safety Prompts:
--yes unless the user explicitly requests it--yes to skip confirmation prompts<dataset_types_overview> Common evaluation dataset types:
<creating_datasets>
Datasets are JSON files with an array of examples. Each example has inputs and outputs.
Export traces first, then process them into dataset format using code:
client = Client()
examples = [] for jsonl_file in Path("./traces").glob("*.jsonl"): runs = [json.loads(line) for line in jsonl_file.read_text().strip().split("\n")] root = next((r for r in runs if r.get("parent_run_id") is None), None) if root and root.get("inputs") and root.get("outputs"): examples.append({ "trace_id": root.get("trace_id"), "inputs": root["inputs"], "outputs": root["outputs"] })
with open("/tmp/dataset.json", "w") as f: json.dump(examples, f, indent=2)
client = Client()
dataset = client.create_dataset("My Dataset", description="Evaluation dataset")
client.create_examples( inputs=[{"query": "What is AI?"}, {"query": "Explain RAG"}], outputs=[{"answer": "AI is..."}, {"answer": "RAG is..."}], dataset_name="My Dataset", )
<dataset_structures>
</dataset_structures>
<script_usage>
</script_usage>
<example_workflow> Complete workflow from traces to uploaded LangSmith dataset:
</example_workflow>
**Dataset upload fails:** - Verify LANGSMITH_API_KEY is set - Check JSON file is valid: each element needs `inputs` (and optionally `outputs`) - Dataset name must be unique, or delete existing first with `langsmith dataset delete`Empty dataset after upload:
inputs keylangsmith example list --dataset "Name"Export has no data:
--full flag to include inputs/outputsinputs and outputs populatedExample count mismatch:
langsmith dataset get "Name" to check remote count