You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: semantic-kernel/Frameworks/agent/agent-contextual-function-selection.md
+7-1Lines changed: 7 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,6 +22,10 @@ Contextual Function Selection is an advanced capability in the Semantic Kernel A
22
22
23
23
This approach addresses the challenge of function selection when dealing with a large number of available functions, where AI models may otherwise struggle to choose the appropriate function, leading to confusion and suboptimal performance.
24
24
25
+
> [!WARNING]
26
+
> When using the `ContextualFunctionProvider`, the `UseImmutableKernel` setting on the agent has to be set to `true` as the feature requires cloning the kernel when invoking the agent.
27
+
> Note that setting `UseImmutableKernel` to `true` will mean that any kernel data modifications done during the agent invocation by e.g. plugins, will not be retained after the invocation completes.
28
+
25
29
## How Contextual Function Selection Works
26
30
27
31
When an agent is configured with contextual function selection, it leverages a vector store and an embedding generator to semantically match the current conversation context (including previous messages and user input) with the descriptions and names of available functions. The most relevant functions, up to the specified limit, are then advertised to the AI model for invocation.
Instructions="You are a friendly assistant that summarizes key points and sentiments from customer reviews. For each response, list available functions.",
Depending on the agent types you use, you may also need to add the respective packages for the agents. Please refer to the [Agents Overview](../agent-architecture.md#agent-types-in-semantic-kernel) for more details.
> When using the `TextSearchProvider` with `OnDemandFunctionCalling`, the `UseImmutableKernel` setting on the agent has to be set to `true` as the feature requires cloning the kernel when invoking the agent.
131
+
> Note that setting `UseImmutableKernel` to `true` will mean that any kernel data modifications done during the agent invocation by e.g. plugins, will not be retained after the invocation completes.
132
+
127
133
## TextSearchProvider options
128
134
129
135
The `TextSearchProvider` can be configured with various options to customize its behavior. Options are provided using the `TextSearchProviderOptions` class to the `TextSearchProvider` constructor.
Copy file name to clipboardExpand all lines: semantic-kernel/Frameworks/process/process-best-practices.md
+8Lines changed: 8 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,6 +22,14 @@ Organizing your project files in a logical and maintainable structure is crucial
22
22
23
23
An organized structure not only simplifies navigation within the project but also enhances code reusability and facilitates collaboration among team members.
24
24
25
+
### Kernel Instance Isolation
26
+
27
+
> [!Important]
28
+
> Do not share a single Kernel instance between the main Process Framework and any of its dependencies (such as agents, tools, or external services).
29
+
30
+
Sharing a Kernel across these components can result in unexpected recursive invocation patterns, including infinite loops, as functions registered in the Kernel may inadvertently invoke each other. For example, a Step may call a function that triggers an agent, which then re-invokes the same function, creating a non-terminating loop.
31
+
32
+
To avoid this, instantiate separate Kernel objects for each independent agent, tool, or service used within your process. This ensures isolation between the Process Framework’s own functions and those required by dependencies, and prevents cross-invocation that could destabilize your workflow. This requirement reflects a current architectural constraint and may be revisited as the framework evolves.
25
33
26
34
### Common Pitfalls
27
35
To ensure smooth implementation and operation of the Process Framework, be mindful of these common pitfalls to avoid:
0 commit comments