Skip to main content
LangSmith allows you to attach transformations to fields in your dataset’s schema that apply to your data before it is added to your dataset, whether that be from UI, API, or run rules. Coupled with LangSmith’s prebuilt JSON schema types, these allow you to do easy preprocessing of your data before saving it into your datasets.

Transformation types

Chat model prebuilt schema

The main use case for transformations is to simplify collecting production traces into datasets in a format that can be standardized across model providers for usage in evaluations / few shot prompting / etc downstream. To simplify setup of transformations for our end users, LangSmith offers a pre-defined schema that will do the following:
  • Extract messages from your collected runs and transform them into the openai standard format, which makes them compatible all LangChain ChatModels and most model providers’ SDK for downstream evaluation and experimentation
  • Extract any tools used by your LLM and add them to your example’s input to be used for reproducibility in downstream evaluation
Users who want to iterate on their system prompts often also add the Remove System Messages transformation on their input messages when using our Chat Model schema, which will prevent you from saving the system prompt to your dataset.

Compatibility

The LLM run collection schema is built to collect data from LangChain BaseChatModel runs or traced runs from the LangSmith OpenAI wrapper. Please contact support via support.langchain.com if you have an LLM run you are tracing that is not compatible and we can extend support. If you want to apply transformations to other sorts of runs (for example, representing LangGraph state with message history), please define your schema directly and manually add the relevant transformations.

Enablement

When adding a run from a tracing project or annotation queue to a dataset, if it has the LLM run type, we will apply the Chat Model schema by default. For enablement on new datasets, see our dataset management how-to guide.

Specs

For the full API specs of the prebuilt schema, see the below sections:

Input schema

Output schema

Transformations

And the transformations look as follows: