from langsmith import Clientexamples = [ { "inputs": {"question": "What is the largest mammal?"}, "outputs": {"answer": "The blue whale"}, "metadata": {"source": "Wikipedia"}, }, { "inputs": {"question": "What do mammals and birds have in common?"}, "outputs": {"answer": "They are both warm-blooded"}, "metadata": {"source": "Wikipedia"}, }, { "inputs": {"question": "What are reptiles known for?"}, "outputs": {"answer": "Having scales"}, "metadata": {"source": "Wikipedia"}, }, { "inputs": {"question": "What's the main characteristic of amphibians?"}, "outputs": {"answer": "They live both in water and on land"}, "metadata": {"source": "Wikipedia"}, },]client = Client()dataset_name = "Elementary Animal Questions"# Storing inputs in a dataset lets us# run chains and LLMs over a shared set of examples.dataset = client.create_dataset( dataset_name=dataset_name, description="Questions and answers about animal phylogenetics.",)# Prepare inputs, outputs, and metadata for bulk creationclient.create_examples( dataset_id=dataset.id, examples=examples)
from langsmith import Clientclient = Client()dataset_name = "Example Dataset"# Filter runs to add to the datasetruns = client.list_runs( project_name="my_project", is_root=True, error=False,)dataset = client.create_dataset(dataset_name, description="An example dataset")# Prepare inputs and outputs for bulk creationexamples = [{"inputs": run.inputs, "outputs": run.outputs} for run in runs]# Use the bulk create_examples methodclient.create_examples( dataset_id=dataset.id, examples=examples)
from langsmith import Clientimport osimport pandas as pdclient = Client()df = pd.read_parquet('path/to/your/myfile.parquet')input_keys = ['column1', 'column2'] # replace with your input column namesoutput_keys = ['output1', 'output2'] # replace with your output column namesdataset = client.upload_dataframe( df=df, input_keys=input_keys, output_keys=output_keys, name="My Parquet Dataset", description="Dataset created from a parquet file", data_type="kv" # The default)