Share via


FunctionResult<T> Class

  • 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>

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

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

Modifier and Type Method and Description
FunctionResultMetadata<?> getMetadata()

Get the metadata about the result of the function invocation.

T getResult()

Get the result of the function invocation.

ContextVariable<T> getResultVariable()

Get the result of the function invocation.

java.lang.Object getUnconvertedResult()

Get the result of the function invocation before it was converted to the expected type.

Methods inherited from java.lang.Object

java.lang.Object.clone java.lang.Object.equals java.lang.Object.finalize java.lang.Object.getClass java.lang.Object.hashCode java.lang.Object.notify java.lang.Object.notifyAll java.lang.Object.toString java.lang.Object.wait java.lang.Object.wait java.lang.Object.wait

Constructor Details

FunctionResult

public FunctionResult(ContextVariable result, FunctionResultMetadata metadata, 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 of, 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 Details

getMetadata

public FunctionResultMetadata getMetadata()

Get the metadata about the result of the function invocation.

Returns:

The metadata about the result of the function invocation.

getResult

public T getResult()

Get the result of the function invocation. NOTE: If you get a ClassCastException from this method, try adding a result type with withResultType(ContextVariableType<U> resultType) )}

Returns:

The result of the function invocation.

getResultVariable

public ContextVariable getResultVariable()

Get the result of the function invocation.

Returns:

The result of the function invocation.

getUnconvertedResult

public Object getUnconvertedResult()

Get the result of the function invocation before it was converted to the expected type.

Returns:

The result of the function invocation before it was converted to the expected type.

Applies to