Skip to content

Adding Python notebook for native function examples - #699

Merged
Lee Miller (lemillermicrosoft) merged 20 commits into
microsoft:mainfrom
carterwilliamson:docs/python-native-func-docs
May 22, 2023
Merged

Lee Miller (lemillermicrosoft) merged 20 commits into
microsoft:mainfrom
carterwilliamson:docs/python-native-func-docs

Conversation

@carterwilliamson

@carterwilliamson Carter Williamson (carterwilliamson) commented Apr 27, 2023 •

Copy link
Copy Markdown
Contributor

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

@carterwilliamson

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree

@carterwilliamson

Copy link
Copy Markdown
Contributor Author

Carter Williamson (@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

@alexchaomander

Copy link
Copy Markdown
Contributor

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 Alex Chao (alexchaomander) added the python Pull requests for the Python Semantic Kernel label Apr 27, 2023
@carterwilliamson

Copy link
Copy Markdown
Contributor Author

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

…thin semantic functions. Added some details about the sk_function_context_parameter decorator
@github-actions github-actions Bot removed the python Pull requests for the Python Semantic Kernel label May 3, 2023

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Really like this notebook. One change I would make is to rename it as 08-native-function-inline.ipynb because we will be merging in a 07 hugging face notebook very shortly. #762

@TMUND

Copy link
Copy Markdown

Love it ❤️

@poweihuang0817

Copy link
Copy Markdown
Contributor

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

@alexchaomander

Copy link
Copy Markdown
Contributor

Carter Williamson (@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

Copy link
Copy Markdown
Contributor

Carter Williamson (@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!

Carter Williamson (@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

Copy link
Copy Markdown
Contributor

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

@lemillermicrosoft
Lee Miller (lemillermicrosoft) merged commit 0ebc599 into microsoft:main May 22, 2023
@carterwilliamson

Copy link
Copy Markdown
Contributor Author

Alex Chao (@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?

@alexchaomander

Copy link
Copy Markdown
Contributor

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

Shawn Callegari (shawncal) pushed a commit to shawncal/semantic-kernel that referenced this pull request Jul 6, 2023
### 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.

Co-authored-by: Carter Williamson <[email protected]>
Co-authored-by: Devis Lucato <[email protected]>
Co-authored-by: Alex Chao <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: ready for review All feedback addressed, ready for reviews

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants