client#

Client for interacting with the LangSmith API.

Use the client to customize API keys / workspace ocnnections, SSl certs, etc. for tracing.

Also used to create, read, update, and delete LangSmith resources such as runs (~trace spans), datasets, examples (~records), feedback (~metrics), projects (tracer sessions/groups), etc.

For detailed API documentation, visit: https://docs.smith.langchain.com/.

Classes

client.Client([api_url, api_key, ...])

Client for interacting with the LangSmith API.

Functions

client.Client.add_runs_to_annotation_queue(...)

Add runs to an annotation queue with the specified queue ID.

client.Client.aevaluate(target, /[, data, ...])

Evaluate an async target system on a given dataset.

client.Client.aevaluate_run(run, evaluator, *)

Evaluate a run asynchronously.

client.Client.batch_ingest_runs([create, ...])

Batch ingest/upsert multiple runs in the Langsmith system.

client.Client.cleanup()

Manually trigger cleanup of the background thread.

client.Client.clone_public_dataset(...[, ...])

Clone a public dataset to your own langsmith tenant.

client.Client.create_annotation_queue(*, name)

Create an annotation queue on the LangSmith API.

client.Client.create_chat_example(messages)

Add an example (row) to a Chat-type dataset.

client.Client.create_commit(...[, ...])

Create a commit for an existing prompt.

client.Client.create_comparative_experiment(...)

Create a comparative experiment on the LangSmith API.

client.Client.create_dataset(dataset_name, *)

Create a dataset in the LangSmith API.

client.Client.create_example(inputs[, ...])

Create a dataset example in the LangSmith API.

client.Client.create_example_from_run(run[, ...])

Add an example (row) to a dataset from a run.

client.Client.create_examples(*, inputs[, ...])

Create examples in a dataset.

client.Client.create_feedback(run_id, key, *)

Create a feedback in the LangSmith API.

client.Client.create_feedback_from_token(...)

Create feedback from a presigned token or URL.

client.Client.create_llm_example(prompt[, ...])

Add an example (row) to an LLM-type dataset.

client.Client.create_presigned_feedback_token(...)

Create a pre-signed URL to send feedback data to.

client.Client.create_presigned_feedback_tokens(...)

Create a pre-signed URL to send feedback data to.

client.Client.create_project(project_name, *)

Create a project on the LangSmith API.

client.Client.create_prompt(prompt_identifier, *)

Create a new prompt.

client.Client.create_run(name, inputs, ...)

Persist a run to the LangSmith API.

client.Client.delete_annotation_queue(queue_id)

Delete an annotation queue with the specified queue ID.

client.Client.delete_dataset(*[, ...])

Delete a dataset from the LangSmith API.

client.Client.delete_example(example_id)

Delete an example by ID.

client.Client.delete_feedback(feedback_id)

Delete a feedback by ID.

client.Client.delete_project(*[, ...])

Delete a project from LangSmith.

client.Client.delete_prompt(prompt_identifier)

Delete a prompt.

client.Client.delete_run_from_annotation_queue(...)

Delete a run from an annotation queue with the specified queue ID and run ID.

client.Client.diff_dataset_versions([...])

Get the difference between two versions of a dataset.

client.Client.evaluate(target, /[, data, ...])

Evaluate a target system on a given dataset.

client.Client.evaluate_run(run, evaluator, *)

Evaluate a run.

client.Client.get_prompt(prompt_identifier)

Get a specific prompt by its identifier.

client.Client.get_run_from_annotation_queue(...)

Get a run from an annotation queue at the specified index.

client.Client.get_run_stats(*[, id, trace, ...])

Get aggregate statistics over queried runs.

client.Client.get_run_url(*, run[, ...])

Get the URL for a run.

client.Client.get_test_results(*[, ...])

Read the record-level information from an experiment into a Pandas DF.

client.Client.has_dataset(*[, dataset_name, ...])

Check whether a dataset exists in your tenant.

client.Client.has_project(project_name, *[, ...])

Check if a project exists.

client.Client.index_dataset(*, dataset_id[, tag])

Enable dataset indexing.

client.Client.like_prompt(prompt_identifier)

Like a prompt.

client.Client.list_annotation_queues(*[, ...])

List the annotation queues on the LangSmith API.

client.Client.list_dataset_splits(*[, ...])

Get the splits for a dataset.

