-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Python: Bug: Kernel functions cannot have optional arguments. #7297
Comments
markwallace-microsoft
added
python
Pull requests for the Python Semantic Kernel
triage
labels
Jul 16, 2024
This issue will be fixed by removing the |
4 tasks
github-merge-queue bot
pushed a commit
that referenced
this issue
Jul 23, 2024
### Motivation and Context We have some gaps in how we build the JSON schema for function calling related to Union and Optional types. There is also some work to do related to handling `Optional` versus `param | None = None`. <!-- Thank you for your contribution to the semantic-kernel repo! Please help reviewers and future users, providing the following information: 1. Why is this change required? 2. What problem does it solve? 3. What scenario does it contribute to? 4. If it fixes an open issue, please link to the issue here. --> ### Description This PR improves the JSON schema building for the Union and Optional types. It adds additional tests and improves some existing tests. - Closes #7297 - Closes #7298 <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [X] The code builds clean without any errors or warnings - [X] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [X] All unit tests pass, and I have added new tests where possible - [X] I didn't break anyone 😄
LudoCorporateShark
pushed a commit
to LudoCorporateShark/semantic-kernel
that referenced
this issue
Aug 25, 2024
### Motivation and Context We have some gaps in how we build the JSON schema for function calling related to Union and Optional types. There is also some work to do related to handling `Optional` versus `param | None = None`. <!-- Thank you for your contribution to the semantic-kernel repo! Please help reviewers and future users, providing the following information: 1. Why is this change required? 2. What problem does it solve? 3. What scenario does it contribute to? 4. If it fixes an open issue, please link to the issue here. --> ### Description This PR improves the JSON schema building for the Union and Optional types. It adds additional tests and improves some existing tests. - Closes microsoft#7297 - Closes microsoft#7298 <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [X] The code builds clean without any errors or warnings - [X] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [X] All unit tests pass, and I have added new tests where possible - [X] I didn't break anyone 😄
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
I want to write a kernel function with an optional argument. It does not work because semantic kernel ignores optional arguments when calling the
/chat/completions
endpoint.To Reproduce
Steps to reproduce the behavior:
The error happens because the metadata sent to the LLM is missing the country_code argument:
Expected behavior
I would expect the metadata to look like this
Screenshots
If applicable, add screenshots to help explain your problem.
Platform
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: