text
stringlengths
13
1.77M
id
stringlengths
22
127
metadata
dict
__index_level_0__
int64
0
28
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import copy import os.path from contextlib import contextmanager from os import PathLike from pathlib import Path from typing import Dict, L...
promptflow/src/promptflow/promptflow/azure/_entities/_flow.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/azure/_entities/_flow.py", "repo_id": "promptflow", "token_count": 3966 }
16
# coding=utf-8 # -------------------------------------------------------------------------- # Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.9.2, 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/models/_models_py3.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/azure/_restclient/flow/models/_models_py3.py", "repo_id": "promptflow", "token_count": 751139 }
17
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- from threading import Lock from promptflow.azure._restclient.flow_service_caller import FlowServiceCaller class _FlowServiceCallerFactory...
promptflow/src/promptflow/promptflow/azure/_restclient/service_caller_factory.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/azure/_restclient/service_caller_factory.py", "repo_id": "promptflow", "token_count": 390 }
18
$schema: https://azuremlschemas.azureedge.net/latest/commandComponent.schema.json # will be changed to flow to support parallelism type: command outputs: output: # PRS team will always aggregate all the outputs into a single file under this folder for now type: uri_folder
promptflow/src/promptflow/promptflow/azure/resources/component_spec_template.yaml/0
{ "file_path": "promptflow/src/promptflow/promptflow/azure/resources/component_spec_template.yaml", "repo_id": "promptflow", "token_count": 85 }
19
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- from dataclasses import dataclass from datetime import datetime from enum import Enum from typing import Any, Dict, List, Mapping, Optional...
promptflow/src/promptflow/promptflow/contracts/run_info.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/contracts/run_info.py", "repo_id": "promptflow", "token_count": 3703 }
20
import multiprocessing import queue import signal from dataclasses import dataclass from enum import Enum from functools import partial from multiprocessing import Queue from typing import List import psutil from promptflow._core.operation_context import OperationContext from promptflow._utils.logger_utils import Log...
promptflow/src/promptflow/promptflow/executor/_process_manager.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/executor/_process_manager.py", "repo_id": "promptflow", "token_count": 6562 }
21
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import copy from json import JSONDecodeError from typing import Any, List, Mapping, Optional from promptflow._utils.logger_utils import lo...
promptflow/src/promptflow/promptflow/executor/flow_validator.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/executor/flow_validator.py", "repo_id": "promptflow", "token_count": 9197 }
22
# Frequency asked questions (FAQ) ## Troubleshooting ## ### Token expired when run pfazure cmd If hit error "AADSTS700082: The refresh token has expired due to inactivity." when running pfazure cmd, it's caused by local cached token expired. Please clear the cached token under "%LOCALAPPDATA%/.IdentityService/msal.c...
promptflow/docs/cloud/azureai/faq.md/0
{ "file_path": "promptflow/docs/cloud/azureai/faq.md", "repo_id": "promptflow", "token_count": 108 }
0
# Add conditional control to a flow :::{admonition} Experimental feature This is an experimental feature, and may change at any time. Learn [more](faq.md#stable-vs-experimental). ::: In prompt flow, we support control logic by activate config, like if-else, switch. Activate config enables conditional execution of nod...
promptflow/docs/how-to-guides/add-conditional-control-to-a-flow.md/0
{ "file_path": "promptflow/docs/how-to-guides/add-conditional-control-to-a-flow.md", "repo_id": "promptflow", "token_count": 1231 }
1
# Create and Use Your Own Custom Strong Type Connection Connections provide a secure method for managing credentials for external APIs and data sources in prompt flow. This guide explains how to create and use a custom strong type connection. ## What is a Custom Strong Type Connection? A custom strong type connection ...
promptflow/docs/how-to-guides/develop-a-tool/create-your-own-custom-strong-type-connection.md/0
{ "file_path": "promptflow/docs/how-to-guides/develop-a-tool/create-your-own-custom-strong-type-connection.md", "repo_id": "promptflow", "token_count": 1583 }
2
# Tune prompts using variants :::{admonition} Experimental feature This is an experimental feature, and may change at any time. Learn [more](faq.md#stable-vs-experimental). ::: To better understand this part, please read [Quick start](./quick-start.md) and [Run and evaluate a flow](./run-and-evaluate-a-flow/index.md)...
promptflow/docs/how-to-guides/tune-prompts-with-variants.md/0
{ "file_path": "promptflow/docs/how-to-guides/tune-prompts-with-variants.md", "repo_id": "promptflow", "token_count": 1456 }
3
# Open Model LLM ## Introduction The Open Model LLM tool enables the utilization of a variety of Open Model and Foundational Models, such as [Falcon](https://ml.azure.com/models/tiiuae-falcon-7b/version/4/catalog/registry/azureml) and [Llama 2](https://ml.azure.com/models/Llama-2-7b-chat/version/14/catalog/registry/a...
promptflow/docs/reference/tools-reference/open_model_llm_tool.md/0
{ "file_path": "promptflow/docs/reference/tools-reference/open_model_llm_tool.md", "repo_id": "promptflow", "token_count": 1634 }
4
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...
promptflow/src/promptflow-tools/promptflow/tools/aoai_gpt4v.py/0
{ "file_path": "promptflow/src/promptflow-tools/promptflow/tools/aoai_gpt4v.py", "repo_id": "promptflow", "token_count": 3075 }
5
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: ...
promptflow/src/promptflow-tools/promptflow/tools/yamls/serpapi.yaml/0
{ "file_path": "promptflow/src/promptflow-tools/promptflow/tools/yamls/serpapi.yaml", "repo_id": "promptflow", "token_count": 302 }
6
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- # pylint: disable=wrong-import-position import json import time from promptflow._cli._pf.help import show_privacy_statement, show_welcome_m...
promptflow/src/promptflow/promptflow/_cli/_pf_azure/entry.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_cli/_pf_azure/entry.py", "repo_id": "promptflow", "token_count": 2094 }
7
{"groundtruth": "App", "prediction": "App"}
promptflow/src/promptflow/promptflow/_cli/data/evaluation_flow/data.jsonl/0
{ "file_path": "promptflow/src/promptflow/promptflow/_cli/data/evaluation_flow/data.jsonl", "repo_id": "promptflow", "token_count": 15 }
8
from traceback import TracebackException from promptflow._utils.exception_utils import ( ADDITIONAL_INFO_USER_EXECUTION_ERROR, is_pf_core_frame, last_frame_info, remove_suffix, ) from promptflow.exceptions import ErrorTarget, SystemErrorException, UserErrorException, ValidationException class Unexpec...
promptflow/src/promptflow/promptflow/_core/_errors.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_core/_errors.py", "repo_id": "promptflow", "token_count": 1699 }
9
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- __path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore # flake8: noqa """Put some imports here for internal pack...
promptflow/src/promptflow/promptflow/_internal/__init__.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_internal/__init__.py", "repo_id": "promptflow", "token_count": 1330 }
10
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import os from os import PathLike from pathlib import Path from typing import Any, Dict, List, Union from .._utils.logger_utils import get_...
promptflow/src/promptflow/promptflow/_sdk/_pf_client.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/_pf_client.py", "repo_id": "promptflow", "token_count": 4254 }
11
{ "swagger": "2.0", "basePath": "/v1.0", "paths": { "/Connections/": { "get": { "responses": { "403": { "description": "This service is available for local user only, please specify X-Remote-User in headers." ...
promptflow/src/promptflow/promptflow/_sdk/_service/swagger.json/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/_service/swagger.json", "repo_id": "promptflow", "token_count": 16309 }
12
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import contextlib import functools import threading import uuid from contextvars import ContextVar from datetime import datetime from typing...
promptflow/src/promptflow/promptflow/_sdk/_telemetry/activity.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/_telemetry/activity.py", "repo_id": "promptflow", "token_count": 3256 }
13
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 - ... - Dockerfile: the dockerfile to build the image - settings.json: a json file to...
promptflow/src/promptflow/promptflow/_sdk/data/docker_csharp/README.md/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/data/docker_csharp/README.md", "repo_id": "promptflow", "token_count": 165 }
14
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import copy import datetime import json import shutil import uuid from os import PathLike from pathlib import Path from typing import Any, D...
promptflow/src/promptflow/promptflow/_sdk/entities/_experiment.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/entities/_experiment.py", "repo_id": "promptflow", "token_count": 6671 }
15
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import copy import os.path import sys import time from dataclasses import asdict from typing import Any, Dict, List, Optional, Union from ...
promptflow/src/promptflow/promptflow/_sdk/operations/_run_operations.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/operations/_run_operations.py", "repo_id": "promptflow", "token_count": 7472 }
16
# --------------------------------------------------------- # 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 }
17
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import importlib import inspect import logging import re from enum import Enum, EnumMeta from typing import Any, Callable, Dict, List, Unio...
promptflow/src/promptflow/promptflow/_utils/tool_utils.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_utils/tool_utils.py", "repo_id": "promptflow", "token_count": 7341 }
18
# coding=utf-8 # -------------------------------------------------------------------------- # Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.9.2, 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_runtimes_workspace_independent_operations.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/azure/_restclient/flow/aio/operations/_flow_runtimes_workspace_independent_operations.py", "repo_id": "promptflow", "token_count": 1237 }
19
# coding=utf-8 # -------------------------------------------------------------------------- # Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.9.2, 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_runtimes_operations.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/azure/_restclient/flow/operations/_flow_runtimes_operations.py", "repo_id": "promptflow", "token_count": 17964 }
20
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import jwt from promptflow.exceptions import ValidationException def is_arm_id(obj) -> bool: return isinstance(obj, str) and obj.star...
promptflow/src/promptflow/promptflow/azure/_utils/gerneral.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/azure/_utils/gerneral.py", "repo_id": "promptflow", "token_count": 783 }
21
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import socket import subprocess import uuid from pathlib import Path from typing import Optional from promptflow._core._errors import Unexp...
promptflow/src/promptflow/promptflow/batch/_csharp_executor_proxy.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/batch/_csharp_executor_proxy.py", "repo_id": "promptflow", "token_count": 2729 }
22
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import inspect import string import traceback from enum import Enum from functools import cached_property from typing import Dict from azur...
promptflow/src/promptflow/promptflow/exceptions.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/exceptions.py", "repo_id": "promptflow", "token_count": 5250 }
23
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import json import os from fastapi import APIRouter from fastapi.responses import PlainTextResponse from promptflow._utils.feature_utils ...
promptflow/src/promptflow/promptflow/executor/_service/apis/common.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/executor/_service/apis/common.py", "repo_id": "promptflow", "token_count": 295 }
24
# --------------------------------------------------------- # 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 }
25
# Contributing to Prompt Flow You can contribute to prompt flow with issues and pull requests (PRs). Simply filing issues for problems you encounter is a great way to contribute. Contributing code is greatly appreciated. ## Reporting Issues We always welcome bug reports, API proposals and overall feedback. Here are a...
promptflow/CONTRIBUTING.md/0
{ "file_path": "promptflow/CONTRIBUTING.md", "repo_id": "promptflow", "token_count": 1394 }
0
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
# 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 }
5
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 }
6
# Prompt flow [![Python package](https://img.shields.io/pypi/v/promptflow)](https://pypi.org/project/promptflow/) [![Python](https://img.shields.io/pypi/pyversions/promptflow.svg?maxAge=2592000)](https://pypi.python.org/pypi/promptflow/) [![PyPI - Downloads](https://img.shields.io/pypi/dm/promptflow)](https://pypi.or...
promptflow/src/promptflow/README.md/0
{ "file_path": "promptflow/src/promptflow/README.md", "repo_id": "promptflow", "token_count": 1489 }
7
import os from promptflow._cli._params import add_param_yes, base_params from promptflow._cli._utils import activate_action, get_cli_sdk_logger from promptflow._utils.utils import prompt_y_n from promptflow.exceptions import UserErrorException logger = get_cli_sdk_logger() UPGRADE_MSG = "Not able to upgrade automati...
promptflow/src/promptflow/promptflow/_cli/_pf/_upgrade.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_cli/_pf/_upgrade.py", "repo_id": "promptflow", "token_count": 2397 }
8
$schema: https://azuremlschemas.azureedge.net/promptflow/latest/OpenAIConnection.schema.json name: {{ connection }} type: open_ai api_key: "<user-input>"
promptflow/src/promptflow/promptflow/_cli/data/chat_flow/template/openai.yaml.jinja2/0
{ "file_path": "promptflow/src/promptflow/promptflow/_cli/data/chat_flow/template/openai.yaml.jinja2", "repo_id": "promptflow", "token_count": 59 }
9
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import copy from contextvars import ContextVar from typing import Dict, Mapping from promptflow._version import VERSION class OperationCo...
promptflow/src/promptflow/promptflow/_core/operation_context.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_core/operation_context.py", "repo_id": "promptflow", "token_count": 3185 }
10
# --------------------------------------------------------- # 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 }
11
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- from flask import Blueprint, current_app as app, request from promptflow._sdk._serving.monitor.flow_monitor import FlowMonitor def is_mon...
promptflow/src/promptflow/promptflow/_sdk/_serving/blueprint/monitor_blueprint.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/_serving/blueprint/monitor_blueprint.py", "repo_id": "promptflow", "token_count": 365 }
12
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import logging from promptflow.contracts.flow import Flow, FlowInputDefinition, FlowOutputDefinition from promptflow.contracts.tool import...
promptflow/src/promptflow/promptflow/_sdk/_serving/swagger.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/_serving/swagger.py", "repo_id": "promptflow", "token_count": 2285 }
13
import json import os import time from copy import copy from pathlib import Path from types import GeneratorType import streamlit as st from PIL import Image from streamlit_quill import st_quill from utils import dict_iter_render_message, parse_image_content, parse_list_from_html, render_single_dict_message from prom...
promptflow/src/promptflow/promptflow/_sdk/data/executable/main.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/data/executable/main.py", "repo_id": "promptflow", "token_count": 4323 }
14
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import abc from typing import Dict, Optional from promptflow._sdk._constants import BASE_PATH_CONTEXT_KEY, CommonYamlFields from promptflow...
promptflow/src/promptflow/promptflow/_sdk/entities/_yaml_translatable.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/entities/_yaml_translatable.py", "repo_id": "promptflow", "token_count": 744 }
15
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import re from marshmallow import ValidationError, fields, validate, validates_schema from promptflow._constants import LANGUAGE_KEY, Flow...
promptflow/src/promptflow/promptflow/_sdk/schemas/_flow.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/schemas/_flow.py", "repo_id": "promptflow", "token_count": 1215 }
16
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import logging import os from pathlib import Path from typing import Any, Dict, List, Tuple, Union from promptflow.exceptions import Error...
promptflow/src/promptflow/promptflow/_utils/load_data.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_utils/load_data.py", "repo_id": "promptflow", "token_count": 2029 }
17
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- class FlowType: STANDARD = "standard" CHAT = "chat" EVALUATION = "evaluate" class FlowJobType: STANDARD = "azureml.promp...
promptflow/src/promptflow/promptflow/azure/_constants/_flow.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/azure/_constants/_flow.py", "repo_id": "promptflow", "token_count": 322 }
18
# coding=utf-8 # -------------------------------------------------------------------------- # Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.9.2, 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/_configuration.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/azure/_restclient/flow/aio/_configuration.py", "repo_id": "promptflow", "token_count": 741 }
19
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import asyncio import concurrent import copy import hashlib import json import os import shutil import sys import time from concurrent.futur...
promptflow/src/promptflow/promptflow/azure/operations/_run_operations.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/azure/operations/_run_operations.py", "repo_id": "promptflow", "token_count": 18051 }
20
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import json import logging import sys from dataclasses import asdict, dataclass from enum import Enum from pathlib import Path from typing ...
promptflow/src/promptflow/promptflow/contracts/flow.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/contracts/flow.py", "repo_id": "promptflow", "token_count": 13269 }
21
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import re from promptflow._core._errors import NotSupported from promptflow.contracts.flow import InputAssignment, InputValueType from pro...
promptflow/src/promptflow/promptflow/executor/_input_assignment_parser.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/executor/_input_assignment_parser.py", "repo_id": "promptflow", "token_count": 2155 }
22
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import copy import inspect import types from dataclasses import dataclass from functools import partial from pathlib import Path from typin...
promptflow/src/promptflow/promptflow/executor/_tool_resolver.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/executor/_tool_resolver.py", "repo_id": "promptflow", "token_count": 8974 }
23
# 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
# Promptflow documentation contribute guidelines This folder contains the source code for [prompt flow documentation site](https://microsoft.github.io/promptflow/). This readme file will not be included in above doc site. It keeps a guide for promptflow documentation contributors. ## Content Below is a table of imp...
promptflow/docs/README.md/0
{ "file_path": "promptflow/docs/README.md", "repo_id": "promptflow", "token_count": 1034 }
1
# Dev Setup ## Set up process - First create a new [conda](https://conda.io/projects/conda/en/latest/user-guide/getting-started.html) environment. Please specify python version as 3.9. `conda create -n <env_name> python=3.9`. - Activate the env you created. - Set environment variable `PYTHONPATH` in your new conda ...
promptflow/docs/dev/dev_setup.md/0
{ "file_path": "promptflow/docs/dev/dev_setup.md", "repo_id": "promptflow", "token_count": 1669 }
2
# Create and Use Tool Package In this document, we will guide you through the process of developing your own tool package, offering detailed steps and advice on how to utilize your creation. The custom tool is the prompt flow tool developed by yourself. If you find it useful, you can follow this guidance to make it a ...
promptflow/docs/how-to-guides/develop-a-tool/create-and-use-tool-package.md/0
{ "file_path": "promptflow/docs/how-to-guides/develop-a-tool/create-and-use-tool-package.md", "repo_id": "promptflow", "token_count": 3697 }
3
# Run and evaluate a flow :::{admonition} Experimental feature This is an experimental feature, and may change at any time. Learn [more](../faq.md#stable-vs-experimental). ::: After you have developed and tested the flow in [init and test a flow](../init-and-test-a-flow.md), this guide will help you learn how to run ...
promptflow/docs/how-to-guides/run-and-evaluate-a-flow/index.md/0
{ "file_path": "promptflow/docs/how-to-guides/run-and-evaluate-a-flow/index.md", "repo_id": "promptflow", "token_count": 2884 }
4
# Embedding ## Introduction OpenAI's embedding models convert text into dense vector representations for various NLP tasks. See the [OpenAI Embeddings API](https://platform.openai.com/docs/api-reference/embeddings) for more information. ## Prerequisite Create OpenAI resources: - **OpenAI** Sign up account [Open...
promptflow/docs/reference/tools-reference/embedding_tool.md/0
{ "file_path": "promptflow/docs/reference/tools-reference/embedding_tool.md", "repo_id": "promptflow", "token_count": 851 }
5
{ "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...
promptflow/src/promptflow-tools/connections.json.example/0
{ "file_path": "promptflow/src/promptflow-tools/connections.json.example", "repo_id": "promptflow", "token_count": 815 }
6
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...
promptflow/src/promptflow-tools/promptflow/tools/yamls/embedding.yaml/0
{ "file_path": "promptflow/src/promptflow-tools/promptflow/tools/yamls/embedding.yaml", "repo_id": "promptflow", "token_count": 403 }
7
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- __path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore from promptflow._core.metric_logger import log_metric # f...
promptflow/src/promptflow/promptflow/__init__.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/__init__.py", "repo_id": "promptflow", "token_count": 214 }
8
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import argparse import json from typing import Dict, List from promptflow._cli._params import ( add_param_archived_only, add_param_...
promptflow/src/promptflow/promptflow/_cli/_pf_azure/_flow.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_cli/_pf_azure/_flow.py", "repo_id": "promptflow", "token_count": 2954 }
9
import os from promptflow import tool from promptflow.connections import CustomConnection {{ function_import }} @tool def {{ tool_function }}( {% for arg in tool_arg_list %} {{ arg.name }}, {% endfor %} connection: CustomConnection) -> str: # set environment variables for key, value in dict(connect...
promptflow/src/promptflow/promptflow/_cli/data/entry_flow/tool.py.jinja2/0
{ "file_path": "promptflow/src/promptflow/promptflow/_cli/data/entry_flow/tool.py.jinja2", "repo_id": "promptflow", "token_count": 192 }
10
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- from promptflow._cli._pf.entry import main # this is a compatibility layer for the old CLI which is used for vscode extension if __name__ ...
promptflow/src/promptflow/promptflow/_cli/pf.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_cli/pf.py", "repo_id": "promptflow", "token_count": 74 }
11
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- """ This file can generate a meta file for the given prompt template or a python file. """ import importlib.util import inspect import json...
promptflow/src/promptflow/promptflow/_core/tool_meta_generator.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_core/tool_meta_generator.py", "repo_id": "promptflow", "token_count": 5685 }
12
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import datetime import json from enum import Enum from typing import Dict, List, Optional, Union from sqlalchemy import TEXT, Boolean, Col...
promptflow/src/promptflow/promptflow/_sdk/_orm/run_info.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/_orm/run_info.py", "repo_id": "promptflow", "token_count": 3138 }
13
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import argparse import json import logging import os import platform import subprocess import sys import waitress from promptflow._cli._ut...
promptflow/src/promptflow/promptflow/_sdk/_service/entry.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/_service/entry.py", "repo_id": "promptflow", "token_count": 2461 }
14
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- from enum import Enum from promptflow._sdk._serving.extension.default_extension import AppExtension class ExtensionType(Enum): """Ext...
promptflow/src/promptflow/promptflow/_sdk/_serving/extension/extension_factory.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/_serving/extension/extension_factory.py", "repo_id": "promptflow", "token_count": 445 }
15
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- # this file is a middle layer between the local SDK and executor. import contextlib import logging from pathlib import Path from types impor...
promptflow/src/promptflow/promptflow/_sdk/_submitter/test_submitter.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/_submitter/test_submitter.py", "repo_id": "promptflow", "token_count": 11239 }
16
#! /bin/bash CONDA_ENV_PATH="$(conda info --base)/envs/{{env.conda_env_name}}" export PATH="$CONDA_ENV_PATH/bin:$PATH" {% if connection_yaml_paths %} {% if show_comment %} # hack: for some unknown reason, without this ls, the connection creation will be failed {% endif %} ls ls /connections {% endif %} {% for connect...
promptflow/src/promptflow/promptflow/_sdk/data/docker/runit/promptflow-serve/run.jinja2/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/data/docker/runit/promptflow-serve/run.jinja2", "repo_id": "promptflow", "token_count": 230 }
17
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- # isort: skip_file # skip to avoid circular import __path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore from ._...
promptflow/src/promptflow/promptflow/_sdk/entities/__init__.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/entities/__init__.py", "repo_id": "promptflow", "token_count": 372 }
18
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import contextlib import glob import json import os import subprocess import sys import uuid from importlib.metadata import version from os ...
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": 14515 }
19
from promptflow.exceptions import SystemErrorException, UserErrorException, ValidationException class InvalidImageInput(ValidationException): pass class LoadMultimediaDataError(UserErrorException): pass class YamlParseError(SystemErrorException): """Exception raised when yaml parse failed.""" pas...
promptflow/src/promptflow/promptflow/_utils/_errors.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_utils/_errors.py", "repo_id": "promptflow", "token_count": 85 }
20
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import time from functools import wraps from typing import Tuple, Type, Union from requests import Response from promptflow._utils.logger...
promptflow/src/promptflow/promptflow/_utils/retry_utils.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_utils/retry_utils.py", "repo_id": "promptflow", "token_count": 1424 }
21
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- """ This file stores functions and objects that will be used in prompt-flow sdk. DO NOT change the module names in "all" list, add new modu...
promptflow/src/promptflow/promptflow/azure/_ml/__init__.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/azure/_ml/__init__.py", "repo_id": "promptflow", "token_count": 593 }
22
# coding=utf-8 # -------------------------------------------------------------------------- # Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.9.2, 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/_connections_operations.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/azure/_restclient/flow/aio/operations/_connections_operations.py", "repo_id": "promptflow", "token_count": 9090 }
23
# coding=utf-8 # -------------------------------------------------------------------------- # Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.9.2, 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/_connection_operations.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/azure/_restclient/flow/operations/_connection_operations.py", "repo_id": "promptflow", "token_count": 10177 }
24
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import json from pathlib import Path from azure.ai.ml._schema import UnionField, YamlFileSchema from azure.ai.ml._schema.core.fields import...
promptflow/src/promptflow/promptflow/azure/_schemas/_flow_schema.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/azure/_schemas/_flow_schema.py", "repo_id": "promptflow", "token_count": 684 }
25
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import asyncio import signal import threading import uuid from datetime import datetime from pathlib import Path from typing import Any, Di...
promptflow/src/promptflow/promptflow/batch/_batch_engine.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/batch/_batch_engine.py", "repo_id": "promptflow", "token_count": 8156 }
26
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- from dataclasses import dataclass from enum import Enum from typing import Any, Dict, List, Optional class TraceType(str, Enum): """A...
promptflow/src/promptflow/promptflow/contracts/trace.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/contracts/trace.py", "repo_id": "promptflow", "token_count": 647 }
27
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- __path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore from promptflow._sdk.operations._connection_operations im...
promptflow/src/promptflow/promptflow/operations/__init__.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/operations/__init__.py", "repo_id": "promptflow", "token_count": 133 }
28
# Deploy to Azure App Service [Azure App Service](https://learn.microsoft.com/azure/app-service/) is an HTTP-based service for hosting web applications, REST APIs, and mobile back ends. The scripts (`deploy.sh` for bash and `deploy.ps1` for powershell) under [this folder](https://github.com/microsoft/promptflow/tree/m...
promptflow/docs/cloud/azureai/deploy-to-azure-appservice.md/0
{ "file_path": "promptflow/docs/cloud/azureai/deploy-to-azure-appservice.md", "repo_id": "promptflow", "token_count": 1049 }
0
# 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 }
1
# 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 }
2
# 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 }
3
# 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 }
4
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...
promptflow/src/promptflow-tools/promptflow/tools/aoai.py/0
{ "file_path": "promptflow/src/promptflow-tools/promptflow/tools/aoai.py", "repo_id": "promptflow", "token_count": 3768 }
5
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...
promptflow/src/promptflow-tools/promptflow/tools/yamls/openai_gpt4v.yaml/0
{ "file_path": "promptflow/src/promptflow-tools/promptflow/tools/yamls/openai_gpt4v.yaml", "repo_id": "promptflow", "token_count": 1040 }
6
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import argparse from promptflow._sdk._constants import PROMPT_FLOW_DIR_NAME, PROMPT_FLOW_RUNS_DIR_NAME, CLIListOutputFormat, FlowType # T...
promptflow/src/promptflow/promptflow/_cli/_params.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_cli/_params.py", "repo_id": "promptflow", "token_count": 4120 }
7
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- from promptflow._cli._utils import get_client_for_cli from promptflow.azure import PFClient def _get_azure_pf_client(subscription_id, reso...
promptflow/src/promptflow/promptflow/_cli/_pf_azure/_utils.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_cli/_pf_azure/_utils.py", "repo_id": "promptflow", "token_count": 165 }
8
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- from typing import List from promptflow import log_metric, tool @tool def aggregate(processed_results: List[str]): """ This tool...
promptflow/src/promptflow/promptflow/_cli/data/evaluation_flow/aggregate.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_cli/data/evaluation_flow/aggregate.py", "repo_id": "promptflow", "token_count": 212 }
9
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import functools import inspect import json import logging import uuid from collections.abc import Iterator from contextvars import Context...
promptflow/src/promptflow/promptflow/_core/tracer.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_core/tracer.py", "repo_id": "promptflow", "token_count": 7614 }
10
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import copy import typing from sqlalchemy import TEXT, Column, Index, text from sqlalchemy.exc import IntegrityError from sqlalchemy.orm i...
promptflow/src/promptflow/promptflow/_sdk/_orm/trace.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/_orm/trace.py", "repo_id": "promptflow", "token_count": 1791 }
11
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- from promptflow._sdk._service.entry import main import sys import win32serviceutil # ServiceFramework and commandline helper import win32s...
promptflow/src/promptflow/promptflow/_sdk/_service/pfsvc.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/_service/pfsvc.py", "repo_id": "promptflow", "token_count": 630 }
12
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- from dataclasses import dataclass from typing import Mapping, Any from promptflow.contracts.run_info import FlowRunInfo from promptflow.con...
promptflow/src/promptflow/promptflow/_sdk/_serving/flow_result.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/_serving/flow_result.py", "repo_id": "promptflow", "token_count": 154 }
13