Freigeben über


KernelArguments Class

Definition

Provides a collection of arguments for operations such as KernelFunction's InvokeAsync and IPromptTemplate's RenderAsync.

public sealed class KernelArguments : System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<string,object>>, System.Collections.Generic.IDictionary<string,object>, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string,object>>, System.Collections.Generic.IReadOnlyCollection<System.Collections.Generic.KeyValuePair<string,object>>, System.Collections.Generic.IReadOnlyDictionary<string,object>
type KernelArguments = class
    interface IDictionary<string, obj>
    interface ICollection<KeyValuePair<string, obj>>
    interface seq<KeyValuePair<string, obj>>
    interface IEnumerable
    interface IReadOnlyDictionary<string, obj>
    interface IReadOnlyCollection<KeyValuePair<string, obj>>
Public NotInheritable Class KernelArguments
Implements ICollection(Of KeyValuePair(Of String, Object)), IDictionary(Of String, Object), IEnumerable(Of KeyValuePair(Of String, Object)), IReadOnlyCollection(Of KeyValuePair(Of String, Object)), IReadOnlyDictionary(Of String, Object)
Inheritance
KernelArguments
Implements

Remarks

A KernelArguments is a dictionary of argument names and values. It also carries a PromptExecutionSettings, accessible via the ExecutionSettings property.

Constructors

KernelArguments()

Initializes a new instance of the KernelArguments class with the specified AI execution settings.

KernelArguments(IDictionary<String,Object>, Dictionary<String,PromptExecutionSettings>)

Initializes a new instance of the KernelArguments class that contains elements copied from the specified IDictionary<TKey,TValue>.

KernelArguments(IEnumerable<PromptExecutionSettings>)

Initializes a new instance of the KernelArguments class with the specified AI execution settings.

KernelArguments(PromptExecutionSettings)

Initializes a new instance of the KernelArguments class with the specified AI execution settings.

Properties

Count

Gets the number of arguments contained in the KernelArguments.

ExecutionSettings

Gets or sets the prompt execution settings.

Item[String]

Gets or sets the value associated with the specified argument name.

Names

Gets an ICollection<T> of all of the arguments' names.

Values

Gets an ICollection<T> of all of the arguments' values.

Methods

Add(String, Object)

Adds the specified argument name and value to the KernelArguments.

Clear()

Removes all arguments names and values from the KernelArguments.

ContainsName(String)

Determines whether the KernelArguments contains an argument with the specified name.

Remove(String)

Removes the argument value with the specified name from the KernelArguments.

TryGetValue(String, Object)

Gets the value associated with the specified argument name.

Explicit Interface Implementations

ICollection<KeyValuePair<String,Object>>.Add(KeyValuePair<String,Object>)

Adds an item to the ICollection<T>.

ICollection<KeyValuePair<String,Object>>.Contains(KeyValuePair<String,Object>)

Determines whether the ICollection<T> contains a specific value.

ICollection<KeyValuePair<String,Object>>.CopyTo(KeyValuePair<String,Object>[], Int32)

Copies the elements of the ICollection<T> to an Array, starting at a particular Array index.

ICollection<KeyValuePair<String,Object>>.IsReadOnly

Gets a value indicating whether the ICollection<T> is read-only.

ICollection<KeyValuePair<String,Object>>.Remove(KeyValuePair<String,Object>)

Removes the first occurrence of a specific object from the ICollection<T>.

IDictionary<String,Object>.Add(String, Object)

Adds an element with the provided key and value to the IDictionary<TKey,TValue>.

IDictionary<String,Object>.ContainsKey(String)

Determines whether the IDictionary<TKey,TValue> contains an element with the specified key.

IDictionary<String,Object>.Item[String]

Gets or sets the element with the specified key.

IDictionary<String,Object>.Keys

Gets an ICollection<T> containing the keys of the IDictionary<TKey,TValue>.

IDictionary<String,Object>.Remove(String)

Removes the element with the specified key from the IDictionary<TKey,TValue>.

IDictionary<String,Object>.TryGetValue(String, Object) System.Object.System#Collections#Generic#IDictionary{System#String@System#Object}#TryGetValue(System.String,System.Object@)
IEnumerable.GetEnumerator()

Returns an enumerator that iterates through a collection.

IEnumerable<KeyValuePair<String,Object>>.GetEnumerator()

Returns an enumerator that iterates through the collection.

IReadOnlyDictionary<String,Object>.ContainsKey(String)

Determines whether the read-only dictionary contains an element that has the specified key.

IReadOnlyDictionary<String,Object>.Item[String]

Gets the element that has the specified key in the read-only dictionary.

IReadOnlyDictionary<String,Object>.Keys

Gets an enumerable collection that contains the keys in the read-only dictionary.

IReadOnlyDictionary<String,Object>.TryGetValue(String, Object) System.Object.System#Collections#Generic#IReadOnlyDictionary{System#String@System#Object}#TryGetValue(System.String,System.Object@)
IReadOnlyDictionary<String,Object>.Values

Gets an enumerable collection that contains the values in the read-only dictionary.

Extension Methods

ContinueLoop(KernelArguments)

Signal the orchestrator to go to the next iteration of the loop in the AtLeastOnce or ZeroOrMore step.

ExitLoop(KernelArguments, String)

Signal the orchestrator to exit out of the AtLeastOnce or ZeroOrMore loop. If response is non-null, that value will be outputted to the user.

GetChatHistory(KernelArguments)

Get ChatHistory from context.

GetChatInput(KernelArguments)

Get latest chat input from context.

IsComplete(KernelArguments, Flow)

Check if all arguments to be provided with the flow is available in the context

IsTerminateFlow(KernelArguments)

Check if we should terminate flow based on current context.

PromptInput(KernelArguments)

Signal the orchestrator to prompt user for input with current function response.

TerminateFlow(KernelArguments)

Signal the orchestrator to terminate the flow.

Applies to