Typed processors for transforming inputs and outputs before they are recorded on a traced run.
public class TraceProcessIO<PI, PO>Typed processors for transforming inputs and outputs before they are recorded on a traced run. The type parameters describe what the processors receive:
processInputs. Depends on the arity of the traced function:
String)Map (empty map)PairTripleprocessOutputs. For non-streaming functions, this is the raw return
type. For streaming functions (when [aggregator] is set), this is the aggregated output
type returned by the aggregator — not the stream type itself.
When processInputs is set, it replaces the default input serialization entirely. Same for
processOutputs.val process = TraceProcessIO(
processInputs = Function { input -> mapOf("query" to input) },
processOutputs = Function { resp -> mapOf("answer" to resp.text) },
)
val config = TraceConfig(name = "my-run", client = client, processTracedIO = process)
TraceProcessIO process = TraceProcessIO.builder()
.processInputs(input -> Map.of("query", input))
.processOutputs(resp -> Map.of("answer", resp.getText()))
.build();
TraceConfig config = TraceConfig.builder()
.name("my-run")
.client(client)
.processTracedIO(process)
.build();Creates a new [Builder]..
Callback to transform the input before it is recorded on the run..
Callback to transform the output before it is recorded on the run..
Aggregator for streaming results.
Builds the [TraceProcessIO]..