From f39166e30f5aa01ab46cae88aad208d9f135f049 Mon Sep 17 00:00:00 2001 From: chjinche <49483542+chjinche@users.noreply.github.com> Date: Tue, 29 Aug 2023 17:40:44 +0800 Subject: [PATCH] remove promptflow-sdk references (#161) With `promptflow` package decoupled from previous `promptflow-sdk` entirely, need to remove all references of previous package. --- .github/workflows/tools_tests.yml | 15 +++------------ .gitignore | 2 ++ ...how-to-create-and-use-your-own-tool-package.md | 8 +++----- 3 files changed, 8 insertions(+), 17 deletions(-) diff --git a/.github/workflows/tools_tests.yml b/.github/workflows/tools_tests.yml index 919009a610a..139f4f0a38e 100644 --- a/.github/workflows/tools_tests.yml +++ b/.github/workflows/tools_tests.yml @@ -29,22 +29,13 @@ jobs: echo "No changes detected in src/promptflow-tools/" echo "run_tests=false" >> $GITHUB_OUTPUT fi - # Eventually only pip install promptflow and uninstall promptflow-sdk - # Install local build promptflow package to ensure some cross-package changes are working - name: Setup if: steps.check_changes.outputs.run_tests == 'true' run: | python -m pip install --upgrade pip - pip install promptflow-sdk --extra-index-url https://azuremlsdktestpypi.azureedge.net/promptflow/ - echo "Local build and install promptflow" - cd src/promptflow - python ./setup.py bdist_wheel - pip install './dist/promptflow-0.0.1-py3-none-any.whl' - pip install pytest - pip install pytest_mock - pip install azure-identity - pip install azure-keyvault-secrets - + pip install promptflow + pip install pytest pytest_mock + pip install azure-identity azure-keyvault-secrets - name: Generate configs if: steps.check_changes.outputs.run_tests == 'true' run: | diff --git a/.gitignore b/.gitignore index bc4cdade33d..91a61525ed4 100644 --- a/.gitignore +++ b/.gitignore @@ -168,6 +168,8 @@ cython_debug/ connection.json .env .azureml +# dummy custom tool package example +hello-world-proj/** # secrets **/connections.json diff --git a/docs/how-to-guides/how-to-create-and-use-your-own-tool-package.md b/docs/how-to-guides/how-to-create-and-use-your-own-tool-package.md index fd710818a74..c8703893501 100644 --- a/docs/how-to-guides/how-to-create-and-use-your-own-tool-package.md +++ b/docs/how-to-guides/how-to-create-and-use-your-own-tool-package.md @@ -7,13 +7,11 @@ Your tool package should be a python package. To try it quickly, just use [my-to ### Prerequisites Create a new conda environment using python 3.9 or 3.10. Run below command to install PromptFlow dependencies: ``` -# eventually only need to install promptflow -pip install promptflow-sdk promptflow --extra-index-url https://azuremlsdktestpypi.azureedge.net/promptflow/ +pip install promptflow ``` Install Pytest packages for running tests: ``` -pip install pytest -pip install pytest-mock +pip install pytest pytest-mock ``` Clone the PromptFlow repository from GitHub using the following command: ``` @@ -57,7 +55,7 @@ hello-world-proj/ ```The points outlined below explain the purpose of each folder/file in the package. If your aim is to develop multiple tools within your package, please make sure to closely examine point 2 and 5.``` 1. **hello-world-proj**: This is the source directory. All of your project's source code should be placed in this directory. -2. **hello-world/tools**: This directory contains the individual tools for your project. You tool package can contain either one tool or many tools. When adding a new tool, you should create another *_tool.py under the `tools` folder. +2. **hello-world/tools**: This directory contains the individual tools for your project. Your tool package can contain either one tool or many tools. When adding a new tool, you should create another *_tool.py under the `tools` folder. 3. **hello-world/tools/hello_world_tool.py**: Develop your tool within the def function. Use the `@tool` decorator to identify the function as a tool. > [!Note] There are two ways to write a tool. The default and recommended way is the function implemented way. You can also use the class implementation way, referring to [my_tool_2.py](https://github.com/microsoft/promptflow/blob/main/examples/tools/tool-package-quickstart/my_tool_package/tools/my_tool_2.py) as an example. 4. **hello-world/tools/utils.py**: This file implements the tool list method, which collects all the tools defined. It is required to have this tool list method, as it allows the User Interface (UI) to retrieve your tools and display them within the UI.