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

Adding Python notebook for native function examples

Open carterwilliamson opened this issue 2 years ago • 8 comments

Motivation and Context

This PR is intended to give some functioning examples to help users get started with python native functions. Currently, there are no examples or very limited examples. When I was playing around with this tool I ended up using some of the integration tests as examples to help get started. Hopefully, this will help the next user with the lessons learned.

Description

This adds a jupyter notebook that walks users through using native functions alongside semantic functions to build a simple story writing app. This notebook also shows how to use ContextVariables and run a semantic function from within a native function.

Contribution Checklist

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

carterwilliamson avatar Apr 27 '23 17:04 carterwilliamson

@microsoft-github-policy-service agree

carterwilliamson avatar Apr 27 '23 17:04 carterwilliamson

@carterwilliamson please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"

Contributor License Agreement

@microsoft-github-policy-service agree

carterwilliamson avatar Apr 27 '23 17:04 carterwilliamson

Thank you so much for creating this! I was just putting on our backlog the need to have better docs/notebooks for this. I'll review!

alexchaomander avatar Apr 27 '23 18:04 alexchaomander

Happy to help out! This project is fascinating, I'm excited to be able to contribute.

carterwilliamson avatar Apr 27 '23 18:04 carterwilliamson

Love it ❤️

TMUND avatar May 04 '23 16:05 TMUND

Thank you. Yes, I'm preparing a hackathon and I was spending a lot of time figuring out how to implement native functions. Thanks for the notebook

poweihuang0817 avatar May 07 '23 02:05 poweihuang0817

@carterwilliamson After talking with the team, could we actually simplify the notebook to just be completely inline?

So we can remove the parts about opening an external script and writing code that you would execute inside a main function. Instead, just directly call those functions inside Jupyter! Basically, we want people to be able to do everything they need to do directly in the notebook and not have to bring up some external editor.

Let me know if that makes sense! We love the notebook and definitely want to bring this in!

alexchaomander avatar May 09 '23 13:05 alexchaomander

@carterwilliamson After talking with the team, could we actually simplify the notebook to just be completely inline?

So we can remove the parts about opening an external script and writing code that you would execute inside a main function. Instead, just directly call those functions inside Jupyter! Basically, we want people to be able to do everything they need to do directly in the notebook and not have to bring up some external editor.

Let me know if that makes sense! We love the notebook and definitely want to bring this in!

@carterwilliamson Let me know if you're able to make the changes! Otherwise, I'd be happy to push to this branch with the updates!

alexchaomander avatar May 15 '23 23:05 alexchaomander

@carterwilliamson Made changes directly to this PR. Kept your examples. Just cleaned up the wording and made it more inline.

alexchaomander avatar May 19 '23 22:05 alexchaomander

@alexchaomander apologies, I went on vacation and didn't have access to github. Looks like this got completed. Any remaining updates you or the team would like to see here?

carterwilliamson avatar May 30 '23 19:05 carterwilliamson

@carterwilliamson Nope! Thank you so much for this PR! Looking forward to your next one :)

alexchaomander avatar May 30 '23 19:05 alexchaomander