semantic-kernel icon indicating copy to clipboard operation
semantic-kernel copied to clipboard

Python: native function always has 'input' parameter

Open chnldw opened this issue 3 years ago • 2 comments

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 https://github.com/microsoft/semantic-kernel/issues/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.

chnldw avatar Aug 16 '23 02:08 chnldw

@shawncal - can we assign this to someone to investigate/plan apart of an upcoming sprint.

nacharya1 avatar Aug 16 '23 16:08 nacharya1

Thanks for fixing this. thanks

chnldw avatar Sep 19 '23 21:09 chnldw