semantic-kernel
semantic-kernel copied to clipboard
Python: Use overloads for sk function invoke_* calls
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
methodsinvoke_with_vars
andinvoke_with_vars_async
- Added the following optional paramters to
sk_function
methodsinvoke_
andinvoke_async
:variables
andmemory
- 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: