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 datetime
import json
from enum import Enum
from typing import Dict, List, Optional, Union
from sqlalchemy import TEXT, Boolean, Col... | promptflow/src/promptflow/promptflow/_sdk/_orm/run_info.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_sdk/_orm/run_info.py",
"repo_id": "promptflow",
"token_count": 3138
} | 40 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import time
from promptflow._sdk._serving.monitor.data_collector import FlowDataCollector
from promptflow._sdk._serving.monitor.streaming_m... | promptflow/src/promptflow/promptflow/_sdk/_serving/monitor/flow_monitor.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_sdk/_serving/monitor/flow_monitor.py",
"repo_id": "promptflow",
"token_count": 1717
} | 41 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import logging
from promptflow._sdk._configuration import Configuration
PROMPTFLOW_LOGGER_NAMESPACE = "promptflow._sdk._telemetry"
class... | promptflow/src/promptflow/promptflow/_sdk/_telemetry/telemetry.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_sdk/_telemetry/telemetry.py",
"repo_id": "promptflow",
"token_count": 1051
} | 42 |
#! /bin/bash
echo "start promptflow serving"
cd /flow
dotnet Promptflow.dll --port "8080" --yaml_path "flow.dag.yaml" --assembly_folder "." --connection_folder_path "../connections" --log_path "" --serving | promptflow/src/promptflow/promptflow/_sdk/data/docker_csharp/runit/promptflow-serve/run.jinja2/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_sdk/data/docker_csharp/runit/promptflow-serve/run.jinja2",
"repo_id": "promptflow",
"token_count": 71
} | 43 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import datetime
import functools
import json
import uuid
from os import PathLike
from pathlib import Path
from typing import Any, Dict, Lis... | promptflow/src/promptflow/promptflow/_sdk/entities/_run.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_sdk/entities/_run.py",
"repo_id": "promptflow",
"token_count": 14107
} | 44 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
# pylint: disable=unused-argument,no-self-use
import copy
from pathlib import Path
from typing import Optional
from marshmallow import RA... | promptflow/src/promptflow/promptflow/_sdk/schemas/_base.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_sdk/schemas/_base.py",
"repo_id": "promptflow",
"token_count": 2701
} | 45 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import hashlib
import os
from os import PathLike
from pathlib import Path
from typing import Union
from promptflow._sdk._constants import D... | promptflow/src/promptflow/promptflow/_utils/flow_utils.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_utils/flow_utils.py",
"repo_id": "promptflow",
"token_count": 949
} | 46 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
class FlowType:
STANDARD = "standard"
CHAT = "chat"
EVALUATION = "evaluate"
class FlowJobType:
STANDARD = "azureml.promp... | promptflow/src/promptflow/promptflow/azure/_constants/_flow.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/azure/_constants/_flow.py",
"repo_id": "promptflow",
"token_count": 322
} | 47 |
# 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/_configuration.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/azure/_restclient/flow/aio/_configuration.py",
"repo_id": "promptflow",
"token_count": 741
} | 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.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/azure/_restclient/flow/models/_models.py",
"repo_id": "promptflow",
"token_count": 668286
} | 49 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
from threading import Lock
from promptflow.azure._restclient.flow_service_caller import FlowServiceCaller
class _FlowServiceCallerFactory... | promptflow/src/promptflow/promptflow/azure/_restclient/service_caller_factory.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/azure/_restclient/service_caller_factory.py",
"repo_id": "promptflow",
"token_count": 347
} | 50 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
# flake8: noqa
from ._base_executor_proxy import AbstractExecutorProxy, APIBasedExecutorProxy
from ._batch_engine import BatchEngine
from .... | promptflow/src/promptflow/promptflow/batch/__init__.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/batch/__init__.py",
"repo_id": "promptflow",
"token_count": 170
} | 51 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import json
import logging
from dataclasses import asdict, dataclass
from enum import Enum
from typing import Any, Dict, List, Optional, Ty... | promptflow/src/promptflow/promptflow/contracts/tool.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/contracts/tool.py",
"repo_id": "promptflow",
"token_count": 6405
} | 52 |
import asyncio
import inspect
import uuid
from pathlib import Path
from typing import Any, Callable, Mapping, Optional
from promptflow._constants import LINE_NUMBER_KEY
from promptflow._core.operation_context import OperationContext
from promptflow._core.run_tracker import RunTracker
from promptflow._core.tool_meta_ge... | promptflow/src/promptflow/promptflow/executor/_script_executor.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/executor/_script_executor.py",
"repo_id": "promptflow",
"token_count": 2020
} | 53 |
import importlib
import json
import os
import tempfile
from multiprocessing import Lock
from pathlib import Path
from unittest.mock import MagicMock, patch
import pytest
from _constants import (
CONNECTION_FILE,
DEFAULT_REGISTRY_NAME,
DEFAULT_RESOURCE_GROUP_NAME,
DEFAULT_RUNTIME_NAME,
DEFAULT_SUBSC... | promptflow/src/promptflow/tests/conftest.py/0 | {
"file_path": "promptflow/src/promptflow/tests/conftest.py",
"repo_id": "promptflow",
"token_count": 2688
} | 54 |
from pathlib import Path
from tempfile import mkdtemp
import pytest
from promptflow._utils.logger_utils import LogContext
from promptflow.batch import BatchEngine
from promptflow.batch._result import BatchResult
from promptflow.contracts.run_info import Status
from promptflow.contracts.run_mode import RunMode
from pr... | promptflow/src/promptflow/tests/executor/e2etests/test_logs.py/0 | {
"file_path": "promptflow/src/promptflow/tests/executor/e2etests/test_logs.py",
"repo_id": "promptflow",
"token_count": 4611
} | 55 |
{
"tool_with_connection": {
"function": "tool_with_test_conn",
"inputs": {
"conn": {"type": ["TestConnection"]}
},
"module": "tool_with_connection",
"name": "Test Tool with Connection",
"type": "python"
}
}
| promptflow/src/promptflow/tests/executor/package_tools/tool_with_connection/package_tool_definition.json/0 | {
"file_path": "promptflow/src/promptflow/tests/executor/package_tools/tool_with_connection/package_tool_definition.json",
"repo_id": "promptflow",
"token_count": 135
} | 56 |
from pathlib import Path
from tempfile import mkdtemp
from unittest.mock import Mock, patch
import pytest
from promptflow._core._errors import UnexpectedError
from promptflow.batch import APIBasedExecutorProxy, BatchEngine, CSharpExecutorProxy, PythonExecutorProxy
from promptflow.contracts.run_info import Status
from... | promptflow/src/promptflow/tests/executor/unittests/batch/test_batch_engine.py/0 | {
"file_path": "promptflow/src/promptflow/tests/executor/unittests/batch/test_batch_engine.py",
"repo_id": "promptflow",
"token_count": 2021
} | 57 |
import pytest
from promptflow.exceptions import PromptflowException
@pytest.mark.unittest
class TestExceptions:
def test_exception_message(self):
ex = PromptflowException(
message_format="Test exception message with parameters: {param}, {param1}.",
param="test_param",
)
... | promptflow/src/promptflow/tests/executor/unittests/executor/test_exceptions.py/0 | {
"file_path": "promptflow/src/promptflow/tests/executor/unittests/executor/test_exceptions.py",
"repo_id": "promptflow",
"token_count": 165
} | 58 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import json
import os
import re
from dataclasses import dataclass
from typing import Dict
import jwt
from azure.core.credentials import Ac... | promptflow/src/promptflow/tests/sdk_cli_azure_test/recording_utilities/utils.py/0 | {
"file_path": "promptflow/src/promptflow/tests/sdk_cli_azure_test/recording_utilities/utils.py",
"repo_id": "promptflow",
"token_count": 4229
} | 59 |
import json
import pytest
@pytest.mark.usefixtures("recording_injection")
@pytest.mark.e2etest
def test_azureml_serving_api_with_encoded_connection(flow_serving_client_with_encoded_connection):
response = flow_serving_client_with_encoded_connection.get("/health")
assert b'{"status":"Healthy","version":"0.0.1... | promptflow/src/promptflow/tests/sdk_cli_test/e2etests/test_flow_serve_azureml_extension.py/0 | {
"file_path": "promptflow/src/promptflow/tests/sdk_cli_test/e2etests/test_flow_serve_azureml_extension.py",
"repo_id": "promptflow",
"token_count": 229
} | 60 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import pandas as pd
import pytest
from promptflow._sdk._constants import LINE_NUMBER
from promptflow._sdk.operations._local_storage_operat... | promptflow/src/promptflow/tests/sdk_cli_test/unittests/test_local_storage_operations.py/0 | {
"file_path": "promptflow/src/promptflow/tests/sdk_cli_test/unittests/test_local_storage_operations.py",
"repo_id": "promptflow",
"token_count": 693
} | 61 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import contextlib
import getpass
import json
from typing import Any, Dict, List
from unittest import mock
import werkzeug
from flask.testin... | promptflow/src/promptflow/tests/sdk_pfs_test/utils.py/0 | {
"file_path": "promptflow/src/promptflow/tests/sdk_pfs_test/utils.py",
"repo_id": "promptflow",
"token_count": 3734
} | 62 |
$schema: https://azuremlschemas.azureedge.net/promptflow/latest/AzureOpenAIConnection.schema.json
name: my_azure_open_ai_connection
type: azure_open_ai # snake case
api_key: "******" # Use the scrub value to test key2 not being updated
api_base: "new_value"
api_type: "azure"
api_version: "2023-07-01-preview"
| promptflow/src/promptflow/tests/test_configs/connections/update_azure_openai_connection.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/connections/update_azure_openai_connection.yaml",
"repo_id": "promptflow",
"token_count": 122
} | 63 |
path: ./entry.py
entry: my_flow
| promptflow/src/promptflow/tests/test_configs/eager_flows/dummy_flow_with_trace/flow.dag.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/eager_flows/dummy_flow_with_trace/flow.dag.yaml",
"repo_id": "promptflow",
"token_count": 13
} | 64 |
inputs:
text:
type: string
default: world
outputs:
output1:
type: string
reference: ${nodeC.output}
output2:
type: string
reference: ${nodeD.output}
nodes:
- name: nodeA
type: python
source:
type: code
path: print_input.py
inputs:
input: ${inputs.text}
activate:
whe... | promptflow/src/promptflow/tests/test_configs/flows/activate_flow/flow.dag.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/activate_flow/flow.dag.yaml",
"repo_id": "promptflow",
"token_count": 343
} | 65 |
from promptflow import tool
@tool
def pass_through(input1: str="Execution") -> str:
return input1 | promptflow/src/promptflow/tests/test_configs/flows/all_depedencies_bypassed_with_activate_met/pass_through.py/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/all_depedencies_bypassed_with_activate_met/pass_through.py",
"repo_id": "promptflow",
"token_count": 33
} | 66 |
from promptflow import tool
import asyncio
@tool
async def passthrough_str_and_wait(input1: str, wait_seconds=3, wait_seconds_in_cancellation=1) -> str:
assert isinstance(input1, str), f"input1 should be a string, got {input1}"
try:
print(f"Wait for {wait_seconds} seconds in async function")
f... | promptflow/src/promptflow/tests/test_configs/flows/async_tools_with_sync_tools/async_passthrough.py/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/async_tools_with_sync_tools/async_passthrough.py",
"repo_id": "promptflow",
"token_count": 334
} | 67 |
import random
import time
from promptflow import tool
@tool
def get_calorie_by_jogging(duration: float, temperature: float):
"""Estimate the calories burned by jogging based on duration and temperature.
:param duration: the length of the jogging in hours.
:type duration: float
:param temperature: th... | promptflow/src/promptflow/tests/test_configs/flows/chat-with-assistant-no-file/get_calorie_by_jogging.py/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/chat-with-assistant-no-file/get_calorie_by_jogging.py",
"repo_id": "promptflow",
"token_count": 222
} | 68 |
from promptflow import tool
@tool
def show_answer(chat_answer: str):
raise Exception("mock exception")
| promptflow/src/promptflow/tests/test_configs/flows/chat_flow_with_exception/show_answer.py/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/chat_flow_with_exception/show_answer.py",
"repo_id": "promptflow",
"token_count": 33
} | 69 |
from typing import List
from promptflow import tool
@tool
def aggregation_assert(input1: List[str], input2: List[str]):
assert isinstance(input1, list)
assert isinstance(input2, list)
assert len(input1) == len(input2)
| promptflow/src/promptflow/tests/test_configs/flows/classification_accuracy_evaluation/aggregation_assert.py/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/classification_accuracy_evaluation/aggregation_assert.py",
"repo_id": "promptflow",
"token_count": 79
} | 70 |
from promptflow import tool
@tool
def extract_incident_info(incident: dict) -> str:
retriever_type = ["icm", "tsg", "kql"]
return {
"retriever": retriever_type[incident["incident_id"]],
"incident_content": incident["incident_content"]
} | promptflow/src/promptflow/tests/test_configs/flows/conditional_flow_with_activate/incident_info_extractor.py/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/conditional_flow_with_activate/incident_info_extractor.py",
"repo_id": "promptflow",
"token_count": 92
} | 71 |
import os
from promptflow import tool
from promptflow.connections import CustomConnection
from intent import extract_intent
@tool
def extract_intent_tool(
chat_prompt,
connection: CustomConnection) -> str:
# set environment variables
for key, value in dict(connection).items():
os.environ[ke... | promptflow/src/promptflow/tests/test_configs/flows/export/linux/flow/extract_intent_tool.py/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/export/linux/flow/extract_intent_tool.py",
"repo_id": "promptflow",
"token_count": 141
} | 72 |
inputs:
number:
type: int
outputs:
output:
type: object
reference: ${nan_inf.output}
nodes:
- name: nan_inf
type: python
source:
type: code
path: nan_inf.py
inputs:
number: ${inputs.number}
| promptflow/src/promptflow/tests/test_configs/flows/flow-with-nan-inf/flow.dag.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/flow-with-nan-inf/flow.dag.yaml",
"repo_id": "promptflow",
"token_count": 97
} | 73 |
environment_variables:
env1: 2
env2: spawn
env3:
- 1
- 2
- 3
- 4
- 5
env4:
a: 1
b: "2"
inputs:
key:
type: string
outputs:
output:
type: string
reference: ${print_env.output.value}
nodes:
- name: print_env
type: python
source:
type: code
path: print_env.py
inputs:
... | promptflow/src/promptflow/tests/test_configs/flows/flow_with_environment_variables/flow.dag.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/flow_with_environment_variables/flow.dag.yaml",
"repo_id": "promptflow",
"token_count": 163
} | 74 |
inputs:
key:
type: list
outputs:
output:
type: string
reference: ${print_val.output.value}
nodes:
- name: print_val
type: python
source:
type: code
path: print_val.py
inputs:
key: ${inputs.key}
| promptflow/src/promptflow/tests/test_configs/flows/flow_with_list_input/flow.dag.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/flow_with_list_input/flow.dag.yaml",
"repo_id": "promptflow",
"token_count": 99
} | 75 |
inputs:
text:
type: string
default: this is an input
outputs:
out:
type: string
reference: ${my_script_tool.output}
nodes:
- name: my_script_tool
type: python
source:
type: code
path: my_script_tool.py
inputs:
connection: custom_connection_2
input_param: ${inputs.text}
| promptflow/src/promptflow/tests/test_configs/flows/flow_with_script_tool_with_custom_strong_type_connection/flow.dag.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/flow_with_script_tool_with_custom_strong_type_connection/flow.dag.yaml",
"repo_id": "promptflow",
"token_count": 126
} | 76 |
inputs:
text:
type: string
outputs:
answer:
type: string
reference: ${echo.output}
nodes:
- name: echo
type: python
source:
type: code
path: echo.py
inputs:
text: ${inputs.text}
| promptflow/src/promptflow/tests/test_configs/flows/generator_tools/flow.dag.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/generator_tools/flow.dag.yaml",
"repo_id": "promptflow",
"token_count": 91
} | 77 |
{
"id": "/subscriptions/xxxx/resourceGroups/xxx/providers/Microsoft.MachineLearningServices/workspaces/xxx/connections/azure_open_ai_connection",
"name": "azure_open_ai_connection",
"type": "Microsoft.MachineLearningServices/workspaces/connections",
"properties": {
"authType": "ApiKey",
... | promptflow/src/promptflow/tests/test_configs/flows/llm_connection_override/connection_arm_template.json/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/llm_connection_override/connection_arm_template.json",
"repo_id": "promptflow",
"token_count": 538
} | 78 |
from promptflow import tool
@tool
def mod_three(number: int):
if number % 3 != 0:
raise Exception("cannot mod 3!")
return {"value": number}
| promptflow/src/promptflow/tests/test_configs/flows/mod-n/three/mod_three.py/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/mod-n/three/mod_three.py",
"repo_id": "promptflow",
"token_count": 58
} | 79 |
from openai.version import VERSION as OPENAI_VERSION
import openai
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
conn = dict(
api_... | promptflow/src/promptflow/tests/test_configs/flows/openai_completion_api_flow/completion.py/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/openai_completion_api_flow/completion.py",
"repo_id": "promptflow",
"token_count": 956
} | 80 |
inputs:
text:
type: string
outputs:
output_prompt:
type: string
reference: ${prompt_tool_with_duplicated_inputs.output}
nodes:
- name: prompt_tool_with_duplicated_inputs
type: prompt
source:
type: code
path: prompt_with_duplicated_inputs.jinja2
inputs:
text: ${inputs.text} | promptflow/src/promptflow/tests/test_configs/flows/prompt_tool_with_duplicated_inputs/flow.dag.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/prompt_tool_with_duplicated_inputs/flow.dag.yaml",
"repo_id": "promptflow",
"token_count": 127
} | 81 |
{"image": {"data:image/png;path":"logo.jpg"}}
{"image": {"data:image/png;path":"logo_2.png"}} | promptflow/src/promptflow/tests/test_configs/flows/python_tool_with_simple_image/inputs.jsonl/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/python_tool_with_simple_image/inputs.jsonl",
"repo_id": "promptflow",
"token_count": 39
} | 82 |
creation_context:
created_at: xxx
created_by: xxx
created_by_type: xxx
last_modified_at: xxx
last_modified_by: xxx
last_modified_by_type: xxx
description: Create flows that use large language models to classify URLs into multiple
categories.
display_name: web_classification_4
error_threshold: -1
id: azure... | promptflow/src/promptflow/tests/test_configs/flows/saved_component_spec/parallel.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/saved_component_spec/parallel.yaml",
"repo_id": "promptflow",
"token_count": 1314
} | 83 |
from promptflow import tool, log_metric
from typing import List
@tool
def accuracy(answer: List[str], groundtruth: List[str]):
assert isinstance(answer, list)
correct = 0
for a, g in zip(answer, groundtruth):
if a == g:
correct += 1
accuracy = float(correct) / len(answer)
log_m... | promptflow/src/promptflow/tests/test_configs/flows/simple_aggregation/accuracy.py/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/simple_aggregation/accuracy.py",
"repo_id": "promptflow",
"token_count": 136
} | 84 |
{
"package": {},
"code": {
"fetch_text_content_from_url.py": {
"type": "python",
"inputs": {
"url": {
"type": [
"string"
]
}
},
"function": "fetch_text_content_... | promptflow/src/promptflow/tests/test_configs/flows/web_classification_no_variants/.promptflow/flow.tools.json/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/web_classification_no_variants/.promptflow/flow.tools.json",
"repo_id": "promptflow",
"token_count": 1366
} | 85 |
import json
from promptflow import tool
@tool
def convert_to_dict(input_str: str):
try:
return json.loads(input_str)
except Exception as e:
print("input is not valid, error: {}".format(e))
return {"category": "None", "evidence": "None"}
| promptflow/src/promptflow/tests/test_configs/flows/web_classification_no_variants_unordered/convert_to_dict.py/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/web_classification_no_variants_unordered/convert_to_dict.py",
"repo_id": "promptflow",
"token_count": 104
} | 86 |
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_invalid_run_logs.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/recordings/test_run_operations_TestFlowRun_test_stream_invalid_run_logs.yaml",
"repo_id": "promptflow",
"token_count": 2431
} | 87 |
flow: ../flows/print_env_var
data: ../datas/env_var_names.jsonl
# run config: env related
environment_variables:
API_BASE: ${azure_open_ai_connection.api_base}
| promptflow/src/promptflow/tests/test_configs/runs/run_with_env.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/runs/run_with_env.yaml",
"repo_id": "promptflow",
"token_count": 64
} | 88 |
inputs:
url:
type: string
default: https://play.google.com/store/apps/details?id=com.twitter.android
is_chat_input: false
outputs:
category:
type: string
reference: ${convert_to_dict.output.category}
evaluation_only: false
is_chat_output: false
evidence:
type: string
reference:... | promptflow/src/promptflow/tests/test_configs/runs/web_classification_variant_0_20231205_120253_104100/snapshot/flow.dag.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/runs/web_classification_variant_0_20231205_120253_104100/snapshot/flow.dag.yaml",
"repo_id": "promptflow",
"token_count": 663
} | 89 |
from promptflow._core.tool import ToolProvider, tool
from promptflow.connections import CustomConnection
class MyTool(ToolProvider):
"""
Doc reference :
"""
def __init__(self, connection: CustomConnection):
super().__init__()
self.connection = connection
@tool(name="My Second Too... | promptflow/src/promptflow/tests/test_configs/tools/tool_with_custom_connection.py/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/tools/tool_with_custom_connection.py",
"repo_id": "promptflow",
"token_count": 244
} | 90 |
inputs:
text:
type: string
outputs:
output:
type: string
reference: ${summarize_text_content.output}
nodes:
- name: summarize_text_content
type: llm
source:
type: code
path: summarize_text_content__variant_1.jinja2
inputs:
deployment_name: gpt-35-turbo
suffix: ''
max_tokens: '2... | promptflow/src/promptflow/tests/test_configs/wrong_flows/invalid_connection/flow.dag.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/wrong_flows/invalid_connection/flow.dag.yaml",
"repo_id": "promptflow",
"token_count": 280
} | 91 |
from promptflow import tool
@tool
def stringify_num(num: int):
return str(num)
| promptflow/src/promptflow/tests/test_configs/wrong_flows/outputs_reference_not_valid/stringify_num.py/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/wrong_flows/outputs_reference_not_valid/stringify_num.py",
"repo_id": "promptflow",
"token_count": 30
} | 92 |
from promptflow import tool
1 / 0
@tool
def tool1():
pass
| promptflow/src/promptflow/tests/test_configs/wrong_tools/load_error.py/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/wrong_tools/load_error.py",
"repo_id": "promptflow",
"token_count": 25
} | 93 |
# Cloud
Prompt flow streamlines the process of developing AI applications based on LLM, easing prompt engineering, prototyping, evaluating, and fine-tuning for high-quality products.
Transitioning to production, however, typically requires a comprehensive **LLMOps** process, LLMOps is short for large language model o... | promptflow/docs/cloud/index.md/0 | {
"file_path": "promptflow/docs/cloud/index.md",
"repo_id": "promptflow",
"token_count": 718
} | 0 |
# Develop chat flow
:::{admonition} Experimental feature
This is an experimental feature, and may change at any time. Learn [more](../faq.md#stable-vs-experimental).
:::
From this document, you can learn how to develop a chat flow by writing a flow yaml from scratch. You can
find additional information about flow ya... | promptflow/docs/how-to-guides/develop-a-flow/develop-chat-flow.md/0 | {
"file_path": "promptflow/docs/how-to-guides/develop-a-flow/develop-chat-flow.md",
"repo_id": "promptflow",
"token_count": 954
} | 1 |
# Frequency asked questions (FAQ)
## General ##
### Stable vs experimental
Prompt flow provides both stable and experimental features in the same SDK.
|Feature status | Description |
|----------------|----------------|
Stable features | **Production ready** <br/><br/> These features are recommended for most use ca... | promptflow/docs/how-to-guides/faq.md/0 | {
"file_path": "promptflow/docs/how-to-guides/faq.md",
"repo_id": "promptflow",
"token_count": 2390
} | 2 |
# Reference
**Current stable version:**
- [promptflow](https://pypi.org/project/promptflow):
[](https://badge.fury.io/py/promptflow)
[](https://pypi.org/project/promptflow/)
- [promptflow-tools](https... | promptflow/docs/reference/index.md/0 | {
"file_path": "promptflow/docs/reference/index.md",
"repo_id": "promptflow",
"token_count": 535
} | 3 |
$schema: https://azuremlschemas.azureedge.net/promptflow/latest/Flow.schema.json
environment:
python_requirements_txt: requirements.txt
inputs:
chat_history:
type: list
is_chat_history: true
question:
type: list
default:
- data:image/png;url: https://images.idgesg.net/images/article/2019/11/ed... | promptflow/examples/flows/chat/chat-with-image/flow.dag.yaml/0 | {
"file_path": "promptflow/examples/flows/chat/chat-with-image/flow.dag.yaml",
"repo_id": "promptflow",
"token_count": 340
} | 4 |
$schema: https://azuremlschemas.azureedge.net/promptflow/latest/Run.schema.json
#name: chat_with_pdf_default_20230820_162219_559000
flow: .
data: ./data/bert-paper-qna.jsonl
#run: <Uncomment to select a run input>
column_mapping:
chat_history: ${data.chat_history}
pdf_url: ${data.pdf_url}
question: ${data.questio... | promptflow/examples/flows/chat/chat-with-pdf/batch_run.yaml/0 | {
"file_path": "promptflow/examples/flows/chat/chat-with-pdf/batch_run.yaml",
"repo_id": "promptflow",
"token_count": 243
} | 5 |
import argparse
from dotenv import load_dotenv
import os
from qna import qna
from find_context import find_context
from rewrite_question import rewrite_question
from build_index import create_faiss_index
from download import download
from utils.lock import acquire_lock
from constants import PDF_DIR, INDEX_DIR
def ch... | promptflow/examples/flows/chat/chat-with-pdf/chat_with_pdf/main.py/0 | {
"file_path": "promptflow/examples/flows/chat/chat-with-pdf/chat_with_pdf/main.py",
"repo_id": "promptflow",
"token_count": 740
} | 6 |
{"pdf_url":"https://arxiv.org/pdf/1810.04805.pdf"}
| promptflow/examples/flows/chat/chat-with-pdf/data/invalid-data-missing-column.jsonl/0 | {
"file_path": "promptflow/examples/flows/chat/chat-with-pdf/data/invalid-data-missing-column.jsonl",
"repo_id": "promptflow",
"token_count": 24
} | 7 |
system:
You are a chatbot having a conversation with a human.
Given the following extracted parts of a long document and a question, create a final answer with references ("SOURCES").
If you don't know the answer, just say that you don't know. Don't try to make up an answer.
ALWAYS return a "SOURCES" part in your answe... | promptflow/examples/flows/chat/chat-with-wikipedia/augmented_chat.jinja2/0 | {
"file_path": "promptflow/examples/flows/chat/chat-with-wikipedia/augmented_chat.jinja2",
"repo_id": "promptflow",
"token_count": 142
} | 8 |
from promptflow import tool
@tool
def line_process(groundtruth: str, prediction: str) -> int:
processed_result = 0
if prediction == "JSONDecodeError" or prediction.startswith("Unknown Error:"):
processed_result = -1
return processed_result
try:
groundtruth = float(groundtruth)
... | promptflow/examples/flows/evaluation/eval-accuracy-maths-to-code/line_process.py/0 | {
"file_path": "promptflow/examples/flows/evaluation/eval-accuracy-maths-to-code/line_process.py",
"repo_id": "promptflow",
"token_count": 396
} | 9 |
{"groundtruth": "App","prediction": "App"}
{"groundtruth": "Channel","prediction": "Channel"}
{"groundtruth": "Academic","prediction": "Academic"}
| promptflow/examples/flows/evaluation/eval-classification-accuracy/data.jsonl/0 | {
"file_path": "promptflow/examples/flows/evaluation/eval-classification-accuracy/data.jsonl",
"repo_id": "promptflow",
"token_count": 44
} | 10 |
$schema: https://azuremlschemas.azureedge.net/promptflow/latest/Flow.schema.json
environment:
python_requirements_txt: requirements.txt
inputs:
question:
type: string
default: What is the name of the new language representation model introduced in
the document?
answer:
type: string
default: ... | promptflow/examples/flows/evaluation/eval-groundedness/flow.dag.yaml/0 | {
"file_path": "promptflow/examples/flows/evaluation/eval-groundedness/flow.dag.yaml",
"repo_id": "promptflow",
"token_count": 5523
} | 11 |
$schema: https://azuremlschemas.azureedge.net/promptflow/latest/Flow.schema.json
inputs:
question:
type: string
default: Which tent is the most waterproof?
is_chat_input: false
answer:
type: string
default: The Alpine Explorer Tent is the most waterproof.
is_chat_input: false
context:
... | promptflow/examples/flows/evaluation/eval-qna-non-rag/flow.dag.yaml/0 | {
"file_path": "promptflow/examples/flows/evaluation/eval-qna-non-rag/flow.dag.yaml",
"repo_id": "promptflow",
"token_count": 2623
} | 12 |
from promptflow import tool
import re
@tool
def parse_retrieval_output(retrieval_output: str) -> str:
score_response = [sent.strip() for sent in
retrieval_output.strip("\"").split("# Result")[-1].strip().split('.') if sent.strip()]
parsed_score_response = re.findall(r"\d+", score_respons... | promptflow/examples/flows/evaluation/eval-qna-rag-metrics/parse_retrival_score.py/0 | {
"file_path": "promptflow/examples/flows/evaluation/eval-qna-rag-metrics/parse_retrival_score.py",
"repo_id": "promptflow",
"token_count": 308
} | 13 |
$schema: https://azuremlschemas.azureedge.net/promptflow/latest/CustomConnection.schema.json
name: azure_ai_language_connection
type: custom
configs:
endpoint: "<azure-language-resource-endpoint>"
secrets:
api_key: "<to-be-replaced>" | promptflow/examples/flows/integrations/azure-ai-language/connections/azure_ai_language.yml/0 | {
"file_path": "promptflow/examples/flows/integrations/azure-ai-language/connections/azure_ai_language.yml",
"repo_id": "promptflow",
"token_count": 85
} | 14 |
You are {{name}}, {{role}}
Play to your strengths as an LLM and pursue simple strategies with no legal complications to complete all goals.
Your decisions must always be made independently without seeking user assistance.
Performance Evaluation:
1. Continuously review and analyze your actions to ensure you are perfo... | promptflow/examples/flows/standard/autonomous-agent/system_prompt.jinja2/0 | {
"file_path": "promptflow/examples/flows/standard/autonomous-agent/system_prompt.jinja2",
"repo_id": "promptflow",
"token_count": 130
} | 15 |
from promptflow import tool
@tool
def generate_result(llm_result="", default_result="") -> str:
if llm_result:
return llm_result
else:
return default_result
| promptflow/examples/flows/standard/conditional-flow-for-if-else/generate_result.py/0 | {
"file_path": "promptflow/examples/flows/standard/conditional-flow-for-if-else/generate_result.py",
"repo_id": "promptflow",
"token_count": 71
} | 16 |
{
"package": {},
"code": {
"chat_prompt": {
"type": "prompt",
"inputs": {
"customer_info": {
"type": [
"string"
]
},
"chat_history": {
"type": [
"string"
]
}
},
"source": "user_intent_zero_sho... | promptflow/examples/flows/standard/customer-intent-extraction/.promptflow/flow.tools.json/0 | {
"file_path": "promptflow/examples/flows/standard/customer-intent-extraction/.promptflow/flow.tools.json",
"repo_id": "promptflow",
"token_count": 628
} | 17 |
# Flow with additional_includes
User sometimes need to reference some common files or folders, this sample demos how to solve the problem using additional_includes. The file or folders in additional includes will be
copied to the snapshot folder by promptflow when operate this flow.
## Tools used in this flow
- LLM ... | promptflow/examples/flows/standard/flow-with-additional-includes/README.md/0 | {
"file_path": "promptflow/examples/flows/standard/flow-with-additional-includes/README.md",
"repo_id": "promptflow",
"token_count": 804
} | 18 |
{"source": "./divider.py"}
{"source": "./azure_open_ai.py"}
{"source": "./generate_docstring_tool.py"}
| promptflow/examples/flows/standard/gen-docstring/data.jsonl/0 | {
"file_path": "promptflow/examples/flows/standard/gen-docstring/data.jsonl",
"repo_id": "promptflow",
"token_count": 44
} | 19 |
from promptflow import tool
import ast
import json
def infinite_loop_check(code_snippet):
tree = ast.parse(code_snippet)
for node in ast.walk(tree):
if isinstance(node, ast.While):
if not node.orelse:
return True
return False
def syntax_error_check(code_snippet):
... | promptflow/examples/flows/standard/maths-to-code/code_refine.py/0 | {
"file_path": "promptflow/examples/flows/standard/maths-to-code/code_refine.py",
"repo_id": "promptflow",
"token_count": 680
} | 20 |
{
"package": {},
"code": {
"fetch_text_content_from_url.py": {
"type": "python",
"inputs": {
"url": {
"type": [
"string"
]
}
},
"source": "fetch_text_content_from_url.py",
"function": "fetch_text_content_from_url"
},
"summariz... | promptflow/examples/flows/standard/web-classification/.promptflow/flow.tools.json/0 | {
"file_path": "promptflow/examples/flows/standard/web-classification/.promptflow/flow.tools.json",
"repo_id": "promptflow",
"token_count": 938
} | 21 |
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore
| promptflow/examples/tools/tool-package-quickstart/my_tool_package/__init__.py/0 | {
"file_path": "promptflow/examples/tools/tool-package-quickstart/my_tool_package/__init__.py",
"repo_id": "promptflow",
"token_count": 30
} | 22 |
my_tool_package.tools.tool_with_cascading_inputs.my_tool:
function: my_tool
inputs:
user_type:
type:
- string
enum:
- student
- teacher
student_id:
type:
- string
enabled_by: user_type
enabled_by_value: [student]
teacher_id:
type:
-... | promptflow/examples/tools/tool-package-quickstart/my_tool_package/yamls/tool_with_cascading_inputs.yaml/0 | {
"file_path": "promptflow/examples/tools/tool-package-quickstart/my_tool_package/yamls/tool_with_cascading_inputs.yaml",
"repo_id": "promptflow",
"token_count": 244
} | 23 |
$schema: https://azuremlschemas.azureedge.net/promptflow/latest/CustomConnection.schema.json
name: basic_custom_connection
type: custom
configs:
api_base: <to-be-replaced>
secrets: # must-have
api_key: <to-be-replaced>
| promptflow/examples/tools/use-cases/custom_llm_tool_showcase/custom_connection.yml/0 | {
"file_path": "promptflow/examples/tools/use-cases/custom_llm_tool_showcase/custom_connection.yml",
"repo_id": "promptflow",
"token_count": 86
} | 24 |
# Copyright (C) Microsoft Corporation. All rights reserved.
<#
.SYNOPSIS
Check Policheck Scan result.
.DESCRIPTION
Helper script to check the Policheck result.
If there is policheck failure, show the error and throw exception.
#>
[CmdLetbinding()]
param (
[string]$policheckResult,
[st... | promptflow/scripts/compliance-check/Check-PolicheckScan.ps1/0 | {
"file_path": "promptflow/scripts/compliance-check/Check-PolicheckScan.ps1",
"repo_id": "promptflow",
"token_count": 242
} | 25 |
{
"type": "object",
"oneOf": [
{
"properties": {
"additional_includes": {
"title": "additional_includes",
"type": "array",
"items": {
"title": "additional_includes",
"t... | promptflow/scripts/json_schema/Flow.schema.json/0 | {
"file_path": "promptflow/scripts/json_schema/Flow.schema.json",
"repo_id": "promptflow",
"token_count": 3605
} | 26 |
- name: {{ step_name }}
working-directory: {{ working_dir }}
run: |
gpt_base=${{ '{{' }} secrets.AOAI_API_ENDPOINT_TEST }}
gpt_base=$(echo ${gpt_base//\//\\/})
if [[ -e run.yml ]]; then
sed -i -e "s/\${azure_open_ai_connection.api_key}/${{ '{{' }} secrets.AOAI_API_KEY_TEST }}/g" -e "s/\${azure_ope... | promptflow/scripts/readme/ghactions_driver/workflow_steps/step_create_run_yml.yml.jinja2/0 | {
"file_path": "promptflow/scripts/readme/ghactions_driver/workflow_steps/step_create_run_yml.yml.jinja2",
"repo_id": "promptflow",
"token_count": 180
} | 27 |
from promptflow._sdk._load_functions import load_yaml
from promptflow._sdk._pf_client import PFClient
from ghactions_driver.readme_step import ReadmeStepsManage
from pathlib import Path
import os
import subprocess
import sys
def install(filename):
subprocess.check_call([sys.executable, "-m", "pip", "install", "-r... | promptflow/scripts/readme/schema_checker.py/0 | {
"file_path": "promptflow/scripts/readme/schema_checker.py",
"repo_id": "promptflow",
"token_count": 1200
} | 28 |
import pytest
import unittest
from promptflow.connections import CustomConnection
from {{ package_name }}.tools.{{ tool_name }} import {{ function_name }}
@pytest.fixture
def my_custom_connection() -> CustomConnection:
my_custom_connection = CustomConnection(
{
"api-key" : "my-api-key",
... | promptflow/scripts/tool/templates/test_tool.py.j2/0 | {
"file_path": "promptflow/scripts/tool/templates/test_tool.py.j2",
"repo_id": "promptflow",
"token_count": 280
} | 29 |
[flake8]
extend-ignore = E203, E266, W503, F403, F821
max-line-length = 120
enable-extensions = E123,E133,E241,E242,E704,W505
exclude =
.git
.tox
.eggs
__pycache__
tests/fixtures/*
docs/*
venv,.pytest_cache
build
src/promptflow/promptflow/azure/_restclient
src/promptflow/tests/te... | promptflow/setup.cfg/0 | {
"file_path": "promptflow/setup.cfg",
"repo_id": "promptflow",
"token_count": 494
} | 30 |
from enum import Enum
try:
from openai import OpenAI as OpenAIClient
except Exception:
raise Exception(
"Please upgrade your OpenAI package to version 1.0.0 or later using the command: pip install --upgrade openai.")
from promptflow.tools.common import render_jinja_template, handle_openai_error, \
... | promptflow/src/promptflow-tools/promptflow/tools/openai.py/0 | {
"file_path": "promptflow/src/promptflow-tools/promptflow/tools/openai.py",
"repo_id": "promptflow",
"token_count": 3479
} | 31 |
import pytest
from promptflow.tools.azure_content_safety import analyze_text
@pytest.mark.usefixtures("use_secrets_config_file")
class TestAzureContentSafety:
def test_azure_content_safety_analyze_happy_path(self, azure_content_safety_connection):
text = "I hate you."
result = analyze_text(
... | promptflow/src/promptflow-tools/tests/test_acs.py/0 | {
"file_path": "promptflow/src/promptflow-tools/tests/test_acs.py",
"repo_id": "promptflow",
"token_count": 194
} | 32 |
import json
class AttrDict(dict):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def __getattr__(self, item):
if item in self:
return self.__getitem__(item)
return super().__getattribute__(item)
def is_json_serializable(data, function_name):
t... | promptflow/src/promptflow-tools/tests/utils.py/0 | {
"file_path": "promptflow/src/promptflow-tools/tests/utils.py",
"repo_id": "promptflow",
"token_count": 412
} | 33 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import argparse
import json
from promptflow._cli._params import (
add_param_all_results,
add_param_archived_only,
add_param_inc... | promptflow/src/promptflow/promptflow/_cli/_pf/_experiment.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_cli/_pf/_experiment.py",
"repo_id": "promptflow",
"token_count": 2168
} | 34 |
The directory structure in the package tool is as follows:
```python
{{ package_name }}
│ setup.py # This file contains metadata about your project like the name, version.
│
│ MANIFEST.in # This file is used to determine which files to include in the distribution of the project.
│
└───{{ ... | promptflow/src/promptflow/promptflow/_cli/data/package_tool/README.md.jinja2/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_cli/data/package_tool/README.md.jinja2",
"repo_id": "promptflow",
"token_count": 311
} | 35 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import asyncio
import functools
import inspect
import logging
import threading
import time
import uuid
from contextvars import ContextVar
f... | promptflow/src/promptflow/promptflow/_core/flow_execution_context.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_core/flow_execution_context.py",
"repo_id": "promptflow",
"token_count": 4757
} | 36 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import os
from enum import Enum
from pathlib import Path
LOGGER_NAME = "promptflow"
PROMPT_FLOW_HOME_DIR_ENV_VAR = "PF_HOME_DIRECTORY"
PRO... | promptflow/src/promptflow/promptflow/_sdk/_constants.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_sdk/_constants.py",
"repo_id": "promptflow",
"token_count": 5327
} | 37 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import inspect
from pathlib import Path
from flask import jsonify, request
import promptflow._sdk.schemas._connection as connection
from ... | promptflow/src/promptflow/promptflow/_sdk/_service/apis/connection.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_sdk/_service/apis/connection.py",
"repo_id": "promptflow",
"token_count": 3034
} | 38 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
from .run_submitter import RunSubmitter
from .test_submitter import TestSubmitter
from .utils import (
overwrite_connections,
overwr... | promptflow/src/promptflow/promptflow/_sdk/_submitter/__init__.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_sdk/_submitter/__init__.py",
"repo_id": "promptflow",
"token_count": 185
} | 39 |
# syntax=docker/dockerfile:1
{% if env.image %}
FROM {{env.image}}
{% else %}
{% if show_comment %}
# use mcr.microsoft.com/azureml/openmpi4.1.0-ubuntu20.04:latest? current image is based on Debian 11
{% endif %}
FROM docker.io/continuumio/miniconda3:latest
{% endif %}
WORKDIR /
{% if env.python_requirements_txt %}
C... | promptflow/src/promptflow/promptflow/_sdk/data/docker/Dockerfile.jinja2/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_sdk/data/docker/Dockerfile.jinja2",
"repo_id": "promptflow",
"token_count": 680
} | 40 |
import base64
import json
import re
import streamlit as st
from bs4 import BeautifulSoup, NavigableString, Tag
from promptflow._utils.multimedia_utils import MIME_PATTERN, is_multimedia_dict
def show_image(image, key=None):
col1, _ = st.columns(2)
with col1:
if not image.startswith("data:image"):
... | promptflow/src/promptflow/promptflow/_sdk/data/executable/utils.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_sdk/data/executable/utils.py",
"repo_id": "promptflow",
"token_count": 2495
} | 41 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
from typing import List, Optional
from promptflow._sdk._constants import MAX_LIST_CLI_RESULTS, ListViewType
from promptflow._sdk._errors im... | promptflow/src/promptflow/promptflow/_sdk/operations/_experiment_operations.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_sdk/operations/_experiment_operations.py",
"repo_id": "promptflow",
"token_count": 1682
} | 42 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import asyncio
from concurrent.futures import ThreadPoolExecutor
def _has_running_loop() -> bool:
"""Check if the current thread has ... | promptflow/src/promptflow/promptflow/_utils/async_utils.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_utils/async_utils.py",
"repo_id": "promptflow",
"token_count": 524
} | 43 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import importlib
import inspect
import logging
import re
from enum import Enum, EnumMeta
from typing import Any, Callable, Dict, List, Unio... | promptflow/src/promptflow/promptflow/_utils/tool_utils.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_utils/tool_utils.py",
"repo_id": "promptflow",
"token_count": 6166
} | 44 |
# 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_workspace_independent_operations.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/azure/_restclient/flow/aio/operations/_flow_runtimes_workspace_independent_operations.py",
"repo_id": "promptflow",
"token_count": 1237
} | 45 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.