text
stringlengths
8
1.72M
id
stringlengths
22
143
metadata
dict
__index_level_0__
int64
0
104
While how LLMs work may be elusive to many developers, how LLM apps work is not - they essentially involve a series of calls to external services such as LLMs/databases/search engines, or intermediate data processing, all glued together. Thus LLM apps are merely Directed Acyclic Graphs (DAGs) of function calls. These D...
promptflow/docs/concepts/concept-flows.md/0
{ "file_path": "promptflow/docs/concepts/concept-flows.md", "repo_id": "promptflow", "token_count": 673 }
1
# Develop standard flow :::{admonition} Experimental feature This is an experimental feature, and may change at any time. Learn [more](../faq.md#stable-vs-experimental). ::: From this document, you can learn how to develop a standard flow by writing a flow yaml from scratch. You can find additional information about...
promptflow/docs/how-to-guides/develop-a-flow/develop-standard-flow.md/0
{ "file_path": "promptflow/docs/how-to-guides/develop-a-flow/develop-standard-flow.md", "repo_id": "promptflow", "token_count": 3588 }
2
# Initialize and test a flow :::{admonition} Experimental feature This is an experimental feature, and may change at any time. Learn [more](faq.md#stable-vs-experimental). ::: From this document, customer can initialize a flow and test it. ## Initialize flow Creating a flow folder with code/prompts and yaml definit...
promptflow/docs/how-to-guides/init-and-test-a-flow.md/0
{ "file_path": "promptflow/docs/how-to-guides/init-and-test-a-flow.md", "repo_id": "promptflow", "token_count": 3178 }
3
# pfazure :::{admonition} Experimental feature This is an experimental feature, and may change at any time. Learn [more](../how-to-guides/faq.md#stable-vs-experimental). ::: Manage prompt flow resources on Azure with the prompt flow CLI. | Command | Description | | --- | --- | | [pfazure flow](#pfazure-flow) | Manag...
promptflow/docs/reference/pfazure-command-reference.md/0
{ "file_path": "promptflow/docs/reference/pfazure-command-reference.md", "repo_id": "promptflow", "token_count": 4975 }
4
$schema: https://azuremlschemas.azureedge.net/promptflow/latest/Flow.schema.json inputs: chat_history: type: list default: [] question: type: string is_chat_input: true default: What is ChatGPT? outputs: answer: type: string reference: ${chat.output} is_chat_output: true nodes: - i...
promptflow/examples/flows/chat/basic-chat/flow.dag.yaml/0
{ "file_path": "promptflow/examples/flows/chat/basic-chat/flow.dag.yaml", "repo_id": "promptflow", "token_count": 330 }
5
{ "package": {}, "code": { "setup_env.py": { "type": "python", "inputs": { "connection": { "type": [ "AzureOpenAIConnection", "OpenAIConnection" ] }, "config": { "type": [ "object" ] } }...
promptflow/examples/flows/chat/chat-with-pdf/.promptflow/flow.tools.json/0
{ "file_path": "promptflow/examples/flows/chat/chat-with-pdf/.promptflow/flow.tools.json", "repo_id": "promptflow", "token_count": 1279 }
6
<jupyter_start><jupyter_text>Chat with PDF using Azure AIThis is a simple flow that allow you to ask questions about the content of a PDF file and get answers.You can run the flow with a URL to a PDF file and question as argument.Once it's launched it will download the PDF and build an index of the content. Then when y...
promptflow/examples/flows/chat/chat-with-pdf/chat-with-pdf-azure.ipynb/0
{ "file_path": "promptflow/examples/flows/chat/chat-with-pdf/chat-with-pdf-azure.ipynb", "repo_id": "promptflow", "token_count": 2006 }
7
You're a smart assistant can answer questions based on provided context and previous conversation history between you and human. Use the context to answer the question at the end, note that the context has order and importance - e.g. context #1 is more important than #2. Try as much as you can to answer based on the ...
promptflow/examples/flows/chat/chat-with-pdf/chat_with_pdf/qna_prompt.md/0
{ "file_path": "promptflow/examples/flows/chat/chat-with-pdf/chat_with_pdf/qna_prompt.md", "repo_id": "promptflow", "token_count": 147 }
8
$schema: https://azuremlschemas.azureedge.net/promptflow/latest/Run.schema.json #name: eval_groundedness_default_20230820_200152_009000 flow: ../../evaluation/eval-groundedness run: chat_with_pdf_default_20230820_162219_559000 column_mapping: question: ${run.inputs.question} answer: ${run.outputs.answer} context:...
promptflow/examples/flows/chat/chat-with-pdf/eval_run.yaml/0
{ "file_path": "promptflow/examples/flows/chat/chat-with-pdf/eval_run.yaml", "repo_id": "promptflow", "token_count": 129 }
9
system: You are an AI assistant reading the transcript of a conversation between an AI and a human. Given an input question and conversation history, infer user real intent. The conversation history is provided just in case of a context (e.g. "What is this?" where "this" is defined in previous conversation). Return t...
promptflow/examples/flows/chat/chat-with-wikipedia/extract_query_from_question.jinja2/0
{ "file_path": "promptflow/examples/flows/chat/chat-with-wikipedia/extract_query_from_question.jinja2", "repo_id": "promptflow", "token_count": 371 }
10
# Basic Eval This example shows how to create a basic evaluation flow. Tools used in this flow: - `python` tool ## Prerequisites Install promptflow sdk and other dependencies in this folder: ```bash pip install -r requirements.txt ``` ## What you will learn In this flow, you will learn - how to compose a point ba...
promptflow/examples/flows/evaluation/eval-basic/README.md/0
{ "file_path": "promptflow/examples/flows/evaluation/eval-basic/README.md", "repo_id": "promptflow", "token_count": 372 }
11
from promptflow import tool @tool def grade(groundtruth: str, prediction: str): return "Correct" if groundtruth.lower() == prediction.lower() else "Incorrect"
promptflow/examples/flows/evaluation/eval-classification-accuracy/grade.py/0
{ "file_path": "promptflow/examples/flows/evaluation/eval-classification-accuracy/grade.py", "repo_id": "promptflow", "token_count": 47 }
12
system: You are an AI assistant. You will be given the definition of an evaluation metric for assessing the quality of an answer in a question-answering task. Your job is to compute an accurate evaluation score using the provided evaluation metric. user: Fluency measures the quality of individual sentences in the answe...
promptflow/examples/flows/evaluation/eval-qna-non-rag/gpt_fluency_prompt.jinja2/0
{ "file_path": "promptflow/examples/flows/evaluation/eval-qna-non-rag/gpt_fluency_prompt.jinja2", "repo_id": "promptflow", "token_count": 445 }
13
system: You are a helpful assistant. user: Your task is to check and rate if factual information in chatbot's reply is all grounded to retrieved documents. You will be given a question, chatbot's response to the question, a chat history between this chatbot and human, and a list of retrieved documents in json format. ...
promptflow/examples/flows/evaluation/eval-qna-rag-metrics/rag_groundedness_prompt.jinja2/0
{ "file_path": "promptflow/examples/flows/evaluation/eval-qna-rag-metrics/rag_groundedness_prompt.jinja2", "repo_id": "promptflow", "token_count": 580 }
14
{ "projectFileVersion": "2022-10-01-preview", "stringIndexType": "Utf16CodeUnit", "metadata": { "projectKind": "Conversation", "settings": { "confidenceThreshold": 0, "normalizeCasing": false }, "projectName": "MediaPlayer", "multilingual": fal...
promptflow/examples/flows/integrations/azure-ai-language/multi_intent_conversational_language_understanding/MediaPlayer.json/0
{ "file_path": "promptflow/examples/flows/integrations/azure-ai-language/multi_intent_conversational_language_understanding/MediaPlayer.json", "repo_id": "promptflow", "token_count": 3327 }
15
Goals: {{goals}}
promptflow/examples/flows/standard/autonomous-agent/user_prompt.jinja2/0
{ "file_path": "promptflow/examples/flows/standard/autonomous-agent/user_prompt.jinja2", "repo_id": "promptflow", "token_count": 10 }
16
# Basic standard flow A basic standard flow using custom python tool that calls Azure OpenAI with connection info stored in environment variables. Tools used in this flow: - `prompt` tool - custom `python` Tool Connections used in this flow: - None ## Prerequisites Install promptflow sdk and other dependencies: ``...
promptflow/examples/flows/standard/basic/README.md/0
{ "file_path": "promptflow/examples/flows/standard/basic/README.md", "repo_id": "promptflow", "token_count": 1439 }
17
from promptflow import tool from divider import Divider @tool def divide_code(file_content: str): # Divide the code into several parts according to the global import/class/function. divided = Divider.divide_file(file_content) return divided
promptflow/examples/flows/standard/gen-docstring/divide_code_tool.py/0
{ "file_path": "promptflow/examples/flows/standard/gen-docstring/divide_code_tool.py", "repo_id": "promptflow", "token_count": 74 }
18
{"question": "What is the sum of 5 and 3?", "answer": "8"} {"question": "Subtract 7 from 10.", "answer": "3"} {"question": "Multiply 6 by 4.", "answer": "24"} {"question": "Divide 20 by 5.", "answer": "4"} {"question": "What is the square of 7?", "answer": "49"} {"question": "What is the square root of 81?", "answer": ...
promptflow/examples/flows/standard/maths-to-code/math_data.jsonl/0
{ "file_path": "promptflow/examples/flows/standard/maths-to-code/math_data.jsonl", "repo_id": "promptflow", "token_count": 573 }
19
system: Your task is to classify a given url into one of the following categories: Movie, App, Academic, Channel, Profile, PDF or None based on the text content information. The classification will be based on the url, the webpage text content summary, or both. user: The selection range of the value of "category" must...
promptflow/examples/flows/standard/web-classification/classify_with_llm.jinja2/0
{ "file_path": "promptflow/examples/flows/standard/web-classification/classify_with_llm.jinja2", "repo_id": "promptflow", "token_count": 235 }
20
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: ...
promptflow/examples/tools/tool-package-quickstart/my_tool_package/yamls/tool_with_custom_strong_type_connection.yaml/0
{ "file_path": "promptflow/examples/tools/tool-package-quickstart/my_tool_package/yamls/tool_with_custom_strong_type_connection.yaml", "repo_id": "promptflow", "token_count": 155 }
21
$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...
promptflow/examples/tools/use-cases/cascading-inputs-tool-showcase/flow.dag.yaml/0
{ "file_path": "promptflow/examples/tools/use-cases/cascading-inputs-tool-showcase/flow.dag.yaml", "repo_id": "promptflow", "token_count": 177 }
22
Welcome to {{ website_name }}! {% if user_name %} Hello, {{ user_name }}! {% else %} Hello there! {% endif %}
promptflow/examples/tools/use-cases/custom_llm_tool_showcase/prompt_template.jinja2/0
{ "file_path": "promptflow/examples/tools/use-cases/custom_llm_tool_showcase/prompt_template.jinja2", "repo_id": "promptflow", "token_count": 48 }
23
#! /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...
promptflow/examples/tutorials/flow-deploy/azure-app-service/deploy.sh/0
{ "file_path": "promptflow/examples/tutorials/flow-deploy/azure-app-service/deploy.sh", "repo_id": "promptflow", "token_count": 2250 }
24
--- 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...
promptflow/examples/tutorials/flow-fine-tuning-evaluation/promptflow-quality-improvement.md/0
{ "file_path": "promptflow/examples/tutorials/flow-fine-tuning-evaluation/promptflow-quality-improvement.md", "repo_id": "promptflow", "token_count": 8166 }
25
{ "releases":{ "internal":{ "promptflow-tools-release":{ "index": "internal-index-release" }, "promptflow-tools-test":{ "index": "internal-index-test" } } }, "targets": { "internal-index-release": { "storage_account": "azuremlsdktestpypi", "packages_...
promptflow/scripts/distributing/configs/distribution_settings.json/0
{ "file_path": "promptflow/scripts/distributing/configs/distribution_settings.json", "repo_id": "promptflow", "token_count": 348 }
26
# Install prompt flow MSI installer on Windows Prompt flow is a suite of development tools designed to streamline the end-to-end development cycle of LLM-based AI applications, that can be installed locally on Windows computers. For Windows, the prompt flow is installed via an MSI, which gives you access to the CLI ...
promptflow/scripts/installer/windows/install_from_msi.md/0
{ "file_path": "promptflow/scripts/installer/windows/install_from_msi.md", "repo_id": "promptflow", "token_count": 1064 }
27
# Readme Workflow Generator These tools is used to generate workflows from README.md and python notebook files in the [examples](../../examples/) folder. * Generated workflows will be placed in [.github/workflows/samples_*](../../.github/workflows/) folder. * The script will also generate a new explanation [README.md]...
promptflow/scripts/readme/README.md/0
{ "file_path": "promptflow/scripts/readme/README.md", "repo_id": "promptflow", "token_count": 567 }
28
- name: {{ step_name }} working-directory: ${{ '{{' }} github.workspace }} run: | python scripts/readme/extract_steps_from_readme.py -f {{ readme_name }} -o {{ working_dir }} - name: Cat script working-directory: {{ working_dir }} run: | cat bash_script.sh - name: Run scripts against canary workspace (s...
promptflow/scripts/readme/ghactions_driver/workflow_steps/step_extract_steps_and_run.yml.jinja2/0
{ "file_path": "promptflow/scripts/readme/ghactions_driver/workflow_steps/step_extract_steps_and_run.yml.jinja2", "repo_id": "promptflow", "token_count": 625 }
29
We are pleased to announce the release of promptflow {{VERSION}}. This release includes some new features, bug fixes, and improvements. We recommend that all users upgrade to this version. See the [CHANGELOG](https://github.com/microsoft/promptflow/blob/release/promptflow/{{VERSION}}/src/promptflow/CHANGELOG.md) for ...
promptflow/scripts/release/promptflow-release-note.md/0
{ "file_path": "promptflow/scripts/release/promptflow-release-note.md", "repo_id": "promptflow", "token_count": 169 }
30
from promptflow import tool from promptflow.connections import CustomConnection @tool def {{ function_name }}(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 l...
promptflow/scripts/tool/templates/tool.py.j2/0
{ "file_path": "promptflow/scripts/tool/templates/tool.py.j2", "repo_id": "promptflow", "token_count": 133 }
31
include promptflow/tools/yamls/*.yaml
promptflow/src/promptflow-tools/MANIFEST.in/0
{ "file_path": "promptflow/src/promptflow-tools/MANIFEST.in", "repo_id": "promptflow", "token_count": 13 }
32
import json import sys from enum import Enum import requests # Avoid circular dependencies: Use import 'from promptflow._internal' instead of 'from promptflow' # since the code here is in promptflow namespace as well from promptflow._internal import ToolProvider, tool from promptflow.connections import SerpConnection ...
promptflow/src/promptflow-tools/promptflow/tools/serpapi.py/0
{ "file_path": "promptflow/src/promptflow-tools/promptflow/tools/serpapi.py", "repo_id": "promptflow", "token_count": 2097 }
33
import pytest from promptflow.tools.aoai_gpt4v import AzureOpenAI @pytest.fixture def azure_openai_provider(azure_open_ai_connection) -> AzureOpenAI: return AzureOpenAI(azure_open_ai_connection) @pytest.mark.usefixtures("use_secrets_config_file") @pytest.mark.skip("Skipping until we have a Azure OpenAI GPT-4 V...
promptflow/src/promptflow-tools/tests/test_aoai_gptv.py/0
{ "file_path": "promptflow/src/promptflow-tools/tests/test_aoai_gptv.py", "repo_id": "promptflow", "token_count": 651 }
34
# Release History ## 1.5.0 (Upcoming) ### Features Added ### Bugs Fixed - [SDK/CLI] The inputs of node test allows the value of reference node output be passed directly in. ### Improvements - [SDK/CLI] For `pf run delete`, `pf connection delete`, introducing an option to skip confirmation prompts. ## 1.4.0 (2...
promptflow/src/promptflow/CHANGELOG.md/0
{ "file_path": "promptflow/src/promptflow/CHANGELOG.md", "repo_id": "promptflow", "token_count": 3253 }
35
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import inspect import json import shutil from abc import ABC, abstractmethod from ast import literal_eval from enum import Enum from pathli...
promptflow/src/promptflow/promptflow/_cli/_pf/_init_entry_generators.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_cli/_pf/_init_entry_generators.py", "repo_id": "promptflow", "token_count": 6361 }
36
from setuptools import find_packages, setup PACKAGE_NAME = "{{ package_name }}" setup( name=PACKAGE_NAME, version="0.0.1", description="This is my tools package", packages=find_packages(), entry_points={ "package_tools": ["{{ package_name }} = {{ package_name }}.utils:list_package_tools"],...
promptflow/src/promptflow/promptflow/_cli/data/package_tool/setup.py.jinja2/0
{ "file_path": "promptflow/src/promptflow/promptflow/_cli/data/package_tool/setup.py.jinja2", "repo_id": "promptflow", "token_count": 151 }
37
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import sys from contextvars import ContextVar from datetime import datetime, timezone from io import StringIO, TextIOBase from typing impor...
promptflow/src/promptflow/promptflow/_core/log_manager.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_core/log_manager.py", "repo_id": "promptflow", "token_count": 2523 }
38
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- from os import PathLike from pathlib import Path from typing import IO, AnyStr, Optional, Union from dotenv import dotenv_values from .._u...
promptflow/src/promptflow/promptflow/_sdk/_load_functions.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/_load_functions.py", "repo_id": "promptflow", "token_count": 1791 }
39
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- from flask import jsonify, make_response, request from flask_restx import fields from promptflow._sdk._service import Namespace, Resource f...
promptflow/src/promptflow/promptflow/_sdk/_service/apis/telemetry.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/_service/apis/telemetry.py", "repo_id": "promptflow", "token_count": 3067 }
40
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import json import os from abc import ABC, abstractmethod from pathlib import Path from promptflow._constants import DEFAULT_ENCODING from...
promptflow/src/promptflow/promptflow/_sdk/_serving/extension/default_extension.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/_serving/extension/default_extension.py", "repo_id": "promptflow", "token_count": 1992 }
41
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- # this file is a middle layer between the local SDK and executor, it'll have some similar logic with cloud PFS. import datetime from pathli...
promptflow/src/promptflow/promptflow/_sdk/_submitter/run_submitter.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/_submitter/run_submitter.py", "repo_id": "promptflow", "token_count": 3850 }
42
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Run Details</title> </head> <body> <div id="root"></div> <script> window.bulk_test_details_data = {{ data }} </script> <script src="{{ js_p...
promptflow/src/promptflow/promptflow/_sdk/data/visualize.j2/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/data/visualize.j2", "repo_id": "promptflow", "token_count": 154 }
43
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import contextlib import glob import json import os import shutil import subprocess import sys from importlib.metadata import version from o...
promptflow/src/promptflow/promptflow/_sdk/operations/_flow_operations.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/operations/_flow_operations.py", "repo_id": "promptflow", "token_count": 15849 }
44
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- """!!!Note: context in this file only used for command line related logics, please avoid using them in service code!!!""" import contextlib...
promptflow/src/promptflow/promptflow/_utils/context_utils.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_utils/context_utils.py", "repo_id": "promptflow", "token_count": 285 }
45
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import datetime import json import logging from promptflow._constants import (LAST_HINT_TIME, LAST_CHECK_TIME, PF_VERSION_CHECK, CLI_PACKAG...
promptflow/src/promptflow/promptflow/_utils/version_hint_utils.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_utils/version_hint_utils.py", "repo_id": "promptflow", "token_count": 1608 }
46
# coding=utf-8 # -------------------------------------------------------------------------- # Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.8.0, generator: @autorest/python@5.12.2) # Changes may cause incorrect behavior and will be lost if the code is regenerated. # ------------------------------...
promptflow/src/promptflow/promptflow/azure/_restclient/flow/_azure_machine_learning_designer_service_client.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/azure/_restclient/flow/_azure_machine_learning_designer_service_client.py", "repo_id": "promptflow", "token_count": 2003 }
47
# coding=utf-8 # -------------------------------------------------------------------------- # Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.8.0, generator: @autorest/python@5.12.2) # Changes may cause incorrect behavior and will be lost if the code is regenerated. # ------------------------------...
promptflow/src/promptflow/promptflow/azure/_restclient/flow/aio/operations/_flow_sessions_operations.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/azure/_restclient/flow/aio/operations/_flow_sessions_operations.py", "repo_id": "promptflow", "token_count": 6266 }
48
# coding=utf-8 # -------------------------------------------------------------------------- # Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.8.0, generator: @autorest/python@5.12.2) # Changes may cause incorrect behavior and will be lost if the code is regenerated. # ------------------------------...
promptflow/src/promptflow/promptflow/azure/_restclient/flow/operations/_flow_sessions_operations.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/azure/_restclient/flow/operations/_flow_sessions_operations.py", "repo_id": "promptflow", "token_count": 9211 }
49
import asyncio import contextvars import functools import json from pathlib import Path from typing import Optional, Union import httpx from azure.core.exceptions import HttpResponseError from azure.storage.blob.aio import BlobServiceClient from promptflow._sdk._constants import DEFAULT_ENCODING, DownloadedRun from p...
promptflow/src/promptflow/promptflow/azure/operations/_async_run_downloader.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/azure/operations/_async_run_downloader.py", "repo_id": "promptflow", "token_count": 6052 }
50
from promptflow.exceptions import UserErrorException class FailedToImportModule(UserErrorException): pass class FlowDefinitionError(UserErrorException): pass
promptflow/src/promptflow/promptflow/contracts/_errors.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/contracts/_errors.py", "repo_id": "promptflow", "token_count": 44 }
51
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- from jinja2 import TemplateSyntaxError from promptflow._utils.exception_utils import ExceptionPresenter, infer_error_code_from_class, remo...
promptflow/src/promptflow/promptflow/executor/_errors.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/executor/_errors.py", "repo_id": "promptflow", "token_count": 2739 }
52
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- class DuplicatedPrimaryKeyException(Exception): pass class NotFoundException(Exception): pass
promptflow/src/promptflow/promptflow/storage/_errors.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/storage/_errors.py", "repo_id": "promptflow", "token_count": 53 }
53
import os from dataclasses import is_dataclass from pathlib import Path from tempfile import mkdtemp import pytest from promptflow.batch._batch_engine import OUTPUT_FILE_NAME, BatchEngine from promptflow.batch._result import BatchResult, LineResult from promptflow.contracts.run_info import Status from promptflow.exec...
promptflow/src/promptflow/tests/executor/e2etests/test_eager_flow.py/0
{ "file_path": "promptflow/src/promptflow/tests/executor/e2etests/test_eager_flow.py", "repo_id": "promptflow", "token_count": 3733 }
54
[ { "text": "Hello" }, { "text": "Hello World!" } ]
promptflow/src/promptflow/tests/executor/package_tools/custom_llm_tool/samples.json/0
{ "file_path": "promptflow/src/promptflow/tests/executor/package_tools/custom_llm_tool/samples.json", "repo_id": "promptflow", "token_count": 37 }
55
import pytest from promptflow._core.metric_logger import MetricLoggerManager, add_metric_logger, log_metric, remove_metric_logger @pytest.mark.unittest class TestMetricLogger: def test_add_and_remove_metric_logger(self): # define log metric function metrics = {} def _log_metric(key, valu...
promptflow/src/promptflow/tests/executor/unittests/_core/test_metric_logger.py/0
{ "file_path": "promptflow/src/promptflow/tests/executor/unittests/_core/test_metric_logger.py", "repo_id": "promptflow", "token_count": 734 }
56
import re from pathlib import Path from unittest.mock import MagicMock, mock_open, patch import pytest from promptflow._utils._errors import InvalidImageInput, LoadMultimediaDataError from promptflow._utils.multimedia_utils import ( _create_image_from_base64, _create_image_from_file, _create_image_from_ur...
promptflow/src/promptflow/tests/executor/unittests/_utils/test_multimedia_utils.py/0
{ "file_path": "promptflow/src/promptflow/tests/executor/unittests/_utils/test_multimedia_utils.py", "repo_id": "promptflow", "token_count": 4918 }
57
from enum import Enum from typing import Any, Callable, NewType, Optional, Tuple, TypeVar, Union import pytest from promptflow._core.tools_manager import connections from promptflow._sdk.entities import CustomStrongTypeConnection from promptflow._sdk.entities._connection import AzureContentSafetyConnection from promp...
promptflow/src/promptflow/tests/executor/unittests/contracts/test_tool.py/0
{ "file_path": "promptflow/src/promptflow/tests/executor/unittests/contracts/test_tool.py", "repo_id": "promptflow", "token_count": 4844 }
58
import pytest from multiprocessing import Queue from promptflow.executor._line_execution_process_pool import QueueRunStorage from promptflow.contracts.run_info import FlowRunInfo from promptflow.contracts.run_info import RunInfo as NodeRunInfo @pytest.mark.unittest class TestLineExecutionProcessPool: def test_pe...
promptflow/src/promptflow/tests/executor/unittests/storage/test_queue_run_storage.py/0
{ "file_path": "promptflow/src/promptflow/tests/executor/unittests/storage/test_queue_run_storage.py", "repo_id": "promptflow", "token_count": 1048 }
59
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import copy import json import shutil from logging import Logger from pathlib import Path from tempfile import TemporaryDirectory from time...
promptflow/src/promptflow/tests/sdk_cli_azure_test/e2etests/test_run_operations.py/0
{ "file_path": "promptflow/src/promptflow/tests/sdk_cli_azure_test/e2etests/test_run_operations.py", "repo_id": "promptflow", "token_count": 19965 }
60
import pytest from promptflow._sdk._errors import RunOperationParameterError @pytest.mark.unittest class TestPFClientAzure: def test_wrong_client_parameters(self): from promptflow.azure import PFClient # test wrong client parameters with pytest.raises(RunOperationParameterError, match="Y...
promptflow/src/promptflow/tests/sdk_cli_azure_test/unittests/test_pf_client_azure.py/0
{ "file_path": "promptflow/src/promptflow/tests/sdk_cli_azure_test/unittests/test_pf_client_azure.py", "repo_id": "promptflow", "token_count": 224 }
61
import subprocess import sys import tempfile from pathlib import Path import mock import pytest from .test_cli import run_pf_command FLOWS_DIR = "./tests/test_configs/flows" RUNS_DIR = "./tests/test_configs/runs" CONNECTIONS_DIR = "./tests/test_configs/connections" DATAS_DIR = "./tests/test_configs/datas" @pytest....
promptflow/src/promptflow/tests/sdk_cli_test/e2etests/test_executable.py/0
{ "file_path": "promptflow/src/promptflow/tests/sdk_cli_test/e2etests/test_executable.py", "repo_id": "promptflow", "token_count": 1189 }
62
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- from pathlib import Path import pytest from promptflow._sdk._configuration import Configuration, InvalidConfigValue from promptflow._sdk._...
promptflow/src/promptflow/tests/sdk_cli_test/unittests/test_config.py/0
{ "file_path": "promptflow/src/promptflow/tests/sdk_cli_test/unittests/test_config.py", "repo_id": "promptflow", "token_count": 1086 }
63
{"text":"data_0000"} {"text":"data_0001"} {"text":"data_0002"} {"text":"data_0003"} {"text":"data_0004"} {"text":"data_0005"} {"text":"data_0006"} {"text":"data_0007"} {"text":"data_0008"} {"text":"data_0009"} {"text":"data_0010"} {"text":"data_0011"} {"text":"data_0012"} {"text":"data_0013"} {"text":"data_0014"} {"tex...
promptflow/src/promptflow/tests/test_configs/datas/load_data_cases/10k.jsonl/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/datas/load_data_cases/10k.jsonl", "repo_id": "promptflow", "token_count": 89936 }
64
{"url": "https://www.youtube.com/watch?v=o5ZQyXaAv1g", "answer": "Channel", "evidence": "Url", "variant_id": "fake_variant1"}
promptflow/src/promptflow/tests/test_configs/datas/webClassification1.jsonl/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/datas/webClassification1.jsonl", "repo_id": "promptflow", "token_count": 53 }
65
entry: my_func path: ./not_exist.py
promptflow/src/promptflow/tests/test_configs/eager_flows/invalid_illegal_path/flow.dag.yaml/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/eager_flows/invalid_illegal_path/flow.dag.yaml", "repo_id": "promptflow", "token_count": 14 }
66
import argparse import os from pathlib import Path parser = argparse.ArgumentParser() parser.add_argument("--input-path", type=str, required=True) parser.add_argument("--output-path", type=str, required=True) parser.add_argument("--count", type=int, required=True) args = parser.parse_args() env_var = os.environ.get("...
promptflow/src/promptflow/tests/test_configs/experiments/basic-script-template/generate_data/generate_data.py/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/experiments/basic-script-template/generate_data/generate_data.py", "repo_id": "promptflow", "token_count": 318 }
67
id: template_eval_flow name: Template Evaluation Flow inputs: groundtruth: type: string is_chat_input: false prediction: type: string is_chat_input: false outputs: results: type: string reference: ${line_process.output} nodes: - name: line_process type: python source: type: code ...
promptflow/src/promptflow/tests/test_configs/flows/aggregation_node_failed/flow.dag.yaml/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/flows/aggregation_node_failed/flow.dag.yaml", "repo_id": "promptflow", "token_count": 252 }
68
inputs: chat_history: type: list is_chat_history: true default: - inputs: question: hi outputs: answer: hi - inputs: question: who are you outputs: answer: who are you question: type: string is_chat_input: true default: What...
promptflow/src/promptflow/tests/test_configs/flows/chat_flow_with_default_history/flow.dag.yaml/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/flows/chat_flow_with_default_history/flow.dag.yaml", "repo_id": "promptflow", "token_count": 334 }
69
import threading from time import sleep from promptflow import tool @tool def wait(**kwargs) -> int: if kwargs["throw_exception"]: raise Exception("test exception") for i in range(10): print(f"Thread {threading.get_ident()} write test log number {i}") sleep(2) return 0
promptflow/src/promptflow/tests/test_configs/flows/concurrent_execution_flow/wait_short.py/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/flows/concurrent_execution_flow/wait_short.py", "repo_id": "promptflow", "token_count": 114 }
70
from promptflow import tool @tool def double(input: int) -> int: return 2*input
promptflow/src/promptflow/tests/test_configs/flows/conditional_flow_with_aggregate_bypassed/double.py/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/flows/conditional_flow_with_aggregate_bypassed/double.py", "repo_id": "promptflow", "token_count": 27 }
71
from promptflow import tool @tool def test_print_input(input_str: str, input_bool: bool, input_list: list, input_dict: dict): assert not input_bool assert input_list == [] assert input_dict == {} print(input_str) return input_str
promptflow/src/promptflow/tests/test_configs/flows/default_input/test_print_input.py/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/flows/default_input/test_print_input.py", "repo_id": "promptflow", "token_count": 88 }
72
inputs: key: type: object outputs: output: type: string reference: ${print_val.output.value} nodes: - name: print_val use_variants: true type: python source: type: code path: print_val.py node_variants: print_val: default_variant_id: variant1 variants: variant1: nod...
promptflow/src/promptflow/tests/test_configs/flows/flow_with_dict_input_with_variant/flow.dag.yaml/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/flows/flow_with_dict_input_with_variant/flow.dag.yaml", "repo_id": "promptflow", "token_count": 250 }
73
import os from promptflow import tool @tool def get_env_var(key: str): from langchain import __version__ print(__version__) print(os.environ.get(key)) # get from env var return {"value": os.environ.get(key)}
promptflow/src/promptflow/tests/test_configs/flows/flow_with_requirements_txt/print_env.py/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/flows/flow_with_requirements_txt/print_env.py", "repo_id": "promptflow", "token_count": 88 }
74
inputs: key: type: object outputs: output: type: string reference: ${print_val.output.value} nodes: - name: print_val type: python source: type: code path: print_val.py inputs: key: ${inputs.key}
promptflow/src/promptflow/tests/test_configs/flows/flow_with_user_output/flow.dag.yaml/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/flows/flow_with_user_output/flow.dag.yaml", "repo_id": "promptflow", "token_count": 99 }
75
$schema: https://azuremlschemas.azureedge.net/latest/flow.schema.json name: web_classificiation_flow_3 display_name: Web Classification type: standard description: Create flows that use large language models to classify URLs into multiple categories. path: ./flow.dag.yaml
promptflow/src/promptflow/tests/test_configs/flows/meta_files/flow.meta.yaml/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/flows/meta_files/flow.meta.yaml", "repo_id": "promptflow", "token_count": 79 }
76
[{"idx": 1}, {"idx": 4}, {"idx": 10}]
promptflow/src/promptflow/tests/test_configs/flows/one_line_of_bulktest_timeout/samples.json/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/flows/one_line_of_bulktest_timeout/samples.json", "repo_id": "promptflow", "token_count": 20 }
77
inputs: idx: type: int mod: type: int mod_2: type: int outputs: output: type: int reference: ${my_python_tool_with_failed_line_2.output} nodes: - name: my_python_tool_with_failed_line_1 type: python source: type: code path: my_python_tool_with_failed_line.py inputs: idx: ${...
promptflow/src/promptflow/tests/test_configs/flows/python_tool_partial_failure/flow.dag.yaml/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/flows/python_tool_partial_failure/flow.dag.yaml", "repo_id": "promptflow", "token_count": 257 }
78
inputs: image_1: type: image image_2: type: image outputs: output: type: image reference: ${python_node.output} nodes: - name: python_node type: python source: type: code path: pick_an_image.py inputs: image_1: ${inputs.image_1} image_2: ${inputs.image_2}
promptflow/src/promptflow/tests/test_configs/flows/python_tool_with_simple_image_without_default/flow.dag.yaml/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/flows/python_tool_with_simple_image_without_default/flow.dag.yaml", "repo_id": "promptflow", "token_count": 134 }
79
from promptflow import tool from dummy_utils.util_tool import passthrough @tool def main(x: str): return passthrough(x)
promptflow/src/promptflow/tests/test_configs/flows/script_with_import/dummy_utils/main.py/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/flows/script_with_import/dummy_utils/main.py", "repo_id": "promptflow", "token_count": 42 }
80
name: node_wrong_order inputs: text: type: string skip: type: bool outputs: result: type: string reference: ${third_node} nodes: - name: third_node type: python source: type: code path: test.py inputs: text: ${second_node} - name: first_node type: python source: type: cod...
promptflow/src/promptflow/tests/test_configs/flows/unordered_nodes_with_activate/flow.dag.yaml/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/flows/unordered_nodes_with_activate/flow.dag.yaml", "repo_id": "promptflow", "token_count": 229 }
81
import json import time from promptflow import tool # use this to test the timeout time.sleep(2) @tool def convert_to_dict(input_str: str): try: return json.loads(input_str) except Exception as e: print("input is not valid, error: {}".format(e)) return {"category": "None", "evidence...
promptflow/src/promptflow/tests/test_configs/flows/web_classification_invalid/convert_to_dict.py/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/flows/web_classification_invalid/convert_to_dict.py", "repo_id": "promptflow", "token_count": 123 }
82
<jupyter_start><jupyter_text>Set flow path<jupyter_code>from promptflow import PFClient # client can help manage your runs and connections. pf = PFClient() flow = "../flows/simple_hello_world" # path to the flow directory<jupyter_output><empty_output><jupyter_text>Quick test<jupyter_code># Test flow flow_inputs = { ...
promptflow/src/promptflow/tests/test_configs/notebooks/dummy.ipynb/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/notebooks/dummy.ipynb", "repo_id": "promptflow", "token_count": 331 }
83
interactions: - request: body: null headers: Accept: - application/json Accept-Encoding: - gzip, deflate Connection: - keep-alive User-Agent: - promptflow-sdk/0.0.1 azure-ai-ml/1.12.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.11.5 (Windows-1...
promptflow/src/promptflow/tests/test_configs/recordings/test_run_operations_TestFlowRun_test_auto_resolve_requirements.yaml/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/recordings/test_run_operations_TestFlowRun_test_auto_resolve_requirements.yaml", "repo_id": "promptflow", "token_count": 104189 }
84
interactions: - request: body: null headers: Accept: - application/json Accept-Encoding: - gzip, deflate Connection: - keep-alive User-Agent: - promptflow-sdk/0.0.1 azure-ai-ml/1.12.1 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.10.13 (Windows-...
promptflow/src/promptflow/tests/test_configs/recordings/test_run_operations_TestFlowRun_test_input_mapping_with_dict.yaml/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/recordings/test_run_operations_TestFlowRun_test_input_mapping_with_dict.yaml", "repo_id": "promptflow", "token_count": 41868 }
85
name: flow_run_20230629_101205 description: sample bulk run flow: ../flows/web_classification data: ../datas/webClassification1.jsonl column_mapping: url: "${data.url}" variant: ${summarize_text_content.variant_0} extra_key: extra_value # run config: env related environment_variables: env_file
promptflow/src/promptflow/tests/test_configs/runs/extra_field.yaml/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/runs/extra_field.yaml", "repo_id": "promptflow", "token_count": 104 }
86
from promptflow import ToolProvider, tool from promptflow.connections import AzureOpenAIConnection @tool(name="python_tool") def my_python_tool(input1: str) -> str: return 'hello ' + input1 @tool def my_python_tool_without_name(input1: str) -> str: return 'hello ' + input1 class PythonTool(ToolProvider): ...
promptflow/src/promptflow/tests/test_configs/tools/python_tool.py/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/tools/python_tool.py", "repo_id": "promptflow", "token_count": 194 }
87
system: You are a helpful assistant. user: {{question}}
promptflow/src/promptflow/tests/test_configs/wrong_flows/flow_llm_with_wrong_conn/wrong_llm.jinja2/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/wrong_flows/flow_llm_with_wrong_conn/wrong_llm.jinja2", "repo_id": "promptflow", "token_count": 18 }
88
name: node_cycle_with_activate inputs: text: type: string outputs: result: type: string reference: ${second_node} nodes: - name: first_node type: python source: type: code path: test.py inputs: text: ${inputs.text} activate: when: ${second_node.output} is: true aggregation:...
promptflow/src/promptflow/tests/test_configs/wrong_flows/nodes_cycle_with_activate/flow.dag.yaml/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/wrong_flows/nodes_cycle_with_activate/flow.dag.yaml", "repo_id": "promptflow", "token_count": 184 }
89
# Devcontainer for promptflow To facilitate your promptflow project development and empower you to work on LLM projects using promptflow more effectively, we've configured the necessary environment for developing promptflow projects and utilizing flows through the dev container feature. You can seamlessly initiate yo...
promptflow/.devcontainer/README.md/0
{ "file_path": "promptflow/.devcontainer/README.md", "repo_id": "promptflow", "token_count": 248 }
0
# Consume connections from Azure AI For a smooth development flow that transitions from cloud (Azure AI) to local environments, you can directly utilize the connection already established on the cloud by setting the connection provider to "Azure AI connections". You can set the connection provider using the following...
promptflow/docs/cloud/azureai/consume-connections-from-azure-ai.md/0
{ "file_path": "promptflow/docs/cloud/azureai/consume-connections-from-azure-ai.md", "repo_id": "promptflow", "token_count": 1002 }
1
# Replay end-to-end tests * This document introduces replay tests for those located in [sdk_cli_azure_test](../../src/promptflow/tests/sdk_cli_azure_test/e2etests/) and [sdk_cli_test](../../src/promptflow/tests/sdk_cli_test/e2etests/). * The primary purpose of replay tests is to avoid the need for credentials, Azure w...
promptflow/docs/dev/replay-e2e-test.md/0
{ "file_path": "promptflow/docs/dev/replay-e2e-test.md", "repo_id": "promptflow", "token_count": 1217 }
2
# Creating a Dynamic List Tool Input Tool input options can be generated on the fly using a dynamic list. Instead of having predefined static options, the tool author defines a request function that queries backends like APIs to retrieve real-time options. This enables flexible integration with various data sources to...
promptflow/docs/how-to-guides/develop-a-tool/create-dynamic-list-tool-input.md/0
{ "file_path": "promptflow/docs/how-to-guides/develop-a-tool/create-dynamic-list-tool-input.md", "repo_id": "promptflow", "token_count": 3003 }
3
# Set global configs :::{admonition} Experimental feature This is an experimental feature, and may change at any time. Learn [more](faq.md#stable-vs-experimental). ::: Promptflow supports setting global configs to avoid passing the same parameters to each command. The global configs are stored in a yaml file, which is...
promptflow/docs/how-to-guides/set-global-configs.md/0
{ "file_path": "promptflow/docs/how-to-guides/set-global-configs.md", "repo_id": "promptflow", "token_count": 881 }
4
# LLM ## Introduction Prompt flow LLM tool enables you to leverage widely used large language models like [OpenAI](https://platform.openai.com/) or [Azure OpenAI (AOAI)](https://learn.microsoft.com/en-us/azure/cognitive-services/openai/overview) for natural language processing. Prompt flow provides a few different ...
promptflow/docs/reference/tools-reference/llm-tool.md/0
{ "file_path": "promptflow/docs/reference/tools-reference/llm-tool.md", "repo_id": "promptflow", "token_count": 2760 }
5
<jupyter_start><jupyter_text>Connection ManagementPrompt flow provides various prebuilt connections, including Azure Open AI, Open AI, Azure Content Safety, etc. Prebuilt connections enable seamless integration with these resources within the built-in tools. Additionally, users have the flexibility to create custom con...
promptflow/examples/connections/connection.ipynb/0
{ "file_path": "promptflow/examples/connections/connection.ipynb", "repo_id": "promptflow", "token_count": 1048 }
6
system: You are an assistant to calculate the answer to the provided math problems. Please think step by step. Return the final numerical answer only and any accompanying reasoning or explanation seperately as json format. user: A jar contains two red marbles, three green marbles, ten white marbles and no other marble...
promptflow/examples/flows/chat/chat-math-variant/chat_variant_2.jinja2/0
{ "file_path": "promptflow/examples/flows/chat/chat-math-variant/chat_variant_2.jinja2", "repo_id": "promptflow", "token_count": 1215 }
7
import os def log(message: str): verbose = os.environ.get("VERBOSE", "false") if verbose.lower() == "true": print(message, flush=True)
promptflow/examples/flows/chat/chat-with-pdf/chat_with_pdf/utils/logging.py/0
{ "file_path": "promptflow/examples/flows/chat/chat-with-pdf/chat_with_pdf/utils/logging.py", "repo_id": "promptflow", "token_count": 63 }
8
{ "chat_history": [ { "inputs": { "question": "What is the weather like in Boston?" }, "outputs": { "answer": "{\"forecast\":[\"sunny\",\"windy\"],\"location\":\"Boston\",\"temperature\":\"72\",\"unit\":\"fahrenheit\"}", "llm_output": { "content": null, ...
promptflow/examples/flows/chat/use_functions_with_chat_models/data.jsonl/0
{ "file_path": "promptflow/examples/flows/chat/use_functions_with_chat_models/data.jsonl", "repo_id": "promptflow", "token_count": 276 }
9
from typing import List from promptflow import tool from promptflow import log_metric @tool def accuracy_aggregate(processed_results: List[int]): num_exception = 0 num_correct = 0 for i in range(len(processed_results)): if processed_results[i] == -1: num_exception += 1 elif p...
promptflow/examples/flows/evaluation/eval-chat-math/aggregate.py/0
{ "file_path": "promptflow/examples/flows/evaluation/eval-chat-math/aggregate.py", "repo_id": "promptflow", "token_count": 407 }
10