Class FunctionResult<T>
- java.lang.Object
-
- com.microsoft.semantickernel.orchestration.FunctionResult<T>
-
- Type Parameters:
T- The type of the result of the function invocation.
public class FunctionResult<T> extends Object
The result of a function invocation.This class is used to return the result of a function invocation. It contains the result of the function invocation and metadata about the result.
-
-
Constructor Summary
Constructors Constructor Description FunctionResult(ContextVariable<T> result, FunctionResultMetadata metadata, Object unconvertedResult)Create a new instance of FunctionResult.FunctionResult(ContextVariable<T> of, Object unconvertedResult)Create a new instance of FunctionResult with no metadata.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FunctionResultMetadatagetMetadata()Get the metadata about the result of the function invocation.TgetResult()Get the result of the function invocation.ContextVariable<T>getResultVariable()Get the result of the function invocation.ObjectgetUnconvertedResult()Get the result of the function invocation before it was converted to the expected type.
-
-
-
Constructor Detail
-
FunctionResult
public FunctionResult(ContextVariable<T> result, @Nullable FunctionResultMetadata metadata, @Nullable Object unconvertedResult)
Create a new instance of FunctionResult.- Parameters:
result- The result of the function invocation.metadata- Metadata about the result of the function invocation.unconvertedResult- The result of the function invocation before it was converted to the expected type.
-
FunctionResult
public FunctionResult(ContextVariable<T> of, @Nullable Object unconvertedResult)
Create a new instance of FunctionResult with no metadata.- Parameters:
of- The result of the function invocation.unconvertedResult- The result of the function invocation before it was converted to the expected type.
-
-
Method Detail
-
getResult
@Nullable public T getResult()
Get the result of the function invocation. NOTE: If you get a ClassCastException from this method, try adding a result type withFunctionInvocation.withResultType(ContextVariableType))}- Returns:
- The result of the function invocation.
- Throws:
ClassCastException- If the result is not of the expected type.
-
getResultVariable
public ContextVariable<T> getResultVariable()
Get the result of the function invocation.- Returns:
- The result of the function invocation.
-
getMetadata
public FunctionResultMetadata getMetadata()
Get the metadata about the result of the function invocation.- Returns:
- The metadata about the result of the function invocation.
-
-