LangSmithLoader
This notebook provides a quick overview for getting started with the LangSmith document loader. For detailed documentation of all LangSmithLoader features and configurations head to the API reference.
Overviewโ
Integration detailsโ
Class | Package | Local | Serializable | JS support |
---|---|---|---|---|
LangSmithLoader | langchain-core | โ | โ | โ |
Loader featuresโ
Source | Lazy loading | Native async |
---|---|---|
LangSmithLoader | โ | โ |
Setupโ
To access the LangSmith document loader you'll need to install langchain-core
, create a LangSmith account and get an API key.
Credentialsโ
Sign up at https://langsmith.com and generate an API key. Once you've done this set the LANGSMITH_API_KEY environment variable:
import getpass
import os
if not os.environ.get("LANGSMITH_API_KEY"):
os.environ["LANGSMITH_API_KEY"] = getpass.getpass("Enter your LangSmith API key: ")
If you want to get automated best-in-class tracing, you can also turn on LangSmith tracing:
# os.environ["LANGSMITH_TRACING"] = "true"
Installationโ
Install langchain-core
:
%pip install -qU langchain-core
Clone example datasetโ
For this example, we'll clone and load a public LangSmith dataset. Cloning creates a copy of this dataset on our personal LangSmith account. You can only load datasets that you have a personal copy of.
from langsmith import Client as LangSmithClient
ls_client = LangSmithClient()
dataset_name = "LangSmith Few Shot Datasets Notebook"
dataset_public_url = (
"https://smith.langchain.com/public/55658626-124a-4223-af45-07fb774a6212/d"
)
ls_client.clone_public_dataset(dataset_public_url)