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

Python : Simplification for the SK decorators and core TextSkill

Open JTremb opened this issue 2 years ago • 0 comments

Motivation and Context

This PR simplifies @sk_* decorators while porting the core TextSkill

Description

This PR is a first step at adapting the python codebase to be more pythonic, it contains the following modifications :

  1. Merged the decorators @sk_function_context_parameter, @sk_function_input , @sk_function_name with @sk_function. The decorators were replaced with new kwargs on sk_function : name, input_description, input_default_value
  2. The name kwarg is optional, the name of the method will be used if none is provided.
  3. Ported core skill - TextSkill
  4. Added some pytest unit test for SK decorators and TextSkill
  5. Changed how skills are imported in the kernel by using instance of the class, not relying on static method anymore for the discovery. e.g.
kernel.import_skill(TextSkill())

Contribution Checklist

  • [x] The code builds clean without any errors or warnings
  • [x] The PR follows SK Contribution Guidelines (https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
  • [x] All unit tests pass, and I have added new tests where possible
  • [x] I didn't break anyone :smile:

JTremb avatar Mar 23 '23 13:03 JTremb