text
stringlengths
13
1.77M
id
stringlengths
22
127
metadata
dict
__index_level_0__
int64
0
28
# 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.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/azure/_restclient/flow/models/_models.py", "repo_id": "promptflow", "token_count": 686164 }
19
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- """service_caller.py, module for interacting with the AzureML service.""" import json import os import sys import time import uuid from func...
promptflow/src/promptflow/promptflow/azure/_restclient/flow_service_caller.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/azure/_restclient/flow_service_caller.py", "repo_id": "promptflow", "token_count": 11631 }
20
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- from typing import Dict from azure.ai.ml._scope_dependent_operations import OperationConfig, OperationScope, _ScopeDependentOperations fr...
promptflow/src/promptflow/promptflow/azure/operations/_trace_operations.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/azure/operations/_trace_operations.py", "repo_id": "promptflow", "token_count": 617 }
21
import base64 import filetype import hashlib from typing import Callable, Optional class PFBytes(bytes): """This class is used to represent a bytes object in PromptFlow. It has all the functionalities of a bytes object, and also has some additional methods to help with serialization and deserialization. ...
promptflow/src/promptflow/promptflow/contracts/multimedia.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/contracts/multimedia.py", "repo_id": "promptflow", "token_count": 977 }
22
import contextvars import multiprocessing import os import queue import signal import sys import threading import time from datetime import datetime from functools import partial from logging import INFO from multiprocessing import Manager, Queue from multiprocessing.pool import ThreadPool from typing import List, Opti...
promptflow/src/promptflow/promptflow/executor/_line_execution_process_pool.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/executor/_line_execution_process_pool.py", "repo_id": "promptflow", "token_count": 14805 }
23
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import asyncio import contextlib import copy import functools import inspect import os import uuid from pathlib import Path from threading ...
promptflow/src/promptflow/promptflow/executor/flow_executor.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/executor/flow_executor.py", "repo_id": "promptflow", "token_count": 22729 }
24
# 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
# Cloud Prompt flow streamlines the process of developing AI applications based on LLM, easing prompt engineering, prototyping, evaluating, and fine-tuning for high-quality products. Transitioning to production, however, typically requires a comprehensive **LLMOps** process, LLMOps is short for large language model o...
promptflow/docs/cloud/index.md/0
{ "file_path": "promptflow/docs/cloud/index.md", "repo_id": "promptflow", "token_count": 722 }
1
# Develop chat 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 chat flow by writing a flow yaml from scratch. You can find additional information about flow ya...
promptflow/docs/how-to-guides/develop-a-flow/develop-chat-flow.md/0
{ "file_path": "promptflow/docs/how-to-guides/develop-a-flow/develop-chat-flow.md", "repo_id": "promptflow", "token_count": 954 }
2
# Frequency asked questions (FAQ) ## General ## ### Stable vs experimental Prompt flow provides both stable and experimental features in the same SDK. |Feature status | Description | |----------------|----------------| Stable features | **Production ready** <br/><br/> These features are recommended for most use ca...
promptflow/docs/how-to-guides/faq.md/0
{ "file_path": "promptflow/docs/how-to-guides/faq.md", "repo_id": "promptflow", "token_count": 2390 }
3
# Reference **Current stable version:** - [promptflow](https://pypi.org/project/promptflow): [![PyPI version](https://badge.fury.io/py/promptflow.svg)](https://badge.fury.io/py/promptflow) [![PyPI - Downloads](https://img.shields.io/pypi/dm/promptflow)](https://pypi.org/project/promptflow/) - [promptflow-tools](https...
promptflow/docs/reference/index.md/0
{ "file_path": "promptflow/docs/reference/index.md", "repo_id": "promptflow", "token_count": 535 }
4
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...
promptflow/src/promptflow-tools/promptflow/tools/open_model_llm.py/0
{ "file_path": "promptflow/src/promptflow-tools/promptflow/tools/open_model_llm.py", "repo_id": "promptflow", "token_count": 23948 }
5
include promptflow/azure/resources/* include promptflow/_sdk/_serving/static/* include promptflow/_sdk/_service/templates/* recursive-include promptflow/_cli/data * recursive-include promptflow/_sdk/data *
promptflow/src/promptflow/MANIFEST.in/0
{ "file_path": "promptflow/src/promptflow/MANIFEST.in", "repo_id": "promptflow", "token_count": 60 }
6
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import argparse import json from typing import Callable, Dict, List, Optional, Tuple from promptflow._cli._params import ( add_param_a...
promptflow/src/promptflow/promptflow/_cli/_pf/_run.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_cli/_pf/_run.py", "repo_id": "promptflow", "token_count": 8431 }
7
$schema: https://azuremlschemas.azureedge.net/promptflow/latest/AzureOpenAIConnection.schema.json name: {{ connection }} type: azure_open_ai api_key: "<user-input>" api_base: "<user-input>" api_type: "azure"
promptflow/src/promptflow/promptflow/_cli/data/chat_flow/template/azure_openai.yaml.jinja2/0
{ "file_path": "promptflow/src/promptflow/promptflow/_cli/data/chat_flow/template/azure_openai.yaml.jinja2", "repo_id": "promptflow", "token_count": 83 }
8
{% if icon %} from pathlib import Path {% endif %} from promptflow import tool from promptflow.connections import CustomConnection @tool( name="{{ tool_name }}", description="This is {{ tool_name }} tool", {% if icon %} icon={{ icon }}, {% endif %} {% for key, value in extra_info.items() %} {{ key }}...
promptflow/src/promptflow/promptflow/_cli/data/package_tool/tool.py.jinja2/0
{ "file_path": "promptflow/src/promptflow/promptflow/_cli/data/package_tool/tool.py.jinja2", "repo_id": "promptflow", "token_count": 241 }
9
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import inspect from typing import Callable class MetricLoggerManager: _instance = None def __init__(self): self._metric_...
promptflow/src/promptflow/promptflow/_core/metric_logger.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_core/metric_logger.py", "repo_id": "promptflow", "token_count": 838 }
10
# flake8: noqa """Put some imports here for mlflow promptflow flavor usage. DO NOT change the module names in "all" list. If the interface has changed in source code, wrap it here and keep original function/module names the same as before, otherwise mldesigner will be broken by this change. """ from promptflow._sdk._...
promptflow/src/promptflow/promptflow/_sdk/_mlflow.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/_mlflow.py", "repo_id": "promptflow", "token_count": 236 }
11
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- # this file is different from other files in this folder # functions (APIs) defined in this file follows OTLP 1.1.0 # https://opentelemetry...
promptflow/src/promptflow/promptflow/_sdk/_service/apis/collector.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/_service/apis/collector.py", "repo_id": "promptflow", "token_count": 729 }
12
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import json import logging import mimetypes import os from pathlib import Path from typing import Dict from flask import Flask, g, jsonify...
promptflow/src/promptflow/promptflow/_sdk/_serving/app.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/_serving/app.py", "repo_id": "promptflow", "token_count": 3515 }
13
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Local Server Test App</title> <style> html, body { height: 100%; width: 100%; box-sizing: border-box; padding: 0;...
promptflow/src/promptflow/promptflow/_sdk/_serving/static/index.html/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/_serving/static/index.html", "repo_id": "promptflow", "token_count": 357 }
14
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- """ This file code has been vendored from azure-ai-ml repo. Please do not edit it, unless really necessary """ # region Diff-imports import...
promptflow/src/promptflow/promptflow/_sdk/_vendor/_asset_utils.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/_vendor/_asset_utils.py", "repo_id": "promptflow", "token_count": 2954 }
15
# -*- mode: python ; coding: utf-8 -*- from PyInstaller.utils.hooks import collect_data_files from PyInstaller.utils.hooks import copy_metadata datas = [('connections', 'connections'), ('flow', 'flow'), ('settings.json', '.'), ('main.py', '.'), ('utils.py', '.'), ('logo.png', '.'), ('{{runtime_interpreter_path}}', './...
promptflow/src/promptflow/promptflow/_sdk/data/executable/app.spec.jinja2/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/data/executable/app.spec.jinja2", "repo_id": "promptflow", "token_count": 575 }
16
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- # pylint: disable=protected-access import copy import json import os.path import typing from pathlib import Path from typing import Dict, ...
promptflow/src/promptflow/promptflow/_sdk/entities/_validation/core.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/entities/_validation/core.py", "repo_id": "promptflow", "token_count": 9020 }
17
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- from marshmallow import fields, post_load, pre_load from promptflow._sdk._constants import ExperimentNodeType from promptflow._sdk.schemas....
promptflow/src/promptflow/promptflow/_sdk/schemas/_experiment.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/schemas/_experiment.py", "repo_id": "promptflow", "token_count": 1860 }
18
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import hashlib import os from os import PathLike from pathlib import Path from typing import Union from promptflow._sdk._constants import D...
promptflow/src/promptflow/promptflow/_utils/flow_utils.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_utils/flow_utils.py", "repo_id": "promptflow", "token_count": 949 }
19
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- __path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore from ._component import COMMAND_COMPONENT_SPEC_TEMPLATE, ...
promptflow/src/promptflow/promptflow/azure/_constants/__init__.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/azure/_constants/__init__.py", "repo_id": "promptflow", "token_count": 138 }
20
# 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/_trace_sessions_operations.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/azure/_restclient/flow/aio/operations/_trace_sessions_operations.py", "repo_id": "promptflow", "token_count": 2814 }
21
# 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/_tools_operations.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/azure/_restclient/flow/operations/_tools_operations.py", "repo_id": "promptflow", "token_count": 13696 }
22
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import os from collections import defaultdict from functools import cached_property from multiprocessing import Lock from pathlib import Pat...
promptflow/src/promptflow/promptflow/azure/operations/_fileshare_storeage_helper.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/azure/operations/_fileshare_storeage_helper.py", "repo_id": "promptflow", "token_count": 4252 }
23
from promptflow.exceptions import UserErrorException class FailedToImportModule(UserErrorException): pass class FlowDefinitionError(UserErrorException): pass
promptflow/src/promptflow/promptflow/contracts/_errors.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/contracts/_errors.py", "repo_id": "promptflow", "token_count": 44 }
24
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- from jinja2 import TemplateSyntaxError from promptflow._utils.exception_utils import ExceptionPresenter, infer_error_code_from_class, remo...
promptflow/src/promptflow/promptflow/executor/_errors.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/executor/_errors.py", "repo_id": "promptflow", "token_count": 2722 }
25
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import json import os from promptflow._core.connection_manager import ConnectionManager from promptflow._utils.exception_utils import Erro...
promptflow/src/promptflow/promptflow/executor/_service/utils/service_utils.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/executor/_service/utils/service_utils.py", "repo_id": "promptflow", "token_count": 392 }
26
# Use flow in Azure ML pipeline job After you have developed and tested the flow in [init and test a flow](../../how-to-guides/init-and-test-a-flow.md), this guide will help you learn how to use a flow as a parallel component in a pipeline job on AzureML, so that you can integrate the created flow with existing pipeli...
promptflow/docs/cloud/azureai/use-flow-in-azure-ml-pipeline.md/0
{ "file_path": "promptflow/docs/cloud/azureai/use-flow-in-azure-ml-pipeline.md", "repo_id": "promptflow", "token_count": 1931 }
0
# Deploy a flow A flow can be deployed to multiple platforms, such as a local development service, Docker container, Kubernetes cluster, etc. ```{gallery-grid} :grid-columns: 1 2 2 3 - image: ../../media/how-to-guides/local.png content: "<center><b>Development server</b></center>" website: deploy-using-dev-server....
promptflow/docs/how-to-guides/deploy-a-flow/index.md/0
{ "file_path": "promptflow/docs/how-to-guides/deploy-a-flow/index.md", "repo_id": "promptflow", "token_count": 397 }
1
# Execute flow as a function :::{admonition} Experimental feature This is an experimental feature, and may change at any time. Learn [more](faq.md#stable-vs-experimental). ::: ## Overview Promptflow allows you to load a flow and use it as a function in your code. This feature is useful when building a service on top...
promptflow/docs/how-to-guides/execute-flow-as-a-function.md/0
{ "file_path": "promptflow/docs/how-to-guides/execute-flow-as-a-function.md", "repo_id": "promptflow", "token_count": 1125 }
2
# Custom Tools This section contains documentation for custom tools created by the community to extend Prompt flow's capabilities for specific use cases. These tools are developed following the guide on [Creating and Using Tool Packages](../../how-to-guides/develop-a-tool/create-and-use-tool-package.md). They are not...
promptflow/docs/integrations/tools/index.md/0
{ "file_path": "promptflow/docs/integrations/tools/index.md", "repo_id": "promptflow", "token_count": 287 }
3
# Vector DB Lookup Vector DB Lookup is a vector search tool that allows users to search top k similar vectors from vector database. This tool is a wrapper for multiple third-party vector databases. The list of current supported databases is as follows. | Name | Description | | --- | --- | | Azure Cognitive Search | M...
promptflow/docs/reference/tools-reference/vector_db_lookup_tool.md/0
{ "file_path": "promptflow/docs/reference/tools-reference/vector_db_lookup_tool.md", "repo_id": "promptflow", "token_count": 2697 }
4
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():...
promptflow/src/promptflow-tools/promptflow/tools/list.py/0
{ "file_path": "promptflow/src/promptflow-tools/promptflow/tools/list.py", "repo_id": "promptflow", "token_count": 233 }
5
# Release History ## 1.6.0 (TBD) ### Features Added - [SDK/CLI] Support configuring environment variable to directly use `AzureCliCredential` for `pfazure` commands. ```dotenv PF_USE_AZURE_CLI_CREDENTIAL=true ``` ## 1.5.0 (2024.02.06) ### Features Added - [SDK/CLI][azure] Support specify compute instance a...
promptflow/src/promptflow/CHANGELOG.md/0
{ "file_path": "promptflow/src/promptflow/CHANGELOG.md", "repo_id": "promptflow", "token_count": 3539 }
6
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import inspect import json import shutil from abc import ABC, abstractmethod from ast import literal_eval from enum import Enum from pathli...
promptflow/src/promptflow/promptflow/_cli/_pf/_init_entry_generators.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_cli/_pf/_init_entry_generators.py", "repo_id": "promptflow", "token_count": 6363 }
7
system: You are a helpful assistant. {% for item in chat_history %} user: {{item.inputs.question}} assistant: {{item.outputs.answer}} {% endfor %} user: {{question}}
promptflow/src/promptflow/promptflow/_cli/data/chat_flow/flow_files/chat.jinja2/0
{ "file_path": "promptflow/src/promptflow/promptflow/_cli/data/chat_flow/flow_files/chat.jinja2", "repo_id": "promptflow", "token_count": 62 }
8
import yaml from pathlib import Path from setuptools import find_packages, setup from setuptools.command.build import build PACKAGE_NAME = "{{ package_name }}" class ToolMetaCacheBuild(build): def run(self): from promptflow import PFClient pf_client = PFClient() tools = pf_client.tools....
promptflow/src/promptflow/promptflow/_cli/data/package_tool/setup.py.jinja2/0
{ "file_path": "promptflow/src/promptflow/promptflow/_cli/data/package_tool/setup.py.jinja2", "repo_id": "promptflow", "token_count": 556 }
9
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import sys from contextvars import ContextVar from datetime import datetime, timezone from io import StringIO, TextIOBase from typing impor...
promptflow/src/promptflow/promptflow/_core/log_manager.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_core/log_manager.py", "repo_id": "promptflow", "token_count": 2523 }
10
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- from os import PathLike from pathlib import Path from typing import IO, AnyStr, Optional, Union from dotenv import dotenv_values from .._u...
promptflow/src/promptflow/promptflow/_sdk/_load_functions.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/_load_functions.py", "repo_id": "promptflow", "token_count": 2496 }
11
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- from promptflow.exceptions import ErrorTarget, UserErrorException class BadRequest(UserErrorException): pass class JsonPayloadRequi...
promptflow/src/promptflow/promptflow/_sdk/_serving/_errors.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/_serving/_errors.py", "repo_id": "promptflow", "token_count": 664 }
12
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import json import time from types import GeneratorType from flask import Response, jsonify from werkzeug.datastructures import MIMEAccept...
promptflow/src/promptflow/promptflow/_sdk/_serving/response_creator.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/_serving/response_creator.py", "repo_id": "promptflow", "token_count": 1814 }
13
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- from ._asset_utils import IgnoreFile, get_ignore_file, get_upload_files_from_folder __all__ = ["get_ignore_file", "IgnoreFile", "get_uploa...
promptflow/src/promptflow/promptflow/_sdk/_vendor/__init__.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/_vendor/__init__.py", "repo_id": "promptflow", "token_count": 79 }
14
import os import sys from promptflow._cli._pf._connection import create_connection from streamlit.web import cli as st_cli from streamlit.runtime import exists from main import start def is_yaml_file(file_path): # Get the file extension _, file_extension = os.path.splitext(file_path) # Check if the file...
promptflow/src/promptflow/promptflow/_sdk/data/executable/app.py.jinja2/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/data/executable/app.py.jinja2", "repo_id": "promptflow", "token_count": 435 }
15
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- from .core import MutableValidationResult, ValidationResult, ValidationResultBuilder from .schema import SchemaValidatableMixin __all__ =...
promptflow/src/promptflow/promptflow/_sdk/entities/_validation/__init__.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/entities/_validation/__init__.py", "repo_id": "promptflow", "token_count": 106 }
16
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import copy from marshmallow import ValidationError, fields, pre_dump, validates from promptflow._sdk._constants import ( SCHEMA_KEYS_...
promptflow/src/promptflow/promptflow/_sdk/schemas/_connection.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/schemas/_connection.py", "repo_id": "promptflow", "token_count": 1953 }
17
from dataclasses import dataclass from enum import Enum from typing import Optional class FeatureState(Enum): """The enum of feature state. READY: The feature is ready to use. E2ETEST: The feature is not ready to be shipped to customer and is in e2e testing. """ READY = "Ready" E2ETEST = "E2...
promptflow/src/promptflow/promptflow/_utils/feature_utils.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_utils/feature_utils.py", "repo_id": "promptflow", "token_count": 607 }
18
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- __path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore from ._pf_client import PFClient __all__ = ["PFClient"]
promptflow/src/promptflow/promptflow/azure/__init__.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/azure/__init__.py", "repo_id": "promptflow", "token_count": 75 }
19
# -------------------------------------------------------------------------- # 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/_vendor.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/azure/_restclient/flow/_vendor.py", "repo_id": "promptflow", "token_count": 365 }
20
# 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/_tools_operations.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/azure/_restclient/flow/aio/operations/_tools_operations.py", "repo_id": "promptflow", "token_count": 8893 }
21
# 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/_flows_provider_operations.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/azure/_restclient/flow/operations/_flows_provider_operations.py", "repo_id": "promptflow", "token_count": 3934 }
22
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- from typing import Dict from azure.ai.ml._scope_dependent_operations import ( OperationConfig, OperationsContainer, OperationSc...
promptflow/src/promptflow/promptflow/azure/operations/_connection_operations.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/azure/operations/_connection_operations.py", "repo_id": "promptflow", "token_count": 1476 }
23
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 }
24
# Manage flows :::{admonition} Experimental feature This is an experimental feature, and may change at any time. Learn [more](../../how-to-guides/faq.md#stable-vs-experimental). ::: This documentation will walk you through how to manage your flow with CLI and SDK on [Azure AI](https://learn.microsoft.com/en-us/azure/...
promptflow/docs/cloud/azureai/manage-flows.md/0
{ "file_path": "promptflow/docs/cloud/azureai/manage-flows.md", "repo_id": "promptflow", "token_count": 1308 }
0
# Deploy a flow using development server :::{admonition} Experimental feature This is an experimental feature, and may change at any time. Learn [more](../faq.md#stable-vs-experimental). ::: Once you have created and thoroughly tested a flow, you can use it as an HTTP endpoint. ::::{tab-set} :::{tab-item} CLI :sync: ...
promptflow/docs/how-to-guides/deploy-a-flow/deploy-using-dev-server.md/0
{ "file_path": "promptflow/docs/how-to-guides/deploy-a-flow/deploy-using-dev-server.md", "repo_id": "promptflow", "token_count": 999 }
1
# Customizing an LLM Tool In this document, we will guide you through the process of customizing an LLM tool, allowing users to seamlessly connect to a large language model with prompt tuning experience using a `PromptTemplate`. ## Prerequisites - Please ensure that your [Prompt flow for VS Code](https://marketplace.v...
promptflow/docs/how-to-guides/develop-a-tool/customize_an_llm_tool.md/0
{ "file_path": "promptflow/docs/how-to-guides/develop-a-tool/customize_an_llm_tool.md", "repo_id": "promptflow", "token_count": 1277 }
2
--- myst: html_meta: "description lang=en": "Prompt flow Doc" "google-site-verification": "rEZN-2h5TVqEco07aaMpqNcDx4bjr2czx1Hwfoxydrg" html_theme.sidebar_secondary.remove: true --- # Prompt flow [**Prompt flow**](https://github.com/microsoft/promptflow) is a suite of development tools designed to streamlin...
promptflow/docs/index.md/0
{ "file_path": "promptflow/docs/index.md", "repo_id": "promptflow", "token_count": 1541 }
3
# OpenAI GPT-4V ## Introduction OpenAI GPT-4V tool enables you to leverage OpenAI's GPT-4 with vision, also referred to as GPT-4V or gpt-4-vision-preview in the API, to take images as input and answer questions about them. ## Prerequisites - Create OpenAI resources Sign up account [OpenAI website](https://opena...
promptflow/docs/reference/tools-reference/openai-gpt-4v-tool.md/0
{ "file_path": "promptflow/docs/reference/tools-reference/openai-gpt-4v-tool.md", "repo_id": "promptflow", "token_count": 1118 }
4
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...
promptflow/src/promptflow-tools/promptflow/tools/azure_content_safety.py/0
{ "file_path": "promptflow/src/promptflow-tools/promptflow/tools/azure_content_safety.py", "repo_id": "promptflow", "token_count": 4937 }
5
import argparse import json from promptflow._cli._params import add_param_set_positional, base_params from promptflow._cli._utils import activate_action, list_of_dict_to_dict from promptflow._sdk._configuration import Configuration, InvalidConfigValue from promptflow._sdk._utils import print_red_error from promptflow....
promptflow/src/promptflow/promptflow/_cli/_pf/_config.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_cli/_pf/_config.py", "repo_id": "promptflow", "token_count": 1038 }
6
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- from promptflow._version import VERSION USER_AGENT = "{}/{}".format("promptflow-cli", VERSION)
promptflow/src/promptflow/promptflow/_cli/_user_agent.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_cli/_user_agent.py", "repo_id": "promptflow", "token_count": 56 }
7
$schema: https://azuremlschemas.azureedge.net/promptflow/latest/Flow.schema.json inputs: groundtruth: type: string prediction: type: string outputs: results: type: string reference: ${line_process.output} nodes: - name: line_process type: python source: type: code path: line_process.py...
promptflow/src/promptflow/promptflow/_cli/data/evaluation_flow/flow.dag.yaml/0
{ "file_path": "promptflow/src/promptflow/promptflow/_cli/data/evaluation_flow/flow.dag.yaml", "repo_id": "promptflow", "token_count": 225 }
8
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import hashlib import json from dataclasses import dataclass from typing import Callable, List from promptflow._utils.logger_utils import ...
promptflow/src/promptflow/promptflow/_core/cache_manager.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_core/cache_manager.py", "repo_id": "promptflow", "token_count": 2075 }
9
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- from os import PathLike from typing import IO, AnyStr, Union from promptflow._sdk._load_functions import load_run from promptflow._sdk._pf_...
promptflow/src/promptflow/promptflow/_sdk/_run_functions.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/_run_functions.py", "repo_id": "promptflow", "token_count": 236 }
10
<!DOCTYPE html> <html> <head> <title>Trace Visualization</title> <style> table, th, td { border: 1px solid black; border-collapse: collapse; } th, td { padding: 5px; text-align: left; } </style> </head> <body> <button onclic...
promptflow/src/promptflow/promptflow/_sdk/_service/templates/ui_traces.html/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/_service/templates/ui_traces.html", "repo_id": "promptflow", "token_count": 1509 }
11
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- class FlowDataCollector: """FlowDataCollector is used to collect flow data via MDC for monitoring.""" def __init__(self, logger):...
promptflow/src/promptflow/promptflow/_sdk/_serving/monitor/data_collector.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/_serving/monitor/data_collector.py", "repo_id": "promptflow", "token_count": 912 }
12
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import logging import os import platform import sys from opencensus.ext.azure.log_exporter import AzureEventHandler from promptflow._sdk._...
promptflow/src/promptflow/promptflow/_sdk/_telemetry/logging_handler.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/_telemetry/logging_handler.py", "repo_id": "promptflow", "token_count": 2042 }
13
#!/bin/bash echo "$(date -uIns) - promptflow-serve/finish $@" echo "$(date -uIns) - Stopped all Gunicorn processes"
promptflow/src/promptflow/promptflow/_sdk/data/docker_csharp/runit/promptflow-serve/finish.jinja2/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/data/docker_csharp/runit/promptflow-serve/finish.jinja2", "repo_id": "promptflow", "token_count": 45 }
14
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import abc import json from os import PathLike from pathlib import Path from typing import Dict, Optional, Tuple, Union from marshmallow i...
promptflow/src/promptflow/promptflow/_sdk/entities/_flow.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/entities/_flow.py", "repo_id": "promptflow", "token_count": 5239 }
15
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import importlib.util import inspect import io import json import logging import pkgutil from dataclasses import asdict from os import PathL...
promptflow/src/promptflow/promptflow/_sdk/operations/_tool_operations.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/operations/_tool_operations.py", "repo_id": "promptflow", "token_count": 10752 }
16
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import re class CredentialScrubber: """Scrub sensitive information in string.""" PLACE_HOLDER = "**data_scrubbed**" LENGTH_T...
promptflow/src/promptflow/promptflow/_utils/credential_scrubber.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_utils/credential_scrubber.py", "repo_id": "promptflow", "token_count": 856 }
17
# --------------------------------------------------------- # 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": 4054 }
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/__init__.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/azure/_restclient/flow/__init__.py", "repo_id": "promptflow", "token_count": 192 }
19
# --------------------------------------------------------- # 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": 1822 }
20
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- __path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore from ._flow_operations import FlowOperations from ._run_...
promptflow/src/promptflow/promptflow/azure/operations/__init__.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/azure/operations/__init__.py", "repo_id": "promptflow", "token_count": 93 }
21
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- from promptflow.exceptions import ErrorTarget, SystemErrorException, UserErrorException, ValidationException class InputMappingError(Vali...
promptflow/src/promptflow/promptflow/batch/_errors.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/batch/_errors.py", "repo_id": "promptflow", "token_count": 161 }
22
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- # flake8: noqa from .flow_executor import FlowExecutor from .flow_validator import FlowValidator
promptflow/src/promptflow/promptflow/executor/__init__.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/executor/__init__.py", "repo_id": "promptflow", "token_count": 54 }
23
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- from fastapi import APIRouter, Request from promptflow._core.operation_context import OperationContext from promptflow.executor._service.c...
promptflow/src/promptflow/promptflow/executor/_service/apis/execution.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/executor/_service/apis/execution.py", "repo_id": "promptflow", "token_count": 819 }
24
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- from functools import partial from pathlib import Path from typing import Union from promptflow._utils.multimedia_utils import _process_re...
promptflow/src/promptflow/promptflow/storage/_run_storage.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/storage/_run_storage.py", "repo_id": "promptflow", "token_count": 2550 }
25
# 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.org...
promptflow/README.md/0
{ "file_path": "promptflow/README.md", "repo_id": "promptflow", "token_count": 2762 }
0
With prompt flow, you can use variants to tune your prompt. In this article, you'll learn the prompt flow variants concept. # Variants A variant refers to a specific version of a tool node that has distinct settings. Currently, variants are supported only in the LLM tool. For example, in the LLM tool, a new variant c...
promptflow/docs/concepts/concept-variants.md/0
{ "file_path": "promptflow/docs/concepts/concept-variants.md", "repo_id": "promptflow", "token_count": 642 }
1
# Referencing external files/folders in a flow Sometimes, pre-existing code assets are essential for the flow reference. In most cases, you can accomplish this by importing a Python package into your flow. However, if a Python package is not available or it is heavy to create a package, you can still reference externa...
promptflow/docs/how-to-guides/develop-a-flow/referencing-external-files-or-folders-in-a-flow.md/0
{ "file_path": "promptflow/docs/how-to-guides/develop-a-flow/referencing-external-files-or-folders-in-a-flow.md", "repo_id": "promptflow", "token_count": 1055 }
2
# Manage runs :::{admonition} Experimental feature This is an experimental feature, and may change at any time. Learn [more](faq.md#stable-vs-experimental). ::: This documentation will walk you through how to manage your runs with CLI, SDK and VS Code Extension. In general: - For `CLI`, you can run `pf/pfazure run -...
promptflow/docs/how-to-guides/manage-runs.md/0
{ "file_path": "promptflow/docs/how-to-guides/manage-runs.md", "repo_id": "promptflow", "token_count": 2998 }
3
# 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: ...
promptflow/src/promptflow-tools/promptflow/tools/template_rendering.py/0
{ "file_path": "promptflow/src/promptflow-tools/promptflow/tools/template_rendering.py", "repo_id": "promptflow", "token_count": 117 }
4
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- from promptflow._sdk._configuration import Configuration # This logic is copied from: https://github.com/microsoft/knack/blob/dev/knack/hel...
promptflow/src/promptflow/promptflow/_cli/_pf/help.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_cli/_pf/help.py", "repo_id": "promptflow", "token_count": 563 }
5
{ "package": {}, "code": { {% for key, prompt_obj in prompt_params.items() %} "{{ key }}": { "type": "prompt", "inputs": { {% for input_name, value in prompt_obj.get("inputs", {}).items() %} "{{ input_name }}": { "type": [ ...
promptflow/src/promptflow/promptflow/_cli/data/entry_flow/flow.tools.json.jinja2/0
{ "file_path": "promptflow/src/promptflow/promptflow/_cli/data/entry_flow/flow.tools.json.jinja2", "repo_id": "promptflow", "token_count": 779 }
6
$schema: https://azuremlschemas.azureedge.net/promptflow/latest/Flow.schema.json inputs: text: type: string outputs: output_prompt: type: string reference: ${echo_my_prompt.output} nodes: - name: hello_prompt type: prompt source: type: code path: hello.jinja2 inputs: text: ${inputs.tex...
promptflow/src/promptflow/promptflow/_cli/data/standard_flow/flow.dag.yaml/0
{ "file_path": "promptflow/src/promptflow/promptflow/_cli/data/standard_flow/flow.dag.yaml", "repo_id": "promptflow", "token_count": 205 }
7
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- from contextvars import ContextVar from typing import Type, TypeVar T = TypeVar("T") class ThreadLocalSingleton: # Use context varia...
promptflow/src/promptflow/promptflow/_core/thread_local_singleton.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_core/thread_local_singleton.py", "repo_id": "promptflow", "token_count": 370 }
8
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- from sqlalchemy import TEXT, Column from sqlalchemy.exc import IntegrityError from sqlalchemy.orm import declarative_base from promptflow._...
promptflow/src/promptflow/promptflow/_sdk/_orm/experiment_node_run.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/_orm/experiment_node_run.py", "repo_id": "promptflow", "token_count": 1544 }
9
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- from flask import jsonify, make_response, request from flask_restx import fields from promptflow._sdk._service import Namespace, Resource f...
promptflow/src/promptflow/promptflow/_sdk/_service/apis/telemetry.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/_service/apis/telemetry.py", "repo_id": "promptflow", "token_count": 3067 }
10
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- from .run_submitter import RunSubmitter from .test_submitter import TestSubmitter from .utils import ( overwrite_connections, overwr...
promptflow/src/promptflow/promptflow/_sdk/_submitter/__init__.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/_submitter/__init__.py", "repo_id": "promptflow", "token_count": 185 }
11
# syntax=docker/dockerfile:1 {% if env.image %} FROM {{env.image}} {% else %} {% if show_comment %} # use mcr.microsoft.com/azureml/openmpi4.1.0-ubuntu20.04:latest? current image is based on Debian 11 {% endif %} FROM docker.io/continuumio/miniconda3:latest {% endif %} WORKDIR / {% if env.python_requirements_txt %} C...
promptflow/src/promptflow/promptflow/_sdk/data/docker/Dockerfile.jinja2/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/data/docker/Dockerfile.jinja2", "repo_id": "promptflow", "token_count": 680 }
12
import base64 import json import re import streamlit as st from bs4 import BeautifulSoup, NavigableString, Tag from promptflow._utils.multimedia_utils import MIME_PATTERN, is_multimedia_dict def show_image(image, key=None): col1, _ = st.columns(2) with col1: if not image.startswith("data:image"): ...
promptflow/src/promptflow/promptflow/_sdk/data/executable/utils.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/data/executable/utils.py", "repo_id": "promptflow", "token_count": 2495 }
13
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- from datetime import datetime from typing import List from promptflow._sdk._constants import MAX_LIST_CLI_RESULTS from promptflow._sdk._orm...
promptflow/src/promptflow/promptflow/_sdk/operations/_connection_operations.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_sdk/operations/_connection_operations.py", "repo_id": "promptflow", "token_count": 1297 }
14
import re from dataclasses import dataclass from enum import Enum from functools import partial from pathlib import Path from typing import Any, Callable from promptflow._utils.multimedia_utils import is_multimedia_dict class ResourceType(Enum): """ Enumeration of different types of multimedia resources. ...
promptflow/src/promptflow/promptflow/_utils/multimedia_data_converter.py/0
{ "file_path": "promptflow/src/promptflow/promptflow/_utils/multimedia_data_converter.py", "repo_id": "promptflow", "token_count": 2299 }
15