-
Notifications
You must be signed in to change notification settings - Fork 918
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[tool] Tool supports input_settings (#929)
# Description Using tool function to configure input settings - is_multi_select - allow_manual_entry - enabled_by - enabled_by_value - dynamic_list ```python from promptflow import InputSettings, DynamicList, tool @def my_list_func(prefix: str = "", size: int = 10, **kwargs): pass dynamic_list_setting = DynamicList(function=my_list_func, input_mapping={"prefix": "input_prefix"}) input_settings = { "input_text": InputSettings( dynamic_list=dynamic_list_setting, allow_manual_entry=True, is_multi_select=True ) } @tool( name="My Tool with Dynamic List Input", description="This is my tool with dynamic list input", input_settings=input_settings ) def my_tool(input_text: list, input_prefix: str) -> str: return f"Hello {input_prefix} {','.join(input_text)}" ``` Generated tool meta: ```json { "name": "My Tool with Dynamic List Input", "type": "python", "inputs": { "input_text": { "type": [ "list" ], "is_multi_select": true, "allow_manual_entry": true, "dynamic_list": { "func_path": "cli_tool_package.tool_with_dynamic_list_input.my_list_func", "func_kwargs": [ { "name": "prefix", "type": [ "string" ], "reference": "${inputs.input_prefix}", "optional": true, "default": "" }, { "name": "size", "type": [ "int" ], "optional": true, "default": 10 } ] } }, "input_prefix": { "type": [ "string" ] } } ``` Please add an informative description that covers that changes made by the pull request and link all relevant issues. # All Promptflow Contribution checklist: - [ ] **The pull request does not introduce [breaking changes].** - [ ] **CHANGELOG is updated for new features, bug fixes or other significant changes.** - [ ] **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 - [ ] Title of the pull request is clear and informative. - [ ] 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 - [ ] Pull request includes test coverage for the included changes.
- Loading branch information
1 parent
4f43297
commit be75ef0
Showing
12 changed files
with
630 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.