Share via


KernelHooks.UnmodifiableKernelHooks Class

public static class KernelHooks.UnmodifiableKernelHooks
extends KernelHooks

A wrapper for KernelHooks that disables mutating methods.

Method Summary

Modifier and Type Method and Description
java.lang.String addFunctionInvokedHook(Function<FunctionInvokedEvent<?>,FunctionInvokedEvent<?>> function)

Add a FunctionInvokedHook to the collection of hooks.

java.lang.String addFunctionInvokingHook(Function<FunctionInvokingEvent<?>,FunctionInvokingEvent<?>> function)

Add a FunctionInvokingHook to the collection of hooks.

java.lang.String addHook(KernelHook<?> hook)

Add a KernelHook<T> to the collection of hooks.

java.lang.String addHook(String hookName, KernelHook<?> hook)

Add a KernelHook<T> to the collection of hooks.

KernelHooks addHooks(KernelHooks kernelHooks)

Appends the given hooks to this collection.

java.lang.String addPostChatCompletionHook(Function<PostChatCompletionEvent,PostChatCompletionEvent> function)

Add a PostChatCompletionEvent to the collection of hooks.

java.lang.String addPreChatCompletionHook(Function<PreChatCompletionEvent,PreChatCompletionEvent> function)

Add a PreChatCompletionHook to the collection of hooks.

java.lang.String addPromptRenderedHook(Function<PromptRenderedEvent,PromptRenderedEvent> function)

Add a PromptRenderedHook to the collection of hooks.

java.lang.String addPromptRenderingHook(Function<PromptRenderingEvent,PromptRenderingEvent> function)

Add a PromptRenderingHook to the collection of hooks.

KernelHook<?> removeHook(String hookName)

Remove a hook from the collection of hooks.

Methods inherited from KernelHooks

<T>executeHooks com.microsoft.semantickernel.hooks.KernelHooks.addFunctionInvokedHook(java.util.function.Function<com.microsoft.semantickernel.hooks.FunctionInvokedEvent< com.microsoft.semantickernel.hooks.KernelHooks.addFunctionInvokingHook(java.util.function.Function<com.microsoft.semantickernel.hooks.FunctionInvokingEvent< com.microsoft.semantickernel.hooks.KernelHooks.addHook(com.microsoft.semantickernel.hooks.KernelHook< com.microsoft.semantickernel.hooks.KernelHooks.addHook(java.lang.String,com.microsoft.semantickernel.hooks.KernelHook< addHooks addPostChatCompletionHook addPreChatCompletionHook addPreToolCallHook addPromptRenderedHook addPromptRenderingHook getHooks isEmpty merge removeHook unmodifiableClone

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

Method Details

addFunctionInvokedHook

public String addFunctionInvokedHook(Function,FunctionInvokedEvent> function)

Add a FunctionInvokedHook to the collection of hooks.

Overrides:

KernelHooks.UnmodifiableKernelHooks.addFunctionInvokedHook(Function<FunctionInvokedEvent<?>,FunctionInvokedEvent<?>> function)

Parameters:

function

addFunctionInvokingHook

public String addFunctionInvokingHook(Function,FunctionInvokingEvent> function)

Add a FunctionInvokingHook to the collection of hooks.

Overrides:

KernelHooks.UnmodifiableKernelHooks.addFunctionInvokingHook(Function<FunctionInvokingEvent<?>,FunctionInvokingEvent<?>> function)

Parameters:

function

addHook

public String addHook(KernelHook hook)

Add a KernelHook<T> to the collection of hooks.

Overrides:

KernelHooks.UnmodifiableKernelHooks.addHook(KernelHook<?> hook)

Parameters:

hook

addHook

public String addHook(String hookName, KernelHook hook)

Add a KernelHook<T> to the collection of hooks.

Overrides:

KernelHooks.UnmodifiableKernelHooks.addHook(String hookName, KernelHook<?> hook)

Parameters:

hookName
hook

addHooks

public KernelHooks addHooks(KernelHooks kernelHooks)

Appends the given hooks to this collection.

Overrides:

KernelHooks.UnmodifiableKernelHooks.addHooks(KernelHooks kernelHooks)

Parameters:

kernelHooks

addPostChatCompletionHook

public String addPostChatCompletionHook(Function function)

Add a PostChatCompletionEvent to the collection of hooks.

Overrides:

KernelHooks.UnmodifiableKernelHooks.addPostChatCompletionHook(Function<PostChatCompletionEvent,PostChatCompletionEvent> function)

Parameters:

function

addPreChatCompletionHook

public String addPreChatCompletionHook(Function function)

Add a PreChatCompletionHook to the collection of hooks.

Overrides:

KernelHooks.UnmodifiableKernelHooks.addPreChatCompletionHook(Function<PreChatCompletionEvent,PreChatCompletionEvent> function)

Parameters:

function

addPromptRenderedHook

public String addPromptRenderedHook(Function function)

Add a PromptRenderedHook to the collection of hooks.

Overrides:

KernelHooks.UnmodifiableKernelHooks.addPromptRenderedHook(Function<PromptRenderedEvent,PromptRenderedEvent> function)

Parameters:

function

addPromptRenderingHook

public String addPromptRenderingHook(Function function)

Add a PromptRenderingHook to the collection of hooks.

Overrides:

KernelHooks.UnmodifiableKernelHooks.addPromptRenderingHook(Function<PromptRenderingEvent,PromptRenderingEvent> function)

Parameters:

function

removeHook

public KernelHook removeHook(String hookName)

Remove a hook from the collection of hooks.

Overrides:

KernelHooks.UnmodifiableKernelHooks.removeHook(String hookName)

Parameters:

hookName

Applies to