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
PythonlangsmithclientClientupload_csv
Method●Since v0.0

upload_csv

Copy
upload_csv(
  self,
  csv_file: Union[str, tuple[str, io.BytesIO], tuple[str
View source on GitHub
,
io
.
BytesIO
,
str
]
]
,
input_keys
:
Sequence
[
str
]
,
output_keys
:
Sequence
[
str
]
,
*
,
name
:
Optional
[
str
]
=
None
,
description
:
Optional
[
str
]
=
None
,
data_type
:
Optional
[
ls_schemas
.
DataType
]
=
ls_schemas
.
DataType
.
kv
)
->
ls_schemas
.
Dataset

Parameters

NameTypeDescription
csv_file*Union[str, tuple[str, io.BytesIO], tuple[str, io.BytesIO, str]]
input_keys*Sequence[str]
output_keys*Sequence[str]
nameOptional[str]
Default:None
descriptionOptional[str]
Default:None
data_typeOptional[ls_schemas.DataType]
Default:ls_schemas.DataType.kv

Upload a CSV file to the LangSmith API.

Example:

from langsmith import Client
import os

client = Client()

csv_file = "path/to/your/myfile.csv"
input_keys = ["column1", "column2"]  # replace with your input column names
output_keys = ["output1", "output2"]  # replace with your output column names

dataset = client.upload_csv(
    csv_file=csv_file,
    input_keys=input_keys,
    output_keys=output_keys,
    name="My CSV Dataset",
    description="Dataset created from a CSV file",
    data_type="kv",  # The default
)

The CSV file to upload.

If a string, it should be the path.

If a tuple, it should be a tuple containing the filename and a BytesIO object.

The input keys.

The output keys.

The name of the dataset.

The description of the dataset.

The data type of the dataset.