text stringlengths 8 1.72M | id stringlengths 22 143 | metadata dict | __index_level_0__ int64 0 104 |
|---|---|---|---|
from promptflow import tool
from typing import List
from promptflow import log_metric
# The inputs section will change based on the arguments of the tool function, after you save the code
# Adding type to arguments and return value will help the system show the types properly
# Please update the function name/signatur... | promptflow/examples/flows/evaluation/eval-entity-match-rate/log_metrics.py/0 | {
"file_path": "promptflow/examples/flows/evaluation/eval-entity-match-rate/log_metrics.py",
"repo_id": "promptflow",
"token_count": 284
} | 11 |
# Q&A Evaluation:
This is a flow evaluating the Q&A RAG (Retrieval Augmented Generation) systems by leveraging the state-of-the-art Large Language Models (LLM) to measure the quality and safety of responses. Utilizing GPT model to assist with measurements aims to achieve a high agreement with human evaluations compare... | promptflow/examples/flows/evaluation/eval-qna-rag-metrics/README.md/0 | {
"file_path": "promptflow/examples/flows/evaluation/eval-qna-rag-metrics/README.md",
"repo_id": "promptflow",
"token_count": 1259
} | 12 |
{"document_path": "./document1.txt", "language": "en"}
{"document_path": "./document2.txt", "language": "en"} | promptflow/examples/flows/integrations/azure-ai-language/analyze_documents/data.jsonl/0 | {
"file_path": "promptflow/examples/flows/integrations/azure-ai-language/analyze_documents/data.jsonl",
"repo_id": "promptflow",
"token_count": 37
} | 13 |
from typing import Union
from promptflow import tool
from promptflow.connections import AzureOpenAIConnection, OpenAIConnection
@tool
def autogpt_easy_start(connection: Union[AzureOpenAIConnection, OpenAIConnection], system_prompt: str, user_prompt: str,
triggering_prompt: str, functions: list... | promptflow/examples/flows/standard/autonomous-agent/autogpt_easy_start.py/0 | {
"file_path": "promptflow/examples/flows/standard/autonomous-agent/autogpt_easy_start.py",
"repo_id": "promptflow",
"token_count": 374
} | 14 |
# Conditional flow for if-else scenario
This example is a conditional flow for if-else scenario.
By following this example, you will learn how to create a conditional flow using the `activate config`.
## Flow description
In this flow, it checks if an input query passes content safety check. If it's denied, we'll re... | promptflow/examples/flows/standard/conditional-flow-for-if-else/README.md/0 | {
"file_path": "promptflow/examples/flows/standard/conditional-flow-for-if-else/README.md",
"repo_id": "promptflow",
"token_count": 522
} | 15 |
from promptflow import tool
@tool
def generate_response(order_search="", product_info="", product_recommendation="") -> str:
default_response = "Sorry, no results matching your search were found."
responses = [order_search, product_info, product_recommendation]
return next((response for response in respon... | promptflow/examples/flows/standard/conditional-flow-for-switch/generate_response.py/0 | {
"file_path": "promptflow/examples/flows/standard/conditional-flow-for-switch/generate_response.py",
"repo_id": "promptflow",
"token_count": 95
} | 16 |
You are given a list of orders with item_numbers from a customer and a statement from the customer. It is your job to identify the intent that the customer has with their statement. Possible intents can be: "product return", "product exchange", "general question", "product question", "other".
In triple backticks below... | promptflow/examples/flows/standard/customer-intent-extraction/user_intent_zero_shot.jinja2/0 | {
"file_path": "promptflow/examples/flows/standard/customer-intent-extraction/user_intent_zero_shot.jinja2",
"repo_id": "promptflow",
"token_count": 180
} | 17 |
$schema: https://azuremlschemas.azureedge.net/promptflow/latest/Flow.schema.json
inputs:
url:
type: string
default: https://www.microsoft.com/en-us/d/xbox-wireless-controller-stellar-shift-special-edition/94fbjc7h0h6h
outputs:
category:
type: string
reference: ${convert_to_dict.output.category}
ev... | promptflow/examples/flows/standard/flow-with-symlinks/flow.dag.yaml/0 | {
"file_path": "promptflow/examples/flows/standard/flow-with-symlinks/flow.dag.yaml",
"repo_id": "promptflow",
"token_count": 1182
} | 18 |
import argparse
from file import File
from diff import show_diff
from load_code_tool import load_code
from promptflow import PFClient
from pathlib import Path
if __name__ == "__main__":
current_folder = Path(__file__).absolute().parent
parser = argparse.ArgumentParser(description="The code path of code that n... | promptflow/examples/flows/standard/gen-docstring/main.py/0 | {
"file_path": "promptflow/examples/flows/standard/gen-docstring/main.py",
"repo_id": "promptflow",
"token_count": 222
} | 19 |
# Named Entity Recognition
A flow that perform named entity recognition task.
[Named Entity Recognition (NER)](https://en.wikipedia.org/wiki/Named-entity_recognition) is a Natural Language Processing (NLP) task. It involves identifying and classifying named entities (such as people, organizations, locations, date exp... | promptflow/examples/flows/standard/named-entity-recognition/README.md/0 | {
"file_path": "promptflow/examples/flows/standard/named-entity-recognition/README.md",
"repo_id": "promptflow",
"token_count": 724
} | 20 |
$schema: https://azuremlschemas.azureedge.net/promptflow/latest/Run.schema.json
flow: .
data: data.jsonl
variant: ${summarize_text_content.variant_1}
column_mapping:
url: ${data.url}
| promptflow/examples/flows/standard/web-classification/run.yml/0 | {
"file_path": "promptflow/examples/flows/standard/web-classification/run.yml",
"repo_id": "promptflow",
"token_count": 77
} | 21 |
from promptflow import tool
from promptflow.connections import CustomStrongTypeConnection
from promptflow.contracts.types import Secret
class MyCustomConnection(CustomStrongTypeConnection):
"""My custom strong type connection.
:param api_key: The api key get from "https://xxx.com".
:type api_key: Secret
... | promptflow/examples/tools/tool-package-quickstart/my_tool_package/tools/tool_with_custom_strong_type_connection.py/0 | {
"file_path": "promptflow/examples/tools/tool-package-quickstart/my_tool_package/tools/tool_with_custom_strong_type_connection.py",
"repo_id": "promptflow",
"token_count": 213
} | 22 |
import pytest
import unittest
from promptflow.connections import CustomConnection
from my_tool_package.tools.my_tool_2 import MyTool
@pytest.fixture
def my_custom_connection() -> CustomConnection:
my_custom_connection = CustomConnection(
{
"api-key" : "my-api-key",
"api-secret" : ... | promptflow/examples/tools/tool-package-quickstart/tests/test_my_tool_2.py/0 | {
"file_path": "promptflow/examples/tools/tool-package-quickstart/tests/test_my_tool_2.py",
"repo_id": "promptflow",
"token_count": 340
} | 23 |
# Basic flow with script tool using custom strong type connection
This is a flow demonstrating the use of a script tool with custom string type connection which provides a secure way to manage credentials for external APIs and data sources, and it offers an improved user-friendly and intellisense experience compared to... | promptflow/examples/tools/use-cases/custom-strong-type-connection-script-tool-showcase/README.md/0 | {
"file_path": "promptflow/examples/tools/use-cases/custom-strong-type-connection-script-tool-showcase/README.md",
"repo_id": "promptflow",
"token_count": 533
} | 24 |
# -*- 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', '.'), ('{{streamlit_runtime_interpreter_path}}', './streamlit/runtime')]
datas +... | promptflow/examples/tutorials/flow-deploy/distribute-flow-as-executable-app/app.spec/0 | {
"file_path": "promptflow/examples/tutorials/flow-deploy/distribute-flow-as-executable-app/app.spec",
"repo_id": "promptflow",
"token_count": 554
} | 25 |
<jupyter_start><jupyter_text>Flow Run Management**Prerequisite** - To make the most of this tutorial, you'll need:- A local clone of the prompt flow repository- A Python environment with Jupyter Notebook support (such as Jupyter Lab or the Python extension for Visual Studio Code)- Know how to program with Python :)_A b... | promptflow/examples/tutorials/run-management/run-management.ipynb/0 | {
"file_path": "promptflow/examples/tutorials/run-management/run-management.ipynb",
"repo_id": "promptflow",
"token_count": 1499
} | 26 |
# -- Path setup --------------------------------------------------------------
import sys
# -- Project information -----------------------------------------------------
project = 'Prompt flow'
copyright = '2023, Microsoft'
author = 'Microsoft'
sys.path.append(".")
from gallery_directive import GalleryDirective # no... | promptflow/scripts/docs/conf.py/0 | {
"file_path": "promptflow/scripts/docs/conf.py",
"repo_id": "promptflow",
"token_count": 1543
} | 27 |
import sys
import multiprocessing
# use this file as the only entry point for the CLI to avoid packaging the same environment repeatedly
if __name__ == "__main__":
multiprocessing.freeze_support()
command = sys.argv[1] if len(sys.argv) > 1 else None
sys.argv = sys.argv[1:]
if command == 'pf':
... | promptflow/scripts/installer/windows/scripts/pfcli.py/0 | {
"file_path": "promptflow/scripts/installer/windows/scripts/pfcli.py",
"repo_id": "promptflow",
"token_count": 359
} | 28 |
# Promptflow examples
[](https://github.com/psf/black)
[](../LICENSE)
## Get started
**Install dependencies**
- Bootstrap your python environment.
- e.g: create a new... | promptflow/scripts/readme/ghactions_driver/readme_templates/README.md.jinja2/0 | {
"file_path": "promptflow/scripts/readme/ghactions_driver/readme_templates/README.md.jinja2",
"repo_id": "promptflow",
"token_count": 2246
} | 29 |
{% extends "workflow_skeleton.yml.jinja2" %}
{% block steps %}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python 3.9 environment
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Generate config.json for canary workspace (sch... | promptflow/scripts/readme/ghactions_driver/workflow_templates/basic_workflow_replace_config_json.yml.jinja2/0 | {
"file_path": "promptflow/scripts/readme/ghactions_driver/workflow_templates/basic_workflow_replace_config_json.yml.jinja2",
"repo_id": "promptflow",
"token_count": 330
} | 30 |
from .secret_exceptions import SecretNameAlreadyExistsException, SecretNameInvalidException, SecretNoSetPermissionException # noqa: F401, E501
| promptflow/scripts/tool/exceptions/__init__.py/0 | {
"file_path": "promptflow/scripts/tool/exceptions/__init__.py",
"repo_id": "promptflow",
"token_count": 36
} | 31 |
{
"stagesToSkip": [],
"resources": {
"repositories": {
"self": {
"refName": "refs/heads/dev-branch"
}
}
},
"templateParameters": {
"deployEndpoint": "True"
},
"variables": {
"model-file": {
"value": "promptflow-g... | promptflow/scripts/tool/utils/configs/deploy-endpoint-request-body.json/0 | {
"file_path": "promptflow/scripts/tool/utils/configs/deploy-endpoint-request-body.json",
"repo_id": "promptflow",
"token_count": 226
} | 32 |
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": 1230
} | 33 |
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
} | 34 |
# system:
## name:
AI
## content:
Don't make assumptions about what values to plug into functions. Ask for clarification if a user request is ambiguous.
# user:
## name:
person
## content:
{{prev_question}}
# assistant:
## name:
John
## content:
{{prev_answer}}
# function:
## name:
{{name}}
## content:
{{result... | promptflow/src/promptflow-tools/tests/test_configs/prompt_templates/prompt_with_name_in_roles.jinja2/0 | {
"file_path": "promptflow/src/promptflow-tools/tests/test_configs/prompt_templates/prompt_with_name_in_roles.jinja2",
"repo_id": "promptflow",
"token_count": 113
} | 35 |
@echo off
setlocal
SET PF_INSTALLER=PIP
IF EXIST "%~dp0\python.exe" (
"%~dp0\python.exe" -m promptflow._cli._pf.entry %*
) ELSE (
python -m promptflow._cli._pf.entry %*
)
| promptflow/src/promptflow/pf.bat/0 | {
"file_path": "promptflow/src/promptflow/pf.bat",
"repo_id": "promptflow",
"token_count": 80
} | 36 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
from pathlib import Path
from dotenv import dotenv_values
from promptflow._cli._params import add_param_connection_name, add_param_env, b... | promptflow/src/promptflow/promptflow/_cli/_pf_azure/_connection.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_cli/_pf_azure/_connection.py",
"repo_id": "promptflow",
"token_count": 1313
} | 37 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
from promptflow import tool
# The inputs section will change based on the arguments of the tool function, after you save the code
# Adding... | promptflow/src/promptflow/promptflow/_cli/data/standard_flow/hello.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_cli/data/standard_flow/hello.py",
"repo_id": "promptflow",
"token_count": 114
} | 38 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import inspect
import logging
from abc import ABC
from dataclasses import InitVar, asdict, dataclass, field
from enum import Enum
from typi... | promptflow/src/promptflow/promptflow/_core/tool.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_core/tool.py",
"repo_id": "promptflow",
"token_count": 3636
} | 39 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import datetime
import os
from contextlib import contextmanager
from pathlib import Path
from typing import List, Union
from filelock impo... | promptflow/src/promptflow/promptflow/_sdk/_orm/session.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_sdk/_orm/session.py",
"repo_id": "promptflow",
"token_count": 3824
} | 40 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import getpass
import socket
from dataclasses import InitVar, dataclass, field
from datetime import datetime
from functools import wraps
im... | promptflow/src/promptflow/promptflow/_sdk/_service/utils/utils.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_sdk/_service/utils/utils.py",
"repo_id": "promptflow",
"token_count": 2118
} | 41 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
from enum import Enum
from typing import Dict, Sequence, Set, List, Any
from promptflow._utils.exception_utils import ErrorResponse
from p... | promptflow/src/promptflow/promptflow/_sdk/_serving/monitor/metrics.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_sdk/_serving/monitor/metrics.py",
"repo_id": "promptflow",
"token_count": 6645
} | 42 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
from promptflow._version import VERSION
USER_AGENT = "{}/{}".format("promptflow-sdk", VERSION)
| promptflow/src/promptflow/promptflow/_sdk/_user_agent.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_sdk/_user_agent.py",
"repo_id": "promptflow",
"token_count": 57
} | 43 |
#!/bin/bash
# stop services created by runsv and propagate SIGINT, SIGTERM to child jobs
sv_stop() {
echo "$(date -uIns) - Stopping all runsv services"
for s in $(ls -d /var/runit/*); do
sv stop $s
done
}
# register SIGINT, SIGTERM handler
trap sv_stop SIGINT SIGTERM
# start services in backgroun... | promptflow/src/promptflow/promptflow/_sdk/data/docker_csharp/start.sh.jinja2/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_sdk/data/docker_csharp/start.sh.jinja2",
"repo_id": "promptflow",
"token_count": 135
} | 44 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
from os import PathLike
from typing import Union
# TODO(2528165): remove this file when we deprecate Flow.run_bulk
class BaseInputs(obje... | promptflow/src/promptflow/promptflow/_sdk/entities/_run_inputs.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_sdk/entities/_run_inputs.py",
"repo_id": "promptflow",
"token_count": 771
} | 45 |
# ---------------------------------------------------------
# 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
} | 46 |
# ---------------------------------------------------------
# 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
} | 47 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
# coding=utf-8
# --------------------------------------------------------------------------
#
# Copyright (c) Microsoft Corporation. All ri... | promptflow/src/promptflow/promptflow/azure/_restclient/flow/aio/_patch.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/azure/_restclient/flow/aio/_patch.py",
"repo_id": "promptflow",
"token_count": 414
} | 48 |
# coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.8.0, generator: @autorest/python@5.12.2)
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# ------------------------------... | promptflow/src/promptflow/promptflow/azure/_restclient/flow/models/_models_py3.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/azure/_restclient/flow/models/_models_py3.py",
"repo_id": "promptflow",
"token_count": 731467
} | 49 |
{
"openapi": "3.0.1",
"info": {
"title": "Azure Machine Learning Designer Service Client",
"version": "1.0.0"
},
"paths": {
"/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/BulkRuns/submit": {
"p... | promptflow/src/promptflow/promptflow/azure/_restclient/swagger.json/0 | {
"file_path": "promptflow/src/promptflow/promptflow/azure/_restclient/swagger.json",
"repo_id": "promptflow",
"token_count": 491277
} | 50 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import asyncio
from datetime import datetime
from json import JSONDecodeError
from pathlib import Path
from typing import Any, Mapping, Opt... | promptflow/src/promptflow/promptflow/batch/_base_executor_proxy.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/batch/_base_executor_proxy.py",
"repo_id": "promptflow",
"token_count": 3273
} | 51 |
# ---------------------------------------------------------
# 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": 637
} | 52 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
from promptflow._core.tool import ToolInvoker
class DefaultToolInvoker(ToolInvoker):
def invoke_tool(self, f, *args, **kwargs):
... | promptflow/src/promptflow/promptflow/executor/_tool_invoker.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/executor/_tool_invoker.py",
"repo_id": "promptflow",
"token_count": 89
} | 53 |
[run]
omit =
*/promptflow/_cli/*
*/promptflow/_sdk/*
*/promptflow/_telemetry/*
*/promptflow/azure/*
*/promptflow/entities/*
*/promptflow/operations/*
*__init__.py*
| promptflow/src/promptflow/tests/executor/.coveragerc/0 | {
"file_path": "promptflow/src/promptflow/tests/executor/.coveragerc",
"repo_id": "promptflow",
"token_count": 90
} | 54 |
import sys
from pathlib import Path
from unittest.mock import patch
import pytest
from promptflow._core._errors import PackageToolNotFoundError, ToolLoadError
from promptflow.contracts.run_info import Status
from promptflow.executor import FlowExecutor
from promptflow.executor._errors import NodeInputValidationError,... | promptflow/src/promptflow/tests/executor/e2etests/test_package_tool.py/0 | {
"file_path": "promptflow/src/promptflow/tests/executor/e2etests/test_package_tool.py",
"repo_id": "promptflow",
"token_count": 3178
} | 55 |
from promptflow import ToolProvider, tool
class TestLoadErrorTool(ToolProvider):
def __init__(self):
raise Exception("Tool load error.")
@tool
def tool(self, name: str):
return name
| promptflow/src/promptflow/tests/executor/package_tools/tool_with_init_error.py/0 | {
"file_path": "promptflow/src/promptflow/tests/executor/package_tools/tool_with_init_error.py",
"repo_id": "promptflow",
"token_count": 75
} | 56 |
import pytest
from promptflow._sdk.entities import CustomStrongTypeConnection
from promptflow._utils.connection_utils import (
generate_custom_strong_type_connection_spec,
generate_custom_strong_type_connection_template,
)
from promptflow.contracts.types import Secret
class MyCustomConnectionWithNoComments(C... | promptflow/src/promptflow/tests/executor/unittests/_utils/test_connection_utils.py/0 | {
"file_path": "promptflow/src/promptflow/tests/executor/unittests/_utils/test_connection_utils.py",
"repo_id": "promptflow",
"token_count": 2787
} | 57 |
import json
from pathlib import Path
from tempfile import mkdtemp
import pytest
from promptflow._core._errors import UnexpectedError
from promptflow._utils.utils import dump_list_to_jsonl
from promptflow.batch._batch_inputs_processor import BatchInputsProcessor, apply_inputs_mapping
from promptflow.batch._errors impo... | promptflow/src/promptflow/tests/executor/unittests/batch/test_batch_inputs_processor.py/0 | {
"file_path": "promptflow/src/promptflow/tests/executor/unittests/batch/test_batch_inputs_processor.py",
"repo_id": "promptflow",
"token_count": 7642
} | 58 |
from unittest.mock import Mock
import pytest
from promptflow import tool
from promptflow.contracts.flow import FlowInputDefinition
from promptflow.contracts.tool import ValueType
from promptflow.executor.flow_executor import (
FlowExecutor,
_ensure_node_result_is_serializable,
_inject_stream_options,
... | promptflow/src/promptflow/tests/executor/unittests/executor/test_flow_executor.py/0 | {
"file_path": "promptflow/src/promptflow/tests/executor/unittests/executor/test_flow_executor.py",
"repo_id": "promptflow",
"token_count": 2875
} | 59 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
from typing import Dict
from vcr.request import Request
from .utils import is_httpx_response, is_json_payload_request
class VariableRec... | promptflow/src/promptflow/tests/sdk_cli_azure_test/recording_utilities/variable_recorder.py/0 | {
"file_path": "promptflow/src/promptflow/tests/sdk_cli_azure_test/recording_utilities/variable_recorder.py",
"repo_id": "promptflow",
"token_count": 609
} | 60 |
from pathlib import Path
import pytest
FLOWS_DIR = Path(__file__).parent.parent.parent / "test_configs" / "flows"
DATAS_DIR = Path(__file__).parent.parent.parent / "test_configs" / "datas"
@pytest.mark.usefixtures("global_config")
@pytest.mark.e2etest
class TestGlobalConfig:
def test_basic_flow_bulk_run(self, p... | promptflow/src/promptflow/tests/sdk_cli_global_config_test/e2etests/test_global_config.py/0 | {
"file_path": "promptflow/src/promptflow/tests/sdk_cli_global_config_test/e2etests/test_global_config.py",
"repo_id": "promptflow",
"token_count": 467
} | 61 |
import logging
import tempfile
from pathlib import Path
from types import GeneratorType
import papermill
import pytest
from marshmallow import ValidationError
from promptflow._sdk._constants import LOGGER_NAME
from promptflow._sdk._pf_client import PFClient
from promptflow.exceptions import UserErrorException
PROMOT... | promptflow/src/promptflow/tests/sdk_cli_test/e2etests/test_flow_test.py/0 | {
"file_path": "promptflow/src/promptflow/tests/sdk_cli_test/e2etests/test_flow_test.py",
"repo_id": "promptflow",
"token_count": 5707
} | 62 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import pytest
import promptflow
import promptflow._sdk._mlflow as module
@pytest.mark.sdk_test
@pytest.mark.unittest
class TestMLFlowDepe... | promptflow/src/promptflow/tests/sdk_cli_test/unittests/test_mlflow_dependencies.py/0 | {
"file_path": "promptflow/src/promptflow/tests/sdk_cli_test/unittests/test_mlflow_dependencies.py",
"repo_id": "promptflow",
"token_count": 222
} | 63 |
{
"subscription_id": "sub_default",
"resource_group": "rg_default",
"workspace_name": "ws_default"
} | promptflow/src/promptflow/tests/test_configs/configs/.azureml/config.json/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/configs/.azureml/config.json",
"repo_id": "promptflow",
"token_count": 47
} | 64 |
$schema: https://azuremlschemas.azureedge.net/promptflow/latest/CustomConnection.schema.json
name: my_custom_connection
type: custom
configs:
key1: "new_value"
secrets: # must-have
key2: "******" # Use the scrub value to test key2 not being updated
| promptflow/src/promptflow/tests/test_configs/connections/update_custom_connection.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/connections/update_custom_connection.yaml",
"repo_id": "promptflow",
"token_count": 90
} | 65 |
{"text": "text", "models": ["model"]}
{"text": "text", "models": ["model", "model_2", "model_3"]} | promptflow/src/promptflow/tests/test_configs/eager_flows/dummy_flow_with_trace/inputs.jsonl/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/eager_flows/dummy_flow_with_trace/inputs.jsonl",
"repo_id": "promptflow",
"token_count": 37
} | 66 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
def my_flow(input_val: str = "gpt"):
"""Simple flow without yaml."""
# print(f"Hello world! {input_val}")
return f"Hello world!... | promptflow/src/promptflow/tests/test_configs/eager_flows/primitive_output/entry.py/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/eager_flows/primitive_output/entry.py",
"repo_id": "promptflow",
"token_count": 86
} | 67 |
from promptflow import tool
@tool
def print_input(input: str) -> str:
return input
| promptflow/src/promptflow/tests/test_configs/flows/activate_flow/print_input.py/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/activate_flow/print_input.py",
"repo_id": "promptflow",
"token_count": 29
} | 68 |
name: all_nodes_bypassed
inputs:
text:
type: string
outputs:
result:
type: string
reference: ${third_node.output}
nodes:
- name: first_node
type: python
source:
type: code
path: test.py
inputs:
text: ${inputs.text}
activate:
when: ${inputs.text}
is: "hello"
- name: second_nod... | promptflow/src/promptflow/tests/test_configs/flows/all_nodes_bypassed/flow.dag.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/all_nodes_bypassed/flow.dag.yaml",
"repo_id": "promptflow",
"token_count": 229
} | 69 |
inputs:
input_str:
type: string
default: Hello
outputs:
ouput1:
type: string
reference: ${async_passthrough1.output}
output2:
type: string
reference: ${sync_passthrough1.output}
nodes:
- name: async_passthrough
type: python
source:
type: code
path: async_passthrough.py
inputs... | promptflow/src/promptflow/tests/test_configs/flows/async_tools_with_sync_tools/flow.dag.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/async_tools_with_sync_tools/flow.dag.yaml",
"repo_id": "promptflow",
"token_count": 311
} | 70 |
import random
import time
from promptflow import tool
@tool
def get_calorie_by_swimming(duration: float, temperature: float):
"""Estimate the calories burned by swimming based on duration and temperature.
:param duration: the length of the swimming in hours.
:type duration: float
:param temperature:... | promptflow/src/promptflow/tests/test_configs/flows/chat-with-assistant-no-file/get_calorie_by_swimming.py/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/chat-with-assistant-no-file/get_calorie_by_swimming.py",
"repo_id": "promptflow",
"token_count": 219
} | 71 |
inputs:
chat_history:
type: list
default:
- inputs:
question:
- the first question
- data:image/jpg;path: logo.jpg
outputs:
answer:
- data:image/jpg;path: logo.jpg
- inputs:
question:
- the second question
- data:image/png;path: log... | promptflow/src/promptflow/tests/test_configs/flows/chat_flow_with_image/flow.dag.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/chat_flow_with_image/flow.dag.yaml",
"repo_id": "promptflow",
"token_count": 396
} | 72 |
from typing import List
from promptflow import log_metric, tool
@tool
def calculate_accuracy(grades: List[str], variant_ids: List[str]):
aggregate_grades = {}
for index in range(len(grades)):
grade = grades[index]
variant_id = variant_ids[index]
if variant_id not in aggregate_grades.k... | promptflow/src/promptflow/tests/test_configs/flows/classification_accuracy_evaluation/calculate_accuracy.py/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/classification_accuracy_evaluation/calculate_accuracy.py",
"repo_id": "promptflow",
"token_count": 244
} | 73 |
[
{
"incident_id": 1,
"incident_content": "Incident 418856448 : Stale App Deployment for App promptflow"
},
{
"incident_id": 3,
"incident_content": "Incident 418856448 : Stale App Deployment for App promptflow"
},
{
"incident_id": 0,
"incident_content"... | promptflow/src/promptflow/tests/test_configs/flows/conditional_flow_with_activate/inputs.json/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/conditional_flow_with_activate/inputs.json",
"repo_id": "promptflow",
"token_count": 177
} | 74 |
inputs: {}
outputs:
output:
type: string
reference: ${conn_node.output}
nodes:
- name: conn_node
type: python
source:
type: code
path: conn_tool.py
inputs:
conn: azure_open_ai_connection
| promptflow/src/promptflow/tests/test_configs/flows/connection_as_input/flow.dag.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/connection_as_input/flow.dag.yaml",
"repo_id": "promptflow",
"token_count": 89
} | 75 |
inputs:
customer_info:
type: string
chat_history:
type: string
outputs:
output:
type: string
reference: ${extract_intent.output}
nodes:
- name: chat_prompt
type: prompt
source:
type: code
path: user_intent_zero_shot.jinja2
inputs: # Please check the generated prompt inputs
custo... | promptflow/src/promptflow/tests/test_configs/flows/export/linux/flow/flow.dag.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/export/linux/flow/flow.dag.yaml",
"repo_id": "promptflow",
"token_count": 232
} | 76 |
from promptflow import tool
@tool
def nan_inf(number: int):
print(number)
return {"nan": float("nan"), "inf": float("inf")}
| promptflow/src/promptflow/tests/test_configs/flows/flow-with-nan-inf/nan_inf.py/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/flow-with-nan-inf/nan_inf.py",
"repo_id": "promptflow",
"token_count": 48
} | 77 |
{"text": "env1"}
{"text": "env2"}
{"text": "env3"}
{"text": "env4"}
{"text": "env5"}
{"text": "env10"} | promptflow/src/promptflow/tests/test_configs/flows/flow_with_environment_variables/inputs.jsonl/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/flow_with_environment_variables/inputs.jsonl",
"repo_id": "promptflow",
"token_count": 47
} | 78 |
from typing import List
from promptflow import tool
@tool
def get_val(key):
# get from env var
print(key)
return {"value": f"{key}: {type(key)}"}
| promptflow/src/promptflow/tests/test_configs/flows/flow_with_list_input/print_val.py/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/flow_with_list_input/print_val.py",
"repo_id": "promptflow",
"token_count": 60
} | 79 |
from promptflow import tool
from promptflow.connections import CustomStrongTypeConnection, CustomConnection
from promptflow.contracts.types import Secret
class MyCustomConnection(CustomStrongTypeConnection):
"""My custom strong type connection.
:param api_key: The api key.
:type api_key: String
:para... | promptflow/src/promptflow/tests/test_configs/flows/flow_with_script_tool_with_custom_strong_type_connection/my_script_tool.py/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/flow_with_script_tool_with_custom_strong_type_connection/my_script_tool.py",
"repo_id": "promptflow",
"token_count": 224
} | 80 |
{
"code": {
"hello_world.py": {
"type": "python",
"inputs": {
"name": {
"type": [
"string"
]
}
},
"source": "hello_world.py",
"function": "hello_world"
... | promptflow/src/promptflow/tests/test_configs/flows/hello-world/.promptflow/flow.tools.json/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/hello-world/.promptflow/flow.tools.json",
"repo_id": "promptflow",
"token_count": 4455
} | 81 |
{
"code": {
"mod_two.py": {
"type": "python",
"inputs": {
"number": {
"type": [
"int"
]
}
},
"source": "mod_two.py",
"function": "mod_two"
}
... | promptflow/src/promptflow/tests/test_configs/flows/mod-n/two/.promptflow/flow.tools.json/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/mod-n/two/.promptflow/flow.tools.json",
"repo_id": "promptflow",
"token_count": 13097
} | 82 |
inputs:
prompt:
type: string
stream:
type: bool
outputs:
output:
type: string
reference: ${completion.output}
nodes:
- name: completion
type: python
source:
type: code
path: completion.py
inputs:
prompt: ${inputs.prompt}
connection: azure_open_ai_connection
stream: ${inpu... | promptflow/src/promptflow/tests/test_configs/flows/openai_completion_api_flow/flow.dag.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/openai_completion_api_flow/flow.dag.yaml",
"repo_id": "promptflow",
"token_count": 130
} | 83 |
{{template}} | promptflow/src/promptflow/tests/test_configs/flows/prompt_tool_with_duplicated_inputs/prompt_with_duplicated_inputs.jinja2/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/prompt_tool_with_duplicated_inputs/prompt_with_duplicated_inputs.jinja2",
"repo_id": "promptflow",
"token_count": 3
} | 84 |
inputs:
input:
type: string
default: World
outputs:
output:
type: string
reference: ${script_tool_with_init.output}
nodes:
- name: script_tool_with_init
type: python
source:
type: code
path: script_tool_with_init.py
inputs:
init_input: Hello
input: ${inputs.input}
| promptflow/src/promptflow/tests/test_configs/flows/script_tool_with_init/flow.dag.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/script_tool_with_init/flow.dag.yaml",
"repo_id": "promptflow",
"token_count": 125
} | 85 |
inputs:
text:
type: string
default: "play"
outputs:
answer:
type: string
reference: ${passthrough.output}
nodes:
- name: passthrough
type: python
source:
type: code
path: passthrough.py
inputs:
input: ${inputs.text}
- name: accuracy
type: python
source:
type: code
path:... | promptflow/src/promptflow/tests/test_configs/flows/simple_aggregation/flow.dag.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/simple_aggregation/flow.dag.yaml",
"repo_id": "promptflow",
"token_count": 170
} | 86 |
inputs:
name:
type: string
default: hod
outputs:
result:
type: string
reference: ${hello_world.output}
nodes:
- name: hello_world
type: python
source:
type: code
path: hello_world.py
inputs:
name: ${inputs.name}
| promptflow/src/promptflow/tests/test_configs/flows/simple_hello_world/flow.dag.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/simple_hello_world/flow.dag.yaml",
"repo_id": "promptflow",
"token_count": 105
} | 87 |
{"inputs.url":"https://www.microsoft.com/en-us/d/xbox-wireless-controller-stellar-shift-special-edition/94fbjc7h0h6h"}
| promptflow/src/promptflow/tests/test_configs/flows/web_classification/fetch_text_content_from_url_input.jsonl/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/web_classification/fetch_text_content_from_url_input.jsonl",
"repo_id": "promptflow",
"token_count": 47
} | 88 |
inputs:
url:
type: string
default: https://www.microsoft.com/en-us/d/xbox-wireless-controller-stellar-shift-special-edition/94fbjc7h0h6h
outputs:
category:
type: string
reference: ${convert_to_dict.output.category}
evidence:
type: string
reference: ${convert_to_dict.output.evidence}
nodes:... | promptflow/src/promptflow/tests/test_configs/flows/web_classification_with_exception/flow.dag.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/web_classification_with_exception/flow.dag.yaml",
"repo_id": "promptflow",
"token_count": 1444
} | 89 |
interactions:
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- promptflow-sdk/0.0.1 azure-ai-ml/1.12.1 azsdk-python-mgmt-machinelearningservices/0.1.0
Python/3.10.13 (Windows-... | promptflow/src/promptflow/tests/test_configs/recordings/test_run_operations_TestFlowRun_test_download_run.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/recordings/test_run_operations_TestFlowRun_test_download_run.yaml",
"repo_id": "promptflow",
"token_count": 76599
} | 90 |
interactions:
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- promptflow-sdk/0.0.1 promptflow/0.0.1 azure-ai-ml/1.12.1 azsdk-python-mgmt-machinelearningservices/0.1.0
Python/... | promptflow/src/promptflow/tests/test_configs/recordings/test_run_operations_TestFlowRun_test_run_bulk_not_exist.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/recordings/test_run_operations_TestFlowRun_test_run_bulk_not_exist.yaml",
"repo_id": "promptflow",
"token_count": 1645
} | 91 |
interactions:
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- promptflow-sdk/0.0.1 azure-ai-ml/1.12.1 azsdk-python-mgmt-machinelearningservices/0.1.0
Python/3.10.13 (Windows-... | promptflow/src/promptflow/tests/test_configs/recordings/test_run_operations_TestFlowRun_test_stream_run_logs.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/recordings/test_run_operations_TestFlowRun_test_stream_run_logs.yaml",
"repo_id": "promptflow",
"token_count": 53944
} | 92 |
name: flow_run_20230629_101205
description: sample bulk run
flow: ../flows/web_classification
data: ../datas/webClassification1.jsonl
column_mapping:
url: "${data.url}"
variant: ${summarize_text_content.variant_0}
# run config: env related
environment_variables: env_file
| promptflow/src/promptflow/tests/test_configs/runs/sample_bulk_run.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/runs/sample_bulk_run.yaml",
"repo_id": "promptflow",
"token_count": 97
} | 93 |
from promptflow._core.tool import tool
from promptflow.connections import CustomStrongTypeConnection
from promptflow.contracts.types import Secret
class MyCustomConnection(CustomStrongTypeConnection):
"""My custom strong type connection.
:param api_key: The api key get from "https://xxx.com".
:type api_k... | promptflow/src/promptflow/tests/test_configs/tools/tool_with_custom_strong_type_connection.py/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/tools/tool_with_custom_strong_type_connection.py",
"repo_id": "promptflow",
"token_count": 239
} | 94 |
from promptflow import tool
@tool
def tool1():
pass
@tool
def tool2():
pass
| promptflow/src/promptflow/tests/test_configs/wrong_tools/multiple_tools.py/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/wrong_tools/multiple_tools.py",
"repo_id": "promptflow",
"token_count": 34
} | 95 |
{
"name": "Promptflow-Python39",
// "context" is the path that the Codespaces docker build command should be run from, relative to devcontainer.json
"context": ".",
"dockerFile": "Dockerfile",
// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.shell... | promptflow/.devcontainer/devcontainer.json/0 | {
"file_path": "promptflow/.devcontainer/devcontainer.json",
"repo_id": "promptflow",
"token_count": 230
} | 0 |
# 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": 1048
} | 1 |
# 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
} | 2 |
# 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": 1591
} | 3 |
# 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": 1454
} | 4 |
# 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
} | 5 |
$schema: https://azuremlschemas.azureedge.net/promptflow/latest/CustomConnection.schema.json
name: custom_connection
type: custom
configs:
key1: "test1"
secrets: # required
api-key: "<to-be-replaced>" | promptflow/examples/connections/custom.yml/0 | {
"file_path": "promptflow/examples/connections/custom.yml",
"repo_id": "promptflow",
"token_count": 76
} | 6 |
# Chat with PDF
This is a simple Python application that allow you to ask questions about the content of a PDF file and get answers.
It's a console application that you start with a URL to a PDF file as argument. Once it's launched it will download the PDF and build an index of the content. Then when you ask a question... | promptflow/examples/flows/chat/chat-with-pdf/chat_with_pdf/README.md/0 | {
"file_path": "promptflow/examples/flows/chat/chat-with-pdf/chat_with_pdf/README.md",
"repo_id": "promptflow",
"token_count": 371
} | 7 |
from typing import List
import openai
from openai.version import VERSION as OPENAI_VERSION
import os
import tiktoken
from jinja2 import Template
from .retry import (
retry_and_handle_exceptions,
retry_and_handle_exceptions_for_generator,
)
from .logging import log
def extract_delay_from_rate_limit_error_msg(... | promptflow/examples/flows/chat/chat-with-pdf/chat_with_pdf/utils/oai.py/0 | {
"file_path": "promptflow/examples/flows/chat/chat-with-pdf/chat_with_pdf/utils/oai.py",
"repo_id": "promptflow",
"token_count": 2376
} | 8 |
from promptflow import tool
from chat_with_pdf.rewrite_question import rewrite_question
@tool
def rewrite_question_tool(question: str, history: list, env_ready_signal: str):
return rewrite_question(question, history)
| promptflow/examples/flows/chat/chat-with-pdf/rewrite_question_tool.py/0 | {
"file_path": "promptflow/examples/flows/chat/chat-with-pdf/rewrite_question_tool.py",
"repo_id": "promptflow",
"token_count": 64
} | 9 |
$schema: https://azuremlschemas.azureedge.net/promptflow/latest/Flow.schema.json
environment:
python_requirements_txt: requirements.txt
inputs:
chat_history:
type: list
default:
- inputs:
question: What is the weather like in Boston?
outputs:
answer: '{"forecast":["sunny","windy"... | promptflow/examples/flows/chat/use_functions_with_chat_models/flow.dag.yaml/0 | {
"file_path": "promptflow/examples/flows/chat/use_functions_with_chat_models/flow.dag.yaml",
"repo_id": "promptflow",
"token_count": 898
} | 10 |
{"groundtruth": "10","prediction": "10"}
{"groundtruth": "253","prediction": "506"}
{"groundtruth": "1/3","prediction": "2/6"} | promptflow/examples/flows/evaluation/eval-chat-math/data.jsonl/0 | {
"file_path": "promptflow/examples/flows/evaluation/eval-chat-math/data.jsonl",
"repo_id": "promptflow",
"token_count": 45
} | 11 |
from promptflow import tool
from typing import List
@tool
def match(answer: List[str], ground_truth: List[str]):
exact_match = 0
partial_match = 0
if is_match(answer, ground_truth, ignore_case=True, ignore_order=True, allow_partial=False):
exact_match = 1
if is_match(answer, ground_truth, ig... | promptflow/examples/flows/evaluation/eval-entity-match-rate/match.py/0 | {
"file_path": "promptflow/examples/flows/evaluation/eval-entity-match-rate/match.py",
"repo_id": "promptflow",
"token_count": 406
} | 12 |
# Q&A Evaluation:
This is a flow evaluating the Q&A systems by leveraging Large Language Models (LLM) to measure the quality and safety of responses. Utilizing GPT and GPT embedding model to assist with measurements aims to achieve a high agreement with human evaluations compared to traditional mathematical measuremen... | promptflow/examples/flows/evaluation/eval-qna-non-rag/README.md/0 | {
"file_path": "promptflow/examples/flows/evaluation/eval-qna-non-rag/README.md",
"repo_id": "promptflow",
"token_count": 1463
} | 13 |
from typing import List
from promptflow import tool, log_metric
import numpy as np
@tool
def aggregate_variants_results(results: List[dict], metrics: List[str]):
aggregate_results = {}
for result in results:
for name, value in result.items():
if name not in aggregate_results.keys():
... | promptflow/examples/flows/evaluation/eval-qna-rag-metrics/aggregate_variants_results.py/0 | {
"file_path": "promptflow/examples/flows/evaluation/eval-qna-rag-metrics/aggregate_variants_results.py",
"repo_id": "promptflow",
"token_count": 451
} | 14 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.