text
stringlengths
8
1.72M
id
stringlengths
22
143
metadata
dict
__index_level_0__
int64
0
104
from promptflow import tool @tool def passthrough_dict(image_list: list, image_dict: dict): return image_dict
promptflow/src/promptflow/tests/test_configs/flows/python_tool_with_composite_image/passthrough_dict.py/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/flows/python_tool_with_composite_image/passthrough_dict.py", "repo_id": "promptflow", "token_count": 38 }
78
import random from promptflow.contracts.multimedia import Image from promptflow import tool @tool def pick_an_image(image_1: Image, image_2: Image) -> Image: if random.choice([True, False]): return image_1 else: return image_2
promptflow/src/promptflow/tests/test_configs/flows/python_tool_with_simple_image/pick_an_image.py/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/flows/python_tool_with_simple_image/pick_an_image.py", "repo_id": "promptflow", "token_count": 93 }
79
inputs: text: type: string default: dummy_input outputs: output_prompt: type: string reference: ${sync_fail.output} nodes: - name: sync_fail type: python source: type: code path: sync_fail.py inputs: s: ${inputs.text}
promptflow/src/promptflow/tests/test_configs/flows/sync_tools_failures/flow.dag.yaml/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/flows/sync_tools_failures/flow.dag.yaml", "repo_id": "promptflow", "token_count": 109 }
80
[ { "url": "https://www.microsoft.com/en-us/d/xbox-wireless-controller-stellar-shift-special-edition/94fbjc7h0h6h" }, { "url": "https://www.microsoft.com/en-us/windows/" } ]
promptflow/src/promptflow/tests/test_configs/flows/web_classification_with_exception/samples.json/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/flows/web_classification_with_exception/samples.json", "repo_id": "promptflow", "token_count": 86 }
81
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_eager_flow_crud.yaml/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/recordings/test_run_operations_TestFlowRun_test_eager_flow_crud.yaml", "repo_id": "promptflow", "token_count": 20704 }
82
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_run_bulk_with_remote_flow.yaml/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/recordings/test_run_operations_TestFlowRun_test_run_bulk_with_remote_flow.yaml", "repo_id": "promptflow", "token_count": 25860 }
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.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_update_run.yaml/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/recordings/test_run_operations_TestFlowRun_test_update_run.yaml", "repo_id": "promptflow", "token_count": 58301 }
84
name: flow_run_20230629_101205 flow: ../flows/web_classification data: ../datas/webClassification1.jsonl column_mapping: url: "${data.url}" variant: ${summarize_text_content.variant_0} resources: instance_type: Standard_D2 # optional, server default value idle_time_before_shutdown_minutes: 60 #optional, server ...
promptflow/src/promptflow/tests/test_configs/runs/sample_bulk_run_with_resources.yaml/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/runs/sample_bulk_run_with_resources.yaml", "repo_id": "promptflow", "token_count": 115 }
85
from enum import Enum from promptflow.entities import InputSetting from promptflow import tool class UserType(str, Enum): STUDENT = "student" TEACHER = "teacher" @tool( name="My Tool with Enabled By Value", description="This is my tool with enabled by value", input_settings={ "teacher_i...
promptflow/src/promptflow/tests/test_configs/tools/tool_with_enabled_by_value.py/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/tools/tool_with_enabled_by_value.py", "repo_id": "promptflow", "token_count": 396 }
86
inputs: outputs: content: type: string reference: ${divide_num.output} nodes: - name: divide_num type: python source: type: code path: divide_num.py inputs: num: ${divide_num_2.output} - name: divide_num_1 type: python source: type: code path: divide_num.py inputs: num: ${d...
promptflow/src/promptflow/tests/test_configs/wrong_flows/node_circular_dependency/flow.dag.yaml/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/wrong_flows/node_circular_dependency/flow.dag.yaml", "repo_id": "promptflow", "token_count": 202 }
87
# See https://pre-commit.com for more information # See https://pre-commit.com/hooks.html for more hooks exclude: '(^docs/)|flows|scripts|src/promptflow/promptflow/azure/_restclient/|src/promptflow/tests/test_configs|src/promptflow-tools' repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v3...
promptflow/.pre-commit-config.yaml/0
{ "file_path": "promptflow/.pre-commit-config.yaml", "repo_id": "promptflow", "token_count": 812 }
0
In prompt flow, you can utilize connections to securely manage credentials or secrets for external services. # Connections Connections are for storing information about how to access external services like LLMs: endpoint, api keys etc. - In your local development environment, the connections are persisted in your lo...
promptflow/docs/concepts/concept-connections.md/0
{ "file_path": "promptflow/docs/concepts/concept-connections.md", "repo_id": "promptflow", "token_count": 641 }
1
# Develop evaluation flow :::{admonition} Experimental feature This is an experimental feature, and may change at any time. Learn [more](../faq.md#stable-vs-experimental). ::: The evaluation flow is a flow to test/evaluate the quality of your LLM application (standard/chat flow). It usually runs on the outputs of sta...
promptflow/docs/how-to-guides/develop-a-flow/develop-evaluation-flow.md/0
{ "file_path": "promptflow/docs/how-to-guides/develop-a-flow/develop-evaluation-flow.md", "repo_id": "promptflow", "token_count": 1939 }
2
# How-to Guides Simple and short articles grouped by topics, each introduces a core feature of prompt flow and how you can use it to address your specific use cases. ```{toctree} :maxdepth: 1 develop-a-flow/index init-and-test-a-flow add-conditional-control-to-a-flow run-and-evaluate-a-flow/index tune-prompts-with-v...
promptflow/docs/how-to-guides/index.md/0
{ "file_path": "promptflow/docs/how-to-guides/index.md", "repo_id": "promptflow", "token_count": 174 }
3
# pf :::{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 with the prompt flow CLI. | Command | Description | |----------------------...
promptflow/docs/reference/pf-command-reference.md/0
{ "file_path": "promptflow/docs/reference/pf-command-reference.md", "repo_id": "promptflow", "token_count": 6270 }
4
# Contributing to examples folder Thank you for your interest in contributing to the examples folder. This folder contains a collection of Python notebooks and selected markdown files that demonstrate various usage of this promptflow project. The script will automatically generate a README.md file in the root folder, ...
promptflow/examples/CONTRIBUTING.md/0
{ "file_path": "promptflow/examples/CONTRIBUTING.md", "repo_id": "promptflow", "token_count": 1042 }
5
from promptflow import tool from chat_with_pdf.build_index import create_faiss_index @tool def build_index_tool(pdf_path: str) -> str: return create_faiss_index(pdf_path)
promptflow/examples/flows/chat/chat-with-pdf/build_index_tool.py/0
{ "file_path": "promptflow/examples/flows/chat/chat-with-pdf/build_index_tool.py", "repo_id": "promptflow", "token_count": 61 }
6
import os from utils.oai import OAIChat def qna(prompt: str, history: list): max_completion_tokens = int(os.environ.get("MAX_COMPLETION_TOKENS")) chat = OAIChat() stream = chat.stream( messages=history + [{"role": "user", "content": prompt}], max_tokens=max_completion_tokens, ) ...
promptflow/examples/flows/chat/chat-with-pdf/chat_with_pdf/qna.py/0
{ "file_path": "promptflow/examples/flows/chat/chat-with-pdf/chat_with_pdf/qna.py", "repo_id": "promptflow", "token_count": 140 }
7
from promptflow import tool from chat_with_pdf.download import download @tool def download_tool(url: str, env_ready_signal: str) -> str: return download(url)
promptflow/examples/flows/chat/chat-with-pdf/download_tool.py/0
{ "file_path": "promptflow/examples/flows/chat/chat-with-pdf/download_tool.py", "repo_id": "promptflow", "token_count": 52 }
8
$schema: https://azuremlschemas.azureedge.net/promptflow/latest/Flow.schema.json inputs: groundtruth: type: string description: Please specify the groundtruth column, which contains the true label to the outputs that your flow produces. default: APP prediction: type: string description: Pl...
promptflow/examples/flows/evaluation/eval-classification-accuracy/flow.dag.yaml/0
{ "file_path": "promptflow/examples/flows/evaluation/eval-classification-accuracy/flow.dag.yaml", "repo_id": "promptflow", "token_count": 297 }
9
user: # Instructions * There are many chatbots that can answer users questions based on the context given from different sources like search results, or snippets from books/papers. They try to understand users's question and then get context by either performing search from search engines, databases or books/papers fo...
promptflow/examples/flows/evaluation/eval-groundedness/gpt_groundedness.md/0
{ "file_path": "promptflow/examples/flows/evaluation/eval-groundedness/gpt_groundedness.md", "repo_id": "promptflow", "token_count": 231 }
10
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: Coherence of an answer is measured by how well all the sentences...
promptflow/examples/flows/evaluation/eval-qna-non-rag/gpt_coherence_prompt.jinja2/0
{ "file_path": "promptflow/examples/flows/evaluation/eval-qna-non-rag/gpt_coherence_prompt.jinja2", "repo_id": "promptflow", "token_count": 464 }
11
system: You will be provided a question, a conversation history, fetched documents related to the question and a response to the question in the domain. You task is to evaluate the quality of the provided response by following the steps below: - Understand the context of the question based on the conversation history. ...
promptflow/examples/flows/evaluation/eval-qna-rag-metrics/rag_generation_prompt.jinja2/0
{ "file_path": "promptflow/examples/flows/evaluation/eval-qna-rag-metrics/rag_generation_prompt.jinja2", "repo_id": "promptflow", "token_count": 579 }
12
$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>"
promptflow/examples/flows/integrations/azure-ai-language/connections/azure_ai_translator.yml/0
{ "file_path": "promptflow/examples/flows/integrations/azure-ai-language/connections/azure_ai_translator.yml", "repo_id": "promptflow", "token_count": 102 }
13
Determine which next function to use, and respond using stringfield JSON object. If you have completed all your tasks, make sure to use the 'finish' function to signal and remember show your results.
promptflow/examples/flows/standard/autonomous-agent/triggering_prompt.jinja2/0
{ "file_path": "promptflow/examples/flows/standard/autonomous-agent/triggering_prompt.jinja2", "repo_id": "promptflow", "token_count": 44 }
14
AZURE_OPENAI_API_KEY=<your_AOAI_key> AZURE_OPENAI_API_BASE=<your_AOAI_endpoint> AZURE_OPENAI_API_TYPE=azure
promptflow/examples/flows/standard/basic/.env.example/0
{ "file_path": "promptflow/examples/flows/standard/basic/.env.example", "repo_id": "promptflow", "token_count": 58 }
15
from promptflow import tool @tool def llm_result(question: str) -> str: # You can use an LLM node to replace this tool. return ( "Prompt flow is a suite of development tools designed to streamline " "the end-to-end development cycle of LLM-based AI applications." )
promptflow/examples/flows/standard/conditional-flow-for-if-else/llm_result.py/0
{ "file_path": "promptflow/examples/flows/standard/conditional-flow-for-if-else/llm_result.py", "repo_id": "promptflow", "token_count": 100 }
16
# Customer Intent Extraction This sample is using OpenAI chat model(ChatGPT/GPT4) to identify customer intent from customer's question. By going through this sample you will learn how to create a flow from existing working code (written in LangChain in this case). This is the [existing code](./intent.py). ## Prereq...
promptflow/examples/flows/standard/customer-intent-extraction/README.md/0
{ "file_path": "promptflow/examples/flows/standard/customer-intent-extraction/README.md", "repo_id": "promptflow", "token_count": 905 }
17
{"url": "https://www.youtube.com/watch?v=o5ZQyXaAv1g", "answer": "Channel", "evidence": "Url"} {"url": "https://arxiv.org/abs/2307.04767", "answer": "Academic", "evidence": "Text content"} {"url": "https://play.google.com/store/apps/details?id=com.twitter.android", "answer": "App", "evidence": "Both"}
promptflow/examples/flows/standard/flow-with-additional-includes/data.jsonl/0
{ "file_path": "promptflow/examples/flows/standard/flow-with-additional-includes/data.jsonl", "repo_id": "promptflow", "token_count": 114 }
18
import difflib import webbrowser def show_diff(left_content, right_content, name="file"): d = difflib.HtmlDiff() html = d.make_file( left_content.splitlines(), right_content.splitlines(), "origin " + name, "new " + name, context=True, numlines=20) html = htm...
promptflow/examples/flows/standard/gen-docstring/diff.py/0
{ "file_path": "promptflow/examples/flows/standard/gen-docstring/diff.py", "repo_id": "promptflow", "token_count": 210 }
19
$schema: https://azuremlschemas.azureedge.net/promptflow/latest/Flow.schema.json environment: python_requirements_txt: requirements.txt inputs: math_question: type: string default: If a rectangle has a length of 10 and width of 5, what is the area? outputs: code: type: string reference: ${code_ref...
promptflow/examples/flows/standard/maths-to-code/flow.dag.yaml/0
{ "file_path": "promptflow/examples/flows/standard/maths-to-code/flow.dag.yaml", "repo_id": "promptflow", "token_count": 457 }
20
# Web Classification This is a flow demonstrating multi-class classification with LLM. Given an url, it will classify the url into one web category with just a few shots, simple summarization and classification prompts. ## Tools used in this flow - LLM Tool - Python Tool ## What you will learn In this flow, you wil...
promptflow/examples/flows/standard/web-classification/README.md/0
{ "file_path": "promptflow/examples/flows/standard/web-classification/README.md", "repo_id": "promptflow", "token_count": 1419 }
21
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: ...
promptflow/examples/tools/tool-package-quickstart/my_tool_package/yamls/tool_with_custom_llm_type.yaml/0
{ "file_path": "promptflow/examples/tools/tool-package-quickstart/my_tool_package/yamls/tool_with_custom_llm_type.yaml", "repo_id": "promptflow", "token_count": 121 }
22
# 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...
promptflow/examples/tools/use-cases/cascading-inputs-tool-showcase/README.md/0
{ "file_path": "promptflow/examples/tools/use-cases/cascading-inputs-tool-showcase/README.md", "repo_id": "promptflow", "token_count": 152 }
23
$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_...
promptflow/examples/tools/use-cases/custom_llm_tool_showcase/flow.dag.yaml/0
{ "file_path": "promptflow/examples/tools/use-cases/custom_llm_tool_showcase/flow.dag.yaml", "repo_id": "promptflow", "token_count": 238 }
24
<# .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...
promptflow/examples/tutorials/flow-deploy/azure-app-service/deploy.ps1/0
{ "file_path": "promptflow/examples/tutorials/flow-deploy/azure-app-service/deploy.ps1", "repo_id": "promptflow", "token_count": 1878 }
25
<PoliCheckExclusions> <!-- All strings must be UPPER CASE --> <!--index-xxx.js is an auto-generated javascript file - skipped given it's not expected to be readable --> <Exclusion Type="FileName">SRC\PROMPTFLOW\PROMPTFLOW\_SDK\_SERVING\STATIC\INDEX.JS</Exclusion> </PoliCheckExclusions>
promptflow/scripts/compliance-check/user_exclusion.xml/0
{ "file_path": "promptflow/scripts/compliance-check/user_exclusion.xml", "repo_id": "promptflow", "token_count": 99 }
26
# Building the Windows MSI Installer This document provides instructions on creating the MSI installer. ## Option1: Building with Github Actions Trigger the [workflow](https://github.com/microsoft/promptflow/actions/workflows/build_msi_installer.yml) manually. ## Option2: Local Building ### Prerequisites 1. Turn o...
promptflow/scripts/installer/windows/README.md/0
{ "file_path": "promptflow/scripts/installer/windows/README.md", "repo_id": "promptflow", "token_count": 610 }
27
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- # flake8: noqa # This file is part of scripts\generate_json_schema.py in sdk-cli-v2, which is used to generate json schema # To use this sc...
promptflow/scripts/json_schema/gen_json_schema.py/0
{ "file_path": "promptflow/scripts/json_schema/gen_json_schema.py", "repo_id": "promptflow", "token_count": 2887 }
28
- name: {{ step_name }} working-directory: {{ working_dir }} run: | if [[ -e .env ]]; then pf connection create --file .env --name {{ connection_name }} fi if [[ -e azure_openai.yml ]]; then pf connection create --file azure_openai.yml --name {{ connection_name }} fi pf connection li...
promptflow/scripts/readme/ghactions_driver/workflow_steps/step_env_create_aoai.yml.jinja2/0
{ "file_path": "promptflow/scripts/readme/ghactions_driver/workflow_steps/step_env_create_aoai.yml.jinja2", "repo_id": "promptflow", "token_count": 123 }
29
import os import glob import argparse from pathlib import Path import ntpath import re import hashlib import json from jinja2 import Environment, FileSystemLoader from ghactions_driver.readme_step import ReadmeStepsManage from ghactions_driver.resource_resolver import resolve_tutorial_resource from ghactions_driver.tel...
promptflow/scripts/readme/workflow_generator.py/0
{ "file_path": "promptflow/scripts/readme/workflow_generator.py", "repo_id": "promptflow", "token_count": 2474 }
30
import pytest import unittest from {{ package_name }}.tools.{{ tool_name }} import {{ class_name }} @pytest.fixture def my_url() -> str: my_url = "https://www.bing.com" return my_url @pytest.fixture def my_tool_provider(my_url) -> {{ class_name }}: my_tool_provider = {{ class_name }}(my_url) return...
promptflow/scripts/tool/templates/test_tool2.py.j2/0
{ "file_path": "promptflow/scripts/tool/templates/test_tool2.py.j2", "repo_id": "promptflow", "token_count": 231 }
31
# Release History ## 1.0.0 (2023.11.30) ### Features Added - Support openai 1.x in promptflow-tools - Add new tool "OpenAI GPT-4V"
promptflow/src/promptflow-tools/CHANGELOG.md/0
{ "file_path": "promptflow/src/promptflow-tools/CHANGELOG.md", "repo_id": "promptflow", "token_count": 52 }
32
try: from openai import OpenAI as OpenAIClient except Exception: raise Exception( "Please upgrade your OpenAI package to version 1.0.0 or later using the command: pip install --upgrade openai.") from promptflow.connections import OpenAIConnection from promptflow.contracts.types import PromptTemplate fr...
promptflow/src/promptflow-tools/promptflow/tools/openai_gpt4v.py/0
{ "file_path": "promptflow/src/promptflow-tools/promptflow/tools/openai_gpt4v.py", "repo_id": "promptflow", "token_count": 1021 }
33
from unittest.mock import patch import pytest import json from promptflow.connections import AzureOpenAIConnection from promptflow.tools.aoai import chat, completion from promptflow.tools.exception import WrappedOpenAIError from tests.utils import AttrDict @pytest.mark.usefixtures("use_secrets_config_file") class Te...
promptflow/src/promptflow-tools/tests/test_aoai.py/0
{ "file_path": "promptflow/src/promptflow-tools/tests/test_aoai.py", "repo_id": "promptflow", "token_count": 4560 }
34
DEFAULT_SUBSCRIPTION_ID="your-subscription-id" DEFAULT_RESOURCE_GROUP_NAME="your-resource-group-name" DEFAULT_WORKSPACE_NAME="your-workspace-name" DEFAULT_RUNTIME_NAME="test-runtime-ci" PROMPT_FLOW_TEST_MODE="replay"
promptflow/src/promptflow/.env.example/0
{ "file_path": "promptflow/src/promptflow/.env.example", "repo_id": "promptflow", "token_count": 85 }
35
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import argparse import importlib import json import os import shutil import subprocess import sys import tempfile import webbrowser from pa...
promptflow/src/promptflow/promptflow/_cli/_pf/_flow.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_cli/_pf/_flow.py", "repo_id": "promptflow", "token_count": 8800 }
36
# Chat flow Chat flow is designed for conversational application development, building upon the capabilities of standard flow and providing enhanced support for chat inputs/outputs and chat history management. With chat flow, you can easily create a chatbot that handles chat input and output. ## Create connection for ...
promptflow/src/promptflow/promptflow/_cli/data/chat_flow/flow_files/README.md/0
{ "file_path": "promptflow/src/promptflow/promptflow/_cli/data/chat_flow/flow_files/README.md", "repo_id": "promptflow", "token_count": 1766 }
37
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- class GeneratorProxy: """A proxy for generator that can record all items that have been yielded from the generator.""" def __init...
promptflow/src/promptflow/promptflow/_core/generator_proxy.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_core/generator_proxy.py", "repo_id": "promptflow", "token_count": 215 }
38
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- from promptflow._sdk._constants import BULK_RUN_ERRORS from promptflow.exceptions import ErrorTarget, SystemErrorException, UserErrorExcepti...
promptflow/src/promptflow/promptflow/_sdk/_errors.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/_errors.py", "repo_id": "promptflow", "token_count": 1364 }
39
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import json import shlex import subprocess import sys import tempfile from dataclasses import asdict from pathlib import Path from flask im...
promptflow/src/promptflow/promptflow/_sdk/_service/apis/run.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/_service/apis/run.py", "repo_id": "promptflow", "token_count": 3864 }
40
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import json import os import re from promptflow._sdk._serving._errors import InvalidConnectionData, MissingConnectionProvider from promptf...
promptflow/src/promptflow/promptflow/_sdk/_serving/extension/azureml_extension.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/_serving/extension/azureml_extension.py", "repo_id": "promptflow", "token_count": 4282 }
41
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import os import subprocess from datetime import datetime from pathlib import Path from typing import Dict from promptflow._sdk._configurat...
promptflow/src/promptflow/promptflow/_sdk/_submitter/experiment_orchestrator.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/_submitter/experiment_orchestrator.py", "repo_id": "promptflow", "token_count": 8367 }
42
Exported Dockerfile & its dependencies are located in the same folder. The structure is as below: - flow: the folder contains all the flow files - ... - connections: the folder contains yaml files to create all related connections - ... - runit: the folder contains all the runit scripts - ... - Dockerfile: the do...
promptflow/src/promptflow/promptflow/_sdk/data/docker/README.md/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/data/docker/README.md", "repo_id": "promptflow", "token_count": 206 }
43
{ "$schema": "http://json-schema.org/draft-04/schema#", "title": "Tool", "type": "object", "properties": { "name": { "type": "string" }, "type": { "$ref": "#/definitions/ToolType" }, "inputs": { "type": "object", "additionalProperties": { "$ref": "#/definition...
promptflow/src/promptflow/promptflow/_sdk/data/tool.schema.json/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/data/tool.schema.json", "repo_id": "promptflow", "token_count": 4791 }
44
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- from functools import lru_cache from os import PathLike from pathlib import Path from typing import Dict from promptflow._sdk._constants im...
promptflow/src/promptflow/promptflow/_sdk/operations/_flow_context_resolver.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/operations/_flow_context_resolver.py", "repo_id": "promptflow", "token_count": 1768 }
45
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import io import re from jinja2 import Template from .yaml_utils import dump_yaml, load_yaml_string def generate_custom_strong_type_conn...
promptflow/src/promptflow/promptflow/_utils/connection_utils.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_utils/connection_utils.py", "repo_id": "promptflow", "token_count": 1814 }
46
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- """This is a common util file. !!!Please do not include any project related import.!!! """ import contextlib import contextvars import func...
promptflow/src/promptflow/promptflow/_utils/utils.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_utils/utils.py", "repo_id": "promptflow", "token_count": 3875 }
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/__init__.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/azure/_restclient/flow/__init__.py", "repo_id": "promptflow", "token_count": 192 }
48
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- # coding=utf-8 # -------------------------------------------------------------------------- # Code generated by Microsoft (R) AutoRest Code...
promptflow/src/promptflow/promptflow/azure/_restclient/flow/aio/operations/_flow_sessions_admin_operations.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/azure/_restclient/flow/aio/operations/_flow_sessions_admin_operations.py", "repo_id": "promptflow", "token_count": 1820 }
49
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- # coding=utf-8 # -------------------------------------------------------------------------- # Code generated by Microsoft (R) AutoRest Code...
promptflow/src/promptflow/promptflow/azure/_restclient/flow/operations/_flow_sessions_admin_operations.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/azure/_restclient/flow/operations/_flow_sessions_admin_operations.py", "repo_id": "promptflow", "token_count": 2613 }
50
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- # pylint: disable=protected-access import os import uuid from datetime import datetime, timedelta from pathlib import Path from typing imp...
promptflow/src/promptflow/promptflow/azure/operations/_artifact_utilities.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/azure/operations/_artifact_utilities.py", "repo_id": "promptflow", "token_count": 6848 }
51
import docutils.nodes from docutils.core import publish_doctree class DocstringParser: @staticmethod def parse(docstring: str): doctree = publish_doctree(docstring) description = doctree[0].astext() params = {} for field in doctree.traverse(docutils.nodes.field): fi...
promptflow/src/promptflow/promptflow/executor/_docstring_parser.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/executor/_docstring_parser.py", "repo_id": "promptflow", "token_count": 447 }
52
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- from dataclasses import dataclass from datetime import datetime from promptflow.contracts.run_info import RunInfo @dataclass class Cache...
promptflow/src/promptflow/promptflow/storage/_cache_storage.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/storage/_cache_storage.py", "repo_id": "promptflow", "token_count": 189 }
53
import json import multiprocessing import threading from pathlib import Path from tempfile import mkdtemp from typing import Optional, Tuple, Union import pytest from promptflow._constants import FlowLanguage from promptflow._utils.exception_utils import ExceptionPresenter from promptflow.batch._batch_engine import B...
promptflow/src/promptflow/tests/executor/e2etests/test_csharp_executor_proxy.py/0
{ "file_path": "promptflow/src/promptflow/tests/executor/e2etests/test_csharp_executor_proxy.py", "repo_id": "promptflow", "token_count": 2303 }
54
{ "custom_llm_tool.TestCustomLLMTool.call": { "class_name": "TestCustomLLMTool", "function": "call", "inputs": { "connection": {"type": ["AzureOpenAIConnection"]}, "connection_2": {"type": ["AzureOpenAIConnection"]}, "api": {"type": ["string"]}, ...
promptflow/src/promptflow/tests/executor/package_tools/custom_llm_tool/package_tool_definition.json/0
{ "file_path": "promptflow/src/promptflow/tests/executor/package_tools/custom_llm_tool/package_tool_definition.json", "repo_id": "promptflow", "token_count": 261 }
55
import logging import sys import time from multiprocessing.pool import ThreadPool import pytest from dateutil.parser import parse from promptflow._core.log_manager import NodeLogManager, NodeLogWriter RUN_ID = "dummy_run_id" NODE_NAME = "dummy_node" LINE_NUMBER = 1 def assert_print_result(i: int, run_logger: NodeL...
promptflow/src/promptflow/tests/executor/unittests/_core/test_log_manager.py/0
{ "file_path": "promptflow/src/promptflow/tests/executor/unittests/_core/test_log_manager.py", "repo_id": "promptflow", "token_count": 2053 }
56
from pathlib import Path from unittest.mock import Mock import pytest from promptflow._utils.multimedia_data_converter import ( AbstractMultimediaInfoConverter, MultimediaConverter, MultimediaFormatAdapter20231201, MultimediaInfo, ResourceType, ) @pytest.mark.unittest class TestMultimediaConvert...
promptflow/src/promptflow/tests/executor/unittests/_utils/test_multimedia_data_converter.py/0
{ "file_path": "promptflow/src/promptflow/tests/executor/unittests/_utils/test_multimedia_data_converter.py", "repo_id": "promptflow", "token_count": 1685 }
57
import pytest from promptflow.contracts.run_mode import RunMode @pytest.mark.unittest @pytest.mark.parametrize( "run_mode, expected", [ ("Test", RunMode.Test), ("SingleNode", RunMode.SingleNode), ("Batch", RunMode.Batch), ("Default", RunMode.Test), ], ) def test_parse(run_...
promptflow/src/promptflow/tests/executor/unittests/contracts/test_run_mode.py/0
{ "file_path": "promptflow/src/promptflow/tests/executor/unittests/contracts/test_run_mode.py", "repo_id": "promptflow", "token_count": 210 }
58
import json import pytest from ..recording_utilities import is_live testdata = """The event sourcing pattern involves using an append-only store to record the full series of actions on that data. The Azure Cosmos DB change feed is a great choice as a central data store in event sourcing architectures in which all d...
promptflow/src/promptflow/tests/sdk_cli_azure_test/e2etests/test_flow_serve.py/0
{ "file_path": "promptflow/src/promptflow/tests/sdk_cli_azure_test/e2etests/test_flow_serve.py", "repo_id": "promptflow", "token_count": 1820 }
59
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import mock import pytest from promptflow import PFClient from promptflow._sdk.operations._connection_operations import ConnectionOperation...
promptflow/src/promptflow/tests/sdk_cli_azure_test/unittests/test_pf_client.py/0
{ "file_path": "promptflow/src/promptflow/tests/sdk_cli_azure_test/unittests/test_pf_client.py", "repo_id": "promptflow", "token_count": 1445 }
60
import uuid from pathlib import Path import pydash import pytest from promptflow._sdk._constants import SCRUBBED_VALUE, CustomStrongTypeConnectionConfigs from promptflow._sdk._pf_client import PFClient from promptflow._sdk.entities import CustomStrongTypeConnection from promptflow.contracts.types import Secret clas...
promptflow/src/promptflow/tests/sdk_cli_test/e2etests/test_custom_strong_type_connection.py/0
{ "file_path": "promptflow/src/promptflow/tests/sdk_cli_test/e2etests/test_custom_strong_type_connection.py", "repo_id": "promptflow", "token_count": 3245 }
61
import pytest from promptflow._cli._pf.entry import get_parser_args from promptflow._cli._utils import _get_cli_activity_name def get_cli_activity_name(cmd): prog, args = get_parser_args(list(cmd)[1:]) return _get_cli_activity_name(cli=prog, args=args) @pytest.mark.unittest class TestCliTimeConsume: def...
promptflow/src/promptflow/tests/sdk_cli_test/unittests/test_cli_activity_name.py/0
{ "file_path": "promptflow/src/promptflow/tests/sdk_cli_test/unittests/test_cli_activity_name.py", "repo_id": "promptflow", "token_count": 1349 }
62
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import pytest from flask.app import Flask from promptflow import PFClient from .utils import PFSOperations @pytest.fixture def app() ->...
promptflow/src/promptflow/tests/sdk_pfs_test/conftest.py/0
{ "file_path": "promptflow/src/promptflow/tests/sdk_pfs_test/conftest.py", "repo_id": "promptflow", "token_count": 202 }
63
name: my_custom_strong_type_connection type: custom custom_type: MyFirstConnection module: my_tool_package.connections package: test-custom-tools package_version: 0.0.2 configs: api_base: "This is my first connection." secrets: # must-have api_key: "<to-be-replaced>"
promptflow/src/promptflow/tests/test_configs/connections/custom_strong_type_connection.yaml/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/connections/custom_strong_type_connection.yaml", "repo_id": "promptflow", "token_count": 92 }
64
{"name": "promptflow"}
promptflow/src/promptflow/tests/test_configs/datas/simple_hello_world.jsonl/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/datas/simple_hello_world.jsonl", "repo_id": "promptflow", "token_count": 8 }
65
entry: my_func path: ./entry.py nodes: []
promptflow/src/promptflow/tests/test_configs/eager_flows/invalid_extra_fields_nodes/flow.dag.yaml/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/eager_flows/invalid_extra_fields_nodes/flow.dag.yaml", "repo_id": "promptflow", "token_count": 17 }
66
$schema: https://azuremlschemas.azureedge.net/promptflow/latest/Experiment.schema.json description: Basic experiment without script node data: - name: my_data path: ../../flows/web_classification/data.jsonl inputs: - name: count type: int default: 3 nodes: - name: gen_data type: command co...
promptflow/src/promptflow/tests/test_configs/experiments/basic-script-template/basic-script.exp.yaml/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/experiments/basic-script-template/basic-script.exp.yaml", "repo_id": "promptflow", "token_count": 541 }
67
{ "line_process.completed": 3, "aggregate.failed": 1 }
promptflow/src/promptflow/tests/test_configs/flows/aggregation_node_failed/expected_status_summary.json/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/flows/aggregation_node_failed/expected_status_summary.json", "repo_id": "promptflow", "token_count": 28 }
68
import random import time from promptflow import tool @tool def get_stock_eod_price(date: str, company: str): """Get the stock end of day price by date and symbol. :param date: the date of the stock price. e.g. 2021-01-01 :type date: str :param company: the company name like A, B, C :type compan...
promptflow/src/promptflow/tests/test_configs/flows/assistant-with-file/get_stock_eod_price.py/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/flows/assistant-with-file/get_stock_eod_price.py", "repo_id": "promptflow", "token_count": 198 }
69
$schema: https://azuremlschemas.azureedge.net/promptflow/latest/Flow.schema.json inputs: text: type: string default: Python Hello World! outputs: output: type: string reference: ${llm.output} nodes: - name: hello_prompt type: prompt inputs: text: ${inputs.text} source: type: code p...
promptflow/src/promptflow/tests/test_configs/flows/basic_with_builtin_llm_node/flow.dag.yaml/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/flows/basic_with_builtin_llm_node/flow.dag.yaml", "repo_id": "promptflow", "token_count": 258 }
70
from promptflow import tool from typing import Generator, List def stream(question: str) -> Generator[str, None, None]: for word in question: yield word @tool def my_python_tool(chat_history: List[dict], question: str) -> dict: return {"answer": stream(question)}
promptflow/src/promptflow/tests/test_configs/flows/chat_flow_with_python_node_streaming_output/stream.py/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/flows/chat_flow_with_python_node_streaming_output/stream.py", "repo_id": "promptflow", "token_count": 89 }
71
from time import sleep from promptflow import tool @tool def wait(**args) -> int: sleep(5) return str(args)
promptflow/src/promptflow/tests/test_configs/flows/concurrent_execution_flow/wait_long.py/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/flows/concurrent_execution_flow/wait_long.py", "repo_id": "promptflow", "token_count": 42 }
72
from promptflow import tool @tool def collect(input1, input2: str="") -> str: return {'double': input1, 'square': input2}
promptflow/src/promptflow/tests/test_configs/flows/conditional_flow_with_aggregate_bypassed/collect_node.py/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/flows/conditional_flow_with_aggregate_bypassed/collect_node.py", "repo_id": "promptflow", "token_count": 42 }
73
from typing import List from promptflow import tool @tool def test_print_input(input_str: List[str], input_bool: List[bool], input_list: List[List], input_dict: List[dict]): assert input_bool[0] == False assert input_list[0] == [] assert input_dict[0] == {} print(input_str) return input_str
promptflow/src/promptflow/tests/test_configs/flows/default_input/test_print_aggregation.py/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/flows/default_input/test_print_aggregation.py", "repo_id": "promptflow", "token_count": 112 }
74
from promptflow import tool @tool def merge_images(image_1: list, image_2: list, image_3: list): res = set() res.add(image_1[0]) res.add(image_2[0]) res.add(image_3[0]) return list(res)
promptflow/src/promptflow/tests/test_configs/flows/eval_flow_with_simple_image/merge_images.py/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/flows/eval_flow_with_simple_image/merge_images.py", "repo_id": "promptflow", "token_count": 93 }
75
{ "CUSTOM_CONNECTION_AZURE_OPENAI_API_KEY": "" }
promptflow/src/promptflow/tests/test_configs/flows/export/linux/settings.json/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/flows/export/linux/settings.json", "repo_id": "promptflow", "token_count": 26 }
76
from promptflow import tool @tool def print_val(val, origin_val): print(val) print(origin_val) if not isinstance(origin_val, dict): raise TypeError(f"key must be a dict, got {type(origin_val)}") return val
promptflow/src/promptflow/tests/test_configs/flows/flow_with_dict_input/print_val.py/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/flows/flow_with_dict_input/print_val.py", "repo_id": "promptflow", "token_count": 90 }
77
import package_not_exist
promptflow/src/promptflow/tests/test_configs/flows/flow_with_invalid_import/hello.py/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/flows/flow_with_invalid_import/hello.py", "repo_id": "promptflow", "token_count": 7 }
78
from promptflow import tool import random import time @tool def my_python_tool_with_failed_line(idx: int, mod=5) -> int: if idx % mod == 0: while True: time.sleep(60) return idx
promptflow/src/promptflow/tests/test_configs/flows/one_line_of_bulktest_timeout/my_python_tool_with_failed_line.py/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/flows/one_line_of_bulktest_timeout/my_python_tool_with_failed_line.py", "repo_id": "promptflow", "token_count": 90 }
79
{ "my_python_tool_with_failed_line_1.completed": 7, "my_python_tool_with_failed_line_1.failed": 3, "my_python_tool_with_failed_line_2.completed": 5, "my_python_tool_with_failed_line_2.failed": 2 }
promptflow/src/promptflow/tests/test_configs/flows/python_tool_partial_failure/expected_status_summary.json/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/flows/python_tool_partial_failure/expected_status_summary.json", "repo_id": "promptflow", "token_count": 96 }
80
{ "name": "main", "type": "python", "inputs": { "x": { "type": [ "string" ] } }, "source": "dummy_utils/main.py", "function": "main" }
promptflow/src/promptflow/tests/test_configs/flows/script_with_import/dummy_utils/main.meta.json/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/flows/script_with_import/dummy_utils/main.meta.json", "repo_id": "promptflow", "token_count": 93 }
81
import statistics from typing import List from promptflow import tool @tool def aggregate_num(num: List[int]) -> int: return statistics.mean(num)
promptflow/src/promptflow/tests/test_configs/flows/simple_flow_with_python_tool_and_aggregate/aggregate_num.py/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/flows/simple_flow_with_python_tool_and_aggregate/aggregate_num.py", "repo_id": "promptflow", "token_count": 45 }
82
name: node_wrong_order inputs: text: type: string 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: code path: test.py i...
promptflow/src/promptflow/tests/test_configs/flows/unordered_nodes/flow.dag.yaml/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/flows/unordered_nodes/flow.dag.yaml", "repo_id": "promptflow", "token_count": 195 }
83
FOO=BAR
promptflow/src/promptflow/tests/test_configs/runs/env_file/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/runs/env_file", "repo_id": "promptflow", "token_count": 6 }
84
{"batch_size": 1}
promptflow/src/promptflow/tests/test_configs/runs/web_classification_variant_0_20231205_120253_104100/meta.json/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/runs/web_classification_variant_0_20231205_120253_104100/meta.json", "repo_id": "promptflow", "token_count": 7 }
85
from enum import Enum from promptflow.entities import InputSetting from promptflow import tool class UserType(str, Enum): STUDENT = "student" TEACHER = "teacher" @tool(name=1, description=1) def invalid_schema_type(input1: str) -> str: return 'hello ' + input1 @tool( name="invalid_input_settings"...
promptflow/src/promptflow/tests/test_configs/tools/invalid_tool.py/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/tools/invalid_tool.py", "repo_id": "promptflow", "token_count": 333 }
86
inputs: {} outputs: {} nodes: - name: wrong_llm type: llm source: type: code path: wrong_llm.jinja2 inputs: {} connection: custom_connection
promptflow/src/promptflow/tests/test_configs/wrong_flows/flow_llm_with_wrong_conn/flow.dag.yaml/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/wrong_flows/flow_llm_with_wrong_conn/flow.dag.yaml", "repo_id": "promptflow", "token_count": 65 }
87
name: node_cycle 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: ${second_node} aggregation: true - name: second_node type: python source: type: code p...
promptflow/src/promptflow/tests/test_configs/wrong_flows/nodes_cycle/flow.dag.yaml/0
{ "file_path": "promptflow/src/promptflow/tests/test_configs/wrong_flows/nodes_cycle/flow.dag.yaml", "repo_id": "promptflow", "token_count": 155 }
88
# Microsoft Open Source Code of Conduct This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). Resources: - [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/) - [Microsoft Code of Conduct FAQ](https://opensource.mic...
promptflow/CODE_OF_CONDUCT.md/0
{ "file_path": "promptflow/CODE_OF_CONDUCT.md", "repo_id": "promptflow", "token_count": 115 }
0