repo_id
stringlengths
15
132
file_path
stringlengths
34
176
content
stringlengths
2
3.52M
__index_level_0__
int64
0
0
promptflow_repo/promptflow/examples
promptflow_repo/promptflow/examples/connections/openai.yml
$schema: https://azuremlschemas.azureedge.net/promptflow/latest/OpenAIConnection.schema.json name: open_ai_connection type: open_ai api_key: "<user-input>" organization: "" # optional
0
promptflow_repo/promptflow/examples
promptflow_repo/promptflow/examples/connections/requirements.txt
promptflow promptflow-tools python-dotenv
0
promptflow_repo/promptflow/examples
promptflow_repo/promptflow/examples/connections/cognitive_search.yml
$schema: https://azuremlschemas.azureedge.net/promptflow/latest/CognitiveSearchConnection.schema.json name: cognitive_search_connection type: cognitive_search api_key: "<to-be-replaced>" api_base: "endpoint" api_version: "2023-07-01-Preview"
0
promptflow_repo/promptflow/examples
promptflow_repo/promptflow/examples/connections/connection.ipynb
%pip install -r ../requirements.txtfrom promptflow import PFClient # client can help manage your runs and connections. client = PFClient()from promptflow.entities import AzureOpenAIConnection # Initialize an AzureOpenAIConnection object connection = AzureOpenAIConnection( name="my_azure_open_ai_connection", a...
0
promptflow_repo/promptflow/examples/tutorials
promptflow_repo/promptflow/examples/tutorials/get-started/quickstart-azure.ipynb
%pip install -r ../../requirements.txtimport json # Import required libraries from azure.identity import DefaultAzureCredential, InteractiveBrowserCredential # azure version promptflow apis from promptflow.azure import PFClienttry: credential = DefaultAzureCredential() # Check if given credential can get toke...
0
promptflow_repo/promptflow/examples/tutorials
promptflow_repo/promptflow/examples/tutorials/get-started/flow-as-function.ipynb
from promptflow import load_flow flow_path = "../../flows/standard/web-classification" sample_url = "https://www.youtube.com/watch?v=o5ZQyXaAv1g" f = load_flow(source=flow_path) result = f(url=sample_url) print(result)# provide parameters to create connection conn_name = "new_ai_connection" api_key = "<user-input>...
0
promptflow_repo/promptflow/examples/tutorials
promptflow_repo/promptflow/examples/tutorials/get-started/quickstart.ipynb
%pip install -r ../../requirements.txtimport json from promptflow import PFClient from promptflow.connections import AzureOpenAIConnection, OpenAIConnection # client can help manage your runs and connections. pf = PFClient()try: conn_name = "open_ai_connection" conn = pf.connections.get(name=conn_name) pri...
0
promptflow_repo/promptflow/examples/tutorials
promptflow_repo/promptflow/examples/tutorials/run-management/cloud-run-management.ipynb
%pip install -r ../../requirements.txtfrom azure.identity import DefaultAzureCredential, InteractiveBrowserCredential from azure.ai.ml.entities import Data from azure.core.exceptions import ResourceNotFoundError from promptflow.azure import PFClient from promptflow.entities import Runtry: credential = DefaultAzure...
0
promptflow_repo/promptflow/examples/tutorials
promptflow_repo/promptflow/examples/tutorials/run-management/run-management.ipynb
%pip install -r ../../requirements.txtimport json from promptflow import PFClient from promptflow.connections import AzureOpenAIConnection, OpenAIConnection # client can help manage your runs and connections. pf = PFClient()try: conn_name = "open_ai_connection" conn = pf.connections.get(name=conn_name) pri...
0
promptflow_repo/promptflow/examples/tutorials
promptflow_repo/promptflow/examples/tutorials/flow-fine-tuning-evaluation/promptflow-quality-improvement.md
--- resources: examples/connections/azure_openai.yml, examples/flows/chat/basic-chat, examples/flows/chat/chat-math-variant, examples/flows/evaluation/eval-chat-math --- # Tutorial: How prompt flow helps on quality improvement This tutorial is designed to enhance your understanding of improving flow quality through p...
0
promptflow_repo/promptflow/examples/tutorials
promptflow_repo/promptflow/examples/tutorials/flow-deploy/README.md
# Deploy flow as applications This folder contains examples of how to build & deploy flow as applications like Web Application packaged in Docker format.
0
promptflow_repo/promptflow/examples/tutorials/flow-deploy
promptflow_repo/promptflow/examples/tutorials/flow-deploy/distribute-flow-as-executable-app/app.spec
# -*- mode: python ; coding: utf-8 -*- from PyInstaller.utils.hooks import collect_data_files from PyInstaller.utils.hooks import copy_metadata datas = [('connections', 'connections'), ('flow', 'flow'), ('settings.json', '.'), ('main.py', '.'), ('{{streamlit_runtime_interpreter_path}}', './streamlit/runtime')] datas +...
0
promptflow_repo/promptflow/examples/tutorials/flow-deploy
promptflow_repo/promptflow/examples/tutorials/flow-deploy/distribute-flow-as-executable-app/app.py
import os import sys from promptflow._cli._pf._connection import create_connection from streamlit.web import cli as st_cli from streamlit.runtime import exists from main import start def is_yaml_file(file_path): _, file_extension = os.path.splitext(file_path) return file_extension.lower() in ('.yaml', '.yml...
0
promptflow_repo/promptflow/examples/tutorials/flow-deploy
promptflow_repo/promptflow/examples/tutorials/flow-deploy/distribute-flow-as-executable-app/README.md
--- resources: examples/connections/azure_openai.yml, examples/flows/standard/web-classification --- # Distribute flow as executable app This example demos how to package flow as a executable app. We will use [web-classification](../../../flows/standard/web-classification/README.md) as example in this tutorial. Pleas...
0
promptflow_repo/promptflow/examples/tutorials/flow-deploy
promptflow_repo/promptflow/examples/tutorials/flow-deploy/distribute-flow-as-executable-app/main.py
import base64 import json import os import re import streamlit as st from pathlib import Path from streamlit_quill import st_quill # noqa: F401 from bs4 import BeautifulSoup, NavigableString, Tag from promptflow._sdk._utils import print_yellow_warning from promptflow._sdk._serving.flow_invoker import FlowInvoker from...
0
promptflow_repo/promptflow/examples/tutorials/flow-deploy
promptflow_repo/promptflow/examples/tutorials/flow-deploy/kubernetes/README.md
--- resources: examples/connections/azure_openai.yml, examples/flows/standard/web-classification --- # Deploy flow using Kubernetes This example demos how to deploy flow as a Kubernetes app. We will use [web-classification](../../../flows/standard/web-classification/README.md) as example in this tutorial. Please ensu...
0
promptflow_repo/promptflow/examples/tutorials/flow-deploy
promptflow_repo/promptflow/examples/tutorials/flow-deploy/kubernetes/deployment.yaml
--- kind: Namespace apiVersion: v1 metadata: name: web-classification --- apiVersion: v1 kind: Secret metadata: name: open-ai-connection-api-key namespace: web-classification type: Opaque data: open-ai-connection-api-key: <encoded_secret> --- apiVersion: v1 kind: Service metadata: name: web-classification-ser...
0
promptflow_repo/promptflow/examples/tutorials/flow-deploy
promptflow_repo/promptflow/examples/tutorials/flow-deploy/create-service-with-flow/README.md
--- resources: examples/tutorials/flow-deploy/create-service-with-flow --- # Create service with flow This example shows how to create a simple service with flow. You can create your own service by utilize `flow-as-function`. This folder contains a example on how to build a service with a flow. Reference [here](./s...
0
promptflow_repo/promptflow/examples/tutorials/flow-deploy
promptflow_repo/promptflow/examples/tutorials/flow-deploy/create-service-with-flow/simple_score.py
import json import logging from flask import Flask, jsonify, request from promptflow import load_flow from promptflow.connections import AzureOpenAIConnection from promptflow.entities import FlowContext from promptflow.exceptions import SystemErrorException, UserErrorException class SimpleScoreApp(Flask): pass ...
0
promptflow_repo/promptflow/examples/tutorials/flow-deploy/create-service-with-flow
promptflow_repo/promptflow/examples/tutorials/flow-deploy/create-service-with-flow/echo_connection_flow/echo_connection.py
from promptflow import tool from promptflow.connections import AzureOpenAIConnection @tool def echo_connection(flow_input: str, node_input: str, connection: AzureOpenAIConnection): print(f"Flow input: {flow_input}") print(f"Node input: {node_input}") print(f"Flow connection: {connection._to_dict()}") ...
0
promptflow_repo/promptflow/examples/tutorials/flow-deploy/create-service-with-flow
promptflow_repo/promptflow/examples/tutorials/flow-deploy/create-service-with-flow/echo_connection_flow/flow.dag.yaml
$schema: https://azuremlschemas.azureedge.net/promptflow/latest/Flow.schema.json inputs: flow_input: type: string outputs: output: type: object reference: ${echo_connection.output} nodes: - name: echo_connection type: python source: type: code path: echo_connection.py inputs: flow_inpu...
0
promptflow_repo/promptflow/examples/tutorials/flow-deploy
promptflow_repo/promptflow/examples/tutorials/flow-deploy/docker/README.md
--- resources: examples/connections/azure_openai.yml, examples/flows/standard/web-classification --- # Deploy a flow using Docker This example demos how to deploy flow as a docker app. We will use [web-classification](../../../flows/standard/web-classification/README.md) as example in this tutorial. ## Build a flow ...
0
promptflow_repo/promptflow/examples/tutorials/flow-deploy
promptflow_repo/promptflow/examples/tutorials/flow-deploy/azure-app-service/README.md
--- resources: examples/connections/azure_openai.yml, examples/flows/standard/web-classification --- # Deploy flow using Azure App Service This example demos how to deploy a flow using Azure App Service. [Azure App Service](https://learn.microsoft.com/azure/app-service/) is an HTTP-based service for hosting web appl...
0
promptflow_repo/promptflow/examples/tutorials/flow-deploy
promptflow_repo/promptflow/examples/tutorials/flow-deploy/azure-app-service/deploy.ps1
<# .DESCRIPTION Script to deploy promptflow to Azure App Service. .PARAMETER path The folder path to be deployed .PARAMETER image_tag The container image tag. .PARAMETER registry The container registry name, for example 'xx.azurecr.io'. .PARAMETER name The app name to produce a unique FQDN as AppName.azurewebsites.net...
0
promptflow_repo/promptflow/examples/tutorials/flow-deploy
promptflow_repo/promptflow/examples/tutorials/flow-deploy/azure-app-service/deploy.sh
#! /bin/bash set -e program_name=$0 function usage { echo "usage: $program_name [-i|-image_tag|--image_tag]" echo " -i|-image_tag|--image_tag specify container image tag" echo " -r|-registry|--registry specify container registry name, for example 'xx.azurecr.io...
0
promptflow_repo/promptflow/examples/tutorials
promptflow_repo/promptflow/examples/tutorials/e2e-development/chat-with-pdf.md
--- resources: examples/connections/azure_openai.yml, examples/flows/chat/chat-with-pdf --- # Tutorial: Chat with PDF ## Overview Retrieval Augmented Generation (or RAG) has become a prevalent pattern to build intelligent application with Large Language Models (or LLMs) since it can infuse external knowledge into the...
0
promptflow_repo/promptflow/examples/tutorials
promptflow_repo/promptflow/examples/tutorials/flow-in-pipeline/pipeline.ipynb
# import required libraries from azure.identity import DefaultAzureCredential, InteractiveBrowserCredential from azure.ai.ml import MLClient, load_component, Input from azure.ai.ml.constants import AssetTypes from azure.ai.ml.dsl import pipelinetry: credential = DefaultAzureCredential() # Check if given creden...
0
promptflow_repo/promptflow/examples/tools/use-cases
promptflow_repo/promptflow/examples/tools/use-cases/dynamic-list-input-tool-showcase/README.md
# Basic flow with tool using a dynamic list input This is a flow demonstrating how to use a tool with a dynamic list input. Tools used in this flow: - `python` Tool Connections used in this flow: - None ## Prerequisites Install promptflow sdk and other dependencies: ```bash pip install -r requirements.txt ``` ## R...
0
promptflow_repo/promptflow/examples/tools/use-cases
promptflow_repo/promptflow/examples/tools/use-cases/dynamic-list-input-tool-showcase/requirements.txt
promptflow my-tools-package
0
promptflow_repo/promptflow/examples/tools/use-cases
promptflow_repo/promptflow/examples/tools/use-cases/dynamic-list-input-tool-showcase/flow.dag.yaml
$schema: https://azuremlschemas.azureedge.net/promptflow/latest/Flow.schema.json inputs: {} outputs: output: type: string reference: ${My_Tool_with_Dynamic_List_Input_cywc.output} nodes: - name: My_Tool_with_Dynamic_List_Input_cywc type: python source: type: package tool: my_tool_package.tools.too...
0
promptflow_repo/promptflow/examples/tools/use-cases
promptflow_repo/promptflow/examples/tools/use-cases/custom-strong-type-connection-script-tool-showcase/data.jsonl
{"text": "Python Hello World!"} {"text": "C Hello World!"} {"text": "C# Hello World!"}
0
promptflow_repo/promptflow/examples/tools/use-cases
promptflow_repo/promptflow/examples/tools/use-cases/custom-strong-type-connection-script-tool-showcase/custom.yml
$schema: https://azuremlschemas.azureedge.net/promptflow/latest/CustomConnection.schema.json name: normal_custom_connection type: custom configs: api_base: test secrets: # must-have api_key: <to-be-replaced>
0
promptflow_repo/promptflow/examples/tools/use-cases
promptflow_repo/promptflow/examples/tools/use-cases/custom-strong-type-connection-script-tool-showcase/README.md
# Basic flow with script tool using custom strong type connection This is a flow demonstrating the use of a script tool with custom string type connection which provides a secure way to manage credentials for external APIs and data sources, and it offers an improved user-friendly and intellisense experience compared to...
0
promptflow_repo/promptflow/examples/tools/use-cases
promptflow_repo/promptflow/examples/tools/use-cases/custom-strong-type-connection-script-tool-showcase/my_script_tool.py
from promptflow import tool from promptflow.connections import CustomStrongTypeConnection from promptflow.contracts.types import Secret class MyCustomConnection(CustomStrongTypeConnection): """My custom strong type connection. :param api_key: The api key. :type api_key: Secret :param api_base: The ap...
0
promptflow_repo/promptflow/examples/tools/use-cases
promptflow_repo/promptflow/examples/tools/use-cases/custom-strong-type-connection-script-tool-showcase/requirements.txt
promptflow[azure]==1.1.0
0
promptflow_repo/promptflow/examples/tools/use-cases
promptflow_repo/promptflow/examples/tools/use-cases/custom-strong-type-connection-script-tool-showcase/flow.dag.yaml
$schema: https://azuremlschemas.azureedge.net/promptflow/latest/Flow.schema.json inputs: text: type: string default: Microsoft outputs: my_output: type: string reference: ${my_script_tool.output} nodes: - name: my_script_tool type: python source: type: code path: my_script_tool.py inpu...
0
promptflow_repo/promptflow/examples/tools/use-cases
promptflow_repo/promptflow/examples/tools/use-cases/custom_llm_tool_showcase/custom_connection.yml
$schema: https://azuremlschemas.azureedge.net/promptflow/latest/CustomConnection.schema.json name: basic_custom_connection type: custom configs: api_base: <to-be-replaced> secrets: # must-have api_key: <to-be-replaced>
0
promptflow_repo/promptflow/examples/tools/use-cases
promptflow_repo/promptflow/examples/tools/use-cases/custom_llm_tool_showcase/README.md
# Flow with custom_llm tool This is a flow demonstrating how to use a `custom_llm` tool, which enables users to seamlessly connect to a large language model with prompt tuning experience using a `PromptTemplate`. Tools used in this flow: - `custom_llm` Tool Connections used in this flow: - custom connection ## Prere...
0
promptflow_repo/promptflow/examples/tools/use-cases
promptflow_repo/promptflow/examples/tools/use-cases/custom_llm_tool_showcase/requirements.txt
promptflow my-tools-package
0
promptflow_repo/promptflow/examples/tools/use-cases
promptflow_repo/promptflow/examples/tools/use-cases/custom_llm_tool_showcase/prompt_template.jinja2
Welcome to {{ website_name }}! {% if user_name %} Hello, {{ user_name }}! {% else %} Hello there! {% endif %}
0
promptflow_repo/promptflow/examples/tools/use-cases
promptflow_repo/promptflow/examples/tools/use-cases/custom_llm_tool_showcase/flow.dag.yaml
$schema: https://azuremlschemas.azureedge.net/promptflow/latest/Flow.schema.json inputs: website_name: type: string default: Microsoft user_name: type: string default: "" outputs: output: type: string reference: ${my_custom_llm_tool.output} nodes: - name: my_custom_llm_tool type: custom_...
0
promptflow_repo/promptflow/examples/tools/use-cases
promptflow_repo/promptflow/examples/tools/use-cases/custom-strong-type-connection-package-tool-showcase/data.jsonl
{"text": "Python Hello World!"} {"text": "C Hello World!"} {"text": "C# Hello World!"}
0
promptflow_repo/promptflow/examples/tools/use-cases
promptflow_repo/promptflow/examples/tools/use-cases/custom-strong-type-connection-package-tool-showcase/README.md
# Basic flow with package tool using custom strong type connection This is a flow demonstrating the use of a package tool with custom string type connection which provides a secure way to manage credentials for external APIs and data sources, and it offers an improved user-friendly and intellisense experience compared ...
0
promptflow_repo/promptflow/examples/tools/use-cases
promptflow_repo/promptflow/examples/tools/use-cases/custom-strong-type-connection-package-tool-showcase/my_custom_connection.yml
$schema: https://azuremlschemas.azureedge.net/promptflow/latest/CustomStrongTypeConnection.schema.json name: "my_custom_connection" type: custom custom_type: MyCustomConnection module: my_tool_package.tools.tool_with_custom_strong_type_connection package: my-tools-package package_version: 0.0.5 configs: api_base: "Th...
0
promptflow_repo/promptflow/examples/tools/use-cases
promptflow_repo/promptflow/examples/tools/use-cases/custom-strong-type-connection-package-tool-showcase/requirements.txt
promptflow[azure]==1.1.0 my-tools-package==0.0.5
0
promptflow_repo/promptflow/examples/tools/use-cases
promptflow_repo/promptflow/examples/tools/use-cases/custom-strong-type-connection-package-tool-showcase/flow.dag.yaml
$schema: https://azuremlschemas.azureedge.net/promptflow/latest/Flow.schema.json inputs: text: type: string default: Microsoft outputs: my_output: type: string reference: ${my_package_tool.output} nodes: - name: my_package_tool type: python source: type: package tool: my_tool_package.too...
0
promptflow_repo/promptflow/examples/tools/use-cases
promptflow_repo/promptflow/examples/tools/use-cases/cascading-inputs-tool-showcase/README.md
# Basic flow with package tool using cascading inputs This is a flow demonstrating the use of a tool with cascading inputs which frequently used in situations where the selection in one input field determines what subsequent inputs should be shown, and it helps in creating a more efficient, user-friendly, and error-fr...
0
promptflow_repo/promptflow/examples/tools/use-cases
promptflow_repo/promptflow/examples/tools/use-cases/cascading-inputs-tool-showcase/requirements.txt
promptflow my-tools-package==0.0.7
0
promptflow_repo/promptflow/examples/tools/use-cases
promptflow_repo/promptflow/examples/tools/use-cases/cascading-inputs-tool-showcase/flow.dag.yaml
$schema: https://azuremlschemas.azureedge.net/promptflow/latest/Flow.schema.json environment: python_requirements_txt: requirements.txt inputs: {} outputs: user_id: type: string reference: ${Tool_with_Cascading_Inputs.output} nodes: - name: Tool_with_Cascading_Inputs type: python source: type: packa...
0
promptflow_repo/promptflow/examples/tools/use-cases
promptflow_repo/promptflow/examples/tools/use-cases/filepath-input-tool-showcase/hello_method.py
def hello(input_text: str) -> str: # Replace with your own code. return "Hello " + input_text
0
promptflow_repo/promptflow/examples/tools/use-cases
promptflow_repo/promptflow/examples/tools/use-cases/filepath-input-tool-showcase/requirements.txt
promptflow promptflow-tools my-tools-package
0
promptflow_repo/promptflow/examples/tools/use-cases
promptflow_repo/promptflow/examples/tools/use-cases/filepath-input-tool-showcase/flow.dag.yaml
$schema: https://azuremlschemas.azureedge.net/promptflow/latest/Flow.schema.json inputs: input: type: string default: Microsoft outputs: output: type: string reference: ${Tool_with_FilePath_Input.output} nodes: - name: Tool_with_FilePath_Input type: python source: type: package tool: my_...
0
promptflow_repo/promptflow/examples/tools
promptflow_repo/promptflow/examples/tools/tool-package-quickstart/setup.py
from setuptools import find_packages, setup PACKAGE_NAME = "my-tools-package" setup( name=PACKAGE_NAME, version="0.0.12", description="This is my tools package", packages=find_packages(), entry_points={ "package_tools": ["my_tools = my_tool_package.tools.utils:list_package_tools"], }, ...
0
promptflow_repo/promptflow/examples/tools
promptflow_repo/promptflow/examples/tools/tool-package-quickstart/MANIFEST.in
include my_tool_package/yamls/*.yaml
0
promptflow_repo/promptflow/examples/tools/tool-package-quickstart
promptflow_repo/promptflow/examples/tools/tool-package-quickstart/my_tool_package/__init__.py
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore
0
promptflow_repo/promptflow/examples/tools/tool-package-quickstart/my_tool_package
promptflow_repo/promptflow/examples/tools/tool-package-quickstart/my_tool_package/tools/tool_with_generated_by_input.py
from typing import Union from promptflow import tool from typing import Dict, List from promptflow.connections import AzureOpenAIConnection, OpenAIConnection, CognitiveSearchConnection def generate_index_json( index_type: str, index: str = "", index_connection: CognitiveSearchConnection = "", index_n...
0
promptflow_repo/promptflow/examples/tools/tool-package-quickstart/my_tool_package
promptflow_repo/promptflow/examples/tools/tool-package-quickstart/my_tool_package/tools/tool_with_file_path_input.py
import importlib from pathlib import Path from promptflow import tool from promptflow.contracts.types import FilePath @tool def my_tool(input_file: FilePath, input_text: str) -> str: # customise your own code to handle and use the input_file here new_module = importlib.import_module(Path(input_file).stem) ...
0
promptflow_repo/promptflow/examples/tools/tool-package-quickstart/my_tool_package
promptflow_repo/promptflow/examples/tools/tool-package-quickstart/my_tool_package/tools/my_tool_2.py
from promptflow import ToolProvider, tool from promptflow.connections import CustomConnection class MyTool(ToolProvider): """ Doc reference : """ def __init__(self, connection: CustomConnection): super().__init__() self.connection = connection @tool def my_tool(self, input_te...
0
promptflow_repo/promptflow/examples/tools/tool-package-quickstart/my_tool_package
promptflow_repo/promptflow/examples/tools/tool-package-quickstart/my_tool_package/tools/utils.py
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():...
0
promptflow_repo/promptflow/examples/tools/tool-package-quickstart/my_tool_package
promptflow_repo/promptflow/examples/tools/tool-package-quickstart/my_tool_package/tools/__init__.py
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore
0
promptflow_repo/promptflow/examples/tools/tool-package-quickstart/my_tool_package
promptflow_repo/promptflow/examples/tools/tool-package-quickstart/my_tool_package/tools/tool_with_custom_strong_type_connection.py
from promptflow import tool from promptflow.connections import CustomStrongTypeConnection from promptflow.contracts.types import Secret class MyCustomConnection(CustomStrongTypeConnection): """My custom strong type connection. :param api_key: The api key get from "https://xxx.com". :type api_key: Secret ...
0
promptflow_repo/promptflow/examples/tools/tool-package-quickstart/my_tool_package
promptflow_repo/promptflow/examples/tools/tool-package-quickstart/my_tool_package/tools/tool_with_dynamic_list_input.py
from promptflow import tool from typing import List, Union, Dict def my_list_func(prefix: str = "", size: int = 10, **kwargs) -> List[Dict[str, Union[str, int, float, list, Dict]]]: """This is a dummy function to generate a list of items. :param prefix: prefix to add to each item. :param size: number of ...
0
promptflow_repo/promptflow/examples/tools/tool-package-quickstart/my_tool_package
promptflow_repo/promptflow/examples/tools/tool-package-quickstart/my_tool_package/tools/tool_with_custom_llm_type.py
from jinja2 import Template from promptflow import tool from promptflow.connections import CustomConnection from promptflow.contracts.types import PromptTemplate @tool def my_tool(connection: CustomConnection, prompt: PromptTemplate, **kwargs) -> str: # Replace with your tool code, customise your own code to hand...
0
promptflow_repo/promptflow/examples/tools/tool-package-quickstart/my_tool_package
promptflow_repo/promptflow/examples/tools/tool-package-quickstart/my_tool_package/tools/my_tool_1.py
from promptflow import tool from promptflow.connections import CustomConnection @tool def my_tool(connection: CustomConnection, input_text: str) -> str: # Replace with your tool code. # Usually connection contains configs to connect to an API. # Use CustomConnection is a dict. You can use it like: connect...
0
promptflow_repo/promptflow/examples/tools/tool-package-quickstart/my_tool_package
promptflow_repo/promptflow/examples/tools/tool-package-quickstart/my_tool_package/tools/tool_with_cascading_inputs.py
from enum import Enum from promptflow import tool class UserType(str, Enum): STUDENT = "student" TEACHER = "teacher" @tool def my_tool(user_type: Enum, student_id: str = "", teacher_id: str = "") -> str: """This is a dummy function to support cascading inputs. :param user_type: user type, student ...
0
promptflow_repo/promptflow/examples/tools/tool-package-quickstart/my_tool_package
promptflow_repo/promptflow/examples/tools/tool-package-quickstart/my_tool_package/yamls/tool_with_custom_llm_type.yaml
my_tool_package.tools.tool_with_custom_llm_type.my_tool: name: My Custom LLM Tool description: This is a tool to demonstrate how to customize an LLM tool with a PromptTemplate. type: custom_llm module: my_tool_package.tools.tool_with_custom_llm_type function: my_tool inputs: connection: type: ...
0
promptflow_repo/promptflow/examples/tools/tool-package-quickstart/my_tool_package
promptflow_repo/promptflow/examples/tools/tool-package-quickstart/my_tool_package/yamls/tool_with_generated_by_input.yaml
my_tool_package.tools.tool_with_generated_by_input.my_tool: function: my_tool inputs: index_json: type: - string generated_by: func_path: my_tool_package.tools.tool_with_generated_by_input.generate_index_json func_kwargs: - name: index_type type: ...
0
promptflow_repo/promptflow/examples/tools/tool-package-quickstart/my_tool_package
promptflow_repo/promptflow/examples/tools/tool-package-quickstart/my_tool_package/yamls/tool_with_dynamic_list_input.yaml
my_tool_package.tools.tool_with_dynamic_list_input.my_tool: function: my_tool inputs: input_prefix: type: - string input_text: type: - list dynamic_list: func_path: my_tool_package.tools.tool_with_dynamic_list_input.my_list_func func_kwargs: - name: pr...
0
promptflow_repo/promptflow/examples/tools/tool-package-quickstart/my_tool_package
promptflow_repo/promptflow/examples/tools/tool-package-quickstart/my_tool_package/yamls/my_tool_2.yaml
my_tool_package.tools.my_tool_2.MyTool.my_tool: class_name: MyTool function: my_tool inputs: connection: type: - CustomConnection input_text: type: - string module: my_tool_package.tools.my_tool_2 name: My Second Tool description: This is my second tool type: python
0
promptflow_repo/promptflow/examples/tools/tool-package-quickstart/my_tool_package
promptflow_repo/promptflow/examples/tools/tool-package-quickstart/my_tool_package/yamls/my_tool_1.yaml
my_tool_package.tools.my_tool_1.my_tool: function: my_tool inputs: connection: type: - CustomConnection input_text: type: - string module: my_tool_package.tools.my_tool_1 name: My First Tool description: This is my first tool type: python
0
promptflow_repo/promptflow/examples/tools/tool-package-quickstart/my_tool_package
promptflow_repo/promptflow/examples/tools/tool-package-quickstart/my_tool_package/yamls/tool_with_cascading_inputs.yaml
my_tool_package.tools.tool_with_cascading_inputs.my_tool: function: my_tool inputs: user_type: type: - string enum: - student - teacher student_id: type: - string enabled_by: user_type enabled_by_value: [student] teacher_id: type: -...
0
promptflow_repo/promptflow/examples/tools/tool-package-quickstart/my_tool_package
promptflow_repo/promptflow/examples/tools/tool-package-quickstart/my_tool_package/yamls/tool_with_file_path_input.yaml
my_tool_package.tools.tool_with_file_path_input.my_tool: function: my_tool inputs: input_file: type: - file_path input_text: type: - string module: my_tool_package.tools.tool_with_file_path_input name: Tool with FilePath Input description: This is a tool to demonstrate the usag...
0
promptflow_repo/promptflow/examples/tools/tool-package-quickstart/my_tool_package
promptflow_repo/promptflow/examples/tools/tool-package-quickstart/my_tool_package/yamls/tool_with_custom_strong_type_connection.yaml
my_tool_package.tools.tool_with_custom_strong_type_connection.my_tool: description: This is my tool with custom strong type connection. function: my_tool inputs: connection: custom_type: - MyCustomConnection type: - CustomConnection input_text: type: - string module: ...
0
promptflow_repo/promptflow/examples/tools/tool-package-quickstart
promptflow_repo/promptflow/examples/tools/tool-package-quickstart/tests/test_my_tool_2.py
import pytest import unittest from promptflow.connections import CustomConnection from my_tool_package.tools.my_tool_2 import MyTool @pytest.fixture def my_custom_connection() -> CustomConnection: my_custom_connection = CustomConnection( { "api-key" : "my-api-key", "api-secret" : ...
0
promptflow_repo/promptflow/examples/tools/tool-package-quickstart
promptflow_repo/promptflow/examples/tools/tool-package-quickstart/tests/test_tool_with_file_path_input.py
import pytest import unittest from promptflow.contracts.types import FilePath from my_tool_package.tools.tool_with_file_path_input import my_tool @pytest.fixture def my_file_path_input() -> FilePath: my_file_path_input = FilePath("tests.test_utils.hello_method.py") return my_file_path_input class TestToolW...
0
promptflow_repo/promptflow/examples/tools/tool-package-quickstart
promptflow_repo/promptflow/examples/tools/tool-package-quickstart/tests/test_tool_with_custom_strong_type_connection.py
import pytest import unittest from my_tool_package.tools.tool_with_custom_strong_type_connection import MyCustomConnection, my_tool @pytest.fixture def my_custom_connection() -> MyCustomConnection: my_custom_connection = MyCustomConnection( { "api_key" : "my-api-key", "api_base" :...
0
promptflow_repo/promptflow/examples/tools/tool-package-quickstart
promptflow_repo/promptflow/examples/tools/tool-package-quickstart/tests/test_tool_with_cascading_inputs.py
from my_tool_package.tools.tool_with_cascading_inputs import my_tool def test_my_tool(): result = my_tool(user_type="student", student_id="student_id") assert result == '123'
0
promptflow_repo/promptflow/examples/tools/tool-package-quickstart
promptflow_repo/promptflow/examples/tools/tool-package-quickstart/tests/test_my_tool_1.py
import pytest import unittest from promptflow.connections import CustomConnection from my_tool_package.tools.my_tool_1 import my_tool @pytest.fixture def my_custom_connection() -> CustomConnection: my_custom_connection = CustomConnection( { "api-key" : "my-api-key", "api-secret" :...
0
promptflow_repo/promptflow/examples/tools/tool-package-quickstart
promptflow_repo/promptflow/examples/tools/tool-package-quickstart/tests/test_tool_with_dynamic_input.py
from my_tool_package.tools.tool_with_dynamic_list_input import my_tool, my_list_func def test_my_tool(): result = my_tool(input_text=["apple", "banana"], input_prefix="My") assert result == 'Hello My apple,banana' def test_my_list_func(): result = my_list_func(prefix="My") assert len(result) == 10 ...
0
promptflow_repo/promptflow/examples/tools/tool-package-quickstart
promptflow_repo/promptflow/examples/tools/tool-package-quickstart/tests/test_tool_with_generated_by_input.py
import json import pytest import unittest from my_tool_package.tools.tool_with_generated_by_input import ( generate_index_json, list_embedding_deployment, list_fields, list_indexes, list_index_types, list_semantic_configuration, my_tool, reverse_generate_index_json, ) @pytest.mark.par...
0
promptflow_repo/promptflow/examples/tools/tool-package-quickstart
promptflow_repo/promptflow/examples/tools/tool-package-quickstart/tests/test_tool_with_custom_llm_type.py
import pytest import unittest from promptflow.connections import CustomConnection from my_tool_package.tools.tool_with_custom_llm_type import my_tool @pytest.fixture def my_custom_connection() -> CustomConnection: my_custom_connection = CustomConnection( { "api-key" : "my-api-key", ...
0
promptflow_repo/promptflow/examples/tools/tool-package-quickstart/tests
promptflow_repo/promptflow/examples/tools/tool-package-quickstart/tests/test_utils/hello_method.py
def hello(input_text: str) -> str: # Replace with your own code. return "Hello " + input_text
0
promptflow_repo/promptflow/examples/flows
promptflow_repo/promptflow/examples/flows/integrations/README.md
# Integrations Folder This folder contains flow examples contributed by various contributors. Each flow example should have a README.md file that provides a comprehensive introduction to the flow and includes contact information for the flow owner. # Guideline for README.md of flows To ensure consistency and clarit...
0
promptflow_repo/promptflow/examples/flows/integrations/azure-ai-language
promptflow_repo/promptflow/examples/flows/integrations/azure-ai-language/connections/azure_ai_language.yml
$schema: https://azuremlschemas.azureedge.net/promptflow/latest/CustomConnection.schema.json name: azure_ai_language_connection type: custom configs: endpoint: "<azure-language-resource-endpoint>" secrets: api_key: "<to-be-replaced>"
0
promptflow_repo/promptflow/examples/flows/integrations/azure-ai-language
promptflow_repo/promptflow/examples/flows/integrations/azure-ai-language/connections/azure_ai_translator.yml
$schema: https://azuremlschemas.azureedge.net/promptflow/latest/CustomConnection.schema.json name: azure_ai_translator_connection type: custom configs: endpoint: "<azure-translator-resource-endpoint>" region: "<azure-translator-resource-region>" secrets: api_key: "<to-be-replaced>"
0
promptflow_repo/promptflow/examples/flows/integrations/azure-ai-language
promptflow_repo/promptflow/examples/flows/integrations/azure-ai-language/analyze_documents/data.jsonl
{"document_path": "./document1.txt", "language": "en"} {"document_path": "./document2.txt", "language": "en"}
0
promptflow_repo/promptflow/examples/flows/integrations/azure-ai-language
promptflow_repo/promptflow/examples/flows/integrations/azure-ai-language/analyze_documents/README.md
# Analyze Documents A flow that analyzes documents with various language-based Machine Learning models. This sample flow utilizes Azure AI Language's pre-built and optimized language models to perform various analyses on text or documents. It performs: - [Translation](https://learn.microsoft.com/en-us/rest/api/cogni...
0
promptflow_repo/promptflow/examples/flows/integrations/azure-ai-language
promptflow_repo/promptflow/examples/flows/integrations/azure-ai-language/analyze_documents/read_file.py
from promptflow import tool @tool def read_file(file_path: str) -> str: """ This tool opens a file and reads its contents into a string. :param file_path: the file path of the file to be read. """ with open(file_path, 'r', encoding="utf8") as f: file = f.read() return file
0
promptflow_repo/promptflow/examples/flows/integrations/azure-ai-language
promptflow_repo/promptflow/examples/flows/integrations/azure-ai-language/analyze_documents/parse_translation.py
from promptflow import tool @tool def parse_translation(translation_results: dict, language: str) -> str: return translation_results[language]
0
promptflow_repo/promptflow/examples/flows/integrations/azure-ai-language
promptflow_repo/promptflow/examples/flows/integrations/azure-ai-language/analyze_documents/document2.txt
Siemens and Microsoft partner to drive cross-industry AI adoption October 31, 2023 | Microsoft News Center Share on Facebook (opens new window) Share on LinkedIn (opens new window) Share on Twitter (opens new window) Companies introduce Siemens Industrial Copilot, a generative AI-powered assistant, designed to enha...
0
promptflow_repo/promptflow/examples/flows/integrations/azure-ai-language
promptflow_repo/promptflow/examples/flows/integrations/azure-ai-language/analyze_documents/document1.txt
La fortaleza de Microsoft Cloud impulsa los resultados del primer trimestre 24 de octubre de 2023 | Centro de noticias de Microsoft Compartir en Facebook (se abre en una ventana nueva) Compartir en LinkedIn (se abre en una ventana nueva) Compartir en Twitter (se abre en una ventana nueva) REDMOND, Washington — 24 d...
0
promptflow_repo/promptflow/examples/flows/integrations/azure-ai-language
promptflow_repo/promptflow/examples/flows/integrations/azure-ai-language/analyze_documents/requirements.txt
promptflow promptflow-tools promptflow-azure-ai-language
0
promptflow_repo/promptflow/examples/flows/integrations/azure-ai-language
promptflow_repo/promptflow/examples/flows/integrations/azure-ai-language/analyze_documents/flow.dag.yaml
$schema: https://azuremlschemas.azureedge.net/promptflow/latest/Flow.schema.json environment: python_requirements_txt: requirements.txt inputs: document_path: type: string default: ./document1.txt language: type: string default: en outputs: extractive_summary: type: string reference: ${E...
0
promptflow_repo/promptflow/examples/flows/integrations/azure-ai-language
promptflow_repo/promptflow/examples/flows/integrations/azure-ai-language/multi_intent_conversational_language_understanding/README.md
# Multi Intent Conversational Language Understanding A flow that can be used to determine multiple intents in a user query leveraging an LLM with Conversational Language Understanding. This sample flow utilizes Azure AI Language's Conversational Language Understanding to perform various analyses on text or documents...
0
promptflow_repo/promptflow/examples/flows/integrations/azure-ai-language
promptflow_repo/promptflow/examples/flows/integrations/azure-ai-language/multi_intent_conversational_language_understanding/MediaPlayer.json
{ "projectFileVersion": "2022-10-01-preview", "stringIndexType": "Utf16CodeUnit", "metadata": { "projectKind": "Conversation", "settings": { "confidenceThreshold": 0, "normalizeCasing": false }, "projectName": "MediaPlayer", "multilingual": fal...
0
promptflow_repo/promptflow/examples/flows/integrations/azure-ai-language
promptflow_repo/promptflow/examples/flows/integrations/azure-ai-language/multi_intent_conversational_language_understanding/chat.jinja2
system: Your task is to break down compound sentences into separate sentences. For simple sentences just repeat the user input. Remember to use a json array for the output. user: The output must be a json array. Here are a few examples: user input: Play Eric Clapton and turn down the volume. OUTPUT: ["Play Eric Clap...
0
promptflow_repo/promptflow/examples/flows/integrations/azure-ai-language
promptflow_repo/promptflow/examples/flows/integrations/azure-ai-language/multi_intent_conversational_language_understanding/requirements.txt
promptflow promptflow-tools promptflow-azure-ai-language
0
promptflow_repo/promptflow/examples/flows/integrations/azure-ai-language
promptflow_repo/promptflow/examples/flows/integrations/azure-ai-language/multi_intent_conversational_language_understanding/flow.dag.yaml
$schema: https://azuremlschemas.azureedge.net/promptflow/latest/Flow.schema.json environment: python_requirements_txt: requirements.txt inputs: chat_history: type: list is_chat_history: true utterance: type: string is_chat_input: true default: Play BB King and increase the volume. outputs: i...
0
promptflow_repo/promptflow/examples/flows/standard
promptflow_repo/promptflow/examples/flows/standard/describe-image/data.jsonl
{"question": "How many colors are there in the image?", "input_image": {"data:image/png;url": "https://developer.microsoft.com/_devcom/images/logo-ms-social.png"}} {"question": "What's this image about?", "input_image": {"data:image/png;url": "https://developer.microsoft.com/_devcom/images/404.png"}}
0
promptflow_repo/promptflow/examples/flows/standard
promptflow_repo/promptflow/examples/flows/standard/describe-image/README.md
# Describe image flow A flow that take image input, flip it horizontally and uses OpenAI GPT-4V tool to describe it. Tools used in this flow: - `OpenAI GPT-4V` tool - custom `python` Tool Connections used in this flow: - OpenAI Connection ## Prerequisites Install promptflow sdk and other dependencies, create connec...
0