diff --git a/docs/cloud/azureai/quick-start/create-run-with-automatic-runtime.md b/docs/cloud/azureai/quick-start/create-run-with-automatic-runtime.md index 8f7de3cdbbc..a7a33dc352d 100644 --- a/docs/cloud/azureai/quick-start/create-run-with-automatic-runtime.md +++ b/docs/cloud/azureai/quick-start/create-run-with-automatic-runtime.md @@ -87,7 +87,7 @@ pfazure run create --file run.yml :sync: SDK ```python -from promptflow import load_run +from promptflow.client import load_run run = load_run(source="run.yml") pf = PFClient( diff --git a/docs/dev/documentation_guidelines.md b/docs/dev/documentation_guidelines.md index 145766a6dcb..f5f4f124d74 100644 --- a/docs/dev/documentation_guidelines.md +++ b/docs/dev/documentation_guidelines.md @@ -23,7 +23,7 @@ First please read through [Sphinx style](https://sphinx-rtd-tutorial.readthedocs Let's start with a class example: ```python from typing import Dict, Optional, Union -from promptflow import PFClient +from promptflow.client import PFClient class MyClass: """One-line summary of the class. diff --git a/docs/how-to-guides/develop-a-flow/develop-evaluation-flow.md b/docs/how-to-guides/develop-a-flow/develop-evaluation-flow.md index 8d87c6b6b09..62393393a7a 100644 --- a/docs/how-to-guides/develop-a-flow/develop-evaluation-flow.md +++ b/docs/how-to-guides/develop-a-flow/develop-evaluation-flow.md @@ -61,7 +61,7 @@ Before introducing the aggregation node, let's see what a regular node looks lik It takes both `groundtruth` and `prediction` from the flow inputs, compare them in the source code to see if they match: ```python -from promptflow import tool +from promptflow.core import tool @tool def grade(groundtruth: str, prediction: str): @@ -86,7 +86,7 @@ When it comes to an `aggregation node`, there are two key distinctions that set ```python from typing import List -from promptflow import log_metric, tool +from promptflow.core import log_metric, tool @tool def calculate_accuracy(grades: List[str]): @@ -157,7 +157,7 @@ Promptflow supports logging and tracking experiments using `log_metric` function ```python from typing import List -from promptflow import log_metric, tool +from promptflow.core import log_metric, tool @tool def example_log_metrics(grades: List[str]): diff --git a/docs/how-to-guides/develop-a-flow/develop-standard-flow.md b/docs/how-to-guides/develop-a-flow/develop-standard-flow.md index f99f9a46fd6..141ec676047 100644 --- a/docs/how-to-guides/develop-a-flow/develop-standard-flow.md +++ b/docs/how-to-guides/develop-a-flow/develop-standard-flow.md @@ -74,7 +74,7 @@ By selecting the tool card on the very top, you'll add a new tool node to flow. You can edit the tool by simply opening the source file and making edits. For example, we provide a simple Python tool code below. ```python -from promptflow import tool +from promptflow.core import tool # The inputs section will change based on the arguments of the tool function, after you save the code # Adding type to arguments and return value will help the system show the types properly @@ -144,7 +144,7 @@ For example: ```python import json -from promptflow import tool +from promptflow.core import tool @tool def convert_to_dict(input_str: str, input_str2: str) -> dict: diff --git a/docs/how-to-guides/develop-a-tool/create-cascading-tool-inputs.md b/docs/how-to-guides/develop-a-tool/create-cascading-tool-inputs.md index c639b8d800f..a4758499b51 100644 --- a/docs/how-to-guides/develop-a-tool/create-cascading-tool-inputs.md +++ b/docs/how-to-guides/develop-a-tool/create-cascading-tool-inputs.md @@ -17,7 +17,7 @@ We'll build out an example tool to show how cascading inputs work. The `student_ ```python from enum import Enum -from promptflow import tool +from promptflow.core import tool class UserType(str, Enum): diff --git a/docs/how-to-guides/develop-a-tool/customize_an_llm_tool.md b/docs/how-to-guides/develop-a-tool/customize_an_llm_tool.md index f29462aa80d..20478f93f2a 100644 --- a/docs/how-to-guides/develop-a-tool/customize_an_llm_tool.md +++ b/docs/how-to-guides/develop-a-tool/customize_an_llm_tool.md @@ -13,7 +13,7 @@ Here we use [an existing tool package](https://github.com/microsoft/promptflow/t ```python from jinja2 import Template - from promptflow import tool + from promptflow.core import tool from promptflow.connections import CustomConnection from promptflow.contracts.types import PromptTemplate diff --git a/docs/how-to-guides/develop-a-tool/use-file-path-as-tool-input.md b/docs/how-to-guides/develop-a-tool/use-file-path-as-tool-input.md index d54fadfa048..9d2cbcd3ca5 100644 --- a/docs/how-to-guides/develop-a-tool/use-file-path-as-tool-input.md +++ b/docs/how-to-guides/develop-a-tool/use-file-path-as-tool-input.md @@ -23,7 +23,7 @@ Here we use [an existing tool package](https://github.com/microsoft/promptflow/t ```python import importlib from pathlib import Path - from promptflow import tool + from promptflow.core import tool # 1. import the FilePath type from promptflow.contracts.types import FilePath @@ -78,7 +78,7 @@ We can also utilize the `FilePath` input type directly in a script tool, elimina ```python import importlib from pathlib import Path - from promptflow import tool + from promptflow.core import tool # 1. import the FilePath type from promptflow.contracts.types import FilePath diff --git a/docs/how-to-guides/enable-streaming-mode.md b/docs/how-to-guides/enable-streaming-mode.md index 7b3de2b913a..9402b7739b1 100644 --- a/docs/how-to-guides/enable-streaming-mode.md +++ b/docs/how-to-guides/enable-streaming-mode.md @@ -24,7 +24,7 @@ If you want to use the streaming mode, you need to create a flow that has a node ``` - Python tools node: This node allows you to write custom Python code that can yield string outputs. You can use this node to call external APIs or libraries that support streaming. For example, you can use this code to echo the input word by word: ```python - from promptflow import tool + from promptflow.core import tool # Sample code echo input by yield in Python tool node diff --git a/docs/how-to-guides/init-and-test-a-flow.md b/docs/how-to-guides/init-and-test-a-flow.md index 03100edda32..1a1ebf39a57 100644 --- a/docs/how-to-guides/init-and-test-a-flow.md +++ b/docs/how-to-guides/init-and-test-a-flow.md @@ -127,7 +127,7 @@ Promptflow CLI will generate test logs and outputs in `.promptflow`: The return value of `test` function is the flow outputs. ```python -from promptflow import PFClient +from promptflow.client import PFClient pf_client = PFClient() @@ -188,7 +188,7 @@ The log and result of flow node test will be displayed in the terminal. And the Customer can execute this command to test the flow. The return value of `test` function is the node outputs. ```python -from promptflow import PFClient +from promptflow.client import PFClient pf_client = PFClient() @@ -266,7 +266,7 @@ The flow result will be streamed in the terminal as shown below. The LLM node return value of `test` function is a generator, you can consume the result by this way: ```python -from promptflow import PFClient +from promptflow.client import PFClient pf_client = PFClient() diff --git a/docs/how-to-guides/manage-connections.md b/docs/how-to-guides/manage-connections.md index 0a923b81401..30803949199 100644 --- a/docs/how-to-guides/manage-connections.md +++ b/docs/how-to-guides/manage-connections.md @@ -63,7 +63,7 @@ The expected result is as follows if the connection created successfully. Using SDK, each connection type has a corresponding class to create a connection. The following code snippet shows how to import the required class and create the connection: ```python -from promptflow import PFClient +from promptflow.client import PFClient from promptflow.entities import AzureOpenAIConnection, CustomConnection # Get a pf client to manage connections @@ -162,7 +162,7 @@ pf connection list :sync: SDK List connection command will return the connections object list, note that all secrets and api keys will be scrubbed: ```python -from promptflow import PFClient +from promptflow.client import PFClient # Get a pf client to manage connections pf = PFClient() # List and print connections @@ -193,7 +193,7 @@ pf connection delete -n :sync: SDK Delete a connection with the following code snippet: ```python -from promptflow import PFClient +from promptflow.client import PFClient # Get a pf client to manage connections pf = PFClient() diff --git a/docs/how-to-guides/manage-runs.md b/docs/how-to-guides/manage-runs.md index 811d9d5701d..91d785cd9bf 100644 --- a/docs/how-to-guides/manage-runs.md +++ b/docs/how-to-guides/manage-runs.md @@ -76,7 +76,7 @@ The expected result is as follows if the run is created successfully. Using SDK, create `Run` object and submit it with `PFClient`. The following code snippet shows how to import the required class and create the run: ```python -from promptflow import PFClient +from promptflow.client import PFClient from promptflow.entities import Run # Get a pf client to manage runs @@ -130,7 +130,7 @@ pf run show --name :sync: SDK Show run with `PFClient` ```python -from promptflow import PFClient +from promptflow.client import PFClient # Get a pf client to manage runs pf = PFClient() # Get and print the run @@ -166,7 +166,7 @@ pf run show-details --name :sync: SDK Show run details with `PFClient` ```python -from promptflow import PFClient +from promptflow.client import PFClient from tabulate import tabulate # Get a pf client to manage runs @@ -204,7 +204,7 @@ pf run show-metrics --name :sync: SDK Show run metrics with `PFClient` ```python -from promptflow import PFClient +from promptflow.client import PFClient import json # Get a pf client to manage runs @@ -240,7 +240,7 @@ A browser will open and display run outputs. :sync: SDK Visualize run with `PFClient` ```python -from promptflow import PFClient +from promptflow.client import PFClient # Get a pf client to manage runs pf = PFClient() @@ -280,7 +280,7 @@ pf run list :sync: SDK List with `PFClient` ```python -from promptflow import PFClient +from promptflow.client import PFClient # Get a pf client to manage runs pf = PFClient() @@ -317,7 +317,7 @@ pf run update --name --set display_name=new_display_name :sync: SDK Update run with `PFClient` ```python -from promptflow import PFClient +from promptflow.client import PFClient # Get a pf client to manage runs pf = PFClient() @@ -346,7 +346,7 @@ pf run archive --name :sync: SDK Archive with `PFClient` ```python -from promptflow import PFClient +from promptflow.client import PFClient # Get a pf client to manage runs pf = PFClient() @@ -379,7 +379,7 @@ pf run restore --name :sync: SDK Restore with `PFClient` ```python -from promptflow import PFClient +from promptflow.client import PFClient # Get a pf client to manage runs pf = PFClient() @@ -409,7 +409,7 @@ pf run delete --name :sync: SDK Delete with `PFClient` ```python -from promptflow import PFClient +from promptflow.client import PFClient # Get a pf client to manage runs pf = PFClient() diff --git a/docs/how-to-guides/quick-start.md b/docs/how-to-guides/quick-start.md index 83c2ca46c7c..d099fe012df 100644 --- a/docs/how-to-guides/quick-start.md +++ b/docs/how-to-guides/quick-start.md @@ -165,7 +165,7 @@ More command details can be found in [CLI reference](../reference/pf-command-ref In SDK, connections can be created and managed with `PFClient`. ```python -from promptflow import PFClient +from promptflow.client import PFClient from promptflow.entities import AzureOpenAIConnection # PFClient can help manage your runs and connections. @@ -254,7 +254,7 @@ pf flow test --flow web-classification # "web-classification" is the directory The return value of `test` function is the flow/node outputs. ```python -from promptflow import PFClient +from promptflow.client import PFClient pf = PFClient() diff --git a/docs/how-to-guides/run-and-evaluate-a-flow/index.md b/docs/how-to-guides/run-and-evaluate-a-flow/index.md index 4296ea436c1..a7ad5de1c81 100644 --- a/docs/how-to-guides/run-and-evaluate-a-flow/index.md +++ b/docs/how-to-guides/run-and-evaluate-a-flow/index.md @@ -58,7 +58,7 @@ More details can be found with `pf run --help` :sync: SDK ```python -from promptflow import PFClient +from promptflow.client import PFClient # Please protect the entry point by using `if __name__ == '__main__':`, # otherwise it would cause unintended side effect when promptflow spawn worker processes. @@ -180,7 +180,7 @@ After the run is finished, you can evaluate the run with below command, compared More details can be found in [Use column mapping](https://aka.ms/pf/column-mapping). ```python -from promptflow import PFClient +from promptflow.client import PFClient # PFClient can help manage your runs and connections. pf = PFClient() diff --git a/docs/how-to-guides/tune-prompts-with-variants.md b/docs/how-to-guides/tune-prompts-with-variants.md index 8a7b2a171af..33ed3e00a07 100644 --- a/docs/how-to-guides/tune-prompts-with-variants.md +++ b/docs/how-to-guides/tune-prompts-with-variants.md @@ -80,7 +80,7 @@ pf run create --flow web-classification --data web-classification/data.jsonl --v :sync: SDK ```python -from promptflow import PFClient +from promptflow.client import PFClient pf = PFClient() # get a promptflow client flow = "web-classification" diff --git a/docs/reference/tools-reference/python-tool.md b/docs/reference/tools-reference/python-tool.md index f98837b03e8..5d63819a997 100644 --- a/docs/reference/tools-reference/python-tool.md +++ b/docs/reference/tools-reference/python-tool.md @@ -62,7 +62,7 @@ The snippet below shows the basic structure of a tool function. Promptflow will from function parameters and type annotations. ```python -from promptflow import tool +from promptflow.core import tool from promptflow.connections import CustomConnection # The inputs section will change based on the arguments of the tool function, after you save the code @@ -97,7 +97,7 @@ we have introduced support for keyword arguments (kwargs) in the Python tool. ```python -from promptflow import tool +from promptflow.core import tool @tool diff --git a/examples/flows/chat/chat-math-variant/extract_result.py b/examples/flows/chat/chat-math-variant/extract_result.py index 5ce86dd507a..e9b1a0bbb07 100644 --- a/examples/flows/chat/chat-math-variant/extract_result.py +++ b/examples/flows/chat/chat-math-variant/extract_result.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool import json import re diff --git a/examples/flows/chat/chat-with-pdf/build_index_tool.py b/examples/flows/chat/chat-with-pdf/build_index_tool.py index abbff62e7ff..21ec19aad6a 100644 --- a/examples/flows/chat/chat-with-pdf/build_index_tool.py +++ b/examples/flows/chat/chat-with-pdf/build_index_tool.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool from chat_with_pdf.build_index import create_faiss_index diff --git a/examples/flows/chat/chat-with-pdf/chat_with_pdf_tool.py b/examples/flows/chat/chat-with-pdf/chat_with_pdf_tool.py index 334755322df..6cc3bc1cff5 100644 --- a/examples/flows/chat/chat-with-pdf/chat_with_pdf_tool.py +++ b/examples/flows/chat/chat-with-pdf/chat_with_pdf_tool.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool from chat_with_pdf.main import chat_with_pdf diff --git a/examples/flows/chat/chat-with-pdf/download_tool.py b/examples/flows/chat/chat-with-pdf/download_tool.py index 72baa90fac5..08dc07a038b 100644 --- a/examples/flows/chat/chat-with-pdf/download_tool.py +++ b/examples/flows/chat/chat-with-pdf/download_tool.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool from chat_with_pdf.download import download diff --git a/examples/flows/chat/chat-with-pdf/find_context_tool.py b/examples/flows/chat/chat-with-pdf/find_context_tool.py index 246ceea2b73..1806bf2c048 100644 --- a/examples/flows/chat/chat-with-pdf/find_context_tool.py +++ b/examples/flows/chat/chat-with-pdf/find_context_tool.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool from chat_with_pdf.find_context import find_context diff --git a/examples/flows/chat/chat-with-pdf/qna_tool.py b/examples/flows/chat/chat-with-pdf/qna_tool.py index 98e131b75ef..1c414485e11 100644 --- a/examples/flows/chat/chat-with-pdf/qna_tool.py +++ b/examples/flows/chat/chat-with-pdf/qna_tool.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool from chat_with_pdf.qna import qna diff --git a/examples/flows/chat/chat-with-pdf/rewrite_question_tool.py b/examples/flows/chat/chat-with-pdf/rewrite_question_tool.py index 8808c4a00f5..ea2152ca725 100644 --- a/examples/flows/chat/chat-with-pdf/rewrite_question_tool.py +++ b/examples/flows/chat/chat-with-pdf/rewrite_question_tool.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool from chat_with_pdf.rewrite_question import rewrite_question diff --git a/examples/flows/chat/chat-with-pdf/setup_env.py b/examples/flows/chat/chat-with-pdf/setup_env.py index 6b231b878c9..9457c2257d0 100644 --- a/examples/flows/chat/chat-with-pdf/setup_env.py +++ b/examples/flows/chat/chat-with-pdf/setup_env.py @@ -1,7 +1,7 @@ import os from typing import Union -from promptflow import tool +from promptflow.core import tool from promptflow.connections import AzureOpenAIConnection, OpenAIConnection from chat_with_pdf.utils.lock import acquire_lock diff --git a/examples/flows/chat/chat-with-wikipedia/get_wiki_url.py b/examples/flows/chat/chat-with-wikipedia/get_wiki_url.py index e371fea6d17..a93287da12c 100644 --- a/examples/flows/chat/chat-with-wikipedia/get_wiki_url.py +++ b/examples/flows/chat/chat-with-wikipedia/get_wiki_url.py @@ -3,7 +3,7 @@ import bs4 import requests -from promptflow import tool +from promptflow.core import tool def decode_str(string): diff --git a/examples/flows/chat/chat-with-wikipedia/process_search_result.py b/examples/flows/chat/chat-with-wikipedia/process_search_result.py index 4248ac0f3c1..cf7d98b4195 100644 --- a/examples/flows/chat/chat-with-wikipedia/process_search_result.py +++ b/examples/flows/chat/chat-with-wikipedia/process_search_result.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool @tool diff --git a/examples/flows/chat/chat-with-wikipedia/search_result_from_url.py b/examples/flows/chat/chat-with-wikipedia/search_result_from_url.py index b5344012788..920e0a7d0a5 100644 --- a/examples/flows/chat/chat-with-wikipedia/search_result_from_url.py +++ b/examples/flows/chat/chat-with-wikipedia/search_result_from_url.py @@ -6,7 +6,7 @@ import bs4 import requests -from promptflow import tool +from promptflow.core import tool session = requests.Session() diff --git a/examples/flows/chat/use_functions_with_chat_models/run_function.py b/examples/flows/chat/use_functions_with_chat_models/run_function.py index d1a97198b28..37029bf893a 100644 --- a/examples/flows/chat/use_functions_with_chat_models/run_function.py +++ b/examples/flows/chat/use_functions_with_chat_models/run_function.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool import json diff --git a/examples/flows/evaluation/eval-accuracy-maths-to-code/aggregate.py b/examples/flows/evaluation/eval-accuracy-maths-to-code/aggregate.py index ae265856ca4..d8f16d0ecc1 100644 --- a/examples/flows/evaluation/eval-accuracy-maths-to-code/aggregate.py +++ b/examples/flows/evaluation/eval-accuracy-maths-to-code/aggregate.py @@ -1,6 +1,6 @@ from typing import List -from promptflow import tool -from promptflow import log_metric +from promptflow.core import tool +from promptflow.core import log_metric @tool diff --git a/examples/flows/evaluation/eval-accuracy-maths-to-code/line_process.py b/examples/flows/evaluation/eval-accuracy-maths-to-code/line_process.py index a4d78553c95..4d2f701a09e 100644 --- a/examples/flows/evaluation/eval-accuracy-maths-to-code/line_process.py +++ b/examples/flows/evaluation/eval-accuracy-maths-to-code/line_process.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool @tool diff --git a/examples/flows/evaluation/eval-basic/README.md b/examples/flows/evaluation/eval-basic/README.md index 163712cddc0..08a786bf0da 100644 --- a/examples/flows/evaluation/eval-basic/README.md +++ b/examples/flows/evaluation/eval-basic/README.md @@ -15,7 +15,7 @@ pip install -r requirements.txt In this flow, you will learn - how to compose a point based evaluation flow, where you can calculate point-wise metrics. -- the way to log metrics. use `from promptflow import log_metric` +- the way to log metrics. use `from promptflow.core import log_metric` - see file [aggregate](aggregate.py). ### 1. Test flow with single line data diff --git a/examples/flows/evaluation/eval-basic/aggregate.py b/examples/flows/evaluation/eval-basic/aggregate.py index 098a6bd89d9..7bc0df88d4d 100644 --- a/examples/flows/evaluation/eval-basic/aggregate.py +++ b/examples/flows/evaluation/eval-basic/aggregate.py @@ -1,6 +1,6 @@ from typing import List -from promptflow import tool +from promptflow.core import tool @tool @@ -18,7 +18,7 @@ def aggregate(processed_results: List[str]): print(processed_results) # Log metric for each variant - from promptflow import log_metric + from promptflow.core import log_metric log_metric(key="results_num", value=results_num) return results_num diff --git a/examples/flows/evaluation/eval-basic/line_process.py b/examples/flows/evaluation/eval-basic/line_process.py index e61befd9d50..34f029e1be6 100644 --- a/examples/flows/evaluation/eval-basic/line_process.py +++ b/examples/flows/evaluation/eval-basic/line_process.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool @tool diff --git a/examples/flows/evaluation/eval-chat-math/aggregate.py b/examples/flows/evaluation/eval-chat-math/aggregate.py index 537fd66cf53..0e28e035a52 100644 --- a/examples/flows/evaluation/eval-chat-math/aggregate.py +++ b/examples/flows/evaluation/eval-chat-math/aggregate.py @@ -1,6 +1,6 @@ from typing import List -from promptflow import tool -from promptflow import log_metric +from promptflow.core import tool +from promptflow.core import log_metric @tool diff --git a/examples/flows/evaluation/eval-chat-math/line_process.py b/examples/flows/evaluation/eval-chat-math/line_process.py index 454049e91af..96a29760bdf 100644 --- a/examples/flows/evaluation/eval-chat-math/line_process.py +++ b/examples/flows/evaluation/eval-chat-math/line_process.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool def string_to_number(raw_string: str) -> float: diff --git a/examples/flows/evaluation/eval-classification-accuracy/README.md b/examples/flows/evaluation/eval-classification-accuracy/README.md index 517df33ea7a..5a6509e8e29 100644 --- a/examples/flows/evaluation/eval-classification-accuracy/README.md +++ b/examples/flows/evaluation/eval-classification-accuracy/README.md @@ -9,7 +9,7 @@ Tools used in this flow: In this flow, you will learn - how to compose a point based evaluation flow, where you can calculate point-wise metrics. -- the way to log metrics. use `from promptflow import log_metric` +- the way to log metrics. use `from promptflow.core import log_metric` - see file [calculate_accuracy.py](calculate_accuracy.py) ### 0. Setup connection diff --git a/examples/flows/evaluation/eval-classification-accuracy/calculate_accuracy.py b/examples/flows/evaluation/eval-classification-accuracy/calculate_accuracy.py index 35fbc75977b..4ed635bcd31 100644 --- a/examples/flows/evaluation/eval-classification-accuracy/calculate_accuracy.py +++ b/examples/flows/evaluation/eval-classification-accuracy/calculate_accuracy.py @@ -1,6 +1,6 @@ from typing import List -from promptflow import log_metric, tool +from promptflow.core import log_metric, tool @tool diff --git a/examples/flows/evaluation/eval-classification-accuracy/grade.py b/examples/flows/evaluation/eval-classification-accuracy/grade.py index 96a1106a048..62527ff2ec8 100644 --- a/examples/flows/evaluation/eval-classification-accuracy/grade.py +++ b/examples/flows/evaluation/eval-classification-accuracy/grade.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool @tool diff --git a/examples/flows/evaluation/eval-entity-match-rate/cleansing.py b/examples/flows/evaluation/eval-entity-match-rate/cleansing.py index a017d7f1ab9..31ffea06b98 100644 --- a/examples/flows/evaluation/eval-entity-match-rate/cleansing.py +++ b/examples/flows/evaluation/eval-entity-match-rate/cleansing.py @@ -1,5 +1,5 @@ from typing import List -from promptflow import tool +from promptflow.core import tool @tool diff --git a/examples/flows/evaluation/eval-entity-match-rate/log_metrics.py b/examples/flows/evaluation/eval-entity-match-rate/log_metrics.py index bf45cca8b31..896ff8d38fd 100644 --- a/examples/flows/evaluation/eval-entity-match-rate/log_metrics.py +++ b/examples/flows/evaluation/eval-entity-match-rate/log_metrics.py @@ -1,6 +1,6 @@ -from promptflow import tool +from promptflow.core import tool from typing import List -from promptflow import log_metric +from promptflow.core import log_metric # The inputs section will change based on the arguments of the tool function, after you save the code # Adding type to arguments and return value will help the system show the types properly diff --git a/examples/flows/evaluation/eval-entity-match-rate/match.py b/examples/flows/evaluation/eval-entity-match-rate/match.py index ae7dc993130..a948a9018be 100644 --- a/examples/flows/evaluation/eval-entity-match-rate/match.py +++ b/examples/flows/evaluation/eval-entity-match-rate/match.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool from typing import List diff --git a/examples/flows/evaluation/eval-groundedness/aggregate.py b/examples/flows/evaluation/eval-groundedness/aggregate.py index 7ca1c8b04c1..ad565a458cf 100644 --- a/examples/flows/evaluation/eval-groundedness/aggregate.py +++ b/examples/flows/evaluation/eval-groundedness/aggregate.py @@ -1,5 +1,5 @@ from typing import List -from promptflow import tool +from promptflow.core import tool @tool @@ -23,7 +23,7 @@ def aggregate(groundedness_scores: List[float]): aggregated_results["groundedness"] /= aggregated_results["count"] # Log metric for each variant - from promptflow import log_metric + from promptflow.core import log_metric log_metric(key="groundedness", value=aggregated_results["groundedness"]) diff --git a/examples/flows/evaluation/eval-groundedness/calc_groundedness.py b/examples/flows/evaluation/eval-groundedness/calc_groundedness.py index 0375ad65729..020d19d7520 100644 --- a/examples/flows/evaluation/eval-groundedness/calc_groundedness.py +++ b/examples/flows/evaluation/eval-groundedness/calc_groundedness.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool import re diff --git a/examples/flows/evaluation/eval-perceived-intelligence/aggregate.py b/examples/flows/evaluation/eval-perceived-intelligence/aggregate.py index a73f3f29845..60e1cfc1d1e 100644 --- a/examples/flows/evaluation/eval-perceived-intelligence/aggregate.py +++ b/examples/flows/evaluation/eval-perceived-intelligence/aggregate.py @@ -1,5 +1,5 @@ from typing import List -from promptflow import tool +from promptflow.core import tool @tool @@ -14,7 +14,7 @@ def aggregate(perceived_intelligence_score: List[float]): aggregated_results["perceived_intelligence_score"] /= aggregated_results["count"] # Log metric for each variant - from promptflow import log_metric + from promptflow.core import log_metric log_metric(key="perceived_intelligence_score", value=aggregated_results["perceived_intelligence_score"]) diff --git a/examples/flows/evaluation/eval-perceived-intelligence/parse_score.py b/examples/flows/evaluation/eval-perceived-intelligence/parse_score.py index 0375ad65729..020d19d7520 100644 --- a/examples/flows/evaluation/eval-perceived-intelligence/parse_score.py +++ b/examples/flows/evaluation/eval-perceived-intelligence/parse_score.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool import re diff --git a/examples/flows/evaluation/eval-qna-non-rag/ada_cosine_similarity_score.py b/examples/flows/evaluation/eval-qna-non-rag/ada_cosine_similarity_score.py index ed1aa87f2d2..5d584365f9a 100644 --- a/examples/flows/evaluation/eval-qna-non-rag/ada_cosine_similarity_score.py +++ b/examples/flows/evaluation/eval-qna-non-rag/ada_cosine_similarity_score.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool import numpy as np from numpy.linalg import norm diff --git a/examples/flows/evaluation/eval-qna-non-rag/aggregate_variants_results.py b/examples/flows/evaluation/eval-qna-non-rag/aggregate_variants_results.py index 3b0973f2f1d..0eef04a5ea3 100644 --- a/examples/flows/evaluation/eval-qna-non-rag/aggregate_variants_results.py +++ b/examples/flows/evaluation/eval-qna-non-rag/aggregate_variants_results.py @@ -1,5 +1,5 @@ from typing import List -from promptflow import tool, log_metric +from promptflow.core import tool, log_metric import numpy as np diff --git a/examples/flows/evaluation/eval-qna-non-rag/concat_scores.py b/examples/flows/evaluation/eval-qna-non-rag/concat_scores.py index 94a90846bf1..8238672570a 100644 --- a/examples/flows/evaluation/eval-qna-non-rag/concat_scores.py +++ b/examples/flows/evaluation/eval-qna-non-rag/concat_scores.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool import numpy as np import re diff --git a/examples/flows/evaluation/eval-qna-non-rag/f1_score.py b/examples/flows/evaluation/eval-qna-non-rag/f1_score.py index 8f7ce449980..4b3d17f5fd9 100644 --- a/examples/flows/evaluation/eval-qna-non-rag/f1_score.py +++ b/examples/flows/evaluation/eval-qna-non-rag/f1_score.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool from collections import Counter diff --git a/examples/flows/evaluation/eval-qna-non-rag/select_metrics.py b/examples/flows/evaluation/eval-qna-non-rag/select_metrics.py index 0a2db17d8de..2fcb853aed2 100644 --- a/examples/flows/evaluation/eval-qna-non-rag/select_metrics.py +++ b/examples/flows/evaluation/eval-qna-non-rag/select_metrics.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool @tool diff --git a/examples/flows/evaluation/eval-qna-non-rag/validate_input.py b/examples/flows/evaluation/eval-qna-non-rag/validate_input.py index 02702bb1c51..1f6e15296e4 100644 --- a/examples/flows/evaluation/eval-qna-non-rag/validate_input.py +++ b/examples/flows/evaluation/eval-qna-non-rag/validate_input.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool @tool diff --git a/examples/flows/evaluation/eval-qna-rag-metrics/aggregate_variants_results.py b/examples/flows/evaluation/eval-qna-rag-metrics/aggregate_variants_results.py index fcff09f5ae7..19d7cd848df 100644 --- a/examples/flows/evaluation/eval-qna-rag-metrics/aggregate_variants_results.py +++ b/examples/flows/evaluation/eval-qna-rag-metrics/aggregate_variants_results.py @@ -1,5 +1,5 @@ from typing import List -from promptflow import tool, log_metric +from promptflow.core import tool, log_metric import numpy as np diff --git a/examples/flows/evaluation/eval-qna-rag-metrics/concat_scores.py b/examples/flows/evaluation/eval-qna-rag-metrics/concat_scores.py index 955c835116d..f15b4fba8df 100644 --- a/examples/flows/evaluation/eval-qna-rag-metrics/concat_scores.py +++ b/examples/flows/evaluation/eval-qna-rag-metrics/concat_scores.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool import numpy as np diff --git a/examples/flows/evaluation/eval-qna-rag-metrics/parse_generation_score.py b/examples/flows/evaluation/eval-qna-rag-metrics/parse_generation_score.py index bbddf346c42..1be541f89a7 100644 --- a/examples/flows/evaluation/eval-qna-rag-metrics/parse_generation_score.py +++ b/examples/flows/evaluation/eval-qna-rag-metrics/parse_generation_score.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool import re diff --git a/examples/flows/evaluation/eval-qna-rag-metrics/parse_groundedness_score.py b/examples/flows/evaluation/eval-qna-rag-metrics/parse_groundedness_score.py index bbcc4d455d9..bdd0ba53c9d 100644 --- a/examples/flows/evaluation/eval-qna-rag-metrics/parse_groundedness_score.py +++ b/examples/flows/evaluation/eval-qna-rag-metrics/parse_groundedness_score.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool import re diff --git a/examples/flows/evaluation/eval-qna-rag-metrics/parse_retrival_score.py b/examples/flows/evaluation/eval-qna-rag-metrics/parse_retrival_score.py index ec8f084b9a9..e9e362ecffe 100644 --- a/examples/flows/evaluation/eval-qna-rag-metrics/parse_retrival_score.py +++ b/examples/flows/evaluation/eval-qna-rag-metrics/parse_retrival_score.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool import re diff --git a/examples/flows/evaluation/eval-qna-rag-metrics/select_metrics.py b/examples/flows/evaluation/eval-qna-rag-metrics/select_metrics.py index 29702208831..9aa3a44605d 100644 --- a/examples/flows/evaluation/eval-qna-rag-metrics/select_metrics.py +++ b/examples/flows/evaluation/eval-qna-rag-metrics/select_metrics.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool @tool diff --git a/examples/flows/evaluation/eval-qna-rag-metrics/validate_input.py b/examples/flows/evaluation/eval-qna-rag-metrics/validate_input.py index 66ec5774edd..796a9eec03a 100644 --- a/examples/flows/evaluation/eval-qna-rag-metrics/validate_input.py +++ b/examples/flows/evaluation/eval-qna-rag-metrics/validate_input.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool def is_valid(input_item): diff --git a/examples/flows/evaluation/eval-summarization/average_scores.py b/examples/flows/evaluation/eval-summarization/average_scores.py index e10b4bd8a93..16c59b5528a 100644 --- a/examples/flows/evaluation/eval-summarization/average_scores.py +++ b/examples/flows/evaluation/eval-summarization/average_scores.py @@ -1,6 +1,6 @@ from typing import Dict, List -from promptflow import log_metric, tool +from promptflow.core import log_metric, tool @tool diff --git a/examples/flows/integrations/azure-ai-language/analyze_documents/create_document.py b/examples/flows/integrations/azure-ai-language/analyze_documents/create_document.py index d891b1c4a96..7728ec39788 100644 --- a/examples/flows/integrations/azure-ai-language/analyze_documents/create_document.py +++ b/examples/flows/integrations/azure-ai-language/analyze_documents/create_document.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool @tool diff --git a/examples/flows/integrations/azure-ai-language/analyze_documents/parse_skill_to_text.py b/examples/flows/integrations/azure-ai-language/analyze_documents/parse_skill_to_text.py index 7bf7d4e1c3a..acc7d2d6df9 100644 --- a/examples/flows/integrations/azure-ai-language/analyze_documents/parse_skill_to_text.py +++ b/examples/flows/integrations/azure-ai-language/analyze_documents/parse_skill_to_text.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool @tool diff --git a/examples/flows/integrations/azure-ai-language/analyze_documents/read_file.py b/examples/flows/integrations/azure-ai-language/analyze_documents/read_file.py index 18a73b32042..da4b58089c7 100644 --- a/examples/flows/integrations/azure-ai-language/analyze_documents/read_file.py +++ b/examples/flows/integrations/azure-ai-language/analyze_documents/read_file.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool @tool diff --git a/examples/flows/integrations/azure-ai-language/analyze_meetings/create_conversation.py b/examples/flows/integrations/azure-ai-language/analyze_meetings/create_conversation.py index fdd2b8dd730..44449e40f30 100644 --- a/examples/flows/integrations/azure-ai-language/analyze_meetings/create_conversation.py +++ b/examples/flows/integrations/azure-ai-language/analyze_meetings/create_conversation.py @@ -1,5 +1,5 @@ from enum import Enum -from promptflow import tool +from promptflow.core import tool class ConversationModality(str, Enum): diff --git a/examples/flows/integrations/azure-ai-language/analyze_meetings/create_document.py b/examples/flows/integrations/azure-ai-language/analyze_meetings/create_document.py index d891b1c4a96..7728ec39788 100644 --- a/examples/flows/integrations/azure-ai-language/analyze_meetings/create_document.py +++ b/examples/flows/integrations/azure-ai-language/analyze_meetings/create_document.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool @tool diff --git a/examples/flows/integrations/azure-ai-language/analyze_meetings/create_redacted_conversation.py b/examples/flows/integrations/azure-ai-language/analyze_meetings/create_redacted_conversation.py index 283bfa28eb3..b63605d26cd 100644 --- a/examples/flows/integrations/azure-ai-language/analyze_meetings/create_redacted_conversation.py +++ b/examples/flows/integrations/azure-ai-language/analyze_meetings/create_redacted_conversation.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool @tool diff --git a/examples/flows/integrations/azure-ai-language/analyze_meetings/extract_language_code.py b/examples/flows/integrations/azure-ai-language/analyze_meetings/extract_language_code.py index 768cd1d1f28..ca17572dc37 100644 --- a/examples/flows/integrations/azure-ai-language/analyze_meetings/extract_language_code.py +++ b/examples/flows/integrations/azure-ai-language/analyze_meetings/extract_language_code.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool @tool diff --git a/examples/flows/integrations/azure-ai-language/analyze_meetings/read_file.py b/examples/flows/integrations/azure-ai-language/analyze_meetings/read_file.py index 18a73b32042..da4b58089c7 100644 --- a/examples/flows/integrations/azure-ai-language/analyze_meetings/read_file.py +++ b/examples/flows/integrations/azure-ai-language/analyze_meetings/read_file.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool @tool diff --git a/examples/flows/standard/autonomous-agent/autogpt_easy_start.py b/examples/flows/standard/autonomous-agent/autogpt_easy_start.py index 945b714954e..04bc1c1fae0 100644 --- a/examples/flows/standard/autonomous-agent/autogpt_easy_start.py +++ b/examples/flows/standard/autonomous-agent/autogpt_easy_start.py @@ -1,6 +1,6 @@ from typing import Union -from promptflow import tool +from promptflow.core import tool from promptflow.connections import AzureOpenAIConnection, OpenAIConnection diff --git a/examples/flows/standard/autonomous-agent/functions.py b/examples/flows/standard/autonomous-agent/functions.py index 33eb276f777..2893c67d8c1 100644 --- a/examples/flows/standard/autonomous-agent/functions.py +++ b/examples/flows/standard/autonomous-agent/functions.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool @tool diff --git a/examples/flows/standard/autonomous-agent/generate_goal.py b/examples/flows/standard/autonomous-agent/generate_goal.py index 0cff4a431bf..5c3c04005cd 100644 --- a/examples/flows/standard/autonomous-agent/generate_goal.py +++ b/examples/flows/standard/autonomous-agent/generate_goal.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool @tool diff --git a/examples/flows/standard/basic-with-connection/hello.py b/examples/flows/standard/basic-with-connection/hello.py index 246c77af520..dce6f5768ab 100644 --- a/examples/flows/standard/basic-with-connection/hello.py +++ b/examples/flows/standard/basic-with-connection/hello.py @@ -1,7 +1,7 @@ from typing import Union from openai.version import VERSION as OPENAI_VERSION -from promptflow import tool +from promptflow.core import tool from promptflow.connections import CustomConnection, AzureOpenAIConnection # The inputs section will change based on the arguments of the tool function, after you save the code diff --git a/examples/flows/standard/basic/hello.py b/examples/flows/standard/basic/hello.py index 07da0d31c1a..74d95785d0a 100644 --- a/examples/flows/standard/basic/hello.py +++ b/examples/flows/standard/basic/hello.py @@ -2,7 +2,7 @@ from openai.version import VERSION as OPENAI_VERSION from dotenv import load_dotenv -from promptflow import tool +from promptflow.core import tool # The inputs section will change based on the arguments of the tool function, after you save the code # Adding type to arguments and return value will help the system show the types properly diff --git a/examples/flows/standard/conditional-flow-for-if-else/content_safety_check.py b/examples/flows/standard/conditional-flow-for-if-else/content_safety_check.py index 79516e69fab..0dd223dcf8e 100644 --- a/examples/flows/standard/conditional-flow-for-if-else/content_safety_check.py +++ b/examples/flows/standard/conditional-flow-for-if-else/content_safety_check.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool import random diff --git a/examples/flows/standard/conditional-flow-for-if-else/default_result.py b/examples/flows/standard/conditional-flow-for-if-else/default_result.py index a4b547f337b..d892db77e69 100644 --- a/examples/flows/standard/conditional-flow-for-if-else/default_result.py +++ b/examples/flows/standard/conditional-flow-for-if-else/default_result.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool @tool diff --git a/examples/flows/standard/conditional-flow-for-if-else/generate_result.py b/examples/flows/standard/conditional-flow-for-if-else/generate_result.py index c238605bc22..872217f6807 100644 --- a/examples/flows/standard/conditional-flow-for-if-else/generate_result.py +++ b/examples/flows/standard/conditional-flow-for-if-else/generate_result.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool @tool diff --git a/examples/flows/standard/conditional-flow-for-if-else/llm_result.py b/examples/flows/standard/conditional-flow-for-if-else/llm_result.py index 82b1910cc9e..d1624bb5e0e 100644 --- a/examples/flows/standard/conditional-flow-for-if-else/llm_result.py +++ b/examples/flows/standard/conditional-flow-for-if-else/llm_result.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool @tool diff --git a/examples/flows/standard/conditional-flow-for-switch/class_check.py b/examples/flows/standard/conditional-flow-for-switch/class_check.py index 6cd08108575..da253db5304 100644 --- a/examples/flows/standard/conditional-flow-for-switch/class_check.py +++ b/examples/flows/standard/conditional-flow-for-switch/class_check.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool @tool diff --git a/examples/flows/standard/conditional-flow-for-switch/generate_response.py b/examples/flows/standard/conditional-flow-for-switch/generate_response.py index ed20a46e0ce..f2ae7b4469d 100644 --- a/examples/flows/standard/conditional-flow-for-switch/generate_response.py +++ b/examples/flows/standard/conditional-flow-for-switch/generate_response.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool @tool diff --git a/examples/flows/standard/conditional-flow-for-switch/order_search.py b/examples/flows/standard/conditional-flow-for-switch/order_search.py index f4cb3b8030d..d910bf8ed7a 100644 --- a/examples/flows/standard/conditional-flow-for-switch/order_search.py +++ b/examples/flows/standard/conditional-flow-for-switch/order_search.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool @tool diff --git a/examples/flows/standard/conditional-flow-for-switch/product_info.py b/examples/flows/standard/conditional-flow-for-switch/product_info.py index 0f4a879a0e2..f18b5557eaa 100644 --- a/examples/flows/standard/conditional-flow-for-switch/product_info.py +++ b/examples/flows/standard/conditional-flow-for-switch/product_info.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool @tool diff --git a/examples/flows/standard/conditional-flow-for-switch/product_recommendation.py b/examples/flows/standard/conditional-flow-for-switch/product_recommendation.py index 8ee53314ca6..a38cb0f5398 100644 --- a/examples/flows/standard/conditional-flow-for-switch/product_recommendation.py +++ b/examples/flows/standard/conditional-flow-for-switch/product_recommendation.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool @tool diff --git a/examples/flows/standard/customer-intent-extraction/extract_intent_tool.py b/examples/flows/standard/customer-intent-extraction/extract_intent_tool.py index ec71f45ec5d..218517989de 100644 --- a/examples/flows/standard/customer-intent-extraction/extract_intent_tool.py +++ b/examples/flows/standard/customer-intent-extraction/extract_intent_tool.py @@ -1,6 +1,6 @@ import os -from promptflow import tool +from promptflow.core import tool from promptflow.connections import CustomConnection from intent import extract_intent diff --git a/examples/flows/standard/describe-image/flip_image.py b/examples/flows/standard/describe-image/flip_image.py index b106b79cd42..6972b5130b3 100644 --- a/examples/flows/standard/describe-image/flip_image.py +++ b/examples/flows/standard/describe-image/flip_image.py @@ -1,5 +1,5 @@ import io -from promptflow import tool +from promptflow.core import tool from promptflow.contracts.multimedia import Image from PIL import Image as PIL_Image diff --git a/examples/flows/standard/gen-docstring/combine_code_tool.py b/examples/flows/standard/gen-docstring/combine_code_tool.py index cf629507f69..619a7a407c2 100644 --- a/examples/flows/standard/gen-docstring/combine_code_tool.py +++ b/examples/flows/standard/gen-docstring/combine_code_tool.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool from divider import Divider from typing import List diff --git a/examples/flows/standard/gen-docstring/divide_code_tool.py b/examples/flows/standard/gen-docstring/divide_code_tool.py index 5a02f061d65..9720c9c9e26 100644 --- a/examples/flows/standard/gen-docstring/divide_code_tool.py +++ b/examples/flows/standard/gen-docstring/divide_code_tool.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool from divider import Divider diff --git a/examples/flows/standard/gen-docstring/generate_docstring_tool.py b/examples/flows/standard/gen-docstring/generate_docstring_tool.py index 6368a83bc43..a7f09dcda41 100644 --- a/examples/flows/standard/gen-docstring/generate_docstring_tool.py +++ b/examples/flows/standard/gen-docstring/generate_docstring_tool.py @@ -4,7 +4,7 @@ import os import sys from typing import Union, List -from promptflow import tool +from promptflow.core import tool from azure_open_ai import ChatLLM from divider import Divider from prompt import docstring_prompt, PromptLimitException diff --git a/examples/flows/standard/gen-docstring/load_code_tool.py b/examples/flows/standard/gen-docstring/load_code_tool.py index ae4d10799b5..2369d002ac0 100644 --- a/examples/flows/standard/gen-docstring/load_code_tool.py +++ b/examples/flows/standard/gen-docstring/load_code_tool.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool from file import File diff --git a/examples/flows/standard/maths-to-code/code_execution.py b/examples/flows/standard/maths-to-code/code_execution.py index 2c082e28a5f..1df8a357531 100644 --- a/examples/flows/standard/maths-to-code/code_execution.py +++ b/examples/flows/standard/maths-to-code/code_execution.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool import sys from io import StringIO diff --git a/examples/flows/standard/maths-to-code/code_refine.py b/examples/flows/standard/maths-to-code/code_refine.py index 0e671c4fc58..a76d8b1592b 100644 --- a/examples/flows/standard/maths-to-code/code_refine.py +++ b/examples/flows/standard/maths-to-code/code_refine.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool import ast import json diff --git a/examples/flows/standard/maths-to-code/math_example.py b/examples/flows/standard/maths-to-code/math_example.py index 74ce04fb1ff..eeef55dca66 100644 --- a/examples/flows/standard/maths-to-code/math_example.py +++ b/examples/flows/standard/maths-to-code/math_example.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool @tool diff --git a/examples/flows/standard/named-entity-recognition/cleansing.py b/examples/flows/standard/named-entity-recognition/cleansing.py index a017d7f1ab9..31ffea06b98 100644 --- a/examples/flows/standard/named-entity-recognition/cleansing.py +++ b/examples/flows/standard/named-entity-recognition/cleansing.py @@ -1,5 +1,5 @@ from typing import List -from promptflow import tool +from promptflow.core import tool @tool diff --git a/examples/flows/standard/web-classification/convert_to_dict.py b/examples/flows/standard/web-classification/convert_to_dict.py index 8e9490b801a..8ca97ff42d9 100644 --- a/examples/flows/standard/web-classification/convert_to_dict.py +++ b/examples/flows/standard/web-classification/convert_to_dict.py @@ -1,6 +1,6 @@ import json -from promptflow import tool +from promptflow.core import tool @tool diff --git a/examples/flows/standard/web-classification/fetch_text_content_from_url.py b/examples/flows/standard/web-classification/fetch_text_content_from_url.py index 1ff7f792909..47cfde8b8af 100644 --- a/examples/flows/standard/web-classification/fetch_text_content_from_url.py +++ b/examples/flows/standard/web-classification/fetch_text_content_from_url.py @@ -1,7 +1,7 @@ import bs4 import requests -from promptflow import tool +from promptflow.core import tool @tool diff --git a/examples/flows/standard/web-classification/prepare_examples.py b/examples/flows/standard/web-classification/prepare_examples.py index c4ccb76d732..c6cf34c35bf 100644 --- a/examples/flows/standard/web-classification/prepare_examples.py +++ b/examples/flows/standard/web-classification/prepare_examples.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool @tool diff --git a/examples/flows/standard/web-classification/requirements.txt b/examples/flows/standard/web-classification/requirements.txt index ccef8cfd3cc..9ee5995790e 100644 --- a/examples/flows/standard/web-classification/requirements.txt +++ b/examples/flows/standard/web-classification/requirements.txt @@ -1,3 +1,3 @@ -promptflow[azure] +promptflow[azure]>=1.7.0 promptflow-tools bs4 \ No newline at end of file diff --git a/examples/tools/tool-package-quickstart/my_tool_package/tools/my_tool_1.py b/examples/tools/tool-package-quickstart/my_tool_package/tools/my_tool_1.py index aab5630f3e3..7287a7dc9ef 100644 --- a/examples/tools/tool-package-quickstart/my_tool_package/tools/my_tool_1.py +++ b/examples/tools/tool-package-quickstart/my_tool_package/tools/my_tool_1.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool from promptflow.connections import CustomConnection diff --git a/examples/tools/tool-package-quickstart/my_tool_package/tools/my_tool_2.py b/examples/tools/tool-package-quickstart/my_tool_package/tools/my_tool_2.py index 7921e62f4dc..636ee0436e4 100644 --- a/examples/tools/tool-package-quickstart/my_tool_package/tools/my_tool_2.py +++ b/examples/tools/tool-package-quickstart/my_tool_package/tools/my_tool_2.py @@ -1,4 +1,4 @@ -from promptflow import ToolProvider, tool +from promptflow.core import ToolProvider, tool from promptflow.connections import CustomConnection diff --git a/examples/tools/tool-package-quickstart/my_tool_package/tools/tool_with_cascading_inputs.py b/examples/tools/tool-package-quickstart/my_tool_package/tools/tool_with_cascading_inputs.py index 0b706f52884..2ba68cda6fe 100644 --- a/examples/tools/tool-package-quickstart/my_tool_package/tools/tool_with_cascading_inputs.py +++ b/examples/tools/tool-package-quickstart/my_tool_package/tools/tool_with_cascading_inputs.py @@ -1,6 +1,6 @@ from enum import Enum -from promptflow import tool +from promptflow.core import tool class UserType(str, Enum): diff --git a/examples/tools/tool-package-quickstart/my_tool_package/tools/tool_with_custom_llm_type.py b/examples/tools/tool-package-quickstart/my_tool_package/tools/tool_with_custom_llm_type.py index 9aad08fddb3..55bb94f139a 100644 --- a/examples/tools/tool-package-quickstart/my_tool_package/tools/tool_with_custom_llm_type.py +++ b/examples/tools/tool-package-quickstart/my_tool_package/tools/tool_with_custom_llm_type.py @@ -1,5 +1,5 @@ from jinja2 import Template -from promptflow import tool +from promptflow.core import tool from promptflow.connections import CustomConnection from promptflow.contracts.types import PromptTemplate diff --git a/examples/tools/tool-package-quickstart/my_tool_package/tools/tool_with_custom_strong_type_connection.py b/examples/tools/tool-package-quickstart/my_tool_package/tools/tool_with_custom_strong_type_connection.py index 4450d49b198..7b965bb048c 100644 --- a/examples/tools/tool-package-quickstart/my_tool_package/tools/tool_with_custom_strong_type_connection.py +++ b/examples/tools/tool-package-quickstart/my_tool_package/tools/tool_with_custom_strong_type_connection.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool from promptflow.connections import CustomStrongTypeConnection from promptflow.contracts.types import Secret diff --git a/examples/tools/tool-package-quickstart/my_tool_package/tools/tool_with_dynamic_list_input.py b/examples/tools/tool-package-quickstart/my_tool_package/tools/tool_with_dynamic_list_input.py index 87b391f67b8..b106757b01c 100644 --- a/examples/tools/tool-package-quickstart/my_tool_package/tools/tool_with_dynamic_list_input.py +++ b/examples/tools/tool-package-quickstart/my_tool_package/tools/tool_with_dynamic_list_input.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool from typing import List, Union, Dict diff --git a/examples/tools/tool-package-quickstart/my_tool_package/tools/tool_with_file_path_input.py b/examples/tools/tool-package-quickstart/my_tool_package/tools/tool_with_file_path_input.py index 83af836751e..76d75039a4a 100644 --- a/examples/tools/tool-package-quickstart/my_tool_package/tools/tool_with_file_path_input.py +++ b/examples/tools/tool-package-quickstart/my_tool_package/tools/tool_with_file_path_input.py @@ -1,6 +1,6 @@ import importlib from pathlib import Path -from promptflow import tool +from promptflow.core import tool from promptflow.contracts.types import FilePath diff --git a/examples/tools/tool-package-quickstart/my_tool_package/tools/tool_with_generated_by_input.py b/examples/tools/tool-package-quickstart/my_tool_package/tools/tool_with_generated_by_input.py index 898eff128af..ff6a923c1e9 100644 --- a/examples/tools/tool-package-quickstart/my_tool_package/tools/tool_with_generated_by_input.py +++ b/examples/tools/tool-package-quickstart/my_tool_package/tools/tool_with_generated_by_input.py @@ -1,6 +1,6 @@ from typing import Union -from promptflow import tool +from promptflow.core import tool from typing import Dict, List from promptflow.connections import AzureOpenAIConnection, OpenAIConnection, CognitiveSearchConnection diff --git a/examples/tools/use-cases/custom-strong-type-connection-package-tool-showcase/requirements.txt b/examples/tools/use-cases/custom-strong-type-connection-package-tool-showcase/requirements.txt index 9ae1aaa439a..af50f7418c2 100644 --- a/examples/tools/use-cases/custom-strong-type-connection-package-tool-showcase/requirements.txt +++ b/examples/tools/use-cases/custom-strong-type-connection-package-tool-showcase/requirements.txt @@ -1,2 +1,2 @@ -promptflow[azure]==1.1.0 +promptflow[azure] my-tools-package==0.0.5 diff --git a/examples/tools/use-cases/custom-strong-type-connection-script-tool-showcase/my_script_tool.py b/examples/tools/use-cases/custom-strong-type-connection-script-tool-showcase/my_script_tool.py index b2d0d7d0377..6a568678147 100644 --- a/examples/tools/use-cases/custom-strong-type-connection-script-tool-showcase/my_script_tool.py +++ b/examples/tools/use-cases/custom-strong-type-connection-script-tool-showcase/my_script_tool.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool from promptflow.connections import CustomStrongTypeConnection from promptflow.contracts.types import Secret diff --git a/examples/tools/use-cases/custom-strong-type-connection-script-tool-showcase/requirements.txt b/examples/tools/use-cases/custom-strong-type-connection-script-tool-showcase/requirements.txt index 7f40ec1297c..957c9676144 100644 --- a/examples/tools/use-cases/custom-strong-type-connection-script-tool-showcase/requirements.txt +++ b/examples/tools/use-cases/custom-strong-type-connection-script-tool-showcase/requirements.txt @@ -1 +1 @@ -promptflow[azure]==1.1.0 +promptflow[azure] diff --git a/examples/tutorials/e2e-development/chat-with-pdf.md b/examples/tutorials/e2e-development/chat-with-pdf.md index 85b04769f4e..a39f121896b 100644 --- a/examples/tutorials/e2e-development/chat-with-pdf.md +++ b/examples/tutorials/e2e-development/chat-with-pdf.md @@ -162,7 +162,7 @@ Check out below: E.g. build_index_tool wrapper: ```python -from promptflow import tool +from promptflow.core import tool from chat_with_pdf.build_index import create_faiss_index diff --git a/examples/tutorials/flow-deploy/create-service-with-flow/echo_connection_flow/echo_connection.py b/examples/tutorials/flow-deploy/create-service-with-flow/echo_connection_flow/echo_connection.py index 9a661708289..a3362a8e5e4 100644 --- a/examples/tutorials/flow-deploy/create-service-with-flow/echo_connection_flow/echo_connection.py +++ b/examples/tutorials/flow-deploy/create-service-with-flow/echo_connection_flow/echo_connection.py @@ -1,4 +1,4 @@ -from promptflow import tool +from promptflow.core import tool from promptflow.connections import AzureOpenAIConnection