-
Notifications
You must be signed in to change notification settings - Fork 902
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
4 changed files
with
54 additions
and
38 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
19 changes: 19 additions & 0 deletions
19
...romptflow/tests/executor/package_tools/custom_llm_tool_multi_inputs_without_index/list.py
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from pathlib import Path | ||
from ruamel.yaml import YAML | ||
|
||
|
||
def collect_tools_from_directory(base_dir) -> dict: | ||
tools = {} | ||
yaml = YAML() | ||
for f in Path(base_dir).glob("**/*.yaml"): | ||
with open(f, "r") as f: | ||
tools_in_file = yaml.load(f) | ||
for identifier, tool in tools_in_file.items(): | ||
tools[identifier] = tool | ||
return tools | ||
|
||
|
||
def list_package_tools(): | ||
"""List package tools""" | ||
yaml_dir = Path(__file__).parent | ||
return collect_tools_from_directory(yaml_dir) |
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