invokeFlow method
Invokes an alias of a flow to run the inputs that you specify and return the output of each node as a stream. If there's an error, the error is returned. For more information, see Test a flow in Amazon Bedrock in the Amazon Bedrock User Guide.
May throw AccessDeniedException.
May throw BadGatewayException.
May throw ConflictException.
May throw DependencyFailedException.
May throw InternalServerException.
May throw ResourceNotFoundException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
May throw ValidationException.
Parameter flowAliasIdentifier :
The unique identifier of the flow alias.
Parameter flowIdentifier :
The unique identifier of the flow.
Parameter inputs :
A list of objects, each containing information about an input into the
flow.
Parameter enableTrace :
Specifies whether to return the trace for the flow or not. Traces track
inputs and outputs for nodes in the flow. For more information, see Track
each step in your prompt flow by viewing its trace in Amazon Bedrock.
Parameter executionId :
The unique identifier for the current flow execution. If you don't provide
a value, Amazon Bedrock creates the identifier for you.
Parameter modelPerformanceConfiguration :
Model performance settings for the request.
Implementation
Future<InvokeFlowResponse> invokeFlow({
required String flowAliasIdentifier,
required String flowIdentifier,
required List<FlowInput> inputs,
bool? enableTrace,
String? executionId,
ModelPerformanceConfiguration? modelPerformanceConfiguration,
}) async {
final $payload = <String, dynamic>{
'inputs': inputs,
if (enableTrace != null) 'enableTrace': enableTrace,
if (executionId != null) 'executionId': executionId,
if (modelPerformanceConfiguration != null)
'modelPerformanceConfiguration': modelPerformanceConfiguration,
};
final response = await _protocol.sendRaw(
payload: $payload,
method: 'POST',
requestUri:
'/flows/${Uri.encodeComponent(flowIdentifier)}/aliases/${Uri.encodeComponent(flowAliasIdentifier)}',
exceptionFnMap: _exceptionFns,
);
final $json = await _s.jsonFromResponse(response);
return InvokeFlowResponse(
responseStream: FlowResponseStream.fromJson($json),
executionId: _s.extractHeaderStringValue(
response.headers, 'x-amz-bedrock-flow-execution-id'),
);
}