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

[Feature Request] Support kwargs #714

Closed
Anbang-Hu opened this issue Oct 11, 2023 · 2 comments
Closed

[Feature Request] Support kwargs #714

Anbang-Hu opened this issue Oct 11, 2023 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@Anbang-Hu
Copy link

Is your feature request related to a problem? Please describe.
Our python tool function needs to accept **kwargs as input. E.g.

from promptflow import tool

@tool
def dummy(input_str: str, **kwargs):
    return input_str

However, visual editor doesn't support specifying kwargs, so we have to define it in flow.dag.yaml:
image

After clicking Run All, the parameters we added in flow.dag.yaml are wiped out:
image

Describe the solution you'd like
Allow users to input parameters for kwargs.

Describe alternatives you've considered
NA

Additional context
NA

@Anbang-Hu Anbang-Hu added the enhancement New feature or request label Oct 11, 2023
@huaiyan
Copy link
Contributor

huaiyan commented Oct 24, 2023

Workaround:
If we trigger execution by CLI or button in yaml text page, inputs will not be removed.
image

huaiyan added a commit that referenced this issue Nov 8, 2023
# Description
#714 asked support for
kwargs.

Add `enable_kwargs` tag in tools.json for customer python tool.
Then clients could add corresponding support for kwargs by yaml
authoring.
We don't need to modify execution logic to support kwargs.

Confirmed with @lalala123123 `_parse_tool_from_function` in
`_sdk.operations._tool_operations.py` will not be used to generate meta.

# All Promptflow Contribution checklist:
- [X] **The pull request does not introduce [breaking changes].**
- [X] **CHANGELOG is updated for new features, bug fixes or other
significant changes.**
- [X] **I have read the [contribution guidelines](../CONTRIBUTING.md).**
- [ ] **Create an issue and link to the pull request to get dedicated
review from promptflow team. Learn more: [suggested
workflow](../CONTRIBUTING.md#suggested-workflow).**

## General Guidelines and Best Practices
- [X] Title of the pull request is clear and informative.
- [X] There are a small number of commits, each of which have an
informative message. This means that previously merged commits do not
appear in the history of the PR. For more information on cleaning up the
commits in your PR, [see this
page](https://github.com/Azure/azure-powershell/blob/master/documentation/development-docs/cleaning-up-commits.md).

### Testing Guidelines
- [X] Pull request includes test coverage for the included changes.

---------

Co-authored-by: Robben Wang <robbenwang@microsoft.com>
@huaiyan
Copy link
Contributor

huaiyan commented Nov 14, 2023

This feature is available if use promptflow version 1.0.0 and extension version 1.4.0

@huaiyan huaiyan closed this as completed Nov 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants