Class RecordExperimentExampleKt

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final static Unit main() Demonstrates how to record experiments in LangSmith using datasets, sessions, and runs.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • main

         final static Unit main()

        Demonstrates how to record experiments in LangSmith using datasets, sessions, and runs.

        This example is inspired by the Python implementation at: https://github.com/jacoblee93/langsmith-rest-experiments

        This example shows:

        • Defining experiment results with inputs, reference outputs, and actual outputs

        • Getting or creating a dataset by name

        • Generating deterministic example IDs using UUID v5

        • Creating or updating examples in the dataset with idempotent IDs

        • Creating an experiment session to group experiment runs

        • Logging mocked LLM runs with inputs, outputs, and metadata

        • Using LLM-as-judge evaluators to compare actual vs reference outputs

        Set these environment variables before running:

        • LANGSMITH_API_KEY: Your LangSmith API key

        ./gradlew :langsmith-java-example:run -Pexample=RecordExperiment