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

Python: Use overloads for sk function invoke_* calls

Open awharrison-28 opened this issue 1 year ago • 0 comments

Motivation and Context

It is confusing to have multiple skfunction invoke_* calls. This PR combines invoke and invoke_with_vars to enable calls with the input pattern: with SKContext, or with SKContextVariables.

Description

  • Removed sk_function methods invoke_with_vars and invoke_with_vars_async
  • Added the following optional paramters to sk_function methods invoke_ and invoke_async: variables and memory
  • Added log warnings for when an both SKContext and variables/memory are passed to invoke methods - this design ensures that the SDContext and it's associated variables and memory are prioritized
  • Updated tests and notebooks where applicable

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] The code follows the .NET coding conventions (https://learn.microsoft.com/dotnet/csharp/fundamentals/coding-style/coding-conventions) verified with dotnet format
  • [x] All unit tests pass, and I have added new tests where possible
  • [x] I didn't break anyone :smile:

awharrison-28 avatar Apr 17 '23 22:04 awharrison-28