RunnableMapInput<RunInput extends Object, RunOutput extends Object> constructor
const
RunnableMapInput<RunInput extends Object, RunOutput extends Object> (
- FutureOr<
RunOutput> inputMapper(- RunInput input
A RunnableMapInput allows you to map the input to a different value.
You can create a RunnableMapInput using the Runnable.mapInput static method.
When you call invoke on a RunnableMapInput, it will take the input it receives and returns the output returned by the given inputMapper function.
Example:
final agent = Agent.fromRunnable(
Runnable.mapInput(
(final AgentPlanInput planInput) => <String, dynamic>{
'input': planInput.inputs['input'],
'agent_scratchpad': buildScratchpad(planInput.intermediateSteps),
},
).pipe(prompt).pipe(model).pipe(outputParser),
tools: [tool],
);
Implementation
const RunnableMapInput(this.inputMapper)
: super(defaultOptions: const RunnableOptions());