Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Python notebook for native function examples #699

Merged

Conversation

carterwilliamson
Copy link
Contributor

@carterwilliamson carterwilliamson commented Apr 27, 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.

Contribution Checklist

Carter Williamson added 2 commits April 27, 2023 09:38
…se native functions in python, including examples with context variables
@carterwilliamson
Copy link
Contributor Author

@microsoft-github-policy-service agree

@carterwilliamson
Copy link
Contributor Author

@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
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 alexchaomander self-requested a review April 27, 2023 18:46
@alexchaomander alexchaomander added the python Pull requests for the Python Semantic Kernel label Apr 27, 2023
@carterwilliamson
Copy link
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
alexchaomander
alexchaomander previously approved these changes May 4, 2023
Copy link
Contributor

@alexchaomander alexchaomander left a comment

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

@alexchaomander alexchaomander added the PR: ready for review All feedback addressed, ready for reviews label May 4, 2023
@TMUND
Copy link

TMUND commented May 4, 2023

Love it ❤️

@poweihuang0817
Copy link
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
Contributor

@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
Contributor

@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
Copy link
Contributor

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

@alexchaomander alexchaomander self-requested a review May 22, 2023 19:46
@lemillermicrosoft lemillermicrosoft merged commit 0ebc599 into microsoft:main May 22, 2023
18 checks passed
@carterwilliamson
Copy link
Contributor Author

@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
Contributor

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

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 <carter.williamson@anitian.com>
Co-authored-by: Devis Lucato <devis@microsoft.com>
Co-authored-by: Alex Chao <5111035+alexchaomander@users.noreply.github.com>
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.

None yet

6 participants