client.Client.list_dataset_versions(*[, ...])

List dataset versions.

client.Client.list_datasets(*[, ...])

List the datasets on the LangSmith API.

client.Client.list_examples([dataset_id, ...])

Retrieve the example rows of the specified dataset.

client.Client.list_feedback(*[, run_ids, ...])

List the feedback objects on the LangSmith API.

client.Client.list_presigned_feedback_tokens(...)

List the feedback ingest tokens for a run.

client.Client.list_projects([project_ids, ...])

List projects from the LangSmith API.

client.Client.list_prompt_commits(...[, ...])

List commits for a given prompt.

client.Client.list_prompts(*[, limit, ...])

List prompts with pagination.

client.Client.list_runs(*[, project_id, ...])

List runs from the LangSmith API.

client.Client.list_shared_examples(...[, ...])

Get shared examples.

client.Client.list_shared_projects(*, ...[, ...])

List shared projects.

client.Client.list_shared_runs(share_token)

Get shared runs.

client.Client.multipart_ingest([create, ...])

Batch ingest/upsert multiple runs in the Langsmith system.

client.Client.pull_prompt(prompt_identifier, *)

Pull a prompt and return it as a LangChain PromptTemplate.

client.Client.pull_prompt_commit(...[, ...])

Pull a prompt object from the LangSmith API.

client.Client.push_prompt(prompt_identifier, *)

Push a prompt to the LangSmith API.

client.Client.read_annotation_queue(queue_id)

Read an annotation queue with the specified queue ID.

client.Client.read_dataset(*[, ...])

Read a dataset from the LangSmith API.

client.Client.read_dataset_openai_finetuning([...])

Download a dataset in OpenAI Jsonl format and load it as a list of dicts.

client.Client.read_dataset_shared_schema([...])

Retrieve the shared schema of a dataset.

client.Client.read_dataset_version(*[, ...])

Get dataset version by as_of or exact tag.

client.Client.read_example(example_id, *[, ...])

Read an example from the LangSmith API.

client.Client.read_feedback(feedback_id)

Read a feedback from the LangSmith API.

client.Client.read_project(*[, project_id, ...])

Read a project from the LangSmith API.

client.Client.read_run(run_id[, load_child_runs])

Read a run from the LangSmith API.

client.Client.read_run_shared_link(run_id)

Retrieve the shared link for a specific run.

client.Client.read_shared_dataset(share_token)

Get shared datasets.

client.Client.read_shared_run(share_token[, ...])

Get shared runs.

client.Client.request_with_retries(method, ...)

Send a request with retries.

client.Client.run_is_shared(run_id)

Get share state for a run.

client.Client.share_dataset([dataset_id, ...])

Get a share link for a dataset.

client.Client.share_run(run_id, *[, share_id])

Get a share link for a run.

client.Client.similar_examples(inputs, /, *, ...)

Retrieve the dataset examples whose inputs best match the current inputs.

client.Client.unlike_prompt(prompt_identifier)

Unlike a prompt.

client.Client.unshare_dataset(dataset_id)

Delete share link for a dataset.

client.Client.unshare_run(run_id)

Delete share link for a run.

client.Client.update_annotation_queue(...[, ...])

Update an annotation queue with the specified queue_id.

client.Client.update_dataset_splits(*[, ...])

Update the splits for a dataset.

client.Client.update_dataset_tag(*[, ...])

Update the tags of a dataset.

client.Client.update_example(example_id, *)

Update a specific example.

client.Client.update_examples(*, example_ids)

Update multiple examples.

client.Client.update_feedback(feedback_id, *)

Update a feedback in the LangSmith API.

client.Client.update_project(project_id, *)

Update a LangSmith project.

client.Client.update_prompt(prompt_identifier, *)

Update a prompt's metadata.

client.Client.update_run(run_id, *[, name, ...])

Update a run in the LangSmith API.

client.Client.upload_csv(csv_file, ...[, ...])

Upload a CSV file to the LangSmith API.

client.Client.upload_dataframe(df, name, ...)

Upload a dataframe as individual examples to the LangSmith API.

Deprecated functions

client.Client.arun_on_dataset(dataset_name, ...)

Asynchronously run the Chain or language model on a dataset.

client.Client.run_on_dataset(dataset_name, ...)

Run the Chain or language model on a dataset.