text stringlengths 8 1.72M | id stringlengths 22 143 | metadata dict | __index_level_0__ int64 0 104 |
|---|---|---|---|
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import pytest
from azure.core.exceptions import HttpResponseError
from promptflow._sdk._orm import RunInfo
from promptflow.exceptions import... | promptflow/src/promptflow/tests/sdk_cli_test/unittests/test_exceptions.py/0 | {
"file_path": "promptflow/src/promptflow/tests/sdk_cli_test/unittests/test_exceptions.py",
"repo_id": "promptflow",
"token_count": 3605
} | 53 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import json
import tempfile
import uuid
from pathlib import Path
import mock
import pytest
from sdk_cli_azure_test.recording_utilities impo... | promptflow/src/promptflow/tests/sdk_pfs_test/e2etests/test_connection_apis.py/0 | {
"file_path": "promptflow/src/promptflow/tests/sdk_pfs_test/e2etests/test_connection_apis.py",
"repo_id": "promptflow",
"token_count": 2392
} | 54 |
$schema: https://azuremlschemas.azureedge.net/promptflow/latest/OpenAIConnection.schema.json
name: my_open_ai_connection
type: open_ai
api_key: "<to-be-replaced>"
organization: "org"
base_url: "" | promptflow/src/promptflow/tests/test_configs/connections/openai_connection.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/connections/openai_connection.yaml",
"repo_id": "promptflow",
"token_count": 78
} | 55 |
{"text":"data_5000"}
{"text":"data_5001"}
{"text":"data_5002"}
{"text":"data_5003"}
{"text":"data_5004"}
{"text":"data_5005"}
{"text":"data_5006"}
{"text":"data_5007"}
{"text":"data_5008"}
{"text":"data_5009"}
{"text":"data_5010"}
{"text":"data_5011"}
{"text":"data_5012"}
{"text":"data_5013"}
{"text":"data_5014"}
{"tex... | promptflow/src/promptflow/tests/test_configs/datas/load_data_cases/10k/5k.2.jsonl/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/datas/load_data_cases/10k/5k.2.jsonl",
"repo_id": "promptflow",
"token_count": 45023
} | 56 |
def my_flow(text: str):
raise Exception("dummy exception")
| promptflow/src/promptflow/tests/test_configs/eager_flows/dummy_flow_with_exception/entry.py/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/eager_flows/dummy_flow_with_exception/entry.py",
"repo_id": "promptflow",
"token_count": 21
} | 57 |
entry: my_func | promptflow/src/promptflow/tests/test_configs/eager_flows/invalid_no_path/flow.dag.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/eager_flows/invalid_no_path/flow.dag.yaml",
"repo_id": "promptflow",
"token_count": 5
} | 58 |
inputs:
text:
type: string
default: hello
outputs:
output:
type: string
reference: ${nodeC.output}
nodes:
- name: nodeA
type: python
source:
type: code
path: pass_through.py
inputs:
input1: ${inputs.text}
activate:
when: ${inputs.text}
is: hi
- name: nodeB
type: python
... | promptflow/src/promptflow/tests/test_configs/flows/activate_condition_always_met/flow.dag.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/activate_condition_always_met/flow.dag.yaml",
"repo_id": "promptflow",
"token_count": 280
} | 59 |
[
{
"groundtruth": "Tomorrow's weather will be sunny.",
"prediction": "The weather will be sunny tomorrow."
},
{
"groundtruth": "Hello,",
"prediction": "World."
},
{
"groundtruth": "Promptflow is a super easy-to-use tool, right?",
"prediction": "Yes!"
}
] | promptflow/src/promptflow/tests/test_configs/flows/aggregation_node_failed/samples.json/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/aggregation_node_failed/samples.json",
"repo_id": "promptflow",
"token_count": 111
} | 60 |
from promptflow import tool
import asyncio
@tool
async def passthrough_str_and_wait(input1: str, wait_seconds=3) -> str:
assert isinstance(input1, str), f"input1 should be a string, got {input1}"
print(f"Wait for {wait_seconds} seconds in async function")
for i in range(wait_seconds):
print(i)
... | promptflow/src/promptflow/tests/test_configs/flows/async_tools/async_passthrough.py/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/async_tools/async_passthrough.py",
"repo_id": "promptflow",
"token_count": 137
} | 61 |
{
"incident_id_extractor.completed": 3,
"job_info_extractor.completed": 1,
"job_info_extractor.bypassed": 2,
"incident_info_extractor.completed": 2,
"incident_info_extractor.bypassed": 1,
"icm_retriever.completed": 1,
"icm_retriever.bypassed": 2,
"tsg_retriever.completed": 1,
"tsg_re... | promptflow/src/promptflow/tests/test_configs/flows/conditional_flow_with_activate/expected_status_summary.json/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/conditional_flow_with_activate/expected_status_summary.json",
"repo_id": "promptflow",
"token_count": 282
} | 62 |
{
"square.bypassed": 2,
"double.completed": 2,
"collect_node.completed": 4,
"double.bypassed": 2,
"square.completed": 2,
"aggregation_double.completed": 1,
"aggregation_square.completed": 1
} | promptflow/src/promptflow/tests/test_configs/flows/conditional_flow_with_aggregate_bypassed/expected_status_summary.json/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/conditional_flow_with_aggregate_bypassed/expected_status_summary.json",
"repo_id": "promptflow",
"token_count": 96
} | 63 |
# syntax=docker/dockerfile:1
FROM docker.io/continuumio/miniconda3:latest
WORKDIR /
COPY ./flow /flow
# create conda environment
RUN conda create -n promptflow-serve python=3.9.16 pip=23.0.1 -q -y && \
conda run -n promptflow-serve \
pip install -r /flow/requirements_txt && \
conda run -n promptflow-serv... | promptflow/src/promptflow/tests/test_configs/flows/export/linux/Dockerfile/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/export/linux/Dockerfile",
"repo_id": "promptflow",
"token_count": 297
} | 64 |
inputs:
question:
type: string
outputs:
output:
type: string
reference: ${test_langchain_traces.output}
nodes:
- name: test_langchain_traces
type: python
source:
type: code
path: test_langchain_traces.py
inputs:
question: ${inputs.question}
conn: azure_open_ai_connection
| promptflow/src/promptflow/tests/test_configs/flows/flow_with_langchain_traces/flow.dag.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/flow_with_langchain_traces/flow.dag.yaml",
"repo_id": "promptflow",
"token_count": 123
} | 65 |
from promptflow import tool
@tool
def echo(text):
"""yield the input string."""
echo_text = "Echo - " + text
for word in echo_text.split():
yield word | promptflow/src/promptflow/tests/test_configs/flows/generator_nodes/echo.py/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/generator_nodes/echo.py",
"repo_id": "promptflow",
"token_count": 65
} | 66 |
echo Hello Promptflow!
| promptflow/src/promptflow/tests/test_configs/flows/intent-copilot/setup.sh/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/intent-copilot/setup.sh",
"repo_id": "promptflow",
"token_count": 6
} | 67 |
$schema: https://azuremlschemas.azureedge.net/latest/flow.schema.json
name: classification_accuracy_eval
type: evaluate
path: azureml://datastores/workspaceworkingdirectory/paths/Users/wanhan/my_flow_snapshot/flow.dag.yaml
| promptflow/src/promptflow/tests/test_configs/flows/meta_files/remote_fs.meta.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/meta_files/remote_fs.meta.yaml",
"repo_id": "promptflow",
"token_count": 80
} | 68 |
import openai
from openai.version import VERSION as OPENAI_VERSION
from typing import List
from promptflow import tool
from promptflow.connections import AzureOpenAIConnection
IS_LEGACY_OPENAI = OPENAI_VERSION.startswith("0.")
def get_client(connection: AzureOpenAIConnection):
api_key = connection.api_key
c... | promptflow/src/promptflow/tests/test_configs/flows/openai_chat_api_flow/chat.py/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/openai_chat_api_flow/chat.py",
"repo_id": "promptflow",
"token_count": 1207
} | 69 |
{"text": "text_0"}
{"text": "text_1"}
{"text": "text_2"}
{"text": "text_3"}
{"text": "text_4"}
{"text": "text_5"}
{"text": "text_6"}
{"text": "text_7"}
{"text": "text_8"}
{"text": "text_9"} | promptflow/src/promptflow/tests/test_configs/flows/print_input_flow/inputs.jsonl/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/print_input_flow/inputs.jsonl",
"repo_id": "promptflow",
"token_count": 89
} | 70 |
{"idx": 1, "line_number": 0}
{"idx": 2, "line_number": 1}
{"idx": 4, "line_number": 3}
{"idx": 5, "line_number": 4}
{"idx": 7, "line_number": 6}
{"idx": 8, "line_number": 7}
{"idx": 10, "line_number": 9}
| promptflow/src/promptflow/tests/test_configs/flows/python_tool_partial_failure/inputs/output.jsonl/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/python_tool_partial_failure/inputs/output.jsonl",
"repo_id": "promptflow",
"token_count": 98
} | 71 |
inputs:
image:
type: image
default: logo.jpg
outputs:
output:
type: image
reference: ${python_node_2.output}
nodes:
- name: python_node
type: python
source:
type: code
path: pick_an_image.py
inputs:
image_1: ${inputs.image}
image_2: logo_2.png
- name: python_node_2
type: pyth... | promptflow/src/promptflow/tests/test_configs/flows/python_tool_with_simple_image/flow.dag.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/python_tool_with_simple_image/flow.dag.yaml",
"repo_id": "promptflow",
"token_count": 195
} | 72 |
id: use_functions_with_chat_models
name: Use Functions with Chat Models
inputs:
chat_history:
type: list
default:
- inputs:
question: What is the weather like in Boston?
outputs:
answer: '{"forecast":["sunny","windy"],"location":"Boston","temperature":"72","unit":"fahrenheit"}'
... | promptflow/src/promptflow/tests/test_configs/flows/sample_flow_with_functions/flow.dag.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/sample_flow_with_functions/flow.dag.yaml",
"repo_id": "promptflow",
"token_count": 1210
} | 73 |
from aaa import bbb # noqa: F401 | promptflow/src/promptflow/tests/test_configs/flows/script_with_import/fail.py/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/script_with_import/fail.py",
"repo_id": "promptflow",
"token_count": 13
} | 74 |
[
{
"url": "https://www.microsoft.com/en-us/d/xbox-wireless-controller-stellar-shift-special-edition/94fbjc7h0h6h"
},
{
"url": "https://www.microsoft.com/en-us/windows/"
}
] | promptflow/src/promptflow/tests/test_configs/flows/web_classification_no_variants/samples.json/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/web_classification_no_variants/samples.json",
"repo_id": "promptflow",
"token_count": 85
} | 75 |
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.9.17 (Windows-1... | promptflow/src/promptflow/tests/test_configs/recordings/test_azure_cli_perf_TestAzureCliPerf_test_pfazure_run_create.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/recordings/test_azure_cli_perf_TestAzureCliPerf_test_pfazure_run_create.yaml",
"repo_id": "promptflow",
"token_count": 22751
} | 76 |
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_automatic_runtime_with_resources.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/recordings/test_run_operations_TestFlowRun_test_automatic_runtime_with_resources.yaml",
"repo_id": "promptflow",
"token_count": 10468
} | 77 |
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_show_metrics.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/recordings/test_run_operations_TestFlowRun_test_show_metrics.yaml",
"repo_id": "promptflow",
"token_count": 90735
} | 78 |
flow: ../flows/classification_accuracy_evaluation
data: not_exist
column_mapping:
groundtruth: "${data.answer}"
prediction: "${run.outputs.category}"
run: flow_run_20230629_101205 # ./sample_bulk_run.yaml
# run config: env related
environment_variables: .env
# optional
connections:
node_1:
connection: ... | promptflow/src/promptflow/tests/test_configs/runs/illegal/non_exist_data.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/runs/illegal/non_exist_data.yaml",
"repo_id": "promptflow",
"token_count": 139
} | 79 |
inputs:
num:
type: int
outputs:
content:
type: string
reference: ""
nodes:
- name: divide_num
type: python
source:
type: code
path: divide_num.py
inputs:
num: ${inputs.num}
| promptflow/src/promptflow/tests/test_configs/wrong_flows/flow_output_reference_invalid/flow.dag.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/wrong_flows/flow_output_reference_invalid/flow.dag.yaml",
"repo_id": "promptflow",
"token_count": 92
} | 80 |
inputs:
num:
type: int
outputs:
content:
type: string
reference: ${stringify_num.output}
nodes:
- name: stringify_num
type: python
source:
type: code
path: stringify_num.py
inputs:
num: ${inputs.num}
- name: stringify_num
type: python
source:
type: code
path: another_string... | promptflow/src/promptflow/tests/test_configs/wrong_flows/nodes_names_duplicated/flow.dag.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/wrong_flows/nodes_names_duplicated/flow.dag.yaml",
"repo_id": "promptflow",
"token_count": 155
} | 81 |
inputs:
text:
type: string
outputs:
output:
type: string
reference: ${search_by_text.output.search_metadata}
nodes:
- name: search_by_text
type: python
source:
type: package
tool: promptflow.tools.serpapi11.SerpAPI.search
inputs:
connection: serp_connection
query: ${inputs.text}
... | promptflow/src/promptflow/tests/test_configs/wrong_flows/wrong_package_in_package_tools/flow.dag.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/wrong_flows/wrong_package_in_package_tools/flow.dag.yaml",
"repo_id": "promptflow",
"token_count": 131
} | 82 |
# 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": 969
} | 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 |
# Basic Chat
This example shows how to create a basic chat flow. It demonstrates how to create a chatbot that can remember previous interactions and use the conversation history to generate next message.
Tools used in this flow:
- `llm` tool
## Prerequisites
Install promptflow sdk and other dependencies in this fold... | promptflow/examples/flows/chat/basic-chat/README.md/0 | {
"file_path": "promptflow/examples/flows/chat/basic-chat/README.md",
"repo_id": "promptflow",
"token_count": 769
} | 5 |
import faiss
from jinja2 import Environment, FileSystemLoader
import os
from utils.index import FAISSIndex
from utils.oai import OAIEmbedding, render_with_token_limit
from utils.logging import log
def find_context(question: str, index_path: str):
index = FAISSIndex(index=faiss.IndexFlatL2(1536), embedding=OAIEmb... | promptflow/examples/flows/chat/chat-with-pdf/chat_with_pdf/find_context.py/0 | {
"file_path": "promptflow/examples/flows/chat/chat-with-pdf/chat_with_pdf/find_context.py",
"repo_id": "promptflow",
"token_count": 422
} | 6 |
$schema: https://azuremlschemas.azureedge.net/promptflow/latest/Flow.schema.json
inputs:
groundtruth:
type: string
default: "1"
prediction:
type: string
default: "2"
outputs:
score:
type: string
reference: ${line_process.output}
nodes:
- name: line_process
type: python
source:
type... | promptflow/examples/flows/evaluation/eval-accuracy-maths-to-code/flow.dag.yaml/0 | {
"file_path": "promptflow/examples/flows/evaluation/eval-accuracy-maths-to-code/flow.dag.yaml",
"repo_id": "promptflow",
"token_count": 228
} | 7 |
from typing import List
from promptflow import log_metric, tool
@tool
def calculate_accuracy(grades: List[str]):
result = []
for index in range(len(grades)):
grade = grades[index]
result.append(grade)
# calculate accuracy for each variant
accuracy = round((result.count("Correct") / l... | promptflow/examples/flows/evaluation/eval-classification-accuracy/calculate_accuracy.py/0 | {
"file_path": "promptflow/examples/flows/evaluation/eval-classification-accuracy/calculate_accuracy.py",
"repo_id": "promptflow",
"token_count": 135
} | 8 |
from promptflow import tool
from collections import Counter
@tool
def compute_f1_score(ground_truth: str, answer: str) -> str:
import string
import re
class QASplitTokenizer:
def __call__(self, line):
"""Tokenizes an input line using split() on whitespace
:param line: a s... | promptflow/examples/flows/evaluation/eval-qna-non-rag/f1_score.py/0 | {
"file_path": "promptflow/examples/flows/evaluation/eval-qna-non-rag/f1_score.py",
"repo_id": "promptflow",
"token_count": 692
} | 9 |
from promptflow import tool
import re
@tool
def parse_grounding_output(rag_grounding_score: str) -> str:
try:
numbers_found = re.findall(r"Quality score:\s*(\d+)\/\d", rag_grounding_score)
score = float(numbers_found[0]) if len(numbers_found) > 0 else 0
except Exception:
score = float(... | promptflow/examples/flows/evaluation/eval-qna-rag-metrics/parse_groundedness_score.py/0 | {
"file_path": "promptflow/examples/flows/evaluation/eval-qna-rag-metrics/parse_groundedness_score.py",
"repo_id": "promptflow",
"token_count": 214
} | 10 |
from typing import Union
from openai.version import VERSION as OPENAI_VERSION
from promptflow import tool
from promptflow.connections import CustomConnection, AzureOpenAIConnection
# The inputs section will change based on the arguments of the tool function, after you save the code
# Adding type to arguments and retu... | promptflow/examples/flows/standard/basic-with-connection/hello.py/0 | {
"file_path": "promptflow/examples/flows/standard/basic-with-connection/hello.py",
"repo_id": "promptflow",
"token_count": 1109
} | 11 |
$schema: https://azuremlschemas.azureedge.net/promptflow/latest/Flow.schema.json
inputs:
question:
type: string
default: What is Prompt flow?
outputs:
answer:
type: string
reference: ${generate_result.output}
nodes:
- name: content_safety_check
type: python
source:
type: code
path: conte... | promptflow/examples/flows/standard/conditional-flow-for-if-else/flow.dag.yaml/0 | {
"file_path": "promptflow/examples/flows/standard/conditional-flow-for-if-else/flow.dag.yaml",
"repo_id": "promptflow",
"token_count": 386
} | 12 |
CHAT_DEPLOYMENT_NAME=gpt-35-turbo
AZURE_OPENAI_API_KEY=<your_AOAI_key>
AZURE_OPENAI_API_BASE=<your_AOAI_endpoint>
| promptflow/examples/flows/standard/customer-intent-extraction/.env.example/0 | {
"file_path": "promptflow/examples/flows/standard/customer-intent-extraction/.env.example",
"repo_id": "promptflow",
"token_count": 61
} | 13 |
from promptflow import tool
from divider import Divider
from typing import List
@tool
def combine_code(divided: List[str]):
code = Divider.combine(divided)
return code
| promptflow/examples/flows/standard/gen-docstring/combine_code_tool.py/0 | {
"file_path": "promptflow/examples/flows/standard/gen-docstring/combine_code_tool.py",
"repo_id": "promptflow",
"token_count": 57
} | 14 |
from promptflow import tool
import sys
from io import StringIO
@tool
def func_exe(code_snippet: str):
if code_snippet == "JSONDecodeError" or code_snippet.startswith("Unknown Error:"):
return code_snippet
# Define the result variable before executing the code snippet
old_stdout = sys.stdout
... | promptflow/examples/flows/standard/maths-to-code/code_execution.py/0 | {
"file_path": "promptflow/examples/flows/standard/maths-to-code/code_execution.py",
"repo_id": "promptflow",
"token_count": 432
} | 15 |
include my_tool_package/yamls/*.yaml | promptflow/examples/tools/tool-package-quickstart/MANIFEST.in/0 | {
"file_path": "promptflow/examples/tools/tool-package-quickstart/MANIFEST.in",
"repo_id": "promptflow",
"token_count": 14
} | 16 |
my_tool_package.tools.my_tool_2.MyTool.my_tool:
class_name: MyTool
function: my_tool
inputs:
connection:
type:
- CustomConnection
input_text:
type:
- string
module: my_tool_package.tools.my_tool_2
name: My Second Tool
description: This is my second tool
type: python
| promptflow/examples/tools/tool-package-quickstart/my_tool_package/yamls/my_tool_2.yaml/0 | {
"file_path": "promptflow/examples/tools/tool-package-quickstart/my_tool_package/yamls/my_tool_2.yaml",
"repo_id": "promptflow",
"token_count": 126
} | 17 |
import json
import pytest
import unittest
from my_tool_package.tools.tool_with_generated_by_input import (
generate_index_json,
list_embedding_deployment,
list_fields,
list_indexes,
list_index_types,
list_semantic_configuration,
my_tool,
reverse_generate_index_json,
)
@pytest.mark.par... | promptflow/examples/tools/tool-package-quickstart/tests/test_tool_with_generated_by_input.py/0 | {
"file_path": "promptflow/examples/tools/tool-package-quickstart/tests/test_tool_with_generated_by_input.py",
"repo_id": "promptflow",
"token_count": 967
} | 18 |
# Flow with custom_llm tool
This is a flow demonstrating how to use a `custom_llm` tool, which enables users to seamlessly connect to a large language model with prompt tuning experience using a `PromptTemplate`.
Tools used in this flow:
- `custom_llm` Tool
Connections used in this flow:
- custom connection
## Prere... | promptflow/examples/tools/use-cases/custom_llm_tool_showcase/README.md/0 | {
"file_path": "promptflow/examples/tools/use-cases/custom_llm_tool_showcase/README.md",
"repo_id": "promptflow",
"token_count": 249
} | 19 |
# Enforce the check of pipelines.
# This script will get the diff of the current branch and main branch, calculate the pipelines that should be triggered.
# Then it will check if the triggered pipelines are successful. This script will loop for 30*loop-times seconds at most.
# How many checks are triggered:
# 1. sdk c... | promptflow/scripts/check_enforcer/check_enforcer.py/0 | {
"file_path": "promptflow/scripts/check_enforcer/check_enforcer.py",
"repo_id": "promptflow",
"token_count": 4517
} | 20 |
#!/usr/bin/env python
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# ---------------------------------------------... | promptflow/scripts/installer/curl_install_pypi/install.py/0 | {
"file_path": "promptflow/scripts/installer/curl_install_pypi/install.py",
"repo_id": "promptflow",
"token_count": 5824
} | 21 |
{
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"EagerFlowSchema": {
"properties": {
"additional_includes": {
"title": "additional_includes",
"type": "array",
"items": {
... | promptflow/scripts/json_schema/EagerFlow.schema.json/0 | {
"file_path": "promptflow/scripts/json_schema/EagerFlow.schema.json",
"repo_id": "promptflow",
"token_count": 1541
} | 22 |
- name: {{ step_name }}
working-directory: {{ working_dir }}
run: |
AOAI_API_KEY=${{ '{{' }} secrets.AOAI_GPT_4V_KEY }}
AOAI_API_ENDPOINT=${{ '{{' }} secrets.AOAI_GPT_4V_ENDPOINT }}
AOAI_API_ENDPOINT=$(echo ${AOAI_API_ENDPOINT//\//\\/})
cp ../../../connections/azure_openai.yml ./azure_openai.yml
... | promptflow/scripts/readme/ghactions_driver/workflow_steps/step_create_env_gpt4.yml.jinja2/0 | {
"file_path": "promptflow/scripts/readme/ghactions_driver/workflow_steps/step_create_env_gpt4.yml.jinja2",
"repo_id": "promptflow",
"token_count": 218
} | 23 |
import argparse
from pathlib import Path
from functools import reduce
from ghactions_driver.readme_workflow_generate import write_readme_workflow
from ghactions_driver.readme_step import ReadmeStepsManage, ReadmeSteps
from ghactions_driver.readme_parse import readme_parser
from ghactions_driver.telemetry_obj import T... | promptflow/scripts/readme/readme_generator.py/0 | {
"file_path": "promptflow/scripts/readme/readme_generator.py",
"repo_id": "promptflow",
"token_count": 983
} | 24 |
from setuptools import find_packages, setup
PACKAGE_NAME = "{{ package_name }}"
setup(
name=PACKAGE_NAME,
version="0.0.1",
description="This is my tools package",
packages=find_packages(),
entry_points={
"package_tools": ["{{ tool_name }} = {{ package_name }}.tools.utils:list_package_tools... | promptflow/scripts/tool/templates/setup.py.j2/0 | {
"file_path": "promptflow/scripts/tool/templates/setup.py.j2",
"repo_id": "promptflow",
"token_count": 157
} | 25 |
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
} | 26 |
[pytest]
markers =
skip_if_no_api_key: skip the test if actual api key is not provided. | promptflow/src/promptflow-tools/tests/pytest.ini/0 | {
"file_path": "promptflow/src/promptflow-tools/tests/pytest.ini",
"repo_id": "promptflow",
"token_count": 33
} | 27 |
import pytest
from promptflow.exceptions import UserErrorException
from promptflow.tools.serpapi import Engine, SafeMode, search
import tests.utils as utils
@pytest.mark.usefixtures("use_secrets_config_file")
@pytest.mark.skip_if_no_api_key("serp_connection")
class TestSerpAPI:
def test_engine(self, serp_connec... | promptflow/src/promptflow-tools/tests/test_serpapi.py/0 | {
"file_path": "promptflow/src/promptflow-tools/tests/test_serpapi.py",
"repo_id": "promptflow",
"token_count": 832
} | 28 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import argparse
import json
from functools import partial
from promptflow._cli._params import (
add_param_all_results,
add_param_m... | promptflow/src/promptflow/promptflow/_cli/_pf/_connection.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_cli/_pf/_connection.py",
"repo_id": "promptflow",
"token_count": 3450
} | 29 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import argparse
import contextlib
import json
import os
import shutil
import sys
import traceback
from collections import namedtuple
from c... | promptflow/src/promptflow/promptflow/_cli/_utils.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_cli/_utils.py",
"repo_id": "promptflow",
"token_count": 7526
} | 30 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
from promptflow import tool
@tool
def line_process(groundtruth: str, prediction: str):
"""
This tool processes the prediction of ... | promptflow/src/promptflow/promptflow/_cli/data/evaluation_flow/line_process.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_cli/data/evaluation_flow/line_process.py",
"repo_id": "promptflow",
"token_count": 156
} | 31 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import copy
import json
import os
from dataclasses import fields, is_dataclass
from pathlib import Path
from typing import Any, Dict, List
... | promptflow/src/promptflow/promptflow/_core/connection_manager.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_core/connection_manager.py",
"repo_id": "promptflow",
"token_count": 2536
} | 32 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import logging
import os.path
import uuid
from itertools import product
from os import PathLike
from pathlib import Path
from typing import ... | promptflow/src/promptflow/promptflow/_sdk/_configuration.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_sdk/_configuration.py",
"repo_id": "promptflow",
"token_count": 3891
} | 33 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import flask
from jinja2 import Template
from pathlib import Path
from flask import Blueprint, request, url_for, current_app as app
def c... | promptflow/src/promptflow/promptflow/_sdk/_serving/blueprint/static_web_blueprint.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_sdk/_serving/blueprint/static_web_blueprint.py",
"repo_id": "promptflow",
"token_count": 545
} | 34 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import json
import os
import time
import base64
import zlib
from flask import jsonify, request
from promptflow._sdk._serving._errors impor... | promptflow/src/promptflow/promptflow/_sdk/_serving/utils.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_sdk/_serving/utils.py",
"repo_id": "promptflow",
"token_count": 1868
} | 35 |
import json
import os
from pathlib import Path
from PIL import Image
import streamlit as st
from streamlit_quill import st_quill
from promptflow._sdk._serving.flow_invoker import FlowInvoker
from utils import dict_iter_render_message, parse_list_from_html, parse_image_content
invoker = None
{% set indent_level = 4 %... | promptflow/src/promptflow/promptflow/_sdk/data/executable/main.py.jinja2/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_sdk/data/executable/main.py.jinja2",
"repo_id": "promptflow",
"token_count": 2320
} | 36 |
# ---------------------------------------------------------
# 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
} | 37 |
from promptflow.exceptions import SystemErrorException, UserErrorException, ValidationException
class InvalidImageInput(ValidationException):
pass
class LoadMultimediaDataError(UserErrorException):
pass
class YamlParseError(SystemErrorException):
"""Exception raised when yaml parse failed."""
pas... | promptflow/src/promptflow/promptflow/_utils/_errors.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_utils/_errors.py",
"repo_id": "promptflow",
"token_count": 85
} | 38 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import contextvars
import logging
import threading
from promptflow._utils.utils import set_context
class RepeatLogTimer(threading.Timer)... | promptflow/src/promptflow/promptflow/_utils/thread_utils.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_utils/thread_utils.py",
"repo_id": "promptflow",
"token_count": 505
} | 39 |
# How to automatically generate the REST client code
Rest client code in this folder are not manually written, but generated by autorest.
## Setup
+ install [nodejs](https://nodejs.org/en)
+ install autorest
+ run `npm install -g autorest`
## Download swagger.json
Download swagger.json from [here](https://int.api.a... | promptflow/src/promptflow/promptflow/azure/_restclient/README.md/0 | {
"file_path": "promptflow/src/promptflow/promptflow/azure/_restclient/README.md",
"repo_id": "promptflow",
"token_count": 837
} | 40 |
# 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/aio/operations/_flow_runtimes_operations.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/azure/_restclient/flow/aio/operations/_flow_runtimes_operations.py",
"repo_id": "promptflow",
"token_count": 11768
} | 41 |
# 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/operations/_flow_runtimes_operations.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/azure/_restclient/flow/operations/_flow_runtimes_operations.py",
"repo_id": "promptflow",
"token_count": 17964
} | 42 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
from dataclasses import dataclass
from datetime import datetime
from itertools import chain
from typing import Any, List, Mapping
from pro... | promptflow/src/promptflow/promptflow/batch/_result.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/batch/_result.py",
"repo_id": "promptflow",
"token_count": 3127
} | 43 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import asyncio
import contextvars
import inspect
import os
import signal
import threading
import time
import traceback
from asyncio import ... | promptflow/src/promptflow/promptflow/executor/_async_nodes_scheduler.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/executor/_async_nodes_scheduler.py",
"repo_id": "promptflow",
"token_count": 6253
} | 44 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore
from promptflow._sdk.operations._connection_operations im... | promptflow/src/promptflow/promptflow/operations/__init__.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/operations/__init__.py",
"repo_id": "promptflow",
"token_count": 133
} | 45 |
from pathlib import Path
from tempfile import mkdtemp
import pytest
from promptflow._utils.exception_utils import ExceptionPresenter
from promptflow.batch import BatchEngine
from promptflow.batch._result import BatchResult, LineError
from promptflow.contracts.run_info import Status
from promptflow.executor._errors im... | promptflow/src/promptflow/tests/executor/e2etests/test_batch_timeout.py/0 | {
"file_path": "promptflow/src/promptflow/tests/executor/e2etests/test_batch_timeout.py",
"repo_id": "promptflow",
"token_count": 3518
} | 46 |
import pytest
from promptflow._core.connection_manager import ConnectionManager
from promptflow.connections import AzureOpenAIConnection
from promptflow.contracts.tool import ConnectionType
def get_connection_dict():
return {
"azure_open_ai_connection": {
"type": "AzureOpenAIConnection",
... | promptflow/src/promptflow/tests/executor/unittests/_core/test_connection_manager.py/0 | {
"file_path": "promptflow/src/promptflow/tests/executor/unittests/_core/test_connection_manager.py",
"repo_id": "promptflow",
"token_count": 1015
} | 47 |
import os
import re
import sys
from multiprocessing import Pool
from pathlib import Path
from unittest.mock import patch
import pytest
from promptflow._core.tool_meta_generator import (
JinjaParsingError,
MultipleToolsDefined,
NoToolDefined,
PythonLoadError,
PythonParsingError,
generate_prompt... | promptflow/src/promptflow/tests/executor/unittests/_utils/test_generate_tool_meta_utils.py/0 | {
"file_path": "promptflow/src/promptflow/tests/executor/unittests/_utils/test_generate_tool_meta_utils.py",
"repo_id": "promptflow",
"token_count": 5664
} | 48 |
from datetime import datetime
import pytest
from promptflow.contracts.run_info import FlowRunInfo, RunInfo, Status
@pytest.mark.unittest
class TestStatus:
@pytest.mark.parametrize(
"status,expected",
[
(Status.Completed, True),
(Status.Failed, True),
(Status.B... | promptflow/src/promptflow/tests/executor/unittests/contracts/test_run_info.py/0 | {
"file_path": "promptflow/src/promptflow/tests/executor/unittests/contracts/test_run_info.py",
"repo_id": "promptflow",
"token_count": 2527
} | 49 |
import re
from pathlib import Path
import pydash
import pytest
from promptflow._utils.yaml_utils import dump_yaml, load_yaml_string
from promptflow.connections import AzureOpenAIConnection
from .._azure_utils import DEFAULT_TEST_TIMEOUT, PYTEST_TIMEOUT_METHOD
from ..recording_utilities import is_live
PROMOTFLOW_ROO... | promptflow/src/promptflow/tests/sdk_cli_azure_test/e2etests/test_flow_in_azure_ml.py/0 | {
"file_path": "promptflow/src/promptflow/tests/sdk_cli_azure_test/e2etests/test_flow_in_azure_ml.py",
"repo_id": "promptflow",
"token_count": 2108
} | 50 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import shutil
import tempfile
import uuid
from pathlib import Path
import pytest
from mock.mock import Mock
from promptflow._sdk._load_fu... | promptflow/src/promptflow/tests/sdk_cli_azure_test/unittests/test_flow_entity.py/0 | {
"file_path": "promptflow/src/promptflow/tests/sdk_cli_azure_test/unittests/test_flow_entity.py",
"repo_id": "promptflow",
"token_count": 4148
} | 51 |
import contextlib
import io
import multiprocessing
import os
import sys
import tempfile
import timeit
import uuid
from pathlib import Path
from unittest import mock
import pytest
from promptflow._cli._user_agent import USER_AGENT as CLI_USER_AGENT # noqa: E402
from promptflow._sdk._telemetry import log_activity
from... | promptflow/src/promptflow/tests/sdk_cli_test/e2etests/test_cli_perf.py/0 | {
"file_path": "promptflow/src/promptflow/tests/sdk_cli_test/e2etests/test_cli_perf.py",
"repo_id": "promptflow",
"token_count": 3111
} | 52 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import hashlib
import json
import os
import shelve
from pathlib import Path
from typing import Dict
from filelock import FileLock
from pro... | promptflow/src/promptflow/tests/sdk_cli_test/recording_utilities/record_storage.py/0 | {
"file_path": "promptflow/src/promptflow/tests/sdk_cli_test/recording_utilities/record_storage.py",
"repo_id": "promptflow",
"token_count": 6211
} | 53 |
[run]
source =
*/promptflow/_sdk/_service/*
omit =
*/promptflow/_cli/*
*/promptflow/azure/*
*/promptflow/entities/*
*/promptflow/operations/*
*__init__.py*
| promptflow/src/promptflow/tests/sdk_pfs_test/.coveragerc/0 | {
"file_path": "promptflow/src/promptflow/tests/sdk_pfs_test/.coveragerc",
"repo_id": "promptflow",
"token_count": 83
} | 54 |
$schema: https://azuremlschemas.azureedge.net/promptflow/latest/CognitiveSearchConnection.schema.json
name: my_cognitive_search_connection
type: cognitive_search # snake case
api_key: "<to-be-replaced>"
api_base: "endpoint"
api_version: "2023-07-01-Preview"
| promptflow/src/promptflow/tests/test_configs/connections/cognitive_search_connection.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/connections/cognitive_search_connection.yaml",
"repo_id": "promptflow",
"token_count": 93
} | 55 |
{"image": {"data:image/png;path":"logo_1.png"}}
{"image": {"data:image/png;path":"logo_2.png"}} | promptflow/src/promptflow/tests/test_configs/datas/image_inputs/inputs.jsonl/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/datas/image_inputs/inputs.jsonl",
"repo_id": "promptflow",
"token_count": 41
} | 56 |
{"text": "https://www.youtube.com/watch?v=o5ZQyXaAv1g"}
| promptflow/src/promptflow/tests/test_configs/datas/print_input_flow.jsonl/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/datas/print_input_flow.jsonl",
"repo_id": "promptflow",
"token_count": 28
} | 57 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
def my_flow(input_val: str):
"""Simple flow without yaml."""
print(f"Hello world! {input_val}")
| promptflow/src/promptflow/tests/test_configs/eager_flows/simple_without_yaml/entry.py/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/eager_flows/simple_without_yaml/entry.py",
"repo_id": "promptflow",
"token_count": 65
} | 58 |
from typing import List
from promptflow import tool
@tool
def aggregate(processed_results: List[str]):
aggregated_results = processed_results
# raise error to test aggregation node failed
num = 1/0
return aggregated_results
| promptflow/src/promptflow/tests/test_configs/flows/aggregation_node_failed/aggregate.py/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/aggregation_node_failed/aggregate.py",
"repo_id": "promptflow",
"token_count": 71
} | 59 |
version: 2
inputs:
assistant_input:
type: list
default:
- type: text
text: The provided file contains end-of-day (EOD) stock prices for companies A
and B across various dates in March. However, it does not include the
EOD stock prices for Company C.
- type: file_path
file_p... | promptflow/src/promptflow/tests/test_configs/flows/assistant-with-file/flow.dag.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/assistant-with-file/flow.dag.yaml",
"repo_id": "promptflow",
"token_count": 517
} | 60 |
inputs:
chat_history:
type: list
question:
type: string
is_chat_input: true
default: What is ChatGPT?
outputs:
answer:
type: string
reference: ${chat_node.output}
is_chat_output: true
multi_answer:
type: string
reference: ${chat_node.output}
is_chat_output: true
nodes:
- ... | promptflow/src/promptflow/tests/test_configs/flows/chat_flow_with_multi_output_invalid/flow.dag.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/chat_flow_with_multi_output_invalid/flow.dag.yaml",
"repo_id": "promptflow",
"token_count": 260
} | 61 |
name: TestPythonToolLongWaitTime
inputs:
input1:
type: bool
input2:
type: bool
input3:
type: bool
input4:
type: bool
outputs:
output:
type: int
reference: ${wait_long_1.output}
nodes:
- name: wait_1
type: python
source:
type: code
path: wait_short.py
inputs:
throw_e... | promptflow/src/promptflow/tests/test_configs/flows/concurrent_execution_flow/flow.dag.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/concurrent_execution_flow/flow.dag.yaml",
"repo_id": "promptflow",
"token_count": 427
} | 62 |
from promptflow import tool
@tool
def tsg_retriever(content: str) -> str:
return "TSG: " + content | promptflow/src/promptflow/tests/test_configs/flows/conditional_flow_with_activate/tsg_retriever.py/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/conditional_flow_with_activate/tsg_retriever.py",
"repo_id": "promptflow",
"token_count": 35
} | 63 |
inputs:
input_str:
type: string
default: input value from default
input_bool:
type: bool
default: False
input_list:
type: list
default: []
input_dict:
type: object
default: {}
outputs:
output:
type: string
reference: ${test_print_input.output}
nodes:
- name: test_print... | promptflow/src/promptflow/tests/test_configs/flows/default_input/flow.dag.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/default_input/flow.dag.yaml",
"repo_id": "promptflow",
"token_count": 346
} | 64 |
#!/bin/bash
echo "$(date -uIns) - promptflow-serve/finish $@"
# stop all gunicorn processes
echo "$(date -uIns) - Stopping all Gunicorn processes"
pkill gunicorn
while pgrep gunicorn >/dev/null; do
echo "$(date -uIns) - Gunicorn process is still running, waiting for 1s"
sleep 1
done
echo "$(date -uIns) - Stopped... | promptflow/src/promptflow/tests/test_configs/flows/export/linux/runit/promptflow-serve/finish/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/export/linux/runit/promptflow-serve/finish",
"repo_id": "promptflow",
"token_count": 123
} | 65 |
inputs:
key:
type: object
outputs:
output:
type: string
reference: ${get_dict_val.output.value}
nodes:
- name: get_dict_val
type: python
source:
type: code
path: get_dict_val.py
inputs:
key: ${inputs.key}
- name: print_val
type: python
source:
type: code
path: print_val.py
... | promptflow/src/promptflow/tests/test_configs/flows/flow_with_dict_input/flow.dag.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/flow_with_dict_input/flow.dag.yaml",
"repo_id": "promptflow",
"token_count": 181
} | 66 |
{"text": "Hello World!"}
| promptflow/src/promptflow/tests/test_configs/flows/flow_with_package_tool_with_custom_strong_type_connection/data.jsonl/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/flow_with_package_tool_with_custom_strong_type_connection/data.jsonl",
"repo_id": "promptflow",
"token_count": 9
} | 67 |
inputs: {}
outputs:
output:
type: string
reference: ${long_run_node.output}
nodes:
- name: long_run_node
type: python
inputs: {}
source:
type: code
path: long_run.py
| promptflow/src/promptflow/tests/test_configs/flows/long_run/flow.dag.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/long_run/flow.dag.yaml",
"repo_id": "promptflow",
"token_count": 80
} | 68 |
inputs:
idx:
type: int
outputs:
output:
type: int
reference: ${my_python_tool_with_failed_line.output}
nodes:
- name: my_python_tool
type: python
source:
type: code
path: my_python_tool.py
inputs:
idx: ${inputs.idx}
- name: my_python_tool_with_failed_line
type: python
source:
t... | promptflow/src/promptflow/tests/test_configs/flows/one_line_of_bulktest_timeout/flow.dag.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/one_line_of_bulktest_timeout/flow.dag.yaml",
"repo_id": "promptflow",
"token_count": 181
} | 69 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.