Skip to content

Python: native function always has 'input' parameter #2473

@chnldw

Description

@chnldw

Describe the bug
Native function alwasy has input parameter in its parameter list even though __sk_function_input_description__ is not set.

The same issue #2233 was closed with a fix to check if __sk_function_input_description__ is None
However it looks like this PR https://github.com/microsoft/semantic-kernel/pull/2329/files#diff-b60910d42f8eb11013690e29847e22e021d9fa9a9c2b049d769711ef55c5b447 gives a default value "" to input description

Now it's not possible to mark input as optional

To Reproduce
Steps to reproduce the behavior:

from semantic_kernel import Kernel, SKContext
from semantic_kernel.skill_definition import sk_function, sk_function_context_parameter


class TestSkill:
    @sk_function(
        description="Test skill",
        name="testSkill",
    )
    @sk_function_context_parameter(
        name="testParam",
        description="Test parameter",
    )
    def test(self, context: SKContext):
        pass


k = Kernel()
skill = k.import_skill(TestSkill(), "TestSkill")

for param in skill['testSkill'].parameters:
    print(f"{param.name}: {param.description}")

# Result:
# input:
# testParam: Test parameter

Expected behavior

# Result:
# testParam: Test parameter

Screenshots
image

Platform

  • OS: Windows
  • IDE: VS Code
  • Language: Python
  • Source: pip 0.3.8.dev0

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpythonPull requests for the Python Semantic Kernel

    Type

    No type

    Projects

    Status

    Sprint: Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions