Wraps a no-arg [Supplier] with LangSmith tracing.
public Supplier<O> traceSupplier(Supplier<O> block, TraceConfig config)Wraps a no-arg [Supplier] with LangSmith tracing. This is the recommended entry point for Java callers (0-arg). It avoids the overload-resolution ambiguity that can occur with [traceable] when Kotlin function types are on the classpath. Kotlin callers should prefer [traceable] directly.
TraceConfig config = TraceConfig.builder()
.name("fetch-answer")
.client(LangsmithOkHttpClient.fromEnv())
.build();
Supplier traced = Tracing.traceSupplier(() -> "42", config);
String result = traced.get();| Name | Type | Description |
|---|---|---|
block* | Supplier<O> | |
config* | TraceConfig |