Share via


InvocationContext Class

  • java.lang.Object
    • com.microsoft.semantickernel.orchestration.InvocationContext

public class InvocationContext

Context passed to a Kernel or KernelFunction invoke. This class is primarily for internal use. The preferred way to supply a context is to use the discrete "with" methods in FunctionInvocation<T>.

Constructor Summary

Modifier Constructor Description
protected InvocationContext()

Create a new instance of InvocationContext.

protected InvocationContext(KernelHooks hooks, PromptExecutionSettings promptExecutionSettings, ToolCallBehavior toolCallBehavior, ContextVariableTypes contextVariableTypes, InvocationReturnMode invocationReturnMode)

Create a new instance of InvocationContext.

protected InvocationContext(InvocationContext context)

Create a new instance of InvocationContext.

Method Summary

Modifier and Type Method and Description
static Builder builder()

Create a new Builder for building an instance of InvocationContext.

static Builder copy(InvocationContext context)

Create a new instance of InvocationContext by copying the values from another instance.

ContextVariableTypes getContextVariableTypes()

Get the types of context variables.

UnmodifiableKernelHooks getKernelHooks()

Get the hooks to use for the invocation.

PromptExecutionSettings getPromptExecutionSettings()

Get the settings for prompt execution.

ToolCallBehavior getToolCallBehavior()

Get the behavior for tool calls.

InvocationReturnMode returnMode()

Get the return mode for the invocation.

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

InvocationContext

protected InvocationContext()

Create a new instance of InvocationContext.

InvocationContext

protected InvocationContext(KernelHooks hooks, PromptExecutionSettings promptExecutionSettings, ToolCallBehavior toolCallBehavior, ContextVariableTypes contextVariableTypes, InvocationReturnMode invocationReturnMode)

Create a new instance of InvocationContext.

Parameters:

hooks - The hooks to use for the invocation.
promptExecutionSettings - The settings for prompt execution.
toolCallBehavior - The behavior for tool calls.
contextVariableTypes - The types of context variables.
invocationReturnMode

InvocationContext

protected InvocationContext(InvocationContext context)

Create a new instance of InvocationContext.

Parameters:

context - The context to copy.

Method Details

builder

public static InvocationContext.Builder builder()

Create a new Builder for building an instance of InvocationContext.

Returns:

the new Builder.

copy

public static InvocationContext.Builder copy(InvocationContext context)

Create a new instance of InvocationContext by copying the values from another instance.

Parameters:

context - The context to copy.

Returns:

The new instance of InvocationContext.

getContextVariableTypes

public ContextVariableTypes getContextVariableTypes()

Get the types of context variables.

Returns:

The types of context variables.

getKernelHooks

public KernelHooks.UnmodifiableKernelHooks getKernelHooks()

Get the hooks to use for the invocation.

Returns:

The hooks to use for the invocation.

getPromptExecutionSettings

public PromptExecutionSettings getPromptExecutionSettings()

Get the settings for prompt execution.

Returns:

The settings for prompt execution.

getToolCallBehavior

public ToolCallBehavior getToolCallBehavior()

Get the behavior for tool calls.

Returns:

The behavior for tool calls.

returnMode

public InvocationReturnMode returnMode()

Get the return mode for the invocation.

Returns:

this Builder

Applies to