public Function<I, O> traceFunction(Function<I, O> block, TraceConfig config)| Name | Type | Description |
|---|---|---|
block* | Function<I, O> | |
config* | TraceConfig |
Wraps a 1-arg [Function] with LangSmith tracing.
Wraps a 1-arg [Function] with LangSmith tracing. This is the recommended entry point for Java callers (1-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("answer-question")
.client(LangsmithOkHttpClient.fromEnv())
.build();
Function traced = Tracing.traceFunction(q -> "42", config);
String result = traced.apply("What is the meaning of life?");