Share via


ContextVariableTypeConverter.Builder<T> Class

  • java.lang.Object
    • com.microsoft.semantickernel.contextvariables.ContextVariableTypeConverter.Builder<T>

Type Parameters

T

the type of the context variable

public static class ContextVariableTypeConverter.Builder<T>

A builder for a context variable type converter.

Constructor Summary

Constructor Description
Builder(Class<T> clazz)

Create a new builder for a context variable type converter.

Method Summary

Modifier and Type Method and Description
ContextVariableTypeConverter<T> build()

Build the context variable type converter.

Builder<T> fromObject(Function<Object,T> fromObject)

Set the function to convert an object to the type.

Builder<T> fromPromptString(Function<String,T> fromPromptString)

Set the function to convert a prompt string to the type.

Builder<T> proxyGlobalType()

Make this builder a proxy for another type converter.

Builder<T> proxyType(ContextVariableTypeConverter<T> proxy)

Make this builder a proxy for another type converter.

Builder<T> toPromptString(Function<T,String> toPromptString)

Set the function to convert the type to a prompt string.

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

Builder

public Builder(Class clazz)

Create a new builder for a context variable type converter.

Parameters:

clazz - the class of the type

Method Details

build

public ContextVariableTypeConverter build()

Build the context variable type converter.

Returns:

the context variable type converter

fromObject

public ContextVariableTypeConverter.Builder fromObject(Function fromObject)

Set the function to convert an object to the type.

Parameters:

fromObject - the function to convert an object to the type

Returns:

this builder

fromPromptString

public ContextVariableTypeConverter.Builder fromPromptString(Function fromPromptString)

Set the function to convert a prompt string to the type.

Parameters:

fromPromptString - the function to convert a prompt string to the type

Returns:

this builder

proxyGlobalType

public ContextVariableTypeConverter.Builder proxyGlobalType()

Make this builder a proxy for another type converter.

Returns:

this builder

proxyType

public ContextVariableTypeConverter.Builder proxyType(ContextVariableTypeConverter proxy)

Make this builder a proxy for another type converter.

Parameters:

proxy - the proxy type converter

Returns:

this builder

toPromptString

public ContextVariableTypeConverter.Builder toPromptString(Function toPromptString)

Set the function to convert the type to a prompt string.

Parameters:

toPromptString - the function to convert the type to a prompt string

Returns:

this builder

Applies to