Skip to content

.Net: Bug: Wrong code example in documentation #10565

Closed
@Arkanioos

Description

@Arkanioos

Describe the bug
In the documentation, a code example is incorrect.

To Reproduce

  1. Go to 'https://learn.microsoft.com/en-us/semantic-kernel/frameworks/agent/agent-chat?pivots=programming-language-csharp'
  2. Scroll down to the 'Chat Termination' tab
  3. See the error

Expected behavior
In the following code example:

  1. // Define a kernel function for the selection strategy
  2. KernelFunctionTerminationStrategy terminationStrategy =
    new(selectionFunction, kernel)
    {
    // Only the reviewer may give approval.
    Agents = [reviewerAgent],
    // Parse the function response.
    ResultParser = (result) =>
    result.GetValue()?.Contains("yes", StringComparison.OrdinalIgnoreCase) ?? false,
    // The prompt variable name for the history argument.
    HistoryVariableName = "history",
    // Save tokens by not including the entire history in the prompt
    HistoryReducer = new ChatHistoryTruncationReducer(1),
    // Limit total number of turns no matter what
    MaximumIterations = 10,
    };

Arent we supposed to use termination strategy (1) and terminationFunction (2) in the constructor ?

Screenshots
Image

Platform

  • Language: C#

Additional context
I may be wrong, sorry if that's the case !
Still learning tho.

Metadata

Metadata

Assignees

Labels

.NETIssue or Pull requests regarding .NET codebugSomething isn't workingdocumentation

Type

Projects

Status

Bug

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions