repo_id
stringlengths
15
132
file_path
stringlengths
34
176
content
stringlengths
2
3.52M
__index_level_0__
int64
0
0
promptflow_repo/promptflow/scripts/docs
promptflow_repo/promptflow/scripts/docs/_static/custom.css
.title { font-weight:700; } .sd-card-header { font-weight:700; font-size: 16px; } .bd-page-width { max-width: 100rem; } .bd-sidebar-primary { flex: 0 0 20%; } .bd-main .bd-content .bd-article-container { max-width: 70em; } html[data-theme="light"] { --header-announcement-color: #fff070...
0
promptflow_repo/promptflow/scripts/docs
promptflow_repo/promptflow/scripts/docs/_static/logo.svg
<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg"> <g clip-path="url(#clip0_699_15212)"> <path fill-rule="evenodd" clip-rule="evenodd" d="M237 39.0408V461.693C237 469.397 228.655 474.208 221.988 470.346L151.918 429.764C130.306 417.247 117 394.164 117 369.19V148.892C117 1...
0
promptflow_repo/promptflow/scripts/docs
promptflow_repo/promptflow/scripts/docs/gallery_directive/__init__.py
"""A directive to generate a gallery of images from structured data. Generating a gallery of images that are all the same size is a common pattern in documentation, and this can be cumbersome if the gallery is generated programmatically. This directive wraps this particular use-case in a helper-directive to generate it...
0
promptflow_repo/promptflow/scripts
promptflow_repo/promptflow/scripts/json_schema/EagerFlow.schema.json
{ "$schema": "http://json-schema.org/draft-07/schema#", "definitions": { "EagerFlowSchema": { "properties": { "additional_includes": { "title": "additional_includes", "type": "array", "items": { ...
0
promptflow_repo/promptflow/scripts
promptflow_repo/promptflow/scripts/json_schema/gen_json_schema.py
# --------------------------------------------------------- # 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...
0
promptflow_repo/promptflow/scripts
promptflow_repo/promptflow/scripts/json_schema/Flow.schema.json
{ "type": "object", "oneOf": [ { "properties": { "additional_includes": { "title": "additional_includes", "type": "array", "items": { "title": "additional_includes", "t...
0
promptflow_repo/promptflow/scripts
promptflow_repo/promptflow/scripts/building/check_enforcer.py
# Enforce the check of pipelines. # This script will get the diff of the current branch and main branch, calculate the pipelines that should be triggered. # Then it will check if the triggered pipelines are successful. This script will loop for 30*loop-times seconds at most. # How many checks are triggered: # 1. sdk c...
0
promptflow_repo/promptflow/scripts
promptflow_repo/promptflow/scripts/building/utils.py
import logging import os import subprocess import sys import time import traceback module_logger = logging.getLogger(__name__) class Color: PURPLE = "\033[95m" CYAN = "\033[96m" DARKCYAN = "\033[36m" BLUE = "\033[94m" GREEN = "\033[92m" YELLOW = "\033[93m" RED = "\033[91m" BOLD = "\03...
0
promptflow_repo/promptflow/scripts
promptflow_repo/promptflow/scripts/building/generate_connection_config.py
import argparse import json from pathlib import Path from azure.keyvault.secrets import SecretClient from azure.identity import ClientSecretCredential, DefaultAzureCredential CONNECTION_FILE_NAME = "connections.json" CONNECTION_TPL_FILE_PATH = Path(".") / "src/promptflow" / "dev-connections.json.example" def get_s...
0
promptflow_repo/promptflow/scripts
promptflow_repo/promptflow/scripts/building/dev_setup.py
import argparse from pathlib import Path from platform import system from utils import print_blue, run_command def setup_promptflow(extra_deps: list, command_args: dict) -> None: print_blue("- Setting up the promptflow SDK ") print_blue("- Installing promptflow Python SDK from local directory") package_l...
0
promptflow_repo/promptflow/scripts
promptflow_repo/promptflow/scripts/building/run_coverage_tests.py
import argparse import os import sys from pathlib import Path from utils import Color, run_command, print_red if __name__ == "__main__": parser = argparse.ArgumentParser(description=Color.RED + "Test Coverage for Promptflow!" + Color.END + "\n") parser.add_argument("-p", required=True, nargs="+", help="The p...
0
promptflow_repo/promptflow/scripts
promptflow_repo/promptflow/scripts/building/release-env.yml
name: release-env channels: - defaults - conda-forge dependencies: - pip - pip: - setuptools - twine==4.0.0 - portalocker~=1.2 - setuptools_rust - pytest - pytest-xdist - pytest-sugar - pytest-timeout - azure-keyvault - azure-identity
0
promptflow_repo/promptflow/scripts/installer
promptflow_repo/promptflow/scripts/installer/windows/README.md
# 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...
0
promptflow_repo/promptflow/scripts/installer
promptflow_repo/promptflow/scripts/installer/windows/product.wxs
<?xml version="1.0" encoding="UTF-8"?> <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> <?define ProductVersion="$(env.CLI_VERSION)" ?> <?define ProductName = "promptflow" ?> <?define ProductDescription = "Command-line tools for prompt flow." ?> <?define ProductAuthor = "Microsoft Corporation" ...
0
promptflow_repo/promptflow/scripts/installer
promptflow_repo/promptflow/scripts/installer/windows/promptflow.wixproj
<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <!-- Project --> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">x86<...
0
promptflow_repo/promptflow/scripts/installer
promptflow_repo/promptflow/scripts/installer/windows/install_from_msi.md
# 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 ...
0
promptflow_repo/promptflow/scripts/installer/windows
promptflow_repo/promptflow/scripts/installer/windows/resources/CLI_LICENSE.rtf
{\rtf1\ansi\ansicpg1252\cocoartf1504\cocoasubrtf820 {\fonttbl\f0\fnil\fcharset0 Tahoma;\f1\froman\fcharset0 TimesNewRomanPSMT;\f2\ftech\fcharset77 Symbol; } {\colortbl;\red255\green255\blue255;\red0\green0\blue255;} {\*\expandedcolortbl;;\csgenericrgb\c0\c0\c100000;} {\*\listtable{\list\listtemplateid1\listhybrid{\list...
0
promptflow_repo/promptflow/scripts/installer/windows
promptflow_repo/promptflow/scripts/installer/windows/scripts/pfazure.bat
@echo off setlocal set MAIN_EXE=%~dp0.\pfcli.exe "%MAIN_EXE%" pfazure %*
0
promptflow_repo/promptflow/scripts/installer/windows
promptflow_repo/promptflow/scripts/installer/windows/scripts/pfs.bat
@echo off setlocal set MAIN_EXE=%~dp0.\pfcli.exe "%MAIN_EXE%" pfs %*
0
promptflow_repo/promptflow/scripts/installer/windows
promptflow_repo/promptflow/scripts/installer/windows/scripts/pfsvc.bat
@echo off setlocal set MAIN_EXE=%~dp0.\pfcli.exe "%MAIN_EXE%" pfsvc %*
0
promptflow_repo/promptflow/scripts/installer/windows
promptflow_repo/promptflow/scripts/installer/windows/scripts/promptflow_service.vbs
DIM objshell set objshell = wscript.createobject("wscript.shell") iReturn = objshell.run("pfs.bat start --force", 0, true)
0
promptflow_repo/promptflow/scripts/installer/windows
promptflow_repo/promptflow/scripts/installer/windows/scripts/pf.bat
@echo off setlocal SET PF_INSTALLER=MSI set MAIN_EXE=%~dp0.\pfcli.exe "%MAIN_EXE%" pf %*
0
promptflow_repo/promptflow/scripts/installer/windows
promptflow_repo/promptflow/scripts/installer/windows/scripts/version_info.txt
# UTF-8 # # For more details about fixed file info 'ffi' see: # http://msdn.microsoft.com/en-us/library/ms646997.aspx VSVersionInfo( ffi=FixedFileInfo( # filevers and prodvers should be always a tuple with four items: (1, 2, 3, 4) # Set not needed items to zero 0. filevers=($(env.FILE_VERSION)), prod...
0
promptflow_repo/promptflow/scripts/installer/windows
promptflow_repo/promptflow/scripts/installer/windows/scripts/pfcli.py
import sys import multiprocessing # use this file as the only entry point for the CLI to avoid packaging the same environment repeatedly if __name__ == "__main__": multiprocessing.freeze_support() command = sys.argv[1] if len(sys.argv) > 1 else None sys.argv = sys.argv[1:] if command == 'pf': ...
0
promptflow_repo/promptflow/scripts/installer/windows
promptflow_repo/promptflow/scripts/installer/windows/scripts/promptflow.spec
# -*- mode: python ; coding: utf-8 -*- from PyInstaller.utils.hooks import collect_data_files from PyInstaller.utils.hooks import copy_metadata datas = [('../resources/CLI_LICENSE.rtf', '.'), ('../../../../src/promptflow/NOTICE.txt', '.'), ('../../../../src/promptflow/promptflow/_sdk/data/executable/', './promptflow/_...
0
promptflow_repo/promptflow/scripts/installer
promptflow_repo/promptflow/scripts/installer/curl_install_pypi/README.md
# Curl Install Script Information The scripts in this directory are used for installing through curl and they point to the packages on PyPI. ## Install or update promptflow curl https://promptflowartifact.blob.core.windows.net/linux-install-scripts/install | bash The script can also be downloaded and run locally. Y...
0
promptflow_repo/promptflow/scripts/installer
promptflow_repo/promptflow/scripts/installer/curl_install_pypi/install
#!/usr/bin/env bash #--------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. #------------------------------------------------...
0
promptflow_repo/promptflow/scripts/installer
promptflow_repo/promptflow/scripts/installer/curl_install_pypi/install.py
#!/usr/bin/env python # -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # ---------------------------------------------...
0
promptflow_repo/promptflow/scripts
promptflow_repo/promptflow/scripts/distributing/publish_package.py
import argparse import json import os import re from datetime import datetime, timedelta from azure.storage.blob import ( AccountSasPermissions, BlobServiceClient, ContentSettings, ResourceTypes, generate_account_sas, ) def get_connection_string(storage_account, storage_key): return f"Default...
0
promptflow_repo/promptflow/scripts/distributing
promptflow_repo/promptflow/scripts/distributing/configs/distribution_settings.json
{ "releases":{ "internal":{ "promptflow-tools-release":{ "index": "internal-index-release" }, "promptflow-tools-test":{ "index": "internal-index-test" } } }, "targets": { "internal-index-release": { "storage_account": "azuremlsdktestpypi", "packages_...
0
promptflow_repo/promptflow/scripts/distributing
promptflow_repo/promptflow/scripts/distributing/configs/promptflow-tools-release-env.yaml
name: release-env channels: - defaults - conda-forge dependencies: - python=3.8 - pip - pip: - setuptools - twine==4.0.0 - azure-storage-blob==12.16.0
0
promptflow_repo/promptflow/scripts
promptflow_repo/promptflow/scripts/release/promptflow-release-note.md
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 ...
0
promptflow_repo/promptflow/scripts
promptflow_repo/promptflow/scripts/runtime_mgmt/update-runtime.py
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import argparse import time from pathlib import Path import requests from azure.ai.ml import MLClient, load_environment from azure.identit...
0
promptflow_repo/promptflow/scripts/runtime_mgmt
promptflow_repo/promptflow/scripts/runtime_mgmt/runtime-env/env.yaml
$schema: https://azuremlschemas.azureedge.net/latest/environment.schema.json name: chat-with-pdf build: path: context inference_config: liveness_route: port: 8080 path: /health readiness_route: port: 8080 path: /health scoring_route: port: 8080 path: /score
0
promptflow_repo/promptflow/scripts/runtime_mgmt/runtime-env
promptflow_repo/promptflow/scripts/runtime_mgmt/runtime-env/context/Dockerfile
FROM mcr.microsoft.com/azureml/promptflow/promptflow-runtime:latest COPY ./requirements.txt ./ RUN pip install --no-cache-dir -r requirements.txt
0
promptflow_repo/promptflow/scripts/runtime_mgmt/runtime-env
promptflow_repo/promptflow/scripts/runtime_mgmt/runtime-env/context/requirements.txt
PyPDF2 faiss-cpu openai jinja2 python-dotenv tiktoken
0
promptflow_repo/promptflow/scripts
promptflow_repo/promptflow/scripts/readme/extract_steps_from_readme.py
import argparse from pathlib import Path from jinja2 import Environment, FileSystemLoader from ghactions_driver.readme_parse import readme_parser from ghactions_driver.readme_step import ReadmeStepsManage def write_readme_shell(readme_path: str, output_folder: str): full_text = readme_parser(readme_path) Pat...
0
promptflow_repo/promptflow/scripts
promptflow_repo/promptflow/scripts/readme/README.md
# 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]...
0
promptflow_repo/promptflow/scripts
promptflow_repo/promptflow/scripts/readme/workflow_generator.py
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...
0
promptflow_repo/promptflow/scripts
promptflow_repo/promptflow/scripts/readme/schema_checker.py
from promptflow._sdk._load_functions import load_yaml from promptflow._sdk._pf_client import PFClient from ghactions_driver.readme_step import ReadmeStepsManage from pathlib import Path import os import subprocess import sys def install(filename): subprocess.check_call([sys.executable, "-m", "pip", "install", "-r...
0
promptflow_repo/promptflow/scripts
promptflow_repo/promptflow/scripts/readme/readme.py
# Generate Readme file for the examples folder import json from pathlib import Path import workflow_generator import readme_generator from jinja2 import Environment, FileSystemLoader from ghactions_driver.readme_step import ReadmeStepsManage from operator import itemgetter import argparse import sys import os import re...
0
promptflow_repo/promptflow/scripts
promptflow_repo/promptflow/scripts/readme/readme_generator.py
import argparse from pathlib import Path from functools import reduce from ghactions_driver.readme_workflow_generate import write_readme_workflow from ghactions_driver.readme_step import ReadmeStepsManage, ReadmeSteps from ghactions_driver.readme_parse import readme_parser from ghactions_driver.telemetry_obj import T...
0
promptflow_repo/promptflow/scripts/readme
promptflow_repo/promptflow/scripts/readme/ghactions_driver/telemetry_obj.py
class Telemetry(object): pass
0
promptflow_repo/promptflow/scripts/readme
promptflow_repo/promptflow/scripts/readme/ghactions_driver/readme_step.py
import subprocess from pathlib import Path import hashlib from jinja2 import Environment, FileSystemLoader, Template from .telemetry_obj import Telemetry class Step: """ StepType in workflow """ Environment = None @staticmethod def init_jinja_loader() -> Environment: jinja_folder_pat...
0
promptflow_repo/promptflow/scripts/readme
promptflow_repo/promptflow/scripts/readme/ghactions_driver/readme_workflow_generate.py
from pathlib import Path from .readme_step import ReadmeStepsManage, ReadmeSteps from ghactions_driver.telemetry_obj import Telemetry def write_readme_workflow(readme_path, output_telemetry=Telemetry()): relative_path = Path(readme_path).relative_to( Path(ReadmeStepsManage.git_base_dir()) ) workf...
0
promptflow_repo/promptflow/scripts/readme
promptflow_repo/promptflow/scripts/readme/ghactions_driver/readme_parse.py
import io import re from pathlib import Path import panflute import pypandoc from .readme_step import ReadmeStepsManage def strip_comments(code): code = str(code) code = re.sub(r"(?m)^ *#.*\n?", "", code) # remove comments splits = [ll.rstrip() for ll in code.splitlines() if ll.strip()] # remove empty...
0
promptflow_repo/promptflow/scripts/readme
promptflow_repo/promptflow/scripts/readme/ghactions_driver/resource_resolver.py
from pathlib import Path from typing import List import markdown import nbformat from .readme_step import ReadmeStepsManage RESOURCES_KEY_NAME = "resources" RESOURCES_KEY_ERROR_MESSAGE = ( "Please follow examples contributing guide to declare tutorial resources: " "https://github.com/microsoft/promptflow/blo...
0
promptflow_repo/promptflow/scripts/readme/ghactions_driver
promptflow_repo/promptflow/scripts/readme/ghactions_driver/workflow_steps/step_extract_steps_and_run.yml.jinja2
- 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...
0
promptflow_repo/promptflow/scripts/readme/ghactions_driver
promptflow_repo/promptflow/scripts/readme/ghactions_driver/workflow_steps/step_azure_login.yml.jinja2
- name: {{ step_name }} uses: azure/login@v1 with: creds: ${{ '{{' }} secrets.AZURE_CREDENTIALS }}
0
promptflow_repo/promptflow/scripts/readme/ghactions_driver
promptflow_repo/promptflow/scripts/readme/ghactions_driver/workflow_steps/step_create_run_yml.yml.jinja2
- name: {{ step_name }} working-directory: {{ working_dir }} run: | gpt_base=${{ '{{' }} secrets.AOAI_API_ENDPOINT_TEST }} gpt_base=$(echo ${gpt_base//\//\\/}) if [[ -e run.yml ]]; then sed -i -e "s/\${azure_open_ai_connection.api_key}/${{ '{{' }} secrets.AOAI_API_KEY_TEST }}/g" -e "s/\${azure_ope...
0
promptflow_repo/promptflow/scripts/readme/ghactions_driver
promptflow_repo/promptflow/scripts/readme/ghactions_driver/workflow_steps/step_install_dev_deps.yml.jinja2
- name: {{ step_name }} working-directory: examples run: | python -m pip install --upgrade pip pip install -r dev_requirements.txt
0
promptflow_repo/promptflow/scripts/readme/ghactions_driver
promptflow_repo/promptflow/scripts/readme/ghactions_driver/workflow_steps/step_extract_steps_and_run_gpt4.yml.jinja2
- 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...
0
promptflow_repo/promptflow/scripts/readme/ghactions_driver
promptflow_repo/promptflow/scripts/readme/ghactions_driver/workflow_steps/step_create_env.yml.jinja2
- name: {{ step_name }} working-directory: {{ working_dir }} run: | AOAI_API_KEY=${{ '{{' }} secrets.AOAI_API_KEY_TEST }} AOAI_API_ENDPOINT=${{ '{{' }} secrets.AOAI_API_ENDPOINT_TEST }} AOAI_API_ENDPOINT=$(echo ${AOAI_API_ENDPOINT//\//\\/}) if [[ -e .env.example ]]; then echo "env replacement"...
0
promptflow_repo/promptflow/scripts/readme/ghactions_driver
promptflow_repo/promptflow/scripts/readme/ghactions_driver/workflow_steps/step_install_deps.yml.jinja2
- name: {{ step_name }} working-directory: examples run: | if [[ -e requirements.txt ]]; then python -m pip install --upgrade pip pip install -r requirements.txt fi
0
promptflow_repo/promptflow/scripts/readme/ghactions_driver
promptflow_repo/promptflow/scripts/readme/ghactions_driver/workflow_steps/step_yml_create_aoai.yml.jinja2
- name: {{ step_name }} working-directory: ${{ '{{' }} github.workspace }} run: pf connection create --file {{ yaml_name }} --set api_key=${{ '{{' }} secrets.AOAI_API_KEY_TEST }} api_base=${{ '{{' }} secrets.AOAI_API_ENDPOINT_TEST }}
0
promptflow_repo/promptflow/scripts/readme/ghactions_driver
promptflow_repo/promptflow/scripts/readme/ghactions_driver/workflow_steps/step_env_create_aoai.yml.jinja2
- 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...
0
promptflow_repo/promptflow/scripts/readme/ghactions_driver
promptflow_repo/promptflow/scripts/readme/ghactions_driver/workflow_steps/step_create_env_gpt4.yml.jinja2
- name: {{ step_name }} working-directory: {{ working_dir }} run: | AOAI_API_KEY=${{ '{{' }} secrets.AOAI_GPT_4V_KEY }} AOAI_API_ENDPOINT=${{ '{{' }} secrets.AOAI_GPT_4V_ENDPOINT }} AOAI_API_ENDPOINT=$(echo ${AOAI_API_ENDPOINT//\//\\/}) cp ../../../connections/azure_openai.yml ./azure_openai.yml ...
0
promptflow_repo/promptflow/scripts/readme/ghactions_driver
promptflow_repo/promptflow/scripts/readme/ghactions_driver/bash_script/bash_script.sh.jinja2
#!/usr/bin/env bash set -xe {{ command }}
0
promptflow_repo/promptflow/scripts/readme/ghactions_driver
promptflow_repo/promptflow/scripts/readme/ghactions_driver/readme_templates/README.md.jinja2
# Promptflow examples [![code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) [![license: MIT](https://img.shields.io/badge/License-MIT-purple.svg)](../LICENSE) ## Get started **Install dependencies** - Bootstrap your python environment. - e.g: create a new...
0
promptflow_repo/promptflow/scripts/readme/ghactions_driver
promptflow_repo/promptflow/scripts/readme/ghactions_driver/workflow_templates/basic_workflow_replace_config_json.yml.jinja2
{% extends "workflow_skeleton.yml.jinja2" %} {% block steps %} runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 - name: Setup Python 3.9 environment uses: actions/setup-python@v4 with: python-version: "3.9" - name: Generate config.json for canary workspace (sch...
0
promptflow_repo/promptflow/scripts/readme/ghactions_driver
promptflow_repo/promptflow/scripts/readme/ghactions_driver/workflow_templates/basic_workflow.yml.jinja2
{% extends "workflow_skeleton.yml.jinja2" %} {% block steps %} runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 - name: Azure Login uses: azure/login@v1 with: creds: ${{ '{{' }} secrets.AZURE_CREDENTIALS }} - name: Setup Python 3.9 environment uses: actions...
0
promptflow_repo/promptflow/scripts/readme/ghactions_driver
promptflow_repo/promptflow/scripts/readme/ghactions_driver/workflow_templates/flow_as_function.yml.jinja2
{% extends "workflow_skeleton.yml.jinja2" %} {% block steps %} runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 - name: Azure Login uses: azure/login@v1 with: creds: ${{ '{{' }} secrets.AZURE_CREDENTIALS }} - name: Setup Python 3.9 environment uses: actions...
0
promptflow_repo/promptflow/scripts/readme/ghactions_driver
promptflow_repo/promptflow/scripts/readme/ghactions_driver/workflow_templates/workflow_config_json.yml.jinja2
{% extends "workflow_skeleton.yml.jinja2" %} {% block steps %} runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 - name: Generate config.json for canary workspace (scheduled runs only) if: github.event_name == 'schedule' run: echo '${{ '{{' }} secrets.TEST_WORKSPACE_CON...
0
promptflow_repo/promptflow/scripts/readme/ghactions_driver
promptflow_repo/promptflow/scripts/readme/ghactions_driver/workflow_templates/basic_workflow_replace.yml.jinja2
{% extends "workflow_skeleton.yml.jinja2" %} {% block steps %} runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 - name: Setup Python 3.9 environment uses: actions/setup-python@v4 with: python-version: "3.9" {%- filter indent(width=2) -%} {% for step in steps %} {...
0
promptflow_repo/promptflow/scripts/readme/ghactions_driver
promptflow_repo/promptflow/scripts/readme/ghactions_driver/workflow_templates/workflow_skeleton.yml.jinja2
# This code is autogenerated. # Code is generated by running custom script: python3 readme.py # Any manual changes to this file may cause incorrect behavior. # Any manual changes will be overwritten if the code is regenerated. name: {{ workflow_name }} on: schedule: - cron: "{{ crontab }}" # {{ crontab_comment }...
0
promptflow_repo/promptflow/scripts/readme/ghactions_driver
promptflow_repo/promptflow/scripts/readme/ghactions_driver/workflow_templates/pdf_workflow.yml.jinja2
{% extends "workflow_skeleton.yml.jinja2" %} {% block steps %} runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 - name: Generate config.json for canary workspace (scheduled runs only) if: github.event_name == 'schedule' run: echo '${{ '{{' }} secrets.TEST_WORKSPACE_CON...
0
promptflow_repo/promptflow/scripts
promptflow_repo/promptflow/scripts/compliance-check/Check-PolicheckScan.ps1
# Copyright (C) Microsoft Corporation. All rights reserved. <# .SYNOPSIS Check Policheck Scan result. .DESCRIPTION Helper script to check the Policheck result. If there is policheck failure, show the error and throw exception. #> [CmdLetbinding()] param ( [string]$policheckResult, [st...
0
promptflow_repo/promptflow/scripts
promptflow_repo/promptflow/scripts/compliance-check/user_exclusion.xml
<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>
0
promptflow_repo/promptflow/src
promptflow_repo/promptflow/src/promptflow-tools/connections.json.example
{ "azure_open_ai_connection": { "type": "AzureOpenAIConnection", "value": { "api_key": "aoai-api-key", "api_base": "aoai-api-endpoint", "api_type": "azure", "api_version": "2023-07-01-preview" }, "module": "promptflow.connections" }, "serp_connection": { "type": "SerpCo...
0
promptflow_repo/promptflow/src
promptflow_repo/promptflow/src/promptflow-tools/CHANGELOG.md
# Release History ## 1.0.0 (2023.11.30) ### Features Added - Support openai 1.x in promptflow-tools - Add new tool "OpenAI GPT-4V"
0
promptflow_repo/promptflow/src
promptflow_repo/promptflow/src/promptflow-tools/README.md
# Prompt flow tools [![Python package](https://img.shields.io/pypi/v/promptflow-tools)](https://pypi.org/project/promptflow-tools/) [![License: MIT](https://img.shields.io/github/license/microsoft/promptflow)](https://github.com/microsoft/promptflow/blob/main/LICENSE) ## Introduction Tools are the fundamental buildi...
0
promptflow_repo/promptflow/src
promptflow_repo/promptflow/src/promptflow-tools/setup.py
import os import re from io import open from typing import Any, List, Match, cast from setuptools import find_namespace_packages, setup PACKAGE_NAME = "promptflow-tools" PACKAGE_FOLDER_PATH = "promptflow" def parse_requirements(file_name: str) -> List[str]: with open(file_name) as f: return [ ...
0
promptflow_repo/promptflow/src
promptflow_repo/promptflow/src/promptflow-tools/MANIFEST.in
include promptflow/tools/yamls/*.yaml
0
promptflow_repo/promptflow/src
promptflow_repo/promptflow/src/promptflow-tools/requirements.txt
google-search-results==2.4.1 promptflow # promptflow-tools only supports openai 1.x openai>=1.0.0
0
promptflow_repo/promptflow/src
promptflow_repo/promptflow/src/promptflow-tools/NOTICE.txt
NOTICES AND INFORMATION Do Not Translate or Localize This software incorporates material from third parties. Microsoft makes certain open source code available at https://3rdpartysource.microsoft.com, or you may send a check or money order for US $5.00, including the product name, the open source component name, platf...
0
promptflow_repo/promptflow/src
promptflow_repo/promptflow/src/promptflow-tools/README.dev.md
# Development Guide ## Prerequisites ```bash pip install -r requirements.txt pip install pytest pytest-mock ``` ## Run tests - Create connection config file by `cp connections.json.example connections.json`. - Fill in fields manually in `connections.json`. - `cd tests` and run `pytest -s -v` to run all tests. ## R...
0
promptflow_repo/promptflow/src/promptflow-tools
promptflow_repo/promptflow/src/promptflow-tools/promptflow/version.txt
VERSION = "1.1.0"
0
promptflow_repo/promptflow/src/promptflow-tools/promptflow
promptflow_repo/promptflow/src/promptflow-tools/promptflow/tools/openai.py
from enum import Enum 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.tools.common import render_jinja_template, handle_openai_error, \ ...
0
promptflow_repo/promptflow/src/promptflow-tools/promptflow
promptflow_repo/promptflow/src/promptflow-tools/promptflow/tools/list.py
from pathlib import Path from ruamel.yaml import YAML def collect_tools_from_directory(base_dir) -> dict: tools = {} yaml = YAML() for f in Path(base_dir).glob("**/*.yaml"): with open(f, "r") as f: tools_in_file = yaml.load(f) for identifier, tool in tools_in_file.items():...
0
promptflow_repo/promptflow/src/promptflow-tools/promptflow
promptflow_repo/promptflow/src/promptflow-tools/promptflow/tools/openai_gpt4v.py
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...
0
promptflow_repo/promptflow/src/promptflow-tools/promptflow
promptflow_repo/promptflow/src/promptflow-tools/promptflow/tools/aoai_gpt4v.py
try: from openai import AzureOpenAI as AzureOpenAIClient 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._internal import ToolProvider, tool from promptflow.connections import AzureOpenAI...
0
promptflow_repo/promptflow/src/promptflow-tools/promptflow
promptflow_repo/promptflow/src/promptflow-tools/promptflow/tools/__init__.py
from .aoai import AzureOpenAI # noqa: F401 from .openai import OpenAI # noqa: F401 from .serpapi import SerpAPI # noqa: F401
0
promptflow_repo/promptflow/src/promptflow-tools/promptflow
promptflow_repo/promptflow/src/promptflow-tools/promptflow/tools/embedding.py
from enum import Enum from typing import Union from openai import AzureOpenAI as AzureOpenAIClient, OpenAI as OpenAIClient from promptflow.tools.common import handle_openai_error, normalize_connection_config from promptflow.tools.exception import InvalidConnectionType # Avoid circular dependencies: Use import 'from p...
0
promptflow_repo/promptflow/src/promptflow-tools/promptflow
promptflow_repo/promptflow/src/promptflow-tools/promptflow/tools/azure_content_safety.py
from enum import Enum from typing import Dict, List, Union import json import requests from promptflow import tool, ToolProvider from promptflow.connections import AzureContentSafetyConnection from promptflow.tools.exception import AzureContentSafetyInputValueError, AzureContentSafetySystemError class TextCategorySe...
0
promptflow_repo/promptflow/src/promptflow-tools/promptflow
promptflow_repo/promptflow/src/promptflow-tools/promptflow/tools/exception.py
from openai import OpenAIError from promptflow.exceptions import ErrorTarget, SystemErrorException, UserErrorException openai_error_code_ref_message = "Error reference: https://platform.openai.com/docs/guides/error-codes/api-errors" def to_openai_error_message(e: Exception) -> str: ex_type = type(e).__name__ ...
0
promptflow_repo/promptflow/src/promptflow-tools/promptflow
promptflow_repo/promptflow/src/promptflow-tools/promptflow/tools/common.py
import functools import json import re import sys import time from typing import List, Mapping from jinja2 import Template from openai import APIConnectionError, APIStatusError, OpenAIError, RateLimitError, APITimeoutError from promptflow.tools.exception import ChatAPIInvalidRole, WrappedOpenAIError, LLMError, JinjaTe...
0
promptflow_repo/promptflow/src/promptflow-tools/promptflow
promptflow_repo/promptflow/src/promptflow-tools/promptflow/tools/open_model_llm.py
import functools import json import os import re import requests import sys import time import tempfile from abc import abstractmethod from datetime import datetime, timedelta from enum import Enum from typing import Any, Dict, List, Tuple, Optional, Union from promptflow._core.tool import ToolProvider, tool from pro...
0
promptflow_repo/promptflow/src/promptflow-tools/promptflow
promptflow_repo/promptflow/src/promptflow-tools/promptflow/tools/aoai.py
import json try: from openai import AzureOpenAI as AzureOpenAIClient 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.tools.common import render_jinja_template, handle_openai_error, parse...
0
promptflow_repo/promptflow/src/promptflow-tools/promptflow
promptflow_repo/promptflow/src/promptflow-tools/promptflow/tools/template_rendering.py
# 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 tool from promptflow.tools.common import render_jinja_template @tool def render_template_jinja2(template: str, **kwargs) -> str: ...
0
promptflow_repo/promptflow/src/promptflow-tools/promptflow
promptflow_repo/promptflow/src/promptflow-tools/promptflow/tools/serpapi.py
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 ...
0
promptflow_repo/promptflow/src/promptflow-tools/promptflow/tools
promptflow_repo/promptflow/src/promptflow-tools/promptflow/tools/yamls/serpapi.yaml
promptflow.tools.serpapi.SerpAPI.search: name: Serp API description: Use Serp API to obtain search results from a specific search engine. inputs: connection: type: - SerpConnection engine: default: google enum: - google - bing type: - string location: ...
0
promptflow_repo/promptflow/src/promptflow-tools/promptflow/tools
promptflow_repo/promptflow/src/promptflow-tools/promptflow/tools/yamls/openai_gpt4v.yaml
promptflow.tools.openai_gpt4v.OpenAI.chat: name: OpenAI GPT-4V description: Use OpenAI GPT-4V to leverage vision ability. type: custom_llm module: promptflow.tools.openai_gpt4v class_name: OpenAI function: chat tool_state: preview icon: light: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCA...
0
promptflow_repo/promptflow/src/promptflow-tools/promptflow/tools
promptflow_repo/promptflow/src/promptflow-tools/promptflow/tools/yamls/embedding.yaml
promptflow.tools.embedding.embedding: name: Embedding description: Use Open AI's embedding model to create an embedding vector representing the input text. type: python module: promptflow.tools.embedding function: embedding inputs: connection: type: [AzureOpenAIConnection, OpenAIConnection] de...
0
promptflow_repo/promptflow/src/promptflow-tools/promptflow/tools
promptflow_repo/promptflow/src/promptflow-tools/promptflow/tools/yamls/aoai_gpt4v.yaml
promptflow.tools.aoai_gpt4v.AzureOpenAI.chat: name: Azure OpenAI GPT-4 Turbo with Vision description: Use Azure OpenAI GPT-4 Turbo with Vision to leverage AOAI vision ability. type: custom_llm module: promptflow.tools.aoai_gpt4v class_name: AzureOpenAI function: chat tool_state: preview icon: light:...
0
promptflow_repo/promptflow/src/promptflow-tools/promptflow/tools
promptflow_repo/promptflow/src/promptflow-tools/promptflow/tools/yamls/open_model_llm.yaml
promptflow.tools.open_model_llm.OpenModelLLM.call: name: Open Model LLM description: Use an open model from the Azure Model catalog, deployed to an AzureML Online Endpoint for LLM Chat or Completion API calls. icon: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACgElEQVR4nGWSz2vcVRTFP/e9NzOZ...
0
promptflow_repo/promptflow/src/promptflow-tools/promptflow/tools
promptflow_repo/promptflow/src/promptflow-tools/promptflow/tools/yamls/azure_content_safety.yaml
promptflow.tools.azure_content_safety.analyze_text: module: promptflow.tools.azure_content_safety function: analyze_text inputs: connection: type: - AzureContentSafetyConnection hate_category: default: medium_sensitivity enum: - disable - low_sensitivity - medium_...
0
promptflow_repo/promptflow/src/promptflow-tools
promptflow_repo/promptflow/src/promptflow-tools/tests/test_embedding.py
import pytest from promptflow.tools.embedding import embedding from promptflow.tools.exception import InvalidConnectionType @pytest.mark.usefixtures("use_secrets_config_file") class TestEmbedding: def test_embedding_conn_aoai(self, azure_open_ai_connection): result = embedding( connection=azu...
0
promptflow_repo/promptflow/src/promptflow-tools
promptflow_repo/promptflow/src/promptflow-tools/tests/test_open_model_llm.py
import copy import os import pytest import re from azure.identity import DefaultAzureCredential from typing import List, Dict from promptflow.tools.exception import ( OpenModelLLMUserError, OpenModelLLMKeyValidationError ) from promptflow.tools.open_model_llm import ( OpenModelLLM, API, ContentForm...
0
promptflow_repo/promptflow/src/promptflow-tools
promptflow_repo/promptflow/src/promptflow-tools/tests/pytest.ini
[pytest] markers = skip_if_no_api_key: skip the test if actual api key is not provided.
0
promptflow_repo/promptflow/src/promptflow-tools
promptflow_repo/promptflow/src/promptflow-tools/tests/test_serpapi.py
import pytest from promptflow.exceptions import UserErrorException from promptflow.tools.serpapi import Engine, SafeMode, search import tests.utils as utils @pytest.mark.usefixtures("use_secrets_config_file") @pytest.mark.skip_if_no_api_key("serp_connection") class TestSerpAPI: def test_engine(self, serp_connec...
0