text
stringlengths 8
1.72M
| id
stringlengths 22
143
| metadata
dict | __index_level_0__
int64 0
104
|
---|---|---|---|
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
# pylint: disable=wrong-import-position
import json
import time
from promptflow._cli._pf._experiment import add_experiment_parser, dispatch_experiment_commands
from promptflow._cli._utils import _get_cli_activity_name
from promptflow._sdk._configuration import Configuration
from promptflow._sdk._telemetry import ActivityType, get_telemetry_logger, log_activity
from promptflow._sdk._telemetry.activity import update_activity_name
# Log the start time
start_time = time.perf_counter()
# E402 module level import not at top of file
import argparse # noqa: E402
import logging # noqa: E402
import sys # noqa: E402
from promptflow._cli._pf._config import add_config_parser, dispatch_config_commands # noqa: E402
from promptflow._cli._pf._connection import add_connection_parser, dispatch_connection_commands # noqa: E402
from promptflow._cli._pf._flow import add_flow_parser, dispatch_flow_commands # noqa: E402
from promptflow._cli._pf._run import add_run_parser, dispatch_run_commands # noqa: E402
from promptflow._cli._pf._tool import add_tool_parser, dispatch_tool_commands # noqa: E402
from promptflow._cli._pf.help import show_privacy_statement, show_welcome_message # noqa: E402
from promptflow._cli._pf._upgrade import add_upgrade_parser, upgrade_version # noqa: E402
from promptflow._cli._user_agent import USER_AGENT # noqa: E402
from promptflow._sdk._utils import ( # noqa: E402
get_promptflow_sdk_version,
print_pf_version,
setup_user_agent_to_operation_context,
)
from promptflow._utils.logger_utils import get_cli_sdk_logger # noqa: E402
# get logger for CLI
logger = get_cli_sdk_logger()
def run_command(args):
# Log the init finish time
init_finish_time = time.perf_counter()
try:
# --verbose, enable info logging
if hasattr(args, "verbose") and args.verbose:
for handler in logger.handlers:
handler.setLevel(logging.INFO)
# --debug, enable debug logging
if hasattr(args, "debug") and args.debug:
for handler in logger.handlers:
handler.setLevel(logging.DEBUG)
if args.version:
print_pf_version()
elif args.action == "flow":
dispatch_flow_commands(args)
elif args.action == "connection":
dispatch_connection_commands(args)
elif args.action == "run":
dispatch_run_commands(args)
elif args.action == "config":
dispatch_config_commands(args)
elif args.action == "tool":
dispatch_tool_commands(args)
elif args.action == "upgrade":
upgrade_version(args)
elif args.action == "experiment":
dispatch_experiment_commands(args)
except KeyboardInterrupt as ex:
logger.debug("Keyboard interrupt is captured.")
# raise UserErrorException(error=ex)
# Cant't raise UserErrorException due to the code exit(1) of promptflow._cli._utils.py line 368.
raise ex
except SystemExit as ex: # some code directly call sys.exit, this is to make sure command metadata is logged
exit_code = ex.code if ex.code is not None else 1
logger.debug(f"Code directly call sys.exit with code {exit_code}")
# raise UserErrorException(error=ex)
# Cant't raise UserErrorException due to the code exit(1) of promptflow._cli._utils.py line 368.
raise ex
except Exception as ex:
logger.debug(f"Command {args} execute failed. {str(ex)}")
# raise UserErrorException(error=ex)
# Cant't raise UserErrorException due to the code exit(1) of promptflow._cli._utils.py line 368.
raise ex
finally:
# Log the invoke finish time
invoke_finish_time = time.perf_counter()
logger.info(
"Command ran in %.3f seconds (init: %.3f, invoke: %.3f)",
invoke_finish_time - start_time,
init_finish_time - start_time,
invoke_finish_time - init_finish_time,
)
def get_parser_args(argv):
parser = argparse.ArgumentParser(
prog="pf",
formatter_class=argparse.RawDescriptionHelpFormatter,
description="pf: manage prompt flow assets. Learn more: https://microsoft.github.io/promptflow.",
)
parser.add_argument(
"-v", "--version", dest="version", action="store_true", help="show current CLI version and exit"
)
subparsers = parser.add_subparsers()
add_upgrade_parser(subparsers)
add_flow_parser(subparsers)
add_connection_parser(subparsers)
add_run_parser(subparsers)
add_config_parser(subparsers)
add_tool_parser(subparsers)
if Configuration.get_instance().is_internal_features_enabled():
add_experiment_parser(subparsers)
return parser.prog, parser.parse_args(argv)
def entry(argv):
"""
Control plane CLI tools for promptflow.
"""
prog, args = get_parser_args(argv)
if hasattr(args, "user_agent"):
setup_user_agent_to_operation_context(args.user_agent)
logger = get_telemetry_logger()
activity_name = _get_cli_activity_name(cli=prog, args=args)
activity_name = update_activity_name(activity_name, args=args)
with log_activity(
logger,
activity_name,
activity_type=ActivityType.PUBLICAPI,
):
run_command(args)
def main():
"""Entrance of pf CLI."""
command_args = sys.argv[1:]
if len(command_args) == 1 and command_args[0] == "version":
version_dict = {"promptflow": get_promptflow_sdk_version()}
version_dict_string = json.dumps(version_dict, ensure_ascii=False, indent=2, sort_keys=True,
separators=(",", ": ")) + "\n"
print(version_dict_string)
return
if len(command_args) == 0:
# print privacy statement & welcome message like azure-cli
show_privacy_statement()
show_welcome_message()
command_args.append("-h")
elif len(command_args) == 1:
# pf only has "pf --version" with 1 layer
if command_args[0] not in ["--version", "-v", "upgrade"]:
command_args.append("-h")
setup_user_agent_to_operation_context(USER_AGENT)
entry(command_args)
if __name__ == "__main__":
main()
| promptflow/src/promptflow/promptflow/_cli/_pf/entry.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_cli/_pf/entry.py",
"repo_id": "promptflow",
"token_count": 2529
} | 26 |
$schema: https://azuremlschemas.azureedge.net/promptflow/latest/Flow.schema.json
inputs:
{% for arg, typ in flow_inputs.items() %}
{{ arg }}:
type: {{ typ }}
{% endfor %}
outputs:
output:
type: string
reference: {% raw %}${{% endraw %}{{ main_node_name }}.output}
nodes:
{% for param_name, file in prompt_params.items() %}
- name: {{ param_name }}
type: prompt
source:
type: code
path: {{ file }}
inputs: # Please check the generated prompt inputs
{% for arg in prompt_inputs[param_name].keys() %}
{{ arg }}: ${inputs.{{ arg }}}
{% endfor %}
{% endfor %}
- name: {{ main_node_name }}
type: python
source:
type: code
path: {{ tool_file }}
inputs:
{# Below are node inputs link to flow inputs #}
{% for arg in func_params.keys() %}
{{ arg }}: ${inputs.{{ arg }}}
{% endfor %}
{# Below are node prompt template inputs from prompt nodes #}
{% for param_name, file in prompt_params.items() %}
{{ param_name }}: {% raw %}${{% endraw %}{{ param_name }}.output}
{% endfor %}
connection: custom_connection
{% if setup_sh or python_requirements_txt %}
environment:
{% if setup_sh %}
setup_sh: {{ setup_sh }}
{% endif %}
{% if python_requirements_txt %}
python_requirements_txt: {{ python_requirements_txt }}
{% endif %}
{% endif %}
| promptflow/src/promptflow/promptflow/_cli/data/entry_flow/flow.dag.yaml.jinja2/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_cli/data/entry_flow/flow.dag.yaml.jinja2",
"repo_id": "promptflow",
"token_count": 517
} | 27 |
{"text": "Hello World!"}
| promptflow/src/promptflow/promptflow/_cli/data/standard_flow/data.jsonl/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_cli/data/standard_flow/data.jsonl",
"repo_id": "promptflow",
"token_count": 9
} | 28 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import asyncio
import json
from contextvars import ContextVar
from datetime import datetime, timezone
from types import GeneratorType
from typing import Any, Dict, List, Mapping, Optional, Union
from promptflow._core._errors import FlowOutputUnserializable, RunRecordNotFound, ToolCanceledError
from promptflow._core.log_manager import NodeLogManager
from promptflow._core.thread_local_singleton import ThreadLocalSingleton
from promptflow._utils.dataclass_serializer import serialize
from promptflow._utils.exception_utils import ExceptionPresenter
from promptflow._utils.logger_utils import flow_logger
from promptflow._utils.multimedia_utils import default_json_encoder
from promptflow._utils.openai_metrics_calculator import OpenAIMetricsCalculator
from promptflow.contracts.run_info import FlowRunInfo, RunInfo, Status
from promptflow.contracts.run_mode import RunMode
from promptflow.contracts.tool import ConnectionType
from promptflow.exceptions import ErrorTarget
from promptflow.storage import AbstractRunStorage
from promptflow.storage._run_storage import DummyRunStorage
class RunTracker(ThreadLocalSingleton):
RUN_CONTEXT_NAME = "CurrentRun"
CONTEXT_VAR_NAME = "RunTracker"
context_var = ContextVar(CONTEXT_VAR_NAME, default=None)
@staticmethod
def init_dummy() -> "RunTracker":
return RunTracker(DummyRunStorage())
def __init__(self, run_storage: AbstractRunStorage, run_mode: RunMode = RunMode.Test, node_log_manager=None):
self._node_runs: Dict[str, RunInfo] = {}
self._flow_runs: Dict[str, FlowRunInfo] = {}
self._current_run_id = ""
self._run_context = ContextVar(self.RUN_CONTEXT_NAME, default="")
self._storage = run_storage
self._debug = True # TODO: Make this configurable
self.node_log_manager = node_log_manager or NodeLogManager()
self._has_failed_root_run = False
self._run_mode = run_mode
self._allow_generator_types = False
@property
def allow_generator_types(self):
return self._allow_generator_types
@allow_generator_types.setter
def allow_generator_types(self, value: bool):
self._allow_generator_types = value
@property
def node_run_list(self):
# Add list() to make node_run_list a new list object,
# therefore avoid iterating over a dictionary, which might be updated by another thread.
return list(self._node_runs.values())
@property
def flow_run_list(self):
# Add list() to make flow_run_list a new list object,
# therefore avoid iterating over a dictionary, which might be updated by another thread.
return list(self._flow_runs.values())
def set_current_run_in_context(self, run_id: str):
self._run_context.set(run_id)
def get_current_run_in_context(self) -> str:
return self._run_context.get()
def start_flow_run(
self,
flow_id,
root_run_id,
run_id,
parent_run_id="",
inputs=None,
index=None,
variant_id="",
) -> FlowRunInfo:
"""Create a flow run and save to run storage on demand."""
run_info = FlowRunInfo(
run_id=run_id,
status=Status.Running,
error=None,
inputs=inputs,
output=None,
metrics=None,
request=None,
parent_run_id=parent_run_id,
root_run_id=root_run_id,
source_run_id=None,
flow_id=flow_id,
start_time=datetime.utcnow(),
end_time=None,
index=index,
variant_id=variant_id,
)
self.persist_flow_run(run_info)
self._flow_runs[run_id] = run_info
self._current_run_id = run_id
return run_info
def start_node_run(
self,
node,
flow_run_id,
parent_run_id,
run_id,
index,
):
run_info = RunInfo(
node=node,
run_id=run_id,
flow_run_id=flow_run_id,
status=Status.Running,
inputs=None,
output=None,
metrics=None,
error=None,
parent_run_id=parent_run_id,
start_time=datetime.utcnow(),
end_time=None,
)
self._node_runs[run_id] = run_info
self._current_run_id = run_id
self.set_current_run_in_context(run_id)
self.node_log_manager.set_node_context(run_id, node, index)
return run_info
def bypass_node_run(
self,
node,
flow_run_id,
parent_run_id,
run_id,
index,
variant_id,
):
run_info = RunInfo(
node=node,
run_id=run_id,
flow_run_id=flow_run_id,
parent_run_id=parent_run_id,
status=Status.Bypassed,
inputs=None,
output=None,
metrics=None,
error=None,
start_time=datetime.utcnow(),
end_time=datetime.utcnow(),
result=None,
index=index,
variant_id=variant_id,
api_calls=[],
)
self._node_runs[run_id] = run_info
return run_info
def _flow_run_postprocess(self, run_info: FlowRunInfo, output, ex: Optional[Exception]):
if output:
try:
self._assert_flow_output_serializable(output)
except Exception as e:
output, ex = None, e
self._common_postprocess(run_info, output, ex)
def _update_flow_run_info_with_node_runs(self, run_info: FlowRunInfo):
run_id = run_info.run_id
child_run_infos = self.collect_child_node_runs(run_id)
run_info.system_metrics = run_info.system_metrics or {}
run_info.system_metrics.update(self.collect_metrics(child_run_infos, self.OPENAI_AGGREGATE_METRICS))
# TODO: Refactor Tracer to support flow level tracing,
# then we can remove the hard-coded root level api_calls here.
# It has to be a list for UI backward compatibility.
# TODO: Add input, output, error to top level. Adding them would require
# the same technique of handingling image and generator in Tracer,
# which introduces duplicated logic. We should do it in the refactoring.
start_timestamp = run_info.start_time.astimezone(timezone.utc).timestamp() if run_info.start_time else None
end_timestamp = run_info.end_time.astimezone(timezone.utc).timestamp() if run_info.end_time else None
run_info.api_calls = [
{
"name": "flow",
"node_name": "flow",
"type": "Flow",
"start_time": start_timestamp,
"end_time": end_timestamp,
"children": self._collect_traces_from_nodes(run_id),
"system_metrics": run_info.system_metrics,
}
]
def _node_run_postprocess(self, run_info: RunInfo, output, ex: Optional[Exception]):
run_id = run_info.run_id
self.set_openai_metrics(run_id)
logs = self.node_log_manager.get_logs(run_id)
run_info.logs = logs
self.node_log_manager.clear_node_context(run_id)
if run_info.inputs:
run_info.inputs = self._ensure_inputs_is_json_serializable(run_info.inputs, run_info.node)
if output is not None:
msg = f"Output of {run_info.node} is not json serializable, use str to store it."
output = self._ensure_serializable_value(output, msg)
self._common_postprocess(run_info, output, ex)
def _common_postprocess(self, run_info, output, ex):
if output is not None:
# Duplicated fields for backward compatibility.
run_info.result = output
run_info.output = output
if ex is not None:
self._enrich_run_info_with_exception(run_info=run_info, ex=ex)
else:
run_info.status = Status.Completed
run_info.end_time = datetime.utcnow()
if not isinstance(run_info.start_time, datetime):
flow_logger.warning(
f"Run start time {run_info.start_time} for {run_info.run_id} is not a datetime object, "
f"got {run_info.start_time}, type={type(run_info.start_time)}."
)
else:
duration = (run_info.end_time - run_info.start_time).total_seconds()
run_info.system_metrics = run_info.system_metrics or {}
run_info.system_metrics["duration"] = duration
def cancel_node_runs(self, msg: str, flow_run_id):
node_runs = self.collect_node_runs(flow_run_id)
for node_run_info in node_runs:
if node_run_info.status != Status.Running:
continue
msg = msg.rstrip(".") # Avoid duplicated "." in the end of the message.
err = ToolCanceledError(
message_format="Tool execution is canceled because of the error: {msg}.",
msg=msg,
target=ErrorTarget.EXECUTOR,
)
self.end_run(node_run_info.run_id, ex=err)
node_run_info.status = Status.Canceled
self.persist_node_run(node_run_info)
def end_run(
self,
run_id: str,
*,
result: Optional[dict] = None,
ex: Optional[Exception] = None,
traces: Optional[List] = None,
):
run_info = self._flow_runs.get(run_id) or self._node_runs.get(run_id)
if run_info is None:
raise RunRecordNotFound(
message_format=(
"Run record with ID '{run_id}' was not tracked in promptflow execution. "
"Please contact support for further assistance."
),
target=ErrorTarget.RUN_TRACKER,
run_id=run_id,
)
# If the run is already canceled, do nothing.
if run_info.status == Status.Canceled:
return run_info
if isinstance(run_info, FlowRunInfo):
self._flow_run_postprocess(run_info, result, ex)
if traces:
run_info.api_calls = traces
elif isinstance(run_info, RunInfo):
run_info.api_calls = traces
self._node_run_postprocess(run_info, result, ex)
return run_info
def _ensure_serializable_value(self, val, warning_msg: Optional[str] = None):
if ConnectionType.is_connection_value(val):
return ConnectionType.serialize_conn(val)
if self.allow_generator_types and isinstance(val, GeneratorType):
return str(val)
try:
json.dumps(val, default=default_json_encoder)
return val
except Exception:
if not warning_msg:
raise
flow_logger.warning(warning_msg)
return repr(val)
def _ensure_inputs_is_json_serializable(self, inputs: dict, node_name: str) -> dict:
return {
k: self._ensure_serializable_value(
v, f"Input '{k}' of {node_name} is not json serializable, use str to store it."
)
for k, v in inputs.items()
}
def _assert_flow_output_serializable(self, output: Any) -> Any:
def _wrap_serializable_error(value):
try:
return self._ensure_serializable_value(value)
except Exception as e:
# If a specific key-value pair is not serializable, raise an exception with the key.
error_type_and_message = f"({e.__class__.__name__}) {e}"
message_format = (
"The output '{output_name}' for flow is incorrect. The output value is not JSON serializable. "
"JSON dump failed: {error_type_and_message}. Please verify your flow output and "
"make sure the value serializable."
)
raise FlowOutputUnserializable(
message_format=message_format,
target=ErrorTarget.FLOW_EXECUTOR,
output_name=k,
error_type_and_message=error_type_and_message,
) from e
# support primitive outputs in eager mode
if not isinstance(output, dict):
return _wrap_serializable_error(output)
serializable_output = {}
for k, v in output.items():
serializable_output[k] = _wrap_serializable_error(v)
return serializable_output
def _enrich_run_info_with_exception(self, run_info: Union[RunInfo, FlowRunInfo], ex: Exception):
"""Update exception details into run info."""
# Update status to Cancelled the run terminates because of KeyboardInterruption or CancelledError.
if isinstance(ex, KeyboardInterrupt) or isinstance(ex, asyncio.CancelledError):
run_info.status = Status.Canceled
else:
run_info.error = ExceptionPresenter.create(ex).to_dict(include_debug_info=self._debug)
run_info.status = Status.Failed
def collect_all_run_infos_as_dicts(self) -> Mapping[str, List[Mapping[str, Any]]]:
flow_runs = self.flow_run_list
node_runs = self.node_run_list
return {
"flow_runs": [serialize(run) for run in flow_runs],
"node_runs": [serialize(run) for run in node_runs],
}
def collect_node_runs(self, flow_run_id: Optional[str] = None) -> List[RunInfo]:
"""If flow_run_id is None, return all node runs."""
if flow_run_id:
return [run_info for run_info in self.node_run_list if run_info.flow_run_id == flow_run_id]
return [run_info for run_info in self.node_run_list]
def collect_child_node_runs(self, parent_run_id: str) -> List[RunInfo]:
return [run_info for run_info in self.node_run_list if run_info.parent_run_id == parent_run_id]
def ensure_run_info(self, run_id: str) -> Union[RunInfo, FlowRunInfo]:
run_info = self._node_runs.get(run_id) or self._flow_runs.get(run_id)
if run_info is None:
raise RunRecordNotFound(
message_format=(
"Run record with ID '{run_id}' was not tracked in promptflow execution. "
"Please contact support for further assistance."
),
target=ErrorTarget.RUN_TRACKER,
run_id=run_id,
)
return run_info
def set_inputs(self, run_id: str, inputs: Mapping[str, Any]):
run_info = self.ensure_run_info(run_id)
run_info.inputs = inputs
def set_openai_metrics(self, run_id: str):
# TODO: Provide a common implementation for different internal metrics
run_info = self.ensure_run_info(run_id)
calls = run_info.api_calls or []
total_metrics = {}
calculator = OpenAIMetricsCalculator(flow_logger)
for call in calls:
metrics = calculator.get_openai_metrics_from_api_call(call)
calculator.merge_metrics_dict(total_metrics, metrics)
run_info.system_metrics = run_info.system_metrics or {}
run_info.system_metrics.update(total_metrics)
def _collect_traces_from_nodes(self, run_id):
child_run_infos = self.collect_child_node_runs(run_id)
traces = []
for node_run_info in child_run_infos:
traces.extend(node_run_info.api_calls or [])
return traces
OPENAI_AGGREGATE_METRICS = ["prompt_tokens", "completion_tokens", "total_tokens"]
def collect_metrics(self, run_infos: List[RunInfo], aggregate_metrics: List[str] = []):
if not aggregate_metrics:
return {}
total_metrics = {}
for run_info in run_infos:
if not run_info.system_metrics:
continue
for metric in aggregate_metrics:
total_metrics[metric] = total_metrics.get(metric, 0) + run_info.system_metrics.get(metric, 0)
return total_metrics
def get_run(self, run_id):
return self._node_runs.get(run_id) or self._flow_runs.get(run_id)
def persist_node_run(self, run_info: RunInfo):
self._storage.persist_node_run(run_info)
def persist_selected_node_runs(self, run_info: FlowRunInfo, node_names: List[str]):
"""
Persists the node runs for the specified node names.
:param run_info: The flow run information.
:type run_info: FlowRunInfo
:param node_names: The names of the nodes to persist.
:type node_names: List[str]
:returns: None
"""
run_id = run_info.run_id
selected_node_run_info = (
run_info for run_info in self.collect_child_node_runs(run_id) if run_info.node in node_names
)
for node_run_info in selected_node_run_info:
self.persist_node_run(node_run_info)
def persist_flow_run(self, run_info: FlowRunInfo):
self._storage.persist_flow_run(run_info)
def get_status_summary(self, run_id: str):
node_run_infos = self.collect_node_runs(run_id)
status_summary = {}
for run_info in node_run_infos:
node_name = run_info.node
if run_info.index is not None:
# Only consider Completed, Bypassed and Failed status, because the UX only support three status.
if run_info.status in (Status.Completed, Status.Bypassed, Status.Failed):
node_status_key = f"__pf__.nodes.{node_name}.{run_info.status.value.lower()}"
status_summary[node_status_key] = status_summary.setdefault(node_status_key, 0) + 1
# For reduce node, the index is None.
else:
status_summary[f"__pf__.nodes.{node_name}.completed"] = 1 if run_info.status == Status.Completed else 0
# Runtime will start root flow run with run_id == root_run_id,
# line flow run will have run id f"{root_run_id}_{line_number}"
# We filter out root flow run accordingly.
line_flow_run_infos = [
flow_run_info
for flow_run_info in self.flow_run_list
if flow_run_info.root_run_id == run_id and flow_run_info.run_id != run_id
]
total_lines = len(line_flow_run_infos)
completed_lines = len(
[flow_run_info for flow_run_info in line_flow_run_infos if flow_run_info.status == Status.Completed]
)
status_summary["__pf__.lines.completed"] = completed_lines
status_summary["__pf__.lines.failed"] = total_lines - completed_lines
return status_summary
def persist_status_summary(self, status_summary: Dict[str, int], run_id: str):
self._storage.persist_status_summary(status_summary, run_id)
| promptflow/src/promptflow/promptflow/_core/run_tracker.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_core/run_tracker.py",
"repo_id": "promptflow",
"token_count": 8635
} | 29 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import datetime
from enum import Enum
from typing import List, Optional, Union
from sqlalchemy import TEXT, Boolean, Column, Index
from sqlalchemy.exc import IntegrityError
from sqlalchemy.orm import declarative_base
from promptflow._sdk._constants import EXPERIMENT_CREATED_ON_INDEX_NAME, EXPERIMENT_TABLE_NAME, ListViewType
from promptflow._sdk._errors import ExperimentExistsError, ExperimentNotFoundError
from .retry import sqlite_retry
from .session import mgmt_db_session
from ...exceptions import UserErrorException, ErrorTarget
Base = declarative_base()
class Experiment(Base):
__tablename__ = EXPERIMENT_TABLE_NAME
name = Column(TEXT, primary_key=True)
created_on = Column(TEXT, nullable=False) # ISO8601("YYYY-MM-DD HH:MM:SS.SSS"), string
status = Column(TEXT, nullable=False)
description = Column(TEXT) # updated by users
properties = Column(TEXT)
archived = Column(Boolean, default=False)
nodes = Column(TEXT) # json(list of json) string
node_runs = Column(TEXT) # json(list of json) string
# NOTE: please always add columns to the tail, so that we can easily handle schema changes;
# also don't forget to update `__pf_schema_version__` when you change the schema
# NOTE: keep in mind that we need to well handle runs with legacy schema;
# normally new fields will be `None`, remember to handle them properly
last_start_time = Column(TEXT) # ISO8601("YYYY-MM-DD HH:MM:SS.SSS"), string
last_end_time = Column(TEXT) # ISO8601("YYYY-MM-DD HH:MM:SS.SSS"), string
data = Column(TEXT) # json string of data (list of dict)
inputs = Column(TEXT) # json string of inputs (list of dict)
__table_args__ = (Index(EXPERIMENT_CREATED_ON_INDEX_NAME, "created_on"),)
# schema version, increase the version number when you change the schema
__pf_schema_version__ = "1"
@sqlite_retry
def dump(self) -> None:
with mgmt_db_session() as session:
try:
session.add(self)
session.commit()
except IntegrityError as e:
# catch "sqlite3.IntegrityError: UNIQUE constraint failed: run_info.name" to raise RunExistsError
# otherwise raise the original error
if "UNIQUE constraint failed" not in str(e):
raise
raise ExperimentExistsError(f"Experiment name {self.name!r} already exists.")
except Exception as e:
raise UserErrorException(target=ErrorTarget.CONTROL_PLANE_SDK, message=str(e), error=e)
@sqlite_retry
def archive(self) -> None:
if self.archived is True:
return
self.archived = True
with mgmt_db_session() as session:
session.query(Experiment).filter(Experiment.name == self.name).update({"archived": self.archived})
session.commit()
@sqlite_retry
def restore(self) -> None:
if self.archived is False:
return
self.archived = False
with mgmt_db_session() as session:
session.query(Experiment).filter(Experiment.name == self.name).update({"archived": self.archived})
session.commit()
@sqlite_retry
def update(
self,
*,
status: Optional[str] = None,
description: Optional[str] = None,
last_start_time: Optional[Union[str, datetime.datetime]] = None,
last_end_time: Optional[Union[str, datetime.datetime]] = None,
node_runs: Optional[str] = None,
) -> None:
update_dict = {}
if status is not None:
self.status = status
update_dict["status"] = self.status
if description is not None:
self.description = description
update_dict["description"] = self.description
if last_start_time is not None:
self.last_start_time = last_start_time if isinstance(last_start_time, str) else last_start_time.isoformat()
update_dict["last_start_time"] = self.last_start_time
if last_end_time is not None:
self.last_end_time = last_end_time if isinstance(last_end_time, str) else last_end_time.isoformat()
update_dict["last_end_time"] = self.last_end_time
if node_runs is not None:
self.node_runs = node_runs
update_dict["node_runs"] = self.node_runs
with mgmt_db_session() as session:
session.query(Experiment).filter(Experiment.name == self.name).update(update_dict)
session.commit()
@staticmethod
@sqlite_retry
def get(name: str) -> "Experiment":
with mgmt_db_session() as session:
run_info = session.query(Experiment).filter(Experiment.name == name).first()
if run_info is None:
raise ExperimentNotFoundError(f"Experiment {name!r} cannot be found.")
return run_info
@staticmethod
@sqlite_retry
def list(max_results: Optional[int], list_view_type: ListViewType) -> List["Experiment"]:
with mgmt_db_session() as session:
basic_statement = session.query(Experiment)
# filter by archived
list_view_type = list_view_type.value if isinstance(list_view_type, Enum) else list_view_type
if list_view_type == ListViewType.ACTIVE_ONLY.value:
basic_statement = basic_statement.filter(Experiment.archived == False) # noqa: E712
elif list_view_type == ListViewType.ARCHIVED_ONLY.value:
basic_statement = basic_statement.filter(Experiment.archived == True) # noqa: E712
basic_statement = basic_statement.order_by(Experiment.created_on.desc())
if isinstance(max_results, int):
return [result for result in basic_statement.limit(max_results)]
else:
return [result for result in basic_statement.all()]
@staticmethod
@sqlite_retry
def delete(name: str) -> None:
with mgmt_db_session() as session:
result = session.query(Experiment).filter(Experiment.name == name).first()
if result is not None:
session.delete(result)
session.commit()
else:
raise ExperimentNotFoundError(f"Experiment {name!r} cannot be found.")
| promptflow/src/promptflow/promptflow/_sdk/_orm/experiment.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_sdk/_orm/experiment.py",
"repo_id": "promptflow",
"token_count": 2618
} | 30 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
from promptflow._sdk._service.entry import main
import sys
import win32serviceutil # ServiceFramework and commandline helper
import win32service # Events
import servicemanager # Simple setup and logging
class PromptFlowService:
"""Silly little application stub"""
def stop(self):
"""Stop the service"""
self.running = False
def run(self):
"""Main service loop. This is where work is done!"""
self.running = True
while self.running:
main() # Important work
servicemanager.LogInfoMsg("Service running...")
class PromptFlowServiceFramework(win32serviceutil.ServiceFramework):
_svc_name_ = 'PromptFlowService'
_svc_display_name_ = 'Prompt Flow Service'
def SvcStop(self):
"""Stop the service"""
self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING)
self.service_impl.stop()
self.ReportServiceStatus(win32service.SERVICE_STOPPED)
def SvcDoRun(self):
"""Start the service; does not return until stopped"""
self.ReportServiceStatus(win32service.SERVICE_START_PENDING)
self.service_impl = PromptFlowService()
self.ReportServiceStatus(win32service.SERVICE_RUNNING)
# Run the service
self.service_impl.run()
def init():
if len(sys.argv) == 1:
servicemanager.Initialize()
servicemanager.PrepareToHostSingle(PromptFlowServiceFramework)
servicemanager.StartServiceCtrlDispatcher()
else:
win32serviceutil.HandleCommandLine(PromptFlowServiceFramework)
if __name__ == '__main__':
init()
| promptflow/src/promptflow/promptflow/_sdk/_service/pfsvc.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_sdk/_service/pfsvc.py",
"repo_id": "promptflow",
"token_count": 630
} | 31 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import contextlib
import functools
import threading
import uuid
from contextvars import ContextVar
from datetime import datetime
from typing import Any, Dict
from promptflow._sdk._telemetry.telemetry import TelemetryMixin
from promptflow._sdk._utils import ClientUserAgentUtil
from promptflow.exceptions import _ErrorInfo
class ActivityType(object):
"""The type of activity (code) monitored.
The default type is "PublicAPI".
"""
PUBLICAPI = "PublicApi" # incoming public API call (default)
INTERNALCALL = "InternalCall" # internal (function) call
CLIENTPROXY = "ClientProxy" # an outgoing service API call
class ActivityCompletionStatus(object):
"""The activity (code) completion status, success, or failure."""
SUCCESS = "Success"
FAILURE = "Failure"
request_id_context = ContextVar("request_id_context", default=None)
def log_activity_start(activity_info: Dict[str, Any], logger) -> None:
"""Log activity start.
Sample activity_info:
{
"request_id": "request_id",
"first_call": True,
"activity_name": "activity_name",
"activity_type": "activity_type",
"user_agent": "user_agent",
}
:param activity_info: The custom properties of the activity to record.
:type activity_info: dict
:param logger: The logger adapter.
:type logger: logging.LoggerAdapter
"""
message = f"{activity_info['activity_name']}.start"
logger.info(message, extra={"custom_dimensions": activity_info})
pass
def log_activity_end(activity_info: Dict[str, Any], logger) -> None:
"""Log activity end.
Sample activity_info for success (start info plus run info):
{
...,
"duration_ms": 1000
"completion_status": "Success",
}
Sample activity_info for failure (start info plus error info):
{
...,
"duration_ms": 1000
"completion_status": "Failure",
"error_category": "error_category",
"error_type": "error_type",
"error_target": "error_target",
"error_message": "error_message",
"error_detail": "error_detail"
}
Error target & error type can be found in the following link:
https://github.com/microsoft/promptflow/blob/main/src/promptflow/promptflow/exceptions.py
:param activity_info: The custom properties of the activity.
:type activity_info: dict
:param logger: The logger adapter.
:type logger: logging.LoggerAdapter
"""
try:
# we will fail this log if activity_name/completion_status is not in activity_info, so directly use get()
message = f"{activity_info['activity_name']}.complete"
if activity_info["completion_status"] == ActivityCompletionStatus.FAILURE:
logger.error(message, extra={"custom_dimensions": activity_info})
else:
logger.info(message, extra={"custom_dimensions": activity_info})
except Exception: # pylint: disable=broad-except
# skip if logger failed to log
pass # pylint: disable=lost-exception
def generate_request_id():
return str(uuid.uuid4())
@contextlib.contextmanager
def log_activity(
logger,
activity_name,
activity_type=ActivityType.INTERNALCALL,
custom_dimensions=None,
):
"""Log an activity.
An activity is a logical block of code that consumers want to monitor.
To monitor, wrap the logical block of code with the ``log_activity()`` method. As an alternative, you can
also use the ``@monitor_with_activity`` decorator.
:param logger: The logger adapter.
:type logger: logging.LoggerAdapter
:param activity_name: The name of the activity. The name should be unique per the wrapped logical code block.
:type activity_name: str
:param activity_type: One of PUBLICAPI, INTERNALCALL, or CLIENTPROXY which represent an incoming API call,
an internal (function) call, or an outgoing API call. If not specified, INTERNALCALL is used.
:type activity_type: str
:param custom_dimensions: The custom properties of the activity.
:type custom_dimensions: dict
:return: None
"""
if not custom_dimensions:
custom_dimensions = {}
user_agent = ClientUserAgentUtil.get_user_agent()
request_id = request_id_context.get()
if not request_id:
# public function call
first_call = True
request_id = generate_request_id()
request_id_context.set(request_id)
else:
first_call = False
activity_info = {
"request_id": request_id,
"first_call": first_call,
"activity_name": activity_name,
"activity_type": activity_type,
"user_agent": user_agent,
}
activity_info.update(custom_dimensions)
start_time = datetime.utcnow()
completion_status = ActivityCompletionStatus.SUCCESS
log_activity_start(activity_info, logger)
exception = None
try:
yield logger
except BaseException as e: # pylint: disable=broad-except
exception = e
completion_status = ActivityCompletionStatus.FAILURE
error_category, error_type, error_target, error_message, error_detail = _ErrorInfo.get_error_info(exception)
activity_info["error_category"] = error_category
activity_info["error_type"] = error_type
activity_info["error_target"] = error_target
activity_info["error_message"] = error_message
activity_info["error_detail"] = error_detail
finally:
if first_call:
# recover request id in global storage
request_id_context.set(None)
end_time = datetime.utcnow()
duration_ms = round((end_time - start_time).total_seconds() * 1000, 2)
activity_info["completion_status"] = completion_status
activity_info["duration_ms"] = duration_ms
log_activity_end(activity_info, logger)
# raise the exception to align with the behavior of the with statement
if exception:
raise exception
def extract_telemetry_info(self):
"""Extract pf telemetry info from given telemetry mix-in instance."""
result = {}
try:
if isinstance(self, TelemetryMixin):
return self._get_telemetry_values()
except Exception:
pass
return result
def update_activity_name(activity_name, kwargs=None, args=None):
"""Update activity name according to kwargs. For flow test, we want to know if it's node test."""
if activity_name == "pf.flows.test":
# SDK
if kwargs.get("node", None):
activity_name = "pf.flows.node_test"
elif activity_name == "pf.flow.test":
# CLI
if getattr(args, "node", None):
activity_name = "pf.flow.node_test"
return activity_name
def monitor_operation(
activity_name,
activity_type=ActivityType.INTERNALCALL,
custom_dimensions=None,
):
"""A wrapper for monitoring an activity in operations class.
To monitor, use the ``@monitor_operation`` decorator.
Note: this decorator should only use in operations class methods.
:param activity_name: The name of the activity. The name should be unique per the wrapped logical code block.
:type activity_name: str
:param activity_type: One of PUBLICAPI, INTERNALCALL, or CLIENTPROXY which represent an incoming API call,
an internal (function) call, or an outgoing API call. If not specified, INTERNALCALL is used.
:type activity_type: str
:param custom_dimensions: The custom properties of the activity.
:type custom_dimensions: dict
:return:
"""
if not custom_dimensions:
custom_dimensions = {}
def monitor(f):
@functools.wraps(f)
def wrapper(self, *args, **kwargs):
from promptflow._sdk._telemetry.telemetry import get_telemetry_logger
from promptflow._utils.version_hint_utils import HINT_ACTIVITY_NAME, check_latest_version, hint_for_update
logger = get_telemetry_logger()
custom_dimensions.update(extract_telemetry_info(self))
# update activity name according to kwargs.
_activity_name = update_activity_name(activity_name, kwargs=kwargs)
with log_activity(logger, _activity_name, activity_type, custom_dimensions):
if _activity_name in HINT_ACTIVITY_NAME:
hint_for_update()
# set check_latest_version as deamon thread to avoid blocking main thread
thread = threading.Thread(target=check_latest_version, daemon=True)
thread.start()
return f(self, *args, **kwargs)
return wrapper
return monitor
| promptflow/src/promptflow/promptflow/_sdk/_telemetry/activity.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_sdk/_telemetry/activity.py",
"repo_id": "promptflow",
"token_count": 3256
} | 32 |
Exported Dockerfile & its dependencies are located in the same folder. The structure is as below:
- flow: the folder contains all the flow files
- ...
- connections: the folder contains yaml files to create all related connections
- ...
- Dockerfile: the dockerfile to build the image
- settings.json: a json file to store the settings of the docker image
- README.md: the readme file to describe how to use the dockerfile
Please refer to [official doc](https://microsoft.github.io/promptflow/how-to-guides/deploy-and-export-a-flow.html#export-a-flow)
for more details about how to use the exported dockerfile and scripts.
| promptflow/src/promptflow/promptflow/_sdk/data/docker_csharp/README.md/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_sdk/data/docker_csharp/README.md",
"repo_id": "promptflow",
"token_count": 165
} | 33 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import copy
import datetime
import json
import shutil
import uuid
from os import PathLike
from pathlib import Path
from typing import Any, Dict, List, Optional, Union
from marshmallow import Schema
from promptflow._sdk._constants import (
BASE_PATH_CONTEXT_KEY,
PARAMS_OVERRIDE_KEY,
PROMPT_FLOW_DIR_NAME,
PROMPT_FLOW_EXP_DIR_NAME,
ExperimentNodeType,
ExperimentStatus,
)
from promptflow._sdk._errors import ExperimentValidationError, ExperimentValueError
from promptflow._sdk._orm.experiment import Experiment as ORMExperiment
from promptflow._sdk._submitter import remove_additional_includes
from promptflow._sdk._utils import _merge_local_code_and_additional_includes, _sanitize_python_variable_name
from promptflow._sdk.entities import Run
from promptflow._sdk.entities._validation import MutableValidationResult, SchemaValidatableMixin
from promptflow._sdk.entities._yaml_translatable import YAMLTranslatableMixin
from promptflow._sdk.schemas._experiment import (
CommandNodeSchema,
ExperimentDataSchema,
ExperimentInputSchema,
ExperimentSchema,
ExperimentTemplateSchema,
FlowNodeSchema,
)
from promptflow._utils.logger_utils import get_cli_sdk_logger
from promptflow.contracts.tool import ValueType
logger = get_cli_sdk_logger()
class ExperimentData(YAMLTranslatableMixin):
def __init__(self, name, path, **kwargs):
self.name = name
self.path = path
@classmethod
def _get_schema_cls(cls):
return ExperimentDataSchema
class ExperimentInput(YAMLTranslatableMixin):
def __init__(self, name, default, type, **kwargs):
self.name = name
self.type, self.default = self._resolve_type_and_default(type, default)
@classmethod
def _get_schema_cls(cls):
return ExperimentInputSchema
def _resolve_type_and_default(self, typ, default):
supported_types = [
ValueType.INT,
ValueType.STRING,
ValueType.DOUBLE,
ValueType.LIST,
ValueType.OBJECT,
ValueType.BOOL,
]
value_type: ValueType = next((i for i in supported_types if typ.lower() == i.value.lower()), None)
if value_type is None:
raise ExperimentValueError(f"Unknown experiment input type {typ!r}, supported are {supported_types}.")
return value_type.value, value_type.parse(default) if default is not None else None
@classmethod
def _load_from_dict(cls, data: Dict, context: Dict, additional_message: str = None, **kwargs):
# Override this to avoid 'type' got pop out
schema_cls = cls._get_schema_cls()
try:
loaded_data = schema_cls(context=context).load(data, **kwargs)
except Exception as e:
raise Exception(f"Load experiment input failed with {str(e)}. f{(additional_message or '')}.")
return cls(base_path=context[BASE_PATH_CONTEXT_KEY], **loaded_data)
class FlowNode(YAMLTranslatableMixin):
def __init__(
self,
path: Union[Path, str],
name: str,
# input fields are optional since it's not stored in DB
data: Optional[str] = None,
variant: Optional[str] = None,
run: Optional[Union["Run", str]] = None,
inputs: Optional[dict] = None,
display_name: Optional[str] = None,
description: Optional[str] = None,
tags: Optional[List[Dict[str, str]]] = None,
environment_variables: Optional[Dict[str, str]] = None,
connections: Optional[Dict[str, Dict]] = None,
properties: Optional[Dict[str, Any]] = None,
**kwargs,
):
self.type = ExperimentNodeType.FLOW
self.data = data
self.inputs = inputs
self.display_name = display_name
self.description = description
self.tags = tags
self.variant = variant
self.run = run
self.environment_variables = environment_variables or {}
self.connections = connections or {}
self._properties = properties or {}
# init here to make sure those fields initialized in all branches.
self.path = path
# default run name: flow directory name + timestamp
self.name = name
self._runtime = kwargs.get("runtime", None)
self._resources = kwargs.get("resources", None)
@classmethod
def _get_schema_cls(cls):
return FlowNodeSchema
def _save_snapshot(self, target):
"""Save flow source to experiment snapshot."""
# Resolve additional includes in flow
from promptflow import load_flow
Path(target).mkdir(parents=True, exist_ok=True)
flow = load_flow(source=self.path)
saved_flow_path = Path(target) / self.name
with _merge_local_code_and_additional_includes(code_path=flow.code) as resolved_flow_dir:
remove_additional_includes(Path(resolved_flow_dir))
shutil.copytree(src=resolved_flow_dir, dst=saved_flow_path)
logger.debug(f"Flow source saved to {saved_flow_path}.")
self.path = saved_flow_path.resolve().absolute().as_posix()
class CommandNode(YAMLTranslatableMixin):
def __init__(
self,
command,
name,
inputs=None,
outputs=None,
runtime=None,
environment_variables=None,
code=None,
display_name=None,
**kwargs,
):
self.type = ExperimentNodeType.COMMAND
self.name = name
self.display_name = display_name
self.code = code
self.command = command
self.inputs = inputs or {}
self.outputs = outputs or {}
self.runtime = runtime
self.environment_variables = environment_variables or {}
@classmethod
def _get_schema_cls(cls):
return CommandNodeSchema
def _save_snapshot(self, target):
"""Save command source to experiment snapshot."""
Path(target).mkdir(parents=True, exist_ok=True)
saved_path = Path(target) / self.name
if not self.code:
# Create an empty folder
saved_path.mkdir(parents=True, exist_ok=True)
self.code = saved_path.resolve().absolute().as_posix()
return
code = Path(self.code)
if not code.exists():
raise ExperimentValueError(f"Command node code {code} does not exist.")
if code.is_dir():
shutil.copytree(src=self.code, dst=saved_path)
else:
saved_path.mkdir(parents=True, exist_ok=True)
shutil.copy(src=self.code, dst=saved_path)
logger.debug(f"Command node source saved to {saved_path}.")
self.code = saved_path.resolve().absolute().as_posix()
class ExperimentTemplate(YAMLTranslatableMixin, SchemaValidatableMixin):
def __init__(self, nodes, name=None, description=None, data=None, inputs=None, **kwargs):
self._base_path = kwargs.get(BASE_PATH_CONTEXT_KEY, Path("."))
self.name = name or self._generate_name()
self.description = description
self.nodes = nodes
self.data = data or []
self.inputs = inputs or []
self._source_path = None
@classmethod
# pylint: disable=unused-argument
def _resolve_cls_and_type(cls, **kwargs):
return cls, "experiment_template"
@classmethod
def _get_schema_cls(cls):
return ExperimentTemplateSchema
@classmethod
def _load(
cls,
data: Optional[Dict] = None,
yaml_path: Optional[Union[PathLike, str]] = None,
params_override: Optional[list] = None,
**kwargs,
):
data = data or {}
params_override = params_override or []
context = {
BASE_PATH_CONTEXT_KEY: Path(yaml_path).parent if yaml_path else Path("./"),
PARAMS_OVERRIDE_KEY: params_override,
}
logger.debug(f"Loading class object with data {data}, params_override {params_override}, context {context}.")
exp = cls._load_from_dict(
data=data,
context=context,
additional_message="Failed to load experiment",
**kwargs,
)
if yaml_path:
exp._source_path = yaml_path
return exp
def _generate_name(self) -> str:
"""Generate a template name."""
try:
folder_name = Path(self._base_path).resolve().absolute().name
return _sanitize_python_variable_name(folder_name)
except Exception as e:
logger.debug(f"Failed to generate template name, error: {e}, use uuid.")
return str(uuid.uuid4())
@classmethod
def _load_from_dict(cls, data: Dict, context: Dict, additional_message: str = None, **kwargs):
schema_cls = cls._get_schema_cls()
try:
loaded_data = schema_cls(context=context).load(data, **kwargs)
except Exception as e:
raise Exception(f"Load experiment template failed with {str(e)}. f{(additional_message or '')}.")
return cls(base_path=context[BASE_PATH_CONTEXT_KEY], **loaded_data)
@classmethod
def _create_schema_for_validation(cls, context) -> Schema:
return cls._get_schema_cls()(context=context)
def _default_context(self) -> dict:
return {BASE_PATH_CONTEXT_KEY: self._base_path}
@classmethod
def _create_validation_error(cls, message: str, no_personal_data_message: str) -> Exception:
return ExperimentValidationError(
message=message,
no_personal_data_message=no_personal_data_message,
)
def _customized_validate(self) -> MutableValidationResult:
"""Validate the resource with customized logic.
Override this method to add customized validation logic.
:return: The customized validation result
:rtype: MutableValidationResult
"""
pass
class Experiment(ExperimentTemplate):
def __init__(
self,
nodes,
name=None,
data=None,
inputs=None,
status=ExperimentStatus.NOT_STARTED,
node_runs=None,
properties=None,
**kwargs,
):
self.name = name or self._generate_name()
self.status = status
self.node_runs = node_runs or {}
self.properties = properties or {}
self.created_on = kwargs.get("created_on", datetime.datetime.now().isoformat())
self.last_start_time = kwargs.get("last_start_time", None)
self.last_end_time = kwargs.get("last_end_time", None)
self.is_archived = kwargs.get("is_archived", False)
self._output_dir = Path.home() / PROMPT_FLOW_DIR_NAME / PROMPT_FLOW_EXP_DIR_NAME / self.name
super().__init__(nodes, name=self.name, data=data, inputs=inputs, **kwargs)
@classmethod
def _get_schema_cls(cls):
return ExperimentSchema
@classmethod
# pylint: disable=unused-argument
def _resolve_cls_and_type(cls, **kwargs):
return cls, "experiment"
def _generate_name(self) -> str:
"""Generate a experiment name."""
try:
folder_name = Path(self._base_path).resolve().absolute().name
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S_%f")
exp_name = f"{folder_name}_{timestamp}"
return _sanitize_python_variable_name(exp_name)
except Exception as e:
logger.debug(f"Failed to generate experiment name, error: {e}, use uuid.")
return str(uuid.uuid4())
def _save_snapshot_and_update_node(
self,
):
"""Save node source to experiment snapshot, update node path."""
snapshot_dir = self._output_dir / "snapshots"
for node in self.nodes:
node._save_snapshot(snapshot_dir)
def _append_node_run(self, node_name, run: Run):
"""Append node run to experiment."""
if node_name not in self.node_runs or not isinstance(self.node_runs[node_name], list):
self.node_runs[node_name] = []
# TODO: Review this
self.node_runs[node_name].append({"name": run.name, "status": run.status})
def _to_orm_object(self):
"""Convert to ORM object."""
result = ORMExperiment(
name=self.name,
description=self.description,
status=self.status,
created_on=self.created_on,
archived=self.is_archived,
last_start_time=self.last_start_time,
last_end_time=self.last_end_time,
properties=json.dumps(self.properties),
data=json.dumps([item._to_dict() for item in self.data]),
inputs=json.dumps([input._to_dict() for input in self.inputs]),
nodes=json.dumps([node._to_dict() for node in self.nodes]),
node_runs=json.dumps(self.node_runs),
)
logger.debug(f"Experiment to ORM object: {result.__dict__}")
return result
@classmethod
def _from_orm_object(cls, obj: ORMExperiment) -> "Experiment":
"""Create a experiment object from ORM object."""
nodes = []
context = {BASE_PATH_CONTEXT_KEY: "./"}
for node_dict in json.loads(obj.nodes):
if node_dict["type"] == ExperimentNodeType.FLOW:
nodes.append(
FlowNode._load_from_dict(node_dict, context=context, additional_message="Failed to load node.")
)
elif node_dict["type"] == ExperimentNodeType.COMMAND:
nodes.append(
CommandNode._load_from_dict(node_dict, context=context, additional_message="Failed to load node.")
)
else:
raise Exception(f"Unknown node type {node_dict['type']}")
data = [
ExperimentData._load_from_dict(item, context=context, additional_message="Failed to load experiment data")
for item in json.loads(obj.data)
]
inputs = [
ExperimentInput._load_from_dict(
item, context=context, additional_message="Failed to load experiment inputs"
)
for item in json.loads(obj.inputs)
]
return cls(
name=obj.name,
description=obj.description,
status=obj.status,
created_on=obj.created_on,
last_start_time=obj.last_start_time,
last_end_time=obj.last_end_time,
is_archived=obj.archived,
properties=json.loads(obj.properties),
data=data,
inputs=inputs,
nodes=nodes,
node_runs=json.loads(obj.node_runs),
)
@classmethod
def from_template(cls, template: ExperimentTemplate, name=None):
"""Create a experiment object from template."""
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S_%f")
exp_name = name or f"{template.name}_{timestamp}"
experiment = cls(
name=exp_name,
description=template.description,
data=copy.deepcopy(template.data),
inputs=copy.deepcopy(template.inputs),
nodes=copy.deepcopy(template.nodes),
base_path=template._base_path,
)
logger.debug("Start saving snapshot and update node.")
experiment._save_snapshot_and_update_node()
return experiment
| promptflow/src/promptflow/promptflow/_sdk/entities/_experiment.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_sdk/entities/_experiment.py",
"repo_id": "promptflow",
"token_count": 6676
} | 34 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import importlib.util
import inspect
import io
import json
import logging
import pkgutil
from dataclasses import asdict
from os import PathLike
from pathlib import Path
from types import ModuleType
from typing import Union
import jsonschema
from promptflow._core.tool_meta_generator import (
ToolValidationError,
_parse_tool_from_function,
asdict_without_none,
is_tool,
)
from promptflow._core.tools_manager import PACKAGE_TOOLS_ENTRY, collect_package_tools
from promptflow._sdk._constants import ICON, ICON_DARK, ICON_LIGHT, LOGGER_NAME, SKIP_FUNC_PARAMS, TOOL_SCHEMA
from promptflow._sdk._telemetry import ActivityType, monitor_operation
from promptflow._sdk.entities._validation import ValidationResult, ValidationResultBuilder
from promptflow._utils.multimedia_utils import convert_multimedia_data_to_base64
from promptflow.contracts.multimedia import Image
from promptflow.exceptions import UserErrorException
TOTAL_COUNT = "total_count"
INVALID_COUNT = "invalid_count"
logger = logging.getLogger(LOGGER_NAME)
class ToolOperations:
"""ToolOperations."""
def __init__(self):
self._tool_schema_dict = None
@property
def _tool_schema(self):
if not self._tool_schema_dict:
with open(TOOL_SCHEMA, "r") as f:
self._tool_schema_dict = json.load(f)
return self._tool_schema_dict
def _merge_validate_result(self, target, source):
target.merge_with(source)
target._set_extra_info(
TOTAL_COUNT,
target._get_extra_info(TOTAL_COUNT, 0) + source._get_extra_info(TOTAL_COUNT, 0),
)
target._set_extra_info(
INVALID_COUNT,
target._get_extra_info(INVALID_COUNT, 0) + source._get_extra_info(INVALID_COUNT, 0),
)
def _list_tools_in_package(self, package_name: str, raise_error: bool = False):
"""
List the meta of all tools in the package. Raise user error if raise_error=True and found incorrect tools.
:param package_name: Package name
:type package_name: str
:param raise_error: Whether to raise the error.
:type raise_error: bool
:return: Dict of tools meta
:rtype: Dict[str, Dict]
"""
package_tools, validate_result = self._list_tool_meta_in_package(package_name=package_name)
if not validate_result.passed:
if raise_error:
def tool_validate_error_func(msg, _):
return ToolValidationError(message=msg, validate_result=validate_result)
validate_result.try_raise(raise_error=raise_error, error_func=tool_validate_error_func)
else:
logger.warning(f"Found invalid tool(s):\n {repr(validate_result)}")
return package_tools
def _list_tool_meta_in_package(self, package_name: str):
"""
List the meta of all tools in the package.
:param package_name: Package name
:type package_name: str
:return: Dict of tools meta, validation result
:rtype: Dict[str, Dict], ValidationResult
"""
package_tools = {}
validate_result = ValidationResultBuilder.success()
try:
package = __import__(package_name)
module_list = pkgutil.walk_packages(package.__path__, prefix=package.__name__ + ".")
for module in module_list:
module_tools, module_validate_result = self._generate_tool_meta(importlib.import_module(module.name))
package_tools.update(module_tools)
self._merge_validate_result(validate_result, module_validate_result)
except ImportError as e:
raise UserErrorException(f"Cannot find the package {package_name}, {e}.")
return package_tools, validate_result
def _generate_tool_meta(self, tool_module):
"""
Generate tools meta in the module.
:param tool_module: The module needs to generate tools meta
:type tool_module: object
:return: Dict of tools meta, validation result
:rtype: Dict[str, Dict], ValidationResult
"""
tool_functions = self._collect_tool_functions_in_module(tool_module)
tool_methods = self._collect_tool_class_methods_in_module(tool_module)
construct_tools = {}
invalid_tool_count = 0
tool_validate_result = ValidationResultBuilder.success()
for f in tool_functions:
tool, input_settings, extra_info = self._parse_tool_from_func(f)
construct_tool, validate_result = self._serialize_tool(tool, input_settings, extra_info, f)
if validate_result.passed:
tool_name = self._get_tool_name(tool)
construct_tools[tool_name] = construct_tool
else:
invalid_tool_count = invalid_tool_count + 1
tool_validate_result.merge_with(validate_result)
for (f, initialize_inputs) in tool_methods:
tool, input_settings, extra_info = self._parse_tool_from_func(f, initialize_inputs)
construct_tool, validate_result = self._serialize_tool(tool, input_settings, extra_info, f)
if validate_result.passed:
tool_name = self._get_tool_name(tool)
construct_tools[tool_name] = construct_tool
else:
invalid_tool_count = invalid_tool_count + 1
tool_validate_result.merge_with(validate_result)
# The generated dict cannot be dumped as yaml directly since yaml cannot handle string enum.
tools = json.loads(json.dumps(construct_tools))
tool_validate_result._set_extra_info(TOTAL_COUNT, len(tool_functions) + len(tool_methods))
tool_validate_result._set_extra_info(INVALID_COUNT, invalid_tool_count)
return tools, tool_validate_result
@staticmethod
def _collect_tool_functions_in_module(tool_module):
tools = []
for _, obj in inspect.getmembers(tool_module):
if is_tool(obj):
# Note that the tool should be in defined in exec but not imported in exec,
# so it should also have the same module with the current function.
if getattr(obj, "__module__", "") != tool_module.__name__:
continue
tools.append(obj)
return tools
@staticmethod
def _collect_tool_class_methods_in_module(tool_module):
from promptflow._core.tool import ToolProvider
tools = []
for _, obj in inspect.getmembers(tool_module):
if isinstance(obj, type) and issubclass(obj, ToolProvider) and obj.__module__ == tool_module.__name__:
for _, method in inspect.getmembers(obj):
if is_tool(method):
initialize_inputs = obj.get_initialize_inputs()
tools.append((method, initialize_inputs))
return tools
def _get_tool_name(self, tool):
tool_name = (
f"{tool.module}.{tool.class_name}.{tool.function}"
if tool.class_name is not None
else f"{tool.module}.{tool.function}"
)
return tool_name
def _parse_tool_from_func(self, tool_func, initialize_inputs=None):
"""
Parse tool from tool function
:param tool_func: The tool function
:type tool_func: callable
:param initialize_inputs: Initialize inputs of tool
:type initialize_inputs: Dict[str, obj]
:return: tool object, tool input settings, extra info about the tool
:rtype: Tool, Dict[str, InputSetting], Dict[str, obj]
"""
tool = _parse_tool_from_function(
tool_func, initialize_inputs=initialize_inputs, gen_custom_type_conn=True, skip_prompt_template=True
)
extra_info = getattr(tool_func, "__extra_info")
input_settings = getattr(tool_func, "__input_settings")
return tool, input_settings, extra_info
def _validate_tool_function(self, tool, input_settings, extra_info, func_name=None, func_path=None):
"""
Check whether the icon and input settings of the tool are legitimate.
:param tool: The tool object
:type tool: Tool
:param input_settings: Input settings of the tool
:type input_settings: Dict[str, InputSetting]
:param extra_info: Extra info about the tool
:type extra_info: Dict[str, obj]
:param func_name: Function name of the tool
:type func_name: str
:param func_path: Script path of the tool
:type func_path: str
:return: Validation result of the tool
:rtype: ValidationResult
"""
validate_result = ValidationResultBuilder.success()
if extra_info:
if ICON in extra_info:
if ICON_LIGHT in extra_info or ICON_DARK in extra_info:
validate_result.append_error(
yaml_path=None,
message=f"Cannot provide both `icon` and `{ICON_LIGHT}` or `{ICON_DARK}`.",
function_name=func_name,
location=func_path,
key="function_name",
)
if input_settings:
input_settings_validate_result = self._validate_input_settings(
tool.inputs, input_settings, func_name, func_path
)
validate_result.merge_with(input_settings_validate_result)
return validate_result
def _validate_tool_schema(self, tool_dict, func_name=None, func_path=None):
"""
Check whether the generated schema of the tool are legitimate.
:param tool_dict: The generated tool dict
:type tool_dict: Dict[str, obj]
:param func_name: Function name of the tool
:type func_name: str
:param func_path: Script path of the tool
:type func_path: str
:return: Validation result of the tool
:rtype: ValidationResult
"""
validate_result = ValidationResultBuilder.success()
try:
jsonschema.validate(instance=tool_dict, schema=self._tool_schema)
except jsonschema.exceptions.ValidationError as e:
validate_result.append_error(
message=str(e), yaml_path=None, function_name=func_name, location=func_path, key="function_name"
)
return validate_result
def _validate_input_settings(self, tool_inputs, input_settings, func_name=None, func_path=None):
"""
Check whether input settings of the tool are legitimate.
:param tool_inputs: Tool inputs
:type tool_inputs: Dict[str, obj]
:param input_settings: Input settings of the tool
:type input_settings: Dict[str, InputSetting]
:param extra_info: Extra info about the tool
:type extra_info: Dict[str, obj]
:param func_name: Function name of the tool
:type func_name: str
:param func_path: Script path of the tool
:type func_path: str
:return: Validation result of the tool
:rtype: ValidationResult
"""
validate_result = ValidationResultBuilder.success()
for input_name, settings in input_settings.items():
if input_name not in tool_inputs:
validate_result.append_error(
yaml_path=None,
message=f"Cannot find {input_name} in tool inputs.",
function_name=func_name,
location=func_path,
key="function_name",
)
if settings.enabled_by and settings.enabled_by not in tool_inputs:
validate_result.append_error(
yaml_path=None,
message=f'Cannot find the input "{settings.enabled_by}" for the enabled_by of {input_name}.',
function_name=func_name,
location=func_path,
key="function_name",
)
if settings.dynamic_list:
dynamic_func_inputs = inspect.signature(settings.dynamic_list._func_obj).parameters
has_kwargs = any([param.kind == param.VAR_KEYWORD for param in dynamic_func_inputs.values()])
required_inputs = [
k
for k, v in dynamic_func_inputs.items()
if v.default is inspect.Parameter.empty and v.kind != v.VAR_KEYWORD and k not in SKIP_FUNC_PARAMS
]
if settings.dynamic_list._input_mapping:
# Validate input mapping in dynamic_list
for func_input, reference_input in settings.dynamic_list._input_mapping.items():
# Check invalid input name of dynamic list function
if not has_kwargs and func_input not in dynamic_func_inputs:
validate_result.append_error(
yaml_path=None,
message=f"Cannot find {func_input} in the inputs of "
f"dynamic_list func {settings.dynamic_list.func_path}",
function_name=func_name,
location=func_path,
key="function_name",
)
# Check invalid input name of tool
if reference_input not in tool_inputs:
validate_result.append_error(
yaml_path=None,
message=f"Cannot find {reference_input} in the tool inputs.",
function_name=func_name,
location=func_path,
key="function_name",
)
if func_input in required_inputs:
required_inputs.remove(func_input)
# Check required input of dynamic_list function
if len(required_inputs) != 0:
validate_result.append_error(
yaml_path=None,
message=f"Missing required input(s) of dynamic_list function: {required_inputs}",
function_name=func_name,
location=func_path,
key="function_name",
)
return validate_result
def _serialize_tool(self, tool, input_settings, extra_info, tool_func):
"""
Serialize tool obj to dict.
:param tool_func: Package tool function
:type tool_func: callable
:param initialize_inputs: Initialize inputs of package tool
:type initialize_inputs: Dict[str, obj]
:return: package tool name, serialized tool
:rtype: str, Dict[str, str]
"""
tool_func_name = tool_func.__name__
tool_script_path = inspect.getsourcefile(getattr(tool_func, "__original_function", tool_func))
validate_result = self._validate_tool_function(
tool, input_settings, extra_info, tool_func_name, tool_script_path
)
if validate_result.passed:
construct_tool = asdict(tool, dict_factory=lambda x: {k: v for (k, v) in x if v})
if extra_info:
if ICON in extra_info:
extra_info[ICON] = self._serialize_icon_data(extra_info["icon"])
if ICON_LIGHT in extra_info:
icon = extra_info.get("icon", {})
icon["light"] = self._serialize_icon_data(extra_info[ICON_LIGHT])
extra_info[ICON] = icon
if ICON_DARK in extra_info:
icon = extra_info.get("icon", {})
icon["dark"] = self._serialize_icon_data(extra_info[ICON_DARK])
extra_info[ICON] = icon
construct_tool.update(extra_info)
# Update tool input settings
if input_settings:
tool_inputs = construct_tool.get("inputs", {})
generated_by_inputs = {}
for input_name, settings in input_settings.items():
tool_inputs[input_name].update(asdict_without_none(settings))
if settings.generated_by:
generated_by_inputs.update(settings.generated_by._input_settings)
tool_inputs.update(generated_by_inputs)
schema_validate_result = self._validate_tool_schema(construct_tool, tool_func_name, tool_script_path)
validate_result.merge_with(schema_validate_result)
return construct_tool, validate_result
else:
return {}, validate_result
def _serialize_icon_data(self, icon):
if not Path(icon).exists():
raise UserErrorException(f"Cannot find the icon path {icon}.")
return self._serialize_image_data(icon)
@staticmethod
def _serialize_image_data(image_path):
"""Serialize image to base64."""
from PIL import Image as PIL_Image
with open(image_path, "rb") as image_file:
# Create a BytesIO object from the image file
image_data = io.BytesIO(image_file.read())
# Open the image and resize it
img = PIL_Image.open(image_data)
if img.size != (16, 16):
img = img.resize((16, 16), PIL_Image.Resampling.LANCZOS)
buffered = io.BytesIO()
img.save(buffered, format="PNG")
icon_image = Image(buffered.getvalue(), mime_type="image/png")
image_url = convert_multimedia_data_to_base64(icon_image, with_type=True)
return image_url
@staticmethod
def _is_package_tool(package) -> bool:
import pkg_resources
try:
distribution = pkg_resources.get_distribution(package.__name__)
entry_points = distribution.get_entry_map()
return PACKAGE_TOOLS_ENTRY in entry_points
except Exception as e:
logger.debug(f"Failed to check {package.__name__} is a package tool, raise {e}")
return False
@monitor_operation(activity_name="pf.tools.list", activity_type=ActivityType.PUBLICAPI)
def list(
self,
flow: Union[str, PathLike] = None,
):
"""
List all package tools in the environment and code tools in the flow.
:param flow: path to the flow directory
:type flow: Union[str, PathLike]
:return: Dict of package tools and code tools info.
:rtype: Dict[str, Dict]
"""
from promptflow._sdk._pf_client import PFClient
local_client = PFClient()
package_tools = collect_package_tools()
if flow:
tools, _ = local_client.flows._generate_tools_meta(flow)
else:
tools = {"package": {}, "code": {}}
tools["package"].update(package_tools)
return tools
@monitor_operation(activity_name="pf.tools.validate", activity_type=ActivityType.PUBLICAPI)
def validate(
self, source: Union[str, callable, PathLike], *, raise_error: bool = False, **kwargs
) -> ValidationResult:
"""
Validate tool.
:param source: path to the package tool directory or tool script
:type source: Union[str, callable, PathLike]
:param raise_error: whether raise error when validation failed
:type raise_error: bool
:return: a validation result object
:rtype: ValidationResult
"""
def validate_tool_function(tool_func, init_inputs=None):
tool, input_settings, extra_info = self._parse_tool_from_func(tool_func, init_inputs)
_, validate_result = self._serialize_tool(tool, input_settings, extra_info, source)
validate_result._set_extra_info(TOTAL_COUNT, 1)
validate_result._set_extra_info(INVALID_COUNT, 0 if validate_result.passed else 1)
return validate_result
if callable(source):
from promptflow._core.tool import ToolProvider
if isinstance(source, type) and issubclass(source, ToolProvider):
# Validate tool class
validate_result = ValidationResultBuilder.success()
for _, method in inspect.getmembers(source):
if is_tool(method):
initialize_inputs = source.get_initialize_inputs()
func_validate_result = validate_tool_function(method, initialize_inputs)
self._merge_validate_result(validate_result, func_validate_result)
else:
# Validate tool function
validate_result = validate_tool_function(source)
elif isinstance(source, (str, PathLike)):
# Validate tool script
if not Path(source).exists():
raise UserErrorException(f"Cannot find the tool script {source}")
# Load the module from the file path
module_name = Path(source).stem
spec = importlib.util.spec_from_file_location(module_name, source)
module = importlib.util.module_from_spec(spec)
# Load the module's code
spec.loader.exec_module(module)
_, validate_result = self._generate_tool_meta(module)
elif isinstance(source, ModuleType):
# Validate package tool
if not self._is_package_tool(source):
raise UserErrorException("Invalid package tool.")
_, validate_result = self._list_tool_meta_in_package(package_name=source.__name__)
else:
raise UserErrorException(
"Provide invalid source, tool validation source supports script tool, "
"package tool and tool script path."
)
def tool_validate_error_func(msg, _):
return ToolValidationError(message=msg)
validate_result.try_raise(raise_error=raise_error, error_func=tool_validate_error_func)
return validate_result
| promptflow/src/promptflow/promptflow/_sdk/operations/_tool_operations.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_sdk/operations/_tool_operations.py",
"repo_id": "promptflow",
"token_count": 10170
} | 35 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
from typing import AbstractSet, Any, Dict, List, Mapping
from promptflow._utils.logger_utils import logger
from promptflow.contracts.flow import Flow, FlowInputDefinition, InputValueType
from promptflow.contracts.run_info import FlowRunInfo, Status
def apply_default_value_for_input(inputs: Dict[str, FlowInputDefinition], line_inputs: Mapping) -> Dict[str, Any]:
updated_inputs = dict(line_inputs or {})
for key, value in inputs.items():
if key not in updated_inputs and (value and value.default is not None):
updated_inputs[key] = value.default
return updated_inputs
def handle_line_failures(run_infos: List[FlowRunInfo], raise_on_line_failure: bool = False):
"""Handle line failures in batch run"""
failed = [i for i, r in enumerate(run_infos) if r.status == Status.Failed]
failed_msg = None
if len(failed) > 0:
failed_indexes = ",".join([str(i) for i in failed])
first_fail_exception = run_infos[failed[0]].error["message"]
if raise_on_line_failure:
failed_msg = "Flow run failed due to the error: " + first_fail_exception
raise Exception(failed_msg)
failed_msg = (
f"{len(failed)}/{len(run_infos)} flow run failed, indexes: [{failed_indexes}],"
f" exception of index {failed[0]}: {first_fail_exception}"
)
logger.error(failed_msg)
def get_aggregation_inputs_properties(flow: Flow) -> AbstractSet[str]:
"""Return the serialized InputAssignment of the aggregation nodes inputs.
For example, an aggregation node refers the outputs of a node named "grade",
then this function will return set("${grade.output}").
"""
normal_node_names = {node.name for node in flow.nodes if flow.is_normal_node(node.name)}
properties = set()
for node in flow.nodes:
if node.name in normal_node_names:
continue
for value in node.inputs.values():
if not value.value_type == InputValueType.NODE_REFERENCE:
continue
if value.value in normal_node_names:
properties.add(value.serialize())
return properties
def collect_lines(indexes: List[int], kvs: Mapping[str, List]) -> Mapping[str, List]:
"""Collect the values from the kvs according to the indexes."""
return {k: [v[i] for i in indexes] for k, v in kvs.items()}
| promptflow/src/promptflow/promptflow/_utils/execution_utils.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_utils/execution_utils.py",
"repo_id": "promptflow",
"token_count": 923
} | 36 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore
from ._component import COMMAND_COMPONENT_SPEC_TEMPLATE, DEFAULT_PYTHON_VERSION
from ._flow import FlowJobType, FlowType
__all__ = ["FlowJobType", "FlowType", "DEFAULT_PYTHON_VERSION", "COMMAND_COMPONENT_SPEC_TEMPLATE"]
| promptflow/src/promptflow/promptflow/azure/_constants/__init__.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/azure/_constants/__init__.py",
"repo_id": "promptflow",
"token_count": 138
} | 37 |
# coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.8.0, generator: @autorest/[email protected])
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
try:
from ._models_py3 import ACIAdvanceSettings
from ._models_py3 import AEVAComputeConfiguration
from ._models_py3 import AEVAResourceConfiguration
from ._models_py3 import AISuperComputerConfiguration
from ._models_py3 import AISuperComputerScalePolicy
from ._models_py3 import AISuperComputerStorageReferenceConfiguration
from ._models_py3 import AKSAdvanceSettings
from ._models_py3 import AKSReplicaStatus
from ._models_py3 import AMLComputeConfiguration
from ._models_py3 import APCloudConfiguration
from ._models_py3 import Activate
from ._models_py3 import AdditionalErrorInfo
from ._models_py3 import AdhocTriggerScheduledCommandJobRequest
from ._models_py3 import AdhocTriggerScheduledSparkJobRequest
from ._models_py3 import AetherAPCloudConfiguration
from ._models_py3 import AetherAmlDataset
from ._models_py3 import AetherAmlSparkCloudSetting
from ._models_py3 import AetherArgumentAssignment
from ._models_py3 import AetherAssetDefinition
from ._models_py3 import AetherAssetOutputSettings
from ._models_py3 import AetherAutoFeaturizeConfiguration
from ._models_py3 import AetherAutoMLComponentConfiguration
from ._models_py3 import AetherAutoTrainConfiguration
from ._models_py3 import AetherAzureBlobReference
from ._models_py3 import AetherAzureDataLakeGen2Reference
from ._models_py3 import AetherAzureDataLakeReference
from ._models_py3 import AetherAzureDatabaseReference
from ._models_py3 import AetherAzureFilesReference
from ._models_py3 import AetherBatchAiComputeInfo
from ._models_py3 import AetherBuildArtifactInfo
from ._models_py3 import AetherCloudBuildDropPathInfo
from ._models_py3 import AetherCloudBuildInfo
from ._models_py3 import AetherCloudBuildQueueInfo
from ._models_py3 import AetherCloudPrioritySetting
from ._models_py3 import AetherCloudSettings
from ._models_py3 import AetherColumnTransformer
from ._models_py3 import AetherComputeConfiguration
from ._models_py3 import AetherComputeSetting
from ._models_py3 import AetherControlInput
from ._models_py3 import AetherControlOutput
from ._models_py3 import AetherCopyDataTask
from ._models_py3 import AetherCosmosReference
from ._models_py3 import AetherCreatedBy
from ._models_py3 import AetherCustomReference
from ._models_py3 import AetherDBFSReference
from ._models_py3 import AetherDataLocation
from ._models_py3 import AetherDataLocationReuseCalculationFields
from ._models_py3 import AetherDataPath
from ._models_py3 import AetherDataReference
from ._models_py3 import AetherDataSetDefinition
from ._models_py3 import AetherDataSetDefinitionValue
from ._models_py3 import AetherDataSettings
from ._models_py3 import AetherDataTransferCloudConfiguration
from ._models_py3 import AetherDataTransferSink
from ._models_py3 import AetherDataTransferSource
from ._models_py3 import AetherDataTransferV2CloudSetting
from ._models_py3 import AetherDatabaseSink
from ._models_py3 import AetherDatabaseSource
from ._models_py3 import AetherDatabricksComputeInfo
from ._models_py3 import AetherDatasetOutput
from ._models_py3 import AetherDatasetOutputOptions
from ._models_py3 import AetherDatasetRegistration
from ._models_py3 import AetherDatastoreSetting
from ._models_py3 import AetherDoWhileControlFlowInfo
from ._models_py3 import AetherDoWhileControlFlowRunSettings
from ._models_py3 import AetherDockerSettingConfiguration
from ._models_py3 import AetherEntityInterfaceDocumentation
from ._models_py3 import AetherEntrySetting
from ._models_py3 import AetherEnvironmentConfiguration
from ._models_py3 import AetherEsCloudConfiguration
from ._models_py3 import AetherExportDataTask
from ._models_py3 import AetherFeaturizationSettings
from ._models_py3 import AetherFileSystem
from ._models_py3 import AetherForecastHorizon
from ._models_py3 import AetherForecastingSettings
from ._models_py3 import AetherGeneralSettings
from ._models_py3 import AetherGlobsOptions
from ._models_py3 import AetherGraphControlNode
from ._models_py3 import AetherGraphControlReferenceNode
from ._models_py3 import AetherGraphDatasetNode
from ._models_py3 import AetherGraphEdge
from ._models_py3 import AetherGraphEntity
from ._models_py3 import AetherGraphModuleNode
from ._models_py3 import AetherGraphReferenceNode
from ._models_py3 import AetherHdfsReference
from ._models_py3 import AetherHdiClusterComputeInfo
from ._models_py3 import AetherHdiRunConfiguration
from ._models_py3 import AetherHyperDriveConfiguration
from ._models_py3 import AetherIdentitySetting
from ._models_py3 import AetherImportDataTask
from ._models_py3 import AetherInputSetting
from ._models_py3 import AetherInteractiveConfig
from ._models_py3 import AetherK8SConfiguration
from ._models_py3 import AetherLegacyDataPath
from ._models_py3 import AetherLimitSettings
from ._models_py3 import AetherMlcComputeInfo
from ._models_py3 import AetherModuleEntity
from ._models_py3 import AetherModuleExtendedProperties
from ._models_py3 import AetherNCrossValidations
from ._models_py3 import AetherOutputSetting
from ._models_py3 import AetherParallelForControlFlowInfo
from ._models_py3 import AetherParameterAssignment
from ._models_py3 import AetherPhillyHdfsReference
from ._models_py3 import AetherPortInfo
from ._models_py3 import AetherPriorityConfig
from ._models_py3 import AetherPriorityConfiguration
from ._models_py3 import AetherRegisteredDataSetReference
from ._models_py3 import AetherRemoteDockerComputeInfo
from ._models_py3 import AetherResourceAssignment
from ._models_py3 import AetherResourceAttributeAssignment
from ._models_py3 import AetherResourceAttributeDefinition
from ._models_py3 import AetherResourceConfig
from ._models_py3 import AetherResourceConfiguration
from ._models_py3 import AetherResourceModel
from ._models_py3 import AetherResourcesSetting
from ._models_py3 import AetherSavedDataSetReference
from ._models_py3 import AetherScopeCloudConfiguration
from ._models_py3 import AetherSeasonality
from ._models_py3 import AetherSqlDataPath
from ._models_py3 import AetherStackEnsembleSettings
from ._models_py3 import AetherStoredProcedureParameter
from ._models_py3 import AetherStructuredInterface
from ._models_py3 import AetherStructuredInterfaceInput
from ._models_py3 import AetherStructuredInterfaceOutput
from ._models_py3 import AetherStructuredInterfaceParameter
from ._models_py3 import AetherSubGraphConfiguration
from ._models_py3 import AetherSweepEarlyTerminationPolicy
from ._models_py3 import AetherSweepSettings
from ._models_py3 import AetherSweepSettingsLimits
from ._models_py3 import AetherTargetLags
from ._models_py3 import AetherTargetRollingWindowSize
from ._models_py3 import AetherTargetSelectorConfiguration
from ._models_py3 import AetherTestDataSettings
from ._models_py3 import AetherTorchDistributedConfiguration
from ._models_py3 import AetherTrainingOutput
from ._models_py3 import AetherTrainingSettings
from ._models_py3 import AetherUIAzureOpenAIDeploymentNameSelector
from ._models_py3 import AetherUIAzureOpenAIModelCapabilities
from ._models_py3 import AetherUIColumnPicker
from ._models_py3 import AetherUIJsonEditor
from ._models_py3 import AetherUIParameterHint
from ._models_py3 import AetherUIPromptFlowConnectionSelector
from ._models_py3 import AetherValidationDataSettings
from ._models_py3 import AetherVsoBuildArtifactInfo
from ._models_py3 import AetherVsoBuildDefinitionInfo
from ._models_py3 import AetherVsoBuildInfo
from ._models_py3 import AmlDataset
from ._models_py3 import AmlK8SConfiguration
from ._models_py3 import AmlK8SPriorityConfiguration
from ._models_py3 import AmlSparkCloudSetting
from ._models_py3 import ApiAndParameters
from ._models_py3 import ApplicationEndpointConfiguration
from ._models_py3 import ArgumentAssignment
from ._models_py3 import Asset
from ._models_py3 import AssetDefinition
from ._models_py3 import AssetNameAndVersionIdentifier
from ._models_py3 import AssetOutputSettings
from ._models_py3 import AssetOutputSettingsParameter
from ._models_py3 import AssetPublishResult
from ._models_py3 import AssetPublishSingleRegionResult
from ._models_py3 import AssetTypeMetaInfo
from ._models_py3 import AssetVersionPublishRequest
from ._models_py3 import AssignedUser
from ._models_py3 import AuthKeys
from ._models_py3 import AutoClusterComputeSpecification
from ._models_py3 import AutoDeleteSetting
from ._models_py3 import AutoFeaturizeConfiguration
from ._models_py3 import AutoMLComponentConfiguration
from ._models_py3 import AutoScaler
from ._models_py3 import AutoTrainConfiguration
from ._models_py3 import AutologgerSettings
from ._models_py3 import AvailabilityResponse
from ._models_py3 import AzureBlobReference
from ._models_py3 import AzureDataLakeGen2Reference
from ._models_py3 import AzureDataLakeReference
from ._models_py3 import AzureDatabaseReference
from ._models_py3 import AzureFilesReference
from ._models_py3 import AzureMLModuleVersionDescriptor
from ._models_py3 import AzureOpenAIDeploymentDto
from ._models_py3 import AzureOpenAIModelCapabilities
from ._models_py3 import BatchAiComputeInfo
from ._models_py3 import BatchDataInput
from ._models_py3 import BatchExportComponentSpecResponse
from ._models_py3 import BatchExportRawComponentResponse
from ._models_py3 import BatchGetComponentHashesRequest
from ._models_py3 import BatchGetComponentRequest
from ._models_py3 import Binding
from ._models_py3 import BulkTestDto
from ._models_py3 import CloudError
from ._models_py3 import CloudPrioritySetting
from ._models_py3 import CloudSettings
from ._models_py3 import ColumnTransformer
from ._models_py3 import CommandJob
from ._models_py3 import CommandJobLimits
from ._models_py3 import CommandReturnCodeConfig
from ._models_py3 import ComponentConfiguration
from ._models_py3 import ComponentInput
from ._models_py3 import ComponentJob
from ._models_py3 import ComponentJobInput
from ._models_py3 import ComponentJobOutput
from ._models_py3 import ComponentNameAndDefaultVersion
from ._models_py3 import ComponentNameMetaInfo
from ._models_py3 import ComponentOutput
from ._models_py3 import ComponentPreflightResult
from ._models_py3 import ComponentSpecMetaInfo
from ._models_py3 import ComponentUpdateRequest
from ._models_py3 import ComponentValidationRequest
from ._models_py3 import ComponentValidationResponse
from ._models_py3 import Compute
from ._models_py3 import ComputeConfiguration
from ._models_py3 import ComputeContract
from ._models_py3 import ComputeIdentityContract
from ._models_py3 import ComputeIdentityDto
from ._models_py3 import ComputeInfo
from ._models_py3 import ComputeProperties
from ._models_py3 import ComputeRPUserAssignedIdentity
from ._models_py3 import ComputeRequest
from ._models_py3 import ComputeSetting
from ._models_py3 import ComputeStatus
from ._models_py3 import ComputeStatusDetail
from ._models_py3 import ComputeWarning
from ._models_py3 import ConnectionConfigSpec
from ._models_py3 import ConnectionDto
from ._models_py3 import ConnectionEntity
from ._models_py3 import ConnectionOverrideSetting
from ._models_py3 import ConnectionSpec
from ._models_py3 import ContainerInstanceConfiguration
from ._models_py3 import ContainerRegistry
from ._models_py3 import ContainerResourceRequirements
from ._models_py3 import ControlInput
from ._models_py3 import ControlOutput
from ._models_py3 import CopyDataTask
from ._models_py3 import CreateFlowFromSampleRequest
from ._models_py3 import CreateFlowRequest
from ._models_py3 import CreateFlowRuntimeRequest
from ._models_py3 import CreateFlowSessionRequest
from ._models_py3 import CreateInferencePipelineRequest
from ._models_py3 import CreateOrUpdateConnectionRequest
from ._models_py3 import CreateOrUpdateConnectionRequestDto
from ._models_py3 import CreatePipelineDraftRequest
from ._models_py3 import CreatePipelineJobScheduleDto
from ._models_py3 import CreatePublishedPipelineRequest
from ._models_py3 import CreateRealTimeEndpointRequest
from ._models_py3 import CreatedBy
from ._models_py3 import CreatedFromDto
from ._models_py3 import CreationContext
from ._models_py3 import Cron
from ._models_py3 import CustomConnectionConfig
from ._models_py3 import CustomReference
from ._models_py3 import DBFSReference
from ._models_py3 import Data
from ._models_py3 import DataInfo
from ._models_py3 import DataLocation
from ._models_py3 import DataPath
from ._models_py3 import DataPathParameter
from ._models_py3 import DataPortDto
from ._models_py3 import DataReference
from ._models_py3 import DataReferenceConfiguration
from ._models_py3 import DataSetDefinition
from ._models_py3 import DataSetDefinitionValue
from ._models_py3 import DataSetPathParameter
from ._models_py3 import DataSettings
from ._models_py3 import DataTransferCloudConfiguration
from ._models_py3 import DataTransferSink
from ._models_py3 import DataTransferSource
from ._models_py3 import DataTransferV2CloudSetting
from ._models_py3 import DataTypeCreationInfo
from ._models_py3 import DatabaseSink
from ._models_py3 import DatabaseSource
from ._models_py3 import DatabricksComputeInfo
from ._models_py3 import DatabricksConfiguration
from ._models_py3 import DatacacheConfiguration
from ._models_py3 import DatasetIdentifier
from ._models_py3 import DatasetInputDetails
from ._models_py3 import DatasetLineage
from ._models_py3 import DatasetOutput
from ._models_py3 import DatasetOutputDetails
from ._models_py3 import DatasetOutputOptions
from ._models_py3 import DatasetRegistration
from ._models_py3 import DatasetRegistrationOptions
from ._models_py3 import DatastoreSetting
from ._models_py3 import DbfsStorageInfoDto
from ._models_py3 import DebugInfoResponse
from ._models_py3 import DeployFlowRequest
from ._models_py3 import DeploymentInfo
from ._models_py3 import DistributionConfiguration
from ._models_py3 import DistributionParameter
from ._models_py3 import DoWhileControlFlowInfo
from ._models_py3 import DoWhileControlFlowRunSettings
from ._models_py3 import DockerBuildContext
from ._models_py3 import DockerConfiguration
from ._models_py3 import DockerImagePlatform
from ._models_py3 import DockerSection
from ._models_py3 import DockerSettingConfiguration
from ._models_py3 import DownloadResourceInfo
from ._models_py3 import EPRPipelineRunErrorClassificationRequest
from ._models_py3 import EndpointSetting
from ._models_py3 import EntityInterface
from ._models_py3 import EntrySetting
from ._models_py3 import EnumParameterRule
from ._models_py3 import EnvironmentConfiguration
from ._models_py3 import EnvironmentDefinition
from ._models_py3 import EnvironmentDefinitionDto
from ._models_py3 import ErrorAdditionalInfo
from ._models_py3 import ErrorResponse
from ._models_py3 import EsCloudConfiguration
from ._models_py3 import EvaluationFlowRunSettings
from ._models_py3 import ExampleRequest
from ._models_py3 import ExecutionContextDto
from ._models_py3 import ExecutionDataLocation
from ._models_py3 import ExecutionDataPath
from ._models_py3 import ExecutionGlobsOptions
from ._models_py3 import ExperimentComputeMetaInfo
from ._models_py3 import ExperimentInfo
from ._models_py3 import ExportComponentMetaInfo
from ._models_py3 import ExportDataTask
from ._models_py3 import FeaturizationSettings
from ._models_py3 import FeedDto
from ._models_py3 import FeedDtoSupportedAssetTypes
from ._models_py3 import FileSystem
from ._models_py3 import Flow
from ._models_py3 import FlowAnnotations
from ._models_py3 import FlowBaseDto
from ._models_py3 import FlowDto
from ._models_py3 import FlowEnvironment
from ._models_py3 import FlowFeature
from ._models_py3 import FlowFeatureState
from ._models_py3 import FlowGraph
from ._models_py3 import FlowGraphAnnotationNode
from ._models_py3 import FlowGraphLayout
from ._models_py3 import FlowGraphReference
from ._models_py3 import FlowIndexEntity
from ._models_py3 import FlowInputDefinition
from ._models_py3 import FlowNode
from ._models_py3 import FlowNodeLayout
from ._models_py3 import FlowNodeVariant
from ._models_py3 import FlowOutputDefinition
from ._models_py3 import FlowProperties
from ._models_py3 import FlowRunBasePath
from ._models_py3 import FlowRunInfo
from ._models_py3 import FlowRunResult
from ._models_py3 import FlowRunSettings
from ._models_py3 import FlowRuntimeCapability
from ._models_py3 import FlowRuntimeDto
from ._models_py3 import FlowSampleDto
from ._models_py3 import FlowSessionDto
from ._models_py3 import FlowSnapshot
from ._models_py3 import FlowSubmitRunSettings
from ._models_py3 import FlowTestInfo
from ._models_py3 import FlowTestStorageSetting
from ._models_py3 import FlowToolSettingParameter
from ._models_py3 import FlowToolsDto
from ._models_py3 import FlowVariantNode
from ._models_py3 import ForecastHorizon
from ._models_py3 import ForecastingSettings
from ._models_py3 import GeneralSettings
from ._models_py3 import GeneratePipelineComponentRequest
from ._models_py3 import GenerateToolMetaRequest
from ._models_py3 import GetDynamicListRequest
from ._models_py3 import GetRunDataResultDto
from ._models_py3 import GetTrainingSessionDto
from ._models_py3 import GlobalJobDispatcherConfiguration
from ._models_py3 import GlobsOptions
from ._models_py3 import GraphAnnotationNode
from ._models_py3 import GraphControlNode
from ._models_py3 import GraphControlReferenceNode
from ._models_py3 import GraphDatasetNode
from ._models_py3 import GraphDraftEntity
from ._models_py3 import GraphEdge
from ._models_py3 import GraphLayout
from ._models_py3 import GraphLayoutCreationInfo
from ._models_py3 import GraphModuleNode
from ._models_py3 import GraphModuleNodeRunSetting
from ._models_py3 import GraphModuleNodeUIInputSetting
from ._models_py3 import GraphNodeStatusInfo
from ._models_py3 import GraphReferenceNode
from ._models_py3 import HdfsReference
from ._models_py3 import HdiClusterComputeInfo
from ._models_py3 import HdiConfiguration
from ._models_py3 import HdiRunConfiguration
from ._models_py3 import HistoryConfiguration
from ._models_py3 import HyperDriveConfiguration
from ._models_py3 import ICheckableLongRunningOperationResponse
from ._models_py3 import IdentityConfiguration
from ._models_py3 import IdentitySetting
from ._models_py3 import ImportDataTask
from ._models_py3 import IndexedErrorResponse
from ._models_py3 import InitScriptInfoDto
from ._models_py3 import InnerErrorDetails
from ._models_py3 import InnerErrorResponse
from ._models_py3 import InputAsset
from ._models_py3 import InputData
from ._models_py3 import InputDataBinding
from ._models_py3 import InputDefinition
from ._models_py3 import InputOutputPortMetadata
from ._models_py3 import InputSetting
from ._models_py3 import IntellectualPropertyPublisherInformation
from ._models_py3 import InteractiveConfig
from ._models_py3 import InteractiveConfiguration
from ._models_py3 import JobCost
from ._models_py3 import JobEndpoint
from ._models_py3 import JobInput
from ._models_py3 import JobOutput
from ._models_py3 import JobOutputArtifacts
from ._models_py3 import JobScheduleDto
from ._models_py3 import K8SConfiguration
from ._models_py3 import KeyValuePairComponentNameMetaInfoErrorResponse
from ._models_py3 import KeyValuePairComponentNameMetaInfoModuleDto
from ._models_py3 import KeyValuePairStringObject
from ._models_py3 import KubernetesConfiguration
from ._models_py3 import Kwarg
from ._models_py3 import LegacyDataPath
from ._models_py3 import LimitSettings
from ._models_py3 import LinkedADBWorkspaceMetadata
from ._models_py3 import LinkedPipelineInfo
from ._models_py3 import LoadFlowAsComponentRequest
from ._models_py3 import LogRunTerminatedEventDto
from ._models_py3 import LongRunningOperationUriResponse
from ._models_py3 import LongRunningUpdateRegistryComponentRequest
from ._models_py3 import ManagedServiceIdentity
from ._models_py3 import MavenLibraryDto
from ._models_py3 import MetricProperties
from ._models_py3 import MetricSchemaDto
from ._models_py3 import MetricSchemaPropertyDto
from ._models_py3 import MetricV2Dto
from ._models_py3 import MetricV2Value
from ._models_py3 import MfeInternalAutologgerSettings
from ._models_py3 import MfeInternalIdentityConfiguration
from ._models_py3 import MfeInternalNodes
from ._models_py3 import MfeInternalOutputData
from ._models_py3 import MfeInternalSecretConfiguration
from ._models_py3 import MfeInternalUriReference
from ._models_py3 import MfeInternalV20211001ComponentJob
from ._models_py3 import MinMaxParameterRule
from ._models_py3 import MlcComputeInfo
from ._models_py3 import ModelDto
from ._models_py3 import ModelManagementErrorResponse
from ._models_py3 import ModifyPipelineJobScheduleDto
from ._models_py3 import ModuleDto
from ._models_py3 import ModuleDtoWithErrors
from ._models_py3 import ModuleDtoWithValidateStatus
from ._models_py3 import ModuleEntity
from ._models_py3 import ModulePythonInterface
from ._models_py3 import MpiConfiguration
from ._models_py3 import NCrossValidations
from ._models_py3 import Node
from ._models_py3 import NodeInputPort
from ._models_py3 import NodeLayout
from ._models_py3 import NodeOutputPort
from ._models_py3 import NodePortInterface
from ._models_py3 import NodeSource
from ._models_py3 import NodeTelemetryMetaInfo
from ._models_py3 import NodeVariant
from ._models_py3 import Nodes
from ._models_py3 import NoteBookTaskDto
from ._models_py3 import NotificationSetting
from ._models_py3 import ODataError
from ._models_py3 import ODataErrorDetail
from ._models_py3 import ODataErrorResponse
from ._models_py3 import ODataInnerError
from ._models_py3 import OutputData
from ._models_py3 import OutputDataBinding
from ._models_py3 import OutputDatasetLineage
from ._models_py3 import OutputDefinition
from ._models_py3 import OutputOptions
from ._models_py3 import OutputSetting
from ._models_py3 import OutputSettingSpec
from ._models_py3 import PaginatedDataInfoList
from ._models_py3 import PaginatedModelDtoList
from ._models_py3 import PaginatedModuleDtoList
from ._models_py3 import PaginatedPipelineDraftSummaryList
from ._models_py3 import PaginatedPipelineEndpointSummaryList
from ._models_py3 import PaginatedPipelineRunSummaryList
from ._models_py3 import PaginatedPublishedPipelineSummaryList
from ._models_py3 import ParallelForControlFlowInfo
from ._models_py3 import ParallelTaskConfiguration
from ._models_py3 import Parameter
from ._models_py3 import ParameterAssignment
from ._models_py3 import ParameterDefinition
from ._models_py3 import PatchFlowRequest
from ._models_py3 import Pipeline
from ._models_py3 import PipelineDraft
from ._models_py3 import PipelineDraftStepDetails
from ._models_py3 import PipelineDraftSummary
from ._models_py3 import PipelineEndpoint
from ._models_py3 import PipelineEndpointSummary
from ._models_py3 import PipelineGraph
from ._models_py3 import PipelineInput
from ._models_py3 import PipelineJob
from ._models_py3 import PipelineJobRuntimeBasicSettings
from ._models_py3 import PipelineJobScheduleDto
from ._models_py3 import PipelineOutput
from ._models_py3 import PipelineRun
from ._models_py3 import PipelineRunGraphDetail
from ._models_py3 import PipelineRunGraphStatus
from ._models_py3 import PipelineRunProfile
from ._models_py3 import PipelineRunStatus
from ._models_py3 import PipelineRunStepDetails
from ._models_py3 import PipelineRunSummary
from ._models_py3 import PipelineStatus
from ._models_py3 import PipelineStepRun
from ._models_py3 import PipelineStepRunOutputs
from ._models_py3 import PipelineSubDraft
from ._models_py3 import PolicyValidationResponse
from ._models_py3 import PortInfo
from ._models_py3 import PortOutputInfo
from ._models_py3 import PriorityConfig
from ._models_py3 import PriorityConfiguration
from ._models_py3 import PromoteDataSetRequest
from ._models_py3 import ProviderEntity
from ._models_py3 import PublishedPipeline
from ._models_py3 import PublishedPipelineSummary
from ._models_py3 import PyTorchConfiguration
from ._models_py3 import PythonInterfaceMapping
from ._models_py3 import PythonPyPiOrRCranLibraryDto
from ._models_py3 import PythonSection
from ._models_py3 import QueueingInfo
from ._models_py3 import RCranPackage
from ._models_py3 import RGitHubPackage
from ._models_py3 import RSection
from ._models_py3 import RawComponentDto
from ._models_py3 import RayConfiguration
from ._models_py3 import RealTimeEndpoint
from ._models_py3 import RealTimeEndpointInfo
from ._models_py3 import RealTimeEndpointStatus
from ._models_py3 import RealTimeEndpointSummary
from ._models_py3 import RealTimeEndpointTestRequest
from ._models_py3 import Recurrence
from ._models_py3 import RecurrencePattern
from ._models_py3 import RecurrenceSchedule
from ._models_py3 import RegenerateServiceKeysRequest
from ._models_py3 import RegisterComponentMetaInfo
from ._models_py3 import RegisterComponentMetaInfoExtraHashes
from ._models_py3 import RegisterComponentMetaInfoIdentifierHashes
from ._models_py3 import RegisterRegistryComponentMetaInfo
from ._models_py3 import RegisterRegistryComponentMetaInfoExtraHashes
from ._models_py3 import RegisterRegistryComponentMetaInfoIdentifierHashes
from ._models_py3 import RegisteredDataSetReference
from ._models_py3 import RegistrationOptions
from ._models_py3 import RegistryBlobReferenceData
from ._models_py3 import RegistryIdentity
from ._models_py3 import Relationship
from ._models_py3 import RemoteDockerComputeInfo
from ._models_py3 import ResourceConfig
from ._models_py3 import ResourceConfiguration
from ._models_py3 import ResourcesSetting
from ._models_py3 import RetrieveToolFuncResultRequest
from ._models_py3 import RetryConfiguration
from ._models_py3 import RootError
from ._models_py3 import RunAnnotations
from ._models_py3 import RunConfiguration
from ._models_py3 import RunDatasetReference
from ._models_py3 import RunDefinition
from ._models_py3 import RunDetailsDto
from ._models_py3 import RunDetailsWarningDto
from ._models_py3 import RunDto
from ._models_py3 import RunIndexEntity
from ._models_py3 import RunIndexMetricSummary
from ._models_py3 import RunIndexMetricSummarySystemObject
from ._models_py3 import RunIndexResourceMetricSummary
from ._models_py3 import RunMetricDto
from ._models_py3 import RunMetricsTypesDto
from ._models_py3 import RunProperties
from ._models_py3 import RunSettingParameter
from ._models_py3 import RunSettingParameterAssignment
from ._models_py3 import RunSettingUIParameterHint
from ._models_py3 import RunStatusPeriod
from ._models_py3 import RunTypeV2
from ._models_py3 import RunTypeV2Index
from ._models_py3 import RuntimeConfiguration
from ._models_py3 import SampleMeta
from ._models_py3 import SavePipelineDraftRequest
from ._models_py3 import SavedDataSetReference
from ._models_py3 import ScheduleBase
from ._models_py3 import SchemaContractsCreatedBy
from ._models_py3 import ScopeCloudConfiguration
from ._models_py3 import Seasonality
from ._models_py3 import SecretConfiguration
from ._models_py3 import SegmentedResult1
from ._models_py3 import ServiceLogRequest
from ._models_py3 import SessionApplication
from ._models_py3 import SessionApplicationRunCommandResult
from ._models_py3 import SessionProperties
from ._models_py3 import SetupFlowSessionRequest
from ._models_py3 import SharingScope
from ._models_py3 import Snapshot
from ._models_py3 import SnapshotInfo
from ._models_py3 import SourceCodeDataReference
from ._models_py3 import SparkConfiguration
from ._models_py3 import SparkJarTaskDto
from ._models_py3 import SparkJob
from ._models_py3 import SparkJobEntry
from ._models_py3 import SparkMavenPackage
from ._models_py3 import SparkPythonTaskDto
from ._models_py3 import SparkResourceConfiguration
from ._models_py3 import SparkSection
from ._models_py3 import SparkSubmitTaskDto
from ._models_py3 import SqlDataPath
from ._models_py3 import StackEnsembleSettings
from ._models_py3 import StandbyPoolProperties
from ._models_py3 import StandbyPoolResourceStatus
from ._models_py3 import StartRunResult
from ._models_py3 import StepRunProfile
from ._models_py3 import StorageInfo
from ._models_py3 import StoredProcedureParameter
from ._models_py3 import Stream
from ._models_py3 import StructuredInterface
from ._models_py3 import StructuredInterfaceInput
from ._models_py3 import StructuredInterfaceOutput
from ._models_py3 import StructuredInterfaceParameter
from ._models_py3 import StudioMigrationInfo
from ._models_py3 import SubGraphConcatenateAssignment
from ._models_py3 import SubGraphConfiguration
from ._models_py3 import SubGraphConnectionInfo
from ._models_py3 import SubGraphDataPathParameterAssignment
from ._models_py3 import SubGraphInfo
from ._models_py3 import SubGraphParameterAssignment
from ._models_py3 import SubGraphPortInfo
from ._models_py3 import SubPipelineDefinition
from ._models_py3 import SubPipelineParameterAssignment
from ._models_py3 import SubPipelinesInfo
from ._models_py3 import SubStatusPeriod
from ._models_py3 import SubmitBulkRunRequest
from ._models_py3 import SubmitBulkRunResponse
from ._models_py3 import SubmitFlowRequest
from ._models_py3 import SubmitPipelineRunRequest
from ._models_py3 import SweepEarlyTerminationPolicy
from ._models_py3 import SweepSettings
from ._models_py3 import SweepSettingsLimits
from ._models_py3 import SystemData
from ._models_py3 import SystemMeta
from ._models_py3 import SystemMetaExtraHashes
from ._models_py3 import SystemMetaIdentifierHashes
from ._models_py3 import TargetLags
from ._models_py3 import TargetRollingWindowSize
from ._models_py3 import TargetSelectorConfiguration
from ._models_py3 import Task
from ._models_py3 import TaskControlFlowInfo
from ._models_py3 import TaskReuseInfo
from ._models_py3 import TensorflowConfiguration
from ._models_py3 import TestDataSettings
from ._models_py3 import Tool
from ._models_py3 import ToolFuncResponse
from ._models_py3 import ToolInputDynamicList
from ._models_py3 import ToolInputGeneratedBy
from ._models_py3 import ToolMetaDto
from ._models_py3 import ToolSetting
from ._models_py3 import ToolSourceMeta
from ._models_py3 import TorchDistributedConfiguration
from ._models_py3 import TrainingDiagnosticConfiguration
from ._models_py3 import TrainingOutput
from ._models_py3 import TrainingSettings
from ._models_py3 import TriggerAsyncOperationStatus
from ._models_py3 import TuningNodeSetting
from ._models_py3 import TypedAssetReference
from ._models_py3 import UIAzureOpenAIDeploymentNameSelector
from ._models_py3 import UIAzureOpenAIModelCapabilities
from ._models_py3 import UIColumnPicker
from ._models_py3 import UIComputeSelection
from ._models_py3 import UIHyperparameterConfiguration
from ._models_py3 import UIInputSetting
from ._models_py3 import UIJsonEditor
from ._models_py3 import UIParameterHint
from ._models_py3 import UIPromptFlowConnectionSelector
from ._models_py3 import UIWidgetMetaInfo
from ._models_py3 import UIYamlEditor
from ._models_py3 import UnversionedEntityRequestDto
from ._models_py3 import UnversionedEntityResponseDto
from ._models_py3 import UnversionedRebuildIndexDto
from ._models_py3 import UnversionedRebuildResponseDto
from ._models_py3 import UpdateComponentRequest
from ._models_py3 import UpdateFlowRequest
from ._models_py3 import UpdateFlowRuntimeRequest
from ._models_py3 import UpdateRegistryComponentRequest
from ._models_py3 import UploadOptions
from ._models_py3 import UriReference
from ._models_py3 import User
from ._models_py3 import UserAssignedIdentity
from ._models_py3 import ValidationDataSettings
from ._models_py3 import VariantNode
from ._models_py3 import WebServiceComputeMetaInfo
from ._models_py3 import WebServicePort
from ._models_py3 import Webhook
from ._models_py3 import WorkspaceConnectionSpec
except (SyntaxError, ImportError):
from ._models import ACIAdvanceSettings # type: ignore
from ._models import AEVAComputeConfiguration # type: ignore
from ._models import AEVAResourceConfiguration # type: ignore
from ._models import AISuperComputerConfiguration # type: ignore
from ._models import AISuperComputerScalePolicy # type: ignore
from ._models import AISuperComputerStorageReferenceConfiguration # type: ignore
from ._models import AKSAdvanceSettings # type: ignore
from ._models import AKSReplicaStatus # type: ignore
from ._models import AMLComputeConfiguration # type: ignore
from ._models import APCloudConfiguration # type: ignore
from ._models import Activate # type: ignore
from ._models import AdditionalErrorInfo # type: ignore
from ._models import AdhocTriggerScheduledCommandJobRequest # type: ignore
from ._models import AdhocTriggerScheduledSparkJobRequest # type: ignore
from ._models import AetherAPCloudConfiguration # type: ignore
from ._models import AetherAmlDataset # type: ignore
from ._models import AetherAmlSparkCloudSetting # type: ignore
from ._models import AetherArgumentAssignment # type: ignore
from ._models import AetherAssetDefinition # type: ignore
from ._models import AetherAssetOutputSettings # type: ignore
from ._models import AetherAutoFeaturizeConfiguration # type: ignore
from ._models import AetherAutoMLComponentConfiguration # type: ignore
from ._models import AetherAutoTrainConfiguration # type: ignore
from ._models import AetherAzureBlobReference # type: ignore
from ._models import AetherAzureDataLakeGen2Reference # type: ignore
from ._models import AetherAzureDataLakeReference # type: ignore
from ._models import AetherAzureDatabaseReference # type: ignore
from ._models import AetherAzureFilesReference # type: ignore
from ._models import AetherBatchAiComputeInfo # type: ignore
from ._models import AetherBuildArtifactInfo # type: ignore
from ._models import AetherCloudBuildDropPathInfo # type: ignore
from ._models import AetherCloudBuildInfo # type: ignore
from ._models import AetherCloudBuildQueueInfo # type: ignore
from ._models import AetherCloudPrioritySetting # type: ignore
from ._models import AetherCloudSettings # type: ignore
from ._models import AetherColumnTransformer # type: ignore
from ._models import AetherComputeConfiguration # type: ignore
from ._models import AetherComputeSetting # type: ignore
from ._models import AetherControlInput # type: ignore
from ._models import AetherControlOutput # type: ignore
from ._models import AetherCopyDataTask # type: ignore
from ._models import AetherCosmosReference # type: ignore
from ._models import AetherCreatedBy # type: ignore
from ._models import AetherCustomReference # type: ignore
from ._models import AetherDBFSReference # type: ignore
from ._models import AetherDataLocation # type: ignore
from ._models import AetherDataLocationReuseCalculationFields # type: ignore
from ._models import AetherDataPath # type: ignore
from ._models import AetherDataReference # type: ignore
from ._models import AetherDataSetDefinition # type: ignore
from ._models import AetherDataSetDefinitionValue # type: ignore
from ._models import AetherDataSettings # type: ignore
from ._models import AetherDataTransferCloudConfiguration # type: ignore
from ._models import AetherDataTransferSink # type: ignore
from ._models import AetherDataTransferSource # type: ignore
from ._models import AetherDataTransferV2CloudSetting # type: ignore
from ._models import AetherDatabaseSink # type: ignore
from ._models import AetherDatabaseSource # type: ignore
from ._models import AetherDatabricksComputeInfo # type: ignore
from ._models import AetherDatasetOutput # type: ignore
from ._models import AetherDatasetOutputOptions # type: ignore
from ._models import AetherDatasetRegistration # type: ignore
from ._models import AetherDatastoreSetting # type: ignore
from ._models import AetherDoWhileControlFlowInfo # type: ignore
from ._models import AetherDoWhileControlFlowRunSettings # type: ignore
from ._models import AetherDockerSettingConfiguration # type: ignore
from ._models import AetherEntityInterfaceDocumentation # type: ignore
from ._models import AetherEntrySetting # type: ignore
from ._models import AetherEnvironmentConfiguration # type: ignore
from ._models import AetherEsCloudConfiguration # type: ignore
from ._models import AetherExportDataTask # type: ignore
from ._models import AetherFeaturizationSettings # type: ignore
from ._models import AetherFileSystem # type: ignore
from ._models import AetherForecastHorizon # type: ignore
from ._models import AetherForecastingSettings # type: ignore
from ._models import AetherGeneralSettings # type: ignore
from ._models import AetherGlobsOptions # type: ignore
from ._models import AetherGraphControlNode # type: ignore
from ._models import AetherGraphControlReferenceNode # type: ignore
from ._models import AetherGraphDatasetNode # type: ignore
from ._models import AetherGraphEdge # type: ignore
from ._models import AetherGraphEntity # type: ignore
from ._models import AetherGraphModuleNode # type: ignore
from ._models import AetherGraphReferenceNode # type: ignore
from ._models import AetherHdfsReference # type: ignore
from ._models import AetherHdiClusterComputeInfo # type: ignore
from ._models import AetherHdiRunConfiguration # type: ignore
from ._models import AetherHyperDriveConfiguration # type: ignore
from ._models import AetherIdentitySetting # type: ignore
from ._models import AetherImportDataTask # type: ignore
from ._models import AetherInputSetting # type: ignore
from ._models import AetherInteractiveConfig # type: ignore
from ._models import AetherK8SConfiguration # type: ignore
from ._models import AetherLegacyDataPath # type: ignore
from ._models import AetherLimitSettings # type: ignore
from ._models import AetherMlcComputeInfo # type: ignore
from ._models import AetherModuleEntity # type: ignore
from ._models import AetherModuleExtendedProperties # type: ignore
from ._models import AetherNCrossValidations # type: ignore
from ._models import AetherOutputSetting # type: ignore
from ._models import AetherParallelForControlFlowInfo # type: ignore
from ._models import AetherParameterAssignment # type: ignore
from ._models import AetherPhillyHdfsReference # type: ignore
from ._models import AetherPortInfo # type: ignore
from ._models import AetherPriorityConfig # type: ignore
from ._models import AetherPriorityConfiguration # type: ignore
from ._models import AetherRegisteredDataSetReference # type: ignore
from ._models import AetherRemoteDockerComputeInfo # type: ignore
from ._models import AetherResourceAssignment # type: ignore
from ._models import AetherResourceAttributeAssignment # type: ignore
from ._models import AetherResourceAttributeDefinition # type: ignore
from ._models import AetherResourceConfig # type: ignore
from ._models import AetherResourceConfiguration # type: ignore
from ._models import AetherResourceModel # type: ignore
from ._models import AetherResourcesSetting # type: ignore
from ._models import AetherSavedDataSetReference # type: ignore
from ._models import AetherScopeCloudConfiguration # type: ignore
from ._models import AetherSeasonality # type: ignore
from ._models import AetherSqlDataPath # type: ignore
from ._models import AetherStackEnsembleSettings # type: ignore
from ._models import AetherStoredProcedureParameter # type: ignore
from ._models import AetherStructuredInterface # type: ignore
from ._models import AetherStructuredInterfaceInput # type: ignore
from ._models import AetherStructuredInterfaceOutput # type: ignore
from ._models import AetherStructuredInterfaceParameter # type: ignore
from ._models import AetherSubGraphConfiguration # type: ignore
from ._models import AetherSweepEarlyTerminationPolicy # type: ignore
from ._models import AetherSweepSettings # type: ignore
from ._models import AetherSweepSettingsLimits # type: ignore
from ._models import AetherTargetLags # type: ignore
from ._models import AetherTargetRollingWindowSize # type: ignore
from ._models import AetherTargetSelectorConfiguration # type: ignore
from ._models import AetherTestDataSettings # type: ignore
from ._models import AetherTorchDistributedConfiguration # type: ignore
from ._models import AetherTrainingOutput # type: ignore
from ._models import AetherTrainingSettings # type: ignore
from ._models import AetherUIAzureOpenAIDeploymentNameSelector # type: ignore
from ._models import AetherUIAzureOpenAIModelCapabilities # type: ignore
from ._models import AetherUIColumnPicker # type: ignore
from ._models import AetherUIJsonEditor # type: ignore
from ._models import AetherUIParameterHint # type: ignore
from ._models import AetherUIPromptFlowConnectionSelector # type: ignore
from ._models import AetherValidationDataSettings # type: ignore
from ._models import AetherVsoBuildArtifactInfo # type: ignore
from ._models import AetherVsoBuildDefinitionInfo # type: ignore
from ._models import AetherVsoBuildInfo # type: ignore
from ._models import AmlDataset # type: ignore
from ._models import AmlK8SConfiguration # type: ignore
from ._models import AmlK8SPriorityConfiguration # type: ignore
from ._models import AmlSparkCloudSetting # type: ignore
from ._models import ApiAndParameters # type: ignore
from ._models import ApplicationEndpointConfiguration # type: ignore
from ._models import ArgumentAssignment # type: ignore
from ._models import Asset # type: ignore
from ._models import AssetDefinition # type: ignore
from ._models import AssetNameAndVersionIdentifier # type: ignore
from ._models import AssetOutputSettings # type: ignore
from ._models import AssetOutputSettingsParameter # type: ignore
from ._models import AssetPublishResult # type: ignore
from ._models import AssetPublishSingleRegionResult # type: ignore
from ._models import AssetTypeMetaInfo # type: ignore
from ._models import AssetVersionPublishRequest # type: ignore
from ._models import AssignedUser # type: ignore
from ._models import AuthKeys # type: ignore
from ._models import AutoClusterComputeSpecification # type: ignore
from ._models import AutoDeleteSetting # type: ignore
from ._models import AutoFeaturizeConfiguration # type: ignore
from ._models import AutoMLComponentConfiguration # type: ignore
from ._models import AutoScaler # type: ignore
from ._models import AutoTrainConfiguration # type: ignore
from ._models import AutologgerSettings # type: ignore
from ._models import AvailabilityResponse # type: ignore
from ._models import AzureBlobReference # type: ignore
from ._models import AzureDataLakeGen2Reference # type: ignore
from ._models import AzureDataLakeReference # type: ignore
from ._models import AzureDatabaseReference # type: ignore
from ._models import AzureFilesReference # type: ignore
from ._models import AzureMLModuleVersionDescriptor # type: ignore
from ._models import AzureOpenAIDeploymentDto # type: ignore
from ._models import AzureOpenAIModelCapabilities # type: ignore
from ._models import BatchAiComputeInfo # type: ignore
from ._models import BatchDataInput # type: ignore
from ._models import BatchExportComponentSpecResponse # type: ignore
from ._models import BatchExportRawComponentResponse # type: ignore
from ._models import BatchGetComponentHashesRequest # type: ignore
from ._models import BatchGetComponentRequest # type: ignore
from ._models import Binding # type: ignore
from ._models import BulkTestDto # type: ignore
from ._models import CloudError # type: ignore
from ._models import CloudPrioritySetting # type: ignore
from ._models import CloudSettings # type: ignore
from ._models import ColumnTransformer # type: ignore
from ._models import CommandJob # type: ignore
from ._models import CommandJobLimits # type: ignore
from ._models import CommandReturnCodeConfig # type: ignore
from ._models import ComponentConfiguration # type: ignore
from ._models import ComponentInput # type: ignore
from ._models import ComponentJob # type: ignore
from ._models import ComponentJobInput # type: ignore
from ._models import ComponentJobOutput # type: ignore
from ._models import ComponentNameAndDefaultVersion # type: ignore
from ._models import ComponentNameMetaInfo # type: ignore
from ._models import ComponentOutput # type: ignore
from ._models import ComponentPreflightResult # type: ignore
from ._models import ComponentSpecMetaInfo # type: ignore
from ._models import ComponentUpdateRequest # type: ignore
from ._models import ComponentValidationRequest # type: ignore
from ._models import ComponentValidationResponse # type: ignore
from ._models import Compute # type: ignore
from ._models import ComputeConfiguration # type: ignore
from ._models import ComputeContract # type: ignore
from ._models import ComputeIdentityContract # type: ignore
from ._models import ComputeIdentityDto # type: ignore
from ._models import ComputeInfo # type: ignore
from ._models import ComputeProperties # type: ignore
from ._models import ComputeRPUserAssignedIdentity # type: ignore
from ._models import ComputeRequest # type: ignore
from ._models import ComputeSetting # type: ignore
from ._models import ComputeStatus # type: ignore
from ._models import ComputeStatusDetail # type: ignore
from ._models import ComputeWarning # type: ignore
from ._models import ConnectionConfigSpec # type: ignore
from ._models import ConnectionDto # type: ignore
from ._models import ConnectionEntity # type: ignore
from ._models import ConnectionOverrideSetting # type: ignore
from ._models import ConnectionSpec # type: ignore
from ._models import ContainerInstanceConfiguration # type: ignore
from ._models import ContainerRegistry # type: ignore
from ._models import ContainerResourceRequirements # type: ignore
from ._models import ControlInput # type: ignore
from ._models import ControlOutput # type: ignore
from ._models import CopyDataTask # type: ignore
from ._models import CreateFlowFromSampleRequest # type: ignore
from ._models import CreateFlowRequest # type: ignore
from ._models import CreateFlowRuntimeRequest # type: ignore
from ._models import CreateFlowSessionRequest # type: ignore
from ._models import CreateInferencePipelineRequest # type: ignore
from ._models import CreateOrUpdateConnectionRequest # type: ignore
from ._models import CreateOrUpdateConnectionRequestDto # type: ignore
from ._models import CreatePipelineDraftRequest # type: ignore
from ._models import CreatePipelineJobScheduleDto # type: ignore
from ._models import CreatePublishedPipelineRequest # type: ignore
from ._models import CreateRealTimeEndpointRequest # type: ignore
from ._models import CreatedBy # type: ignore
from ._models import CreatedFromDto # type: ignore
from ._models import CreationContext # type: ignore
from ._models import Cron # type: ignore
from ._models import CustomConnectionConfig # type: ignore
from ._models import CustomReference # type: ignore
from ._models import DBFSReference # type: ignore
from ._models import Data # type: ignore
from ._models import DataInfo # type: ignore
from ._models import DataLocation # type: ignore
from ._models import DataPath # type: ignore
from ._models import DataPathParameter # type: ignore
from ._models import DataPortDto # type: ignore
from ._models import DataReference # type: ignore
from ._models import DataReferenceConfiguration # type: ignore
from ._models import DataSetDefinition # type: ignore
from ._models import DataSetDefinitionValue # type: ignore
from ._models import DataSetPathParameter # type: ignore
from ._models import DataSettings # type: ignore
from ._models import DataTransferCloudConfiguration # type: ignore
from ._models import DataTransferSink # type: ignore
from ._models import DataTransferSource # type: ignore
from ._models import DataTransferV2CloudSetting # type: ignore
from ._models import DataTypeCreationInfo # type: ignore
from ._models import DatabaseSink # type: ignore
from ._models import DatabaseSource # type: ignore
from ._models import DatabricksComputeInfo # type: ignore
from ._models import DatabricksConfiguration # type: ignore
from ._models import DatacacheConfiguration # type: ignore
from ._models import DatasetIdentifier # type: ignore
from ._models import DatasetInputDetails # type: ignore
from ._models import DatasetLineage # type: ignore
from ._models import DatasetOutput # type: ignore
from ._models import DatasetOutputDetails # type: ignore
from ._models import DatasetOutputOptions # type: ignore
from ._models import DatasetRegistration # type: ignore
from ._models import DatasetRegistrationOptions # type: ignore
from ._models import DatastoreSetting # type: ignore
from ._models import DbfsStorageInfoDto # type: ignore
from ._models import DebugInfoResponse # type: ignore
from ._models import DeployFlowRequest # type: ignore
from ._models import DeploymentInfo # type: ignore
from ._models import DistributionConfiguration # type: ignore
from ._models import DistributionParameter # type: ignore
from ._models import DoWhileControlFlowInfo # type: ignore
from ._models import DoWhileControlFlowRunSettings # type: ignore
from ._models import DockerBuildContext # type: ignore
from ._models import DockerConfiguration # type: ignore
from ._models import DockerImagePlatform # type: ignore
from ._models import DockerSection # type: ignore
from ._models import DockerSettingConfiguration # type: ignore
from ._models import DownloadResourceInfo # type: ignore
from ._models import EPRPipelineRunErrorClassificationRequest # type: ignore
from ._models import EndpointSetting # type: ignore
from ._models import EntityInterface # type: ignore
from ._models import EntrySetting # type: ignore
from ._models import EnumParameterRule # type: ignore
from ._models import EnvironmentConfiguration # type: ignore
from ._models import EnvironmentDefinition # type: ignore
from ._models import EnvironmentDefinitionDto # type: ignore
from ._models import ErrorAdditionalInfo # type: ignore
from ._models import ErrorResponse # type: ignore
from ._models import EsCloudConfiguration # type: ignore
from ._models import EvaluationFlowRunSettings # type: ignore
from ._models import ExampleRequest # type: ignore
from ._models import ExecutionContextDto # type: ignore
from ._models import ExecutionDataLocation # type: ignore
from ._models import ExecutionDataPath # type: ignore
from ._models import ExecutionGlobsOptions # type: ignore
from ._models import ExperimentComputeMetaInfo # type: ignore
from ._models import ExperimentInfo # type: ignore
from ._models import ExportComponentMetaInfo # type: ignore
from ._models import ExportDataTask # type: ignore
from ._models import FeaturizationSettings # type: ignore
from ._models import FeedDto # type: ignore
from ._models import FeedDtoSupportedAssetTypes # type: ignore
from ._models import FileSystem # type: ignore
from ._models import Flow # type: ignore
from ._models import FlowAnnotations # type: ignore
from ._models import FlowBaseDto # type: ignore
from ._models import FlowDto # type: ignore
from ._models import FlowEnvironment # type: ignore
from ._models import FlowFeature # type: ignore
from ._models import FlowFeatureState # type: ignore
from ._models import FlowGraph # type: ignore
from ._models import FlowGraphAnnotationNode # type: ignore
from ._models import FlowGraphLayout # type: ignore
from ._models import FlowGraphReference # type: ignore
from ._models import FlowIndexEntity # type: ignore
from ._models import FlowInputDefinition # type: ignore
from ._models import FlowNode # type: ignore
from ._models import FlowNodeLayout # type: ignore
from ._models import FlowNodeVariant # type: ignore
from ._models import FlowOutputDefinition # type: ignore
from ._models import FlowProperties # type: ignore
from ._models import FlowRunBasePath # type: ignore
from ._models import FlowRunInfo # type: ignore
from ._models import FlowRunResult # type: ignore
from ._models import FlowRunSettings # type: ignore
from ._models import FlowRuntimeCapability # type: ignore
from ._models import FlowRuntimeDto # type: ignore
from ._models import FlowSampleDto # type: ignore
from ._models import FlowSessionDto # type: ignore
from ._models import FlowSnapshot # type: ignore
from ._models import FlowSubmitRunSettings # type: ignore
from ._models import FlowTestInfo # type: ignore
from ._models import FlowTestStorageSetting # type: ignore
from ._models import FlowToolSettingParameter # type: ignore
from ._models import FlowToolsDto # type: ignore
from ._models import FlowVariantNode # type: ignore
from ._models import ForecastHorizon # type: ignore
from ._models import ForecastingSettings # type: ignore
from ._models import GeneralSettings # type: ignore
from ._models import GeneratePipelineComponentRequest # type: ignore
from ._models import GenerateToolMetaRequest # type: ignore
from ._models import GetDynamicListRequest # type: ignore
from ._models import GetRunDataResultDto # type: ignore
from ._models import GetTrainingSessionDto # type: ignore
from ._models import GlobalJobDispatcherConfiguration # type: ignore
from ._models import GlobsOptions # type: ignore
from ._models import GraphAnnotationNode # type: ignore
from ._models import GraphControlNode # type: ignore
from ._models import GraphControlReferenceNode # type: ignore
from ._models import GraphDatasetNode # type: ignore
from ._models import GraphDraftEntity # type: ignore
from ._models import GraphEdge # type: ignore
from ._models import GraphLayout # type: ignore
from ._models import GraphLayoutCreationInfo # type: ignore
from ._models import GraphModuleNode # type: ignore
from ._models import GraphModuleNodeRunSetting # type: ignore
from ._models import GraphModuleNodeUIInputSetting # type: ignore
from ._models import GraphNodeStatusInfo # type: ignore
from ._models import GraphReferenceNode # type: ignore
from ._models import HdfsReference # type: ignore
from ._models import HdiClusterComputeInfo # type: ignore
from ._models import HdiConfiguration # type: ignore
from ._models import HdiRunConfiguration # type: ignore
from ._models import HistoryConfiguration # type: ignore
from ._models import HyperDriveConfiguration # type: ignore
from ._models import ICheckableLongRunningOperationResponse # type: ignore
from ._models import IdentityConfiguration # type: ignore
from ._models import IdentitySetting # type: ignore
from ._models import ImportDataTask # type: ignore
from ._models import IndexedErrorResponse # type: ignore
from ._models import InitScriptInfoDto # type: ignore
from ._models import InnerErrorDetails # type: ignore
from ._models import InnerErrorResponse # type: ignore
from ._models import InputAsset # type: ignore
from ._models import InputData # type: ignore
from ._models import InputDataBinding # type: ignore
from ._models import InputDefinition # type: ignore
from ._models import InputOutputPortMetadata # type: ignore
from ._models import InputSetting # type: ignore
from ._models import IntellectualPropertyPublisherInformation # type: ignore
from ._models import InteractiveConfig # type: ignore
from ._models import InteractiveConfiguration # type: ignore
from ._models import JobCost # type: ignore
from ._models import JobEndpoint # type: ignore
from ._models import JobInput # type: ignore
from ._models import JobOutput # type: ignore
from ._models import JobOutputArtifacts # type: ignore
from ._models import JobScheduleDto # type: ignore
from ._models import K8SConfiguration # type: ignore
from ._models import KeyValuePairComponentNameMetaInfoErrorResponse # type: ignore
from ._models import KeyValuePairComponentNameMetaInfoModuleDto # type: ignore
from ._models import KeyValuePairStringObject # type: ignore
from ._models import KubernetesConfiguration # type: ignore
from ._models import Kwarg # type: ignore
from ._models import LegacyDataPath # type: ignore
from ._models import LimitSettings # type: ignore
from ._models import LinkedADBWorkspaceMetadata # type: ignore
from ._models import LinkedPipelineInfo # type: ignore
from ._models import LoadFlowAsComponentRequest # type: ignore
from ._models import LogRunTerminatedEventDto # type: ignore
from ._models import LongRunningOperationUriResponse # type: ignore
from ._models import LongRunningUpdateRegistryComponentRequest # type: ignore
from ._models import ManagedServiceIdentity # type: ignore
from ._models import MavenLibraryDto # type: ignore
from ._models import MetricProperties # type: ignore
from ._models import MetricSchemaDto # type: ignore
from ._models import MetricSchemaPropertyDto # type: ignore
from ._models import MetricV2Dto # type: ignore
from ._models import MetricV2Value # type: ignore
from ._models import MfeInternalAutologgerSettings # type: ignore
from ._models import MfeInternalIdentityConfiguration # type: ignore
from ._models import MfeInternalNodes # type: ignore
from ._models import MfeInternalOutputData # type: ignore
from ._models import MfeInternalSecretConfiguration # type: ignore
from ._models import MfeInternalUriReference # type: ignore
from ._models import MfeInternalV20211001ComponentJob # type: ignore
from ._models import MinMaxParameterRule # type: ignore
from ._models import MlcComputeInfo # type: ignore
from ._models import ModelDto # type: ignore
from ._models import ModelManagementErrorResponse # type: ignore
from ._models import ModifyPipelineJobScheduleDto # type: ignore
from ._models import ModuleDto # type: ignore
from ._models import ModuleDtoWithErrors # type: ignore
from ._models import ModuleDtoWithValidateStatus # type: ignore
from ._models import ModuleEntity # type: ignore
from ._models import ModulePythonInterface # type: ignore
from ._models import MpiConfiguration # type: ignore
from ._models import NCrossValidations # type: ignore
from ._models import Node # type: ignore
from ._models import NodeInputPort # type: ignore
from ._models import NodeLayout # type: ignore
from ._models import NodeOutputPort # type: ignore
from ._models import NodePortInterface # type: ignore
from ._models import NodeSource # type: ignore
from ._models import NodeTelemetryMetaInfo # type: ignore
from ._models import NodeVariant # type: ignore
from ._models import Nodes # type: ignore
from ._models import NoteBookTaskDto # type: ignore
from ._models import NotificationSetting # type: ignore
from ._models import ODataError # type: ignore
from ._models import ODataErrorDetail # type: ignore
from ._models import ODataErrorResponse # type: ignore
from ._models import ODataInnerError # type: ignore
from ._models import OutputData # type: ignore
from ._models import OutputDataBinding # type: ignore
from ._models import OutputDatasetLineage # type: ignore
from ._models import OutputDefinition # type: ignore
from ._models import OutputOptions # type: ignore
from ._models import OutputSetting # type: ignore
from ._models import OutputSettingSpec # type: ignore
from ._models import PaginatedDataInfoList # type: ignore
from ._models import PaginatedModelDtoList # type: ignore
from ._models import PaginatedModuleDtoList # type: ignore
from ._models import PaginatedPipelineDraftSummaryList # type: ignore
from ._models import PaginatedPipelineEndpointSummaryList # type: ignore
from ._models import PaginatedPipelineRunSummaryList # type: ignore
from ._models import PaginatedPublishedPipelineSummaryList # type: ignore
from ._models import ParallelForControlFlowInfo # type: ignore
from ._models import ParallelTaskConfiguration # type: ignore
from ._models import Parameter # type: ignore
from ._models import ParameterAssignment # type: ignore
from ._models import ParameterDefinition # type: ignore
from ._models import PatchFlowRequest # type: ignore
from ._models import Pipeline # type: ignore
from ._models import PipelineDraft # type: ignore
from ._models import PipelineDraftStepDetails # type: ignore
from ._models import PipelineDraftSummary # type: ignore
from ._models import PipelineEndpoint # type: ignore
from ._models import PipelineEndpointSummary # type: ignore
from ._models import PipelineGraph # type: ignore
from ._models import PipelineInput # type: ignore
from ._models import PipelineJob # type: ignore
from ._models import PipelineJobRuntimeBasicSettings # type: ignore
from ._models import PipelineJobScheduleDto # type: ignore
from ._models import PipelineOutput # type: ignore
from ._models import PipelineRun # type: ignore
from ._models import PipelineRunGraphDetail # type: ignore
from ._models import PipelineRunGraphStatus # type: ignore
from ._models import PipelineRunProfile # type: ignore
from ._models import PipelineRunStatus # type: ignore
from ._models import PipelineRunStepDetails # type: ignore
from ._models import PipelineRunSummary # type: ignore
from ._models import PipelineStatus # type: ignore
from ._models import PipelineStepRun # type: ignore
from ._models import PipelineStepRunOutputs # type: ignore
from ._models import PipelineSubDraft # type: ignore
from ._models import PolicyValidationResponse # type: ignore
from ._models import PortInfo # type: ignore
from ._models import PortOutputInfo # type: ignore
from ._models import PriorityConfig # type: ignore
from ._models import PriorityConfiguration # type: ignore
from ._models import PromoteDataSetRequest # type: ignore
from ._models import ProviderEntity # type: ignore
from ._models import PublishedPipeline # type: ignore
from ._models import PublishedPipelineSummary # type: ignore
from ._models import PyTorchConfiguration # type: ignore
from ._models import PythonInterfaceMapping # type: ignore
from ._models import PythonPyPiOrRCranLibraryDto # type: ignore
from ._models import PythonSection # type: ignore
from ._models import QueueingInfo # type: ignore
from ._models import RCranPackage # type: ignore
from ._models import RGitHubPackage # type: ignore
from ._models import RSection # type: ignore
from ._models import RawComponentDto # type: ignore
from ._models import RayConfiguration # type: ignore
from ._models import RealTimeEndpoint # type: ignore
from ._models import RealTimeEndpointInfo # type: ignore
from ._models import RealTimeEndpointStatus # type: ignore
from ._models import RealTimeEndpointSummary # type: ignore
from ._models import RealTimeEndpointTestRequest # type: ignore
from ._models import Recurrence # type: ignore
from ._models import RecurrencePattern # type: ignore
from ._models import RecurrenceSchedule # type: ignore
from ._models import RegenerateServiceKeysRequest # type: ignore
from ._models import RegisterComponentMetaInfo # type: ignore
from ._models import RegisterComponentMetaInfoExtraHashes # type: ignore
from ._models import RegisterComponentMetaInfoIdentifierHashes # type: ignore
from ._models import RegisterRegistryComponentMetaInfo # type: ignore
from ._models import RegisterRegistryComponentMetaInfoExtraHashes # type: ignore
from ._models import RegisterRegistryComponentMetaInfoIdentifierHashes # type: ignore
from ._models import RegisteredDataSetReference # type: ignore
from ._models import RegistrationOptions # type: ignore
from ._models import RegistryBlobReferenceData # type: ignore
from ._models import RegistryIdentity # type: ignore
from ._models import Relationship # type: ignore
from ._models import RemoteDockerComputeInfo # type: ignore
from ._models import ResourceConfig # type: ignore
from ._models import ResourceConfiguration # type: ignore
from ._models import ResourcesSetting # type: ignore
from ._models import RetrieveToolFuncResultRequest # type: ignore
from ._models import RetryConfiguration # type: ignore
from ._models import RootError # type: ignore
from ._models import RunAnnotations # type: ignore
from ._models import RunConfiguration # type: ignore
from ._models import RunDatasetReference # type: ignore
from ._models import RunDefinition # type: ignore
from ._models import RunDetailsDto # type: ignore
from ._models import RunDetailsWarningDto # type: ignore
from ._models import RunDto # type: ignore
from ._models import RunIndexEntity # type: ignore
from ._models import RunIndexMetricSummary # type: ignore
from ._models import RunIndexMetricSummarySystemObject # type: ignore
from ._models import RunIndexResourceMetricSummary # type: ignore
from ._models import RunMetricDto # type: ignore
from ._models import RunMetricsTypesDto # type: ignore
from ._models import RunProperties # type: ignore
from ._models import RunSettingParameter # type: ignore
from ._models import RunSettingParameterAssignment # type: ignore
from ._models import RunSettingUIParameterHint # type: ignore
from ._models import RunStatusPeriod # type: ignore
from ._models import RunTypeV2 # type: ignore
from ._models import RunTypeV2Index # type: ignore
from ._models import RuntimeConfiguration # type: ignore
from ._models import SampleMeta # type: ignore
from ._models import SavePipelineDraftRequest # type: ignore
from ._models import SavedDataSetReference # type: ignore
from ._models import ScheduleBase # type: ignore
from ._models import SchemaContractsCreatedBy # type: ignore
from ._models import ScopeCloudConfiguration # type: ignore
from ._models import Seasonality # type: ignore
from ._models import SecretConfiguration # type: ignore
from ._models import SegmentedResult1 # type: ignore
from ._models import ServiceLogRequest # type: ignore
from ._models import SessionApplication # type: ignore
from ._models import SessionApplicationRunCommandResult # type: ignore
from ._models import SessionProperties # type: ignore
from ._models import SetupFlowSessionRequest # type: ignore
from ._models import SharingScope # type: ignore
from ._models import Snapshot # type: ignore
from ._models import SnapshotInfo # type: ignore
from ._models import SourceCodeDataReference # type: ignore
from ._models import SparkConfiguration # type: ignore
from ._models import SparkJarTaskDto # type: ignore
from ._models import SparkJob # type: ignore
from ._models import SparkJobEntry # type: ignore
from ._models import SparkMavenPackage # type: ignore
from ._models import SparkPythonTaskDto # type: ignore
from ._models import SparkResourceConfiguration # type: ignore
from ._models import SparkSection # type: ignore
from ._models import SparkSubmitTaskDto # type: ignore
from ._models import SqlDataPath # type: ignore
from ._models import StackEnsembleSettings # type: ignore
from ._models import StandbyPoolProperties # type: ignore
from ._models import StandbyPoolResourceStatus # type: ignore
from ._models import StartRunResult # type: ignore
from ._models import StepRunProfile # type: ignore
from ._models import StorageInfo # type: ignore
from ._models import StoredProcedureParameter # type: ignore
from ._models import Stream # type: ignore
from ._models import StructuredInterface # type: ignore
from ._models import StructuredInterfaceInput # type: ignore
from ._models import StructuredInterfaceOutput # type: ignore
from ._models import StructuredInterfaceParameter # type: ignore
from ._models import StudioMigrationInfo # type: ignore
from ._models import SubGraphConcatenateAssignment # type: ignore
from ._models import SubGraphConfiguration # type: ignore
from ._models import SubGraphConnectionInfo # type: ignore
from ._models import SubGraphDataPathParameterAssignment # type: ignore
from ._models import SubGraphInfo # type: ignore
from ._models import SubGraphParameterAssignment # type: ignore
from ._models import SubGraphPortInfo # type: ignore
from ._models import SubPipelineDefinition # type: ignore
from ._models import SubPipelineParameterAssignment # type: ignore
from ._models import SubPipelinesInfo # type: ignore
from ._models import SubStatusPeriod # type: ignore
from ._models import SubmitBulkRunRequest # type: ignore
from ._models import SubmitBulkRunResponse # type: ignore
from ._models import SubmitFlowRequest # type: ignore
from ._models import SubmitPipelineRunRequest # type: ignore
from ._models import SweepEarlyTerminationPolicy # type: ignore
from ._models import SweepSettings # type: ignore
from ._models import SweepSettingsLimits # type: ignore
from ._models import SystemData # type: ignore
from ._models import SystemMeta # type: ignore
from ._models import SystemMetaExtraHashes # type: ignore
from ._models import SystemMetaIdentifierHashes # type: ignore
from ._models import TargetLags # type: ignore
from ._models import TargetRollingWindowSize # type: ignore
from ._models import TargetSelectorConfiguration # type: ignore
from ._models import Task # type: ignore
from ._models import TaskControlFlowInfo # type: ignore
from ._models import TaskReuseInfo # type: ignore
from ._models import TensorflowConfiguration # type: ignore
from ._models import TestDataSettings # type: ignore
from ._models import Tool # type: ignore
from ._models import ToolFuncResponse # type: ignore
from ._models import ToolInputDynamicList # type: ignore
from ._models import ToolInputGeneratedBy # type: ignore
from ._models import ToolMetaDto # type: ignore
from ._models import ToolSetting # type: ignore
from ._models import ToolSourceMeta # type: ignore
from ._models import TorchDistributedConfiguration # type: ignore
from ._models import TrainingDiagnosticConfiguration # type: ignore
from ._models import TrainingOutput # type: ignore
from ._models import TrainingSettings # type: ignore
from ._models import TriggerAsyncOperationStatus # type: ignore
from ._models import TuningNodeSetting # type: ignore
from ._models import TypedAssetReference # type: ignore
from ._models import UIAzureOpenAIDeploymentNameSelector # type: ignore
from ._models import UIAzureOpenAIModelCapabilities # type: ignore
from ._models import UIColumnPicker # type: ignore
from ._models import UIComputeSelection # type: ignore
from ._models import UIHyperparameterConfiguration # type: ignore
from ._models import UIInputSetting # type: ignore
from ._models import UIJsonEditor # type: ignore
from ._models import UIParameterHint # type: ignore
from ._models import UIPromptFlowConnectionSelector # type: ignore
from ._models import UIWidgetMetaInfo # type: ignore
from ._models import UIYamlEditor # type: ignore
from ._models import UnversionedEntityRequestDto # type: ignore
from ._models import UnversionedEntityResponseDto # type: ignore
from ._models import UnversionedRebuildIndexDto # type: ignore
from ._models import UnversionedRebuildResponseDto # type: ignore
from ._models import UpdateComponentRequest # type: ignore
from ._models import UpdateFlowRequest # type: ignore
from ._models import UpdateFlowRuntimeRequest # type: ignore
from ._models import UpdateRegistryComponentRequest # type: ignore
from ._models import UploadOptions # type: ignore
from ._models import UriReference # type: ignore
from ._models import User # type: ignore
from ._models import UserAssignedIdentity # type: ignore
from ._models import ValidationDataSettings # type: ignore
from ._models import VariantNode # type: ignore
from ._models import WebServiceComputeMetaInfo # type: ignore
from ._models import WebServicePort # type: ignore
from ._models import Webhook # type: ignore
from ._models import WorkspaceConnectionSpec # type: ignore
from ._azure_machine_learning_designer_service_client_enums import (
AEVAAssetType,
AEVADataStoreMode,
AEVAIdentityType,
ActionType,
AetherArgumentValueType,
AetherAssetType,
AetherBuildSourceType,
AetherComputeType,
AetherControlFlowType,
AetherControlInputValue,
AetherDataCopyMode,
AetherDataLocationStorageType,
AetherDataReferenceType,
AetherDataStoreMode,
AetherDataTransferStorageType,
AetherDataTransferTaskType,
AetherDatasetType,
AetherEarlyTerminationPolicyType,
AetherEntityStatus,
AetherExecutionEnvironment,
AetherExecutionPhase,
AetherFeaturizationMode,
AetherFileBasedPathType,
AetherForecastHorizonMode,
AetherIdentityType,
AetherLogVerbosity,
AetherModuleDeploymentSource,
AetherModuleHashVersion,
AetherModuleType,
AetherNCrossValidationMode,
AetherParameterType,
AetherParameterValueType,
AetherPrimaryMetrics,
AetherRepositoryType,
AetherResourceOperator,
AetherResourceValueType,
AetherSamplingAlgorithmType,
AetherSeasonalityMode,
AetherShortSeriesHandlingConfiguration,
AetherStackMetaLearnerType,
AetherStoredProcedureParameterType,
AetherTabularTrainingMode,
AetherTargetAggregationFunction,
AetherTargetLagsMode,
AetherTargetRollingWindowSizeMode,
AetherTaskType,
AetherTrainingOutputType,
AetherUIScriptLanguageEnum,
AetherUIWidgetTypeEnum,
AetherUploadState,
AetherUseStl,
ApplicationEndpointType,
ArgumentValueType,
AssetScopeTypes,
AssetSourceType,
AssetType,
AutoDeleteCondition,
BuildContextLocationType,
Communicator,
ComponentRegistrationTypeEnum,
ComponentType,
ComputeEnvironmentType,
ComputeTargetType,
ComputeType,
ConfigValueType,
ConnectionCategory,
ConnectionScope,
ConnectionSourceType,
ConnectionType,
ConsumeMode,
ControlFlowType,
ControlInputValue,
DataBindingMode,
DataCategory,
DataCopyMode,
DataLocationStorageType,
DataPortType,
DataReferenceType,
DataSourceType,
DataStoreMode,
DataTransferStorageType,
DataTransferTaskType,
DataTypeMechanism,
DatasetAccessModes,
DatasetConsumptionType,
DatasetDeliveryMechanism,
DatasetOutputType,
DatasetType,
DeliveryMechanism,
DistributionParameterEnum,
DistributionType,
EarlyTerminationPolicyType,
EmailNotificationEnableType,
EndpointAuthMode,
EntityKind,
EntityStatus,
ErrorHandlingMode,
ExecutionPhase,
FeaturizationMode,
FlowFeatureStateEnum,
FlowLanguage,
FlowPatchOperationType,
FlowRunMode,
FlowRunTypeEnum,
FlowRuntimeSubmissionApiVersion,
FlowTestMode,
FlowType,
ForecastHorizonMode,
Framework,
Frequency,
GlobalJobDispatcherSupportedComputeType,
GraphComponentsMode,
GraphDatasetsLoadModes,
GraphSdkCodeType,
HttpStatusCode,
IdentityType,
InputType,
IntellectualPropertyAccessMode,
JobInputType,
JobLimitsType,
JobOutputType,
JobProvisioningState,
JobStatus,
JobType,
KeyType,
ListViewType,
LogLevel,
LogVerbosity,
LongRunningUpdateType,
MLFlowAutologgerState,
ManagedServiceIdentityType,
MetricValueType,
MfeInternalIdentityType,
MfeInternalMLFlowAutologgerState,
MfeInternalScheduleStatus,
ModuleDtoFields,
ModuleInfoFromYamlStatusEnum,
ModuleRunSettingTypes,
ModuleScope,
ModuleSourceType,
ModuleType,
ModuleUpdateOperationType,
ModuleWorkingMechanism,
NCrossValidationMode,
NodeCompositionMode,
NodesValueType,
Orientation,
OutputMechanism,
ParameterType,
ParameterValueType,
PipelineDraftMode,
PipelineRunStatusCode,
PipelineStatusCode,
PipelineType,
PortAction,
PrimaryMetrics,
ProvisioningState,
RealTimeEndpointInternalStepCode,
RealTimeEndpointOpCode,
RealTimeEndpointOpStatusCode,
RecurrenceFrequency,
RunDisplayNameGenerationType,
RunSettingParameterType,
RunSettingUIWidgetTypeEnum,
RunStatus,
RunType,
RuntimeStatusEnum,
RuntimeType,
SamplingAlgorithmType,
ScheduleProvisioningStatus,
ScheduleStatus,
ScheduleType,
ScopeType,
ScriptType,
SeasonalityMode,
Section,
SessionSetupModeEnum,
SetupFlowSessionAction,
SeverityLevel,
ShortSeriesHandlingConfiguration,
StackMetaLearnerType,
StorageAuthType,
StoredProcedureParameterType,
SuccessfulCommandReturnCode,
TabularTrainingMode,
TargetAggregationFunction,
TargetLagsMode,
TargetRollingWindowSizeMode,
TaskCreationOptions,
TaskStatus,
TaskStatusCode,
TaskType,
ToolFuncCallScenario,
ToolState,
ToolType,
TrainingOutputType,
TriggerOperationType,
TriggerType,
UIInputDataDeliveryMode,
UIScriptLanguageEnum,
UIWidgetTypeEnum,
UploadState,
UseStl,
UserType,
ValidationStatus,
ValueType,
VmPriority,
WebServiceState,
WeekDays,
Weekday,
YarnDeployMode,
)
__all__ = [
'ACIAdvanceSettings',
'AEVAComputeConfiguration',
'AEVAResourceConfiguration',
'AISuperComputerConfiguration',
'AISuperComputerScalePolicy',
'AISuperComputerStorageReferenceConfiguration',
'AKSAdvanceSettings',
'AKSReplicaStatus',
'AMLComputeConfiguration',
'APCloudConfiguration',
'Activate',
'AdditionalErrorInfo',
'AdhocTriggerScheduledCommandJobRequest',
'AdhocTriggerScheduledSparkJobRequest',
'AetherAPCloudConfiguration',
'AetherAmlDataset',
'AetherAmlSparkCloudSetting',
'AetherArgumentAssignment',
'AetherAssetDefinition',
'AetherAssetOutputSettings',
'AetherAutoFeaturizeConfiguration',
'AetherAutoMLComponentConfiguration',
'AetherAutoTrainConfiguration',
'AetherAzureBlobReference',
'AetherAzureDataLakeGen2Reference',
'AetherAzureDataLakeReference',
'AetherAzureDatabaseReference',
'AetherAzureFilesReference',
'AetherBatchAiComputeInfo',
'AetherBuildArtifactInfo',
'AetherCloudBuildDropPathInfo',
'AetherCloudBuildInfo',
'AetherCloudBuildQueueInfo',
'AetherCloudPrioritySetting',
'AetherCloudSettings',
'AetherColumnTransformer',
'AetherComputeConfiguration',
'AetherComputeSetting',
'AetherControlInput',
'AetherControlOutput',
'AetherCopyDataTask',
'AetherCosmosReference',
'AetherCreatedBy',
'AetherCustomReference',
'AetherDBFSReference',
'AetherDataLocation',
'AetherDataLocationReuseCalculationFields',
'AetherDataPath',
'AetherDataReference',
'AetherDataSetDefinition',
'AetherDataSetDefinitionValue',
'AetherDataSettings',
'AetherDataTransferCloudConfiguration',
'AetherDataTransferSink',
'AetherDataTransferSource',
'AetherDataTransferV2CloudSetting',
'AetherDatabaseSink',
'AetherDatabaseSource',
'AetherDatabricksComputeInfo',
'AetherDatasetOutput',
'AetherDatasetOutputOptions',
'AetherDatasetRegistration',
'AetherDatastoreSetting',
'AetherDoWhileControlFlowInfo',
'AetherDoWhileControlFlowRunSettings',
'AetherDockerSettingConfiguration',
'AetherEntityInterfaceDocumentation',
'AetherEntrySetting',
'AetherEnvironmentConfiguration',
'AetherEsCloudConfiguration',
'AetherExportDataTask',
'AetherFeaturizationSettings',
'AetherFileSystem',
'AetherForecastHorizon',
'AetherForecastingSettings',
'AetherGeneralSettings',
'AetherGlobsOptions',
'AetherGraphControlNode',
'AetherGraphControlReferenceNode',
'AetherGraphDatasetNode',
'AetherGraphEdge',
'AetherGraphEntity',
'AetherGraphModuleNode',
'AetherGraphReferenceNode',
'AetherHdfsReference',
'AetherHdiClusterComputeInfo',
'AetherHdiRunConfiguration',
'AetherHyperDriveConfiguration',
'AetherIdentitySetting',
'AetherImportDataTask',
'AetherInputSetting',
'AetherInteractiveConfig',
'AetherK8SConfiguration',
'AetherLegacyDataPath',
'AetherLimitSettings',
'AetherMlcComputeInfo',
'AetherModuleEntity',
'AetherModuleExtendedProperties',
'AetherNCrossValidations',
'AetherOutputSetting',
'AetherParallelForControlFlowInfo',
'AetherParameterAssignment',
'AetherPhillyHdfsReference',
'AetherPortInfo',
'AetherPriorityConfig',
'AetherPriorityConfiguration',
'AetherRegisteredDataSetReference',
'AetherRemoteDockerComputeInfo',
'AetherResourceAssignment',
'AetherResourceAttributeAssignment',
'AetherResourceAttributeDefinition',
'AetherResourceConfig',
'AetherResourceConfiguration',
'AetherResourceModel',
'AetherResourcesSetting',
'AetherSavedDataSetReference',
'AetherScopeCloudConfiguration',
'AetherSeasonality',
'AetherSqlDataPath',
'AetherStackEnsembleSettings',
'AetherStoredProcedureParameter',
'AetherStructuredInterface',
'AetherStructuredInterfaceInput',
'AetherStructuredInterfaceOutput',
'AetherStructuredInterfaceParameter',
'AetherSubGraphConfiguration',
'AetherSweepEarlyTerminationPolicy',
'AetherSweepSettings',
'AetherSweepSettingsLimits',
'AetherTargetLags',
'AetherTargetRollingWindowSize',
'AetherTargetSelectorConfiguration',
'AetherTestDataSettings',
'AetherTorchDistributedConfiguration',
'AetherTrainingOutput',
'AetherTrainingSettings',
'AetherUIAzureOpenAIDeploymentNameSelector',
'AetherUIAzureOpenAIModelCapabilities',
'AetherUIColumnPicker',
'AetherUIJsonEditor',
'AetherUIParameterHint',
'AetherUIPromptFlowConnectionSelector',
'AetherValidationDataSettings',
'AetherVsoBuildArtifactInfo',
'AetherVsoBuildDefinitionInfo',
'AetherVsoBuildInfo',
'AmlDataset',
'AmlK8SConfiguration',
'AmlK8SPriorityConfiguration',
'AmlSparkCloudSetting',
'ApiAndParameters',
'ApplicationEndpointConfiguration',
'ArgumentAssignment',
'Asset',
'AssetDefinition',
'AssetNameAndVersionIdentifier',
'AssetOutputSettings',
'AssetOutputSettingsParameter',
'AssetPublishResult',
'AssetPublishSingleRegionResult',
'AssetTypeMetaInfo',
'AssetVersionPublishRequest',
'AssignedUser',
'AuthKeys',
'AutoClusterComputeSpecification',
'AutoDeleteSetting',
'AutoFeaturizeConfiguration',
'AutoMLComponentConfiguration',
'AutoScaler',
'AutoTrainConfiguration',
'AutologgerSettings',
'AvailabilityResponse',
'AzureBlobReference',
'AzureDataLakeGen2Reference',
'AzureDataLakeReference',
'AzureDatabaseReference',
'AzureFilesReference',
'AzureMLModuleVersionDescriptor',
'AzureOpenAIDeploymentDto',
'AzureOpenAIModelCapabilities',
'BatchAiComputeInfo',
'BatchDataInput',
'BatchExportComponentSpecResponse',
'BatchExportRawComponentResponse',
'BatchGetComponentHashesRequest',
'BatchGetComponentRequest',
'Binding',
'BulkTestDto',
'CloudError',
'CloudPrioritySetting',
'CloudSettings',
'ColumnTransformer',
'CommandJob',
'CommandJobLimits',
'CommandReturnCodeConfig',
'ComponentConfiguration',
'ComponentInput',
'ComponentJob',
'ComponentJobInput',
'ComponentJobOutput',
'ComponentNameAndDefaultVersion',
'ComponentNameMetaInfo',
'ComponentOutput',
'ComponentPreflightResult',
'ComponentSpecMetaInfo',
'ComponentUpdateRequest',
'ComponentValidationRequest',
'ComponentValidationResponse',
'Compute',
'ComputeConfiguration',
'ComputeContract',
'ComputeIdentityContract',
'ComputeIdentityDto',
'ComputeInfo',
'ComputeProperties',
'ComputeRPUserAssignedIdentity',
'ComputeRequest',
'ComputeSetting',
'ComputeStatus',
'ComputeStatusDetail',
'ComputeWarning',
'ConnectionConfigSpec',
'ConnectionDto',
'ConnectionEntity',
'ConnectionOverrideSetting',
'ConnectionSpec',
'ContainerInstanceConfiguration',
'ContainerRegistry',
'ContainerResourceRequirements',
'ControlInput',
'ControlOutput',
'CopyDataTask',
'CreateFlowFromSampleRequest',
'CreateFlowRequest',
'CreateFlowRuntimeRequest',
'CreateFlowSessionRequest',
'CreateInferencePipelineRequest',
'CreateOrUpdateConnectionRequest',
'CreateOrUpdateConnectionRequestDto',
'CreatePipelineDraftRequest',
'CreatePipelineJobScheduleDto',
'CreatePublishedPipelineRequest',
'CreateRealTimeEndpointRequest',
'CreatedBy',
'CreatedFromDto',
'CreationContext',
'Cron',
'CustomConnectionConfig',
'CustomReference',
'DBFSReference',
'Data',
'DataInfo',
'DataLocation',
'DataPath',
'DataPathParameter',
'DataPortDto',
'DataReference',
'DataReferenceConfiguration',
'DataSetDefinition',
'DataSetDefinitionValue',
'DataSetPathParameter',
'DataSettings',
'DataTransferCloudConfiguration',
'DataTransferSink',
'DataTransferSource',
'DataTransferV2CloudSetting',
'DataTypeCreationInfo',
'DatabaseSink',
'DatabaseSource',
'DatabricksComputeInfo',
'DatabricksConfiguration',
'DatacacheConfiguration',
'DatasetIdentifier',
'DatasetInputDetails',
'DatasetLineage',
'DatasetOutput',
'DatasetOutputDetails',
'DatasetOutputOptions',
'DatasetRegistration',
'DatasetRegistrationOptions',
'DatastoreSetting',
'DbfsStorageInfoDto',
'DebugInfoResponse',
'DeployFlowRequest',
'DeploymentInfo',
'DistributionConfiguration',
'DistributionParameter',
'DoWhileControlFlowInfo',
'DoWhileControlFlowRunSettings',
'DockerBuildContext',
'DockerConfiguration',
'DockerImagePlatform',
'DockerSection',
'DockerSettingConfiguration',
'DownloadResourceInfo',
'EPRPipelineRunErrorClassificationRequest',
'EndpointSetting',
'EntityInterface',
'EntrySetting',
'EnumParameterRule',
'EnvironmentConfiguration',
'EnvironmentDefinition',
'EnvironmentDefinitionDto',
'ErrorAdditionalInfo',
'ErrorResponse',
'EsCloudConfiguration',
'EvaluationFlowRunSettings',
'ExampleRequest',
'ExecutionContextDto',
'ExecutionDataLocation',
'ExecutionDataPath',
'ExecutionGlobsOptions',
'ExperimentComputeMetaInfo',
'ExperimentInfo',
'ExportComponentMetaInfo',
'ExportDataTask',
'FeaturizationSettings',
'FeedDto',
'FeedDtoSupportedAssetTypes',
'FileSystem',
'Flow',
'FlowAnnotations',
'FlowBaseDto',
'FlowDto',
'FlowEnvironment',
'FlowFeature',
'FlowFeatureState',
'FlowGraph',
'FlowGraphAnnotationNode',
'FlowGraphLayout',
'FlowGraphReference',
'FlowIndexEntity',
'FlowInputDefinition',
'FlowNode',
'FlowNodeLayout',
'FlowNodeVariant',
'FlowOutputDefinition',
'FlowProperties',
'FlowRunBasePath',
'FlowRunInfo',
'FlowRunResult',
'FlowRunSettings',
'FlowRuntimeCapability',
'FlowRuntimeDto',
'FlowSampleDto',
'FlowSessionDto',
'FlowSnapshot',
'FlowSubmitRunSettings',
'FlowTestInfo',
'FlowTestStorageSetting',
'FlowToolSettingParameter',
'FlowToolsDto',
'FlowVariantNode',
'ForecastHorizon',
'ForecastingSettings',
'GeneralSettings',
'GeneratePipelineComponentRequest',
'GenerateToolMetaRequest',
'GetDynamicListRequest',
'GetRunDataResultDto',
'GetTrainingSessionDto',
'GlobalJobDispatcherConfiguration',
'GlobsOptions',
'GraphAnnotationNode',
'GraphControlNode',
'GraphControlReferenceNode',
'GraphDatasetNode',
'GraphDraftEntity',
'GraphEdge',
'GraphLayout',
'GraphLayoutCreationInfo',
'GraphModuleNode',
'GraphModuleNodeRunSetting',
'GraphModuleNodeUIInputSetting',
'GraphNodeStatusInfo',
'GraphReferenceNode',
'HdfsReference',
'HdiClusterComputeInfo',
'HdiConfiguration',
'HdiRunConfiguration',
'HistoryConfiguration',
'HyperDriveConfiguration',
'ICheckableLongRunningOperationResponse',
'IdentityConfiguration',
'IdentitySetting',
'ImportDataTask',
'IndexedErrorResponse',
'InitScriptInfoDto',
'InnerErrorDetails',
'InnerErrorResponse',
'InputAsset',
'InputData',
'InputDataBinding',
'InputDefinition',
'InputOutputPortMetadata',
'InputSetting',
'IntellectualPropertyPublisherInformation',
'InteractiveConfig',
'InteractiveConfiguration',
'JobCost',
'JobEndpoint',
'JobInput',
'JobOutput',
'JobOutputArtifacts',
'JobScheduleDto',
'K8SConfiguration',
'KeyValuePairComponentNameMetaInfoErrorResponse',
'KeyValuePairComponentNameMetaInfoModuleDto',
'KeyValuePairStringObject',
'KubernetesConfiguration',
'Kwarg',
'LegacyDataPath',
'LimitSettings',
'LinkedADBWorkspaceMetadata',
'LinkedPipelineInfo',
'LoadFlowAsComponentRequest',
'LogRunTerminatedEventDto',
'LongRunningOperationUriResponse',
'LongRunningUpdateRegistryComponentRequest',
'ManagedServiceIdentity',
'MavenLibraryDto',
'MetricProperties',
'MetricSchemaDto',
'MetricSchemaPropertyDto',
'MetricV2Dto',
'MetricV2Value',
'MfeInternalAutologgerSettings',
'MfeInternalIdentityConfiguration',
'MfeInternalNodes',
'MfeInternalOutputData',
'MfeInternalSecretConfiguration',
'MfeInternalUriReference',
'MfeInternalV20211001ComponentJob',
'MinMaxParameterRule',
'MlcComputeInfo',
'ModelDto',
'ModelManagementErrorResponse',
'ModifyPipelineJobScheduleDto',
'ModuleDto',
'ModuleDtoWithErrors',
'ModuleDtoWithValidateStatus',
'ModuleEntity',
'ModulePythonInterface',
'MpiConfiguration',
'NCrossValidations',
'Node',
'NodeInputPort',
'NodeLayout',
'NodeOutputPort',
'NodePortInterface',
'NodeSource',
'NodeTelemetryMetaInfo',
'NodeVariant',
'Nodes',
'NoteBookTaskDto',
'NotificationSetting',
'ODataError',
'ODataErrorDetail',
'ODataErrorResponse',
'ODataInnerError',
'OutputData',
'OutputDataBinding',
'OutputDatasetLineage',
'OutputDefinition',
'OutputOptions',
'OutputSetting',
'OutputSettingSpec',
'PaginatedDataInfoList',
'PaginatedModelDtoList',
'PaginatedModuleDtoList',
'PaginatedPipelineDraftSummaryList',
'PaginatedPipelineEndpointSummaryList',
'PaginatedPipelineRunSummaryList',
'PaginatedPublishedPipelineSummaryList',
'ParallelForControlFlowInfo',
'ParallelTaskConfiguration',
'Parameter',
'ParameterAssignment',
'ParameterDefinition',
'PatchFlowRequest',
'Pipeline',
'PipelineDraft',
'PipelineDraftStepDetails',
'PipelineDraftSummary',
'PipelineEndpoint',
'PipelineEndpointSummary',
'PipelineGraph',
'PipelineInput',
'PipelineJob',
'PipelineJobRuntimeBasicSettings',
'PipelineJobScheduleDto',
'PipelineOutput',
'PipelineRun',
'PipelineRunGraphDetail',
'PipelineRunGraphStatus',
'PipelineRunProfile',
'PipelineRunStatus',
'PipelineRunStepDetails',
'PipelineRunSummary',
'PipelineStatus',
'PipelineStepRun',
'PipelineStepRunOutputs',
'PipelineSubDraft',
'PolicyValidationResponse',
'PortInfo',
'PortOutputInfo',
'PriorityConfig',
'PriorityConfiguration',
'PromoteDataSetRequest',
'ProviderEntity',
'PublishedPipeline',
'PublishedPipelineSummary',
'PyTorchConfiguration',
'PythonInterfaceMapping',
'PythonPyPiOrRCranLibraryDto',
'PythonSection',
'QueueingInfo',
'RCranPackage',
'RGitHubPackage',
'RSection',
'RawComponentDto',
'RayConfiguration',
'RealTimeEndpoint',
'RealTimeEndpointInfo',
'RealTimeEndpointStatus',
'RealTimeEndpointSummary',
'RealTimeEndpointTestRequest',
'Recurrence',
'RecurrencePattern',
'RecurrenceSchedule',
'RegenerateServiceKeysRequest',
'RegisterComponentMetaInfo',
'RegisterComponentMetaInfoExtraHashes',
'RegisterComponentMetaInfoIdentifierHashes',
'RegisterRegistryComponentMetaInfo',
'RegisterRegistryComponentMetaInfoExtraHashes',
'RegisterRegistryComponentMetaInfoIdentifierHashes',
'RegisteredDataSetReference',
'RegistrationOptions',
'RegistryBlobReferenceData',
'RegistryIdentity',
'Relationship',
'RemoteDockerComputeInfo',
'ResourceConfig',
'ResourceConfiguration',
'ResourcesSetting',
'RetrieveToolFuncResultRequest',
'RetryConfiguration',
'RootError',
'RunAnnotations',
'RunConfiguration',
'RunDatasetReference',
'RunDefinition',
'RunDetailsDto',
'RunDetailsWarningDto',
'RunDto',
'RunIndexEntity',
'RunIndexMetricSummary',
'RunIndexMetricSummarySystemObject',
'RunIndexResourceMetricSummary',
'RunMetricDto',
'RunMetricsTypesDto',
'RunProperties',
'RunSettingParameter',
'RunSettingParameterAssignment',
'RunSettingUIParameterHint',
'RunStatusPeriod',
'RunTypeV2',
'RunTypeV2Index',
'RuntimeConfiguration',
'SampleMeta',
'SavePipelineDraftRequest',
'SavedDataSetReference',
'ScheduleBase',
'SchemaContractsCreatedBy',
'ScopeCloudConfiguration',
'Seasonality',
'SecretConfiguration',
'SegmentedResult1',
'ServiceLogRequest',
'SessionApplication',
'SessionApplicationRunCommandResult',
'SessionProperties',
'SetupFlowSessionRequest',
'SharingScope',
'Snapshot',
'SnapshotInfo',
'SourceCodeDataReference',
'SparkConfiguration',
'SparkJarTaskDto',
'SparkJob',
'SparkJobEntry',
'SparkMavenPackage',
'SparkPythonTaskDto',
'SparkResourceConfiguration',
'SparkSection',
'SparkSubmitTaskDto',
'SqlDataPath',
'StackEnsembleSettings',
'StandbyPoolProperties',
'StandbyPoolResourceStatus',
'StartRunResult',
'StepRunProfile',
'StorageInfo',
'StoredProcedureParameter',
'Stream',
'StructuredInterface',
'StructuredInterfaceInput',
'StructuredInterfaceOutput',
'StructuredInterfaceParameter',
'StudioMigrationInfo',
'SubGraphConcatenateAssignment',
'SubGraphConfiguration',
'SubGraphConnectionInfo',
'SubGraphDataPathParameterAssignment',
'SubGraphInfo',
'SubGraphParameterAssignment',
'SubGraphPortInfo',
'SubPipelineDefinition',
'SubPipelineParameterAssignment',
'SubPipelinesInfo',
'SubStatusPeriod',
'SubmitBulkRunRequest',
'SubmitBulkRunResponse',
'SubmitFlowRequest',
'SubmitPipelineRunRequest',
'SweepEarlyTerminationPolicy',
'SweepSettings',
'SweepSettingsLimits',
'SystemData',
'SystemMeta',
'SystemMetaExtraHashes',
'SystemMetaIdentifierHashes',
'TargetLags',
'TargetRollingWindowSize',
'TargetSelectorConfiguration',
'Task',
'TaskControlFlowInfo',
'TaskReuseInfo',
'TensorflowConfiguration',
'TestDataSettings',
'Tool',
'ToolFuncResponse',
'ToolInputDynamicList',
'ToolInputGeneratedBy',
'ToolMetaDto',
'ToolSetting',
'ToolSourceMeta',
'TorchDistributedConfiguration',
'TrainingDiagnosticConfiguration',
'TrainingOutput',
'TrainingSettings',
'TriggerAsyncOperationStatus',
'TuningNodeSetting',
'TypedAssetReference',
'UIAzureOpenAIDeploymentNameSelector',
'UIAzureOpenAIModelCapabilities',
'UIColumnPicker',
'UIComputeSelection',
'UIHyperparameterConfiguration',
'UIInputSetting',
'UIJsonEditor',
'UIParameterHint',
'UIPromptFlowConnectionSelector',
'UIWidgetMetaInfo',
'UIYamlEditor',
'UnversionedEntityRequestDto',
'UnversionedEntityResponseDto',
'UnversionedRebuildIndexDto',
'UnversionedRebuildResponseDto',
'UpdateComponentRequest',
'UpdateFlowRequest',
'UpdateFlowRuntimeRequest',
'UpdateRegistryComponentRequest',
'UploadOptions',
'UriReference',
'User',
'UserAssignedIdentity',
'ValidationDataSettings',
'VariantNode',
'WebServiceComputeMetaInfo',
'WebServicePort',
'Webhook',
'WorkspaceConnectionSpec',
'AEVAAssetType',
'AEVADataStoreMode',
'AEVAIdentityType',
'ActionType',
'AetherArgumentValueType',
'AetherAssetType',
'AetherBuildSourceType',
'AetherComputeType',
'AetherControlFlowType',
'AetherControlInputValue',
'AetherDataCopyMode',
'AetherDataLocationStorageType',
'AetherDataReferenceType',
'AetherDataStoreMode',
'AetherDataTransferStorageType',
'AetherDataTransferTaskType',
'AetherDatasetType',
'AetherEarlyTerminationPolicyType',
'AetherEntityStatus',
'AetherExecutionEnvironment',
'AetherExecutionPhase',
'AetherFeaturizationMode',
'AetherFileBasedPathType',
'AetherForecastHorizonMode',
'AetherIdentityType',
'AetherLogVerbosity',
'AetherModuleDeploymentSource',
'AetherModuleHashVersion',
'AetherModuleType',
'AetherNCrossValidationMode',
'AetherParameterType',
'AetherParameterValueType',
'AetherPrimaryMetrics',
'AetherRepositoryType',
'AetherResourceOperator',
'AetherResourceValueType',
'AetherSamplingAlgorithmType',
'AetherSeasonalityMode',
'AetherShortSeriesHandlingConfiguration',
'AetherStackMetaLearnerType',
'AetherStoredProcedureParameterType',
'AetherTabularTrainingMode',
'AetherTargetAggregationFunction',
'AetherTargetLagsMode',
'AetherTargetRollingWindowSizeMode',
'AetherTaskType',
'AetherTrainingOutputType',
'AetherUIScriptLanguageEnum',
'AetherUIWidgetTypeEnum',
'AetherUploadState',
'AetherUseStl',
'ApplicationEndpointType',
'ArgumentValueType',
'AssetScopeTypes',
'AssetSourceType',
'AssetType',
'AutoDeleteCondition',
'BuildContextLocationType',
'Communicator',
'ComponentRegistrationTypeEnum',
'ComponentType',
'ComputeEnvironmentType',
'ComputeTargetType',
'ComputeType',
'ConfigValueType',
'ConnectionCategory',
'ConnectionScope',
'ConnectionSourceType',
'ConnectionType',
'ConsumeMode',
'ControlFlowType',
'ControlInputValue',
'DataBindingMode',
'DataCategory',
'DataCopyMode',
'DataLocationStorageType',
'DataPortType',
'DataReferenceType',
'DataSourceType',
'DataStoreMode',
'DataTransferStorageType',
'DataTransferTaskType',
'DataTypeMechanism',
'DatasetAccessModes',
'DatasetConsumptionType',
'DatasetDeliveryMechanism',
'DatasetOutputType',
'DatasetType',
'DeliveryMechanism',
'DistributionParameterEnum',
'DistributionType',
'EarlyTerminationPolicyType',
'EmailNotificationEnableType',
'EndpointAuthMode',
'EntityKind',
'EntityStatus',
'ErrorHandlingMode',
'ExecutionPhase',
'FeaturizationMode',
'FlowFeatureStateEnum',
'FlowLanguage',
'FlowPatchOperationType',
'FlowRunMode',
'FlowRunTypeEnum',
'FlowRuntimeSubmissionApiVersion',
'FlowTestMode',
'FlowType',
'ForecastHorizonMode',
'Framework',
'Frequency',
'GlobalJobDispatcherSupportedComputeType',
'GraphComponentsMode',
'GraphDatasetsLoadModes',
'GraphSdkCodeType',
'HttpStatusCode',
'IdentityType',
'InputType',
'IntellectualPropertyAccessMode',
'JobInputType',
'JobLimitsType',
'JobOutputType',
'JobProvisioningState',
'JobStatus',
'JobType',
'KeyType',
'ListViewType',
'LogLevel',
'LogVerbosity',
'LongRunningUpdateType',
'MLFlowAutologgerState',
'ManagedServiceIdentityType',
'MetricValueType',
'MfeInternalIdentityType',
'MfeInternalMLFlowAutologgerState',
'MfeInternalScheduleStatus',
'ModuleDtoFields',
'ModuleInfoFromYamlStatusEnum',
'ModuleRunSettingTypes',
'ModuleScope',
'ModuleSourceType',
'ModuleType',
'ModuleUpdateOperationType',
'ModuleWorkingMechanism',
'NCrossValidationMode',
'NodeCompositionMode',
'NodesValueType',
'Orientation',
'OutputMechanism',
'ParameterType',
'ParameterValueType',
'PipelineDraftMode',
'PipelineRunStatusCode',
'PipelineStatusCode',
'PipelineType',
'PortAction',
'PrimaryMetrics',
'ProvisioningState',
'RealTimeEndpointInternalStepCode',
'RealTimeEndpointOpCode',
'RealTimeEndpointOpStatusCode',
'RecurrenceFrequency',
'RunDisplayNameGenerationType',
'RunSettingParameterType',
'RunSettingUIWidgetTypeEnum',
'RunStatus',
'RunType',
'RuntimeStatusEnum',
'RuntimeType',
'SamplingAlgorithmType',
'ScheduleProvisioningStatus',
'ScheduleStatus',
'ScheduleType',
'ScopeType',
'ScriptType',
'SeasonalityMode',
'Section',
'SessionSetupModeEnum',
'SetupFlowSessionAction',
'SeverityLevel',
'ShortSeriesHandlingConfiguration',
'StackMetaLearnerType',
'StorageAuthType',
'StoredProcedureParameterType',
'SuccessfulCommandReturnCode',
'TabularTrainingMode',
'TargetAggregationFunction',
'TargetLagsMode',
'TargetRollingWindowSizeMode',
'TaskCreationOptions',
'TaskStatus',
'TaskStatusCode',
'TaskType',
'ToolFuncCallScenario',
'ToolState',
'ToolType',
'TrainingOutputType',
'TriggerOperationType',
'TriggerType',
'UIInputDataDeliveryMode',
'UIScriptLanguageEnum',
'UIWidgetTypeEnum',
'UploadState',
'UseStl',
'UserType',
'ValidationStatus',
'ValueType',
'VmPriority',
'WebServiceState',
'WeekDays',
'Weekday',
'YarnDeployMode',
]
| promptflow/src/promptflow/promptflow/azure/_restclient/flow/models/__init__.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/azure/_restclient/flow/models/__init__.py",
"repo_id": "promptflow",
"token_count": 33469
} | 38 |
# Marker file for PEP 561. | promptflow/src/promptflow/promptflow/azure/_restclient/flow/py.typed/0 | {
"file_path": "promptflow/src/promptflow/promptflow/azure/_restclient/flow/py.typed",
"repo_id": "promptflow",
"token_count": 10
} | 39 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import asyncio
import concurrent
import copy
import hashlib
import json
import os
import shutil
import sys
import time
from concurrent.futures import ThreadPoolExecutor
from functools import cached_property
from pathlib import Path
from typing import Any, Dict, List, Optional, Union
import requests
from azure.ai.ml._artifacts._artifact_utilities import _upload_and_generate_remote_uri
from azure.ai.ml._scope_dependent_operations import (
OperationConfig,
OperationsContainer,
OperationScope,
_ScopeDependentOperations,
)
from azure.ai.ml.constants._common import AssetTypes, AzureMLResourceType
from azure.ai.ml.entities import Workspace
from azure.ai.ml.operations import DataOperations
from azure.ai.ml.operations._operation_orchestrator import OperationOrchestrator
from promptflow._constants import LANGUAGE_KEY, FlowLanguage
from promptflow._sdk._constants import (
LINE_NUMBER,
MAX_RUN_LIST_RESULTS,
MAX_SHOW_DETAILS_RESULTS,
PROMPT_FLOW_DIR_NAME,
PROMPT_FLOW_RUNS_DIR_NAME,
REGISTRY_URI_PREFIX,
VIS_PORTAL_URL_TMPL,
AzureRunTypes,
ListViewType,
RunDataKeys,
RunHistoryKeys,
RunStatus,
)
from promptflow._sdk._errors import InvalidRunStatusError, RunNotFoundError, RunOperationParameterError
from promptflow._sdk._telemetry import ActivityType, WorkspaceTelemetryMixin, monitor_operation
from promptflow._sdk._utils import in_jupyter_notebook, incremental_print, is_remote_uri, print_red_error
from promptflow._sdk.entities import Run
from promptflow._utils.async_utils import async_run_allowing_running_loop
from promptflow._utils.flow_utils import get_flow_lineage_id
from promptflow._utils.logger_utils import get_cli_sdk_logger
from promptflow.azure._constants._flow import AUTOMATIC_RUNTIME, AUTOMATIC_RUNTIME_NAME, CLOUD_RUNS_PAGE_SIZE
from promptflow.azure._load_functions import load_flow
from promptflow.azure._restclient.flow_service_caller import FlowServiceCaller
from promptflow.azure._utils.gerneral import get_authorization, get_user_alias_from_credential
from promptflow.azure.operations._flow_operations import FlowOperations
from promptflow.exceptions import UserErrorException
RUNNING_STATUSES = RunStatus.get_running_statuses()
logger = get_cli_sdk_logger()
class RunRequestException(Exception):
"""RunRequestException."""
def __init__(self, message):
super().__init__(message)
class RunOperations(WorkspaceTelemetryMixin, _ScopeDependentOperations):
"""RunOperations that can manage runs.
You should not instantiate this class directly. Instead, you should
create an :class:`~promptflow.azure.PFClient` instance and this operation is available as the instance's attribute.
"""
def __init__(
self,
operation_scope: OperationScope,
operation_config: OperationConfig,
all_operations: OperationsContainer,
flow_operations: FlowOperations,
credential,
service_caller: FlowServiceCaller,
workspace: Workspace,
**kwargs: Dict,
):
super().__init__(
operation_scope=operation_scope,
operation_config=operation_config,
workspace_name=operation_scope.workspace_name,
subscription_id=operation_scope.subscription_id,
resource_group_name=operation_scope.resource_group_name,
)
self._operation_scope = operation_scope
self._all_operations = all_operations
self._service_caller = service_caller
self._workspace = workspace
self._credential = credential
self._flow_operations = flow_operations
self._orchestrators = OperationOrchestrator(self._all_operations, self._operation_scope, self._operation_config)
self._workspace_default_datastore = self._datastore_operations.get_default()
@property
def _data_operations(self):
return self._all_operations.get_operation(AzureMLResourceType.DATA, lambda x: isinstance(x, DataOperations))
@property
def _datastore_operations(self) -> "DatastoreOperations":
return self._all_operations.all_operations[AzureMLResourceType.DATASTORE]
@cached_property
def _run_history_endpoint_url(self):
"""Get the endpoint url for the workspace."""
endpoint = self._service_caller._service_endpoint
return endpoint + "history/v1.0" + self._service_caller._common_azure_url_pattern
def _get_run_portal_url(self, run_id: str):
"""Get the portal url for the run."""
portal_url, run_info = None, None
try:
run_info = self._get_run_from_pfs(run_id=run_id)
except Exception as e:
logger.warning(f"Failed to get run portal url from pfs for run {run_id!r}: {str(e)}")
if run_info and hasattr(run_info, "studio_portal_endpoint"):
portal_url = run_info.studio_portal_endpoint
return portal_url
def _get_headers(self):
custom_header = {
"Authorization": get_authorization(credential=self._credential),
"Content-Type": "application/json",
}
return custom_header
@monitor_operation(activity_name="pfazure.runs.create_or_update", activity_type=ActivityType.PUBLICAPI)
def create_or_update(self, run: Run, **kwargs) -> Run:
"""Create or update a run.
:param run: Run object to create or update.
:type run: ~promptflow.entities.Run
:return: Run object created or updated.
:rtype: ~promptflow.entities.Run
"""
stream = kwargs.pop("stream", False)
reset = kwargs.pop("reset_runtime", False)
# validate the run object
run._validate_for_run_create_operation()
rest_obj = self._resolve_dependencies_in_parallel(run=run, runtime=kwargs.get("runtime"), reset=reset)
self._service_caller.submit_bulk_run(
subscription_id=self._operation_scope.subscription_id,
resource_group_name=self._operation_scope.resource_group_name,
workspace_name=self._operation_scope.workspace_name,
body=rest_obj,
)
if in_jupyter_notebook():
print(f"Portal url: {self._get_run_portal_url(run_id=run.name)}")
if stream:
self.stream(run=run.name)
return self.get(run=run.name)
@monitor_operation(activity_name="pfazure.runs.list", activity_type=ActivityType.PUBLICAPI)
def list(
self, max_results: int = MAX_RUN_LIST_RESULTS, list_view_type: ListViewType = ListViewType.ACTIVE_ONLY, **kwargs
) -> List[Run]:
"""List runs in the workspace.
:param max_results: The max number of runs to return, defaults to 50, max is 100
:type max_results: int
:param list_view_type: The list view type, defaults to ListViewType.ACTIVE_ONLY
:type list_view_type: ListViewType
:return: The list of runs.
:rtype: List[~promptflow.entities.Run]
"""
if not isinstance(max_results, int) or max_results < 0:
raise RunOperationParameterError(f"'max_results' must be a positive integer, got {max_results!r}")
headers = self._get_headers()
filter_archived = []
if list_view_type == ListViewType.ACTIVE_ONLY:
filter_archived = ["false"]
elif list_view_type == ListViewType.ARCHIVED_ONLY:
filter_archived = ["true"]
elif list_view_type == ListViewType.ALL:
filter_archived = ["true", "false"]
else:
raise RunOperationParameterError(
f"Invalid list view type: {list_view_type!r}, expecting one of ['ActiveOnly', 'ArchivedOnly', 'All']"
)
pay_load = {
"filters": [
{"field": "type", "operator": "eq", "values": ["runs"]},
{"field": "annotations/archived", "operator": "eq", "values": filter_archived},
{
"field": "properties/runType",
"operator": "contains",
"values": [
AzureRunTypes.BATCH,
AzureRunTypes.EVALUATION,
AzureRunTypes.PAIRWISE_EVALUATE,
],
},
],
"freeTextSearch": "",
"order": [{"direction": "Desc", "field": "properties/creationContext/createdTime"}],
# index service can return 100 results at most
"pageSize": min(max_results, 100),
"skip": 0,
"includeTotalResultCount": True,
"searchBuilder": "AppendPrefix",
}
endpoint = self._run_history_endpoint_url.replace("/history", "/index")
url = endpoint + "/entities"
response = requests.post(url, headers=headers, json=pay_load)
if response.status_code == 200:
entities = json.loads(response.text)
runs = entities["value"]
else:
raise RunRequestException(
f"Failed to get runs from service. Code: {response.status_code}, text: {response.text}"
)
refined_runs = []
for run in runs:
refined_runs.append(Run._from_index_service_entity(run))
return refined_runs
@monitor_operation(activity_name="pfazure.runs.get_metrics", activity_type=ActivityType.PUBLICAPI)
def get_metrics(self, run: Union[str, Run], **kwargs) -> dict:
"""Get the metrics from the run.
:param run: The run or the run object
:type run: Union[str, ~promptflow.entities.Run]
:return: The metrics
:rtype: dict
"""
run = Run._validate_and_return_run_name(run)
self._check_cloud_run_completed(run_name=run)
metrics = self._get_metrics_from_metric_service(run)
return metrics
@monitor_operation(activity_name="pfazure.runs.get_details", activity_type=ActivityType.PUBLICAPI)
def get_details(
self, run: Union[str, Run], max_results: int = MAX_SHOW_DETAILS_RESULTS, all_results: bool = False, **kwargs
) -> "DataFrame":
"""Get the details from the run.
.. note::
If `all_results` is set to True, `max_results` will be overwritten to sys.maxsize.
:param run: The run name or run object
:type run: Union[str, ~promptflow.sdk.entities.Run]
:param max_results: The max number of runs to return, defaults to 100
:type max_results: int
:param all_results: Whether to return all results, defaults to False
:type all_results: bool
:raises RunOperationParameterError: If `max_results` is not a positive integer.
:return: The details data frame.
:rtype: pandas.DataFrame
"""
from pandas import DataFrame
# if all_results is True, set max_results to sys.maxsize
if all_results:
max_results = sys.maxsize
if not isinstance(max_results, int) or max_results < 1:
raise RunOperationParameterError(f"'max_results' must be a positive integer, got {max_results!r}")
run = Run._validate_and_return_run_name(run)
self._check_cloud_run_completed(run_name=run)
child_runs = self._get_flow_runs_pagination(run, max_results=max_results)
inputs, outputs = self._get_inputs_outputs_from_child_runs(child_runs)
# if there is any line run failed, the number of inputs and outputs will be different
# this will result in pandas raising ValueError, so we need to handle mismatched case
# if all line runs are failed, no need to fill the outputs
if len(outputs) > 0:
# get total number of line runs from inputs
num_line_runs = len(list(inputs.values())[0])
num_outputs = len(list(outputs.values())[0])
if num_line_runs > num_outputs:
# build full set with None as placeholder
filled_outputs = {}
output_keys = list(outputs.keys())
for k in output_keys:
filled_outputs[k] = [None] * num_line_runs
filled_outputs[LINE_NUMBER] = list(range(num_line_runs))
for i in range(num_outputs):
line_number = outputs[LINE_NUMBER][i]
for k in output_keys:
filled_outputs[k][line_number] = outputs[k][i]
# replace defective outputs with full set
outputs = copy.deepcopy(filled_outputs)
data = {}
columns = []
for k in inputs:
new_k = f"inputs.{k}"
data[new_k] = copy.deepcopy(inputs[k])
columns.append(new_k)
for k in outputs:
new_k = f"outputs.{k}"
data[new_k] = copy.deepcopy(outputs[k])
columns.append(new_k)
df = DataFrame(data).reindex(columns=columns)
if f"outputs.{LINE_NUMBER}" in columns:
df = df.set_index(f"outputs.{LINE_NUMBER}")
return df
def _check_cloud_run_completed(self, run_name: str) -> bool:
"""Check if the cloud run is completed."""
run = self.get(run=run_name)
run._check_run_status_is_completed()
def _get_flow_runs_pagination(self, name: str, max_results: int) -> List[dict]:
# call childRuns API with pagination to avoid PFS OOM
# different from UX, run status should be completed here
flow_runs = []
start_index, end_index = 0, CLOUD_RUNS_PAGE_SIZE - 1
while start_index < max_results:
current_flow_runs = self._service_caller.get_child_runs(
subscription_id=self._operation_scope.subscription_id,
resource_group_name=self._operation_scope.resource_group_name,
workspace_name=self._operation_scope.workspace_name,
flow_run_id=name,
start_index=start_index,
end_index=end_index,
)
# no data in current page
if len(current_flow_runs) == 0:
break
start_index, end_index = start_index + CLOUD_RUNS_PAGE_SIZE, end_index + CLOUD_RUNS_PAGE_SIZE
flow_runs += current_flow_runs
return flow_runs[0:max_results]
def _extract_metrics_from_metric_service_response(self, values) -> dict:
"""Get metrics from the metric service response."""
refined_metrics = {}
metric_list = values.get("value", [])
if not metric_list:
return refined_metrics
for metric in metric_list:
metric_name = metric["name"]
if self._is_system_metric(metric_name):
continue
refined_metrics[metric_name] = metric["value"][0]["data"][metric_name]
return refined_metrics
def _get_metrics_from_metric_service(self, run_id) -> dict:
"""Get the metrics from metric service."""
headers = self._get_headers()
# refer to MetricController: https://msdata.visualstudio.com/Vienna/_git/vienna?path=/src/azureml-api/src/Metric/EntryPoints/Api/Controllers/MetricController.cs&version=GBmaster # noqa: E501
endpoint = self._run_history_endpoint_url.replace("/history/v1.0", "/metric/v2.0")
url = endpoint + f"/runs/{run_id}/lastvalues"
response = requests.post(url, headers=headers, json={})
if response.status_code == 200:
values = response.json()
return self._extract_metrics_from_metric_service_response(values)
else:
raise RunRequestException(
f"Failed to get metrics from service. Code: {response.status_code}, text: {response.text}"
)
@staticmethod
def _is_system_metric(metric: str) -> bool:
"""Check if the metric is system metric.
Current we have some system metrics like: __pf__.lines.completed, __pf__.lines.bypassed,
__pf__.lines.failed, __pf__.nodes.xx.completed
"""
return (
metric.endswith(".completed")
or metric.endswith(".bypassed")
or metric.endswith(".failed")
or metric.endswith(".is_completed")
)
@monitor_operation(activity_name="pfazure.runs.get", activity_type=ActivityType.PUBLICAPI)
def get(self, run: Union[str, Run], **kwargs) -> Run:
"""Get a run.
:param run: The run name
:type run: Union[str, ~promptflow.entities.Run]
:return: The run object
:rtype: ~promptflow.entities.Run
"""
run = Run._validate_and_return_run_name(run)
return self._get_run_from_run_history(flow_run_id=run, **kwargs)
def _get_run_from_run_history(self, flow_run_id, original_form=False, **kwargs):
"""Get run info from run history"""
headers = self._get_headers()
url = self._run_history_endpoint_url + "/rundata"
payload = {
"runId": flow_run_id,
"selectRunMetadata": True,
"selectRunDefinition": True,
"selectJobSpecification": True,
}
response = requests.post(url, headers=headers, json=payload)
if response.status_code == 200:
run = response.json()
# if original_form is True, return the original run data from run history, mainly for test use
if original_form:
return run
run_data = self._refine_run_data_from_run_history(run)
run = Run._from_run_history_entity(run_data)
return run
elif response.status_code == 404:
raise RunNotFoundError(f"Run {flow_run_id!r} not found.")
else:
raise RunRequestException(
f"Failed to get run from service. Code: {response.status_code}, text: {response.text}"
)
def _refine_run_data_from_run_history(self, run_data: dict) -> dict:
"""Refine the run data from run history.
Generate the portal url, input and output value from run history data.
"""
run_data = run_data[RunHistoryKeys.RunMetaData]
# add cloud run url
run_data[RunDataKeys.PORTAL_URL] = self._get_run_portal_url(run_id=run_data["runId"])
# get input and output value
# TODO: Unify below values to the same pattern - azureml://xx
properties = run_data["properties"]
input_data = properties.pop("azureml.promptflow.input_data", None)
input_run_id = properties.pop("azureml.promptflow.input_run_id", None)
output_data = run_data["outputs"]
if output_data:
output_data = output_data.get("flow_outputs", {}).get("assetId", None)
run_data[RunDataKeys.DATA] = input_data
run_data[RunDataKeys.RUN] = input_run_id
run_data[RunDataKeys.OUTPUT] = output_data
return run_data
def _get_run_from_index_service(self, flow_run_id, **kwargs):
"""Get run info from index service"""
headers = self._get_headers()
payload = {
"filters": [
{"field": "type", "operator": "eq", "values": ["runs"]},
{"field": "annotations/archived", "operator": "eq", "values": ["false"]},
{"field": "properties/runId", "operator": "eq", "values": [flow_run_id]},
],
"order": [{"direction": "Desc", "field": "properties/startTime"}],
"pageSize": 50,
}
endpoint = self._run_history_endpoint_url.replace("/history", "/index")
url = endpoint + "/entities"
response = requests.post(url, json=payload, headers=headers)
if response.status_code == 200:
runs = response.json().get("value", None)
if not runs:
raise RunRequestException(
f"Could not found run with run id {flow_run_id!r}, please double check the run id and try again."
)
run = runs[0]
return Run._from_index_service_entity(run)
else:
raise RunRequestException(
f"Failed to get run metrics from service. Code: {response.status_code}, text: {response.text}"
)
def _get_run_from_pfs(self, run_id, **kwargs):
"""Get run info from pfs"""
return self._service_caller.get_flow_run(
subscription_id=self._operation_scope.subscription_id,
resource_group_name=self._operation_scope.resource_group_name,
workspace_name=self._operation_scope.workspace_name,
flow_run_id=run_id,
)
@monitor_operation(activity_name="pfazure.runs.archive", activity_type=ActivityType.PUBLICAPI)
def archive(self, run: Union[str, Run]) -> Run:
"""Archive a run.
:param run: The run name or run object
:type run: Union[str, ~promptflow.entities.Run]
:return: The run object
:rtype: ~promptflow.entities.Run
"""
run = Run._validate_and_return_run_name(run)
payload = {
RunHistoryKeys.HIDDEN: True,
}
return self._modify_run_in_run_history(run_id=run, payload=payload)
@monitor_operation(activity_name="pfazure.runs.restore", activity_type=ActivityType.PUBLICAPI)
def restore(self, run: Union[str, Run]) -> Run:
"""Restore a run.
:param run: The run name or run object
:type run: Union[str, ~promptflow.entities.Run]
:return: The run object
:rtype: ~promptflow.entities.Run
"""
run = Run._validate_and_return_run_name(run)
payload = {
RunHistoryKeys.HIDDEN: False,
}
return self._modify_run_in_run_history(run_id=run, payload=payload)
def _get_log(self, flow_run_id: str) -> str:
return self._service_caller.caller.bulk_runs.get_flow_run_log_content(
subscription_id=self._operation_scope.subscription_id,
resource_group_name=self._operation_scope.resource_group_name,
workspace_name=self._operation_scope.workspace_name,
flow_run_id=flow_run_id,
headers=self._get_headers(),
)
@monitor_operation(activity_name="pfazure.runs.update", activity_type=ActivityType.PUBLICAPI)
def update(
self,
run: Union[str, Run],
display_name: Optional[str] = None,
description: Optional[str] = None,
tags: Optional[Dict[str, str]] = None,
) -> Optional[Run]:
"""Update a run. May update the display name, description or tags.
.. note::
- Display name and description are strings, and tags is a dictionary of key-value pairs, both key and value
are also strings.
- Tags is a dictionary of key-value pairs. Updating tags will overwrite the existing key-value pair,
but will not delete the existing key-value pairs.
:param run: The run name or run object
:type run: Union[str, ~promptflow.entities.Run]
:param display_name: The display name
:type display_name: Optional[str]
:param description: The description
:type description: Optional[str]
:param tags: The tags
:type tags: Optional[Dict[str, str]]
:raises UpdateRunError: If nothing or wrong type values provided to update the run.
:return: The run object
:rtype: Optional[~promptflow.entities.Run]
"""
run = Run._validate_and_return_run_name(run)
if display_name is None and description is None and tags is None:
logger.warning("Nothing provided to update the run.")
return None
payload = {}
if isinstance(display_name, str):
payload["displayName"] = display_name
elif display_name is not None:
logger.warning(f"Display name must be a string, got {type(display_name)!r}: {display_name!r}.")
if isinstance(description, str):
payload["description"] = description
elif description is not None:
logger.warning(f"Description must be a string, got {type(description)!r}: {description!r}.")
# check if the tags type is Dict[str, str]
if isinstance(tags, dict) and all(
isinstance(key, str) and isinstance(value, str) for key, value in tags.items()
):
payload["tags"] = tags
elif tags is not None:
logger.warning(f"Tags type must be 'Dict[str, str]', got non-dict or non-string key/value in tags: {tags}.")
return self._modify_run_in_run_history(run_id=run, payload=payload)
@monitor_operation(activity_name="pfazure.runs.stream", activity_type=ActivityType.PUBLICAPI)
def stream(self, run: Union[str, Run], raise_on_error: bool = True) -> Run:
"""Stream the logs of a run.
:param run: The run name or run object
:type run: Union[str, ~promptflow.entities.Run]
:param raise_on_error: Raises an exception if a run fails or canceled.
:type raise_on_error: bool
:return: The run object
:rtype: ~promptflow.entities.Run
"""
run = self.get(run=run)
# TODO: maybe we need to make this configurable
file_handler = sys.stdout
# different from Azure ML job, flow job can run very fast, so it might not print anything;
# use below variable to track this behavior, and at least print something to the user.
try:
printed = 0
stream_count = 0
start = time.time()
while run.status in RUNNING_STATUSES or run.status == RunStatus.FINALIZING:
file_handler.flush()
stream_count += 1
# print prompt every 3 times, in case there is no log printed
if stream_count % 3 == 0:
# print prompt every 3 times
file_handler.write(f"(Run status is {run.status!r}, continue streaming...)\n")
# if the run is not started for 5 minutes, print an error message and break the loop
if run.status == RunStatus.NOT_STARTED:
current = time.time()
if current - start > 300:
file_handler.write(
f"The run {run.name!r} is in status 'NotStarted' for 5 minutes, streaming is stopped."
"Please make sure you are using the latest runtime.\n"
)
break
available_logs = self._get_log(flow_run_id=run.name)
printed = incremental_print(available_logs, printed, file_handler)
time.sleep(10)
run = self.get(run=run.name)
# ensure all logs are printed
file_handler.flush()
available_logs = self._get_log(flow_run_id=run.name)
incremental_print(available_logs, printed, file_handler)
file_handler.write("======= Run Summary =======\n")
duration = None
if run._start_time and run._end_time:
duration = str(run._end_time - run._start_time)
file_handler.write(
f'Run name: "{run.name}"\n'
f'Run status: "{run.status}"\n'
f'Start time: "{run._start_time}"\n'
f'Duration: "{duration}"\n'
f'Run url: "{self._get_run_portal_url(run_id=run.name)}"'
)
except KeyboardInterrupt:
error_message = (
"The output streaming for the flow run was interrupted.\n"
"But the run is still executing on the cloud.\n"
)
print(error_message)
if run.status == RunStatus.FAILED or run.status == RunStatus.CANCELED:
if run.status == RunStatus.FAILED:
try:
error_message = run._error["error"]["message"]
except Exception: # pylint: disable=broad-except
error_message = "Run fails with unknown error."
else:
error_message = "Run is canceled."
if raise_on_error:
raise InvalidRunStatusError(error_message)
else:
print_red_error(error_message)
return run
def _resolve_data_to_asset_id(self, run: Run):
# Skip if no data provided
if run.data is None:
return
test_data = run.data
def _get_data_type(_data):
if os.path.isdir(_data):
return AssetTypes.URI_FOLDER
else:
return AssetTypes.URI_FILE
if is_remote_uri(test_data):
# Pass through ARM id or remote url
return test_data
if os.path.exists(test_data): # absolute local path, upload, transform to remote url
data_type = _get_data_type(test_data)
test_data = _upload_and_generate_remote_uri(
self._operation_scope,
self._datastore_operations,
test_data,
datastore_name=self._workspace_default_datastore.name,
show_progress=self._show_progress,
)
if data_type == AssetTypes.URI_FOLDER and test_data and not test_data.endswith("/"):
test_data = test_data + "/"
else:
raise ValueError(
f"Local path {test_data!r} not exist. "
"If it's remote data, only data with azureml prefix or remote url is supported."
)
return test_data
def _resolve_flow(self, run: Run):
if run._use_remote_flow:
return self._resolve_flow_definition_resource_id(run=run)
flow = load_flow(run.flow)
self._flow_operations._resolve_arm_id_or_upload_dependencies(
flow=flow,
# ignore .promptflow/dag.tools.json only for run submission scenario in python
ignore_tools_json=flow._flow_dict.get(LANGUAGE_KEY, None) != FlowLanguage.CSharp,
)
return flow.path
def _get_session_id(self, flow):
try:
user_alias = get_user_alias_from_credential(self._credential)
except Exception:
# fall back to unknown user when failed to get credential.
user_alias = "unknown_user"
flow_id = get_flow_lineage_id(flow_dir=flow)
session_id = f"{user_alias}_{flow_id}"
# hash and truncate to avoid the session id getting too long
# backend has a 64 bit limit for session id.
# use hexdigest to avoid non-ascii characters in session id
session_id = str(hashlib.sha256(session_id.encode()).hexdigest())[:48]
return session_id
def _get_inputs_outputs_from_child_runs(self, runs: List[Dict[str, Any]]):
"""Get the inputs and outputs from the child runs."""
inputs = {}
outputs = {}
outputs[LINE_NUMBER] = []
runs.sort(key=lambda x: x["index"])
# 1st loop, until have all outputs keys
outputs_keys = []
for run in runs:
run_outputs = run["output"]
if isinstance(run_outputs, dict):
for k in run_outputs:
outputs_keys.append(k)
break
# 2nd complete loop, get values
for run in runs:
index, run_inputs, run_outputs = run["index"], run["inputs"], run["output"]
# input should always available as a dict
for k, v in run_inputs.items():
if k not in inputs:
inputs[k] = []
inputs[k].append(v)
# output
outputs[LINE_NUMBER].append(index)
# for failed line run, output is None, instead of a dict
# in this case, we append an empty line
if not isinstance(run_outputs, dict):
for k in outputs_keys:
if k == LINE_NUMBER:
continue
if k not in outputs:
outputs[k] = []
outputs[k].append(None)
else:
for k, v in run_outputs.items():
if k not in outputs:
outputs[k] = []
outputs[k].append(v)
return inputs, outputs
@monitor_operation(activity_name="pfazure.runs.visualize", activity_type=ActivityType.PUBLICAPI)
def visualize(self, runs: Union[str, Run, List[str], List[Run]], **kwargs) -> None:
"""Visualize run(s) using Azure AI portal.
:param runs: Names of the runs, or list of run objects.
:type runs: Union[str, ~promptflow.sdk.entities.Run, List[str], List[~promptflow.sdk.entities.Run]]
"""
if not isinstance(runs, list):
runs = [runs]
validated_runs = []
for run in runs:
run_name = Run._validate_and_return_run_name(run)
validated_runs.append(run_name)
subscription_id = self._operation_scope.subscription_id
resource_group_name = self._operation_scope.resource_group_name
workspace_name = self._operation_scope.workspace_name
names = ",".join(validated_runs)
portal_url = VIS_PORTAL_URL_TMPL.format(
subscription_id=subscription_id,
resource_group_name=resource_group_name,
workspace_name=workspace_name,
names=names,
)
print(f"Web View: {portal_url}")
def _resolve_automatic_runtime(self):
logger.warning(
f"You're using {AUTOMATIC_RUNTIME}, if it's first time you're using it, "
"it may take a while to build runtime and you may see 'NotStarted' status for a while. "
)
runtime_name = AUTOMATIC_RUNTIME_NAME
return runtime_name
def _resolve_runtime(self, run, flow_path, runtime):
runtime = run._runtime or runtime
# for remote flow case, use flow name as session id
# for local flow case, use flow path to calculate session id
session_id = run._flow_name if run._use_remote_flow else self._get_session_id(flow=flow_path)
if runtime is None or runtime == AUTOMATIC_RUNTIME_NAME:
runtime = self._resolve_automatic_runtime()
elif not isinstance(runtime, str):
raise TypeError(f"runtime should be a string, got {type(runtime)} for {runtime}")
return runtime, session_id
def _resolve_dependencies_in_parallel(self, run, runtime, reset=None):
flow_path = run.flow
with ThreadPoolExecutor() as pool:
tasks = [
pool.submit(self._resolve_data_to_asset_id, run=run),
pool.submit(self._resolve_flow, run=run),
]
concurrent.futures.wait(tasks, return_when=concurrent.futures.ALL_COMPLETED)
task_results = [task.result() for task in tasks]
run.data = task_results[0]
run.flow = task_results[1]
runtime, session_id = self._resolve_runtime(run=run, flow_path=flow_path, runtime=runtime)
rest_obj = run._to_rest_object()
rest_obj.runtime_name = runtime
rest_obj.session_id = session_id
# TODO(2884482): support force reset & force install
if runtime == "None":
# HARD CODE for office scenario, use workspace default runtime when specified None
rest_obj.runtime_name = None
return rest_obj
def _refine_payload_for_run_update(self, payload: dict, key: str, value, expected_type: type) -> dict:
"""Refine the payload for run update."""
if value is not None:
payload[key] = value
return payload
def _modify_run_in_run_history(self, run_id: str, payload: dict) -> Run:
"""Modify run info in run history."""
headers = self._get_headers()
url = self._run_history_endpoint_url + f"/runs/{run_id}/modify"
response = requests.patch(url, headers=headers, json=payload)
if response.status_code == 200:
# the modify api returns different data format compared with get api, so we use get api here to
# return standard Run object
return self.get(run=run_id)
else:
raise RunRequestException(
f"Failed to modify run in run history. Code: {response.status_code}, text: {response.text}"
)
def _resolve_flow_definition_resource_id(self, run: Run):
"""Resolve the flow definition resource id."""
# for registry flow pattern, the flow uri can be passed as flow definition resource id directly
if run.flow.startswith(REGISTRY_URI_PREFIX):
return run.flow
# for workspace flow pattern, generate the flow definition resource id
workspace_id = self._workspace._workspace_id
location = self._workspace.location
return f"azureml://locations/{location}/workspaces/{workspace_id}/flows/{run._flow_name}"
@monitor_operation(activity_name="pfazure.runs.download", activity_type=ActivityType.PUBLICAPI)
def download(
self, run: Union[str, Run], output: Optional[Union[str, Path]] = None, overwrite: Optional[bool] = False
) -> str:
"""Download the data of a run, including input, output, snapshot and other run information.
.. note::
After the download is finished, you can use ``pf run create --source <run-info-local-folder>``
to register this run as a local run record, then you can use commands like ``pf run show/visualize``
to inspect the run just like a run that was created from local flow.
:param run: The run name or run object
:type run: Union[str, ~promptflow.entities.Run]
:param output: The output directory. Default to be default to be "~/.promptflow/.runs" folder.
:type output: Optional[str]
:param overwrite: Whether to overwrite the existing run folder. Default to be False.
:type overwrite: Optional[bool]
:return: The run directory path
:rtype: str
"""
import platform
from promptflow.azure.operations._async_run_downloader import AsyncRunDownloader
run = Run._validate_and_return_run_name(run)
run_folder = self._validate_for_run_download(run=run, output=output, overwrite=overwrite)
run_downloader = AsyncRunDownloader._from_run_operations(run_ops=self, run=run, output_folder=run_folder)
if platform.system().lower() == "windows":
# Reference: https://stackoverflow.com/questions/45600579/asyncio-event-loop-is-closed-when-getting-loop
# On Windows seems to be a problem with EventLoopPolicy, use this snippet to work around it
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
async_run_allowing_running_loop(run_downloader.download)
result_path = run_folder.resolve().as_posix()
logger.info(f"Successfully downloaded run {run!r} to {result_path!r}.")
return result_path
def _validate_for_run_download(self, run: Union[str, Run], output: Optional[Union[str, Path]], overwrite):
"""Validate the run download parameters."""
run = Run._validate_and_return_run_name(run)
# process the output path
if output is None:
# default to be "~/.promptflow/.runs" folder
output_directory = Path.home() / PROMPT_FLOW_DIR_NAME / PROMPT_FLOW_RUNS_DIR_NAME
else:
output_directory = Path(output)
# validate the run folder
run_folder = output_directory / run
if run_folder.exists():
if overwrite is True:
logger.warning("Removing existing run folder %r.", run_folder.resolve().as_posix())
shutil.rmtree(run_folder)
else:
raise UserErrorException(
f"Run folder {run_folder.resolve().as_posix()!r} already exists, please specify a new output path "
f"or set the overwrite flag to be true."
)
# check the run status, only download the completed run
run = self.get(run=run)
if run.status != RunStatus.COMPLETED:
raise UserErrorException(
f"Can only download the run with status {RunStatus.COMPLETED!r} "
f"while {run.name!r}'s status is {run.status!r}."
)
run_folder.mkdir(parents=True)
return run_folder
@monitor_operation(activity_name="pfazure.runs.cancel", activity_type=ActivityType.PUBLICAPI)
def cancel(self, run: Union[str, Run], **kwargs) -> None:
"""Cancel a run.
:param run: The run name or run object
:type run: Union[str, ~promptflow.entities.Run]
"""
run = Run._validate_and_return_run_name(run)
self._service_caller.cancel_flow_run(
subscription_id=self._operation_scope.subscription_id,
resource_group_name=self._operation_scope.resource_group_name,
workspace_name=self._operation_scope.workspace_name,
flow_run_id=run,
)
| promptflow/src/promptflow/promptflow/azure/operations/_run_operations.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/azure/operations/_run_operations.py",
"repo_id": "promptflow",
"token_count": 18051
} | 40 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
from dataclasses import dataclass
from datetime import datetime
from enum import Enum
from typing import Any, Dict, List, Mapping, Optional
from dateutil import parser
class Status(Enum):
"""An enumeration class for different types of run status."""
Running = "Running"
Preparing = "Preparing"
Completed = "Completed"
Failed = "Failed"
Bypassed = "Bypassed"
Canceled = "Canceled"
NotStarted = "NotStarted"
CancelRequested = "CancelRequested"
@staticmethod
def is_terminated(status):
"""Check if a given status is terminated.
:param status: The status to be checked
:type status: str or :class:`Status`
:return: True if the status is terminated, False otherwise
:rtype: bool
"""
if isinstance(status, Status):
status = status.value
return status in {s.value for s in {Status.Completed, Status.Failed, Status.Bypassed, Status.Canceled}}
@dataclass
class RunInfo:
"""A dataclass representing the run information.
:param node: Node name
:type node: str
:param flow_run_id: The id of the flow run
:type flow_run_id: str
:param run_id: The id of the run, which equals ``flow_run_id:step_run_id``
:type run_id: str
:param status: Status of the run
:type status: ~promptflow.contracts.run_info.Status
:param inputs: List of inputs for the run
:type inputs: list
:param output: Output of the run
:type output: object
:param metrics: Metrics of the run
:type metrics: Dict[str, Any]
:param error: Errors occurred during the run
:type error: Dict[str, Any]
:param parent_run_id: Parent run id
:type parent_run_id: str
:param start_time: Start time of the run
:type start_time: datetime
:param end_time: End time of the run
:type end_time: datetime
:param index: Index of the run
:type index: Optional[int]
:param api_calls: API calls made during the run
:type api_calls: Optional[List[Dict[str, Any]]]
:param variant_id: Variant id of the run
:type variant_id: Optional[str]
:param cached_run_id: Cached run id
:type cached_run_id: Optional[str]
:param cached_flow_run_id: Cached flow run id
:type cached_flow_run_id: Optional[str]
:param logs: Logs of the run
:type logs: Optional[Dict[str, str]]
:param system_metrics: System metrics of the run
:type system_metrics: Optional[Dict[str, Any]]
:param result: Result of the run
:type result: Optional[object]
"""
node: str
flow_run_id: str
run_id: str
status: Status
inputs: Mapping[str, Any]
output: object
metrics: Dict[str, Any]
error: Dict[str, Any]
parent_run_id: str
start_time: datetime
end_time: datetime
index: Optional[int] = None
api_calls: Optional[List[Dict[str, Any]]] = None
variant_id: str = ""
cached_run_id: str = None
cached_flow_run_id: str = None
logs: Optional[Dict[str, str]] = None
system_metrics: Dict[str, Any] = None
result: object = None
@staticmethod
def deserialize(data: dict) -> "RunInfo":
"""Deserialize the RunInfo from a dict."""
run_info = RunInfo(
node=data.get("node"),
flow_run_id=data.get("flow_run_id"),
run_id=data.get("run_id"),
status=Status(data.get("status")),
inputs=data.get("inputs", None),
output=data.get("output", None),
metrics=data.get("metrics", None),
error=data.get("error", None),
parent_run_id=data.get("parent_run_id", None),
start_time=parser.parse(data.get("start_time")).replace(tzinfo=None),
end_time=parser.parse(data.get("end_time")).replace(tzinfo=None),
index=data.get("index", None),
api_calls=data.get("api_calls", None),
variant_id=data.get("variant_id", ""),
cached_run_id=data.get("cached_run_id", None),
cached_flow_run_id=data.get("cached_flow_run_id", None),
logs=data.get("logs", None),
system_metrics=data.get("system_metrics", None),
result=data.get("result", None),
)
return run_info
@dataclass
class FlowRunInfo:
"""A dataclass representing the run information.
:param run_id: The id of the run, which equals ``flow_run_id:child_flow_run_id``
:type run_id: str
:param status: Status of the flow run
:type status: ~promptflow.contracts.run_info.Status
:param error: Errors occurred during the flow run
:type error: Dict[str, Any]
:param inputs: Inputs for the flow run
:type inputs: object
:param output: Output of the flow run
:type output: object
:param metrics: Metrics of the flow run
:type metrics: Dict[str, Any]
:param request: Request made for the flow run
:type request: object
:param parent_run_id: Parent run id of the flow run
:type parent_run_id: str
:param root_run_id: Root run id of the flow run
:type root_run_id: str
:param source_run_id: The run id of the run that triggered the flow run
:type source_run_id: str
:param flow_id: Flow id of the flow run
:type flow_id: str
:param start_time: Start time of the flow run
:type start_time: datetime
:param end_time: End time of the flow run
:type end_time: datetime
:param index: Index of the flow run (used for bulk test mode)
:type index: Optional[int]
:param api_calls: API calls made during the flow run
:type api_calls: Optional[List[Dict[str, Any]]]
:param variant_id: Variant id of the flow run
:type variant_id: Optional[str]
:param name: Name of the flow run
:type name: Optional[str]
:param description: Description of the flow run
:type description: Optional[str]
:param tags: Tags of the flow run
:type tags: Optional[Dict[str, str]]
:param system_metrics: System metrics of the flow run
:type system_metrics: Optional[Dict[str, Any]]
:param result: Result of the flow run
:type result: Optional[object]
:param upload_metrics: Flag indicating whether to upload metrics for the flow run
:type upload_metrics: Optional[bool]
"""
run_id: str
status: Status
error: object
inputs: object
output: object
metrics: Dict[str, Any]
request: object
parent_run_id: str
root_run_id: str
source_run_id: str
flow_id: str
start_time: datetime
end_time: datetime
index: Optional[int] = None
api_calls: Optional[List[Dict[str, Any]]] = None
variant_id: str = ""
name: str = ""
description: str = ""
tags: Optional[Mapping[str, str]] = None
system_metrics: Dict[str, Any] = None
result: object = None
upload_metrics: bool = False # only set as true for root runs in bulk test mode and evaluation mode
@staticmethod
def deserialize(data: dict) -> "FlowRunInfo":
"""Deserialize the FlowRunInfo from a dict."""
flow_run_info = FlowRunInfo(
run_id=data.get("run_id"),
status=Status(data.get("status")),
error=data.get("error", None),
inputs=data.get("inputs", None),
output=data.get("output", None),
metrics=data.get("metrics", None),
request=data.get("request", None),
parent_run_id=data.get("parent_run_id", None),
root_run_id=data.get("root_run_id", None),
source_run_id=data.get("source_run_id", None),
flow_id=data.get("flow_id"),
start_time=parser.parse(data.get("start_time")).replace(tzinfo=None),
end_time=parser.parse(data.get("end_time")).replace(tzinfo=None),
index=data.get("index", None),
api_calls=data.get("api_calls", None),
variant_id=data.get("variant_id", ""),
name=data.get("name", ""),
description=data.get("description", ""),
tags=data.get("tags", None),
system_metrics=data.get("system_metrics", None),
result=data.get("result", None),
upload_metrics=data.get("upload_metrics", False),
)
return flow_run_info
@staticmethod
def create_with_error(start_time, inputs, index, run_id, error):
return FlowRunInfo(
run_id=run_id,
status=Status.Failed,
error=error,
inputs=inputs,
output=None,
metrics=None,
request=None,
parent_run_id=run_id,
root_run_id=run_id,
source_run_id=run_id,
flow_id="default_flow_id",
start_time=start_time,
end_time=datetime.utcnow(),
index=index,
)
| promptflow/src/promptflow/promptflow/contracts/run_info.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/contracts/run_info.py",
"repo_id": "promptflow",
"token_count": 3703
} | 41 |
import multiprocessing
import queue
import signal
from dataclasses import dataclass
from enum import Enum
from functools import partial
from multiprocessing import Queue
from typing import List
import psutil
from promptflow._core.operation_context import OperationContext
from promptflow._utils.logger_utils import LogContext, bulk_logger
from promptflow.executor._errors import SpawnedForkProcessManagerStartFailure
from promptflow.executor.flow_executor import FlowExecutor
@dataclass
class ProcessInfo:
index: int
process_id: str
process_name: str
class ProcessControlSignal(str, Enum):
START = "start"
RESTART = "restart"
END = "end"
class AbstractProcessManager:
"""
AbstractProcessManager is a base class for managing processes.
:param input_queues: Queues for providing input data to the processes.
:type input_queues: List[multiprocessing.Queue]
:param output_queues: Queues for receiving execution results of the processes.
:type output_queues: List[multiprocessing.Queue]
:param process_info: Dictionary to store information about the processes.
:type process_info: dict
:param process_target_func: The target function that the processes will execute.
:param raise_ex: Flag to determine whether to raise exceptions or not.
:type raise_ex: bool
"""
def __init__(
self,
input_queues: List[Queue],
output_queues: List[Queue],
process_info: dict,
process_target_func,
*args,
**kwargs,
) -> None:
self._input_queues = input_queues
self._output_queues = output_queues
self._process_info = process_info
self._process_target_func = process_target_func
current_log_context = LogContext.get_current()
self._log_context_initialization_func = current_log_context.get_initializer() if current_log_context else None
self._current_operation_context = OperationContext.get_instance().get_context_dict()
def new_process(self, i):
"""
Create and start a new process.
:param i: Index of the new process to start.
:type i: int
"""
raise NotImplementedError("AbstractProcessManager is an abstract class, no implementation for new_process.")
def restart_process(self, i):
"""
Restarts a specified process
:param i: Index of the process to restart.
:type i: int
"""
raise NotImplementedError("AbstractProcessManager is an abstract class, no implementation for restart_process.")
def end_process(self, i):
"""
Terminates a specified process.
:param i: Index of the process to terminate.
:type i: int
"""
raise NotImplementedError("AbstractProcessManager is an abstract class, no implementation for end_process.")
def ensure_healthy(self):
"""
Checks the health of the managed processes.
This method should be implemented in subclasses to provide specific health check mechanisms.
"""
raise NotImplementedError("AbstractProcessManager is an abstract class, no implementation for end_process.")
class SpawnProcessManager(AbstractProcessManager):
"""
SpawnProcessManager extends AbstractProcessManager to specifically manage processes using the 'spawn' start method.
:param executor_creation_func: Function to create an executor for each process.
:param args: Additional positional arguments for the AbstractProcessManager.
:param kwargs: Additional keyword arguments for the AbstractProcessManager.
"""
def __init__(self, executor_creation_func, *args, **kwargs):
super().__init__(*args, **kwargs)
self._executor_creation_func = executor_creation_func
self.context = multiprocessing.get_context("spawn")
def start_processes(self):
"""
Initiates processes.
"""
for i in range(len(self._input_queues)):
self.new_process(i)
def new_process(self, i):
"""
Create and start a new process using the 'spawn' context.
:param i: Index of the input and output queue for the new process.
:type i: int
"""
process = self.context.Process(
target=self._process_target_func,
args=(
self._executor_creation_func,
self._input_queues[i],
self._output_queues[i],
self._log_context_initialization_func,
self._current_operation_context,
),
# Set the process as a daemon process to automatically terminated and release system resources
# when the main process exits.
daemon=True,
)
process.start()
try:
self._process_info[i] = ProcessInfo(
index=i,
process_id=process.pid,
process_name=process.name,
)
except Exception as e:
bulk_logger.warning(
f"Unexpected error occurred while creating ProcessInfo for index {i} and process id {process.pid}. "
f"Exception: {e}"
)
return process
def restart_process(self, i):
"""
Restarts a specified process by first terminating it then creating a new one.
:param i: Index of the process to restart.
:type i: int
"""
self.end_process(i)
self.new_process(i)
def end_process(self, i):
"""
Terminates a specified process.
:param i: Index of the process to terminate.
:type i: int
"""
try:
pid = self._process_info[i].process_id
process = psutil.Process(pid)
process.terminate()
process.wait()
self._process_info.pop(i)
except psutil.NoSuchProcess:
bulk_logger.warning(f"Process {pid} had been terminated")
except Exception as e:
bulk_logger.warning(
f"Unexpected error occurred while end process for index {i} and process id {process.pid}. "
f"Exception: {e}"
)
def ensure_healthy(self):
"""
Checks the health of the managed processes.
Note:
Health checks for spawn mode processes are currently not performed.
Add detailed checks in this function if needed in the future.
"""
pass
class ForkProcessManager(AbstractProcessManager):
'''
ForkProcessManager extends AbstractProcessManager to manage processes using the 'fork' method
in a spawned process.
:param control_signal_queue: A queue for controlling signals to manage process operations.
:type control_signal_queue: multiprocessing.Queue
:param flow_file: The path to the flow file.
:type flow_file: Path
:param connections: The connections to be used for the flow.
:type connections: dict
:param working_dir: The working directory to be used for the flow.
:type working_dir: str
:param args: Additional positional arguments for the AbstractProcessManager.
:param kwargs: Additional keyword arguments for the AbstractProcessManager.
"""
'''
def __init__(self, control_signal_queue: Queue, flow_create_kwargs, *args, **kwargs):
super().__init__(*args, **kwargs)
self._control_signal_queue = control_signal_queue
self._flow_create_kwargs = flow_create_kwargs
def start_processes(self):
"""
Initiates a process with "spawn" method to establish a clean environment.
"""
context = multiprocessing.get_context("spawn")
process = context.Process(
target=create_spawned_fork_process_manager,
args=(
self._log_context_initialization_func,
self._current_operation_context,
self._input_queues,
self._output_queues,
self._control_signal_queue,
self._flow_create_kwargs,
self._process_info,
self._process_target_func,
),
)
process.start()
self._spawned_fork_process_manager_pid = process.pid
def restart_process(self, i):
"""
Sends a signal to restart a specific process.
:param i: Index of the process to restart.
:type i: int
"""
self._control_signal_queue.put((ProcessControlSignal.RESTART, i))
def end_process(self, i):
"""
Sends a signal to terminate a specific process.
:param i: Index of the process to terminate.
:type i: int
"""
self._control_signal_queue.put((ProcessControlSignal.END, i))
def new_process(self, i):
"""
Sends a signal to start a new process.
:param i: Index of the new process to start.
:type i: int
"""
self._control_signal_queue.put((ProcessControlSignal.START, i))
def ensure_healthy(self):
# A 'zombie' process is a process that has finished running but still remains in
# the process table, waiting for its parent process to collect and handle its exit status.
# The normal state of the spawned process is 'running'. If the process does not start successfully
# or exit unexpectedly, its state will be 'zombie'.
if psutil.Process(self._spawned_fork_process_manager_pid).status() == "zombie":
bulk_logger.error("The spawned fork process manager failed to start.")
ex = SpawnedForkProcessManagerStartFailure()
raise ex
class SpawnedForkProcessManager(AbstractProcessManager):
"""
SpawnedForkProcessManager extends AbstractProcessManager to manage processes using 'fork' method
in a spawned process.
:param control_signal_queue: A queue for controlling signals to manage process operations.
:type control_signal_queue: multiprocessing.Queue
:param executor_creation_func: Function to create an executor for each process.
:type executor_creation_func: Callable
:param args: Additional positional arguments for the AbstractProcessManager.
:param kwargs: Additional keyword arguments for the AbstractProcessManager.
"""
def __init__(
self,
log_context_initialization_func,
current_operation_context,
control_signal_queue,
executor_creation_func,
*args,
**kwargs,
):
super().__init__(*args, **kwargs)
self._log_context_initialization_func = log_context_initialization_func
self._current_operation_context = current_operation_context
self._control_signal_queue = control_signal_queue
self._executor_creation_func = executor_creation_func
self.context = multiprocessing.get_context("fork")
def new_process(self, i):
"""
Create and start a new process using the 'fork' context.
:param i: Index of the input and output queue for the new process.
:type i: int
"""
process = self.context.Process(
target=self._process_target_func,
args=(
self._executor_creation_func,
self._input_queues[i],
self._output_queues[i],
self._log_context_initialization_func,
self._current_operation_context,
),
daemon=True,
)
process.start()
try:
self._process_info[i] = ProcessInfo(
index=i,
process_id=process.pid,
process_name=process.name,
)
except Exception as e:
bulk_logger.warning(
f"Unexpected error occurred while creating ProcessInfo for index {i} and process id {process.pid}. "
f"Exception: {e}"
)
return process
def end_process(self, i):
"""
Terminates a specified process.
:param i: Index of the process to terminate.
:type i: int
"""
try:
pid = self._process_info[i].process_id
process = psutil.Process(pid)
process.terminate()
process.wait()
self._process_info.pop(i)
except psutil.NoSuchProcess:
bulk_logger.warning(f"Process {pid} had been terminated")
except Exception as e:
bulk_logger.warning(
f"Unexpected error occurred while end process for index {i} and process id {process.pid}. "
f"Exception: {e}"
)
def restart_process(self, i):
"""
Restarts a specified process by first terminating it then creating a new one.
:param i: Index of the process to restart.
:type i: int
"""
self.end_process(i)
self.new_process(i)
def handle_signals(self, control_signal, i):
"""
Handles control signals for processes, performing actions such as starting, ending,
or restarting them based on the received signal.
:param control_signal: The control signal indicating the desired action. It can be 'start', 'end', or 'restart'.
:type control_signal: str
:param i: Index of the process to control.
:type i: int
"""
if control_signal == ProcessControlSignal.END:
self.end_process(i)
elif control_signal == ProcessControlSignal.RESTART:
self.restart_process(i)
elif control_signal == ProcessControlSignal.START:
self.new_process(i)
def create_spawned_fork_process_manager(
log_context_initialization_func,
current_operation_context,
input_queues,
output_queues,
control_signal_queue,
flow_create_kwargs,
process_info,
process_target_func,
):
"""
Manages the creation, termination, and signaling of processes using the 'fork' context.
"""
# Set up signal handling for process interruption.
from promptflow.executor._line_execution_process_pool import create_executor_fork, signal_handler
signal.signal(signal.SIGINT, signal_handler)
# Create flow executor.
executor = FlowExecutor.create(**flow_create_kwargs)
# When using fork, we use this method to create the executor to avoid reloading the flow
# which will introduce a lot more memory.
executor_creation_func = partial(create_executor_fork, flow_executor=executor)
manager = SpawnedForkProcessManager(
log_context_initialization_func,
current_operation_context,
control_signal_queue,
executor_creation_func,
input_queues,
output_queues,
process_info,
process_target_func,
)
# Initialize processes.
for i in range(len(input_queues)):
manager.new_process(i)
# Main loop to handle control signals and manage process lifecycle.
while True:
all_processes_stopped = True
try:
process_info_list = process_info.items()
except Exception as e:
bulk_logger.warning(f"Unexpected error occurred while get process info list. Exception: {e}")
break
for _, info in list(process_info_list):
pid = info.process_id
# Check if at least one process is alive.
if psutil.pid_exists(pid):
process = psutil.Process(pid)
if process.status() != "zombie":
all_processes_stopped = False
else:
# If do not call wait(), the child process may become a zombie process,
# and psutil.pid_exists(pid) is always true, which will cause spawn proces
# never exit.
process.wait()
# If all fork child processes exit, exit the loop.
if all_processes_stopped:
break
try:
control_signal, i = control_signal_queue.get(timeout=1)
manager.handle_signals(control_signal, i)
except queue.Empty:
# Do nothing until the process_queue have not content or process is killed
pass
| promptflow/src/promptflow/promptflow/executor/_process_manager.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/executor/_process_manager.py",
"repo_id": "promptflow",
"token_count": 6562
} | 42 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import os
import re
from pathlib import Path
from typing import Any, Match, cast
from setuptools import find_packages, setup
PACKAGE_NAME = "promptflow"
PACKAGE_FOLDER_PATH = Path(__file__).parent / "promptflow"
with open(os.path.join(PACKAGE_FOLDER_PATH, "_version.py"), encoding="utf-8") as f:
version = cast(Match[Any], re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', f.read(), re.MULTILINE)).group(1)
with open("README.md", encoding="utf-8") as f:
readme = f.read()
with open("CHANGELOG.md", encoding="utf-8") as f:
changelog = f.read()
REQUIRES = [
"psutil", # get process information when bulk run
"httpx>=0.25.1", # used to send http requests asynchronously
"openai", # promptflow._core.api_injector
"flask>=2.2.3,<4.0.0", # Serving endpoint requirements
"sqlalchemy>=1.4.48,<3.0.0", # sqlite requirements
# note that pandas 1.5.3 is the only version to test in ci before promptflow 0.1.0b7 is released
# and pandas 2.x.x will be the only version to test in ci after that.
"pandas>=1.5.3,<3.0.0", # load data requirements
"python-dotenv>=1.0.0,<2.0.0", # control plane sdk requirements, to load .env file
"keyring>=24.2.0,<25.0.0", # control plane sdk requirements, to access system keyring service
"pydash>=6.0.0,<8.0.0", # control plane sdk requirements, to support parameter overrides in schema.
# vulnerability: https://github.com/advisories/GHSA-5cpq-8wj7-hf2v
"cryptography>=41.0.3,<42.0.0", # control plane sdk requirements to support connection encryption
"colorama>=0.4.6,<0.5.0", # producing colored terminal text for testing chat flow
"tabulate>=0.9.0,<1.0.0", # control plane sdk requirements, to print table in console
"filelock>=3.4.0,<4.0.0", # control plane sdk requirements, to lock for multiprocessing
# We need to pin the version due to the issue: https://github.com/hwchase17/langchain/issues/5113
"marshmallow>=3.5,<4.0.0",
"gitpython>=3.1.24,<4.0.0", # used git info to generate flow id
"tiktoken>=0.4.0",
"strictyaml>=1.5.0,<2.0.0", # used to identify exact location of validation error
"waitress>=2.1.2,<3.0.0", # used to serve local service
"opencensus-ext-azure<2.0.0", # configure opencensus to send telemetry to azure monitor
"ruamel.yaml>=0.17.10,<1.0.0", # used to generate connection templates with preserved comments
"pyarrow>=14.0.1,<15.0.0", # used to read parquet file with pandas.read_parquet
"pillow>=10.1.0,<11.0.0", # used to generate icon data URI for package tool
"filetype>=1.2.0", # used to detect the mime type for mulitmedia input
"jsonschema>=4.0.0,<5.0.0", # used to validate tool
"docutils", # used to generate description for tools
]
setup(
name=PACKAGE_NAME,
version=version,
description="Prompt flow Python SDK - build high-quality LLM apps",
long_description_content_type="text/markdown",
long_description=readme + "\n\n" + changelog,
license="MIT License",
author="Microsoft Corporation",
author_email="[email protected]",
url="https://github.com/microsoft/promptflow",
classifiers=[
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
python_requires="<4.0,>=3.8",
install_requires=REQUIRES,
extras_require={
"azure": [
"azure-core>=1.26.4,<2.0.0",
"azure-storage-blob[aio]>=12.13.0,<13.0.0", # add [aio] for async run download feature
"azure-identity>=1.12.0,<2.0.0",
"azure-ai-ml>=1.11.0,<2.0.0",
"pyjwt>=2.4.0,<3.0.0", # requirement of control plane SDK
],
"executable": ["pyinstaller>=5.13.2", "streamlit>=1.26.0", "streamlit-quill<0.1.0", "bs4"],
"pfs": [
"flask-restx>=1.2.0,<2.0.0",
],
"azureml-serving": [
# AzureML connection dependencies
"azure-identity>=1.12.0,<2.0.0",
"azure-ai-ml>=1.11.0,<2.0.0",
# OTel dependencies for monitoring
"opentelemetry-api>=1.21.0,<2.0.0",
"opentelemetry-sdk>=1.21.0,<2.0.0",
"azure-monitor-opentelemetry>=1.1.1,<2.0.0",
# MDC dependencies for monitoring
"azureml-ai-monitoring>=0.1.0b3,<1.0.0",
],
},
packages=find_packages(),
scripts=[
'pf',
'pf.bat'
],
entry_points={
"console_scripts": [
"pfazure = promptflow._cli._pf_azure.entry:main",
"pfs = promptflow._sdk._service.entry:main",
],
},
include_package_data=True,
project_urls={
"Bug Reports": "https://github.com/microsoft/promptflow/issues",
"Source": "https://github.com/microsoft/promptflow",
},
)
| promptflow/src/promptflow/setup.py/0 | {
"file_path": "promptflow/src/promptflow/setup.py",
"repo_id": "promptflow",
"token_count": 2306
} | 43 |
import os
from pathlib import Path
from tempfile import mkdtemp
import pytest
from promptflow._utils.multimedia_utils import MIME_PATTERN, _create_image_from_file, _is_url, is_multimedia_dict
from promptflow.batch._batch_engine import OUTPUT_FILE_NAME, BatchEngine
from promptflow.batch._result import BatchResult
from promptflow.contracts.multimedia import Image
from promptflow.contracts.run_info import FlowRunInfo, RunInfo, Status
from promptflow.executor import FlowExecutor
from promptflow.storage._run_storage import DefaultRunStorage
from ..utils import get_flow_folder, get_yaml_file, is_image_file, is_jsonl_file, load_jsonl
SIMPLE_IMAGE_FLOW = "python_tool_with_simple_image"
SAMPLE_IMAGE_FLOW_WITH_DEFAULT = "python_tool_with_simple_image_with_default"
SIMPLE_IMAGE_WITH_INVALID_DEFAULT_VALUE_FLOW = "python_tool_with_invalid_default_value"
COMPOSITE_IMAGE_FLOW = "python_tool_with_composite_image"
CHAT_FLOW_WITH_IMAGE = "chat_flow_with_image"
EVAL_FLOW_WITH_SIMPLE_IMAGE = "eval_flow_with_simple_image"
EVAL_FLOW_WITH_COMPOSITE_IMAGE = "eval_flow_with_composite_image"
NESTED_API_CALLS_FLOW = "python_tool_with_image_nested_api_calls"
IMAGE_URL = (
"https://raw.githubusercontent.com/microsoft/promptflow/main/src/promptflow/tests/test_configs/datas/logo.jpg"
)
def get_test_cases_for_simple_input(flow_folder):
working_dir = get_flow_folder(flow_folder)
image = _create_image_from_file(working_dir / "logo.jpg")
inputs = [
{"data:image/jpg;path": str(working_dir / "logo.jpg")},
{"data:image/jpg;base64": image.to_base64()},
{"data:image/jpg;url": IMAGE_URL},
str(working_dir / "logo.jpg"),
image.to_base64(),
IMAGE_URL,
]
return [(flow_folder, {"image": input}) for input in inputs]
def get_test_cases_for_composite_input(flow_folder):
working_dir = get_flow_folder(flow_folder)
image_1 = _create_image_from_file(working_dir / "logo.jpg")
image_2 = _create_image_from_file(working_dir / "logo_2.png")
inputs = [
[
{"data:image/jpg;path": str(working_dir / "logo.jpg")},
{"data:image/png;path": str(working_dir / "logo_2.png")},
],
[{"data:image/jpg;base64": image_1.to_base64()}, {"data:image/png;base64": image_2.to_base64()}],
[{"data:image/jpg;url": IMAGE_URL}, {"data:image/png;url": IMAGE_URL}],
]
return [
(flow_folder, {"image_list": input, "image_dict": {"image_1": input[0], "image_2": input[1]}})
for input in inputs
]
def get_test_cases_for_node_run():
image = {"data:image/jpg;path": str(get_flow_folder(SIMPLE_IMAGE_FLOW) / "logo.jpg")}
simple_image_input = {"image": image}
image_list = [{"data:image/jpg;path": "logo.jpg"}, {"data:image/png;path": "logo_2.png"}]
image_dict = {
"image_dict": {
"image_1": {"data:image/jpg;path": "logo.jpg"},
"image_2": {"data:image/png;path": "logo_2.png"},
}
}
composite_image_input = {"image_list": image_list, "image_dcit": image_dict}
return [
(SIMPLE_IMAGE_FLOW, "python_node", simple_image_input, None),
(SIMPLE_IMAGE_FLOW, "python_node_2", simple_image_input, {"python_node": image}),
(COMPOSITE_IMAGE_FLOW, "python_node", composite_image_input, None),
(COMPOSITE_IMAGE_FLOW, "python_node_2", composite_image_input, None),
(
COMPOSITE_IMAGE_FLOW,
"python_node_3",
composite_image_input,
{"python_node": image_list, "python_node_2": image_dict},
),
]
def contain_image_reference(value, parent_path="temp"):
if isinstance(value, (FlowRunInfo, RunInfo)):
assert contain_image_reference(value.api_calls, parent_path)
assert contain_image_reference(value.inputs, parent_path)
assert contain_image_reference(value.output, parent_path)
return True
assert not isinstance(value, Image)
if isinstance(value, list):
return any(contain_image_reference(item, parent_path) for item in value)
if isinstance(value, dict):
if is_multimedia_dict(value):
v = list(value.values())[0]
assert isinstance(v, str)
assert _is_url(v) or str(Path(v).parent) == parent_path
return True
return any(contain_image_reference(v, parent_path) for v in value.values())
return False
def contain_image_object(value):
if isinstance(value, list):
return any(contain_image_object(item) for item in value)
elif isinstance(value, dict):
assert not is_multimedia_dict(value)
return any(contain_image_object(v) for v in value.values())
else:
return isinstance(value, Image)
@pytest.mark.usefixtures("dev_connections")
@pytest.mark.e2etest
class TestExecutorWithImage:
@pytest.mark.parametrize(
"flow_folder, inputs",
get_test_cases_for_simple_input(SIMPLE_IMAGE_FLOW)
+ get_test_cases_for_composite_input(COMPOSITE_IMAGE_FLOW)
+ [(CHAT_FLOW_WITH_IMAGE, {}), (NESTED_API_CALLS_FLOW, {})],
)
def test_executor_exec_line_with_image(self, flow_folder, inputs, dev_connections):
working_dir = get_flow_folder(flow_folder)
os.chdir(working_dir)
storage = DefaultRunStorage(base_dir=working_dir, sub_dir=Path("./temp"))
executor = FlowExecutor.create(get_yaml_file(flow_folder), dev_connections, storage=storage)
flow_result = executor.exec_line(inputs)
assert isinstance(flow_result.output, dict)
assert contain_image_object(flow_result.output)
# Assert output also contains plain text.
assert any(isinstance(v, str) for v in flow_result.output)
assert flow_result.run_info.status == Status.Completed
assert contain_image_reference(flow_result.run_info)
for _, node_run_info in flow_result.node_run_infos.items():
assert node_run_info.status == Status.Completed
assert contain_image_reference(node_run_info)
@pytest.mark.parametrize(
"flow_folder, node_name, flow_inputs, dependency_nodes_outputs", get_test_cases_for_node_run()
)
def test_executor_exec_node_with_image(
self, flow_folder, node_name, flow_inputs, dependency_nodes_outputs, dev_connections
):
working_dir = get_flow_folder(flow_folder)
os.chdir(working_dir)
storage = DefaultRunStorage(base_dir=working_dir, sub_dir=Path("./temp"))
run_info = FlowExecutor.load_and_exec_node(
get_yaml_file(flow_folder),
node_name,
flow_inputs=flow_inputs,
dependency_nodes_outputs=dependency_nodes_outputs,
connections=dev_connections,
storage=storage,
raise_ex=True,
)
assert run_info.status == Status.Completed
assert contain_image_reference(run_info)
# Assert image could be persisted to the specified path.
@pytest.mark.parametrize(
"output_sub_dir, assign_storage, expected_path",
[
("test_path", True, "test_storage"),
("test_path", False, "test_path"),
(None, True, "test_storage"),
(None, False, "."),
],
)
def test_executor_exec_node_with_image_storage_and_path(self, output_sub_dir, assign_storage, expected_path):
flow_folder = SIMPLE_IMAGE_FLOW
node_name = "python_node"
image = {"data:image/jpg;path": str(get_flow_folder(SIMPLE_IMAGE_FLOW) / "logo.jpg")}
flow_inputs = {"image": image}
working_dir = get_flow_folder(flow_folder)
os.chdir(working_dir)
storage = DefaultRunStorage(base_dir=working_dir, sub_dir=Path("./test_storage"))
run_info = FlowExecutor.load_and_exec_node(
get_yaml_file(flow_folder),
node_name,
flow_inputs=flow_inputs,
dependency_nodes_outputs=None,
connections=None,
storage=storage if assign_storage else None,
output_sub_dir=output_sub_dir,
raise_ex=True,
)
assert run_info.status == Status.Completed
assert contain_image_reference(run_info, parent_path=expected_path)
@pytest.mark.parametrize(
"flow_folder, node_name, flow_inputs, dependency_nodes_outputs",
[
(
SIMPLE_IMAGE_WITH_INVALID_DEFAULT_VALUE_FLOW,
"python_node_2",
{},
{
"python_node": {
"data:image/jpg;path": str(
get_flow_folder(SIMPLE_IMAGE_WITH_INVALID_DEFAULT_VALUE_FLOW) / "logo.jpg"
)
}
},
)
],
)
def test_executor_exec_node_with_invalid_default_value(
self, flow_folder, node_name, flow_inputs, dependency_nodes_outputs, dev_connections
):
working_dir = get_flow_folder(flow_folder)
os.chdir(working_dir)
storage = DefaultRunStorage(base_dir=working_dir, sub_dir=Path("./temp"))
run_info = FlowExecutor.load_and_exec_node(
get_yaml_file(flow_folder),
node_name,
flow_inputs=flow_inputs,
dependency_nodes_outputs=dependency_nodes_outputs,
connections=dev_connections,
storage=storage,
raise_ex=True,
)
assert run_info.status == Status.Completed
assert contain_image_reference(run_info)
@pytest.mark.parametrize(
"flow_folder, input_dirs, inputs_mapping, output_key, expected_outputs_number, has_aggregation_node",
[
(
SIMPLE_IMAGE_FLOW,
{"data": "."},
{"image": "${data.image}"},
"output",
4,
False,
),
(
SAMPLE_IMAGE_FLOW_WITH_DEFAULT,
{"data": "."},
{"image_2": "${data.image_2}"},
"output",
4,
False,
),
(
COMPOSITE_IMAGE_FLOW,
{"data": "inputs.jsonl"},
{"image_list": "${data.image_list}", "image_dict": "${data.image_dict}"},
"output",
2,
False,
),
(
CHAT_FLOW_WITH_IMAGE,
{"data": "inputs.jsonl"},
{"question": "${data.question}", "chat_history": "${data.chat_history}"},
"answer",
2,
False,
),
(
EVAL_FLOW_WITH_SIMPLE_IMAGE,
{"data": "inputs.jsonl"},
{"image": "${data.image}"},
"output",
2,
True,
),
(
EVAL_FLOW_WITH_COMPOSITE_IMAGE,
{"data": "inputs.jsonl"},
{"image_list": "${data.image_list}", "image_dict": "${data.image_dict}"},
"output",
2,
True,
),
],
)
def test_batch_engine_with_image(
self, flow_folder, input_dirs, inputs_mapping, output_key, expected_outputs_number, has_aggregation_node
):
flow_file = get_yaml_file(flow_folder)
working_dir = get_flow_folder(flow_folder)
output_dir = Path(mkdtemp())
batch_result = BatchEngine(flow_file, working_dir).run(
input_dirs, inputs_mapping, output_dir, max_lines_count=4
)
assert isinstance(batch_result, BatchResult)
assert batch_result.completed_lines == expected_outputs_number
assert all(is_jsonl_file(output_file) or is_image_file(output_file) for output_file in output_dir.iterdir())
outputs = load_jsonl(output_dir / OUTPUT_FILE_NAME)
assert len(outputs) == expected_outputs_number
for i, output in enumerate(outputs):
assert isinstance(output, dict)
assert "line_number" in output, f"line_number is not in {i}th output {output}"
assert output["line_number"] == i, f"line_number is not correct in {i}th output {output}"
result = output[output_key][0] if isinstance(output[output_key], list) else output[output_key]
assert all(MIME_PATTERN.search(key) for key in result), f"image is not in {i}th output {output}"
@pytest.mark.parametrize(
"flow_folder, inputs",
get_test_cases_for_simple_input(EVAL_FLOW_WITH_SIMPLE_IMAGE)
+ get_test_cases_for_composite_input(EVAL_FLOW_WITH_COMPOSITE_IMAGE),
)
def test_executor_exec_aggregation_with_image(self, flow_folder, inputs, dev_connections):
working_dir = get_flow_folder(flow_folder)
os.chdir(working_dir)
storage = DefaultRunStorage(base_dir=working_dir, sub_dir=Path("./temp"))
executor = FlowExecutor.create(get_yaml_file(flow_folder), dev_connections, storage=storage)
flow_result = executor.exec_line(inputs, index=0)
flow_inputs = {k: [v] for k, v in inputs.items()}
aggregation_inputs = {k: [v] for k, v in flow_result.aggregation_inputs.items()}
aggregation_results = executor.exec_aggregation(flow_inputs, aggregation_inputs=aggregation_inputs)
for _, node_run_info in aggregation_results.node_run_infos.items():
assert node_run_info.status == Status.Completed
assert contain_image_reference(node_run_info)
def test_batch_run_then_eval_with_image(self):
# submit a flow in batch mode fisrt
batch_flow_folder = get_flow_folder(COMPOSITE_IMAGE_FLOW)
batch_flow_file = get_yaml_file(batch_flow_folder)
batch_working_dir = get_flow_folder(batch_flow_folder)
batch_output_dir = Path(mkdtemp())
batch_input_dirs = {"data": "inputs.jsonl"}
batch_inputs_mapping = {"image_list": "${data.image_list}", "image_dict": "${data.image_dict}"}
batch_result = BatchEngine(batch_flow_file, batch_working_dir).run(
batch_input_dirs, batch_inputs_mapping, batch_output_dir
)
assert batch_result.completed_lines == batch_result.total_lines
# use the output of batch run as input of eval flow
eval_flow_folder = get_flow_folder(EVAL_FLOW_WITH_COMPOSITE_IMAGE)
eval_flow_file = get_yaml_file(eval_flow_folder)
eval_working_dir = get_flow_folder(eval_flow_folder)
eval_output_dir = Path(mkdtemp())
eval_input_dirs = {
"data": batch_flow_folder / "inputs.jsonl",
"run.outputs": batch_output_dir / OUTPUT_FILE_NAME,
}
eval_inputs_mapping = {"image_list": "${run.outputs.output}", "image_dict": "${data.image_dict}"}
eval_result = BatchEngine(eval_flow_file, eval_working_dir).run(
eval_input_dirs, eval_inputs_mapping, eval_output_dir
)
assert eval_result.completed_lines == eval_result.total_lines
| promptflow/src/promptflow/tests/executor/e2etests/test_image.py/0 | {
"file_path": "promptflow/src/promptflow/tests/executor/e2etests/test_image.py",
"repo_id": "promptflow",
"token_count": 7025
} | 44 |
from dataclasses import dataclass
from promptflow import tool
from promptflow._core.tools_manager import register_connections
from promptflow.contracts.types import Secret
@dataclass
class TestConnection:
name: str
secret: Secret
register_connections(TestConnection)
@tool
def tool_with_test_conn(conn: TestConnection):
assert isinstance(conn, TestConnection)
return conn.name + conn.secret
| promptflow/src/promptflow/tests/executor/package_tools/tool_with_connection.py/0 | {
"file_path": "promptflow/src/promptflow/tests/executor/package_tools/tool_with_connection.py",
"repo_id": "promptflow",
"token_count": 121
} | 45 |
import textwrap
from pathlib import Path
from unittest.mock import patch
import pytest
from mock import MagicMock
from promptflow import tool
from promptflow._core._errors import InputTypeMismatch, InvalidSource, PackageToolNotFoundError
from promptflow._core.tools_manager import (
BuiltinsManager,
ToolLoader,
collect_package_tools,
collect_package_tools_and_connections,
)
from promptflow._utils.yaml_utils import load_yaml_string
from promptflow.contracts.flow import InputAssignment, InputValueType, Node, ToolSource, ToolSourceType
from promptflow.contracts.tool import Tool, ToolType
from promptflow.exceptions import UserErrorException
@pytest.mark.unittest
class TestToolLoader:
def test_load_tool_for_node_with_invalid_node(self):
tool_loader = ToolLoader(working_dir="test_working_dir")
node: Node = Node(name="test", tool="test_tool", inputs={}, type=ToolType.PYTHON)
with pytest.raises(UserErrorException, match="Node test does not have source defined."):
tool_loader.load_tool_for_node(node)
node: Node = Node(
name="test", tool="test_tool", inputs={}, type=ToolType.PYTHON, source=ToolSource(type="invalid_type")
)
with pytest.raises(
NotImplementedError, match="Tool source type invalid_type for python tool is not supported yet."
):
tool_loader.load_tool_for_node(node)
node: Node = Node(
name="test", tool="test_tool", inputs={}, type=ToolType.CUSTOM_LLM, source=ToolSource(type="invalid_type")
)
with pytest.raises(
NotImplementedError, match="Tool source type invalid_type for custom_llm tool is not supported yet."
):
tool_loader.load_tool_for_node(node)
node: Node = Node(
name="test", tool="test_tool", inputs={}, type="invalid_type", source=ToolSource(type=ToolSourceType.Code)
)
with pytest.raises(NotImplementedError, match="Tool type invalid_type is not supported yet."):
tool_loader.load_tool_for_node(node)
def test_load_tool_for_package_node(self, mocker):
package_tools = {"test_tool": Tool(name="test_tool", type=ToolType.PYTHON, inputs={}).serialize()}
mocker.patch("promptflow._core.tools_manager.collect_package_tools", return_value=package_tools)
tool_loader = ToolLoader(
working_dir="test_working_dir", package_tool_keys=["promptflow._core.tools_manager.collect_package_tools"]
)
node: Node = Node(
name="test",
tool="test_tool",
inputs={},
type=ToolType.PYTHON,
source=ToolSource(type=ToolSourceType.Package, tool="test_tool"),
)
tool = tool_loader.load_tool_for_node(node)
assert tool.name == "test_tool"
node: Node = Node(
name="test",
tool="test_tool",
inputs={},
type=ToolType.PYTHON,
source=ToolSource(type=ToolSourceType.Package, tool="invalid_tool"),
)
msg = (
"Package tool 'invalid_tool' is not found in the current environment. "
"All available package tools are: ['test_tool']."
)
with pytest.raises(PackageToolNotFoundError) as ex:
tool_loader.load_tool_for_node(node)
assert str(ex.value) == msg
def test_load_tool_for_package_node_with_legacy_tool_id(self, mocker):
package_tools = {
"new_tool_1": Tool(
name="new tool 1", type=ToolType.PYTHON, inputs={}, deprecated_tools=["old_tool_1"]
).serialize(),
"new_tool_2": Tool(
name="new tool 1", type=ToolType.PYTHON, inputs={}, deprecated_tools=["old_tool_2"]
).serialize(),
"old_tool_2": Tool(name="old tool 2", type=ToolType.PYTHON, inputs={}).serialize(),
}
mocker.patch("promptflow._core.tools_manager.collect_package_tools", return_value=package_tools)
tool_loader = ToolLoader(working_dir="test_working_dir", package_tool_keys=list(package_tools.keys()))
node_with_legacy_tool: Node = Node(
name="test_legacy_tool",
tool="old_tool_1",
inputs={},
type=ToolType.PYTHON,
source=ToolSource(type=ToolSourceType.Package, tool="old_tool_1"),
)
assert tool_loader.load_tool_for_node(node_with_legacy_tool).name == "new tool 1"
node_with_legacy_tool_but_in_package_tools: Node = Node(
name="test_legacy_tool_but_in_package_tools",
tool="old_tool_2",
inputs={},
type=ToolType.PYTHON,
source=ToolSource(type=ToolSourceType.Package, tool="old_tool_2"),
)
assert tool_loader.load_tool_for_node(node_with_legacy_tool_but_in_package_tools).name == "old tool 2"
def test_load_tool_for_script_node(self):
working_dir = Path(__file__).parent
tool_loader = ToolLoader(working_dir=working_dir)
file = "test_tools_manager.py"
node: Node = Node(
name="test",
tool="sample_tool",
inputs={},
type=ToolType.PYTHON,
source=ToolSource(type=ToolSourceType.Code, path=file),
)
tool = tool_loader.load_tool_for_node(node)
assert tool.name == "sample_tool"
@pytest.mark.parametrize(
"source_path, error_message",
[
(None, "Load tool failed for node 'test'. The source path is 'None'."),
("invalid_file.py", "Load tool failed for node 'test'. Tool file 'invalid_file.py' can not be found."),
],
)
def test_load_tool_for_script_node_exception(self, source_path, error_message):
working_dir = Path(__file__).parent
tool_loader = ToolLoader(working_dir=working_dir)
node: Node = Node(
name="test",
tool="sample_tool",
inputs={},
type=ToolType.PYTHON,
source=ToolSource(type=ToolSourceType.Code, path=source_path),
)
with pytest.raises(InvalidSource) as ex:
tool_loader.load_tool_for_script_node(node)
assert str(ex.value) == error_message
# This tool is for testing tools_manager.ToolLoader.load_tool_for_script_node
@tool
def sample_tool(input: str):
return input
@pytest.mark.unittest
class TestToolsManager:
def test_collect_package_tools_if_node_source_tool_is_legacy(self):
legacy_node_source_tools = ["content_safety_text.tools.content_safety_text_tool.analyze_text"]
package_tools = collect_package_tools(legacy_node_source_tools)
assert "promptflow.tools.azure_content_safety.analyze_text" in package_tools.keys()
def test_collect_package_tools_and_connections(self, install_custom_tool_pkg):
keys = ["my_tool_package.tools.my_tool_2.MyTool.my_tool"]
tools, specs, templates = collect_package_tools_and_connections(keys)
assert len(tools) == 1
assert specs == {
"my_tool_package.connections.MyFirstConnection": {
"connectionCategory": "CustomKeys",
"flowValueType": "CustomConnection",
"connectionType": "MyFirstConnection",
"ConnectionTypeDisplayName": "MyFirstConnection",
"configSpecs": [
{"name": "api_key", "displayName": "Api Key", "configValueType": "Secret", "isOptional": False},
{"name": "api_base", "displayName": "Api Base", "configValueType": "str", "isOptional": True},
],
"module": "my_tool_package.connections",
"package": "test-custom-tools",
"package_version": "0.0.2",
}
}
expected_template = {
"$schema": "https://azuremlschemas.azureedge.net/promptflow/latest/CustomStrongTypeConnection.schema.json",
"name": "to_replace_with_connection_name",
"type": "custom",
"custom_type": "MyFirstConnection",
"module": "my_tool_package.connections",
"package": "test-custom-tools",
"package_version": "0.0.2",
"configs": {"api_base": "This is my first connection."},
"secrets": {"api_key": "to_replace_with_api_key"},
}
loaded_yaml = load_yaml_string(templates["my_tool_package.connections.MyFirstConnection"])
assert loaded_yaml == expected_template
keys = ["my_tool_package.tools.my_tool_with_custom_strong_type_connection.my_tool"]
tools, specs, templates = collect_package_tools_and_connections(keys)
assert len(templates) == 1
expected_template = """
name: "to_replace_with_connection_name"
type: custom
custom_type: MyCustomConnection
module: my_tool_package.tools.my_tool_with_custom_strong_type_connection
package: test-custom-tools
package_version: 0.0.2
configs:
api_url: "This is a fake api url." # String type. The api url.
secrets: # must-have
api_key: "to_replace_with_api_key" # String type. The api key.
"""
content = templates["my_tool_package.tools.my_tool_with_custom_strong_type_connection.MyCustomConnection"]
expected_template_str = textwrap.dedent(expected_template)
assert expected_template_str in content
def test_gen_dynamic_list(self, mocked_ws_triple, mock_module_with_list_func):
from promptflow._sdk._utils import _gen_dynamic_list
func_path = "my_tool_package.tools.tool_with_dynamic_list_input.my_list_func"
func_kwargs = {"prefix": "My"}
result = _gen_dynamic_list({"func_path": func_path, "func_kwargs": func_kwargs})
assert len(result) == 2
# test gen_dynamic_list with ws_triple.
with patch("promptflow._cli._utils.get_workspace_triad_from_local", return_value=mocked_ws_triple):
result = _gen_dynamic_list({"func_path": func_path, "func_kwargs": func_kwargs})
assert len(result) == 2
@pytest.mark.unittest
class TestBuiltinsManager:
def test_load_tool_from_module(
self,
):
# Test case 1: When class_name is None
module = MagicMock()
tool_name = "test_tool"
module_name = "test_module"
class_name = None
method_name = "test_method"
node_inputs = {"input1": InputAssignment(value_type=InputValueType.LITERAL, value="value1")}
# Mock the behavior of the module and class
module.test_method = MagicMock()
# Call the method
api, init_inputs = BuiltinsManager._load_tool_from_module(
module, tool_name, module_name, class_name, method_name, node_inputs
)
# Assertions
assert api == module.test_method
assert init_inputs == {}
# Non literal input for init parameter will raise exception.
module = MagicMock()
tool_name = "test_tool"
module_name = "test_module"
class_name = "TestClass"
method_name = "test_method"
node_inputs = {"input1": InputAssignment(value_type=InputValueType.FLOW_INPUT, value="value1")}
# Mock the behavior of the module and class
module.TestClass = MagicMock()
module.TestClass.get_initialize_inputs = MagicMock(return_value=["input1"])
module.TestClass.get_required_initialize_inputs = MagicMock(return_value=["input1"])
module.TestClass.test_method = MagicMock()
# Call the method
with pytest.raises(InputTypeMismatch) as ex:
BuiltinsManager._load_tool_from_module(module, tool_name, module_name, class_name, method_name, node_inputs)
expected_message = (
"Invalid input for 'test_tool': Initialization input 'input1' requires a literal value, "
"but ${flow.value1} was received."
)
assert expected_message == str(ex.value)
| promptflow/src/promptflow/tests/executor/unittests/_core/test_tools_manager.py/0 | {
"file_path": "promptflow/src/promptflow/tests/executor/unittests/_core/test_tools_manager.py",
"repo_id": "promptflow",
"token_count": 5269
} | 46 |
import pytest
from promptflow.contracts.flow import ActivateCondition, InputAssignment, Node
from promptflow.executor._dag_manager import DAGManager
def create_test_node(name, input, activate=None):
input = InputAssignment.deserialize(input)
activate = ActivateCondition.deserialize(activate, name) if activate else None
return Node(
name=name,
tool="test_tool",
connection="azure_open_ai_connection",
inputs={"test_input": input, "test_input2": InputAssignment("hello world")},
provider="test_provider",
api="test_api",
activate=activate,
)
def pop_ready_node_names(dag_manager: DAGManager):
return {node.name for node in dag_manager.pop_ready_nodes()}
def pop_bypassed_node_names(dag_manager: DAGManager):
return {node.name for node in dag_manager.pop_bypassable_nodes()}
@pytest.mark.unittest
class TestDAGManager:
def test_pop_ready_nodes(self):
nodes = [
create_test_node("node1", input="value1"),
create_test_node("node2", input="${node1.output}"),
create_test_node("node3", input="${node1.output}"),
]
dag_manager = DAGManager(nodes, flow_inputs={})
assert pop_ready_node_names(dag_manager) == {"node1"}
dag_manager.complete_nodes({"node1": None})
assert pop_ready_node_names(dag_manager) == {"node2", "node3"}
dag_manager.complete_nodes({"node2": None, "node3": None})
def test_pop_bypassed_nodes(self):
nodes = [
create_test_node("node1", input="value1"),
create_test_node("node2", input="${inputs.text}", activate={"when": "${inputs.text}", "is": "world"}),
create_test_node("node3", input="${node1.output}"),
create_test_node("node4", input="${node2.output}"),
]
flow_inputs = {"text": "hello"}
dag_manager = DAGManager(nodes, flow_inputs)
expected_bypassed_nodes = {"node2", "node4"}
assert pop_bypassed_node_names(dag_manager) == expected_bypassed_nodes
assert dag_manager.bypassed_nodes.keys() == expected_bypassed_nodes
def test_complete_nodes(self):
nodes = [create_test_node("node1", input="value1")]
dag_manager = DAGManager(nodes, flow_inputs={})
dag_manager.complete_nodes({"node1": {"output1": "value1"}})
assert len(dag_manager.completed_nodes_outputs) == 1
assert dag_manager.completed_nodes_outputs["node1"] == {"output1": "value1"}
def test_completed(self):
nodes = [
create_test_node("node1", input="${inputs.text}", activate={"when": "${inputs.text}", "is": "hello"}),
create_test_node("node2", input="${node1.output}"),
]
flow_inputs = {"text": "hello"}
dag_manager = DAGManager(nodes, flow_inputs)
assert pop_ready_node_names(dag_manager) == {"node1"}
dag_manager.complete_nodes({"node1": {"output1": "value1"}})
assert pop_ready_node_names(dag_manager) == {"node2"}
dag_manager.complete_nodes({"node2": {"output1": "value1"}})
assert dag_manager.completed_nodes_outputs.keys() == {"node1", "node2"}
assert dag_manager.completed()
def test_get_node_valid_inputs(self):
nodes = [
create_test_node("node1", input="value1"),
create_test_node("node2", input="${node1.output}"),
]
def f(input):
return input
flow_inputs = {}
dag_manager = DAGManager(nodes, flow_inputs)
dag_manager.complete_nodes({"node1": {"output1": "value1"}})
valid_inputs = dag_manager.get_node_valid_inputs(nodes[1], f)
assert valid_inputs == {"test_input": {"output1": "value1"}, "test_input2": "hello world"}
| promptflow/src/promptflow/tests/executor/unittests/executor/test_dag_manager.py/0 | {
"file_path": "promptflow/src/promptflow/tests/executor/unittests/executor/test_dag_manager.py",
"repo_id": "promptflow",
"token_count": 1632
} | 47 |
import signal
from azure.identity import AzureCliCredential, DefaultAzureCredential
def get_cred():
"""get credential for azure storage"""
# resolve requests
try:
credential = AzureCliCredential()
token = credential.get_token("https://management.azure.com/.default")
except Exception:
credential = DefaultAzureCredential()
# ensure we can get token
token = credential.get_token("https://management.azure.com/.default")
assert token is not None
return credential
PYTEST_TIMEOUT_METHOD = "signal" if hasattr(signal, "SIGALRM") else "thread" # use signal when os support SIGALRM
DEFAULT_TEST_TIMEOUT = 10 * 60 # 10mins
| promptflow/src/promptflow/tests/sdk_cli_azure_test/_azure_utils.py/0 | {
"file_path": "promptflow/src/promptflow/tests/sdk_cli_azure_test/_azure_utils.py",
"repo_id": "promptflow",
"token_count": 242
} | 48 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
ENVIRON_TEST_MODE = "PROMPT_FLOW_TEST_MODE"
class TestMode:
LIVE = "live"
RECORD = "record"
REPLAY = "replay"
FILTER_HEADERS = [
"aml-user-token",
"authorization",
"date",
"etag",
"request-context",
"x-aml-cluster",
"x-ms-access-tier",
"x-ms-access-tier-inferred",
"x-ms-client-request-id",
"x-ms-client-session-id",
"x-ms-client-user-type",
"x-ms-correlation-request-id",
"x-ms-file-permission-key",
"x-ms-lease-state",
"x-ms-lease-status",
"x-ms-server-encrypted",
"x-ms-ratelimit-remaining-subscription-reads",
"x-ms-ratelimit-remaining-subscription-writes",
"x-ms-response-type",
"x-ms-request-id",
"x-ms-routing-request-id",
"x-msedge-ref",
]
class SanitizedValues:
UUID = "00000000-0000-0000-0000-000000000000"
SUBSCRIPTION_ID = "00000000-0000-0000-0000-000000000000"
RESOURCE_GROUP_NAME = "00000"
WORKSPACE_NAME = "00000"
WORKSPACE_ID = "00000000-0000-0000-0000-000000000000"
TENANT_ID = "00000000-0000-0000-0000-000000000000"
USER_OBJECT_ID = "00000000-0000-0000-0000-000000000000"
# workspace
DISCOVERY_URL = "https://eastus.api.azureml.ms/discovery"
# datastore
FAKE_KEY = "this is fake key"
FAKE_ACCOUNT_NAME = "fake_account_name"
FAKE_CONTAINER_NAME = "fake-container-name"
FAKE_FILE_SHARE_NAME = "fake-file-share-name"
# aoai connection
FAKE_API_BASE = "https://fake.openai.azure.com"
# storage
UPLOAD_HASH = "000000000000000000000000000000000000"
BLOB_STORAGE_REQUEST_HOST = "fake_account_name.blob.core.windows.net"
FILE_SHARE_REQUEST_HOST = "fake_account_name.file.core.windows.net"
# PFS
RUNTIME_NAME = "fake-runtime-name"
SESSION_ID = "000000000000000000000000000000000000000000000000"
FLOW_LINEAGE_ID = "0000000000000000000000000000000000000000000000000000000000000000"
REGION = "fake-region"
FLOW_ID = "00000000-0000-0000-0000-000000000000"
# trick: "unknown_user" is the value when client fails to get username
# use this value so that we don't do extra logic when replay
USERNAME = "unknown_user"
# MISC
EMAIL_USERNAME = "username"
class AzureMLResourceTypes:
CONNECTION = "Microsoft.MachineLearningServices/workspaces/connections"
DATASTORE = "Microsoft.MachineLearningServices/workspaces/datastores"
WORKSPACE = "Microsoft.MachineLearningServices/workspaces"
TEST_CLASSES_FOR_RUN_INTEGRATION_TEST_RECORDING = [
"TestCliWithAzure",
"TestFlowRun",
"TestFlow",
"TestTelemetry",
"TestAzureCliPerf",
]
| promptflow/src/promptflow/tests/sdk_cli_azure_test/recording_utilities/constants.py/0 | {
"file_path": "promptflow/src/promptflow/tests/sdk_cli_azure_test/recording_utilities/constants.py",
"repo_id": "promptflow",
"token_count": 1086
} | 49 |
import os
import shutil
import sys
import tempfile
import uuid
from pathlib import Path
import numpy as np
import pandas as pd
import pytest
from marshmallow import ValidationError
from pytest_mock import MockerFixture
from promptflow import PFClient
from promptflow._constants import PROMPTFLOW_CONNECTIONS
from promptflow._sdk._constants import (
FLOW_DIRECTORY_MACRO_IN_CONFIG,
PROMPT_FLOW_DIR_NAME,
FlowRunProperties,
LocalStorageFilenames,
RunStatus,
)
from promptflow._sdk._errors import (
ConnectionNotFoundError,
InvalidFlowError,
InvalidRunError,
InvalidRunStatusError,
RunExistsError,
RunNotFoundError,
)
from promptflow._sdk._load_functions import load_flow, load_run
from promptflow._sdk._run_functions import create_yaml_run
from promptflow._sdk._submitter.utils import SubmitterHelper
from promptflow._sdk._utils import _get_additional_includes
from promptflow._sdk.entities import Run
from promptflow._sdk.operations._local_storage_operations import LocalStorageOperations
from promptflow.connections import AzureOpenAIConnection
from promptflow.exceptions import UserErrorException
from ..recording_utilities import RecordStorage
PROMOTFLOW_ROOT = Path(__file__) / "../../../.."
TEST_ROOT = Path(__file__).parent.parent.parent
MODEL_ROOT = TEST_ROOT / "test_configs/e2e_samples"
CONNECTION_FILE = (PROMOTFLOW_ROOT / "connections.json").resolve().absolute().as_posix()
FLOWS_DIR = "./tests/test_configs/flows"
EAGER_FLOWS_DIR = "./tests/test_configs/eager_flows"
RUNS_DIR = "./tests/test_configs/runs"
DATAS_DIR = "./tests/test_configs/datas"
def create_run_against_multi_line_data(client) -> Run:
return client.run(
flow=f"{FLOWS_DIR}/web_classification",
data=f"{DATAS_DIR}/webClassification3.jsonl",
column_mapping={"url": "${data.url}"},
)
def create_run_against_multi_line_data_without_llm(client: PFClient) -> Run:
return client.run(
flow=f"{FLOWS_DIR}/print_env_var",
data=f"{DATAS_DIR}/env_var_names.jsonl",
)
def create_run_against_run(client, run: Run) -> Run:
return client.run(
flow=f"{FLOWS_DIR}/classification_accuracy_evaluation",
data=f"{DATAS_DIR}/webClassification3.jsonl",
run=run.name,
column_mapping={
"groundtruth": "${data.answer}",
"prediction": "${run.outputs.category}",
"variant_id": "${data.variant_id}",
},
)
def assert_run_with_invalid_column_mapping(client: PFClient, run: Run) -> None:
assert run.status == RunStatus.FAILED
with pytest.raises(InvalidRunStatusError):
client.stream(run.name)
local_storage = LocalStorageOperations(run)
assert os.path.exists(local_storage._exception_path)
exception = local_storage.load_exception()
assert "The input for batch run is incorrect. Couldn't find these mapping relations" in exception["message"]
assert exception["code"] == "UserError"
assert exception["innerError"]["innerError"]["code"] == "BulkRunException"
@pytest.mark.usefixtures(
"use_secrets_config_file", "recording_injection", "setup_local_connection", "install_custom_tool_pkg"
)
@pytest.mark.sdk_test
@pytest.mark.e2etest
class TestFlowRun:
def test_basic_flow_bulk_run(self, azure_open_ai_connection: AzureOpenAIConnection, pf) -> None:
data_path = f"{DATAS_DIR}/webClassification3.jsonl"
pf.run(flow=f"{FLOWS_DIR}/web_classification", data=data_path)
# Test repeated execute flow run
pf.run(flow=f"{FLOWS_DIR}/web_classification", data=data_path)
pf.run(flow=f"{FLOWS_DIR}/web_classification_v1", data=data_path)
pf.run(flow=f"{FLOWS_DIR}/web_classification_v2", data=data_path)
# TODO: check details
# df = pf.show_details(baseline, v1, v2)
def test_basic_run_bulk(self, azure_open_ai_connection: AzureOpenAIConnection, local_client, pf):
result = pf.run(
flow=f"{FLOWS_DIR}/web_classification",
data=f"{DATAS_DIR}/webClassification1.jsonl",
column_mapping={"url": "${data.url}"},
)
local_storage = LocalStorageOperations(result)
detail = local_storage.load_detail()
tuning_node = next((x for x in detail["node_runs"] if x["node"] == "summarize_text_content"), None)
# used default variant config
assert tuning_node["inputs"]["temperature"] == 0.3
assert "variant_0" in result.name
run = local_client.runs.get(name=result.name)
assert run.status == "Completed"
# write to user_dir/.promptflow/.runs
assert ".promptflow" in run.properties["output_path"]
def test_local_storage_delete(self, pf):
result = pf.run(flow=f"{FLOWS_DIR}/print_env_var", data=f"{DATAS_DIR}/env_var_names.jsonl")
local_storage = LocalStorageOperations(result)
local_storage.delete()
assert not os.path.exists(local_storage._outputs_path)
def test_flow_run_delete(self, pf):
result = pf.run(flow=f"{FLOWS_DIR}/print_env_var", data=f"{DATAS_DIR}/env_var_names.jsonl")
local_storage = LocalStorageOperations(result)
output_path = local_storage.path
# delete new created run by name
pf.runs.delete(result.name)
# check folders and dbs are deleted
assert not os.path.exists(output_path)
from promptflow._sdk._orm import RunInfo as ORMRun
pytest.raises(RunNotFoundError, lambda: ORMRun.get(result.name))
pytest.raises(RunNotFoundError, lambda: pf.runs.get(result.name))
def test_flow_run_delete_fake_id_raise(self, pf: PFClient):
run = "fake_run_id"
# delete new created run by name
pytest.raises(RunNotFoundError, lambda: pf.runs.delete(name=run))
@pytest.mark.skipif(sys.platform == "win32", reason="Windows doesn't support chmod, just test permission errors")
def test_flow_run_delete_invalid_permission_raise(self, pf: PFClient):
result = pf.run(flow=f"{FLOWS_DIR}/print_env_var", data=f"{DATAS_DIR}/env_var_names.jsonl")
local_storage = LocalStorageOperations(result)
output_path = local_storage.path
os.chmod(output_path, 0o555)
# delete new created run by name
pytest.raises(InvalidRunError, lambda: pf.runs.delete(name=result.name))
# Change folder permission back
os.chmod(output_path, 0o755)
pf.runs.delete(name=result.name)
assert not os.path.exists(output_path)
def test_visualize_run_with_referenced_run_deleted(self, pf: PFClient):
run_id = str(uuid.uuid4())
run = load_run(
source=f"{RUNS_DIR}/sample_bulk_run.yaml",
params_override=[{"name": run_id}],
)
run_a = pf.runs.create_or_update(run=run)
local_storage_a = LocalStorageOperations(run_a)
output_path_a = local_storage_a.path
run = load_run(source=f"{RUNS_DIR}/sample_eval_run.yaml", params_override=[{"run": run_id}])
run_b = pf.runs.create_or_update(run=run)
local_storage_b = LocalStorageOperations(run_b)
output_path_b = local_storage_b.path
pf.runs.delete(run_a.name)
assert not os.path.exists(output_path_a)
assert os.path.exists(output_path_b)
# visualize doesn't raise error
pf.runs.visualize(run_b.name)
def test_basic_flow_with_variant(self, azure_open_ai_connection: AzureOpenAIConnection, local_client, pf) -> None:
result = pf.run(
flow=f"{FLOWS_DIR}/web_classification",
data=f"{DATAS_DIR}/webClassification1.jsonl",
column_mapping={"url": "${data.url}"},
variant="${summarize_text_content.variant_0}",
)
local_storage = LocalStorageOperations(result)
detail = local_storage.load_detail()
tuning_node = next((x for x in detail["node_runs"] if x["node"] == "summarize_text_content"), None)
assert "variant_0" in result.name
# used variant_0 config
assert tuning_node["inputs"]["temperature"] == 0.2
result = pf.run(
flow=f"{FLOWS_DIR}/web_classification",
data=f"{DATAS_DIR}/webClassification1.jsonl",
column_mapping={"url": "${data.url}"},
variant="${summarize_text_content.variant_1}",
)
local_storage = LocalStorageOperations(result)
detail = local_storage.load_detail()
tuning_node = next((x for x in detail["node_runs"] if x["node"] == "summarize_text_content"), None)
assert "variant_1" in result.name
# used variant_1 config
assert tuning_node["inputs"]["temperature"] == 0.3
def test_run_bulk_error(self, pf):
# path not exist
with pytest.raises(FileNotFoundError) as e:
pf.run(
flow=f"{MODEL_ROOT}/not_exist",
data=f"{DATAS_DIR}/webClassification3.jsonl",
column_mapping={"question": "${data.question}", "context": "${data.context}"},
variant="${summarize_text_content.variant_0}",
)
assert "not exist" in str(e.value)
# tuning_node not exist
with pytest.raises(InvalidFlowError) as e:
pf.run(
flow=f"{FLOWS_DIR}/web_classification",
data=f"{DATAS_DIR}/webClassification3.jsonl",
column_mapping={"question": "${data.question}", "context": "${data.context}"},
variant="${not_exist.variant_0}",
)
assert "Node not_exist not found in flow" in str(e.value)
# invalid variant format
with pytest.raises(UserErrorException) as e:
pf.run(
flow=f"{FLOWS_DIR}/web_classification",
data=f"{DATAS_DIR}/webClassification3.jsonl",
column_mapping={"question": "${data.question}", "context": "${data.context}"},
variant="v",
)
assert "Invalid variant format: v, variant should be in format of ${TUNING_NODE.VARIANT}" in str(e.value)
def test_basic_evaluation(self, azure_open_ai_connection: AzureOpenAIConnection, local_client, pf):
result = pf.run(
flow=f"{FLOWS_DIR}/print_env_var",
data=f"{DATAS_DIR}/env_var_names.jsonl",
)
assert local_client.runs.get(result.name).status == "Completed"
eval_result = pf.run(
flow=f"{FLOWS_DIR}/classification_accuracy_evaluation",
run=result.name,
column_mapping={
"prediction": "${run.outputs.output}",
# evaluation reference run.inputs
# NOTE: we need this value to guard behavior when a run reference another run's inputs
"variant_id": "${run.inputs.key}",
# can reference other columns in data which doesn't exist in base run's inputs
"groundtruth": "${run.inputs.extra_key}",
},
)
assert local_client.runs.get(eval_result.name).status == "Completed"
def test_flow_demo(self, azure_open_ai_connection, pf):
data_path = f"{DATAS_DIR}/webClassification3.jsonl"
column_mapping = {
"groundtruth": "${data.answer}",
"prediction": "${run.outputs.category}",
"variant_id": "${data.variant_id}",
}
metrics = {}
for flow_name, output_key in [
("web_classification", "baseline"),
("web_classification_v1", "v1"),
("web_classification_v2", "v2"),
]:
v = pf.run(flow=f"{FLOWS_DIR}/web_classification", data=data_path)
metrics[output_key] = pf.run(
flow=f"{FLOWS_DIR}/classification_accuracy_evaluation",
data=data_path,
run=v,
column_mapping=column_mapping,
)
def test_submit_run_from_yaml(self, local_client, pf):
run_id = str(uuid.uuid4())
run = create_yaml_run(source=f"{RUNS_DIR}/sample_bulk_run.yaml", params_override=[{"name": run_id}])
assert local_client.runs.get(run.name).status == "Completed"
eval_run = create_yaml_run(
source=f"{RUNS_DIR}/sample_eval_run.yaml",
params_override=[{"run": run_id}],
)
assert local_client.runs.get(eval_run.name).status == "Completed"
@pytest.mark.usefixtures("enable_logger_propagate")
def test_submit_run_with_extra_params(self, pf, caplog):
run_id = str(uuid.uuid4())
run = create_yaml_run(source=f"{RUNS_DIR}/extra_field.yaml", params_override=[{"name": run_id}])
assert pf.runs.get(run.name).status == "Completed"
assert "Run schema validation warnings. Unknown fields found" in caplog.text
def test_run_with_connection(self, local_client, local_aoai_connection, pf):
# remove connection file to test connection resolving
os.environ.pop(PROMPTFLOW_CONNECTIONS)
result = pf.run(
flow=f"{FLOWS_DIR}/web_classification",
data=f"{DATAS_DIR}/webClassification1.jsonl",
column_mapping={"url": "${data.url}"},
)
local_storage = LocalStorageOperations(result)
detail = local_storage.load_detail()
tuning_node = next((x for x in detail["node_runs"] if x["node"] == "summarize_text_content"), None)
# used default variant config
assert tuning_node["inputs"]["temperature"] == 0.3
run = local_client.runs.get(name=result.name)
assert run.status == "Completed"
def test_run_with_connection_overwrite(self, local_client, local_aoai_connection, local_alt_aoai_connection, pf):
result = pf.run(
flow=f"{FLOWS_DIR}/web_classification",
data=f"{DATAS_DIR}/webClassification1.jsonl",
connections={"classify_with_llm": {"connection": "new_ai_connection"}},
)
run = local_client.runs.get(name=result.name)
assert run.status == "Completed"
def test_custom_connection_overwrite(self, local_client, local_custom_connection, pf):
result = pf.run(
flow=f"{FLOWS_DIR}/custom_connection_flow",
data=f"{DATAS_DIR}/env_var_names.jsonl",
connections={"print_env": {"connection": "test_custom_connection"}},
)
run = local_client.runs.get(name=result.name)
assert run.status == "Completed"
# overwrite non-exist connection
with pytest.raises(InvalidFlowError) as e:
pf.run(
flow=f"{FLOWS_DIR}/custom_connection_flow",
data=f"{DATAS_DIR}/env_var_names.jsonl",
connections={"print_env": {"new_connection": "test_custom_connection"}},
)
assert "Connection with name new_connection not found" in str(e.value)
def test_basic_flow_with_package_tool_with_custom_strong_type_connection(
self, install_custom_tool_pkg, local_client, pf
):
result = pf.run(
flow=f"{FLOWS_DIR}/flow_with_package_tool_with_custom_strong_type_connection",
data=f"{FLOWS_DIR}/flow_with_package_tool_with_custom_strong_type_connection/data.jsonl",
connections={"My_First_Tool_00f8": {"connection": "custom_strong_type_connection"}},
)
run = local_client.runs.get(name=result.name)
assert run.status == "Completed"
def test_basic_flow_with_script_tool_with_custom_strong_type_connection(
self, install_custom_tool_pkg, local_client, pf
):
# Prepare custom connection
from promptflow.connections import CustomConnection
conn = CustomConnection(name="custom_connection_2", secrets={"api_key": "test"}, configs={"api_url": "test"})
local_client.connections.create_or_update(conn)
result = pf.run(
flow=f"{FLOWS_DIR}/flow_with_script_tool_with_custom_strong_type_connection",
data=f"{FLOWS_DIR}/flow_with_script_tool_with_custom_strong_type_connection/data.jsonl",
)
run = local_client.runs.get(name=result.name)
assert run.status == "Completed"
def test_run_with_connection_overwrite_non_exist(self, local_client, local_aoai_connection, pf):
# overwrite non_exist connection
with pytest.raises(ConnectionNotFoundError):
pf.run(
flow=f"{FLOWS_DIR}/web_classification",
data=f"{DATAS_DIR}/webClassification1.jsonl",
connections={"classify_with_llm": {"connection": "Not_exist"}},
)
def test_run_reference_failed_run(self, pf):
failed_run = pf.run(
flow=f"{FLOWS_DIR}/failed_flow",
data=f"{DATAS_DIR}/webClassification1.jsonl",
column_mapping={"text": "${data.url}"},
)
# "update" run status to failed since currently all run will be completed unless there's bug
pf.runs.update(
name=failed_run.name,
status="Failed",
)
run_name = str(uuid.uuid4())
with pytest.raises(UserErrorException) as e:
pf.run(
name=run_name,
flow=f"{FLOWS_DIR}/custom_connection_flow",
run=failed_run,
connections={"print_env": {"connection": "test_custom_connection"}},
)
assert "is not completed, got status" in str(e.value)
# run should not be created
with pytest.raises(RunNotFoundError):
pf.runs.get(name=run_name)
def test_referenced_output_not_exist(self, pf: PFClient) -> None:
# failed run won't generate output
failed_run = pf.run(
flow=f"{FLOWS_DIR}/failed_flow",
data=f"{DATAS_DIR}/webClassification1.jsonl",
column_mapping={"text": "${data.url}"},
)
run_name = str(uuid.uuid4())
run = pf.run(
name=run_name,
run=failed_run,
flow=f"{FLOWS_DIR}/failed_flow",
column_mapping={"text": "${run.outputs.text}"},
)
assert_run_with_invalid_column_mapping(pf, run)
def test_connection_overwrite_file(self, local_client, local_aoai_connection):
run = create_yaml_run(
source=f"{RUNS_DIR}/run_with_connections.yaml",
)
run = local_client.runs.get(name=run.name)
assert run.status == "Completed"
def test_connection_overwrite_model(self, local_client, local_aoai_connection):
run = create_yaml_run(
source=f"{RUNS_DIR}/run_with_connections_model.yaml",
)
run = local_client.runs.get(name=run.name)
assert run.status == "Completed"
def test_resolve_connection(self, local_client, local_aoai_connection):
flow = load_flow(f"{FLOWS_DIR}/web_classification_no_variants")
connections = SubmitterHelper.resolve_connections(flow, local_client)
assert local_aoai_connection.name in connections
def test_run_with_env_overwrite(self, local_client, local_aoai_connection):
run = create_yaml_run(
source=f"{RUNS_DIR}/run_with_env.yaml",
)
outputs = local_client.runs._get_outputs(run=run)
assert outputs["output"][0] == local_aoai_connection.api_base
def test_pf_run_with_env_overwrite(self, local_client, local_aoai_connection, pf):
run = pf.run(
flow=f"{FLOWS_DIR}/print_env_var",
data=f"{DATAS_DIR}/env_var_names.jsonl",
environment_variables={"API_BASE": "${azure_open_ai_connection.api_base}"},
)
outputs = local_client.runs._get_outputs(run=run)
assert outputs["output"][0] == local_aoai_connection.api_base
def test_eval_run_not_exist(self, pf):
name = str(uuid.uuid4())
with pytest.raises(RunNotFoundError) as e:
pf.runs.create_or_update(
run=Run(
name=name,
flow=Path(f"{FLOWS_DIR}/classification_accuracy_evaluation"),
run="not_exist",
column_mapping={
"groundtruth": "${data.answer}",
"prediction": "${run.outputs.category}",
# evaluation reference run.inputs
"url": "${run.inputs.url}",
},
)
)
assert "Run name 'not_exist' cannot be found" in str(e.value)
# run should not be created
with pytest.raises(RunNotFoundError):
pf.runs.get(name=name)
def test_eval_run_data_deleted(self, pf):
with tempfile.TemporaryDirectory() as temp_dir:
shutil.copy(f"{DATAS_DIR}/env_var_names.jsonl", temp_dir)
result = pf.run(
flow=f"{FLOWS_DIR}/print_env_var",
data=f"{temp_dir}/env_var_names.jsonl",
)
assert pf.runs.get(result.name).status == "Completed"
# delete original run's input data
os.remove(f"{temp_dir}/env_var_names.jsonl")
with pytest.raises(UserErrorException) as e:
pf.run(
flow=f"{FLOWS_DIR}/classification_accuracy_evaluation",
run=result.name,
column_mapping={
"prediction": "${run.outputs.output}",
# evaluation reference run.inputs
# NOTE: we need this value to guard behavior when a run reference another run's inputs
"variant_id": "${run.inputs.key}",
# can reference other columns in data which doesn't exist in base run's inputs
"groundtruth": "${run.inputs.extra_key}",
},
)
assert "Please make sure it exists and not deleted." in str(e.value)
def test_eval_run_data_not_exist(self, pf):
base_run = pf.run(
flow=f"{FLOWS_DIR}/print_env_var",
data=f"{DATAS_DIR}/env_var_names.jsonl",
)
assert pf.runs.get(base_run.name).status == "Completed"
eval_run = pf.run(
flow=f"{FLOWS_DIR}/classification_accuracy_evaluation",
run=base_run.name,
column_mapping={
"prediction": "${run.outputs.output}",
# evaluation reference run.inputs
# NOTE: we need this value to guard behavior when a run reference another run's inputs
"variant_id": "${run.inputs.key}",
# can reference other columns in data which doesn't exist in base run's inputs
"groundtruth": "${run.inputs.extra_key}",
},
)
result = pf.run(
flow=f"{FLOWS_DIR}/classification_accuracy_evaluation",
run=eval_run.name,
column_mapping={
"prediction": "${run.outputs.output}",
# evaluation reference run.inputs
# NOTE: we need this value to guard behavior when a run reference another run's inputs
"variant_id": "${run.inputs.key}",
# can reference other columns in data which doesn't exist in base run's inputs
"groundtruth": "${run.inputs.extra_key}",
},
)
# Run failed because run inputs data is None, and error will be in the run output error.json
assert result.status == "Failed"
def test_create_run_with_tags(self, pf):
name = str(uuid.uuid4())
display_name = "test_run_with_tags"
tags = {"key1": "tag1"}
run = pf.run(
name=name,
display_name=display_name,
tags=tags,
flow=f"{FLOWS_DIR}/print_env_var",
data=f"{DATAS_DIR}/env_var_names.jsonl",
environment_variables={"API_BASE": "${azure_open_ai_connection.api_base}"},
)
assert run.name == name
assert "test_run_with_tags" == run.display_name
assert run.tags == tags
def test_run_display_name(self, pf):
# use run name if not specify display_name
run = pf.runs.create_or_update(
run=Run(
flow=Path(f"{FLOWS_DIR}/print_env_var"),
data=f"{DATAS_DIR}/env_var_names.jsonl",
environment_variables={"API_BASE": "${azure_open_ai_connection.api_base}"},
)
)
assert run.display_name == run.name
assert "print_env_var" in run.display_name
# will respect if specified in run
base_run = pf.runs.create_or_update(
run=Run(
flow=Path(f"{FLOWS_DIR}/print_env_var"),
data=f"{DATAS_DIR}/env_var_names.jsonl",
environment_variables={"API_BASE": "${azure_open_ai_connection.api_base}"},
display_name="my_run",
)
)
assert base_run.display_name == "my_run"
run = pf.runs.create_or_update(
run=Run(
flow=Path(f"{FLOWS_DIR}/print_env_var"),
data=f"{DATAS_DIR}/env_var_names.jsonl",
environment_variables={"API_BASE": "${azure_open_ai_connection.api_base}"},
display_name="my_run_${variant_id}_${run}",
run=base_run,
)
)
assert run.display_name == f"my_run_variant_0_{base_run.name}"
run = pf.runs.create_or_update(
run=Run(
flow=Path(f"{FLOWS_DIR}/print_env_var"),
data=f"{DATAS_DIR}/env_var_names.jsonl",
environment_variables={"API_BASE": "${azure_open_ai_connection.api_base}"},
display_name="my_run_${timestamp}",
run=base_run,
)
)
assert "${timestamp}" not in run.display_name
def test_run_dump(self, azure_open_ai_connection: AzureOpenAIConnection, pf) -> None:
data_path = f"{DATAS_DIR}/webClassification3.jsonl"
run = pf.run(flow=f"{FLOWS_DIR}/web_classification", data=data_path)
# in fact, `pf.run` will internally query the run from db in `RunSubmitter`
# explicitly call ORM get here to emphasize the dump operatoin
# if no dump operation, a RunNotFoundError will be raised here
pf.runs.get(run.name)
def test_run_list(self, azure_open_ai_connection: AzureOpenAIConnection, pf) -> None:
# create a run to ensure there is at least one run in the db
data_path = f"{DATAS_DIR}/webClassification3.jsonl"
pf.run(flow=f"{FLOWS_DIR}/web_classification", data=data_path)
# not specify `max_result` here, so that if there are legacy runs in the db
# list runs API can collect them, and can somehow cover legacy schema
runs = pf.runs.list()
assert len(runs) >= 1
def test_stream_run_summary(self, azure_open_ai_connection: AzureOpenAIConnection, local_client, capfd, pf) -> None:
data_path = f"{DATAS_DIR}/webClassification3.jsonl"
run = pf.run(flow=f"{FLOWS_DIR}/web_classification", data=data_path)
local_client.runs.stream(run.name)
out, _ = capfd.readouterr()
print(out)
assert 'Run status: "Completed"' in out
assert "Output path: " in out
def test_stream_incomplete_run_summary(
self, azure_open_ai_connection: AzureOpenAIConnection, local_client, capfd, pf
) -> None:
# use wrong data to create a failed run
data_path = f"{DATAS_DIR}/webClassification3.jsonl"
name = str(uuid.uuid4())
run = pf.run(
flow=f"{FLOWS_DIR}/failed_flow",
data=data_path,
column_mapping={"text": "${data.url}"},
name=name,
)
local_client.runs.stream(run.name)
# assert error message in stream API
out, _ = capfd.readouterr()
assert 'Run status: "Completed"' in out
# won't print exception, use can get it from run._to_dict()
# assert "failed with exception" in out
def test_run_data_not_provided(self, pf):
with pytest.raises(ValueError) as e:
pf.run(
flow=f"{FLOWS_DIR}/web_classification",
)
assert "at least one of data or run must be provided" in str(e)
def test_get_details(self, azure_open_ai_connection: AzureOpenAIConnection, pf) -> None:
data_path = f"{DATAS_DIR}/webClassification3.jsonl"
run = pf.run(
flow=f"{FLOWS_DIR}/web_classification",
data=data_path,
column_mapping={"url": "${data.url}"},
)
from promptflow._sdk.operations._local_storage_operations import LocalStorageOperations
local_storage = LocalStorageOperations(run)
# there should be line_number in original DataFrame, but not in details DataFrame
# as we will set index on line_number to ensure the order
outputs = pd.read_json(local_storage._outputs_path, orient="records", lines=True)
details = pf.get_details(run)
assert "line_number" in outputs and "line_number" not in details
def test_visualize_run(self, azure_open_ai_connection: AzureOpenAIConnection, pf) -> None:
data_path = f"{DATAS_DIR}/webClassification3.jsonl"
run1 = pf.run(
flow=f"{FLOWS_DIR}/web_classification",
data=data_path,
column_mapping={"url": "${data.url}"},
)
run2 = pf.run(
flow=f"{FLOWS_DIR}/classification_accuracy_evaluation",
data=data_path,
run=run1.name,
column_mapping={
"groundtruth": "${data.answer}",
"prediction": "${run.outputs.category}",
"variant_id": "${data.variant_id}",
},
)
pf.visualize([run1, run2])
def test_incomplete_run_visualize(
self, azure_open_ai_connection: AzureOpenAIConnection, pf, capfd: pytest.CaptureFixture
) -> None:
failed_run = pf.run(
flow=f"{FLOWS_DIR}/failed_flow",
data=f"{DATAS_DIR}/webClassification1.jsonl",
column_mapping={"text": "${data.url}"},
)
# "update" run status to failed since currently all run will be completed unless there's bug
pf.runs.update(
name=failed_run.name,
status="Failed",
)
# patch logger.error to print, so that we can capture the error message using capfd
from promptflow._sdk.operations import _run_operations
_run_operations.logger.error = print
pf.visualize(failed_run)
captured = capfd.readouterr()
expected_error_message = (
f"Cannot visualize non-completed run. Run {failed_run.name!r} is not completed, the status is 'Failed'."
)
assert expected_error_message in captured.out
def test_flow_bulk_run_with_additional_includes(self, azure_open_ai_connection: AzureOpenAIConnection, pf):
data_path = f"{DATAS_DIR}/webClassification3.jsonl"
run = pf.run(flow=f"{FLOWS_DIR}/web_classification_with_additional_include", data=data_path)
additional_includes = _get_additional_includes(run.flow / "flow.dag.yaml")
snapshot_path = Path.home() / ".promptflow" / ".runs" / run.name / "snapshot"
for item in additional_includes:
assert (snapshot_path / Path(item).name).exists()
# Addition includes in snapshot is removed
additional_includes = _get_additional_includes(snapshot_path / "flow.dag.yaml")
assert not additional_includes
def test_input_mapping_source_not_found_error(self, azure_open_ai_connection: AzureOpenAIConnection, pf):
# input_mapping source not found error won't create run
name = str(uuid.uuid4())
data_path = f"{DATAS_DIR}/webClassification3.jsonl"
run = pf.run(
flow=f"{FLOWS_DIR}/web_classification",
data=data_path,
column_mapping={"not_exist": "${data.not_exist_key}"},
name=name,
)
assert_run_with_invalid_column_mapping(pf, run)
def test_input_mapping_with_dict(self, azure_open_ai_connection: AzureOpenAIConnection, pf):
data_path = f"{DATAS_DIR}/webClassification3.jsonl"
run = pf.run(
flow=f"{FLOWS_DIR}/flow_with_dict_input",
data=data_path,
column_mapping={"key": {"value": "1"}, "url": "${data.url}"},
)
outputs = pf.runs._get_outputs(run=run)
assert "dict" in outputs["output"][0]
def test_run_exist_error(self, pf):
name = str(uuid.uuid4())
data_path = f"{DATAS_DIR}/webClassification3.jsonl"
pf.run(
name=name,
flow=f"{FLOWS_DIR}/flow_with_dict_input",
data=data_path,
column_mapping={"key": {"value": "1"}, "url": "${data.url}"},
)
# create a new run won't affect original run
with pytest.raises(RunExistsError):
pf.run(
name=name,
flow=f"{FLOWS_DIR}/flow_with_dict_input",
data=data_path,
column_mapping={"key": {"value": "1"}, "url": "${data.url}"},
)
run = pf.runs.get(name)
assert run.status == RunStatus.COMPLETED
assert not os.path.exists(run._output_path / LocalStorageFilenames.EXCEPTION)
def test_run_local_storage_structure(self, local_client, pf) -> None:
run = create_run_against_multi_line_data(pf)
local_storage = LocalStorageOperations(local_client.runs.get(run.name))
run_output_path = local_storage.path
assert (Path(run_output_path) / "flow_outputs").is_dir()
assert (Path(run_output_path) / "flow_outputs" / "output.jsonl").is_file()
assert (Path(run_output_path) / "flow_artifacts").is_dir()
# 3 line runs for webClassification3.jsonl
assert len([_ for _ in (Path(run_output_path) / "flow_artifacts").iterdir()]) == 3
assert (Path(run_output_path) / "node_artifacts").is_dir()
# 5 nodes web classification flow DAG
assert len([_ for _ in (Path(run_output_path) / "node_artifacts").iterdir()]) == 5
def test_run_snapshot_with_flow_tools_json(self, local_client, pf) -> None:
run = create_run_against_multi_line_data(pf)
local_storage = LocalStorageOperations(local_client.runs.get(run.name))
assert (local_storage._snapshot_folder_path / ".promptflow").is_dir()
assert (local_storage._snapshot_folder_path / ".promptflow" / "flow.tools.json").is_file()
def test_get_metrics_format(self, local_client, pf) -> None:
run1 = create_run_against_multi_line_data(pf)
run2 = create_run_against_run(pf, run1)
# ensure the result is a flatten dict
assert local_client.runs.get_metrics(run2.name).keys() == {"accuracy"}
def test_get_detail_format(self, local_client, pf) -> None:
run = create_run_against_multi_line_data(pf)
# data is a jsonl file, so we can know the number of line runs
with open(f"{DATAS_DIR}/webClassification3.jsonl", "r") as f:
data = f.readlines()
number_of_lines = len(data)
local_storage = LocalStorageOperations(local_client.runs.get(run.name))
detail = local_storage.load_detail()
assert isinstance(detail, dict)
# flow runs
assert "flow_runs" in detail
assert isinstance(detail["flow_runs"], list)
assert len(detail["flow_runs"]) == number_of_lines
# node runs
assert "node_runs" in detail
assert isinstance(detail["node_runs"], list)
def test_run_logs(self, pf):
data_path = f"{DATAS_DIR}/webClassification3.jsonl"
run = pf.run(
flow=f"{FLOWS_DIR}/flow_with_user_output",
data=data_path,
column_mapping={"key": {"value": "1"}, "url": "${data.url}"},
)
local_storage = LocalStorageOperations(run=run)
logs = local_storage.logger.get_logs()
# For Batch run, the executor uses bulk logger to print logs, and only prints the error log of the nodes.
existing_keywords = ["execution", "execution.bulk", "WARNING", "error log"]
assert all([keyword in logs for keyword in existing_keywords])
non_existing_keywords = ["execution.flow", "user log"]
assert all([keyword not in logs for keyword in non_existing_keywords])
def test_get_detail_against_partial_fail_run(self, pf) -> None:
run = pf.run(
flow=f"{FLOWS_DIR}/partial_fail",
data=f"{FLOWS_DIR}/partial_fail/data.jsonl",
)
detail = pf.runs.get_details(name=run.name)
detail.fillna("", inplace=True)
assert len(detail) == 3
def test_flow_with_only_static_values(self, pf):
name = str(uuid.uuid4())
data_path = f"{DATAS_DIR}/webClassification3.jsonl"
with pytest.raises(UserErrorException) as e:
pf.run(
flow=f"{FLOWS_DIR}/flow_with_dict_input",
data=data_path,
column_mapping={"key": {"value": "1"}},
name=name,
)
assert "Column mapping must contain at least one mapping binding" in str(e.value)
# run should not be created
with pytest.raises(RunNotFoundError):
pf.runs.get(name=name)
def test_error_message_dump(self, pf):
failed_run = pf.run(
flow=f"{FLOWS_DIR}/failed_flow",
data=f"{DATAS_DIR}/webClassification1.jsonl",
column_mapping={"text": "${data.url}"},
)
# even if all lines failed, the bulk run's status is completed.
assert failed_run.status == "Completed"
# error messages will store in local
local_storage = LocalStorageOperations(failed_run)
assert os.path.exists(local_storage._exception_path)
exception = local_storage.load_exception()
assert "Failed to run 1/1 lines. First error message is" in exception["message"]
# line run failures will be stored in additionalInfo
assert len(exception["additionalInfo"][0]["info"]["errors"]) == 1
# show run will get error message
run = pf.runs.get(name=failed_run.name)
run_dict = run._to_dict()
assert "error" in run_dict
assert run_dict["error"] == exception
@pytest.mark.skipif(RecordStorage.is_replaying_mode(), reason="System metrics not supported in replaying mode")
def test_system_metrics_in_properties(self, pf) -> None:
run = create_run_against_multi_line_data(pf)
assert FlowRunProperties.SYSTEM_METRICS in run.properties
assert isinstance(run.properties[FlowRunProperties.SYSTEM_METRICS], dict)
assert "total_tokens" in run.properties[FlowRunProperties.SYSTEM_METRICS]
def test_run_get_inputs(self, pf):
# inputs should be persisted when defaults are used
run = pf.run(
flow=f"{FLOWS_DIR}/default_input",
data=f"{DATAS_DIR}/webClassification1.jsonl",
)
inputs = pf.runs._get_inputs(run=run)
assert inputs == {
"line_number": [0],
"input_bool": [False],
"input_dict": [{}],
"input_list": [[]],
"input_str": ["input value from default"],
}
# inputs should be persisted when data value are used
run = pf.run(
flow=f"{FLOWS_DIR}/flow_with_dict_input",
data=f"{DATAS_DIR}/dictInput1.jsonl",
)
inputs = pf.runs._get_inputs(run=run)
assert inputs == {"key": [{"key": "value in data"}], "line_number": [0]}
# inputs should be persisted when column-mapping are used
run = pf.run(
flow=f"{FLOWS_DIR}/flow_with_dict_input",
data=f"{DATAS_DIR}/webClassification1.jsonl",
column_mapping={"key": {"value": "value in column-mapping"}, "url": "${data.url}"},
)
inputs = pf.runs._get_inputs(run=run)
assert inputs == {
"key": [{"value": "value in column-mapping"}],
"line_number": [0],
"url": ["https://www.youtube.com/watch?v=o5ZQyXaAv1g"],
}
def test_executor_logs_in_batch_run_logs(self, pf) -> None:
run = create_run_against_multi_line_data_without_llm(pf)
local_storage = LocalStorageOperations(run=run)
logs = local_storage.logger.get_logs()
# below warning is printed by executor before the batch run executed
# the warning message results from we do not use column mapping
# so it is expected to be printed here
assert "Starting run without column mapping may lead to unexpected results." in logs
def test_basic_image_flow_bulk_run(self, pf, local_client) -> None:
image_flow_path = f"{FLOWS_DIR}/python_tool_with_simple_image"
data_path = f"{image_flow_path}/image_inputs/inputs.jsonl"
result = pf.run(flow=image_flow_path, data=data_path, column_mapping={"image": "${data.image}"})
run = local_client.runs.get(name=result.name)
assert run.status == "Completed"
assert "error" not in run._to_dict()
def test_python_tool_with_composite_image(self, pf) -> None:
image_flow_path = f"{FLOWS_DIR}/python_tool_with_composite_image"
data_path = f"{image_flow_path}/inputs.jsonl"
result = pf.run(
flow=image_flow_path,
data=data_path,
column_mapping={
"image_list": "${data.image_list}",
"image_dict": "${data.image_dict}",
},
)
run = pf.runs.get(name=result.name)
assert run.status == "Completed"
# no error when processing lines
assert "error" not in run._to_dict()
# test input from output
result = pf.run(
run=result,
flow=image_flow_path,
column_mapping={
"image_list": "${run.outputs.output}"
# image dict will use default value, which is relative to flow's folder
},
)
run = pf.runs.get(name=result.name)
assert run.status == "Completed"
# no error when processing lines
assert "error" not in run._to_dict()
def test_image_without_default(self, pf):
image_flow_path = f"{FLOWS_DIR}/python_tool_with_simple_image_without_default"
data_path = f"{DATAS_DIR}/image_inputs"
result = pf.run(
flow=image_flow_path,
data=data_path,
column_mapping={
"image_1": "${data.image}",
"image_2": "${data.image}",
},
)
run = pf.runs.get(name=result.name)
assert run.status == "Completed", run.name
# no error when processing lines
assert "error" not in run._to_dict(), run.name
def test_get_details_for_image_in_flow(self, pf) -> None:
image_flow_path = f"{FLOWS_DIR}/python_tool_with_simple_image"
data_path = f"{image_flow_path}/image_inputs/inputs.jsonl"
run = pf.run(
flow=image_flow_path,
data=data_path,
column_mapping={"image": "${data.image}"},
)
details = pf.get_details(run.name)
for i in range(len(details)):
input_image_path = details["inputs.image"][i]["data:image/png;path"]
assert Path(input_image_path).is_absolute()
output_image_path = details["outputs.output"][i]["data:image/png;path"]
assert Path(output_image_path).is_absolute()
def test_stream_raise_on_error_false(self, pf: PFClient, capfd: pytest.CaptureFixture) -> None:
data_path = f"{DATAS_DIR}/webClassification3.jsonl"
run = pf.run(
flow=f"{FLOWS_DIR}/web_classification",
data=data_path,
column_mapping={"not_exist": "${data.not_exist_key}"},
name=str(uuid.uuid4()),
)
# raise_on_error=False, will print error message in stdout
pf.stream(run.name, raise_on_error=False)
out, _ = capfd.readouterr()
assert "The input for batch run is incorrect. Couldn't find these mapping relations" in out
def test_stream_canceled_run(self, pf: PFClient, capfd: pytest.CaptureFixture) -> None:
run = create_run_against_multi_line_data_without_llm(pf)
pf.runs.update(name=run.name, status=RunStatus.CANCELED)
# (default) raise_on_error=True
with pytest.raises(InvalidRunStatusError):
pf.stream(run.name)
# raise_on_error=False
pf.stream(run.name, raise_on_error=False)
out, _ = capfd.readouterr()
assert "Run is canceled." in out
def test_specify_run_output_path(self, pf: PFClient, mocker: MockerFixture) -> None:
# mock to imitate user specify config run.output_path
specified_run_output_path = (Path.home() / PROMPT_FLOW_DIR_NAME / ".mock").resolve().as_posix()
with mocker.patch(
"promptflow._sdk._configuration.Configuration.get_run_output_path",
return_value=specified_run_output_path,
):
run = create_run_against_multi_line_data_without_llm(pf)
local_storage = LocalStorageOperations(run=run)
expected_output_path_prefix = (Path(specified_run_output_path) / run.name).resolve().as_posix()
assert local_storage.outputs_folder.as_posix().startswith(expected_output_path_prefix)
def test_override_run_output_path_in_pf_client(self) -> None:
specified_run_output_path = (Path.home() / PROMPT_FLOW_DIR_NAME / ".another_mock").resolve().as_posix()
pf = PFClient(config={"run.output_path": specified_run_output_path})
run = create_run_against_multi_line_data_without_llm(pf)
local_storage = LocalStorageOperations(run=run)
expected_output_path_prefix = (Path(specified_run_output_path) / run.name).resolve().as_posix()
assert local_storage.outputs_folder.as_posix().startswith(expected_output_path_prefix)
def test_specify_run_output_path_with_macro(self, pf: PFClient, mocker: MockerFixture) -> None:
# mock to imitate user specify invalid config run.output_path
with mocker.patch(
"promptflow._sdk._configuration.Configuration.get_run_output_path",
return_value=f"{FLOW_DIRECTORY_MACRO_IN_CONFIG}/.promptflow",
):
for _ in range(3):
run = create_run_against_multi_line_data_without_llm(pf)
local_storage = LocalStorageOperations(run=run)
expected_path_prefix = Path(FLOWS_DIR) / "print_env_var" / ".promptflow" / run.name
expected_path_prefix = expected_path_prefix.resolve().as_posix()
assert local_storage.outputs_folder.as_posix().startswith(expected_path_prefix)
def test_specify_run_output_path_with_invalid_macro(self, pf: PFClient, mocker: MockerFixture) -> None:
# mock to imitate user specify invalid config run.output_path
with mocker.patch(
"promptflow._sdk._configuration.Configuration.get_run_output_path",
# this case will happen when user manually modifies ~/.promptflow/pf.yaml
return_value=f"{FLOW_DIRECTORY_MACRO_IN_CONFIG}",
):
run = create_run_against_multi_line_data_without_llm(pf)
# as the specified run output path is invalid
# the actual run output path will be the default value
local_storage = LocalStorageOperations(run=run)
expected_output_path_prefix = (Path.home() / PROMPT_FLOW_DIR_NAME / ".runs" / run.name).resolve().as_posix()
assert local_storage.outputs_folder.as_posix().startswith(expected_output_path_prefix)
def test_failed_run_to_dict_exclude(self, pf):
failed_run = pf.run(
flow=f"{FLOWS_DIR}/failed_flow",
data=f"{DATAS_DIR}/webClassification1.jsonl",
column_mapping={"text": "${data.url}"},
)
default = failed_run._to_dict()
# CLI will exclude additional info and debug info
exclude = failed_run._to_dict(exclude_additional_info=True, exclude_debug_info=True)
assert "additionalInfo" in default["error"] and "additionalInfo" not in exclude["error"]
assert "debugInfo" in default["error"] and "debugInfo" not in exclude["error"]
def test_create_run_with_existing_run_folder(self, pf):
# TODO: Should use fixture to create an run and download it to be used here.
run_name = "web_classification_variant_0_20231205_120253_104100"
# clean the run if exists
from promptflow._cli._utils import _try_delete_existing_run_record
_try_delete_existing_run_record(run_name)
# assert the run doesn't exist
with pytest.raises(RunNotFoundError):
pf.runs.get(run_name)
# create the run with run folder
run_folder = f"{RUNS_DIR}/{run_name}"
run = Run._load_from_source(source=run_folder)
pf.runs.create_or_update(run)
# test with other local run operations
run = pf.runs.get(run_name)
assert run.name == run_name
details = pf.get_details(run_name)
assert details.shape == (3, 5)
metrics = pf.runs.get_metrics(run_name)
assert metrics == {}
pf.stream(run_name)
pf.visualize([run_name])
def test_aggregation_node_failed(self, pf):
failed_run = pf.run(
flow=f"{FLOWS_DIR}/aggregation_node_failed",
data=f"{FLOWS_DIR}/aggregation_node_failed/data.jsonl",
)
# even if all lines failed, the bulk run's status is completed.
assert failed_run.status == "Completed"
# error messages will store in local
local_storage = LocalStorageOperations(failed_run)
assert os.path.exists(local_storage._exception_path)
exception = local_storage.load_exception()
assert "First error message is" in exception["message"]
# line run failures will be stored in additionalInfo
assert len(exception["additionalInfo"][0]["info"]["errors"]) == 1
# show run will get error message
run = pf.runs.get(name=failed_run.name)
run_dict = run._to_dict()
assert "error" in run_dict
assert run_dict["error"] == exception
def test_get_details_against_partial_completed_run(self, pf: PFClient, monkeypatch) -> None:
# TODO: remove this patch after executor switch to default spawn
monkeypatch.setenv("PF_BATCH_METHOD", "spawn")
flow_mod2 = f"{FLOWS_DIR}/mod-n/two"
flow_mod3 = f"{FLOWS_DIR}/mod-n/three"
data_path = f"{DATAS_DIR}/numbers.jsonl"
# batch run against data
run1 = pf.run(
flow=flow_mod2,
data=data_path,
column_mapping={"number": "${data.value}"},
)
pf.runs.stream(run1)
details1 = pf.get_details(run1)
assert len(details1) == 20
assert len(details1.loc[details1["outputs.output"] != "(Failed)"]) == 10
# assert to ensure inputs and outputs are aligned
for _, row in details1.iterrows():
if str(row["outputs.output"]) != "(Failed)":
assert int(row["inputs.number"]) == int(row["outputs.output"])
# batch run against previous run
run2 = pf.run(
flow=flow_mod3,
run=run1,
column_mapping={"number": "${run.outputs.output}"},
)
pf.runs.stream(run2)
details2 = pf.get_details(run2)
assert len(details2) == 10
assert len(details2.loc[details2["outputs.output"] != "(Failed)"]) == 4
# assert to ensure inputs and outputs are aligned
for _, row in details2.iterrows():
if str(row["outputs.output"]) != "(Failed)":
assert int(row["inputs.number"]) == int(row["outputs.output"])
monkeypatch.delenv("PF_BATCH_METHOD")
def test_flow_with_nan_inf(self, pf: PFClient, monkeypatch) -> None:
# TODO: remove this patch after executor switch to default spawn
monkeypatch.setenv("PF_BATCH_METHOD", "spawn")
run = pf.run(
flow=f"{FLOWS_DIR}/flow-with-nan-inf",
data=f"{DATAS_DIR}/numbers.jsonl",
column_mapping={"number": "${data.value}"},
)
pf.stream(run)
local_storage = LocalStorageOperations(run=run)
# default behavior: no special logic for nan and inf
detail = local_storage.load_detail()
first_line_run_output = detail["flow_runs"][0]["output"]["output"]
assert isinstance(first_line_run_output["nan"], float)
assert np.isnan(first_line_run_output["nan"])
assert isinstance(first_line_run_output["inf"], float)
assert np.isinf(first_line_run_output["inf"])
# handles nan and inf, which is real scenario during visualize
detail = local_storage.load_detail(parse_const_as_str=True)
first_line_run_output = detail["flow_runs"][0]["output"]["output"]
assert isinstance(first_line_run_output["nan"], str)
assert first_line_run_output["nan"] == "NaN"
assert isinstance(first_line_run_output["inf"], str)
assert first_line_run_output["inf"] == "Infinity"
monkeypatch.delenv("PF_BATCH_METHOD")
@pytest.mark.skip("Enable this when executor change merges")
def test_eager_flow_run_without_yaml(self, pf):
# TODO(2898455): support this
flow_path = Path(f"{EAGER_FLOWS_DIR}/simple_without_yaml/entry.py")
run = pf.run(
flow=flow_path,
entry="my_flow",
data=f"{DATAS_DIR}/simple_eager_flow_data.jsonl",
)
assert run.status == "Completed"
def test_eager_flow_run_with_yaml(self, pf):
flow_path = Path(f"{EAGER_FLOWS_DIR}/simple_with_yaml")
run = pf.run(
flow=flow_path,
data=f"{DATAS_DIR}/simple_eager_flow_data.jsonl",
)
assert run.status == "Completed"
def test_eager_flow_test_invalid_cases(self, pf):
# no entry provided
flow_path = Path(f"{EAGER_FLOWS_DIR}/simple_without_yaml/entry.py")
with pytest.raises(UserErrorException) as e:
pf.run(
flow=flow_path,
data=f"{DATAS_DIR}/simple_eager_flow_data.jsonl",
)
assert "Entry function is not specified" in str(e.value)
# no path provided
flow_path = Path(f"{EAGER_FLOWS_DIR}/invalid_no_path/")
with pytest.raises(ValidationError) as e:
pf.run(
flow=flow_path,
data=f"{DATAS_DIR}/simple_eager_flow_data.jsonl",
)
assert "'path': ['Missing data for required field.']" in str(e.value)
def test_get_incomplete_run(self, local_client, pf) -> None:
with tempfile.TemporaryDirectory() as temp_dir:
shutil.copytree(f"{FLOWS_DIR}/print_env_var", f"{temp_dir}/print_env_var")
run = pf.run(
flow=f"{temp_dir}/print_env_var",
data=f"{DATAS_DIR}/env_var_names.jsonl",
)
# remove run dag
shutil.rmtree(f"{temp_dir}/print_env_var")
# can still get run operations
LocalStorageOperations(run=run)
# can to_dict
run._to_dict()
| promptflow/src/promptflow/tests/sdk_cli_test/e2etests/test_flow_run.py/0 | {
"file_path": "promptflow/src/promptflow/tests/sdk_cli_test/e2etests/test_flow_run.py",
"repo_id": "promptflow",
"token_count": 25678
} | 50 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
from pathlib import Path
import pytest
from promptflow._sdk._serving._errors import UnexpectedConnectionProviderReturn, UnsupportedConnectionProvider
from promptflow._sdk._serving.flow_invoker import FlowInvoker
from promptflow.exceptions import UserErrorException
PROMOTFLOW_ROOT = Path(__file__).parent.parent.parent.parent
FLOWS_DIR = Path(PROMOTFLOW_ROOT / "tests/test_configs/flows")
EXAMPLE_FLOW = FLOWS_DIR / "web_classification"
@pytest.mark.sdk_test
@pytest.mark.unittest
class TestFlowInvoker:
# Note: e2e test of flow invoker has been covered by test_flow_serve.
def test_flow_invoker_unsupported_connection_provider(self):
with pytest.raises(UnsupportedConnectionProvider):
FlowInvoker(flow=EXAMPLE_FLOW, connection_provider=[])
with pytest.raises(UserErrorException):
FlowInvoker(flow=EXAMPLE_FLOW, connection_provider="unsupported")
def test_flow_invoker_custom_connection_provider(self):
# Return is not a list
with pytest.raises(UnexpectedConnectionProviderReturn) as e:
FlowInvoker(flow=EXAMPLE_FLOW, connection_provider=lambda: {})
assert "should return a list of connections" in str(e.value)
# Return is not connection type
with pytest.raises(UnexpectedConnectionProviderReturn) as e:
FlowInvoker(flow=EXAMPLE_FLOW, connection_provider=lambda: [1, 2])
assert "should be connection type" in str(e.value)
| promptflow/src/promptflow/tests/sdk_cli_test/unittests/test_flow_invoker.py/0 | {
"file_path": "promptflow/src/promptflow/tests/sdk_cli_test/unittests/test_flow_invoker.py",
"repo_id": "promptflow",
"token_count": 550
} | 51 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import json
import uuid
from dataclasses import fields
from pathlib import Path
import pytest
from promptflow import PFClient
from promptflow._sdk.entities import Run
from promptflow._sdk.operations._local_storage_operations import LocalStorageOperations
from promptflow.contracts._run_management import RunMetadata
from ..utils import PFSOperations, check_activity_end_telemetry
FLOW_PATH = "./tests/test_configs/flows/print_env_var"
DATA_PATH = "./tests/test_configs/datas/env_var_names.jsonl"
def create_run_against_multi_line_data(client: PFClient) -> Run:
return client.run(flow=FLOW_PATH, data=DATA_PATH)
@pytest.mark.usefixtures("use_secrets_config_file")
@pytest.mark.e2etest
class TestRunAPIs:
@pytest.fixture(autouse=True)
def _submit_run(self, pf_client):
self.run = create_run_against_multi_line_data(pf_client)
def test_list_runs(self, pfs_op: PFSOperations) -> None:
with check_activity_end_telemetry(activity_name="pf.runs.list"):
response = pfs_op.list_runs(status_code=200).json
assert len(response) >= 1
@pytest.mark.skip(reason="Task 2917711: cli command will give strange stdout in ci; re-enable after switch to sdk")
def test_submit_run(self, pfs_op: PFSOperations) -> None:
# run submit is done via cli, so no telemetry will be detected here
with check_activity_end_telemetry(expected_activities=[]):
response = pfs_op.submit_run(
{
"flow": Path(FLOW_PATH).absolute().as_posix(),
"data": Path(DATA_PATH).absolute().as_posix(),
},
status_code=200,
)
with check_activity_end_telemetry(activity_name="pf.runs.get"):
run_from_pfs = pfs_op.get_run(name=response.json["name"]).json
assert run_from_pfs
def update_run(self, pfs_op: PFSOperations) -> None:
display_name = "new_display_name"
tags = {"key": "value"}
with check_activity_end_telemetry(activity_name="pf.runs.update"):
run_from_pfs = pfs_op.update_run(
name=self.run.name, display_name=display_name, tags=json.dumps(tags), status_code=200
).json
assert run_from_pfs["display_name"] == display_name
assert run_from_pfs["tags"] == tags
def test_archive_restore_run(self, pf_client: PFClient, pfs_op: PFSOperations) -> None:
run = create_run_against_multi_line_data(pf_client)
with check_activity_end_telemetry(
expected_activities=[
{"activity_name": "pf.runs.get", "first_call": False},
{"activity_name": "pf.runs.archive"},
]
):
pfs_op.archive_run(name=run.name, status_code=200)
runs = pfs_op.list_runs().json
assert not any([item["name"] == run.name for item in runs])
with check_activity_end_telemetry(
expected_activities=[
{"activity_name": "pf.runs.get", "first_call": False},
{"activity_name": "pf.runs.restore"},
]
):
pfs_op.restore_run(name=run.name, status_code=200)
runs = pfs_op.list_runs().json
assert any([item["name"] == run.name for item in runs])
def test_delete_run(self, pf_client: PFClient, pfs_op: PFSOperations) -> None:
run = create_run_against_multi_line_data(pf_client)
local_storage = LocalStorageOperations(run)
path = local_storage.path
assert path.exists()
with check_activity_end_telemetry(
expected_activities=[
{"activity_name": "pf.runs.get", "first_call": False},
{"activity_name": "pf.runs.delete"},
]
):
pfs_op.delete_run(name=run.name, status_code=204)
runs = pfs_op.list_runs().json
assert not any([item["name"] == run.name for item in runs])
assert not path.exists()
def test_visualize_run(self, pfs_op: PFSOperations) -> None:
with check_activity_end_telemetry(
expected_activities=[
{"activity_name": "pf.runs.get", "first_call": False},
{"activity_name": "pf.runs.get", "first_call": False},
{"activity_name": "pf.runs.get_metrics", "first_call": False},
{"activity_name": "pf.runs.visualize"},
]
):
response = pfs_op.get_run_visualize(name=self.run.name, status_code=200)
assert response.data
def test_get_not_exist_run(self, pfs_op: PFSOperations) -> None:
random_name = str(uuid.uuid4())
with check_activity_end_telemetry(activity_name="pf.runs.get", completion_status="Failure"):
response = pfs_op.get_run(name=random_name)
assert response.status_code == 404
def test_get_run(self, pfs_op: PFSOperations) -> None:
with check_activity_end_telemetry(activity_name="pf.runs.get"):
run_from_pfs = pfs_op.get_run(name=self.run.name, status_code=200).json
assert run_from_pfs["name"] == self.run.name
def test_get_child_runs(self, pfs_op: PFSOperations) -> None:
with check_activity_end_telemetry(activity_name="pf.runs.get"):
run_from_pfs = pfs_op.get_child_runs(name=self.run.name, status_code=200).json
assert len(run_from_pfs) == 1
assert run_from_pfs[0]["parent_run_id"] == self.run.name
def test_get_node_runs(self, pfs_op: PFSOperations) -> None:
with check_activity_end_telemetry(activity_name="pf.runs.get"):
run_from_pfs = pfs_op.get_node_runs(name=self.run.name, node_name="print_env", status_code=200).json
assert len(run_from_pfs) == 1
assert run_from_pfs[0]["node"] == "print_env"
def test_get_run_log(self, pfs_op: PFSOperations, pf_client: PFClient) -> None:
with check_activity_end_telemetry(activity_name="pf.runs.get"):
log = pfs_op.get_run_log(name=self.run.name, status_code=200)
assert not log.data.decode("utf-8").startswith('"')
def test_get_run_metrics(self, pfs_op: PFSOperations) -> None:
with check_activity_end_telemetry(activity_name="pf.runs.get"):
metrics = pfs_op.get_run_metrics(name=self.run.name, status_code=200).json
assert metrics is not None
def test_get_run_metadata(self, pfs_op: PFSOperations) -> None:
with check_activity_end_telemetry(activity_name="pf.runs.get"):
metadata = pfs_op.get_run_metadata(name=self.run.name, status_code=200).json
for field in fields(RunMetadata):
assert field.name in metadata
assert metadata["name"] == self.run.name
| promptflow/src/promptflow/tests/sdk_pfs_test/e2etests/test_run_apis.py/0 | {
"file_path": "promptflow/src/promptflow/tests/sdk_pfs_test/e2etests/test_run_apis.py",
"repo_id": "promptflow",
"token_count": 3037
} | 52 |
$schema: https://azuremlschemas.azureedge.net/promptflow/latest/QdrantConnection.schema.json
name: my_qdrant_connection
type: qdrant
api_key: "<to-be-replaced>"
api_base: "endpoint"
| promptflow/src/promptflow/tests/test_configs/connections/qdrant_connection.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/connections/qdrant_connection.yaml",
"repo_id": "promptflow",
"token_count": 73
} | 53 |
{"text": "text"}
{"text": "text"} | promptflow/src/promptflow/tests/test_configs/eager_flows/dummy_flow_with_exception/inputs.jsonl/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/eager_flows/dummy_flow_with_exception/inputs.jsonl",
"repo_id": "promptflow",
"token_count": 13
} | 54 |
from promptflow import tool
@tool
def pass_through(input1: str) -> str:
return 'hello ' + input1
| promptflow/src/promptflow/tests/test_configs/flows/activate_condition_always_met/pass_through.py/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/activate_condition_always_met/pass_through.py",
"repo_id": "promptflow",
"token_count": 33
} | 55 |
inputs:
text:
type: string
default: hi
outputs:
output:
type: string
reference: ${nodeB.output}
nodes:
- name: nodeA
type: python
source:
type: code
path: pass_through.py
inputs:
input1: ${inputs.text}
activate:
when: ${inputs.text}
is: world
- name: nodeB
type: python
source:
type: code
path: pass_through.py
inputs:
input1: ${nodeA.output}
activate:
when: ${inputs.text}
is: hi
| promptflow/src/promptflow/tests/test_configs/flows/all_depedencies_bypassed_with_activate_met/flow.dag.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/all_depedencies_bypassed_with_activate_met/flow.dag.yaml",
"repo_id": "promptflow",
"token_count": 199
} | 56 |
from promptflow import tool
async def raise_exception_async(s):
msg = f"In raise_exception_async: {s}"
raise Exception(msg)
@tool
async def raise_an_exception_async(s: str):
try:
await raise_exception_async(s)
except Exception as e:
raise Exception(f"In tool raise_an_exception_async: {s}") from e
| promptflow/src/promptflow/tests/test_configs/flows/async_tools_failures/async_fail.py/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/async_tools_failures/async_fail.py",
"repo_id": "promptflow",
"token_count": 137
} | 57 |
from promptflow import tool
@tool
def icm_retriever(content: str) -> str:
return "ICM: " + content | promptflow/src/promptflow/tests/test_configs/flows/conditional_flow_with_activate/icm_retriever.py/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/conditional_flow_with_activate/icm_retriever.py",
"repo_id": "promptflow",
"token_count": 35
} | 58 |
[
{
"case": "double",
"value": 1
},
{
"case": "double",
"value": 2
},
{
"case": "square",
"value": 3
},
{
"case": "square",
"value": 4
}
] | promptflow/src/promptflow/tests/test_configs/flows/conditional_flow_with_aggregate_bypassed/inputs.json/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/conditional_flow_with_aggregate_bypassed/inputs.json",
"repo_id": "promptflow",
"token_count": 147
} | 59 |
$schema: https://azuremlschemas.azureedge.net/promptflow/latest/CustomConnection.schema.json
type: custom
name: custom_connection
configs:
CHAT_DEPLOYMENT_NAME: gpt-35-turbo
AZURE_OPENAI_API_BASE: https://gpt-test-eus.openai.azure.com/
secrets:
AZURE_OPENAI_API_KEY: ${env:CUSTOM_CONNECTION_AZURE_OPENAI_API_KEY}
module: promptflow.connections
| promptflow/src/promptflow/tests/test_configs/flows/export/linux/connections/custom_connection.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/export/linux/connections/custom_connection.yaml",
"repo_id": "promptflow",
"token_count": 144
} | 60 |
from promptflow import tool
@tool
def character_generator(text: str):
"""Generate characters from a string."""
for char in text:
yield char | promptflow/src/promptflow/tests/test_configs/flows/generator_tools/char_generator.py/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/generator_tools/char_generator.py",
"repo_id": "promptflow",
"token_count": 57
} | 61 |
{"question": "What is the capital of the United States of America?", "chat_history": [], "stream": true}
{"question": "What is the capital of the United States of America?", "chat_history": [], "stream": false}
| promptflow/src/promptflow/tests/test_configs/flows/openai_chat_api_flow/inputs.jsonl/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/openai_chat_api_flow/inputs.jsonl",
"repo_id": "promptflow",
"token_count": 56
} | 62 |
inputs:
key:
type: string
default: text
outputs:
output:
type: string
reference: ${print_secret.output}
nodes:
- name: print_secret
type: python
source:
type: code
path: print_secret.py
inputs:
connection: custom_connection
text: ${inputs.key}
| promptflow/src/promptflow/tests/test_configs/flows/print_secret_flow/flow.dag.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/print_secret_flow/flow.dag.yaml",
"repo_id": "promptflow",
"token_count": 113
} | 63 |
[
{"idx": 1, "mod": 3, "mod_2": 5},
{"idx": 2, "mod": 3, "mod_2": 5},
{"idx": 3, "mod": 3, "mod_2": 5},
{"idx": 4, "mod": 3, "mod_2": 5},
{"idx": 5, "mod": 3, "mod_2": 5},
{"idx": 6, "mod": 3, "mod_2": 5},
{"idx": 7, "mod": 3, "mod_2": 5},
{"idx": 8, "mod": 3, "mod_2": 5},
{"idx": 9, "mod": 3, "mod_2": 5},
{"idx": 10, "mod": 3, "mod_2": 5}
] | promptflow/src/promptflow/tests/test_configs/flows/python_tool_partial_failure/samples.json/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/python_tool_partial_failure/samples.json",
"repo_id": "promptflow",
"token_count": 223
} | 64 |
[
{
"question": "How about London next week?"
}
] | promptflow/src/promptflow/tests/test_configs/flows/sample_flow_with_functions/samples.json/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/sample_flow_with_functions/samples.json",
"repo_id": "promptflow",
"token_count": 31
} | 65 |
{
"name": "script_with_special_character",
"type": "python",
"inputs": {
"input1": {
"type": [
"string"
]
}
},
"source": "script_with_special_character.py",
"function": "print_special_character"
} | promptflow/src/promptflow/tests/test_configs/flows/script_with_special_character/script_with_special_character.meta.json/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/script_with_special_character/script_with_special_character.meta.json",
"repo_id": "promptflow",
"token_count": 105
} | 66 |
from promptflow import tool
import time
@tool
def python_node(input: str, index: int) -> str:
time.sleep(index + 5)
return input
| promptflow/src/promptflow/tests/test_configs/flows/simple_flow_with_ten_inputs/python_node.py/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/flows/simple_flow_with_ten_inputs/python_node.py",
"repo_id": "promptflow",
"token_count": 48
} | 67 |
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-10-10.0.22631-SP0)
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000
response:
body:
string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000",
"name": "00000", "type": "Microsoft.MachineLearningServices/workspaces", "location":
"eastus", "tags": {}, "etag": null, "kind": "Default", "sku": {"name": "Basic",
"tier": "Basic"}, "properties": {"discoveryUrl": "https://eastus.api.azureml.ms/discovery"}}'
headers:
cache-control:
- no-cache
content-length:
- '3630'
content-type:
- application/json; charset=utf-8
expires:
- '-1'
pragma:
- no-cache
strict-transport-security:
- max-age=31536000; includeSubDomains
transfer-encoding:
- chunked
vary:
- Accept-Encoding,Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '0.027'
status:
code: 200
message: OK
- 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-10-10.0.22631-SP0)
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores?count=30&isDefault=true&orderByAsc=false
response:
body:
string: '{"value": [{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore",
"name": "workspaceblobstore", "type": "Microsoft.MachineLearningServices/workspaces/datastores",
"properties": {"description": null, "tags": null, "properties": null, "isDefault":
true, "credentials": {"credentialsType": "AccountKey"}, "intellectualProperty":
null, "subscriptionId": "00000000-0000-0000-0000-000000000000", "resourceGroup":
"00000", "datastoreType": "AzureBlob", "accountName": "fake_account_name",
"containerName": "fake-container-name", "endpoint": "core.windows.net", "protocol":
"https", "serviceDataAccessAuthIdentity": "WorkspaceSystemAssignedIdentity"},
"systemData": {"createdAt": "2023-04-08T02:53:06.5886442+00:00", "createdBy":
"779301c0-18b2-4cdc-801b-a0a3368fee0a", "createdByType": "Application", "lastModifiedAt":
"2023-04-08T02:53:07.521127+00:00", "lastModifiedBy": "779301c0-18b2-4cdc-801b-a0a3368fee0a",
"lastModifiedByType": "Application"}}]}'
headers:
cache-control:
- no-cache
content-length:
- '1372'
content-type:
- application/json; charset=utf-8
expires:
- '-1'
pragma:
- no-cache
strict-transport-security:
- max-age=31536000; includeSubDomains
transfer-encoding:
- chunked
vary:
- Accept-Encoding,Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '0.085'
status:
code: 200
message: OK
- 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-10-10.0.22631-SP0)
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore
response:
body:
string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore",
"name": "workspaceblobstore", "type": "Microsoft.MachineLearningServices/workspaces/datastores",
"properties": {"description": null, "tags": null, "properties": null, "isDefault":
true, "credentials": {"credentialsType": "AccountKey"}, "intellectualProperty":
null, "subscriptionId": "00000000-0000-0000-0000-000000000000", "resourceGroup":
"00000", "datastoreType": "AzureBlob", "accountName": "fake_account_name",
"containerName": "fake-container-name", "endpoint": "core.windows.net", "protocol":
"https", "serviceDataAccessAuthIdentity": "WorkspaceSystemAssignedIdentity"},
"systemData": {"createdAt": "2023-04-08T02:53:06.5886442+00:00", "createdBy":
"779301c0-18b2-4cdc-801b-a0a3368fee0a", "createdByType": "Application", "lastModifiedAt":
"2023-04-08T02:53:07.521127+00:00", "lastModifiedBy": "779301c0-18b2-4cdc-801b-a0a3368fee0a",
"lastModifiedByType": "Application"}}'
headers:
cache-control:
- no-cache
content-length:
- '1227'
content-type:
- application/json; charset=utf-8
expires:
- '-1'
pragma:
- no-cache
strict-transport-security:
- max-age=31536000; includeSubDomains
transfer-encoding:
- chunked
vary:
- Accept-Encoding,Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '0.097'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
Content-Length:
- '0'
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-10-10.0.22631-SP0)
method: POST
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore/listSecrets
response:
body:
string: '{"secretsType": "AccountKey", "key": "dGhpcyBpcyBmYWtlIGtleQ=="}'
headers:
cache-control:
- no-cache
content-length:
- '134'
content-type:
- application/json; charset=utf-8
expires:
- '-1'
pragma:
- no-cache
strict-transport-security:
- max-age=31536000; includeSubDomains
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '0.087'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/xml
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- azsdk-python-storage-blob/12.19.0 Python/3.10.13 (Windows-10-10.0.22631-SP0)
x-ms-date:
- Fri, 12 Jan 2024 08:18:40 GMT
x-ms-version:
- '2023-11-03'
method: HEAD
uri: https://fake_account_name.blob.core.windows.net/fake-container-name/LocalUpload/000000000000000000000000000000000000/webClassification3.jsonl
response:
body:
string: ''
headers:
accept-ranges:
- bytes
content-length:
- '379'
content-md5:
- lI/pz9jzTQ7Td3RHPL7y7w==
content-type:
- application/octet-stream
last-modified:
- Mon, 06 Nov 2023 08:30:18 GMT
server:
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
vary:
- Origin
x-ms-blob-type:
- BlockBlob
x-ms-creation-time:
- Mon, 06 Nov 2023 08:30:18 GMT
x-ms-meta-name:
- 94331215-cf7f-452a-9f1a-1d276bc9b0e4
x-ms-meta-upload_status:
- completed
x-ms-meta-version:
- 3f163752-edb0-4afc-a6f5-b0a670bd7c24
x-ms-version:
- '2023-11-03'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/xml
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- azsdk-python-storage-blob/12.19.0 Python/3.10.13 (Windows-10-10.0.22631-SP0)
x-ms-date:
- Fri, 12 Jan 2024 08:18:41 GMT
x-ms-version:
- '2023-11-03'
method: HEAD
uri: https://fake_account_name.blob.core.windows.net/fake-container-name/az-ml-artifacts/000000000000000000000000000000000000/webClassification3.jsonl
response:
body:
string: ''
headers:
server:
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
transfer-encoding:
- chunked
vary:
- Origin
x-ms-error-code:
- BlobNotFound
x-ms-version:
- '2023-11-03'
status:
code: 404
message: The specified blob does not exist.
- 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-10-10.0.22631-SP0)
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore
response:
body:
string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore",
"name": "workspaceblobstore", "type": "Microsoft.MachineLearningServices/workspaces/datastores",
"properties": {"description": null, "tags": null, "properties": null, "isDefault":
true, "credentials": {"credentialsType": "AccountKey"}, "intellectualProperty":
null, "subscriptionId": "00000000-0000-0000-0000-000000000000", "resourceGroup":
"00000", "datastoreType": "AzureBlob", "accountName": "fake_account_name",
"containerName": "fake-container-name", "endpoint": "core.windows.net", "protocol":
"https", "serviceDataAccessAuthIdentity": "WorkspaceSystemAssignedIdentity"},
"systemData": {"createdAt": "2023-04-08T02:53:06.5886442+00:00", "createdBy":
"779301c0-18b2-4cdc-801b-a0a3368fee0a", "createdByType": "Application", "lastModifiedAt":
"2023-04-08T02:53:07.521127+00:00", "lastModifiedBy": "779301c0-18b2-4cdc-801b-a0a3368fee0a",
"lastModifiedByType": "Application"}}'
headers:
cache-control:
- no-cache
content-length:
- '1227'
content-type:
- application/json; charset=utf-8
expires:
- '-1'
pragma:
- no-cache
strict-transport-security:
- max-age=31536000; includeSubDomains
transfer-encoding:
- chunked
vary:
- Accept-Encoding,Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '0.103'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
Content-Length:
- '0'
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-10-10.0.22631-SP0)
method: POST
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore/listSecrets
response:
body:
string: '{"secretsType": "AccountKey", "key": "dGhpcyBpcyBmYWtlIGtleQ=="}'
headers:
cache-control:
- no-cache
content-length:
- '134'
content-type:
- application/json; charset=utf-8
expires:
- '-1'
pragma:
- no-cache
strict-transport-security:
- max-age=31536000; includeSubDomains
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '0.110'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/xml
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- azsdk-python-storage-blob/12.19.0 Python/3.10.13 (Windows-10-10.0.22631-SP0)
x-ms-date:
- Fri, 12 Jan 2024 08:18:44 GMT
x-ms-version:
- '2023-11-03'
method: HEAD
uri: https://fake_account_name.blob.core.windows.net/fake-container-name/LocalUpload/000000000000000000000000000000000000/web_classification/classify_with_llm.jinja2
response:
body:
string: ''
headers:
accept-ranges:
- bytes
content-length:
- '853'
content-md5:
- ylTeNqjvuOvtzEZJ/X5n3A==
content-type:
- application/octet-stream
last-modified:
- Fri, 12 Jan 2024 08:13:57 GMT
server:
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
vary:
- Origin
x-ms-blob-type:
- BlockBlob
x-ms-creation-time:
- Fri, 12 Jan 2024 08:13:56 GMT
x-ms-meta-name:
- 950201e8-c52c-4b15-ada1-5e58de9b2f4d
x-ms-meta-upload_status:
- completed
x-ms-meta-version:
- '1'
x-ms-version:
- '2023-11-03'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/xml
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- azsdk-python-storage-blob/12.19.0 Python/3.10.13 (Windows-10-10.0.22631-SP0)
x-ms-date:
- Fri, 12 Jan 2024 08:18:45 GMT
x-ms-version:
- '2023-11-03'
method: HEAD
uri: https://fake_account_name.blob.core.windows.net/fake-container-name/az-ml-artifacts/000000000000000000000000000000000000/web_classification/classify_with_llm.jinja2
response:
body:
string: ''
headers:
server:
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
transfer-encoding:
- chunked
vary:
- Origin
x-ms-error-code:
- BlobNotFound
x-ms-version:
- '2023-11-03'
status:
code: 404
message: The specified blob does not exist.
- request:
body: '{"flowDefinitionDataStoreName": "workspaceblobstore", "flowDefinitionBlobPath":
"LocalUpload/000000000000000000000000000000000000/web_classification/flow.dag.yaml",
"runId": "batch_run_name", "runDisplayName": "batch_run_name", "runExperimentName":
"", "nodeVariant": "${summarize_text_content.variant_0}", "batchDataInput":
{"dataUri": "azureml://datastores/workspaceblobstore/paths/LocalUpload/000000000000000000000000000000000000/webClassification3.jsonl"},
"inputsMapping": {"url": "${data.url}"}, "connections": {}, "environmentVariables":
{}, "runtimeName": "fake-runtime-name", "sessionId": "000000000000000000000000000000000000000000000000",
"sessionSetupMode": "SystemWait", "flowLineageId": "0000000000000000000000000000000000000000000000000000000000000000",
"runDisplayNameGenerationType": "UserProvidedMacro"}'
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
Content-Length:
- '873'
Content-Type:
- application/json
User-Agent:
- promptflow-sdk/0.0.1 azsdk-python-azuremachinelearningdesignerserviceclient/unknown
Python/3.10.13 (Windows-10-10.0.22631-SP0)
method: POST
uri: https://eastus.api.azureml.ms/flow/api/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/BulkRuns/submit
response:
body:
string: '"batch_run_name"'
headers:
connection:
- keep-alive
content-length:
- '38'
content-type:
- application/json; charset=utf-8
strict-transport-security:
- max-age=15724800; includeSubDomains; preload
x-content-type-options:
- nosniff
x-request-time:
- '6.550'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- promptflow-sdk/0.0.1 azsdk-python-azuremachinelearningdesignerserviceclient/unknown
Python/3.10.13 (Windows-10-10.0.22631-SP0)
method: GET
uri: https://eastus.api.azureml.ms/flow/api/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/BulkRuns/batch_run_name
response:
body:
string: '{"flowGraph": {"nodes": [{"name": "fetch_text_content_from_url", "type":
"python", "source": {"type": "code", "path": "fetch_text_content_from_url.py"},
"inputs": {"fetch_url": "${inputs.url}"}, "tool": "fetch_text_content_from_url.py",
"reduce": false}, {"name": "prepare_examples", "type": "python", "source":
{"type": "code", "path": "prepare_examples.py"}, "inputs": {}, "tool": "prepare_examples.py",
"reduce": false}, {"name": "classify_with_llm", "type": "llm", "source": {"type":
"code", "path": "classify_with_llm.jinja2"}, "inputs": {"deployment_name":
"gpt-35-turbo", "suffix": "", "max_tokens": "128", "temperature": "0.1", "top_p":
"1.0", "logprobs": "", "echo": "False", "stop": "", "presence_penalty": "0",
"frequency_penalty": "0", "best_of": "1", "logit_bias": "", "url": "${inputs.url}",
"examples": "${prepare_examples.output}", "text_content": "${summarize_text_content.output}"},
"tool": "classify_with_llm.jinja2", "reduce": false, "api": "chat", "provider":
"AzureOpenAI", "connection": "azure_open_ai_connection", "module": "promptflow.tools.aoai"},
{"name": "convert_to_dict", "type": "python", "source": {"type": "code", "path":
"convert_to_dict.py"}, "inputs": {"input_str": "${classify_with_llm.output}"},
"tool": "convert_to_dict.py", "reduce": false}, {"name": "summarize_text_content",
"type": "llm", "source": {"type": "code", "path": "summarize_text_content.jinja2"},
"inputs": {"deployment_name": "gpt-35-turbo", "suffix": "", "max_tokens":
"128", "temperature": "0.2", "top_p": "1.0", "logprobs": "", "echo": "False",
"stop": "", "presence_penalty": "0", "frequency_penalty": "0", "best_of":
"1", "logit_bias": "", "text": "${fetch_text_content_from_url.output}"}, "tool":
"summarize_text_content.jinja2", "reduce": false, "api": "chat", "provider":
"AzureOpenAI", "connection": "azure_open_ai_connection", "module": "promptflow.tools.aoai"}],
"tools": [{"name": "Content Safety (Text Analyze)", "type": "python", "inputs":
{"connection": {"type": ["AzureContentSafetyConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "hate_category":
{"type": ["string"], "default": "medium_sensitivity", "enum": ["disable",
"low_sensitivity", "medium_sensitivity", "high_sensitivity"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "self_harm_category":
{"type": ["string"], "default": "medium_sensitivity", "enum": ["disable",
"low_sensitivity", "medium_sensitivity", "high_sensitivity"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "sexual_category":
{"type": ["string"], "default": "medium_sensitivity", "enum": ["disable",
"low_sensitivity", "medium_sensitivity", "high_sensitivity"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "text": {"type":
["string"], "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "violence_category": {"type": ["string"], "default": "medium_sensitivity",
"enum": ["disable", "low_sensitivity", "medium_sensitivity", "high_sensitivity"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"}},
"description": "Use Azure Content Safety to detect harmful content.", "module":
"promptflow.tools.azure_content_safety", "function": "analyze_text", "is_builtin":
true, "package": "promptflow-tools", "package_version": "0.0.216", "enable_kwargs":
false, "deprecated_tools": ["content_safety_text.tools.content_safety_text_tool.analyze_text"],
"tool_state": "stable"}, {"name": "Embedding", "type": "python", "inputs":
{"connection": {"type": ["AzureOpenAIConnection", "OpenAIConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "deployment_name":
{"type": ["string"], "enabled_by": "connection", "enabled_by_type": ["AzureOpenAIConnection"],
"model_list": ["text-embedding-ada-002", "text-search-ada-doc-001", "text-search-ada-query-001"],
"capabilities": {"completion": false, "chat_completion": false, "embeddings":
true}, "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "input": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "model": {"type": ["string"], "enum": ["text-embedding-ada-002",
"text-search-ada-doc-001", "text-search-ada-query-001"], "enabled_by": "connection",
"enabled_by_type": ["OpenAIConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use Open AI''s embedding
model to create an embedding vector representing the input text.", "module":
"promptflow.tools.embedding", "function": "embedding", "is_builtin": true,
"package": "promptflow-tools", "package_version": "0.0.216", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Open Source LLM", "type": "custom_llm",
"inputs": {"api": {"type": ["string"], "enum": ["chat", "completion"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "connection": {"type":
["CustomConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "deployment_name": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "endpoint_name":
{"type": ["string"], "default": "-- please enter an endpoint name --", "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "max_new_tokens":
{"type": ["int"], "default": 500, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "model_kwargs": {"type": ["object"], "default":
"{}", "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default", "advanced": true}, "temperature": {"type": ["double"], "default":
1.0, "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "top_p": {"type": ["double"], "default": 1.0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default", "advanced": true}},
"description": "Use an Open Source model from the Azure Model catalog, deployed
to an AzureML Online Endpoint for LLM Chat or Completion API calls.", "module":
"promptflow.tools.open_source_llm", "class_name": "OpenSourceLLM", "function":
"call", "icon": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACgElEQVR4nGWSz2vcVRTFP/e9NzOZ1KDGohASslLEH6VLV0ak4l/QpeDCrfQPcNGliODKnVm4EBdBsIjQIlhciKW0ycKFVCSNbYnjdDLtmPnmO/nO9917XcxMkjYX3uLx7nnn3HOuMK2Nix4fP78ZdrYXVkLVWjf3l3B1B+HpcjzGFtmqa6cePz7/x0dnn1n5qhj3iBJPYREIURAJuCtpY8PjReDbrf9WG7H1fuefwQU9qKztTcMJT+PNnEFvjGVDBDlSsH6p/9MLzy6+NxwVqI8RAg4IPmWedMckdLYP6O6UpIaQfvyyXG012+e79/ZfHukoS1ISMT2hGTB1RkUmNgQ5QZ0w+a2VWDq73MbdEWmfnnv6UWe7oNzPaLapl5CwuLTXK9WUGBuCjqekzhP+z52ZXOrKMD3OJg0Hh778aiOuvpnYvp05d6GJO4iAO4QAe/eV36/X5LFRV4Zmn+AdkqlL8Vjp3oVioOz+WTPzzYEgsN+fgPLYyJVheSbPPVl2ikeGZRjtG52/8rHuaV9VOlpP2OtKyVndcRVCSqOhsvxa4vW359i6OuKdD+aP8Q4SYPdOzS/flGjt1JUSaMqZ5nwa1Y8qWb/Ud/eZZkHisYezEM0m+fcelDr8F1SqW2LNK6r1jXQwyLzy1hxvrLXZulry7ocL+FS6G4QIu3fG/Px1gdYeW7LIgXU2P/115TOA5G7e3Rmj2aS/m7l5pThiZzrCcE/d1XHzbln373nw7y6veeoUm5KCNKT/IPPwbiY1hYd/l5MIT65BMFt87sU4v9D7/JMflr44uV6hGh1+L4RCkg6z5iK2tAhNLeLsNGwYA4fDYnC/drvuuFxe86NV/x+Ut27g0FvykgAAAABJRU5ErkJggg==",
"is_builtin": true, "package": "promptflow-tools", "package_version": "0.0.216",
"enable_kwargs": false, "tool_state": "stable"}, {"name": "OpenAI GPT-4V",
"type": "custom_llm", "inputs": {"connection": {"type": ["OpenAIConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"frequency_penalty": {"type": ["double"], "default": 0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "max_tokens": {"type":
["int"], "default": "", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "model": {"type": ["string"], "enum": ["gpt-4-vision-preview"],
"allow_manual_entry": true, "is_multi_select": false, "input_type": "default"},
"presence_penalty": {"type": ["double"], "default": 0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "stop": {"type":
["list"], "default": "", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "temperature": {"type": ["double"], "default": 1,
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"top_p": {"type": ["double"], "default": 1, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use OpenAI GPT-4V to leverage
vision ability.", "module": "promptflow.tools.openai_gpt4v", "class_name":
"OpenAI", "function": "chat", "is_builtin": true, "package": "promptflow-tools",
"package_version": "0.0.216", "default_prompt": "# system:\nAs an AI assistant,
your task involves interpreting images and responding to questions about the
image.\nRemember to provide accurate answers based on the information present
in the image.\n\n# user:\nCan you tell me what the image depicts?\n\n",
"enable_kwargs": false, "tool_state": "stable"}, {"name": "Serp API", "type":
"python", "inputs": {"connection": {"type": ["SerpConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "engine": {"type":
["string"], "default": "google", "enum": ["google", "bing"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "location": {"type":
["string"], "default": "", "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "num": {"type": ["int"], "default": "10",
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"query": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "safe": {"type": ["string"], "default": "off",
"enum": ["active", "off"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use Serp API to obtain search
results from a specific search engine.", "module": "promptflow.tools.serpapi",
"class_name": "SerpAPI", "function": "search", "is_builtin": true, "package":
"promptflow-tools", "package_version": "0.0.216", "enable_kwargs": false,
"tool_state": "stable"}, {"name": "Faiss Index Lookup", "type": "python",
"inputs": {"path": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "top_k": {"type": ["int"], "default": "3",
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"vector": {"type": ["list"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Search vector based query
from the FAISS index file.", "module": "promptflow_vectordb.tool.faiss_index_lookup",
"class_name": "FaissIndexLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Vector DB Lookup", "type": "python",
"inputs": {"class_name": {"type": ["string"], "enabled_by": "connection",
"enabled_by_type": ["WeaviateConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "collection_name": {"type": ["string"], "enabled_by":
"connection", "enabled_by_type": ["QdrantConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "connection": {"type":
["CognitiveSearchConnection", "QdrantConnection", "WeaviateConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "index_name": {"type":
["string"], "enabled_by": "connection", "enabled_by_type": ["CognitiveSearchConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"search_filters": {"type": ["object"], "enabled_by": "connection", "enabled_by_type":
["CognitiveSearchConnection", "QdrantConnection"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "default"}, "search_params": {"type":
["object"], "enabled_by": "connection", "enabled_by_type": ["CognitiveSearchConnection",
"QdrantConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "text_field": {"type": ["string"], "enabled_by":
"connection", "enabled_by_type": ["CognitiveSearchConnection", "QdrantConnection",
"WeaviateConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "top_k": {"type": ["int"], "default": "3", "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "vector": {"type":
["list"], "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "vector_field": {"type": ["string"], "enabled_by": "connection",
"enabled_by_type": ["CognitiveSearchConnection"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "default"}}, "description": "Search
vector based query from existing Vector Database.", "module": "promptflow_vectordb.tool.vector_db_lookup",
"class_name": "VectorDBLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Vector Index Lookup", "type": "python",
"inputs": {"path": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "query": {"type": ["object"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "top_k": {"type":
["int"], "default": "3", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}}, "description": "Search text or vector based query
from AzureML Vector Index.", "module": "promptflow_vectordb.tool.vector_index_lookup",
"class_name": "VectorIndexLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "classify_with_llm.jinja2", "type":
"prompt", "inputs": {"examples": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "text_content":
{"type": ["string"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "url": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}}, "source": "classify_with_llm.jinja2",
"is_builtin": false, "enable_kwargs": false, "tool_state": "stable"}, {"name":
"convert_to_dict.py", "type": "python", "inputs": {"input_str": {"type": ["string"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"}},
"source": "convert_to_dict.py", "function": "convert_to_dict", "is_builtin":
false, "enable_kwargs": false, "tool_state": "stable"}, {"name": "fetch_text_content_from_url.py",
"type": "python", "inputs": {"fetch_url": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}}, "source": "fetch_text_content_from_url.py",
"function": "fetch_text_content_from_url", "is_builtin": false, "enable_kwargs":
false, "tool_state": "stable"}, {"name": "prepare_examples.py", "type": "python",
"source": "prepare_examples.py", "function": "prepare_examples", "is_builtin":
false, "enable_kwargs": false, "tool_state": "stable"}, {"name": "summarize_text_content.jinja2",
"type": "prompt", "inputs": {"text": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}}, "source": "summarize_text_content.jinja2",
"is_builtin": false, "enable_kwargs": false, "tool_state": "stable"}, {"name":
"summarize_text_content__variant_1.jinja2", "type": "prompt", "inputs": {"text":
{"type": ["string"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}}, "source": "summarize_text_content__variant_1.jinja2",
"is_builtin": false, "enable_kwargs": false, "tool_state": "stable"}], "inputs":
{"url": {"type": "string", "default": "https://www.microsoft.com/en-us/d/xbox-wireless-controller-stellar-shift-special-edition/94fbjc7h0h6h",
"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": "${convert_to_dict.output.evidence}",
"evaluation_only": false, "is_chat_output": false}}}, "flowRunResourceId":
"azureml://locations/eastus/workspaces/00000/flows/batch_run_name/flowRuns/batch_run_name",
"flowRunId": "batch_run_name", "flowRunDisplayName": "batch_run_name", "batchDataInput":
{"dataUri": "azureml://datastores/workspaceblobstore/paths/LocalUpload/74c11bba717480b2d6b04b8e746d09d7/webClassification3.jsonl"},
"flowRunType": "FlowRun", "flowType": "Default", "runtimeName": "test-runtime-ci",
"inputsMapping": {"url": "${data.url}"}, "outputDatastoreName": "workspaceblobstore",
"childRunBasePath": "promptflow/PromptFlowArtifacts/batch_run_name/flow_artifacts",
"flowDagFileRelativePath": "flow.dag.yaml", "flowSnapshotId": "c956855e-d291-4714-a3df-91c99c974de9",
"studioPortalEndpoint": "https://ml.azure.com/runs/batch_run_name?wsid=/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000"}'
headers:
connection:
- keep-alive
content-length:
- '16239'
content-type:
- application/json; charset=utf-8
strict-transport-security:
- max-age=15724800; includeSubDomains; preload
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '0.455'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- promptflow-sdk/0.0.1 azsdk-python-azuremachinelearningdesignerserviceclient/unknown
Python/3.10.13 (Windows-10-10.0.22631-SP0)
method: GET
uri: https://eastus.api.azureml.ms/flow/api/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/BulkRuns/batch_run_name
response:
body:
string: '{"flowGraph": {"nodes": [{"name": "fetch_text_content_from_url", "type":
"python", "source": {"type": "code", "path": "fetch_text_content_from_url.py"},
"inputs": {"fetch_url": "${inputs.url}"}, "tool": "fetch_text_content_from_url.py",
"reduce": false}, {"name": "prepare_examples", "type": "python", "source":
{"type": "code", "path": "prepare_examples.py"}, "inputs": {}, "tool": "prepare_examples.py",
"reduce": false}, {"name": "classify_with_llm", "type": "llm", "source": {"type":
"code", "path": "classify_with_llm.jinja2"}, "inputs": {"deployment_name":
"gpt-35-turbo", "suffix": "", "max_tokens": "128", "temperature": "0.1", "top_p":
"1.0", "logprobs": "", "echo": "False", "stop": "", "presence_penalty": "0",
"frequency_penalty": "0", "best_of": "1", "logit_bias": "", "url": "${inputs.url}",
"examples": "${prepare_examples.output}", "text_content": "${summarize_text_content.output}"},
"tool": "classify_with_llm.jinja2", "reduce": false, "api": "chat", "provider":
"AzureOpenAI", "connection": "azure_open_ai_connection", "module": "promptflow.tools.aoai"},
{"name": "convert_to_dict", "type": "python", "source": {"type": "code", "path":
"convert_to_dict.py"}, "inputs": {"input_str": "${classify_with_llm.output}"},
"tool": "convert_to_dict.py", "reduce": false}, {"name": "summarize_text_content",
"type": "llm", "source": {"type": "code", "path": "summarize_text_content.jinja2"},
"inputs": {"deployment_name": "gpt-35-turbo", "suffix": "", "max_tokens":
"128", "temperature": "0.2", "top_p": "1.0", "logprobs": "", "echo": "False",
"stop": "", "presence_penalty": "0", "frequency_penalty": "0", "best_of":
"1", "logit_bias": "", "text": "${fetch_text_content_from_url.output}"}, "tool":
"summarize_text_content.jinja2", "reduce": false, "api": "chat", "provider":
"AzureOpenAI", "connection": "azure_open_ai_connection", "module": "promptflow.tools.aoai"}],
"tools": [{"name": "Content Safety (Text Analyze)", "type": "python", "inputs":
{"connection": {"type": ["AzureContentSafetyConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "hate_category":
{"type": ["string"], "default": "medium_sensitivity", "enum": ["disable",
"low_sensitivity", "medium_sensitivity", "high_sensitivity"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "self_harm_category":
{"type": ["string"], "default": "medium_sensitivity", "enum": ["disable",
"low_sensitivity", "medium_sensitivity", "high_sensitivity"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "sexual_category":
{"type": ["string"], "default": "medium_sensitivity", "enum": ["disable",
"low_sensitivity", "medium_sensitivity", "high_sensitivity"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "text": {"type":
["string"], "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "violence_category": {"type": ["string"], "default": "medium_sensitivity",
"enum": ["disable", "low_sensitivity", "medium_sensitivity", "high_sensitivity"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"}},
"description": "Use Azure Content Safety to detect harmful content.", "module":
"promptflow.tools.azure_content_safety", "function": "analyze_text", "is_builtin":
true, "package": "promptflow-tools", "package_version": "0.0.216", "enable_kwargs":
false, "deprecated_tools": ["content_safety_text.tools.content_safety_text_tool.analyze_text"],
"tool_state": "stable"}, {"name": "Embedding", "type": "python", "inputs":
{"connection": {"type": ["AzureOpenAIConnection", "OpenAIConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "deployment_name":
{"type": ["string"], "enabled_by": "connection", "enabled_by_type": ["AzureOpenAIConnection"],
"model_list": ["text-embedding-ada-002", "text-search-ada-doc-001", "text-search-ada-query-001"],
"capabilities": {"completion": false, "chat_completion": false, "embeddings":
true}, "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "input": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "model": {"type": ["string"], "enum": ["text-embedding-ada-002",
"text-search-ada-doc-001", "text-search-ada-query-001"], "enabled_by": "connection",
"enabled_by_type": ["OpenAIConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use Open AI''s embedding
model to create an embedding vector representing the input text.", "module":
"promptflow.tools.embedding", "function": "embedding", "is_builtin": true,
"package": "promptflow-tools", "package_version": "0.0.216", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Open Source LLM", "type": "custom_llm",
"inputs": {"api": {"type": ["string"], "enum": ["chat", "completion"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "connection": {"type":
["CustomConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "deployment_name": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "endpoint_name":
{"type": ["string"], "default": "-- please enter an endpoint name --", "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "max_new_tokens":
{"type": ["int"], "default": 500, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "model_kwargs": {"type": ["object"], "default":
"{}", "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default", "advanced": true}, "temperature": {"type": ["double"], "default":
1.0, "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "top_p": {"type": ["double"], "default": 1.0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default", "advanced": true}},
"description": "Use an Open Source model from the Azure Model catalog, deployed
to an AzureML Online Endpoint for LLM Chat or Completion API calls.", "module":
"promptflow.tools.open_source_llm", "class_name": "OpenSourceLLM", "function":
"call", "icon": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACgElEQVR4nGWSz2vcVRTFP/e9NzOZ1KDGohASslLEH6VLV0ak4l/QpeDCrfQPcNGliODKnVm4EBdBsIjQIlhciKW0ycKFVCSNbYnjdDLtmPnmO/nO9917XcxMkjYX3uLx7nnn3HOuMK2Nix4fP78ZdrYXVkLVWjf3l3B1B+HpcjzGFtmqa6cePz7/x0dnn1n5qhj3iBJPYREIURAJuCtpY8PjReDbrf9WG7H1fuefwQU9qKztTcMJT+PNnEFvjGVDBDlSsH6p/9MLzy6+NxwVqI8RAg4IPmWedMckdLYP6O6UpIaQfvyyXG012+e79/ZfHukoS1ISMT2hGTB1RkUmNgQ5QZ0w+a2VWDq73MbdEWmfnnv6UWe7oNzPaLapl5CwuLTXK9WUGBuCjqekzhP+z52ZXOrKMD3OJg0Hh778aiOuvpnYvp05d6GJO4iAO4QAe/eV36/X5LFRV4Zmn+AdkqlL8Vjp3oVioOz+WTPzzYEgsN+fgPLYyJVheSbPPVl2ikeGZRjtG52/8rHuaV9VOlpP2OtKyVndcRVCSqOhsvxa4vW359i6OuKdD+aP8Q4SYPdOzS/flGjt1JUSaMqZ5nwa1Y8qWb/Ud/eZZkHisYezEM0m+fcelDr8F1SqW2LNK6r1jXQwyLzy1hxvrLXZulry7ocL+FS6G4QIu3fG/Px1gdYeW7LIgXU2P/115TOA5G7e3Rmj2aS/m7l5pThiZzrCcE/d1XHzbln373nw7y6veeoUm5KCNKT/IPPwbiY1hYd/l5MIT65BMFt87sU4v9D7/JMflr44uV6hGh1+L4RCkg6z5iK2tAhNLeLsNGwYA4fDYnC/drvuuFxe86NV/x+Ut27g0FvykgAAAABJRU5ErkJggg==",
"is_builtin": true, "package": "promptflow-tools", "package_version": "0.0.216",
"enable_kwargs": false, "tool_state": "stable"}, {"name": "OpenAI GPT-4V",
"type": "custom_llm", "inputs": {"connection": {"type": ["OpenAIConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"frequency_penalty": {"type": ["double"], "default": 0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "max_tokens": {"type":
["int"], "default": "", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "model": {"type": ["string"], "enum": ["gpt-4-vision-preview"],
"allow_manual_entry": true, "is_multi_select": false, "input_type": "default"},
"presence_penalty": {"type": ["double"], "default": 0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "stop": {"type":
["list"], "default": "", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "temperature": {"type": ["double"], "default": 1,
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"top_p": {"type": ["double"], "default": 1, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use OpenAI GPT-4V to leverage
vision ability.", "module": "promptflow.tools.openai_gpt4v", "class_name":
"OpenAI", "function": "chat", "is_builtin": true, "package": "promptflow-tools",
"package_version": "0.0.216", "default_prompt": "# system:\nAs an AI assistant,
your task involves interpreting images and responding to questions about the
image.\nRemember to provide accurate answers based on the information present
in the image.\n\n# user:\nCan you tell me what the image depicts?\n\n",
"enable_kwargs": false, "tool_state": "stable"}, {"name": "Serp API", "type":
"python", "inputs": {"connection": {"type": ["SerpConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "engine": {"type":
["string"], "default": "google", "enum": ["google", "bing"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "location": {"type":
["string"], "default": "", "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "num": {"type": ["int"], "default": "10",
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"query": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "safe": {"type": ["string"], "default": "off",
"enum": ["active", "off"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use Serp API to obtain search
results from a specific search engine.", "module": "promptflow.tools.serpapi",
"class_name": "SerpAPI", "function": "search", "is_builtin": true, "package":
"promptflow-tools", "package_version": "0.0.216", "enable_kwargs": false,
"tool_state": "stable"}, {"name": "Faiss Index Lookup", "type": "python",
"inputs": {"path": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "top_k": {"type": ["int"], "default": "3",
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"vector": {"type": ["list"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Search vector based query
from the FAISS index file.", "module": "promptflow_vectordb.tool.faiss_index_lookup",
"class_name": "FaissIndexLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Vector DB Lookup", "type": "python",
"inputs": {"class_name": {"type": ["string"], "enabled_by": "connection",
"enabled_by_type": ["WeaviateConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "collection_name": {"type": ["string"], "enabled_by":
"connection", "enabled_by_type": ["QdrantConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "connection": {"type":
["CognitiveSearchConnection", "QdrantConnection", "WeaviateConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "index_name": {"type":
["string"], "enabled_by": "connection", "enabled_by_type": ["CognitiveSearchConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"search_filters": {"type": ["object"], "enabled_by": "connection", "enabled_by_type":
["CognitiveSearchConnection", "QdrantConnection"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "default"}, "search_params": {"type":
["object"], "enabled_by": "connection", "enabled_by_type": ["CognitiveSearchConnection",
"QdrantConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "text_field": {"type": ["string"], "enabled_by":
"connection", "enabled_by_type": ["CognitiveSearchConnection", "QdrantConnection",
"WeaviateConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "top_k": {"type": ["int"], "default": "3", "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "vector": {"type":
["list"], "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "vector_field": {"type": ["string"], "enabled_by": "connection",
"enabled_by_type": ["CognitiveSearchConnection"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "default"}}, "description": "Search
vector based query from existing Vector Database.", "module": "promptflow_vectordb.tool.vector_db_lookup",
"class_name": "VectorDBLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Vector Index Lookup", "type": "python",
"inputs": {"path": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "query": {"type": ["object"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "top_k": {"type":
["int"], "default": "3", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}}, "description": "Search text or vector based query
from AzureML Vector Index.", "module": "promptflow_vectordb.tool.vector_index_lookup",
"class_name": "VectorIndexLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "classify_with_llm.jinja2", "type":
"prompt", "inputs": {"examples": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "text_content":
{"type": ["string"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "url": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}}, "source": "classify_with_llm.jinja2",
"is_builtin": false, "enable_kwargs": false, "tool_state": "stable"}, {"name":
"convert_to_dict.py", "type": "python", "inputs": {"input_str": {"type": ["string"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"}},
"source": "convert_to_dict.py", "function": "convert_to_dict", "is_builtin":
false, "enable_kwargs": false, "tool_state": "stable"}, {"name": "fetch_text_content_from_url.py",
"type": "python", "inputs": {"fetch_url": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}}, "source": "fetch_text_content_from_url.py",
"function": "fetch_text_content_from_url", "is_builtin": false, "enable_kwargs":
false, "tool_state": "stable"}, {"name": "prepare_examples.py", "type": "python",
"source": "prepare_examples.py", "function": "prepare_examples", "is_builtin":
false, "enable_kwargs": false, "tool_state": "stable"}, {"name": "summarize_text_content.jinja2",
"type": "prompt", "inputs": {"text": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}}, "source": "summarize_text_content.jinja2",
"is_builtin": false, "enable_kwargs": false, "tool_state": "stable"}, {"name":
"summarize_text_content__variant_1.jinja2", "type": "prompt", "inputs": {"text":
{"type": ["string"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}}, "source": "summarize_text_content__variant_1.jinja2",
"is_builtin": false, "enable_kwargs": false, "tool_state": "stable"}], "inputs":
{"url": {"type": "string", "default": "https://www.microsoft.com/en-us/d/xbox-wireless-controller-stellar-shift-special-edition/94fbjc7h0h6h",
"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": "${convert_to_dict.output.evidence}",
"evaluation_only": false, "is_chat_output": false}}}, "flowRunResourceId":
"azureml://locations/eastus/workspaces/00000/flows/batch_run_name/flowRuns/batch_run_name",
"flowRunId": "batch_run_name", "flowRunDisplayName": "batch_run_name", "batchDataInput":
{"dataUri": "azureml://datastores/workspaceblobstore/paths/LocalUpload/74c11bba717480b2d6b04b8e746d09d7/webClassification3.jsonl"},
"flowRunType": "FlowRun", "flowType": "Default", "runtimeName": "test-runtime-ci",
"inputsMapping": {"url": "${data.url}"}, "outputDatastoreName": "workspaceblobstore",
"childRunBasePath": "promptflow/PromptFlowArtifacts/batch_run_name/flow_artifacts",
"flowDagFileRelativePath": "flow.dag.yaml", "flowSnapshotId": "c956855e-d291-4714-a3df-91c99c974de9",
"studioPortalEndpoint": "https://ml.azure.com/runs/batch_run_name?wsid=/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000"}'
headers:
connection:
- keep-alive
content-length:
- '16239'
content-type:
- application/json; charset=utf-8
strict-transport-security:
- max-age=15724800; includeSubDomains; preload
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '0.471'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- promptflow-sdk/0.0.1 azsdk-python-azuremachinelearningdesignerserviceclient/unknown
Python/3.10.13 (Windows-10-10.0.22631-SP0)
method: GET
uri: https://eastus.api.azureml.ms/flow/api/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/BulkRuns/batch_run_name
response:
body:
string: '{"flowGraph": {"nodes": [{"name": "fetch_text_content_from_url", "type":
"python", "source": {"type": "code", "path": "fetch_text_content_from_url.py"},
"inputs": {"fetch_url": "${inputs.url}"}, "tool": "fetch_text_content_from_url.py",
"reduce": false}, {"name": "prepare_examples", "type": "python", "source":
{"type": "code", "path": "prepare_examples.py"}, "inputs": {}, "tool": "prepare_examples.py",
"reduce": false}, {"name": "classify_with_llm", "type": "llm", "source": {"type":
"code", "path": "classify_with_llm.jinja2"}, "inputs": {"deployment_name":
"gpt-35-turbo", "suffix": "", "max_tokens": "128", "temperature": "0.1", "top_p":
"1.0", "logprobs": "", "echo": "False", "stop": "", "presence_penalty": "0",
"frequency_penalty": "0", "best_of": "1", "logit_bias": "", "url": "${inputs.url}",
"examples": "${prepare_examples.output}", "text_content": "${summarize_text_content.output}"},
"tool": "classify_with_llm.jinja2", "reduce": false, "api": "chat", "provider":
"AzureOpenAI", "connection": "azure_open_ai_connection", "module": "promptflow.tools.aoai"},
{"name": "convert_to_dict", "type": "python", "source": {"type": "code", "path":
"convert_to_dict.py"}, "inputs": {"input_str": "${classify_with_llm.output}"},
"tool": "convert_to_dict.py", "reduce": false}, {"name": "summarize_text_content",
"type": "llm", "source": {"type": "code", "path": "summarize_text_content.jinja2"},
"inputs": {"deployment_name": "gpt-35-turbo", "suffix": "", "max_tokens":
"128", "temperature": "0.2", "top_p": "1.0", "logprobs": "", "echo": "False",
"stop": "", "presence_penalty": "0", "frequency_penalty": "0", "best_of":
"1", "logit_bias": "", "text": "${fetch_text_content_from_url.output}"}, "tool":
"summarize_text_content.jinja2", "reduce": false, "api": "chat", "provider":
"AzureOpenAI", "connection": "azure_open_ai_connection", "module": "promptflow.tools.aoai"}],
"tools": [{"name": "Content Safety (Text Analyze)", "type": "python", "inputs":
{"connection": {"type": ["AzureContentSafetyConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "hate_category":
{"type": ["string"], "default": "medium_sensitivity", "enum": ["disable",
"low_sensitivity", "medium_sensitivity", "high_sensitivity"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "self_harm_category":
{"type": ["string"], "default": "medium_sensitivity", "enum": ["disable",
"low_sensitivity", "medium_sensitivity", "high_sensitivity"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "sexual_category":
{"type": ["string"], "default": "medium_sensitivity", "enum": ["disable",
"low_sensitivity", "medium_sensitivity", "high_sensitivity"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "text": {"type":
["string"], "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "violence_category": {"type": ["string"], "default": "medium_sensitivity",
"enum": ["disable", "low_sensitivity", "medium_sensitivity", "high_sensitivity"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"}},
"description": "Use Azure Content Safety to detect harmful content.", "module":
"promptflow.tools.azure_content_safety", "function": "analyze_text", "is_builtin":
true, "package": "promptflow-tools", "package_version": "0.0.216", "enable_kwargs":
false, "deprecated_tools": ["content_safety_text.tools.content_safety_text_tool.analyze_text"],
"tool_state": "stable"}, {"name": "Embedding", "type": "python", "inputs":
{"connection": {"type": ["AzureOpenAIConnection", "OpenAIConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "deployment_name":
{"type": ["string"], "enabled_by": "connection", "enabled_by_type": ["AzureOpenAIConnection"],
"model_list": ["text-embedding-ada-002", "text-search-ada-doc-001", "text-search-ada-query-001"],
"capabilities": {"completion": false, "chat_completion": false, "embeddings":
true}, "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "input": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "model": {"type": ["string"], "enum": ["text-embedding-ada-002",
"text-search-ada-doc-001", "text-search-ada-query-001"], "enabled_by": "connection",
"enabled_by_type": ["OpenAIConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use Open AI''s embedding
model to create an embedding vector representing the input text.", "module":
"promptflow.tools.embedding", "function": "embedding", "is_builtin": true,
"package": "promptflow-tools", "package_version": "0.0.216", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Open Source LLM", "type": "custom_llm",
"inputs": {"api": {"type": ["string"], "enum": ["chat", "completion"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "connection": {"type":
["CustomConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "deployment_name": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "endpoint_name":
{"type": ["string"], "default": "-- please enter an endpoint name --", "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "max_new_tokens":
{"type": ["int"], "default": 500, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "model_kwargs": {"type": ["object"], "default":
"{}", "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default", "advanced": true}, "temperature": {"type": ["double"], "default":
1.0, "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "top_p": {"type": ["double"], "default": 1.0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default", "advanced": true}},
"description": "Use an Open Source model from the Azure Model catalog, deployed
to an AzureML Online Endpoint for LLM Chat or Completion API calls.", "module":
"promptflow.tools.open_source_llm", "class_name": "OpenSourceLLM", "function":
"call", "icon": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACgElEQVR4nGWSz2vcVRTFP/e9NzOZ1KDGohASslLEH6VLV0ak4l/QpeDCrfQPcNGliODKnVm4EBdBsIjQIlhciKW0ycKFVCSNbYnjdDLtmPnmO/nO9917XcxMkjYX3uLx7nnn3HOuMK2Nix4fP78ZdrYXVkLVWjf3l3B1B+HpcjzGFtmqa6cePz7/x0dnn1n5qhj3iBJPYREIURAJuCtpY8PjReDbrf9WG7H1fuefwQU9qKztTcMJT+PNnEFvjGVDBDlSsH6p/9MLzy6+NxwVqI8RAg4IPmWedMckdLYP6O6UpIaQfvyyXG012+e79/ZfHukoS1ISMT2hGTB1RkUmNgQ5QZ0w+a2VWDq73MbdEWmfnnv6UWe7oNzPaLapl5CwuLTXK9WUGBuCjqekzhP+z52ZXOrKMD3OJg0Hh778aiOuvpnYvp05d6GJO4iAO4QAe/eV36/X5LFRV4Zmn+AdkqlL8Vjp3oVioOz+WTPzzYEgsN+fgPLYyJVheSbPPVl2ikeGZRjtG52/8rHuaV9VOlpP2OtKyVndcRVCSqOhsvxa4vW359i6OuKdD+aP8Q4SYPdOzS/flGjt1JUSaMqZ5nwa1Y8qWb/Ud/eZZkHisYezEM0m+fcelDr8F1SqW2LNK6r1jXQwyLzy1hxvrLXZulry7ocL+FS6G4QIu3fG/Px1gdYeW7LIgXU2P/115TOA5G7e3Rmj2aS/m7l5pThiZzrCcE/d1XHzbln373nw7y6veeoUm5KCNKT/IPPwbiY1hYd/l5MIT65BMFt87sU4v9D7/JMflr44uV6hGh1+L4RCkg6z5iK2tAhNLeLsNGwYA4fDYnC/drvuuFxe86NV/x+Ut27g0FvykgAAAABJRU5ErkJggg==",
"is_builtin": true, "package": "promptflow-tools", "package_version": "0.0.216",
"enable_kwargs": false, "tool_state": "stable"}, {"name": "OpenAI GPT-4V",
"type": "custom_llm", "inputs": {"connection": {"type": ["OpenAIConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"frequency_penalty": {"type": ["double"], "default": 0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "max_tokens": {"type":
["int"], "default": "", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "model": {"type": ["string"], "enum": ["gpt-4-vision-preview"],
"allow_manual_entry": true, "is_multi_select": false, "input_type": "default"},
"presence_penalty": {"type": ["double"], "default": 0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "stop": {"type":
["list"], "default": "", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "temperature": {"type": ["double"], "default": 1,
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"top_p": {"type": ["double"], "default": 1, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use OpenAI GPT-4V to leverage
vision ability.", "module": "promptflow.tools.openai_gpt4v", "class_name":
"OpenAI", "function": "chat", "is_builtin": true, "package": "promptflow-tools",
"package_version": "0.0.216", "default_prompt": "# system:\nAs an AI assistant,
your task involves interpreting images and responding to questions about the
image.\nRemember to provide accurate answers based on the information present
in the image.\n\n# user:\nCan you tell me what the image depicts?\n\n",
"enable_kwargs": false, "tool_state": "stable"}, {"name": "Serp API", "type":
"python", "inputs": {"connection": {"type": ["SerpConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "engine": {"type":
["string"], "default": "google", "enum": ["google", "bing"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "location": {"type":
["string"], "default": "", "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "num": {"type": ["int"], "default": "10",
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"query": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "safe": {"type": ["string"], "default": "off",
"enum": ["active", "off"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use Serp API to obtain search
results from a specific search engine.", "module": "promptflow.tools.serpapi",
"class_name": "SerpAPI", "function": "search", "is_builtin": true, "package":
"promptflow-tools", "package_version": "0.0.216", "enable_kwargs": false,
"tool_state": "stable"}, {"name": "Faiss Index Lookup", "type": "python",
"inputs": {"path": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "top_k": {"type": ["int"], "default": "3",
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"vector": {"type": ["list"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Search vector based query
from the FAISS index file.", "module": "promptflow_vectordb.tool.faiss_index_lookup",
"class_name": "FaissIndexLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Vector DB Lookup", "type": "python",
"inputs": {"class_name": {"type": ["string"], "enabled_by": "connection",
"enabled_by_type": ["WeaviateConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "collection_name": {"type": ["string"], "enabled_by":
"connection", "enabled_by_type": ["QdrantConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "connection": {"type":
["CognitiveSearchConnection", "QdrantConnection", "WeaviateConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "index_name": {"type":
["string"], "enabled_by": "connection", "enabled_by_type": ["CognitiveSearchConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"search_filters": {"type": ["object"], "enabled_by": "connection", "enabled_by_type":
["CognitiveSearchConnection", "QdrantConnection"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "default"}, "search_params": {"type":
["object"], "enabled_by": "connection", "enabled_by_type": ["CognitiveSearchConnection",
"QdrantConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "text_field": {"type": ["string"], "enabled_by":
"connection", "enabled_by_type": ["CognitiveSearchConnection", "QdrantConnection",
"WeaviateConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "top_k": {"type": ["int"], "default": "3", "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "vector": {"type":
["list"], "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "vector_field": {"type": ["string"], "enabled_by": "connection",
"enabled_by_type": ["CognitiveSearchConnection"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "default"}}, "description": "Search
vector based query from existing Vector Database.", "module": "promptflow_vectordb.tool.vector_db_lookup",
"class_name": "VectorDBLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Vector Index Lookup", "type": "python",
"inputs": {"path": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "query": {"type": ["object"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "top_k": {"type":
["int"], "default": "3", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}}, "description": "Search text or vector based query
from AzureML Vector Index.", "module": "promptflow_vectordb.tool.vector_index_lookup",
"class_name": "VectorIndexLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "classify_with_llm.jinja2", "type":
"prompt", "inputs": {"examples": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "text_content":
{"type": ["string"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "url": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}}, "source": "classify_with_llm.jinja2",
"is_builtin": false, "enable_kwargs": false, "tool_state": "stable"}, {"name":
"convert_to_dict.py", "type": "python", "inputs": {"input_str": {"type": ["string"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"}},
"source": "convert_to_dict.py", "function": "convert_to_dict", "is_builtin":
false, "enable_kwargs": false, "tool_state": "stable"}, {"name": "fetch_text_content_from_url.py",
"type": "python", "inputs": {"fetch_url": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}}, "source": "fetch_text_content_from_url.py",
"function": "fetch_text_content_from_url", "is_builtin": false, "enable_kwargs":
false, "tool_state": "stable"}, {"name": "prepare_examples.py", "type": "python",
"source": "prepare_examples.py", "function": "prepare_examples", "is_builtin":
false, "enable_kwargs": false, "tool_state": "stable"}, {"name": "summarize_text_content.jinja2",
"type": "prompt", "inputs": {"text": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}}, "source": "summarize_text_content.jinja2",
"is_builtin": false, "enable_kwargs": false, "tool_state": "stable"}, {"name":
"summarize_text_content__variant_1.jinja2", "type": "prompt", "inputs": {"text":
{"type": ["string"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}}, "source": "summarize_text_content__variant_1.jinja2",
"is_builtin": false, "enable_kwargs": false, "tool_state": "stable"}], "inputs":
{"url": {"type": "string", "default": "https://www.microsoft.com/en-us/d/xbox-wireless-controller-stellar-shift-special-edition/94fbjc7h0h6h",
"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": "${convert_to_dict.output.evidence}",
"evaluation_only": false, "is_chat_output": false}}}, "flowRunResourceId":
"azureml://locations/eastus/workspaces/00000/flows/batch_run_name/flowRuns/batch_run_name",
"flowRunId": "batch_run_name", "flowRunDisplayName": "batch_run_name", "batchDataInput":
{"dataUri": "azureml://datastores/workspaceblobstore/paths/LocalUpload/74c11bba717480b2d6b04b8e746d09d7/webClassification3.jsonl"},
"flowRunType": "FlowRun", "flowType": "Default", "runtimeName": "test-runtime-ci",
"inputsMapping": {"url": "${data.url}"}, "outputDatastoreName": "workspaceblobstore",
"childRunBasePath": "promptflow/PromptFlowArtifacts/batch_run_name/flow_artifacts",
"flowDagFileRelativePath": "flow.dag.yaml", "flowSnapshotId": "c956855e-d291-4714-a3df-91c99c974de9",
"studioPortalEndpoint": "https://ml.azure.com/runs/batch_run_name?wsid=/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000"}'
headers:
connection:
- keep-alive
content-length:
- '16239'
content-type:
- application/json; charset=utf-8
strict-transport-security:
- max-age=15724800; includeSubDomains; preload
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '0.374'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- promptflow-sdk/0.0.1 azsdk-python-azuremachinelearningdesignerserviceclient/unknown
Python/3.10.13 (Windows-10-10.0.22631-SP0)
method: GET
uri: https://eastus.api.azureml.ms/flow/api/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/BulkRuns/batch_run_name
response:
body:
string: '{"flowGraph": {"nodes": [{"name": "fetch_text_content_from_url", "type":
"python", "source": {"type": "code", "path": "fetch_text_content_from_url.py"},
"inputs": {"fetch_url": "${inputs.url}"}, "tool": "fetch_text_content_from_url.py",
"reduce": false}, {"name": "prepare_examples", "type": "python", "source":
{"type": "code", "path": "prepare_examples.py"}, "inputs": {}, "tool": "prepare_examples.py",
"reduce": false}, {"name": "classify_with_llm", "type": "llm", "source": {"type":
"code", "path": "classify_with_llm.jinja2"}, "inputs": {"deployment_name":
"gpt-35-turbo", "suffix": "", "max_tokens": "128", "temperature": "0.1", "top_p":
"1.0", "logprobs": "", "echo": "False", "stop": "", "presence_penalty": "0",
"frequency_penalty": "0", "best_of": "1", "logit_bias": "", "url": "${inputs.url}",
"examples": "${prepare_examples.output}", "text_content": "${summarize_text_content.output}"},
"tool": "classify_with_llm.jinja2", "reduce": false, "api": "chat", "provider":
"AzureOpenAI", "connection": "azure_open_ai_connection", "module": "promptflow.tools.aoai"},
{"name": "convert_to_dict", "type": "python", "source": {"type": "code", "path":
"convert_to_dict.py"}, "inputs": {"input_str": "${classify_with_llm.output}"},
"tool": "convert_to_dict.py", "reduce": false}, {"name": "summarize_text_content",
"type": "llm", "source": {"type": "code", "path": "summarize_text_content.jinja2"},
"inputs": {"deployment_name": "gpt-35-turbo", "suffix": "", "max_tokens":
"128", "temperature": "0.2", "top_p": "1.0", "logprobs": "", "echo": "False",
"stop": "", "presence_penalty": "0", "frequency_penalty": "0", "best_of":
"1", "logit_bias": "", "text": "${fetch_text_content_from_url.output}"}, "tool":
"summarize_text_content.jinja2", "reduce": false, "api": "chat", "provider":
"AzureOpenAI", "connection": "azure_open_ai_connection", "module": "promptflow.tools.aoai"}],
"tools": [{"name": "Content Safety (Text Analyze)", "type": "python", "inputs":
{"connection": {"type": ["AzureContentSafetyConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "hate_category":
{"type": ["string"], "default": "medium_sensitivity", "enum": ["disable",
"low_sensitivity", "medium_sensitivity", "high_sensitivity"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "self_harm_category":
{"type": ["string"], "default": "medium_sensitivity", "enum": ["disable",
"low_sensitivity", "medium_sensitivity", "high_sensitivity"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "sexual_category":
{"type": ["string"], "default": "medium_sensitivity", "enum": ["disable",
"low_sensitivity", "medium_sensitivity", "high_sensitivity"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "text": {"type":
["string"], "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "violence_category": {"type": ["string"], "default": "medium_sensitivity",
"enum": ["disable", "low_sensitivity", "medium_sensitivity", "high_sensitivity"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"}},
"description": "Use Azure Content Safety to detect harmful content.", "module":
"promptflow.tools.azure_content_safety", "function": "analyze_text", "is_builtin":
true, "package": "promptflow-tools", "package_version": "0.0.216", "enable_kwargs":
false, "deprecated_tools": ["content_safety_text.tools.content_safety_text_tool.analyze_text"],
"tool_state": "stable"}, {"name": "Embedding", "type": "python", "inputs":
{"connection": {"type": ["AzureOpenAIConnection", "OpenAIConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "deployment_name":
{"type": ["string"], "enabled_by": "connection", "enabled_by_type": ["AzureOpenAIConnection"],
"model_list": ["text-embedding-ada-002", "text-search-ada-doc-001", "text-search-ada-query-001"],
"capabilities": {"completion": false, "chat_completion": false, "embeddings":
true}, "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "input": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "model": {"type": ["string"], "enum": ["text-embedding-ada-002",
"text-search-ada-doc-001", "text-search-ada-query-001"], "enabled_by": "connection",
"enabled_by_type": ["OpenAIConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use Open AI''s embedding
model to create an embedding vector representing the input text.", "module":
"promptflow.tools.embedding", "function": "embedding", "is_builtin": true,
"package": "promptflow-tools", "package_version": "0.0.216", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Open Source LLM", "type": "custom_llm",
"inputs": {"api": {"type": ["string"], "enum": ["chat", "completion"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "connection": {"type":
["CustomConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "deployment_name": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "endpoint_name":
{"type": ["string"], "default": "-- please enter an endpoint name --", "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "max_new_tokens":
{"type": ["int"], "default": 500, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "model_kwargs": {"type": ["object"], "default":
"{}", "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default", "advanced": true}, "temperature": {"type": ["double"], "default":
1.0, "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "top_p": {"type": ["double"], "default": 1.0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default", "advanced": true}},
"description": "Use an Open Source model from the Azure Model catalog, deployed
to an AzureML Online Endpoint for LLM Chat or Completion API calls.", "module":
"promptflow.tools.open_source_llm", "class_name": "OpenSourceLLM", "function":
"call", "icon": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACgElEQVR4nGWSz2vcVRTFP/e9NzOZ1KDGohASslLEH6VLV0ak4l/QpeDCrfQPcNGliODKnVm4EBdBsIjQIlhciKW0ycKFVCSNbYnjdDLtmPnmO/nO9917XcxMkjYX3uLx7nnn3HOuMK2Nix4fP78ZdrYXVkLVWjf3l3B1B+HpcjzGFtmqa6cePz7/x0dnn1n5qhj3iBJPYREIURAJuCtpY8PjReDbrf9WG7H1fuefwQU9qKztTcMJT+PNnEFvjGVDBDlSsH6p/9MLzy6+NxwVqI8RAg4IPmWedMckdLYP6O6UpIaQfvyyXG012+e79/ZfHukoS1ISMT2hGTB1RkUmNgQ5QZ0w+a2VWDq73MbdEWmfnnv6UWe7oNzPaLapl5CwuLTXK9WUGBuCjqekzhP+z52ZXOrKMD3OJg0Hh778aiOuvpnYvp05d6GJO4iAO4QAe/eV36/X5LFRV4Zmn+AdkqlL8Vjp3oVioOz+WTPzzYEgsN+fgPLYyJVheSbPPVl2ikeGZRjtG52/8rHuaV9VOlpP2OtKyVndcRVCSqOhsvxa4vW359i6OuKdD+aP8Q4SYPdOzS/flGjt1JUSaMqZ5nwa1Y8qWb/Ud/eZZkHisYezEM0m+fcelDr8F1SqW2LNK6r1jXQwyLzy1hxvrLXZulry7ocL+FS6G4QIu3fG/Px1gdYeW7LIgXU2P/115TOA5G7e3Rmj2aS/m7l5pThiZzrCcE/d1XHzbln373nw7y6veeoUm5KCNKT/IPPwbiY1hYd/l5MIT65BMFt87sU4v9D7/JMflr44uV6hGh1+L4RCkg6z5iK2tAhNLeLsNGwYA4fDYnC/drvuuFxe86NV/x+Ut27g0FvykgAAAABJRU5ErkJggg==",
"is_builtin": true, "package": "promptflow-tools", "package_version": "0.0.216",
"enable_kwargs": false, "tool_state": "stable"}, {"name": "OpenAI GPT-4V",
"type": "custom_llm", "inputs": {"connection": {"type": ["OpenAIConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"frequency_penalty": {"type": ["double"], "default": 0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "max_tokens": {"type":
["int"], "default": "", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "model": {"type": ["string"], "enum": ["gpt-4-vision-preview"],
"allow_manual_entry": true, "is_multi_select": false, "input_type": "default"},
"presence_penalty": {"type": ["double"], "default": 0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "stop": {"type":
["list"], "default": "", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "temperature": {"type": ["double"], "default": 1,
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"top_p": {"type": ["double"], "default": 1, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use OpenAI GPT-4V to leverage
vision ability.", "module": "promptflow.tools.openai_gpt4v", "class_name":
"OpenAI", "function": "chat", "is_builtin": true, "package": "promptflow-tools",
"package_version": "0.0.216", "default_prompt": "# system:\nAs an AI assistant,
your task involves interpreting images and responding to questions about the
image.\nRemember to provide accurate answers based on the information present
in the image.\n\n# user:\nCan you tell me what the image depicts?\n\n",
"enable_kwargs": false, "tool_state": "stable"}, {"name": "Serp API", "type":
"python", "inputs": {"connection": {"type": ["SerpConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "engine": {"type":
["string"], "default": "google", "enum": ["google", "bing"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "location": {"type":
["string"], "default": "", "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "num": {"type": ["int"], "default": "10",
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"query": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "safe": {"type": ["string"], "default": "off",
"enum": ["active", "off"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use Serp API to obtain search
results from a specific search engine.", "module": "promptflow.tools.serpapi",
"class_name": "SerpAPI", "function": "search", "is_builtin": true, "package":
"promptflow-tools", "package_version": "0.0.216", "enable_kwargs": false,
"tool_state": "stable"}, {"name": "Faiss Index Lookup", "type": "python",
"inputs": {"path": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "top_k": {"type": ["int"], "default": "3",
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"vector": {"type": ["list"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Search vector based query
from the FAISS index file.", "module": "promptflow_vectordb.tool.faiss_index_lookup",
"class_name": "FaissIndexLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Vector DB Lookup", "type": "python",
"inputs": {"class_name": {"type": ["string"], "enabled_by": "connection",
"enabled_by_type": ["WeaviateConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "collection_name": {"type": ["string"], "enabled_by":
"connection", "enabled_by_type": ["QdrantConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "connection": {"type":
["CognitiveSearchConnection", "QdrantConnection", "WeaviateConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "index_name": {"type":
["string"], "enabled_by": "connection", "enabled_by_type": ["CognitiveSearchConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"search_filters": {"type": ["object"], "enabled_by": "connection", "enabled_by_type":
["CognitiveSearchConnection", "QdrantConnection"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "default"}, "search_params": {"type":
["object"], "enabled_by": "connection", "enabled_by_type": ["CognitiveSearchConnection",
"QdrantConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "text_field": {"type": ["string"], "enabled_by":
"connection", "enabled_by_type": ["CognitiveSearchConnection", "QdrantConnection",
"WeaviateConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "top_k": {"type": ["int"], "default": "3", "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "vector": {"type":
["list"], "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "vector_field": {"type": ["string"], "enabled_by": "connection",
"enabled_by_type": ["CognitiveSearchConnection"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "default"}}, "description": "Search
vector based query from existing Vector Database.", "module": "promptflow_vectordb.tool.vector_db_lookup",
"class_name": "VectorDBLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Vector Index Lookup", "type": "python",
"inputs": {"path": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "query": {"type": ["object"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "top_k": {"type":
["int"], "default": "3", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}}, "description": "Search text or vector based query
from AzureML Vector Index.", "module": "promptflow_vectordb.tool.vector_index_lookup",
"class_name": "VectorIndexLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "classify_with_llm.jinja2", "type":
"prompt", "inputs": {"examples": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "text_content":
{"type": ["string"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "url": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}}, "source": "classify_with_llm.jinja2",
"is_builtin": false, "enable_kwargs": false, "tool_state": "stable"}, {"name":
"convert_to_dict.py", "type": "python", "inputs": {"input_str": {"type": ["string"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"}},
"source": "convert_to_dict.py", "function": "convert_to_dict", "is_builtin":
false, "enable_kwargs": false, "tool_state": "stable"}, {"name": "fetch_text_content_from_url.py",
"type": "python", "inputs": {"fetch_url": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}}, "source": "fetch_text_content_from_url.py",
"function": "fetch_text_content_from_url", "is_builtin": false, "enable_kwargs":
false, "tool_state": "stable"}, {"name": "prepare_examples.py", "type": "python",
"source": "prepare_examples.py", "function": "prepare_examples", "is_builtin":
false, "enable_kwargs": false, "tool_state": "stable"}, {"name": "summarize_text_content.jinja2",
"type": "prompt", "inputs": {"text": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}}, "source": "summarize_text_content.jinja2",
"is_builtin": false, "enable_kwargs": false, "tool_state": "stable"}, {"name":
"summarize_text_content__variant_1.jinja2", "type": "prompt", "inputs": {"text":
{"type": ["string"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}}, "source": "summarize_text_content__variant_1.jinja2",
"is_builtin": false, "enable_kwargs": false, "tool_state": "stable"}], "inputs":
{"url": {"type": "string", "default": "https://www.microsoft.com/en-us/d/xbox-wireless-controller-stellar-shift-special-edition/94fbjc7h0h6h",
"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": "${convert_to_dict.output.evidence}",
"evaluation_only": false, "is_chat_output": false}}}, "flowRunResourceId":
"azureml://locations/eastus/workspaces/00000/flows/batch_run_name/flowRuns/batch_run_name",
"flowRunId": "batch_run_name", "flowRunDisplayName": "batch_run_name", "batchDataInput":
{"dataUri": "azureml://datastores/workspaceblobstore/paths/LocalUpload/74c11bba717480b2d6b04b8e746d09d7/webClassification3.jsonl"},
"flowRunType": "FlowRun", "flowType": "Default", "runtimeName": "test-runtime-ci",
"inputsMapping": {"url": "${data.url}"}, "outputDatastoreName": "workspaceblobstore",
"childRunBasePath": "promptflow/PromptFlowArtifacts/batch_run_name/flow_artifacts",
"flowDagFileRelativePath": "flow.dag.yaml", "flowSnapshotId": "c956855e-d291-4714-a3df-91c99c974de9",
"studioPortalEndpoint": "https://ml.azure.com/runs/batch_run_name?wsid=/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000"}'
headers:
connection:
- keep-alive
content-length:
- '16239'
content-type:
- application/json; charset=utf-8
strict-transport-security:
- max-age=15724800; includeSubDomains; preload
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '0.458'
status:
code: 200
message: OK
- 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-10-10.0.22631-SP0)
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore
response:
body:
string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore",
"name": "workspaceblobstore", "type": "Microsoft.MachineLearningServices/workspaces/datastores",
"properties": {"description": null, "tags": null, "properties": null, "isDefault":
true, "credentials": {"credentialsType": "AccountKey"}, "intellectualProperty":
null, "subscriptionId": "00000000-0000-0000-0000-000000000000", "resourceGroup":
"00000", "datastoreType": "AzureBlob", "accountName": "fake_account_name",
"containerName": "fake-container-name", "endpoint": "core.windows.net", "protocol":
"https", "serviceDataAccessAuthIdentity": "WorkspaceSystemAssignedIdentity"},
"systemData": {"createdAt": "2023-04-08T02:53:06.5886442+00:00", "createdBy":
"779301c0-18b2-4cdc-801b-a0a3368fee0a", "createdByType": "Application", "lastModifiedAt":
"2023-04-08T02:53:07.521127+00:00", "lastModifiedBy": "779301c0-18b2-4cdc-801b-a0a3368fee0a",
"lastModifiedByType": "Application"}}'
headers:
cache-control:
- no-cache
content-length:
- '1227'
content-type:
- application/json; charset=utf-8
expires:
- '-1'
pragma:
- no-cache
strict-transport-security:
- max-age=31536000; includeSubDomains
transfer-encoding:
- chunked
vary:
- Accept-Encoding,Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '0.109'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
Content-Length:
- '0'
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-10-10.0.22631-SP0)
method: POST
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore/listSecrets
response:
body:
string: '{"secretsType": "AccountKey", "key": "dGhpcyBpcyBmYWtlIGtleQ=="}'
headers:
cache-control:
- no-cache
content-length:
- '134'
content-type:
- application/json; charset=utf-8
expires:
- '-1'
pragma:
- no-cache
strict-transport-security:
- max-age=31536000; includeSubDomains
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '0.134'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/xml
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- azsdk-python-storage-blob/12.19.0 Python/3.10.13 (Windows-10-10.0.22631-SP0)
x-ms-date:
- Fri, 12 Jan 2024 08:19:32 GMT
x-ms-version:
- '2023-11-03'
method: HEAD
uri: https://fake_account_name.blob.core.windows.net/fake-container-name/LocalUpload/000000000000000000000000000000000000/eval-classification-accuracy/calculate_accuracy.py
response:
body:
string: ''
headers:
accept-ranges:
- bytes
content-length:
- '409'
content-md5:
- OyENtlqGVUTrY5zKuzo8XA==
content-type:
- application/octet-stream
last-modified:
- Tue, 21 Nov 2023 08:03:40 GMT
server:
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
vary:
- Origin
x-ms-blob-type:
- BlockBlob
x-ms-creation-time:
- Tue, 21 Nov 2023 08:03:39 GMT
x-ms-meta-name:
- fd932777-4f3a-4c1d-9c3a-24d45835d7e1
x-ms-meta-upload_status:
- completed
x-ms-meta-version:
- '1'
x-ms-version:
- '2023-11-03'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/xml
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- azsdk-python-storage-blob/12.19.0 Python/3.10.13 (Windows-10-10.0.22631-SP0)
x-ms-date:
- Fri, 12 Jan 2024 08:19:33 GMT
x-ms-version:
- '2023-11-03'
method: HEAD
uri: https://fake_account_name.blob.core.windows.net/fake-container-name/az-ml-artifacts/000000000000000000000000000000000000/eval-classification-accuracy/calculate_accuracy.py
response:
body:
string: ''
headers:
server:
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
transfer-encoding:
- chunked
vary:
- Origin
x-ms-error-code:
- BlobNotFound
x-ms-version:
- '2023-11-03'
status:
code: 404
message: The specified blob does not exist.
- request:
body: '{"flowDefinitionDataStoreName": "workspaceblobstore", "flowDefinitionBlobPath":
"LocalUpload/000000000000000000000000000000000000/eval-classification-accuracy/flow.dag.yaml",
"runId": "eval_run_name", "runDisplayName": "eval_run_name", "runExperimentName":
"", "variantRunId": "batch_run_name", "batchDataInput": {}, "inputsMapping":
{"groundtruth": "${run.inputs.url}", "prediction": "${run.outputs.category}"},
"connections": {}, "environmentVariables": {}, "runtimeName": "fake-runtime-name",
"sessionId": "000000000000000000000000000000000000000000000000", "sessionSetupMode":
"SystemWait", "flowLineageId": "0000000000000000000000000000000000000000000000000000000000000000",
"runDisplayNameGenerationType": "UserProvidedMacro"}'
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
Content-Length:
- '822'
Content-Type:
- application/json
User-Agent:
- promptflow-sdk/0.0.1 azsdk-python-azuremachinelearningdesignerserviceclient/unknown
Python/3.10.13 (Windows-10-10.0.22631-SP0)
method: POST
uri: https://eastus.api.azureml.ms/flow/api/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/BulkRuns/submit
response:
body:
string: '"eval_run_name"'
headers:
connection:
- keep-alive
content-length:
- '38'
content-type:
- application/json; charset=utf-8
strict-transport-security:
- max-age=15724800; includeSubDomains; preload
x-content-type-options:
- nosniff
x-request-time:
- '6.239'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- promptflow-sdk/0.0.1 azsdk-python-azuremachinelearningdesignerserviceclient/unknown
Python/3.10.13 (Windows-10-10.0.22631-SP0)
method: GET
uri: https://eastus.api.azureml.ms/flow/api/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/BulkRuns/eval_run_name
response:
body:
string: '{"flowGraph": {"nodes": [{"name": "grade", "type": "python", "source":
{"type": "code", "path": "grade.py"}, "inputs": {"groundtruth": "${inputs.groundtruth}",
"prediction": "${inputs.prediction}"}, "tool": "grade.py", "reduce": false},
{"name": "calculate_accuracy", "type": "python", "source": {"type": "code",
"path": "calculate_accuracy.py"}, "inputs": {"grades": "${grade.output}"},
"tool": "calculate_accuracy.py", "reduce": true}], "tools": [{"name": "Content
Safety (Text Analyze)", "type": "python", "inputs": {"connection": {"type":
["AzureContentSafetyConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "hate_category": {"type": ["string"], "default":
"medium_sensitivity", "enum": ["disable", "low_sensitivity", "medium_sensitivity",
"high_sensitivity"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "self_harm_category": {"type": ["string"], "default":
"medium_sensitivity", "enum": ["disable", "low_sensitivity", "medium_sensitivity",
"high_sensitivity"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "sexual_category": {"type": ["string"], "default":
"medium_sensitivity", "enum": ["disable", "low_sensitivity", "medium_sensitivity",
"high_sensitivity"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "text": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "violence_category":
{"type": ["string"], "default": "medium_sensitivity", "enum": ["disable",
"low_sensitivity", "medium_sensitivity", "high_sensitivity"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}}, "description":
"Use Azure Content Safety to detect harmful content.", "module": "promptflow.tools.azure_content_safety",
"function": "analyze_text", "is_builtin": true, "package": "promptflow-tools",
"package_version": "0.0.216", "enable_kwargs": false, "deprecated_tools":
["content_safety_text.tools.content_safety_text_tool.analyze_text"], "tool_state":
"stable"}, {"name": "Embedding", "type": "python", "inputs": {"connection":
{"type": ["AzureOpenAIConnection", "OpenAIConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "deployment_name":
{"type": ["string"], "enabled_by": "connection", "enabled_by_type": ["AzureOpenAIConnection"],
"model_list": ["text-embedding-ada-002", "text-search-ada-doc-001", "text-search-ada-query-001"],
"capabilities": {"completion": false, "chat_completion": false, "embeddings":
true}, "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "input": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "model": {"type": ["string"], "enum": ["text-embedding-ada-002",
"text-search-ada-doc-001", "text-search-ada-query-001"], "enabled_by": "connection",
"enabled_by_type": ["OpenAIConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use Open AI''s embedding
model to create an embedding vector representing the input text.", "module":
"promptflow.tools.embedding", "function": "embedding", "is_builtin": true,
"package": "promptflow-tools", "package_version": "0.0.216", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Open Source LLM", "type": "custom_llm",
"inputs": {"api": {"type": ["string"], "enum": ["chat", "completion"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "connection": {"type":
["CustomConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "deployment_name": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "endpoint_name":
{"type": ["string"], "default": "-- please enter an endpoint name --", "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "max_new_tokens":
{"type": ["int"], "default": 500, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "model_kwargs": {"type": ["object"], "default":
"{}", "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default", "advanced": true}, "temperature": {"type": ["double"], "default":
1.0, "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "top_p": {"type": ["double"], "default": 1.0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default", "advanced": true}},
"description": "Use an Open Source model from the Azure Model catalog, deployed
to an AzureML Online Endpoint for LLM Chat or Completion API calls.", "module":
"promptflow.tools.open_source_llm", "class_name": "OpenSourceLLM", "function":
"call", "icon": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACgElEQVR4nGWSz2vcVRTFP/e9NzOZ1KDGohASslLEH6VLV0ak4l/QpeDCrfQPcNGliODKnVm4EBdBsIjQIlhciKW0ycKFVCSNbYnjdDLtmPnmO/nO9917XcxMkjYX3uLx7nnn3HOuMK2Nix4fP78ZdrYXVkLVWjf3l3B1B+HpcjzGFtmqa6cePz7/x0dnn1n5qhj3iBJPYREIURAJuCtpY8PjReDbrf9WG7H1fuefwQU9qKztTcMJT+PNnEFvjGVDBDlSsH6p/9MLzy6+NxwVqI8RAg4IPmWedMckdLYP6O6UpIaQfvyyXG012+e79/ZfHukoS1ISMT2hGTB1RkUmNgQ5QZ0w+a2VWDq73MbdEWmfnnv6UWe7oNzPaLapl5CwuLTXK9WUGBuCjqekzhP+z52ZXOrKMD3OJg0Hh778aiOuvpnYvp05d6GJO4iAO4QAe/eV36/X5LFRV4Zmn+AdkqlL8Vjp3oVioOz+WTPzzYEgsN+fgPLYyJVheSbPPVl2ikeGZRjtG52/8rHuaV9VOlpP2OtKyVndcRVCSqOhsvxa4vW359i6OuKdD+aP8Q4SYPdOzS/flGjt1JUSaMqZ5nwa1Y8qWb/Ud/eZZkHisYezEM0m+fcelDr8F1SqW2LNK6r1jXQwyLzy1hxvrLXZulry7ocL+FS6G4QIu3fG/Px1gdYeW7LIgXU2P/115TOA5G7e3Rmj2aS/m7l5pThiZzrCcE/d1XHzbln373nw7y6veeoUm5KCNKT/IPPwbiY1hYd/l5MIT65BMFt87sU4v9D7/JMflr44uV6hGh1+L4RCkg6z5iK2tAhNLeLsNGwYA4fDYnC/drvuuFxe86NV/x+Ut27g0FvykgAAAABJRU5ErkJggg==",
"is_builtin": true, "package": "promptflow-tools", "package_version": "0.0.216",
"enable_kwargs": false, "tool_state": "stable"}, {"name": "OpenAI GPT-4V",
"type": "custom_llm", "inputs": {"connection": {"type": ["OpenAIConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"frequency_penalty": {"type": ["double"], "default": 0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "max_tokens": {"type":
["int"], "default": "", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "model": {"type": ["string"], "enum": ["gpt-4-vision-preview"],
"allow_manual_entry": true, "is_multi_select": false, "input_type": "default"},
"presence_penalty": {"type": ["double"], "default": 0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "stop": {"type":
["list"], "default": "", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "temperature": {"type": ["double"], "default": 1,
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"top_p": {"type": ["double"], "default": 1, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use OpenAI GPT-4V to leverage
vision ability.", "module": "promptflow.tools.openai_gpt4v", "class_name":
"OpenAI", "function": "chat", "is_builtin": true, "package": "promptflow-tools",
"package_version": "0.0.216", "default_prompt": "# system:\nAs an AI assistant,
your task involves interpreting images and responding to questions about the
image.\nRemember to provide accurate answers based on the information present
in the image.\n\n# user:\nCan you tell me what the image depicts?\n\n",
"enable_kwargs": false, "tool_state": "stable"}, {"name": "Serp API", "type":
"python", "inputs": {"connection": {"type": ["SerpConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "engine": {"type":
["string"], "default": "google", "enum": ["google", "bing"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "location": {"type":
["string"], "default": "", "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "num": {"type": ["int"], "default": "10",
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"query": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "safe": {"type": ["string"], "default": "off",
"enum": ["active", "off"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use Serp API to obtain search
results from a specific search engine.", "module": "promptflow.tools.serpapi",
"class_name": "SerpAPI", "function": "search", "is_builtin": true, "package":
"promptflow-tools", "package_version": "0.0.216", "enable_kwargs": false,
"tool_state": "stable"}, {"name": "Faiss Index Lookup", "type": "python",
"inputs": {"path": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "top_k": {"type": ["int"], "default": "3",
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"vector": {"type": ["list"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Search vector based query
from the FAISS index file.", "module": "promptflow_vectordb.tool.faiss_index_lookup",
"class_name": "FaissIndexLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Vector DB Lookup", "type": "python",
"inputs": {"class_name": {"type": ["string"], "enabled_by": "connection",
"enabled_by_type": ["WeaviateConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "collection_name": {"type": ["string"], "enabled_by":
"connection", "enabled_by_type": ["QdrantConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "connection": {"type":
["CognitiveSearchConnection", "QdrantConnection", "WeaviateConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "index_name": {"type":
["string"], "enabled_by": "connection", "enabled_by_type": ["CognitiveSearchConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"search_filters": {"type": ["object"], "enabled_by": "connection", "enabled_by_type":
["CognitiveSearchConnection", "QdrantConnection"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "default"}, "search_params": {"type":
["object"], "enabled_by": "connection", "enabled_by_type": ["CognitiveSearchConnection",
"QdrantConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "text_field": {"type": ["string"], "enabled_by":
"connection", "enabled_by_type": ["CognitiveSearchConnection", "QdrantConnection",
"WeaviateConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "top_k": {"type": ["int"], "default": "3", "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "vector": {"type":
["list"], "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "vector_field": {"type": ["string"], "enabled_by": "connection",
"enabled_by_type": ["CognitiveSearchConnection"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "default"}}, "description": "Search
vector based query from existing Vector Database.", "module": "promptflow_vectordb.tool.vector_db_lookup",
"class_name": "VectorDBLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Vector Index Lookup", "type": "python",
"inputs": {"path": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "query": {"type": ["object"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "top_k": {"type":
["int"], "default": "3", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}}, "description": "Search text or vector based query
from AzureML Vector Index.", "module": "promptflow_vectordb.tool.vector_index_lookup",
"class_name": "VectorIndexLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "calculate_accuracy.py", "type":
"python", "inputs": {"grades": {"type": ["object"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}}, "source": "calculate_accuracy.py",
"function": "calculate_accuracy", "is_builtin": false, "enable_kwargs": false,
"tool_state": "stable"}, {"name": "grade.py", "type": "python", "inputs":
{"groundtruth": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "prediction": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}}, "source": "grade.py",
"function": "grade", "is_builtin": false, "enable_kwargs": false, "tool_state":
"stable"}], "inputs": {"groundtruth": {"type": "string", "default": "APP",
"description": "Please specify the groundtruth column, which contains the
true label to the outputs that your flow produces.", "is_chat_input": false},
"prediction": {"type": "string", "default": "APP", "description": "Please
specify the prediction column, which contains the predicted outputs that your
flow produces.", "is_chat_input": false}}, "outputs": {"grade": {"type": "string",
"reference": "${grade.output}", "evaluation_only": false, "is_chat_output":
false}}}, "flowRunResourceId": "azureml://locations/eastus/workspaces/00000/flows/eval_run_name/flowRuns/eval_run_name",
"flowRunId": "eval_run_name", "flowRunDisplayName": "eval_run_name", "batchDataInput":
{}, "flowRunType": "FlowRun", "flowType": "Default", "runtimeName": "test-runtime-ci",
"inputsMapping": {"groundtruth": "${run.inputs.url}", "prediction": "${run.outputs.category}"},
"outputDatastoreName": "workspaceblobstore", "childRunBasePath": "promptflow/PromptFlowArtifacts/eval_run_name/flow_artifacts",
"flowDagFileRelativePath": "flow.dag.yaml", "flowSnapshotId": "07c78456-f714-4df6-9398-0dc36e95ed2c",
"studioPortalEndpoint": "https://ml.azure.com/runs/eval_run_name?wsid=/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000"}'
headers:
connection:
- keep-alive
content-length:
- '13745'
content-type:
- application/json; charset=utf-8
strict-transport-security:
- max-age=15724800; includeSubDomains; preload
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '0.237'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- promptflow-sdk/0.0.1 azsdk-python-azuremachinelearningdesignerserviceclient/unknown
Python/3.10.13 (Windows-10-10.0.22631-SP0)
method: GET
uri: https://eastus.api.azureml.ms/flow/api/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/BulkRuns/eval_run_name
response:
body:
string: '{"flowGraph": {"nodes": [{"name": "grade", "type": "python", "source":
{"type": "code", "path": "grade.py"}, "inputs": {"groundtruth": "${inputs.groundtruth}",
"prediction": "${inputs.prediction}"}, "tool": "grade.py", "reduce": false},
{"name": "calculate_accuracy", "type": "python", "source": {"type": "code",
"path": "calculate_accuracy.py"}, "inputs": {"grades": "${grade.output}"},
"tool": "calculate_accuracy.py", "reduce": true}], "tools": [{"name": "Content
Safety (Text Analyze)", "type": "python", "inputs": {"connection": {"type":
["AzureContentSafetyConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "hate_category": {"type": ["string"], "default":
"medium_sensitivity", "enum": ["disable", "low_sensitivity", "medium_sensitivity",
"high_sensitivity"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "self_harm_category": {"type": ["string"], "default":
"medium_sensitivity", "enum": ["disable", "low_sensitivity", "medium_sensitivity",
"high_sensitivity"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "sexual_category": {"type": ["string"], "default":
"medium_sensitivity", "enum": ["disable", "low_sensitivity", "medium_sensitivity",
"high_sensitivity"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "text": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "violence_category":
{"type": ["string"], "default": "medium_sensitivity", "enum": ["disable",
"low_sensitivity", "medium_sensitivity", "high_sensitivity"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}}, "description":
"Use Azure Content Safety to detect harmful content.", "module": "promptflow.tools.azure_content_safety",
"function": "analyze_text", "is_builtin": true, "package": "promptflow-tools",
"package_version": "0.0.216", "enable_kwargs": false, "deprecated_tools":
["content_safety_text.tools.content_safety_text_tool.analyze_text"], "tool_state":
"stable"}, {"name": "Embedding", "type": "python", "inputs": {"connection":
{"type": ["AzureOpenAIConnection", "OpenAIConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "deployment_name":
{"type": ["string"], "enabled_by": "connection", "enabled_by_type": ["AzureOpenAIConnection"],
"model_list": ["text-embedding-ada-002", "text-search-ada-doc-001", "text-search-ada-query-001"],
"capabilities": {"completion": false, "chat_completion": false, "embeddings":
true}, "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "input": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "model": {"type": ["string"], "enum": ["text-embedding-ada-002",
"text-search-ada-doc-001", "text-search-ada-query-001"], "enabled_by": "connection",
"enabled_by_type": ["OpenAIConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use Open AI''s embedding
model to create an embedding vector representing the input text.", "module":
"promptflow.tools.embedding", "function": "embedding", "is_builtin": true,
"package": "promptflow-tools", "package_version": "0.0.216", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Open Source LLM", "type": "custom_llm",
"inputs": {"api": {"type": ["string"], "enum": ["chat", "completion"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "connection": {"type":
["CustomConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "deployment_name": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "endpoint_name":
{"type": ["string"], "default": "-- please enter an endpoint name --", "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "max_new_tokens":
{"type": ["int"], "default": 500, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "model_kwargs": {"type": ["object"], "default":
"{}", "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default", "advanced": true}, "temperature": {"type": ["double"], "default":
1.0, "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "top_p": {"type": ["double"], "default": 1.0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default", "advanced": true}},
"description": "Use an Open Source model from the Azure Model catalog, deployed
to an AzureML Online Endpoint for LLM Chat or Completion API calls.", "module":
"promptflow.tools.open_source_llm", "class_name": "OpenSourceLLM", "function":
"call", "icon": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACgElEQVR4nGWSz2vcVRTFP/e9NzOZ1KDGohASslLEH6VLV0ak4l/QpeDCrfQPcNGliODKnVm4EBdBsIjQIlhciKW0ycKFVCSNbYnjdDLtmPnmO/nO9917XcxMkjYX3uLx7nnn3HOuMK2Nix4fP78ZdrYXVkLVWjf3l3B1B+HpcjzGFtmqa6cePz7/x0dnn1n5qhj3iBJPYREIURAJuCtpY8PjReDbrf9WG7H1fuefwQU9qKztTcMJT+PNnEFvjGVDBDlSsH6p/9MLzy6+NxwVqI8RAg4IPmWedMckdLYP6O6UpIaQfvyyXG012+e79/ZfHukoS1ISMT2hGTB1RkUmNgQ5QZ0w+a2VWDq73MbdEWmfnnv6UWe7oNzPaLapl5CwuLTXK9WUGBuCjqekzhP+z52ZXOrKMD3OJg0Hh778aiOuvpnYvp05d6GJO4iAO4QAe/eV36/X5LFRV4Zmn+AdkqlL8Vjp3oVioOz+WTPzzYEgsN+fgPLYyJVheSbPPVl2ikeGZRjtG52/8rHuaV9VOlpP2OtKyVndcRVCSqOhsvxa4vW359i6OuKdD+aP8Q4SYPdOzS/flGjt1JUSaMqZ5nwa1Y8qWb/Ud/eZZkHisYezEM0m+fcelDr8F1SqW2LNK6r1jXQwyLzy1hxvrLXZulry7ocL+FS6G4QIu3fG/Px1gdYeW7LIgXU2P/115TOA5G7e3Rmj2aS/m7l5pThiZzrCcE/d1XHzbln373nw7y6veeoUm5KCNKT/IPPwbiY1hYd/l5MIT65BMFt87sU4v9D7/JMflr44uV6hGh1+L4RCkg6z5iK2tAhNLeLsNGwYA4fDYnC/drvuuFxe86NV/x+Ut27g0FvykgAAAABJRU5ErkJggg==",
"is_builtin": true, "package": "promptflow-tools", "package_version": "0.0.216",
"enable_kwargs": false, "tool_state": "stable"}, {"name": "OpenAI GPT-4V",
"type": "custom_llm", "inputs": {"connection": {"type": ["OpenAIConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"frequency_penalty": {"type": ["double"], "default": 0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "max_tokens": {"type":
["int"], "default": "", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "model": {"type": ["string"], "enum": ["gpt-4-vision-preview"],
"allow_manual_entry": true, "is_multi_select": false, "input_type": "default"},
"presence_penalty": {"type": ["double"], "default": 0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "stop": {"type":
["list"], "default": "", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "temperature": {"type": ["double"], "default": 1,
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"top_p": {"type": ["double"], "default": 1, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use OpenAI GPT-4V to leverage
vision ability.", "module": "promptflow.tools.openai_gpt4v", "class_name":
"OpenAI", "function": "chat", "is_builtin": true, "package": "promptflow-tools",
"package_version": "0.0.216", "default_prompt": "# system:\nAs an AI assistant,
your task involves interpreting images and responding to questions about the
image.\nRemember to provide accurate answers based on the information present
in the image.\n\n# user:\nCan you tell me what the image depicts?\n\n",
"enable_kwargs": false, "tool_state": "stable"}, {"name": "Serp API", "type":
"python", "inputs": {"connection": {"type": ["SerpConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "engine": {"type":
["string"], "default": "google", "enum": ["google", "bing"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "location": {"type":
["string"], "default": "", "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "num": {"type": ["int"], "default": "10",
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"query": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "safe": {"type": ["string"], "default": "off",
"enum": ["active", "off"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use Serp API to obtain search
results from a specific search engine.", "module": "promptflow.tools.serpapi",
"class_name": "SerpAPI", "function": "search", "is_builtin": true, "package":
"promptflow-tools", "package_version": "0.0.216", "enable_kwargs": false,
"tool_state": "stable"}, {"name": "Faiss Index Lookup", "type": "python",
"inputs": {"path": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "top_k": {"type": ["int"], "default": "3",
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"vector": {"type": ["list"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Search vector based query
from the FAISS index file.", "module": "promptflow_vectordb.tool.faiss_index_lookup",
"class_name": "FaissIndexLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Vector DB Lookup", "type": "python",
"inputs": {"class_name": {"type": ["string"], "enabled_by": "connection",
"enabled_by_type": ["WeaviateConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "collection_name": {"type": ["string"], "enabled_by":
"connection", "enabled_by_type": ["QdrantConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "connection": {"type":
["CognitiveSearchConnection", "QdrantConnection", "WeaviateConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "index_name": {"type":
["string"], "enabled_by": "connection", "enabled_by_type": ["CognitiveSearchConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"search_filters": {"type": ["object"], "enabled_by": "connection", "enabled_by_type":
["CognitiveSearchConnection", "QdrantConnection"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "default"}, "search_params": {"type":
["object"], "enabled_by": "connection", "enabled_by_type": ["CognitiveSearchConnection",
"QdrantConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "text_field": {"type": ["string"], "enabled_by":
"connection", "enabled_by_type": ["CognitiveSearchConnection", "QdrantConnection",
"WeaviateConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "top_k": {"type": ["int"], "default": "3", "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "vector": {"type":
["list"], "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "vector_field": {"type": ["string"], "enabled_by": "connection",
"enabled_by_type": ["CognitiveSearchConnection"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "default"}}, "description": "Search
vector based query from existing Vector Database.", "module": "promptflow_vectordb.tool.vector_db_lookup",
"class_name": "VectorDBLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Vector Index Lookup", "type": "python",
"inputs": {"path": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "query": {"type": ["object"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "top_k": {"type":
["int"], "default": "3", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}}, "description": "Search text or vector based query
from AzureML Vector Index.", "module": "promptflow_vectordb.tool.vector_index_lookup",
"class_name": "VectorIndexLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "calculate_accuracy.py", "type":
"python", "inputs": {"grades": {"type": ["object"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}}, "source": "calculate_accuracy.py",
"function": "calculate_accuracy", "is_builtin": false, "enable_kwargs": false,
"tool_state": "stable"}, {"name": "grade.py", "type": "python", "inputs":
{"groundtruth": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "prediction": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}}, "source": "grade.py",
"function": "grade", "is_builtin": false, "enable_kwargs": false, "tool_state":
"stable"}], "inputs": {"groundtruth": {"type": "string", "default": "APP",
"description": "Please specify the groundtruth column, which contains the
true label to the outputs that your flow produces.", "is_chat_input": false},
"prediction": {"type": "string", "default": "APP", "description": "Please
specify the prediction column, which contains the predicted outputs that your
flow produces.", "is_chat_input": false}}, "outputs": {"grade": {"type": "string",
"reference": "${grade.output}", "evaluation_only": false, "is_chat_output":
false}}}, "flowRunResourceId": "azureml://locations/eastus/workspaces/00000/flows/eval_run_name/flowRuns/eval_run_name",
"flowRunId": "eval_run_name", "flowRunDisplayName": "eval_run_name", "batchDataInput":
{}, "flowRunType": "FlowRun", "flowType": "Default", "runtimeName": "test-runtime-ci",
"inputsMapping": {"groundtruth": "${run.inputs.url}", "prediction": "${run.outputs.category}"},
"outputDatastoreName": "workspaceblobstore", "childRunBasePath": "promptflow/PromptFlowArtifacts/eval_run_name/flow_artifacts",
"flowDagFileRelativePath": "flow.dag.yaml", "flowSnapshotId": "07c78456-f714-4df6-9398-0dc36e95ed2c",
"studioPortalEndpoint": "https://ml.azure.com/runs/eval_run_name?wsid=/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000"}'
headers:
connection:
- keep-alive
content-length:
- '13745'
content-type:
- application/json; charset=utf-8
strict-transport-security:
- max-age=15724800; includeSubDomains; preload
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '0.206'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- promptflow-sdk/0.0.1 azsdk-python-azuremachinelearningdesignerserviceclient/unknown
Python/3.10.13 (Windows-10-10.0.22631-SP0)
method: GET
uri: https://eastus.api.azureml.ms/flow/api/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/BulkRuns/eval_run_name
response:
body:
string: '{"flowGraph": {"nodes": [{"name": "grade", "type": "python", "source":
{"type": "code", "path": "grade.py"}, "inputs": {"groundtruth": "${inputs.groundtruth}",
"prediction": "${inputs.prediction}"}, "tool": "grade.py", "reduce": false},
{"name": "calculate_accuracy", "type": "python", "source": {"type": "code",
"path": "calculate_accuracy.py"}, "inputs": {"grades": "${grade.output}"},
"tool": "calculate_accuracy.py", "reduce": true}], "tools": [{"name": "Content
Safety (Text Analyze)", "type": "python", "inputs": {"connection": {"type":
["AzureContentSafetyConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "hate_category": {"type": ["string"], "default":
"medium_sensitivity", "enum": ["disable", "low_sensitivity", "medium_sensitivity",
"high_sensitivity"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "self_harm_category": {"type": ["string"], "default":
"medium_sensitivity", "enum": ["disable", "low_sensitivity", "medium_sensitivity",
"high_sensitivity"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "sexual_category": {"type": ["string"], "default":
"medium_sensitivity", "enum": ["disable", "low_sensitivity", "medium_sensitivity",
"high_sensitivity"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "text": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "violence_category":
{"type": ["string"], "default": "medium_sensitivity", "enum": ["disable",
"low_sensitivity", "medium_sensitivity", "high_sensitivity"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}}, "description":
"Use Azure Content Safety to detect harmful content.", "module": "promptflow.tools.azure_content_safety",
"function": "analyze_text", "is_builtin": true, "package": "promptflow-tools",
"package_version": "0.0.216", "enable_kwargs": false, "deprecated_tools":
["content_safety_text.tools.content_safety_text_tool.analyze_text"], "tool_state":
"stable"}, {"name": "Embedding", "type": "python", "inputs": {"connection":
{"type": ["AzureOpenAIConnection", "OpenAIConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "deployment_name":
{"type": ["string"], "enabled_by": "connection", "enabled_by_type": ["AzureOpenAIConnection"],
"model_list": ["text-embedding-ada-002", "text-search-ada-doc-001", "text-search-ada-query-001"],
"capabilities": {"completion": false, "chat_completion": false, "embeddings":
true}, "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "input": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "model": {"type": ["string"], "enum": ["text-embedding-ada-002",
"text-search-ada-doc-001", "text-search-ada-query-001"], "enabled_by": "connection",
"enabled_by_type": ["OpenAIConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use Open AI''s embedding
model to create an embedding vector representing the input text.", "module":
"promptflow.tools.embedding", "function": "embedding", "is_builtin": true,
"package": "promptflow-tools", "package_version": "0.0.216", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Open Source LLM", "type": "custom_llm",
"inputs": {"api": {"type": ["string"], "enum": ["chat", "completion"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "connection": {"type":
["CustomConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "deployment_name": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "endpoint_name":
{"type": ["string"], "default": "-- please enter an endpoint name --", "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "max_new_tokens":
{"type": ["int"], "default": 500, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "model_kwargs": {"type": ["object"], "default":
"{}", "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default", "advanced": true}, "temperature": {"type": ["double"], "default":
1.0, "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "top_p": {"type": ["double"], "default": 1.0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default", "advanced": true}},
"description": "Use an Open Source model from the Azure Model catalog, deployed
to an AzureML Online Endpoint for LLM Chat or Completion API calls.", "module":
"promptflow.tools.open_source_llm", "class_name": "OpenSourceLLM", "function":
"call", "icon": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACgElEQVR4nGWSz2vcVRTFP/e9NzOZ1KDGohASslLEH6VLV0ak4l/QpeDCrfQPcNGliODKnVm4EBdBsIjQIlhciKW0ycKFVCSNbYnjdDLtmPnmO/nO9917XcxMkjYX3uLx7nnn3HOuMK2Nix4fP78ZdrYXVkLVWjf3l3B1B+HpcjzGFtmqa6cePz7/x0dnn1n5qhj3iBJPYREIURAJuCtpY8PjReDbrf9WG7H1fuefwQU9qKztTcMJT+PNnEFvjGVDBDlSsH6p/9MLzy6+NxwVqI8RAg4IPmWedMckdLYP6O6UpIaQfvyyXG012+e79/ZfHukoS1ISMT2hGTB1RkUmNgQ5QZ0w+a2VWDq73MbdEWmfnnv6UWe7oNzPaLapl5CwuLTXK9WUGBuCjqekzhP+z52ZXOrKMD3OJg0Hh778aiOuvpnYvp05d6GJO4iAO4QAe/eV36/X5LFRV4Zmn+AdkqlL8Vjp3oVioOz+WTPzzYEgsN+fgPLYyJVheSbPPVl2ikeGZRjtG52/8rHuaV9VOlpP2OtKyVndcRVCSqOhsvxa4vW359i6OuKdD+aP8Q4SYPdOzS/flGjt1JUSaMqZ5nwa1Y8qWb/Ud/eZZkHisYezEM0m+fcelDr8F1SqW2LNK6r1jXQwyLzy1hxvrLXZulry7ocL+FS6G4QIu3fG/Px1gdYeW7LIgXU2P/115TOA5G7e3Rmj2aS/m7l5pThiZzrCcE/d1XHzbln373nw7y6veeoUm5KCNKT/IPPwbiY1hYd/l5MIT65BMFt87sU4v9D7/JMflr44uV6hGh1+L4RCkg6z5iK2tAhNLeLsNGwYA4fDYnC/drvuuFxe86NV/x+Ut27g0FvykgAAAABJRU5ErkJggg==",
"is_builtin": true, "package": "promptflow-tools", "package_version": "0.0.216",
"enable_kwargs": false, "tool_state": "stable"}, {"name": "OpenAI GPT-4V",
"type": "custom_llm", "inputs": {"connection": {"type": ["OpenAIConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"frequency_penalty": {"type": ["double"], "default": 0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "max_tokens": {"type":
["int"], "default": "", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "model": {"type": ["string"], "enum": ["gpt-4-vision-preview"],
"allow_manual_entry": true, "is_multi_select": false, "input_type": "default"},
"presence_penalty": {"type": ["double"], "default": 0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "stop": {"type":
["list"], "default": "", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "temperature": {"type": ["double"], "default": 1,
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"top_p": {"type": ["double"], "default": 1, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use OpenAI GPT-4V to leverage
vision ability.", "module": "promptflow.tools.openai_gpt4v", "class_name":
"OpenAI", "function": "chat", "is_builtin": true, "package": "promptflow-tools",
"package_version": "0.0.216", "default_prompt": "# system:\nAs an AI assistant,
your task involves interpreting images and responding to questions about the
image.\nRemember to provide accurate answers based on the information present
in the image.\n\n# user:\nCan you tell me what the image depicts?\n\n",
"enable_kwargs": false, "tool_state": "stable"}, {"name": "Serp API", "type":
"python", "inputs": {"connection": {"type": ["SerpConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "engine": {"type":
["string"], "default": "google", "enum": ["google", "bing"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "location": {"type":
["string"], "default": "", "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "num": {"type": ["int"], "default": "10",
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"query": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "safe": {"type": ["string"], "default": "off",
"enum": ["active", "off"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use Serp API to obtain search
results from a specific search engine.", "module": "promptflow.tools.serpapi",
"class_name": "SerpAPI", "function": "search", "is_builtin": true, "package":
"promptflow-tools", "package_version": "0.0.216", "enable_kwargs": false,
"tool_state": "stable"}, {"name": "Faiss Index Lookup", "type": "python",
"inputs": {"path": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "top_k": {"type": ["int"], "default": "3",
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"vector": {"type": ["list"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Search vector based query
from the FAISS index file.", "module": "promptflow_vectordb.tool.faiss_index_lookup",
"class_name": "FaissIndexLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Vector DB Lookup", "type": "python",
"inputs": {"class_name": {"type": ["string"], "enabled_by": "connection",
"enabled_by_type": ["WeaviateConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "collection_name": {"type": ["string"], "enabled_by":
"connection", "enabled_by_type": ["QdrantConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "connection": {"type":
["CognitiveSearchConnection", "QdrantConnection", "WeaviateConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "index_name": {"type":
["string"], "enabled_by": "connection", "enabled_by_type": ["CognitiveSearchConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"search_filters": {"type": ["object"], "enabled_by": "connection", "enabled_by_type":
["CognitiveSearchConnection", "QdrantConnection"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "default"}, "search_params": {"type":
["object"], "enabled_by": "connection", "enabled_by_type": ["CognitiveSearchConnection",
"QdrantConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "text_field": {"type": ["string"], "enabled_by":
"connection", "enabled_by_type": ["CognitiveSearchConnection", "QdrantConnection",
"WeaviateConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "top_k": {"type": ["int"], "default": "3", "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "vector": {"type":
["list"], "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "vector_field": {"type": ["string"], "enabled_by": "connection",
"enabled_by_type": ["CognitiveSearchConnection"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "default"}}, "description": "Search
vector based query from existing Vector Database.", "module": "promptflow_vectordb.tool.vector_db_lookup",
"class_name": "VectorDBLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Vector Index Lookup", "type": "python",
"inputs": {"path": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "query": {"type": ["object"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "top_k": {"type":
["int"], "default": "3", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}}, "description": "Search text or vector based query
from AzureML Vector Index.", "module": "promptflow_vectordb.tool.vector_index_lookup",
"class_name": "VectorIndexLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "calculate_accuracy.py", "type":
"python", "inputs": {"grades": {"type": ["object"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}}, "source": "calculate_accuracy.py",
"function": "calculate_accuracy", "is_builtin": false, "enable_kwargs": false,
"tool_state": "stable"}, {"name": "grade.py", "type": "python", "inputs":
{"groundtruth": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "prediction": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}}, "source": "grade.py",
"function": "grade", "is_builtin": false, "enable_kwargs": false, "tool_state":
"stable"}], "inputs": {"groundtruth": {"type": "string", "default": "APP",
"description": "Please specify the groundtruth column, which contains the
true label to the outputs that your flow produces.", "is_chat_input": false},
"prediction": {"type": "string", "default": "APP", "description": "Please
specify the prediction column, which contains the predicted outputs that your
flow produces.", "is_chat_input": false}}, "outputs": {"grade": {"type": "string",
"reference": "${grade.output}", "evaluation_only": false, "is_chat_output":
false}}}, "flowRunResourceId": "azureml://locations/eastus/workspaces/00000/flows/eval_run_name/flowRuns/eval_run_name",
"flowRunId": "eval_run_name", "flowRunDisplayName": "eval_run_name", "batchDataInput":
{}, "flowRunType": "FlowRun", "flowType": "Default", "runtimeName": "test-runtime-ci",
"inputsMapping": {"groundtruth": "${run.inputs.url}", "prediction": "${run.outputs.category}"},
"outputDatastoreName": "workspaceblobstore", "childRunBasePath": "promptflow/PromptFlowArtifacts/eval_run_name/flow_artifacts",
"flowDagFileRelativePath": "flow.dag.yaml", "flowSnapshotId": "07c78456-f714-4df6-9398-0dc36e95ed2c",
"studioPortalEndpoint": "https://ml.azure.com/runs/eval_run_name?wsid=/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000"}'
headers:
connection:
- keep-alive
content-length:
- '13745'
content-type:
- application/json; charset=utf-8
strict-transport-security:
- max-age=15724800; includeSubDomains; preload
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '0.333'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- promptflow-sdk/0.0.1 azsdk-python-azuremachinelearningdesignerserviceclient/unknown
Python/3.10.13 (Windows-10-10.0.22631-SP0)
method: GET
uri: https://eastus.api.azureml.ms/flow/api/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/BulkRuns/eval_run_name
response:
body:
string: '{"flowGraph": {"nodes": [{"name": "grade", "type": "python", "source":
{"type": "code", "path": "grade.py"}, "inputs": {"groundtruth": "${inputs.groundtruth}",
"prediction": "${inputs.prediction}"}, "tool": "grade.py", "reduce": false},
{"name": "calculate_accuracy", "type": "python", "source": {"type": "code",
"path": "calculate_accuracy.py"}, "inputs": {"grades": "${grade.output}"},
"tool": "calculate_accuracy.py", "reduce": true}], "tools": [{"name": "Content
Safety (Text Analyze)", "type": "python", "inputs": {"connection": {"type":
["AzureContentSafetyConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "hate_category": {"type": ["string"], "default":
"medium_sensitivity", "enum": ["disable", "low_sensitivity", "medium_sensitivity",
"high_sensitivity"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "self_harm_category": {"type": ["string"], "default":
"medium_sensitivity", "enum": ["disable", "low_sensitivity", "medium_sensitivity",
"high_sensitivity"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "sexual_category": {"type": ["string"], "default":
"medium_sensitivity", "enum": ["disable", "low_sensitivity", "medium_sensitivity",
"high_sensitivity"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "text": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "violence_category":
{"type": ["string"], "default": "medium_sensitivity", "enum": ["disable",
"low_sensitivity", "medium_sensitivity", "high_sensitivity"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}}, "description":
"Use Azure Content Safety to detect harmful content.", "module": "promptflow.tools.azure_content_safety",
"function": "analyze_text", "is_builtin": true, "package": "promptflow-tools",
"package_version": "0.0.216", "enable_kwargs": false, "deprecated_tools":
["content_safety_text.tools.content_safety_text_tool.analyze_text"], "tool_state":
"stable"}, {"name": "Embedding", "type": "python", "inputs": {"connection":
{"type": ["AzureOpenAIConnection", "OpenAIConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "deployment_name":
{"type": ["string"], "enabled_by": "connection", "enabled_by_type": ["AzureOpenAIConnection"],
"model_list": ["text-embedding-ada-002", "text-search-ada-doc-001", "text-search-ada-query-001"],
"capabilities": {"completion": false, "chat_completion": false, "embeddings":
true}, "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "input": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "model": {"type": ["string"], "enum": ["text-embedding-ada-002",
"text-search-ada-doc-001", "text-search-ada-query-001"], "enabled_by": "connection",
"enabled_by_type": ["OpenAIConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use Open AI''s embedding
model to create an embedding vector representing the input text.", "module":
"promptflow.tools.embedding", "function": "embedding", "is_builtin": true,
"package": "promptflow-tools", "package_version": "0.0.216", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Open Source LLM", "type": "custom_llm",
"inputs": {"api": {"type": ["string"], "enum": ["chat", "completion"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "connection": {"type":
["CustomConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "deployment_name": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "endpoint_name":
{"type": ["string"], "default": "-- please enter an endpoint name --", "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "max_new_tokens":
{"type": ["int"], "default": 500, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "model_kwargs": {"type": ["object"], "default":
"{}", "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default", "advanced": true}, "temperature": {"type": ["double"], "default":
1.0, "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "top_p": {"type": ["double"], "default": 1.0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default", "advanced": true}},
"description": "Use an Open Source model from the Azure Model catalog, deployed
to an AzureML Online Endpoint for LLM Chat or Completion API calls.", "module":
"promptflow.tools.open_source_llm", "class_name": "OpenSourceLLM", "function":
"call", "icon": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACgElEQVR4nGWSz2vcVRTFP/e9NzOZ1KDGohASslLEH6VLV0ak4l/QpeDCrfQPcNGliODKnVm4EBdBsIjQIlhciKW0ycKFVCSNbYnjdDLtmPnmO/nO9917XcxMkjYX3uLx7nnn3HOuMK2Nix4fP78ZdrYXVkLVWjf3l3B1B+HpcjzGFtmqa6cePz7/x0dnn1n5qhj3iBJPYREIURAJuCtpY8PjReDbrf9WG7H1fuefwQU9qKztTcMJT+PNnEFvjGVDBDlSsH6p/9MLzy6+NxwVqI8RAg4IPmWedMckdLYP6O6UpIaQfvyyXG012+e79/ZfHukoS1ISMT2hGTB1RkUmNgQ5QZ0w+a2VWDq73MbdEWmfnnv6UWe7oNzPaLapl5CwuLTXK9WUGBuCjqekzhP+z52ZXOrKMD3OJg0Hh778aiOuvpnYvp05d6GJO4iAO4QAe/eV36/X5LFRV4Zmn+AdkqlL8Vjp3oVioOz+WTPzzYEgsN+fgPLYyJVheSbPPVl2ikeGZRjtG52/8rHuaV9VOlpP2OtKyVndcRVCSqOhsvxa4vW359i6OuKdD+aP8Q4SYPdOzS/flGjt1JUSaMqZ5nwa1Y8qWb/Ud/eZZkHisYezEM0m+fcelDr8F1SqW2LNK6r1jXQwyLzy1hxvrLXZulry7ocL+FS6G4QIu3fG/Px1gdYeW7LIgXU2P/115TOA5G7e3Rmj2aS/m7l5pThiZzrCcE/d1XHzbln373nw7y6veeoUm5KCNKT/IPPwbiY1hYd/l5MIT65BMFt87sU4v9D7/JMflr44uV6hGh1+L4RCkg6z5iK2tAhNLeLsNGwYA4fDYnC/drvuuFxe86NV/x+Ut27g0FvykgAAAABJRU5ErkJggg==",
"is_builtin": true, "package": "promptflow-tools", "package_version": "0.0.216",
"enable_kwargs": false, "tool_state": "stable"}, {"name": "OpenAI GPT-4V",
"type": "custom_llm", "inputs": {"connection": {"type": ["OpenAIConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"frequency_penalty": {"type": ["double"], "default": 0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "max_tokens": {"type":
["int"], "default": "", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "model": {"type": ["string"], "enum": ["gpt-4-vision-preview"],
"allow_manual_entry": true, "is_multi_select": false, "input_type": "default"},
"presence_penalty": {"type": ["double"], "default": 0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "stop": {"type":
["list"], "default": "", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "temperature": {"type": ["double"], "default": 1,
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"top_p": {"type": ["double"], "default": 1, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use OpenAI GPT-4V to leverage
vision ability.", "module": "promptflow.tools.openai_gpt4v", "class_name":
"OpenAI", "function": "chat", "is_builtin": true, "package": "promptflow-tools",
"package_version": "0.0.216", "default_prompt": "# system:\nAs an AI assistant,
your task involves interpreting images and responding to questions about the
image.\nRemember to provide accurate answers based on the information present
in the image.\n\n# user:\nCan you tell me what the image depicts?\n\n",
"enable_kwargs": false, "tool_state": "stable"}, {"name": "Serp API", "type":
"python", "inputs": {"connection": {"type": ["SerpConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "engine": {"type":
["string"], "default": "google", "enum": ["google", "bing"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "location": {"type":
["string"], "default": "", "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "num": {"type": ["int"], "default": "10",
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"query": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "safe": {"type": ["string"], "default": "off",
"enum": ["active", "off"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use Serp API to obtain search
results from a specific search engine.", "module": "promptflow.tools.serpapi",
"class_name": "SerpAPI", "function": "search", "is_builtin": true, "package":
"promptflow-tools", "package_version": "0.0.216", "enable_kwargs": false,
"tool_state": "stable"}, {"name": "Faiss Index Lookup", "type": "python",
"inputs": {"path": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "top_k": {"type": ["int"], "default": "3",
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"vector": {"type": ["list"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Search vector based query
from the FAISS index file.", "module": "promptflow_vectordb.tool.faiss_index_lookup",
"class_name": "FaissIndexLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Vector DB Lookup", "type": "python",
"inputs": {"class_name": {"type": ["string"], "enabled_by": "connection",
"enabled_by_type": ["WeaviateConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "collection_name": {"type": ["string"], "enabled_by":
"connection", "enabled_by_type": ["QdrantConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "connection": {"type":
["CognitiveSearchConnection", "QdrantConnection", "WeaviateConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "index_name": {"type":
["string"], "enabled_by": "connection", "enabled_by_type": ["CognitiveSearchConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"search_filters": {"type": ["object"], "enabled_by": "connection", "enabled_by_type":
["CognitiveSearchConnection", "QdrantConnection"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "default"}, "search_params": {"type":
["object"], "enabled_by": "connection", "enabled_by_type": ["CognitiveSearchConnection",
"QdrantConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "text_field": {"type": ["string"], "enabled_by":
"connection", "enabled_by_type": ["CognitiveSearchConnection", "QdrantConnection",
"WeaviateConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "top_k": {"type": ["int"], "default": "3", "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "vector": {"type":
["list"], "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "vector_field": {"type": ["string"], "enabled_by": "connection",
"enabled_by_type": ["CognitiveSearchConnection"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "default"}}, "description": "Search
vector based query from existing Vector Database.", "module": "promptflow_vectordb.tool.vector_db_lookup",
"class_name": "VectorDBLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Vector Index Lookup", "type": "python",
"inputs": {"path": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "query": {"type": ["object"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "top_k": {"type":
["int"], "default": "3", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}}, "description": "Search text or vector based query
from AzureML Vector Index.", "module": "promptflow_vectordb.tool.vector_index_lookup",
"class_name": "VectorIndexLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "calculate_accuracy.py", "type":
"python", "inputs": {"grades": {"type": ["object"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}}, "source": "calculate_accuracy.py",
"function": "calculate_accuracy", "is_builtin": false, "enable_kwargs": false,
"tool_state": "stable"}, {"name": "grade.py", "type": "python", "inputs":
{"groundtruth": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "prediction": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}}, "source": "grade.py",
"function": "grade", "is_builtin": false, "enable_kwargs": false, "tool_state":
"stable"}], "inputs": {"groundtruth": {"type": "string", "default": "APP",
"description": "Please specify the groundtruth column, which contains the
true label to the outputs that your flow produces.", "is_chat_input": false},
"prediction": {"type": "string", "default": "APP", "description": "Please
specify the prediction column, which contains the predicted outputs that your
flow produces.", "is_chat_input": false}}, "outputs": {"grade": {"type": "string",
"reference": "${grade.output}", "evaluation_only": false, "is_chat_output":
false}}}, "flowRunResourceId": "azureml://locations/eastus/workspaces/00000/flows/eval_run_name/flowRuns/eval_run_name",
"flowRunId": "eval_run_name", "flowRunDisplayName": "eval_run_name", "batchDataInput":
{}, "flowRunType": "FlowRun", "flowType": "Default", "runtimeName": "test-runtime-ci",
"inputsMapping": {"groundtruth": "${run.inputs.url}", "prediction": "${run.outputs.category}"},
"outputDatastoreName": "workspaceblobstore", "childRunBasePath": "promptflow/PromptFlowArtifacts/eval_run_name/flow_artifacts",
"flowDagFileRelativePath": "flow.dag.yaml", "flowSnapshotId": "07c78456-f714-4df6-9398-0dc36e95ed2c",
"studioPortalEndpoint": "https://ml.azure.com/runs/eval_run_name?wsid=/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000"}'
headers:
connection:
- keep-alive
content-length:
- '13745'
content-type:
- application/json; charset=utf-8
strict-transport-security:
- max-age=15724800; includeSubDomains; preload
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '0.225'
status:
code: 200
message: OK
- request:
body: '{"runId": "batch_run_name", "selectRunMetadata": true, "selectRunDefinition":
true, "selectJobSpecification": true}'
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
Content-Length:
- '137'
Content-Type:
- application/json
User-Agent:
- python-requests/2.31.0
method: POST
uri: https://eastus.api.azureml.ms/history/v1.0/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/rundata
response:
body:
string: '{"runMetadata": {"runNumber": 1705047531, "rootRunId": "batch_run_name",
"createdUtc": "2024-01-12T08:18:51.407626+00:00", "createdBy": {"userObjectId":
"00000000-0000-0000-0000-000000000000", "userPuId": null, "userIdp": "https://sts.windows.net/00000000-0000-0000-0000-000000000000/",
"userAltSecId": null, "userIss": "https://sts.windows.net/00000000-0000-0000-0000-000000000000/",
"userTenantId": "00000000-0000-0000-0000-000000000000", "userName": "4cbd0e2e-aae4-4099-b4ba-94d3a4910587",
"upn": null}, "userId": "00000000-0000-0000-0000-000000000000", "token": null,
"tokenExpiryTimeUtc": null, "error": null, "warnings": null, "revision": 6,
"statusRevision": 3, "runUuid": "9c4b2e54-2cee-4251-bafd-721d0ce00cde", "parentRunUuid":
null, "rootRunUuid": "9c4b2e54-2cee-4251-bafd-721d0ce00cde", "lastStartTimeUtc":
null, "currentComputeTime": null, "computeDuration": "00:00:06.6774532", "effectiveStartTimeUtc":
null, "lastModifiedBy": {"userObjectId": "00000000-0000-0000-0000-000000000000",
"userPuId": null, "userIdp": "https://sts.windows.net/00000000-0000-0000-0000-000000000000/",
"userAltSecId": null, "userIss": "https://sts.windows.net/00000000-0000-0000-0000-000000000000/",
"userTenantId": "00000000-0000-0000-0000-000000000000", "userName": "18a66f5f-dbdf-4c17-9dd7-1634712a9cbe",
"upn": null}, "lastModifiedUtc": "2024-01-12T08:19:14.3434706+00:00", "duration":
"00:00:06.6774532", "cancelationReason": null, "currentAttemptId": 1, "runId":
"batch_run_name", "parentRunId": null, "experimentId": "d30efbeb-f81d-4cfa-b5cc-a0570a049009",
"status": "Completed", "startTimeUtc": "2024-01-12T08:19:08.511381+00:00",
"endTimeUtc": "2024-01-12T08:19:15.1888342+00:00", "scheduleId": null, "displayName":
"batch_run_name", "name": null, "dataContainerId": "dcid.batch_run_name",
"description": null, "hidden": false, "runType": "azureml.promptflow.FlowRun",
"runTypeV2": {"orchestrator": null, "traits": [], "attribution": "PromptFlow",
"computeType": "AmlcDsi"}, "properties": {"azureml.promptflow.runtime_name":
"test-runtime-ci", "azureml.promptflow.runtime_version": "20231204.v4", "azureml.promptflow.definition_file_name":
"flow.dag.yaml", "azureml.promptflow.session_id": "4dd8f4d5f44dfeb817d3438cf84bd739215d87afd9458597",
"azureml.promptflow.flow_lineage_id": "af1a6951de9be2ce13d3b58b23dbd8b6a0cd8fd4918ad9cb22b28fb8395fbcb0",
"azureml.promptflow.node_variant": "${summarize_text_content.variant_0}",
"azureml.promptflow.flow_definition_datastore_name": "workspaceblobstore",
"azureml.promptflow.flow_definition_blob_path": "LocalUpload/a1fa6ef1ead7ff3ce76b36250f6f5461/web_classification/flow.dag.yaml",
"azureml.promptflow.input_data": "azureml://datastores/workspaceblobstore/paths/LocalUpload/74c11bba717480b2d6b04b8e746d09d7/webClassification3.jsonl",
"azureml.promptflow.inputs_mapping": "{\"url\":\"${data.url}\"}", "_azureml.evaluation_run":
"promptflow.BatchRun", "azureml.promptflow.snapshot_id": "c956855e-d291-4714-a3df-91c99c974de9",
"azureml.promptflow.total_tokens": "2403", "_azureml.evaluate_artifacts":
"[{\"path\": \"instance_results.jsonl\", \"type\": \"table\"}]"}, "parameters":
{}, "actionUris": {}, "scriptName": null, "target": null, "uniqueChildRunComputeTargets":
[], "tags": {}, "settings": {}, "services": {}, "inputDatasets": [], "outputDatasets":
[], "runDefinition": null, "jobSpecification": null, "primaryMetricName":
null, "createdFrom": null, "cancelUri": null, "completeUri": null, "diagnosticsUri":
null, "computeRequest": null, "compute": null, "retainForLifetimeOfWorkspace":
false, "queueingInfo": null, "inputs": null, "outputs": {"debug_info": {"assetId":
"azureml://locations/eastus/workspaces/00000/data/azureml_batch_run_name_output_data_debug_info/versions/1",
"type": "UriFolder"}, "flow_outputs": {"assetId": "azureml://locations/eastus/workspaces/00000/data/azureml_batch_run_name_output_data_flow_outputs/versions/1",
"type": "UriFolder"}}}, "runDefinition": null, "jobSpecification": null, "systemSettings":
null}'
headers:
connection:
- keep-alive
content-length:
- '4730'
content-type:
- application/json; charset=utf-8
strict-transport-security:
- max-age=15724800; includeSubDomains; preload
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '0.046'
status:
code: 200
message: OK
- request:
body: '{"runId": "eval_run_name", "selectRunMetadata": true, "selectRunDefinition":
true, "selectJobSpecification": true}'
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
Content-Length:
- '137'
Content-Type:
- application/json
User-Agent:
- python-requests/2.31.0
method: POST
uri: https://eastus.api.azureml.ms/history/v1.0/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/rundata
response:
body:
string: '{"runMetadata": {"runNumber": 1705047579, "rootRunId": "eval_run_name",
"createdUtc": "2024-01-12T08:19:39.1600906+00:00", "createdBy": {"userObjectId":
"00000000-0000-0000-0000-000000000000", "userPuId": null, "userIdp": "https://sts.windows.net/00000000-0000-0000-0000-000000000000/",
"userAltSecId": null, "userIss": "https://sts.windows.net/00000000-0000-0000-0000-000000000000/",
"userTenantId": "00000000-0000-0000-0000-000000000000", "userName": "4cbd0e2e-aae4-4099-b4ba-94d3a4910587",
"upn": null}, "userId": "00000000-0000-0000-0000-000000000000", "token": null,
"tokenExpiryTimeUtc": null, "error": null, "warnings": null, "revision": 6,
"statusRevision": 3, "runUuid": "603a145c-daa6-48f3-bde4-94d59fa20de4", "parentRunUuid":
null, "rootRunUuid": "603a145c-daa6-48f3-bde4-94d59fa20de4", "lastStartTimeUtc":
null, "currentComputeTime": null, "computeDuration": "00:00:04.9882119", "effectiveStartTimeUtc":
null, "lastModifiedBy": {"userObjectId": "00000000-0000-0000-0000-000000000000",
"userPuId": null, "userIdp": "https://sts.windows.net/00000000-0000-0000-0000-000000000000/",
"userAltSecId": null, "userIss": "https://sts.windows.net/00000000-0000-0000-0000-000000000000/",
"userTenantId": "00000000-0000-0000-0000-000000000000", "userName": "18a66f5f-dbdf-4c17-9dd7-1634712a9cbe",
"upn": null}, "lastModifiedUtc": "2024-01-12T08:20:00.8511921+00:00", "duration":
"00:00:04.9882119", "cancelationReason": null, "currentAttemptId": 1, "runId":
"eval_run_name", "parentRunId": null, "experimentId": "7bdec279-f99c-4ed3-b0b8-dd75698b8fd0",
"status": "Completed", "startTimeUtc": "2024-01-12T08:19:56.9171272+00:00",
"endTimeUtc": "2024-01-12T08:20:01.9053391+00:00", "scheduleId": null, "displayName":
"eval_run_name", "name": null, "dataContainerId": "dcid.eval_run_name", "description":
null, "hidden": false, "runType": "azureml.promptflow.FlowRun", "runTypeV2":
{"orchestrator": null, "traits": [], "attribution": "PromptFlow", "computeType":
"AmlcDsi"}, "properties": {"azureml.promptflow.runtime_name": "test-runtime-ci",
"azureml.promptflow.runtime_version": "20231204.v4", "azureml.promptflow.definition_file_name":
"flow.dag.yaml", "azureml.promptflow.session_id": "f8e4236a4e78e7f7125bbd811ec7976cb330412723a530f8",
"azureml.promptflow.flow_lineage_id": "26c575d863a85371ef937096728441d8c68c3e737b5a1bfeae5ac8f3b9ccb048",
"azureml.promptflow.flow_definition_datastore_name": "workspaceblobstore",
"azureml.promptflow.flow_definition_blob_path": "LocalUpload/1aa3064d06f6170abbc488cc35c713b9/eval-classification-accuracy/flow.dag.yaml",
"azureml.promptflow.input_run_id": "batch_run_name", "azureml.promptflow.inputs_mapping":
"{\"groundtruth\":\"${run.inputs.url}\",\"prediction\":\"${run.outputs.category}\"}",
"_azureml.evaluation_run": "promptflow.BatchRun", "azureml.promptflow.snapshot_id":
"07c78456-f714-4df6-9398-0dc36e95ed2c", "azureml.promptflow.total_tokens":
"0", "_azureml.evaluate_artifacts": "[{\"path\": \"instance_results.jsonl\",
\"type\": \"table\"}]"}, "parameters": {}, "actionUris": {}, "scriptName":
null, "target": null, "uniqueChildRunComputeTargets": [], "tags": {}, "settings":
{}, "services": {}, "inputDatasets": [], "outputDatasets": [], "runDefinition":
null, "jobSpecification": null, "primaryMetricName": null, "createdFrom":
null, "cancelUri": null, "completeUri": null, "diagnosticsUri": null, "computeRequest":
null, "compute": null, "retainForLifetimeOfWorkspace": false, "queueingInfo":
null, "inputs": null, "outputs": {"debug_info": {"assetId": "azureml://locations/eastus/workspaces/00000/data/azureml_eval_run_name_output_data_debug_info/versions/1",
"type": "UriFolder"}, "flow_outputs": {"assetId": "azureml://locations/eastus/workspaces/00000/data/azureml_eval_run_name_output_data_flow_outputs/versions/1",
"type": "UriFolder"}}}, "runDefinition": null, "jobSpecification": null, "systemSettings":
null}'
headers:
connection:
- keep-alive
content-length:
- '4639'
content-type:
- application/json; charset=utf-8
strict-transport-security:
- max-age=15724800; includeSubDomains; preload
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '0.040'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
Content-Type:
- application/json
User-Agent:
- promptflow-sdk/0.0.1 azsdk-python-azuremachinelearningdesignerserviceclient/unknown
Python/3.10.13 (Windows-10-10.0.22631-SP0)
method: GET
uri: https://eastus.api.azureml.ms/flow/api/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/BulkRuns/batch_run_name/logContent
response:
body:
string: '"2024-01-12 08:18:56 +0000 134 promptflow-runtime INFO [batch_run_name]
Receiving v2 bulk run request 76a57ee3-bb6d-4468-aa09-8cf32cd9cbc9: {\"flow_id\":
\"batch_run_name\", \"flow_run_id\": \"batch_run_name\", \"flow_source\":
{\"flow_source_type\": 1, \"flow_source_info\": {\"snapshot_id\": \"c956855e-d291-4714-a3df-91c99c974de9\"},
\"flow_dag_file\": \"flow.dag.yaml\"}, \"connections\": \"**data_scrubbed**\",
\"log_path\": \"https://promptfloweast4063704120.blob.core.windows.net/azureml/ExperimentRun/dcid.batch_run_name/logs/azureml/executionlogs.txt?sv=2019-07-07&sr=b&sig=**data_scrubbed**&skoid=55b92eba-d7c7-4afd-ab76-7bb1cd345283&sktid=00000000-0000-0000-0000-000000000000&skt=2024-01-12T07%3A46%3A24Z&ske=2024-01-13T15%3A56%3A24Z&sks=b&skv=2019-07-07&st=2024-01-12T08%3A08%3A55Z&se=2024-01-12T16%3A18%3A55Z&sp=rcw\",
\"app_insights_instrumentation_key\": \"InstrumentationKey=**data_scrubbed**;IngestionEndpoint=https://eastus-6.in.applicationinsights.azure.com/;LiveEndpoint=https://eastus.livediagnostics.monitor.azure.com/\",
\"data_inputs\": {\"data\": \"azureml://datastores/workspaceblobstore/paths/LocalUpload/74c11bba717480b2d6b04b8e746d09d7/webClassification3.jsonl\"},
\"inputs_mapping\": {\"url\": \"${data.url}\"}, \"azure_storage_setting\":
{\"azure_storage_mode\": 1, \"storage_account_name\": \"promptfloweast4063704120\",
\"blob_container_name\": \"azureml-blobstore-3e123da1-f9a5-4c91-9234-8d9ffbb39ff5\",
\"flow_artifacts_root_path\": \"promptflow/PromptFlowArtifacts/batch_run_name\",
\"blob_container_sas_token\": \"?sv=2019-07-07&sr=c&sig=**data_scrubbed**&skoid=55b92eba-d7c7-4afd-ab76-7bb1cd345283&sktid=00000000-0000-0000-0000-000000000000&skt=2024-01-12T08%3A18%3A55Z&ske=2024-01-19T08%3A18%3A55Z&sks=b&skv=2019-07-07&se=2024-01-19T08%3A18%3A55Z&sp=racwl\",
\"output_datastore_name\": \"workspaceblobstore\"}}\n2024-01-12 08:18:56 +0000 134
promptflow-runtime INFO Runtime version: 20231204.v4. PromptFlow version:
1.2.0rc1\n2024-01-12 08:18:56 +0000 134 promptflow-runtime INFO Updating
batch_run_name to Status.Preparing...\n2024-01-12 08:18:56 +0000 134 promptflow-runtime
INFO Downloading snapshot to /mnt/host/service/app/38343/requests/batch_run_name\n2024-01-12
08:18:56 +0000 134 promptflow-runtime INFO Get snapshot sas url for
c956855e-d291-4714-a3df-91c99c974de9...\n2024-01-12 08:19:02 +0000 134
promptflow-runtime INFO Downloading snapshot c956855e-d291-4714-a3df-91c99c974de9
from uri https://promptfloweast4063704120.blob.core.windows.net/snapshotzips/promptflow-eastus:3e123da1-f9a5-4c91-9234-8d9ffbb39ff5:snapshotzip/c956855e-d291-4714-a3df-91c99c974de9.zip...\n2024-01-12
08:19:02 +0000 134 promptflow-runtime INFO Downloaded file /mnt/host/service/app/38343/requests/batch_run_name/c956855e-d291-4714-a3df-91c99c974de9.zip
with size 5027 for snapshot c956855e-d291-4714-a3df-91c99c974de9.\n2024-01-12
08:19:02 +0000 134 promptflow-runtime INFO Download snapshot c956855e-d291-4714-a3df-91c99c974de9
completed.\n2024-01-12 08:19:02 +0000 134 promptflow-runtime INFO Successfully
download snapshot to /mnt/host/service/app/38343/requests/batch_run_name\n2024-01-12
08:19:02 +0000 134 promptflow-runtime INFO About to execute a python
flow.\n2024-01-12 08:19:02 +0000 134 promptflow-runtime INFO Use spawn
method to start child process.\n2024-01-12 08:19:03 +0000 134 promptflow-runtime
INFO Starting to check process 4227 status for run batch_run_name\n2024-01-12
08:19:03 +0000 134 promptflow-runtime INFO Start checking run status
for run batch_run_name\n2024-01-12 08:19:06 +0000 4227 promptflow-runtime
INFO [134--4227] Start processing flowV2......\n2024-01-12 08:19:07 +0000 4227
promptflow-runtime INFO Runtime version: 20231204.v4. PromptFlow version:
1.2.0rc1\n2024-01-12 08:19:07 +0000 4227 promptflow-runtime INFO Setting
mlflow tracking uri...\n2024-01-12 08:19:07 +0000 4227 promptflow-runtime
INFO Validating ''AzureML Data Scientist'' user authentication...\n2024-01-12
08:19:07 +0000 4227 promptflow-runtime INFO Successfully validated
''AzureML Data Scientist'' user authentication.\n2024-01-12 08:19:07 +0000 4227
promptflow-runtime INFO Using AzureMLRunStorageV2\n2024-01-12 08:19:07
+0000 4227 promptflow-runtime INFO Setting mlflow tracking uri to ''azureml://eastus.api.azureml.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/promptflow-eastus''\n2024-01-12
08:19:07 +0000 4227 promptflow-runtime INFO Initialized blob service
client for AzureMLRunTracker.\n2024-01-12 08:19:07 +0000 4227 promptflow-runtime
INFO Setting mlflow tracking uri to ''azureml://eastus.api.azureml.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/promptflow-eastus''\n2024-01-12
08:19:08 +0000 4227 promptflow-runtime INFO Resolve data from url finished
in 0.49149388913065195 seconds\n2024-01-12 08:19:08 +0000 4227 promptflow-runtime
INFO Starting the aml run ''batch_run_name''...\n2024-01-12 08:19:08 +0000 4227
execution.bulk INFO Using fork, process count: 3\n2024-01-12 08:19:08
+0000 4270 execution.bulk INFO Process 4270 started.\n2024-01-12
08:19:08 +0000 4274 execution.bulk INFO Process 4274 started.\n2024-01-12
08:19:08 +0000 4279 execution.bulk INFO Process 4279 started.\n2024-01-12
08:19:08 +0000 4227 execution.bulk INFO Process name: ForkProcess-42:3,
Process id: 4270, Line number: 0 start execution.\n2024-01-12 08:19:08 +0000 4227
execution.bulk INFO Process name: ForkProcess-42:2, Process id: 4274,
Line number: 1 start execution.\n2024-01-12 08:19:08 +0000 4227 execution.bulk INFO Process
name: ForkProcess-42:4, Process id: 4279, Line number: 2 start execution.\n2024-01-12
08:19:10 +0000 4227 execution.bulk INFO Process name: ForkProcess-42:2,
Process id: 4274, Line number: 1 completed.\n2024-01-12 08:19:10 +0000 4227
execution.bulk INFO Finished 1 / 3 lines.\n2024-01-12 08:19:10 +0000 4227
execution.bulk INFO Average execution time for completed lines: 1.61
seconds. Estimated time for incomplete lines: 3.22 seconds.\n2024-01-12 08:19:10
+0000 4227 execution.bulk INFO Process name: ForkProcess-42:4,
Process id: 4279, Line number: 2 completed.\n2024-01-12 08:19:10 +0000 4227
execution.bulk INFO Finished 2 / 3 lines.\n2024-01-12 08:19:10 +0000 4227
execution.bulk INFO Average execution time for completed lines: 0.82
seconds. Estimated time for incomplete lines: 0.82 seconds.\n2024-01-12 08:19:10
+0000 4227 execution.bulk INFO Process name: ForkProcess-42:3,
Process id: 4270, Line number: 0 completed.\n2024-01-12 08:19:10 +0000 4227
execution.bulk INFO Finished 3 / 3 lines.\n2024-01-12 08:19:10 +0000 4227
execution.bulk INFO Average execution time for completed lines: 0.62
seconds. Estimated time for incomplete lines: 0.0 seconds.\n2024-01-12 08:19:14
+0000 4227 execution.bulk INFO Upload status summary metrics for
run batch_run_name finished in 2.5736593334004283 seconds\n2024-01-12 08:19:14
+0000 4227 promptflow-runtime INFO Successfully write run properties
{\"azureml.promptflow.total_tokens\": 2403, \"_azureml.evaluate_artifacts\":
\"[{\\\"path\\\": \\\"instance_results.jsonl\\\", \\\"type\\\": \\\"table\\\"}]\"}
with run id ''batch_run_name''\n2024-01-12 08:19:14 +0000 4227 execution.bulk INFO Upload
RH properties for run batch_run_name finished in 0.06843763962388039 seconds\n2024-01-12
08:19:14 +0000 4227 promptflow-runtime INFO Creating unregistered output
Asset for Run batch_run_name...\n2024-01-12 08:19:14 +0000 4227 promptflow-runtime
INFO Created debug_info Asset: azureml://locations/eastus/workspaces/00000/data/azureml_batch_run_name_output_data_debug_info/versions/1\n2024-01-12
08:19:14 +0000 4227 promptflow-runtime INFO Creating unregistered output
Asset for Run batch_run_name...\n2024-01-12 08:19:14 +0000 4227 promptflow-runtime
INFO Created flow_outputs output Asset: azureml://locations/eastus/workspaces/00000/data/azureml_batch_run_name_output_data_flow_outputs/versions/1\n2024-01-12
08:19:14 +0000 4227 promptflow-runtime INFO Creating Artifact for Run
batch_run_name...\n2024-01-12 08:19:14 +0000 4227 promptflow-runtime INFO Created
instance_results.jsonl Artifact.\n2024-01-12 08:19:14 +0000 4227 promptflow-runtime
INFO Patching batch_run_name...\n2024-01-12 08:19:15 +0000 4227 promptflow-runtime
INFO Ending the aml run ''batch_run_name'' with status ''Completed''...\n2024-01-12
08:19:16 +0000 134 promptflow-runtime INFO Process 4227 finished\n2024-01-12
08:19:16 +0000 134 promptflow-runtime INFO [134] Child process finished!\n2024-01-12
08:19:16 +0000 134 promptflow-runtime INFO [batch_run_name] End processing
bulk run\n2024-01-12 08:19:16 +0000 134 promptflow-runtime INFO Cleanup
working dir /mnt/host/service/app/38343/requests/batch_run_name for bulk run\n"'
headers:
connection:
- keep-alive
content-length:
- '9863'
content-type:
- application/json; charset=utf-8
strict-transport-security:
- max-age=15724800; includeSubDomains; preload
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '0.695'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
Content-Type:
- application/json
User-Agent:
- promptflow-sdk/0.0.1 azsdk-python-azuremachinelearningdesignerserviceclient/unknown
Python/3.10.13 (Windows-10-10.0.22631-SP0)
method: GET
uri: https://eastus.api.azureml.ms/flow/api/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/BulkRuns/eval_run_name/logContent
response:
body:
string: '"2024-01-12 08:19:43 +0000 134 promptflow-runtime INFO [eval_run_name]
Receiving v2 bulk run request 32c97496-d3ae-4e08-a6f2-758a0c6e418f: {\"flow_id\":
\"eval_run_name\", \"flow_run_id\": \"eval_run_name\", \"flow_source\": {\"flow_source_type\":
1, \"flow_source_info\": {\"snapshot_id\": \"07c78456-f714-4df6-9398-0dc36e95ed2c\"},
\"flow_dag_file\": \"flow.dag.yaml\"}, \"log_path\": \"https://promptfloweast4063704120.blob.core.windows.net/azureml/ExperimentRun/dcid.eval_run_name/logs/azureml/executionlogs.txt?sv=2019-07-07&sr=b&sig=**data_scrubbed**&skoid=55b92eba-d7c7-4afd-ab76-7bb1cd345283&sktid=00000000-0000-0000-0000-000000000000&skt=2024-01-12T08%3A01%3A10Z&ske=2024-01-13T16%3A11%3A10Z&sks=b&skv=2019-07-07&st=2024-01-12T08%3A09%3A42Z&se=2024-01-12T16%3A19%3A42Z&sp=rcw\",
\"app_insights_instrumentation_key\": \"InstrumentationKey=**data_scrubbed**;IngestionEndpoint=https://eastus-6.in.applicationinsights.azure.com/;LiveEndpoint=https://eastus.livediagnostics.monitor.azure.com/\",
\"data_inputs\": {\"run.outputs\": \"azureml:/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/data/azureml_batch_run_name_output_data_flow_outputs/versions/1\",
\"run.inputs\": \"azureml://datastores/workspaceblobstore/paths/LocalUpload/74c11bba717480b2d6b04b8e746d09d7/webClassification3.jsonl\"},
\"inputs_mapping\": {\"groundtruth\": \"${run.inputs.url}\", \"prediction\":
\"${run.outputs.category}\"}, \"azure_storage_setting\": {\"azure_storage_mode\":
1, \"storage_account_name\": \"promptfloweast4063704120\", \"blob_container_name\":
\"azureml-blobstore-3e123da1-f9a5-4c91-9234-8d9ffbb39ff5\", \"flow_artifacts_root_path\":
\"promptflow/PromptFlowArtifacts/eval_run_name\", \"blob_container_sas_token\":
\"?sv=2019-07-07&sr=c&sig=**data_scrubbed**&skoid=55b92eba-d7c7-4afd-ab76-7bb1cd345283&sktid=00000000-0000-0000-0000-000000000000&skt=2024-01-12T08%3A19%3A43Z&ske=2024-01-19T08%3A19%3A43Z&sks=b&skv=2019-07-07&se=2024-01-19T08%3A19%3A43Z&sp=racwl\",
\"output_datastore_name\": \"workspaceblobstore\"}}\n2024-01-12 08:19:43 +0000 134
promptflow-runtime INFO Runtime version: 20231204.v4. PromptFlow version:
1.2.0rc1\n2024-01-12 08:19:43 +0000 134 promptflow-runtime INFO Updating
eval_run_name to Status.Preparing...\n2024-01-12 08:19:43 +0000 134 promptflow-runtime
INFO Downloading snapshot to /mnt/host/service/app/38343/requests/eval_run_name\n2024-01-12
08:19:43 +0000 134 promptflow-runtime INFO Get snapshot sas url for
07c78456-f714-4df6-9398-0dc36e95ed2c...\n2024-01-12 08:19:50 +0000 134
promptflow-runtime INFO Downloading snapshot 07c78456-f714-4df6-9398-0dc36e95ed2c
from uri https://promptfloweast4063704120.blob.core.windows.net/snapshotzips/promptflow-eastus:3e123da1-f9a5-4c91-9234-8d9ffbb39ff5:snapshotzip/07c78456-f714-4df6-9398-0dc36e95ed2c.zip...\n2024-01-12
08:19:50 +0000 134 promptflow-runtime INFO Downloaded file /mnt/host/service/app/38343/requests/eval_run_name/07c78456-f714-4df6-9398-0dc36e95ed2c.zip
with size 1243 for snapshot 07c78456-f714-4df6-9398-0dc36e95ed2c.\n2024-01-12
08:19:50 +0000 134 promptflow-runtime INFO Download snapshot 07c78456-f714-4df6-9398-0dc36e95ed2c
completed.\n2024-01-12 08:19:50 +0000 134 promptflow-runtime INFO Successfully
download snapshot to /mnt/host/service/app/38343/requests/eval_run_name\n2024-01-12
08:19:50 +0000 134 promptflow-runtime INFO About to execute a python
flow.\n2024-01-12 08:19:50 +0000 134 promptflow-runtime INFO Use spawn
method to start child process.\n2024-01-12 08:19:50 +0000 134 promptflow-runtime
INFO Starting to check process 4351 status for run eval_run_name\n2024-01-12
08:19:50 +0000 134 promptflow-runtime INFO Start checking run status
for run eval_run_name\n2024-01-12 08:19:54 +0000 4351 promptflow-runtime
INFO [134--4351] Start processing flowV2......\n2024-01-12 08:19:54 +0000 4351
promptflow-runtime INFO Runtime version: 20231204.v4. PromptFlow version:
1.2.0rc1\n2024-01-12 08:19:54 +0000 4351 promptflow-runtime INFO Setting
mlflow tracking uri...\n2024-01-12 08:19:54 +0000 4351 promptflow-runtime
INFO Validating ''AzureML Data Scientist'' user authentication...\n2024-01-12
08:19:55 +0000 4351 promptflow-runtime INFO Successfully validated
''AzureML Data Scientist'' user authentication.\n2024-01-12 08:19:55 +0000 4351
promptflow-runtime INFO Using AzureMLRunStorageV2\n2024-01-12 08:19:55
+0000 4351 promptflow-runtime INFO Setting mlflow tracking uri to ''azureml://eastus.api.azureml.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/promptflow-eastus''\n2024-01-12
08:19:55 +0000 4351 promptflow-runtime INFO Initialized blob service
client for AzureMLRunTracker.\n2024-01-12 08:19:55 +0000 4351 promptflow-runtime
INFO Setting mlflow tracking uri to ''azureml://eastus.api.azureml.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/promptflow-eastus''\n2024-01-12
08:19:56 +0000 4351 promptflow-runtime INFO Resolve data from url finished
in 0.6869602408260107 seconds\n2024-01-12 08:19:56 +0000 4351 promptflow-runtime
INFO Resolve data from url finished in 0.5102318925783038 seconds\n2024-01-12
08:19:56 +0000 4351 promptflow-runtime INFO Starting the aml run ''eval_run_name''...\n2024-01-12
08:19:57 +0000 4351 execution.bulk INFO Using fork, process count:
3\n2024-01-12 08:19:57 +0000 4398 execution.bulk INFO Process 4398
started.\n2024-01-12 08:19:57 +0000 4394 execution.bulk INFO Process
4394 started.\n2024-01-12 08:19:57 +0000 4403 execution.bulk INFO Process
4403 started.\n2024-01-12 08:19:57 +0000 4351 execution.bulk INFO Process
name: ForkProcess-44:4, Process id: 4398, Line number: 0 start execution.\n2024-01-12
08:19:57 +0000 4351 execution.bulk INFO Process name: ForkProcess-44:2,
Process id: 4394, Line number: 1 start execution.\n2024-01-12 08:19:57 +0000 4351
execution.bulk INFO Process name: ForkProcess-44:3, Process id: 4403,
Line number: 2 start execution.\n2024-01-12 08:19:57 +0000 4351 execution.bulk INFO Process
name: ForkProcess-44:4, Process id: 4398, Line number: 0 completed.\n2024-01-12
08:19:57 +0000 4351 execution.bulk INFO Finished 1 / 3 lines.\n2024-01-12
08:19:57 +0000 4351 execution.bulk INFO Average execution time
for completed lines: 0.24 seconds. Estimated time for incomplete lines: 0.48
seconds.\n2024-01-12 08:19:57 +0000 4351 execution.bulk INFO Process
name: ForkProcess-44:3, Process id: 4403, Line number: 2 completed.\n2024-01-12
08:19:57 +0000 4351 execution.bulk INFO Process name: ForkProcess-44:2,
Process id: 4394, Line number: 1 completed.\n2024-01-12 08:19:57 +0000 4351
execution.bulk INFO Finished 3 / 3 lines.\n2024-01-12 08:19:57 +0000 4351
execution.bulk INFO Finished 3 / 3 lines.\n2024-01-12 08:19:57 +0000 4351
execution.bulk INFO Average execution time for completed lines: 0.1
seconds. Estimated time for incomplete lines: 0.0 seconds.\n2024-01-12 08:19:57
+0000 4351 execution.bulk INFO Average execution time for completed
lines: 0.11 seconds. Estimated time for incomplete lines: 0.0 seconds.\n2024-01-12
08:19:58 +0000 4351 execution.bulk INFO Executing aggregation nodes...\n2024-01-12
08:19:58 +0000 4351 execution.bulk INFO Finish executing aggregation
nodes.\n2024-01-12 08:20:00 +0000 4351 execution.bulk INFO Upload
status summary metrics for run eval_run_name finished in 1.5121951373293996
seconds\n2024-01-12 08:20:00 +0000 4351 execution.bulk INFO Upload
metrics for run eval_run_name finished in 0.3903973773121834 seconds\n2024-01-12
08:20:00 +0000 4351 promptflow-runtime INFO Successfully write run
properties {\"azureml.promptflow.total_tokens\": 0, \"_azureml.evaluate_artifacts\":
\"[{\\\"path\\\": \\\"instance_results.jsonl\\\", \\\"type\\\": \\\"table\\\"}]\"}
with run id ''eval_run_name''\n2024-01-12 08:20:00 +0000 4351 execution.bulk INFO Upload
RH properties for run eval_run_name finished in 0.08290723245590925 seconds\n2024-01-12
08:20:00 +0000 4351 promptflow-runtime INFO Creating unregistered output
Asset for Run eval_run_name...\n2024-01-12 08:20:01 +0000 4351 promptflow-runtime
INFO Created debug_info Asset: azureml://locations/eastus/workspaces/00000/data/azureml_eval_run_name_output_data_debug_info/versions/1\n2024-01-12
08:20:01 +0000 4351 promptflow-runtime INFO Creating unregistered output
Asset for Run eval_run_name...\n2024-01-12 08:20:01 +0000 4351 promptflow-runtime
INFO Created flow_outputs output Asset: azureml://locations/eastus/workspaces/00000/data/azureml_eval_run_name_output_data_flow_outputs/versions/1\n2024-01-12
08:20:01 +0000 4351 promptflow-runtime INFO Creating Artifact for Run
eval_run_name...\n2024-01-12 08:20:01 +0000 4351 promptflow-runtime INFO Created
instance_results.jsonl Artifact.\n2024-01-12 08:20:01 +0000 4351 promptflow-runtime
INFO Patching eval_run_name...\n2024-01-12 08:20:01 +0000 4351 promptflow-runtime
INFO Ending the aml run ''eval_run_name'' with status ''Completed''...\n2024-01-12
08:20:03 +0000 134 promptflow-runtime INFO Process 4351 finished\n2024-01-12
08:20:03 +0000 134 promptflow-runtime INFO [134] Child process finished!\n2024-01-12
08:20:03 +0000 134 promptflow-runtime INFO [eval_run_name] End processing
bulk run\n2024-01-12 08:20:03 +0000 134 promptflow-runtime INFO Cleanup
working dir /mnt/host/service/app/38343/requests/eval_run_name for bulk run\n"'
headers:
connection:
- keep-alive
content-length:
- '10628'
content-type:
- application/json; charset=utf-8
strict-transport-security:
- max-age=15724800; includeSubDomains; preload
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '0.856'
status:
code: 200
message: OK
version: 1
| promptflow/src/promptflow/tests/test_configs/recordings/test_run_operations_TestFlowRun_test_basic_evaluation_without_data.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/recordings/test_run_operations_TestFlowRun_test_basic_evaluation_without_data.yaml",
"repo_id": "promptflow",
"token_count": 85951
} | 68 |
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.0 azsdk-python-mgmt-machinelearningservices/0.1.0
Python/3.11.5 (Windows-10-10.0.22621-SP0)
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000
response:
body:
string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000",
"name": "00000", "type": "Microsoft.MachineLearningServices/workspaces", "location":
"eastus", "tags": {}, "etag": null, "kind": "Default", "sku": {"name": "Basic",
"tier": "Basic"}, "properties": {"discoveryUrl": "https://eastus.api.azureml.ms/discovery"}}'
headers:
cache-control:
- no-cache
content-length:
- '3630'
content-type:
- application/json; charset=utf-8
expires:
- '-1'
pragma:
- no-cache
strict-transport-security:
- max-age=31536000; includeSubDomains
transfer-encoding:
- chunked
vary:
- Accept-Encoding,Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '0.030'
status:
code: 200
message: OK
- 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.0 azsdk-python-mgmt-machinelearningservices/0.1.0
Python/3.11.5 (Windows-10-10.0.22621-SP0)
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores?count=30&isDefault=true&orderByAsc=false
response:
body:
string: '{"value": [{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore",
"name": "workspaceblobstore", "type": "Microsoft.MachineLearningServices/workspaces/datastores",
"properties": {"description": null, "tags": null, "properties": null, "isDefault":
true, "credentials": {"credentialsType": "AccountKey"}, "intellectualProperty":
null, "subscriptionId": "00000000-0000-0000-0000-000000000000", "resourceGroup":
"00000", "datastoreType": "AzureBlob", "accountName": "fake_account_name",
"containerName": "fake-container-name", "endpoint": "core.windows.net", "protocol":
"https", "serviceDataAccessAuthIdentity": "WorkspaceSystemAssignedIdentity"},
"systemData": {"createdAt": "2023-04-08T02:53:06.5886442+00:00", "createdBy":
"779301c0-18b2-4cdc-801b-a0a3368fee0a", "createdByType": "Application", "lastModifiedAt":
"2023-04-08T02:53:07.521127+00:00", "lastModifiedBy": "779301c0-18b2-4cdc-801b-a0a3368fee0a",
"lastModifiedByType": "Application"}}]}'
headers:
cache-control:
- no-cache
content-length:
- '1372'
content-type:
- application/json; charset=utf-8
expires:
- '-1'
pragma:
- no-cache
strict-transport-security:
- max-age=31536000; includeSubDomains
transfer-encoding:
- chunked
vary:
- Accept-Encoding,Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '0.060'
status:
code: 200
message: OK
- 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.0 azsdk-python-mgmt-machinelearningservices/0.1.0
Python/3.11.5 (Windows-10-10.0.22621-SP0)
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore
response:
body:
string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore",
"name": "workspaceblobstore", "type": "Microsoft.MachineLearningServices/workspaces/datastores",
"properties": {"description": null, "tags": null, "properties": null, "isDefault":
true, "credentials": {"credentialsType": "AccountKey"}, "intellectualProperty":
null, "subscriptionId": "00000000-0000-0000-0000-000000000000", "resourceGroup":
"00000", "datastoreType": "AzureBlob", "accountName": "fake_account_name",
"containerName": "fake-container-name", "endpoint": "core.windows.net", "protocol":
"https", "serviceDataAccessAuthIdentity": "WorkspaceSystemAssignedIdentity"},
"systemData": {"createdAt": "2023-04-08T02:53:06.5886442+00:00", "createdBy":
"779301c0-18b2-4cdc-801b-a0a3368fee0a", "createdByType": "Application", "lastModifiedAt":
"2023-04-08T02:53:07.521127+00:00", "lastModifiedBy": "779301c0-18b2-4cdc-801b-a0a3368fee0a",
"lastModifiedByType": "Application"}}'
headers:
cache-control:
- no-cache
content-length:
- '1227'
content-type:
- application/json; charset=utf-8
expires:
- '-1'
pragma:
- no-cache
strict-transport-security:
- max-age=31536000; includeSubDomains
transfer-encoding:
- chunked
vary:
- Accept-Encoding,Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '0.067'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
Content-Length:
- '0'
User-Agent:
- promptflow-sdk/0.0.1 azure-ai-ml/1.12.0 azsdk-python-mgmt-machinelearningservices/0.1.0
Python/3.11.5 (Windows-10-10.0.22621-SP0)
method: POST
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore/listSecrets
response:
body:
string: '{"secretsType": "AccountKey", "key": "dGhpcyBpcyBmYWtlIGtleQ=="}'
headers:
cache-control:
- no-cache
content-length:
- '134'
content-type:
- application/json; charset=utf-8
expires:
- '-1'
pragma:
- no-cache
strict-transport-security:
- max-age=31536000; includeSubDomains
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '0.085'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/xml
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- azsdk-python-storage-blob/12.19.0 Python/3.11.5 (Windows-10-10.0.22621-SP0)
x-ms-date:
- Fri, 19 Jan 2024 08:10:47 GMT
x-ms-version:
- '2023-11-03'
method: HEAD
uri: https://fake_account_name.blob.core.windows.net/fake-container-name/LocalUpload/000000000000000000000000000000000000/env_var_names.jsonl
response:
body:
string: ''
headers:
accept-ranges:
- bytes
content-length:
- '49'
content-md5:
- quXiEreYvPinSj0HsaNa/g==
content-type:
- application/octet-stream
last-modified:
- Wed, 08 Nov 2023 04:26:09 GMT
server:
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
vary:
- Origin
x-ms-blob-type:
- BlockBlob
x-ms-creation-time:
- Wed, 08 Nov 2023 04:26:09 GMT
x-ms-meta-name:
- c4092674-5e53-4c17-b78d-75353ae0edb6
x-ms-meta-upload_status:
- completed
x-ms-meta-version:
- 579021dc-8ac8-4c73-8110-4642bd00c69b
x-ms-version:
- '2023-11-03'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/xml
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- azsdk-python-storage-blob/12.19.0 Python/3.11.5 (Windows-10-10.0.22621-SP0)
x-ms-date:
- Fri, 19 Jan 2024 08:10:50 GMT
x-ms-version:
- '2023-11-03'
method: HEAD
uri: https://fake_account_name.blob.core.windows.net/fake-container-name/az-ml-artifacts/000000000000000000000000000000000000/env_var_names.jsonl
response:
body:
string: ''
headers:
server:
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
transfer-encoding:
- chunked
vary:
- Origin
x-ms-error-code:
- BlobNotFound
x-ms-version:
- '2023-11-03'
status:
code: 404
message: The specified blob does not exist.
- 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.0 azsdk-python-mgmt-machinelearningservices/0.1.0
Python/3.11.5 (Windows-10-10.0.22621-SP0)
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore
response:
body:
string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore",
"name": "workspaceblobstore", "type": "Microsoft.MachineLearningServices/workspaces/datastores",
"properties": {"description": null, "tags": null, "properties": null, "isDefault":
true, "credentials": {"credentialsType": "AccountKey"}, "intellectualProperty":
null, "subscriptionId": "00000000-0000-0000-0000-000000000000", "resourceGroup":
"00000", "datastoreType": "AzureBlob", "accountName": "fake_account_name",
"containerName": "fake-container-name", "endpoint": "core.windows.net", "protocol":
"https", "serviceDataAccessAuthIdentity": "WorkspaceSystemAssignedIdentity"},
"systemData": {"createdAt": "2023-04-08T02:53:06.5886442+00:00", "createdBy":
"779301c0-18b2-4cdc-801b-a0a3368fee0a", "createdByType": "Application", "lastModifiedAt":
"2023-04-08T02:53:07.521127+00:00", "lastModifiedBy": "779301c0-18b2-4cdc-801b-a0a3368fee0a",
"lastModifiedByType": "Application"}}'
headers:
cache-control:
- no-cache
content-length:
- '1227'
content-type:
- application/json; charset=utf-8
expires:
- '-1'
pragma:
- no-cache
strict-transport-security:
- max-age=31536000; includeSubDomains
transfer-encoding:
- chunked
vary:
- Accept-Encoding,Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '0.074'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
Content-Length:
- '0'
User-Agent:
- promptflow-sdk/0.0.1 azure-ai-ml/1.12.0 azsdk-python-mgmt-machinelearningservices/0.1.0
Python/3.11.5 (Windows-10-10.0.22621-SP0)
method: POST
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore/listSecrets
response:
body:
string: '{"secretsType": "AccountKey", "key": "dGhpcyBpcyBmYWtlIGtleQ=="}'
headers:
cache-control:
- no-cache
content-length:
- '134'
content-type:
- application/json; charset=utf-8
expires:
- '-1'
pragma:
- no-cache
strict-transport-security:
- max-age=31536000; includeSubDomains
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '0.122'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/xml
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- azsdk-python-storage-blob/12.19.0 Python/3.11.5 (Windows-10-10.0.22621-SP0)
x-ms-date:
- Fri, 19 Jan 2024 08:11:02 GMT
x-ms-version:
- '2023-11-03'
method: HEAD
uri: https://fake_account_name.blob.core.windows.net/fake-container-name/LocalUpload/000000000000000000000000000000000000/code_with_additional_includes/flow.dag.yaml
response:
body:
string: ''
headers:
accept-ranges:
- bytes
content-length:
- '300'
content-md5:
- JM5HFMAvpAmurbiHjn4gTg==
content-type:
- application/octet-stream
last-modified:
- Fri, 19 Jan 2024 08:00:00 GMT
server:
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
vary:
- Origin
x-ms-blob-type:
- BlockBlob
x-ms-creation-time:
- Fri, 19 Jan 2024 07:59:59 GMT
x-ms-meta-name:
- 10fdeb53-9a64-43e0-8211-9f82a8918f9e
x-ms-meta-upload_status:
- completed
x-ms-meta-version:
- '1'
x-ms-version:
- '2023-11-03'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/xml
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- azsdk-python-storage-blob/12.19.0 Python/3.11.5 (Windows-10-10.0.22621-SP0)
x-ms-date:
- Fri, 19 Jan 2024 08:11:05 GMT
x-ms-version:
- '2023-11-03'
method: HEAD
uri: https://fake_account_name.blob.core.windows.net/fake-container-name/az-ml-artifacts/000000000000000000000000000000000000/code_with_additional_includes/flow.dag.yaml
response:
body:
string: ''
headers:
server:
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
transfer-encoding:
- chunked
vary:
- Origin
x-ms-error-code:
- BlobNotFound
x-ms-version:
- '2023-11-03'
status:
code: 404
message: The specified blob does not exist.
- request:
body: '{"flowDefinitionDataStoreName": "workspaceblobstore", "flowDefinitionBlobPath":
"LocalUpload/000000000000000000000000000000000000/code_with_additional_includes/flow.dag.yaml",
"runId": "name", "runDisplayName": "name", "runExperimentName": "", "batchDataInput":
{"dataUri": "azureml://datastores/workspaceblobstore/paths/LocalUpload/000000000000000000000000000000000000/env_var_names.jsonl"},
"inputsMapping": {}, "connections": {}, "environmentVariables": {}, "runtimeName":
"fake-runtime-name", "sessionId": "000000000000000000000000000000000000000000000000",
"sessionSetupMode": "SystemWait", "flowLineageId": "0000000000000000000000000000000000000000000000000000000000000000",
"runDisplayNameGenerationType": "UserProvidedMacro"}'
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
Content-Length:
- '813'
Content-Type:
- application/json
User-Agent:
- promptflow-sdk/0.0.1 azsdk-python-azuremachinelearningdesignerserviceclient/unknown
Python/3.11.5 (Windows-10-10.0.22621-SP0)
method: POST
uri: https://eastus.api.azureml.ms/flow/api/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/BulkRuns/submit
response:
body:
string: '"name"'
headers:
connection:
- keep-alive
content-length:
- '38'
content-type:
- application/json; charset=utf-8
strict-transport-security:
- max-age=15724800; includeSubDomains; preload
x-content-type-options:
- nosniff
x-request-time:
- '18.310'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- promptflow-sdk/0.0.1 azsdk-python-azuremachinelearningdesignerserviceclient/unknown
Python/3.11.5 (Windows-10-10.0.22621-SP0)
method: GET
uri: https://eastus.api.azureml.ms/flow/api/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/BulkRuns/name
response:
body:
string: '{"flowGraph": {"nodes": [{"name": "print_env", "type": "python", "source":
{"type": "code", "path": "print_env.py"}, "inputs": {"key": "${inputs.key}"},
"tool": "print_env.py", "reduce": false}], "tools": [{"name": "Azure OpenAI
GPT-4 Turbo with Vision", "type": "custom_llm", "inputs": {"connection": {"type":
["AzureOpenAIConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "deployment_name": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "frequency_penalty":
{"type": ["double"], "default": 0, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "max_tokens": {"type": ["int"], "default":
512, "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "presence_penalty": {"type": ["double"], "default": 0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "stop": {"type":
["list"], "default": "", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "temperature": {"type": ["double"], "default": 1,
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"top_p": {"type": ["double"], "default": 1, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use Azure OpenAI GPT-4 Turbo
with Vision to leverage AOAI vision ability.", "module": "promptflow.tools.aoai_gpt4v",
"class_name": "AzureOpenAI", "function": "chat", "icon": {"dark": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAA2ElEQVR4nJXSzW3CQBAF4DUSTjk+Al1AD0ikESslpBIEheRALhEpgAYSWV8OGUublf/yLuP3PPNmdndS+gdwXZrYDmh7fGE/W+wXbaYd8IYm4rxJPnZ0boI3wZcdJxs/n+AwV7DFK7aFyfQdYIMLPvES8YJNf5yp4jMeeEYdWh38gXOR35YGHe5xabvQdsHv6PLi8qV6gycc8YH3iMfQu6Lh4ASr+F5Hh3XwVWnQYzUkVlX1nccplAb1SN6Y/sfgmlK64VS8wimldIv/0yj2QLkHizG0iWP4AVAfQ34DVQONAAAAAElFTkSuQmCC",
"light": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAx0lEQVR4nJWSwQ2CQBBFX0jAcjgqXUgPJNiIsQQrIVCIFy8GC6ABDcGDX7Mus9n1Xz7zZ+fPsLPwH4bUg0dD2wMPcbR48Uxq4AKU4iSTDwZ1LhWXipN/B3V0J6hjBTvgLHZNonewBXrgDpzEvXSIjN0BE3AACmmF4kl5F6tNzcCoLpW0SvGovFvsb4oZ2AANcAOu4ka6axCcINN3rg654sww+CYsPD0OwjcozFNh/Qcd78tqVbCIW+n+Fky472Bh/Q6SYb1EEy8tDzd+9IsVPAAAAABJRU5ErkJggg=="},
"is_builtin": true, "package": "promptflow-tools", "package_version": "1.1.0rc2",
"default_prompt": "# system:\nAs an AI assistant, your task involves interpreting
images and responding to questions about the image.\nRemember to provide accurate
answers based on the information present in the image.\n\n# user:\nCan you
tell me what the image depicts?\n\n", "enable_kwargs":
false, "tool_state": "preview"}, {"name": "Content Safety (Text Analyze)",
"type": "python", "inputs": {"connection": {"type": ["AzureContentSafetyConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"hate_category": {"type": ["string"], "default": "medium_sensitivity", "enum":
["disable", "low_sensitivity", "medium_sensitivity", "high_sensitivity"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"self_harm_category": {"type": ["string"], "default": "medium_sensitivity",
"enum": ["disable", "low_sensitivity", "medium_sensitivity", "high_sensitivity"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"sexual_category": {"type": ["string"], "default": "medium_sensitivity", "enum":
["disable", "low_sensitivity", "medium_sensitivity", "high_sensitivity"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"text": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "violence_category": {"type": ["string"],
"default": "medium_sensitivity", "enum": ["disable", "low_sensitivity", "medium_sensitivity",
"high_sensitivity"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}}, "description": "Use Azure Content Safety to detect
harmful content.", "module": "promptflow.tools.azure_content_safety", "function":
"analyze_text", "is_builtin": true, "package": "promptflow-tools", "package_version":
"1.1.0rc2", "enable_kwargs": false, "deprecated_tools": ["content_safety_text.tools.content_safety_text_tool.analyze_text"],
"tool_state": "stable"}, {"name": "Embedding", "type": "python", "inputs":
{"connection": {"type": ["AzureOpenAIConnection", "OpenAIConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "deployment_name":
{"type": ["string"], "enabled_by": "connection", "enabled_by_type": ["AzureOpenAIConnection"],
"model_list": ["text-embedding-ada-002", "text-search-ada-doc-001", "text-search-ada-query-001"],
"capabilities": {"completion": false, "chat_completion": false, "embeddings":
true}, "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "input": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "model": {"type": ["string"], "enum": ["text-embedding-ada-002",
"text-search-ada-doc-001", "text-search-ada-query-001"], "enabled_by": "connection",
"enabled_by_type": ["OpenAIConnection"], "allow_manual_entry": true, "is_multi_select":
false, "input_type": "default"}}, "description": "Use Open AI''s embedding
model to create an embedding vector representing the input text.", "module":
"promptflow.tools.embedding", "function": "embedding", "is_builtin": true,
"package": "promptflow-tools", "package_version": "1.1.0rc2", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Open Model LLM", "type": "custom_llm",
"inputs": {"api": {"type": ["string"], "enum": ["chat", "completion"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "deployment_name":
{"type": ["string"], "default": "", "dynamic_list": {"func_path": "promptflow.tools.open_model_llm.list_deployment_names",
"func_kwargs": [{"name": "endpoint", "optional": true, "reference": "${inputs.endpoint}",
"type": ["string"]}]}, "allow_manual_entry": true, "is_multi_select": false,
"input_type": "default"}, "endpoint_name": {"type": ["string"], "dynamic_list":
{"func_path": "promptflow.tools.open_model_llm.list_endpoint_names"}, "allow_manual_entry":
true, "is_multi_select": false, "input_type": "default"}, "max_new_tokens":
{"type": ["int"], "default": 500, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "model_kwargs": {"type": ["object"], "default":
"{}", "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default", "advanced": true}, "temperature": {"type": ["double"], "default":
1.0, "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "top_p": {"type": ["double"], "default": 1.0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default", "advanced": true}},
"description": "Use an open model from the Azure Model catalog, deployed to
an AzureML Online Endpoint for LLM Chat or Completion API calls.", "module":
"promptflow.tools.open_model_llm", "class_name": "OpenModelLLM", "function":
"call", "icon": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACgElEQVR4nGWSz2vcVRTFP/e9NzOZ1KDGohASslLEH6VLV0ak4l/QpeDCrfQPcNGliODKnVm4EBdBsIjQIlhciKW0ycKFVCSNbYnjdDLtmPnmO/nO9917XcxMkjYX3uLx7nnn3HOuMK2Nix4fP78ZdrYXVkLVWjf3l3B1B+HpcjzGFtmqa6cePz7/x0dnn1n5qhj3iBJPYREIURAJuCtpY8PjReDbrf9WG7H1fuefwQU9qKztTcMJT+PNnEFvjGVDBDlSsH6p/9MLzy6+NxwVqI8RAg4IPmWedMckdLYP6O6UpIaQfvyyXG012+e79/ZfHukoS1ISMT2hGTB1RkUmNgQ5QZ0w+a2VWDq73MbdEWmfnnv6UWe7oNzPaLapl5CwuLTXK9WUGBuCjqekzhP+z52ZXOrKMD3OJg0Hh778aiOuvpnYvp05d6GJO4iAO4QAe/eV36/X5LFRV4Zmn+AdkqlL8Vjp3oVioOz+WTPzzYEgsN+fgPLYyJVheSbPPVl2ikeGZRjtG52/8rHuaV9VOlpP2OtKyVndcRVCSqOhsvxa4vW359i6OuKdD+aP8Q4SYPdOzS/flGjt1JUSaMqZ5nwa1Y8qWb/Ud/eZZkHisYezEM0m+fcelDr8F1SqW2LNK6r1jXQwyLzy1hxvrLXZulry7ocL+FS6G4QIu3fG/Px1gdYeW7LIgXU2P/115TOA5G7e3Rmj2aS/m7l5pThiZzrCcE/d1XHzbln373nw7y6veeoUm5KCNKT/IPPwbiY1hYd/l5MIT65BMFt87sU4v9D7/JMflr44uV6hGh1+L4RCkg6z5iK2tAhNLeLsNGwYA4fDYnC/drvuuFxe86NV/x+Ut27g0FvykgAAAABJRU5ErkJggg==",
"is_builtin": true, "package": "promptflow-tools", "package_version": "1.1.0rc2",
"enable_kwargs": false, "tool_state": "stable"}, {"name": "OpenAI GPT-4V",
"type": "custom_llm", "inputs": {"connection": {"type": ["OpenAIConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"frequency_penalty": {"type": ["double"], "default": 0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "max_tokens": {"type":
["int"], "default": 512, "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "model": {"type": ["string"], "enum": ["gpt-4-vision-preview"],
"allow_manual_entry": true, "is_multi_select": false, "input_type": "default"},
"presence_penalty": {"type": ["double"], "default": 0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "stop": {"type":
["list"], "default": "", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "temperature": {"type": ["double"], "default": 1,
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"top_p": {"type": ["double"], "default": 1, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use OpenAI GPT-4V to leverage
vision ability.", "module": "promptflow.tools.openai_gpt4v", "class_name":
"OpenAI", "function": "chat", "icon": {"dark": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAA2ElEQVR4nJXSzW3CQBAF4DUSTjk+Al1AD0ikESslpBIEheRALhEpgAYSWV8OGUublf/yLuP3PPNmdndS+gdwXZrYDmh7fGE/W+wXbaYd8IYm4rxJPnZ0boI3wZcdJxs/n+AwV7DFK7aFyfQdYIMLPvES8YJNf5yp4jMeeEYdWh38gXOR35YGHe5xabvQdsHv6PLi8qV6gycc8YH3iMfQu6Lh4ASr+F5Hh3XwVWnQYzUkVlX1nccplAb1SN6Y/sfgmlK64VS8wimldIv/0yj2QLkHizG0iWP4AVAfQ34DVQONAAAAAElFTkSuQmCC",
"light": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAx0lEQVR4nJWSwQ2CQBBFX0jAcjgqXUgPJNiIsQQrIVCIFy8GC6ABDcGDX7Mus9n1Xz7zZ+fPsLPwH4bUg0dD2wMPcbR48Uxq4AKU4iSTDwZ1LhWXipN/B3V0J6hjBTvgLHZNonewBXrgDpzEvXSIjN0BE3AACmmF4kl5F6tNzcCoLpW0SvGovFvsb4oZ2AANcAOu4ka6axCcINN3rg654sww+CYsPD0OwjcozFNh/Qcd78tqVbCIW+n+Fky472Bh/Q6SYb1EEy8tDzd+9IsVPAAAAABJRU5ErkJggg=="},
"is_builtin": true, "package": "promptflow-tools", "package_version": "1.1.0rc2",
"default_prompt": "# system:\nAs an AI assistant, your task involves interpreting
images and responding to questions about the image.\nRemember to provide accurate
answers based on the information present in the image.\n\n# user:\nCan you
tell me what the image depicts?\n\n", "enable_kwargs":
false, "tool_state": "preview"}, {"name": "Serp API", "type": "python", "inputs":
{"connection": {"type": ["SerpConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "engine": {"type": ["string"], "default":
"google", "enum": ["google", "bing"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "location": {"type": ["string"], "default":
"", "allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"num": {"type": ["int"], "default": "10", "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "query": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "safe": {"type":
["string"], "default": "off", "enum": ["active", "off"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}}, "description":
"Use Serp API to obtain search results from a specific search engine.", "module":
"promptflow.tools.serpapi", "class_name": "SerpAPI", "function": "search",
"is_builtin": true, "package": "promptflow-tools", "package_version": "1.1.0rc2",
"enable_kwargs": false, "tool_state": "stable"}, {"name": "Index Lookup",
"type": "python", "inputs": {"acs_content_field": {"type": ["string"], "enabled_by":
"index_type", "enabled_by_value": ["Azure AI Search"], "dynamic_list": {"func_path":
"promptflow_vectordb.tool.common_index_lookup_utils.list_acs_index_fields",
"func_kwargs": [{"name": "acs_connection", "optional": false, "reference":
"${inputs.acs_index_connection}", "type": ["CognitiveSearchConnection"]},
{"name": "acs_index_name", "optional": false, "reference": "${inputs.acs_index_name}",
"type": ["string"]}, {"default": "Edm.String", "name": "field_data_type",
"optional": false, "type": ["string"]}]}, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "uionly_hidden"}, "acs_embedding_field": {"type": ["string"],
"enabled_by": "index_type", "enabled_by_value": ["Azure AI Search"], "dynamic_list":
{"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_acs_index_fields",
"func_kwargs": [{"name": "acs_connection", "optional": false, "reference":
"${inputs.acs_index_connection}", "type": ["CognitiveSearchConnection"]},
{"name": "acs_index_name", "optional": false, "reference": "${inputs.acs_index_name}",
"type": ["string"]}, {"default": "Collection(Edm.Single)", "name": "field_data_type",
"optional": false, "type": ["string"]}]}, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "uionly_hidden"}, "acs_index_connection": {"type": ["CognitiveSearchConnection"],
"enabled_by": "index_type", "enabled_by_value": ["Azure AI Search"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "uionly_hidden"}, "acs_index_name":
{"type": ["string"], "enabled_by": "index_type", "enabled_by_value": ["Azure
AI Search"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_acs_indices",
"func_kwargs": [{"name": "acs_connection", "optional": false, "reference":
"${inputs.acs_index_connection}", "type": ["CognitiveSearchConnection"]}]},
"allow_manual_entry": false, "is_multi_select": false, "input_type": "uionly_hidden"},
"acs_metadata_field": {"type": ["string"], "enabled_by": "index_type", "enabled_by_value":
["Azure AI Search"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_acs_index_fields",
"func_kwargs": [{"name": "acs_connection", "optional": false, "reference":
"${inputs.acs_index_connection}", "type": ["CognitiveSearchConnection"]},
{"name": "acs_index_name", "optional": false, "reference": "${inputs.acs_index_name}",
"type": ["string"]}, {"default": "Edm.String", "name": "field_data_type",
"optional": false, "type": ["string"]}]}, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "uionly_hidden"}, "aoai_embedding_connection": {"type":
["AzureOpenAIConnection"], "enabled_by": "embedding_type", "enabled_by_value":
["Azure OpenAI"], "allow_manual_entry": false, "is_multi_select": false, "input_type":
"uionly_hidden"}, "embedding_deployment": {"type": ["string"], "enabled_by":
"embedding_type", "enabled_by_value": ["Azure OpenAI"], "dynamic_list": {"func_path":
"promptflow_vectordb.tool.common_index_lookup_utils.list_aoai_embedding_deployments",
"func_kwargs": [{"name": "aoai_connection", "optional": false, "reference":
"${inputs.aoai_embedding_connection}", "type": ["AzurOpenAIConnection"]}]},
"allow_manual_entry": false, "is_multi_select": false, "input_type": "uionly_hidden"},
"embedding_model": {"type": ["string"], "enabled_by": "embedding_type", "enabled_by_value":
["OpenAI", "Hugging Face"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_embedding_models",
"func_kwargs": [{"name": "embedding_type", "optional": false, "reference":
"${inputs.embedding_type}", "type": ["string"]}]}, "allow_manual_entry": false,
"is_multi_select": false, "input_type": "uionly_hidden"}, "embedding_type":
{"type": ["string"], "enabled_by": "index_type", "enabled_by_value": ["Azure
AI Search", "FAISS", "Pinecone"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_available_embedding_types",
"func_kwargs": [{"name": "index_type", "optional": false, "reference": "${inputs.index_type}",
"type": ["string"]}]}, "allow_manual_entry": false, "is_multi_select": false,
"input_type": "uionly_hidden"}, "faiss_index_path": {"type": ["string"], "enabled_by":
"index_type", "enabled_by_value": ["FAISS"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "uionly_hidden"}, "index_type": {"type":
["string"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_available_index_types"},
"allow_manual_entry": false, "is_multi_select": false, "input_type": "uionly_hidden"},
"mlindex_asset_id": {"type": ["string"], "enabled_by": "index_type", "enabled_by_value":
["Registered Index"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_registered_mlindices"},
"allow_manual_entry": false, "is_multi_select": false, "input_type": "uionly_hidden"},
"mlindex_content": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "generated_by": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.forward_mapping",
"func_kwargs": [{"name": "index_type", "reference": "${inputs.index_type}",
"type": ["string"]}, {"name": "mlindex_asset_id", "optional": true, "reference":
"${inputs.mlindex_asset_id}", "type": ["string"]}, {"name": "mlindex_path",
"optional": true, "reference": "${inputs.mlindex_path}", "type": ["string"]},
{"name": "acs_index_connection", "optional": true, "reference": "${inputs.acs_index_connection}",
"type": ["CognitiveSearchConnection"]}, {"name": "acs_index_name", "optional":
true, "reference": "${inputs.acs_index_name}", "type": ["string"]}, {"name":
"acs_content_field", "optional": true, "reference": "${inputs.acs_content_field}",
"type": ["string"]}, {"name": "acs_embedding_field", "optional": true, "reference":
"${inputs.acs_embedding_field}", "type": ["string"]}, {"name": "acs_metadata_field",
"optional": true, "reference": "${inputs.acs_metadata_field}", "type": ["string"]},
{"name": "semantic_configuration", "optional": true, "reference": "${inputs.semantic_configuration}",
"type": ["string"]}, {"name": "faiss_index_path", "optional": true, "reference":
"${inputs.faiss_index_path}", "type": ["string"]}, {"name": "pinecone_index_connection",
"optional": true, "reference": "${inputs.pinecone_index_connection}", "type":
["string"]}, {"name": "pinecone_index_name", "optional": true, "reference":
"${inputs.pinecone_index_name}", "type": ["string"]}, {"name": "pinecone_content_field",
"optional": true, "reference": "${inputs.pinecone_content_field}", "type":
["string"]}, {"name": "pinecone_metadata_field", "optional": true, "reference":
"${inputs.pinecone_metadata_field}", "type": ["string"]}, {"name": "embedding_type",
"optional": true, "reference": "${inputs.embedding_type}", "type": ["string"]},
{"name": "aoai_embedding_connection", "optional": true, "reference": "${inputs.aoai_embedding_connection}",
"type": ["AzureOpenAIConnection"]}, {"name": "oai_embedding_connection", "optional":
true, "reference": "${inputs.oai_embedding_connection}", "type": ["string"]},
{"name": "embedding_model", "optional": true, "reference": "${inputs.embedding_model}",
"type": ["string"]}, {"name": "embedding_deployment", "optional": true, "reference":
"${inputs.embedding_deployment}", "type": ["string"]}], "reverse_func_path":
"promptflow_vectordb.tool.common_index_lookup_utils.reverse_mapping"}, "input_type":
"default"}, "mlindex_path": {"type": ["string"], "enabled_by": "index_type",
"enabled_by_value": ["MLIndex file from path"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "uionly_hidden"}, "oai_embedding_connection":
{"type": ["OpenAIConnection"], "enabled_by": "embedding_type", "enabled_by_value":
["OpenAI"], "allow_manual_entry": false, "is_multi_select": false, "input_type":
"uionly_hidden"}, "pinecone_content_field": {"type": ["string"], "enabled_by":
"index_type", "enabled_by_value": ["Pinecone"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "uionly_hidden"}, "pinecone_index_connection":
{"type": ["PineconeConnection"], "enabled_by": "index_type", "enabled_by_value":
["Pinecone"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_pinecone_connections"},
"allow_manual_entry": false, "is_multi_select": false, "input_type": "uionly_hidden"},
"pinecone_index_name": {"type": ["string"], "enabled_by": "index_type", "enabled_by_value":
["Pinecone"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_pinecone_indices",
"func_kwargs": [{"name": "pinecone_connection_name", "optional": false, "reference":
"${inputs.pinecone_index_connection}", "type": ["string"]}]}, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "uionly_hidden"}, "pinecone_metadata_field":
{"type": ["string"], "enabled_by": "index_type", "enabled_by_value": ["Pinecone"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "uionly_hidden"},
"queries": {"type": ["object"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "query_type": {"type": ["string"], "dynamic_list":
{"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_available_query_types",
"func_kwargs": [{"name": "mlindex_content", "optional": false, "reference":
"${inputs.mlindex_content}", "type": ["string"]}]}, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "semantic_configuration":
{"type": ["string"], "enabled_by": "index_type", "enabled_by_value": ["Azure
AI Search"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_acs_index_semantic_configurations",
"func_kwargs": [{"name": "acs_connection", "optional": false, "reference":
"${inputs.acs_index_connection}", "type": ["CognitiveSearchConnection"]},
{"name": "acs_index_name", "optional": false, "reference": "${inputs.acs_index_name}",
"type": ["string"]}]}, "allow_manual_entry": false, "is_multi_select": false,
"input_type": "uionly_hidden"}, "top_k": {"type": ["int"], "default": 3, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}}, "description":
"Search an AzureML Vector Index for relevant results using one or more text
queries.", "module": "promptflow_vectordb.tool.common_index_lookup", "function":
"search", "is_builtin": true, "package": "promptflow-vectordb", "package_version":
"0.0.1", "enable_kwargs": false, "tool_state": "preview"}, {"name": "Faiss
Index Lookup", "type": "python", "inputs": {"path": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "top_k": {"type":
["int"], "default": "3", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "vector": {"type": ["list"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}}, "description":
"Search vector based query from the FAISS index file.", "module": "promptflow_vectordb.tool.faiss_index_lookup",
"class_name": "FaissIndexLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Vector DB Lookup", "type": "python",
"inputs": {"class_name": {"type": ["string"], "enabled_by": "connection",
"enabled_by_type": ["WeaviateConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "collection_name": {"type": ["string"], "enabled_by":
"connection", "enabled_by_type": ["QdrantConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "connection": {"type":
["CognitiveSearchConnection", "QdrantConnection", "WeaviateConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "index_name": {"type":
["string"], "enabled_by": "connection", "enabled_by_type": ["CognitiveSearchConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"search_filters": {"type": ["object"], "enabled_by": "connection", "enabled_by_type":
["CognitiveSearchConnection", "QdrantConnection"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "default"}, "search_params": {"type":
["object"], "enabled_by": "connection", "enabled_by_type": ["CognitiveSearchConnection",
"QdrantConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "text_field": {"type": ["string"], "enabled_by":
"connection", "enabled_by_type": ["CognitiveSearchConnection", "QdrantConnection",
"WeaviateConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "top_k": {"type": ["int"], "default": "3", "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "vector": {"type":
["list"], "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "vector_field": {"type": ["string"], "enabled_by": "connection",
"enabled_by_type": ["CognitiveSearchConnection"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "default"}}, "description": "Search
vector based query from existing Vector Database.", "module": "promptflow_vectordb.tool.vector_db_lookup",
"class_name": "VectorDBLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Vector Index Lookup", "type": "python",
"inputs": {"path": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "query": {"type": ["object"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "top_k": {"type":
["int"], "default": "3", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}}, "description": "Search text or vector based query
from AzureML Vector Index.", "module": "promptflow_vectordb.tool.vector_index_lookup",
"class_name": "VectorIndexLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "print_env.py", "type": "python",
"inputs": {"key": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "source": "print_env.py", "function": "get_env_var",
"is_builtin": false, "enable_kwargs": false, "tool_state": "stable"}], "inputs":
{"key": {"type": "string", "is_chat_input": false}}, "outputs": {"output":
{"type": "string", "reference": "${print_env.output.value}", "evaluation_only":
false, "is_chat_output": false}}}, "flowRunResourceId": "azureml://locations/eastus/workspaces/00000/flows/name/flowRuns/name",
"flowRunId": "name", "flowRunDisplayName": "name", "batchDataInput": {"dataUri":
"azureml://datastores/workspaceblobstore/paths/LocalUpload/c32a61842e439cecc022ebcff5dc0da4/env_var_names.jsonl"},
"flowRunType": "FlowRun", "flowType": "Default", "runtimeName": "automatic",
"inputsMapping": {}, "outputDatastoreName": "workspaceblobstore", "childRunBasePath":
"promptflow/PromptFlowArtifacts/name/flow_artifacts", "flowDagFileRelativePath":
"flow.dag.yaml", "flowSnapshotId": "f70ec21e-2e5f-4f8a-8877-19d060899638",
"studioPortalEndpoint": "https://ml.azure.com/runs/name?wsid=/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000"}'
headers:
connection:
- keep-alive
content-length:
- '26127'
content-type:
- application/json; charset=utf-8
strict-transport-security:
- max-age=15724800; includeSubDomains; preload
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '1.474'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- promptflow-sdk/0.0.1 azsdk-python-azuremachinelearningdesignerserviceclient/unknown
Python/3.11.5 (Windows-10-10.0.22621-SP0)
method: GET
uri: https://eastus.api.azureml.ms/flow/api/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/BulkRuns/name
response:
body:
string: '{"flowGraph": {"nodes": [{"name": "print_env", "type": "python", "source":
{"type": "code", "path": "print_env.py"}, "inputs": {"key": "${inputs.key}"},
"tool": "print_env.py", "reduce": false}], "tools": [{"name": "Azure OpenAI
GPT-4 Turbo with Vision", "type": "custom_llm", "inputs": {"connection": {"type":
["AzureOpenAIConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "deployment_name": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "frequency_penalty":
{"type": ["double"], "default": 0, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "max_tokens": {"type": ["int"], "default":
512, "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "presence_penalty": {"type": ["double"], "default": 0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "stop": {"type":
["list"], "default": "", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "temperature": {"type": ["double"], "default": 1,
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"top_p": {"type": ["double"], "default": 1, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use Azure OpenAI GPT-4 Turbo
with Vision to leverage AOAI vision ability.", "module": "promptflow.tools.aoai_gpt4v",
"class_name": "AzureOpenAI", "function": "chat", "icon": {"dark": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAA2ElEQVR4nJXSzW3CQBAF4DUSTjk+Al1AD0ikESslpBIEheRALhEpgAYSWV8OGUublf/yLuP3PPNmdndS+gdwXZrYDmh7fGE/W+wXbaYd8IYm4rxJPnZ0boI3wZcdJxs/n+AwV7DFK7aFyfQdYIMLPvES8YJNf5yp4jMeeEYdWh38gXOR35YGHe5xabvQdsHv6PLi8qV6gycc8YH3iMfQu6Lh4ASr+F5Hh3XwVWnQYzUkVlX1nccplAb1SN6Y/sfgmlK64VS8wimldIv/0yj2QLkHizG0iWP4AVAfQ34DVQONAAAAAElFTkSuQmCC",
"light": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAx0lEQVR4nJWSwQ2CQBBFX0jAcjgqXUgPJNiIsQQrIVCIFy8GC6ABDcGDX7Mus9n1Xz7zZ+fPsLPwH4bUg0dD2wMPcbR48Uxq4AKU4iSTDwZ1LhWXipN/B3V0J6hjBTvgLHZNonewBXrgDpzEvXSIjN0BE3AACmmF4kl5F6tNzcCoLpW0SvGovFvsb4oZ2AANcAOu4ka6axCcINN3rg654sww+CYsPD0OwjcozFNh/Qcd78tqVbCIW+n+Fky472Bh/Q6SYb1EEy8tDzd+9IsVPAAAAABJRU5ErkJggg=="},
"is_builtin": true, "package": "promptflow-tools", "package_version": "1.1.0rc2",
"default_prompt": "# system:\nAs an AI assistant, your task involves interpreting
images and responding to questions about the image.\nRemember to provide accurate
answers based on the information present in the image.\n\n# user:\nCan you
tell me what the image depicts?\n\n", "enable_kwargs":
false, "tool_state": "preview"}, {"name": "Content Safety (Text Analyze)",
"type": "python", "inputs": {"connection": {"type": ["AzureContentSafetyConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"hate_category": {"type": ["string"], "default": "medium_sensitivity", "enum":
["disable", "low_sensitivity", "medium_sensitivity", "high_sensitivity"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"self_harm_category": {"type": ["string"], "default": "medium_sensitivity",
"enum": ["disable", "low_sensitivity", "medium_sensitivity", "high_sensitivity"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"sexual_category": {"type": ["string"], "default": "medium_sensitivity", "enum":
["disable", "low_sensitivity", "medium_sensitivity", "high_sensitivity"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"text": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "violence_category": {"type": ["string"],
"default": "medium_sensitivity", "enum": ["disable", "low_sensitivity", "medium_sensitivity",
"high_sensitivity"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}}, "description": "Use Azure Content Safety to detect
harmful content.", "module": "promptflow.tools.azure_content_safety", "function":
"analyze_text", "is_builtin": true, "package": "promptflow-tools", "package_version":
"1.1.0rc2", "enable_kwargs": false, "deprecated_tools": ["content_safety_text.tools.content_safety_text_tool.analyze_text"],
"tool_state": "stable"}, {"name": "Embedding", "type": "python", "inputs":
{"connection": {"type": ["AzureOpenAIConnection", "OpenAIConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "deployment_name":
{"type": ["string"], "enabled_by": "connection", "enabled_by_type": ["AzureOpenAIConnection"],
"model_list": ["text-embedding-ada-002", "text-search-ada-doc-001", "text-search-ada-query-001"],
"capabilities": {"completion": false, "chat_completion": false, "embeddings":
true}, "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "input": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "model": {"type": ["string"], "enum": ["text-embedding-ada-002",
"text-search-ada-doc-001", "text-search-ada-query-001"], "enabled_by": "connection",
"enabled_by_type": ["OpenAIConnection"], "allow_manual_entry": true, "is_multi_select":
false, "input_type": "default"}}, "description": "Use Open AI''s embedding
model to create an embedding vector representing the input text.", "module":
"promptflow.tools.embedding", "function": "embedding", "is_builtin": true,
"package": "promptflow-tools", "package_version": "1.1.0rc2", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Open Model LLM", "type": "custom_llm",
"inputs": {"api": {"type": ["string"], "enum": ["chat", "completion"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "deployment_name":
{"type": ["string"], "default": "", "dynamic_list": {"func_path": "promptflow.tools.open_model_llm.list_deployment_names",
"func_kwargs": [{"name": "endpoint", "optional": true, "reference": "${inputs.endpoint}",
"type": ["string"]}]}, "allow_manual_entry": true, "is_multi_select": false,
"input_type": "default"}, "endpoint_name": {"type": ["string"], "dynamic_list":
{"func_path": "promptflow.tools.open_model_llm.list_endpoint_names"}, "allow_manual_entry":
true, "is_multi_select": false, "input_type": "default"}, "max_new_tokens":
{"type": ["int"], "default": 500, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "model_kwargs": {"type": ["object"], "default":
"{}", "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default", "advanced": true}, "temperature": {"type": ["double"], "default":
1.0, "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "top_p": {"type": ["double"], "default": 1.0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default", "advanced": true}},
"description": "Use an open model from the Azure Model catalog, deployed to
an AzureML Online Endpoint for LLM Chat or Completion API calls.", "module":
"promptflow.tools.open_model_llm", "class_name": "OpenModelLLM", "function":
"call", "icon": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACgElEQVR4nGWSz2vcVRTFP/e9NzOZ1KDGohASslLEH6VLV0ak4l/QpeDCrfQPcNGliODKnVm4EBdBsIjQIlhciKW0ycKFVCSNbYnjdDLtmPnmO/nO9917XcxMkjYX3uLx7nnn3HOuMK2Nix4fP78ZdrYXVkLVWjf3l3B1B+HpcjzGFtmqa6cePz7/x0dnn1n5qhj3iBJPYREIURAJuCtpY8PjReDbrf9WG7H1fuefwQU9qKztTcMJT+PNnEFvjGVDBDlSsH6p/9MLzy6+NxwVqI8RAg4IPmWedMckdLYP6O6UpIaQfvyyXG012+e79/ZfHukoS1ISMT2hGTB1RkUmNgQ5QZ0w+a2VWDq73MbdEWmfnnv6UWe7oNzPaLapl5CwuLTXK9WUGBuCjqekzhP+z52ZXOrKMD3OJg0Hh778aiOuvpnYvp05d6GJO4iAO4QAe/eV36/X5LFRV4Zmn+AdkqlL8Vjp3oVioOz+WTPzzYEgsN+fgPLYyJVheSbPPVl2ikeGZRjtG52/8rHuaV9VOlpP2OtKyVndcRVCSqOhsvxa4vW359i6OuKdD+aP8Q4SYPdOzS/flGjt1JUSaMqZ5nwa1Y8qWb/Ud/eZZkHisYezEM0m+fcelDr8F1SqW2LNK6r1jXQwyLzy1hxvrLXZulry7ocL+FS6G4QIu3fG/Px1gdYeW7LIgXU2P/115TOA5G7e3Rmj2aS/m7l5pThiZzrCcE/d1XHzbln373nw7y6veeoUm5KCNKT/IPPwbiY1hYd/l5MIT65BMFt87sU4v9D7/JMflr44uV6hGh1+L4RCkg6z5iK2tAhNLeLsNGwYA4fDYnC/drvuuFxe86NV/x+Ut27g0FvykgAAAABJRU5ErkJggg==",
"is_builtin": true, "package": "promptflow-tools", "package_version": "1.1.0rc2",
"enable_kwargs": false, "tool_state": "stable"}, {"name": "OpenAI GPT-4V",
"type": "custom_llm", "inputs": {"connection": {"type": ["OpenAIConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"frequency_penalty": {"type": ["double"], "default": 0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "max_tokens": {"type":
["int"], "default": 512, "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "model": {"type": ["string"], "enum": ["gpt-4-vision-preview"],
"allow_manual_entry": true, "is_multi_select": false, "input_type": "default"},
"presence_penalty": {"type": ["double"], "default": 0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "stop": {"type":
["list"], "default": "", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "temperature": {"type": ["double"], "default": 1,
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"top_p": {"type": ["double"], "default": 1, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use OpenAI GPT-4V to leverage
vision ability.", "module": "promptflow.tools.openai_gpt4v", "class_name":
"OpenAI", "function": "chat", "icon": {"dark": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAA2ElEQVR4nJXSzW3CQBAF4DUSTjk+Al1AD0ikESslpBIEheRALhEpgAYSWV8OGUublf/yLuP3PPNmdndS+gdwXZrYDmh7fGE/W+wXbaYd8IYm4rxJPnZ0boI3wZcdJxs/n+AwV7DFK7aFyfQdYIMLPvES8YJNf5yp4jMeeEYdWh38gXOR35YGHe5xabvQdsHv6PLi8qV6gycc8YH3iMfQu6Lh4ASr+F5Hh3XwVWnQYzUkVlX1nccplAb1SN6Y/sfgmlK64VS8wimldIv/0yj2QLkHizG0iWP4AVAfQ34DVQONAAAAAElFTkSuQmCC",
"light": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAx0lEQVR4nJWSwQ2CQBBFX0jAcjgqXUgPJNiIsQQrIVCIFy8GC6ABDcGDX7Mus9n1Xz7zZ+fPsLPwH4bUg0dD2wMPcbR48Uxq4AKU4iSTDwZ1LhWXipN/B3V0J6hjBTvgLHZNonewBXrgDpzEvXSIjN0BE3AACmmF4kl5F6tNzcCoLpW0SvGovFvsb4oZ2AANcAOu4ka6axCcINN3rg654sww+CYsPD0OwjcozFNh/Qcd78tqVbCIW+n+Fky472Bh/Q6SYb1EEy8tDzd+9IsVPAAAAABJRU5ErkJggg=="},
"is_builtin": true, "package": "promptflow-tools", "package_version": "1.1.0rc2",
"default_prompt": "# system:\nAs an AI assistant, your task involves interpreting
images and responding to questions about the image.\nRemember to provide accurate
answers based on the information present in the image.\n\n# user:\nCan you
tell me what the image depicts?\n\n", "enable_kwargs":
false, "tool_state": "preview"}, {"name": "Serp API", "type": "python", "inputs":
{"connection": {"type": ["SerpConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "engine": {"type": ["string"], "default":
"google", "enum": ["google", "bing"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "location": {"type": ["string"], "default":
"", "allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"num": {"type": ["int"], "default": "10", "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "query": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "safe": {"type":
["string"], "default": "off", "enum": ["active", "off"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}}, "description":
"Use Serp API to obtain search results from a specific search engine.", "module":
"promptflow.tools.serpapi", "class_name": "SerpAPI", "function": "search",
"is_builtin": true, "package": "promptflow-tools", "package_version": "1.1.0rc2",
"enable_kwargs": false, "tool_state": "stable"}, {"name": "Index Lookup",
"type": "python", "inputs": {"acs_content_field": {"type": ["string"], "enabled_by":
"index_type", "enabled_by_value": ["Azure AI Search"], "dynamic_list": {"func_path":
"promptflow_vectordb.tool.common_index_lookup_utils.list_acs_index_fields",
"func_kwargs": [{"name": "acs_connection", "optional": false, "reference":
"${inputs.acs_index_connection}", "type": ["CognitiveSearchConnection"]},
{"name": "acs_index_name", "optional": false, "reference": "${inputs.acs_index_name}",
"type": ["string"]}, {"default": "Edm.String", "name": "field_data_type",
"optional": false, "type": ["string"]}]}, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "uionly_hidden"}, "acs_embedding_field": {"type": ["string"],
"enabled_by": "index_type", "enabled_by_value": ["Azure AI Search"], "dynamic_list":
{"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_acs_index_fields",
"func_kwargs": [{"name": "acs_connection", "optional": false, "reference":
"${inputs.acs_index_connection}", "type": ["CognitiveSearchConnection"]},
{"name": "acs_index_name", "optional": false, "reference": "${inputs.acs_index_name}",
"type": ["string"]}, {"default": "Collection(Edm.Single)", "name": "field_data_type",
"optional": false, "type": ["string"]}]}, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "uionly_hidden"}, "acs_index_connection": {"type": ["CognitiveSearchConnection"],
"enabled_by": "index_type", "enabled_by_value": ["Azure AI Search"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "uionly_hidden"}, "acs_index_name":
{"type": ["string"], "enabled_by": "index_type", "enabled_by_value": ["Azure
AI Search"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_acs_indices",
"func_kwargs": [{"name": "acs_connection", "optional": false, "reference":
"${inputs.acs_index_connection}", "type": ["CognitiveSearchConnection"]}]},
"allow_manual_entry": false, "is_multi_select": false, "input_type": "uionly_hidden"},
"acs_metadata_field": {"type": ["string"], "enabled_by": "index_type", "enabled_by_value":
["Azure AI Search"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_acs_index_fields",
"func_kwargs": [{"name": "acs_connection", "optional": false, "reference":
"${inputs.acs_index_connection}", "type": ["CognitiveSearchConnection"]},
{"name": "acs_index_name", "optional": false, "reference": "${inputs.acs_index_name}",
"type": ["string"]}, {"default": "Edm.String", "name": "field_data_type",
"optional": false, "type": ["string"]}]}, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "uionly_hidden"}, "aoai_embedding_connection": {"type":
["AzureOpenAIConnection"], "enabled_by": "embedding_type", "enabled_by_value":
["Azure OpenAI"], "allow_manual_entry": false, "is_multi_select": false, "input_type":
"uionly_hidden"}, "embedding_deployment": {"type": ["string"], "enabled_by":
"embedding_type", "enabled_by_value": ["Azure OpenAI"], "dynamic_list": {"func_path":
"promptflow_vectordb.tool.common_index_lookup_utils.list_aoai_embedding_deployments",
"func_kwargs": [{"name": "aoai_connection", "optional": false, "reference":
"${inputs.aoai_embedding_connection}", "type": ["AzurOpenAIConnection"]}]},
"allow_manual_entry": false, "is_multi_select": false, "input_type": "uionly_hidden"},
"embedding_model": {"type": ["string"], "enabled_by": "embedding_type", "enabled_by_value":
["OpenAI", "Hugging Face"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_embedding_models",
"func_kwargs": [{"name": "embedding_type", "optional": false, "reference":
"${inputs.embedding_type}", "type": ["string"]}]}, "allow_manual_entry": false,
"is_multi_select": false, "input_type": "uionly_hidden"}, "embedding_type":
{"type": ["string"], "enabled_by": "index_type", "enabled_by_value": ["Azure
AI Search", "FAISS", "Pinecone"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_available_embedding_types",
"func_kwargs": [{"name": "index_type", "optional": false, "reference": "${inputs.index_type}",
"type": ["string"]}]}, "allow_manual_entry": false, "is_multi_select": false,
"input_type": "uionly_hidden"}, "faiss_index_path": {"type": ["string"], "enabled_by":
"index_type", "enabled_by_value": ["FAISS"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "uionly_hidden"}, "index_type": {"type":
["string"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_available_index_types"},
"allow_manual_entry": false, "is_multi_select": false, "input_type": "uionly_hidden"},
"mlindex_asset_id": {"type": ["string"], "enabled_by": "index_type", "enabled_by_value":
["Registered Index"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_registered_mlindices"},
"allow_manual_entry": false, "is_multi_select": false, "input_type": "uionly_hidden"},
"mlindex_content": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "generated_by": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.forward_mapping",
"func_kwargs": [{"name": "index_type", "reference": "${inputs.index_type}",
"type": ["string"]}, {"name": "mlindex_asset_id", "optional": true, "reference":
"${inputs.mlindex_asset_id}", "type": ["string"]}, {"name": "mlindex_path",
"optional": true, "reference": "${inputs.mlindex_path}", "type": ["string"]},
{"name": "acs_index_connection", "optional": true, "reference": "${inputs.acs_index_connection}",
"type": ["CognitiveSearchConnection"]}, {"name": "acs_index_name", "optional":
true, "reference": "${inputs.acs_index_name}", "type": ["string"]}, {"name":
"acs_content_field", "optional": true, "reference": "${inputs.acs_content_field}",
"type": ["string"]}, {"name": "acs_embedding_field", "optional": true, "reference":
"${inputs.acs_embedding_field}", "type": ["string"]}, {"name": "acs_metadata_field",
"optional": true, "reference": "${inputs.acs_metadata_field}", "type": ["string"]},
{"name": "semantic_configuration", "optional": true, "reference": "${inputs.semantic_configuration}",
"type": ["string"]}, {"name": "faiss_index_path", "optional": true, "reference":
"${inputs.faiss_index_path}", "type": ["string"]}, {"name": "pinecone_index_connection",
"optional": true, "reference": "${inputs.pinecone_index_connection}", "type":
["string"]}, {"name": "pinecone_index_name", "optional": true, "reference":
"${inputs.pinecone_index_name}", "type": ["string"]}, {"name": "pinecone_content_field",
"optional": true, "reference": "${inputs.pinecone_content_field}", "type":
["string"]}, {"name": "pinecone_metadata_field", "optional": true, "reference":
"${inputs.pinecone_metadata_field}", "type": ["string"]}, {"name": "embedding_type",
"optional": true, "reference": "${inputs.embedding_type}", "type": ["string"]},
{"name": "aoai_embedding_connection", "optional": true, "reference": "${inputs.aoai_embedding_connection}",
"type": ["AzureOpenAIConnection"]}, {"name": "oai_embedding_connection", "optional":
true, "reference": "${inputs.oai_embedding_connection}", "type": ["string"]},
{"name": "embedding_model", "optional": true, "reference": "${inputs.embedding_model}",
"type": ["string"]}, {"name": "embedding_deployment", "optional": true, "reference":
"${inputs.embedding_deployment}", "type": ["string"]}], "reverse_func_path":
"promptflow_vectordb.tool.common_index_lookup_utils.reverse_mapping"}, "input_type":
"default"}, "mlindex_path": {"type": ["string"], "enabled_by": "index_type",
"enabled_by_value": ["MLIndex file from path"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "uionly_hidden"}, "oai_embedding_connection":
{"type": ["OpenAIConnection"], "enabled_by": "embedding_type", "enabled_by_value":
["OpenAI"], "allow_manual_entry": false, "is_multi_select": false, "input_type":
"uionly_hidden"}, "pinecone_content_field": {"type": ["string"], "enabled_by":
"index_type", "enabled_by_value": ["Pinecone"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "uionly_hidden"}, "pinecone_index_connection":
{"type": ["PineconeConnection"], "enabled_by": "index_type", "enabled_by_value":
["Pinecone"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_pinecone_connections"},
"allow_manual_entry": false, "is_multi_select": false, "input_type": "uionly_hidden"},
"pinecone_index_name": {"type": ["string"], "enabled_by": "index_type", "enabled_by_value":
["Pinecone"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_pinecone_indices",
"func_kwargs": [{"name": "pinecone_connection_name", "optional": false, "reference":
"${inputs.pinecone_index_connection}", "type": ["string"]}]}, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "uionly_hidden"}, "pinecone_metadata_field":
{"type": ["string"], "enabled_by": "index_type", "enabled_by_value": ["Pinecone"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "uionly_hidden"},
"queries": {"type": ["object"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "query_type": {"type": ["string"], "dynamic_list":
{"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_available_query_types",
"func_kwargs": [{"name": "mlindex_content", "optional": false, "reference":
"${inputs.mlindex_content}", "type": ["string"]}]}, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "semantic_configuration":
{"type": ["string"], "enabled_by": "index_type", "enabled_by_value": ["Azure
AI Search"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_acs_index_semantic_configurations",
"func_kwargs": [{"name": "acs_connection", "optional": false, "reference":
"${inputs.acs_index_connection}", "type": ["CognitiveSearchConnection"]},
{"name": "acs_index_name", "optional": false, "reference": "${inputs.acs_index_name}",
"type": ["string"]}]}, "allow_manual_entry": false, "is_multi_select": false,
"input_type": "uionly_hidden"}, "top_k": {"type": ["int"], "default": 3, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}}, "description":
"Search an AzureML Vector Index for relevant results using one or more text
queries.", "module": "promptflow_vectordb.tool.common_index_lookup", "function":
"search", "is_builtin": true, "package": "promptflow-vectordb", "package_version":
"0.0.1", "enable_kwargs": false, "tool_state": "preview"}, {"name": "Faiss
Index Lookup", "type": "python", "inputs": {"path": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "top_k": {"type":
["int"], "default": "3", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "vector": {"type": ["list"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}}, "description":
"Search vector based query from the FAISS index file.", "module": "promptflow_vectordb.tool.faiss_index_lookup",
"class_name": "FaissIndexLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Vector DB Lookup", "type": "python",
"inputs": {"class_name": {"type": ["string"], "enabled_by": "connection",
"enabled_by_type": ["WeaviateConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "collection_name": {"type": ["string"], "enabled_by":
"connection", "enabled_by_type": ["QdrantConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "connection": {"type":
["CognitiveSearchConnection", "QdrantConnection", "WeaviateConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "index_name": {"type":
["string"], "enabled_by": "connection", "enabled_by_type": ["CognitiveSearchConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"search_filters": {"type": ["object"], "enabled_by": "connection", "enabled_by_type":
["CognitiveSearchConnection", "QdrantConnection"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "default"}, "search_params": {"type":
["object"], "enabled_by": "connection", "enabled_by_type": ["CognitiveSearchConnection",
"QdrantConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "text_field": {"type": ["string"], "enabled_by":
"connection", "enabled_by_type": ["CognitiveSearchConnection", "QdrantConnection",
"WeaviateConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "top_k": {"type": ["int"], "default": "3", "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "vector": {"type":
["list"], "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "vector_field": {"type": ["string"], "enabled_by": "connection",
"enabled_by_type": ["CognitiveSearchConnection"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "default"}}, "description": "Search
vector based query from existing Vector Database.", "module": "promptflow_vectordb.tool.vector_db_lookup",
"class_name": "VectorDBLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Vector Index Lookup", "type": "python",
"inputs": {"path": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "query": {"type": ["object"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "top_k": {"type":
["int"], "default": "3", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}}, "description": "Search text or vector based query
from AzureML Vector Index.", "module": "promptflow_vectordb.tool.vector_index_lookup",
"class_name": "VectorIndexLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "print_env.py", "type": "python",
"inputs": {"key": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "source": "print_env.py", "function": "get_env_var",
"is_builtin": false, "enable_kwargs": false, "tool_state": "stable"}], "inputs":
{"key": {"type": "string", "is_chat_input": false}}, "outputs": {"output":
{"type": "string", "reference": "${print_env.output.value}", "evaluation_only":
false, "is_chat_output": false}}}, "flowRunResourceId": "azureml://locations/eastus/workspaces/00000/flows/name/flowRuns/name",
"flowRunId": "name", "flowRunDisplayName": "name", "batchDataInput": {"dataUri":
"azureml://datastores/workspaceblobstore/paths/LocalUpload/c32a61842e439cecc022ebcff5dc0da4/env_var_names.jsonl"},
"flowRunType": "FlowRun", "flowType": "Default", "runtimeName": "automatic",
"inputsMapping": {}, "outputDatastoreName": "workspaceblobstore", "childRunBasePath":
"promptflow/PromptFlowArtifacts/name/flow_artifacts", "flowDagFileRelativePath":
"flow.dag.yaml", "flowSnapshotId": "f70ec21e-2e5f-4f8a-8877-19d060899638",
"studioPortalEndpoint": "https://ml.azure.com/runs/name?wsid=/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000"}'
headers:
connection:
- keep-alive
content-length:
- '26127'
content-type:
- application/json; charset=utf-8
strict-transport-security:
- max-age=15724800; includeSubDomains; preload
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '0.426'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- promptflow-sdk/0.0.1 azsdk-python-azuremachinelearningdesignerserviceclient/unknown
Python/3.11.5 (Windows-10-10.0.22621-SP0)
method: GET
uri: https://eastus.api.azureml.ms/flow/api/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/BulkRuns/name
response:
body:
string: '{"flowGraph": {"nodes": [{"name": "print_env", "type": "python", "source":
{"type": "code", "path": "print_env.py"}, "inputs": {"key": "${inputs.key}"},
"tool": "print_env.py", "reduce": false}], "tools": [{"name": "Azure OpenAI
GPT-4 Turbo with Vision", "type": "custom_llm", "inputs": {"connection": {"type":
["AzureOpenAIConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "deployment_name": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "frequency_penalty":
{"type": ["double"], "default": 0, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "max_tokens": {"type": ["int"], "default":
512, "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "presence_penalty": {"type": ["double"], "default": 0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "stop": {"type":
["list"], "default": "", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "temperature": {"type": ["double"], "default": 1,
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"top_p": {"type": ["double"], "default": 1, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use Azure OpenAI GPT-4 Turbo
with Vision to leverage AOAI vision ability.", "module": "promptflow.tools.aoai_gpt4v",
"class_name": "AzureOpenAI", "function": "chat", "icon": {"dark": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAA2ElEQVR4nJXSzW3CQBAF4DUSTjk+Al1AD0ikESslpBIEheRALhEpgAYSWV8OGUublf/yLuP3PPNmdndS+gdwXZrYDmh7fGE/W+wXbaYd8IYm4rxJPnZ0boI3wZcdJxs/n+AwV7DFK7aFyfQdYIMLPvES8YJNf5yp4jMeeEYdWh38gXOR35YGHe5xabvQdsHv6PLi8qV6gycc8YH3iMfQu6Lh4ASr+F5Hh3XwVWnQYzUkVlX1nccplAb1SN6Y/sfgmlK64VS8wimldIv/0yj2QLkHizG0iWP4AVAfQ34DVQONAAAAAElFTkSuQmCC",
"light": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAx0lEQVR4nJWSwQ2CQBBFX0jAcjgqXUgPJNiIsQQrIVCIFy8GC6ABDcGDX7Mus9n1Xz7zZ+fPsLPwH4bUg0dD2wMPcbR48Uxq4AKU4iSTDwZ1LhWXipN/B3V0J6hjBTvgLHZNonewBXrgDpzEvXSIjN0BE3AACmmF4kl5F6tNzcCoLpW0SvGovFvsb4oZ2AANcAOu4ka6axCcINN3rg654sww+CYsPD0OwjcozFNh/Qcd78tqVbCIW+n+Fky472Bh/Q6SYb1EEy8tDzd+9IsVPAAAAABJRU5ErkJggg=="},
"is_builtin": true, "package": "promptflow-tools", "package_version": "1.1.0rc2",
"default_prompt": "# system:\nAs an AI assistant, your task involves interpreting
images and responding to questions about the image.\nRemember to provide accurate
answers based on the information present in the image.\n\n# user:\nCan you
tell me what the image depicts?\n\n", "enable_kwargs":
false, "tool_state": "preview"}, {"name": "Content Safety (Text Analyze)",
"type": "python", "inputs": {"connection": {"type": ["AzureContentSafetyConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"hate_category": {"type": ["string"], "default": "medium_sensitivity", "enum":
["disable", "low_sensitivity", "medium_sensitivity", "high_sensitivity"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"self_harm_category": {"type": ["string"], "default": "medium_sensitivity",
"enum": ["disable", "low_sensitivity", "medium_sensitivity", "high_sensitivity"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"sexual_category": {"type": ["string"], "default": "medium_sensitivity", "enum":
["disable", "low_sensitivity", "medium_sensitivity", "high_sensitivity"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"text": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "violence_category": {"type": ["string"],
"default": "medium_sensitivity", "enum": ["disable", "low_sensitivity", "medium_sensitivity",
"high_sensitivity"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}}, "description": "Use Azure Content Safety to detect
harmful content.", "module": "promptflow.tools.azure_content_safety", "function":
"analyze_text", "is_builtin": true, "package": "promptflow-tools", "package_version":
"1.1.0rc2", "enable_kwargs": false, "deprecated_tools": ["content_safety_text.tools.content_safety_text_tool.analyze_text"],
"tool_state": "stable"}, {"name": "Embedding", "type": "python", "inputs":
{"connection": {"type": ["AzureOpenAIConnection", "OpenAIConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "deployment_name":
{"type": ["string"], "enabled_by": "connection", "enabled_by_type": ["AzureOpenAIConnection"],
"model_list": ["text-embedding-ada-002", "text-search-ada-doc-001", "text-search-ada-query-001"],
"capabilities": {"completion": false, "chat_completion": false, "embeddings":
true}, "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "input": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "model": {"type": ["string"], "enum": ["text-embedding-ada-002",
"text-search-ada-doc-001", "text-search-ada-query-001"], "enabled_by": "connection",
"enabled_by_type": ["OpenAIConnection"], "allow_manual_entry": true, "is_multi_select":
false, "input_type": "default"}}, "description": "Use Open AI''s embedding
model to create an embedding vector representing the input text.", "module":
"promptflow.tools.embedding", "function": "embedding", "is_builtin": true,
"package": "promptflow-tools", "package_version": "1.1.0rc2", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Open Model LLM", "type": "custom_llm",
"inputs": {"api": {"type": ["string"], "enum": ["chat", "completion"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "deployment_name":
{"type": ["string"], "default": "", "dynamic_list": {"func_path": "promptflow.tools.open_model_llm.list_deployment_names",
"func_kwargs": [{"name": "endpoint", "optional": true, "reference": "${inputs.endpoint}",
"type": ["string"]}]}, "allow_manual_entry": true, "is_multi_select": false,
"input_type": "default"}, "endpoint_name": {"type": ["string"], "dynamic_list":
{"func_path": "promptflow.tools.open_model_llm.list_endpoint_names"}, "allow_manual_entry":
true, "is_multi_select": false, "input_type": "default"}, "max_new_tokens":
{"type": ["int"], "default": 500, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "model_kwargs": {"type": ["object"], "default":
"{}", "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default", "advanced": true}, "temperature": {"type": ["double"], "default":
1.0, "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "top_p": {"type": ["double"], "default": 1.0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default", "advanced": true}},
"description": "Use an open model from the Azure Model catalog, deployed to
an AzureML Online Endpoint for LLM Chat or Completion API calls.", "module":
"promptflow.tools.open_model_llm", "class_name": "OpenModelLLM", "function":
"call", "icon": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACgElEQVR4nGWSz2vcVRTFP/e9NzOZ1KDGohASslLEH6VLV0ak4l/QpeDCrfQPcNGliODKnVm4EBdBsIjQIlhciKW0ycKFVCSNbYnjdDLtmPnmO/nO9917XcxMkjYX3uLx7nnn3HOuMK2Nix4fP78ZdrYXVkLVWjf3l3B1B+HpcjzGFtmqa6cePz7/x0dnn1n5qhj3iBJPYREIURAJuCtpY8PjReDbrf9WG7H1fuefwQU9qKztTcMJT+PNnEFvjGVDBDlSsH6p/9MLzy6+NxwVqI8RAg4IPmWedMckdLYP6O6UpIaQfvyyXG012+e79/ZfHukoS1ISMT2hGTB1RkUmNgQ5QZ0w+a2VWDq73MbdEWmfnnv6UWe7oNzPaLapl5CwuLTXK9WUGBuCjqekzhP+z52ZXOrKMD3OJg0Hh778aiOuvpnYvp05d6GJO4iAO4QAe/eV36/X5LFRV4Zmn+AdkqlL8Vjp3oVioOz+WTPzzYEgsN+fgPLYyJVheSbPPVl2ikeGZRjtG52/8rHuaV9VOlpP2OtKyVndcRVCSqOhsvxa4vW359i6OuKdD+aP8Q4SYPdOzS/flGjt1JUSaMqZ5nwa1Y8qWb/Ud/eZZkHisYezEM0m+fcelDr8F1SqW2LNK6r1jXQwyLzy1hxvrLXZulry7ocL+FS6G4QIu3fG/Px1gdYeW7LIgXU2P/115TOA5G7e3Rmj2aS/m7l5pThiZzrCcE/d1XHzbln373nw7y6veeoUm5KCNKT/IPPwbiY1hYd/l5MIT65BMFt87sU4v9D7/JMflr44uV6hGh1+L4RCkg6z5iK2tAhNLeLsNGwYA4fDYnC/drvuuFxe86NV/x+Ut27g0FvykgAAAABJRU5ErkJggg==",
"is_builtin": true, "package": "promptflow-tools", "package_version": "1.1.0rc2",
"enable_kwargs": false, "tool_state": "stable"}, {"name": "OpenAI GPT-4V",
"type": "custom_llm", "inputs": {"connection": {"type": ["OpenAIConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"frequency_penalty": {"type": ["double"], "default": 0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "max_tokens": {"type":
["int"], "default": 512, "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "model": {"type": ["string"], "enum": ["gpt-4-vision-preview"],
"allow_manual_entry": true, "is_multi_select": false, "input_type": "default"},
"presence_penalty": {"type": ["double"], "default": 0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "stop": {"type":
["list"], "default": "", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "temperature": {"type": ["double"], "default": 1,
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"top_p": {"type": ["double"], "default": 1, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use OpenAI GPT-4V to leverage
vision ability.", "module": "promptflow.tools.openai_gpt4v", "class_name":
"OpenAI", "function": "chat", "icon": {"dark": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAA2ElEQVR4nJXSzW3CQBAF4DUSTjk+Al1AD0ikESslpBIEheRALhEpgAYSWV8OGUublf/yLuP3PPNmdndS+gdwXZrYDmh7fGE/W+wXbaYd8IYm4rxJPnZ0boI3wZcdJxs/n+AwV7DFK7aFyfQdYIMLPvES8YJNf5yp4jMeeEYdWh38gXOR35YGHe5xabvQdsHv6PLi8qV6gycc8YH3iMfQu6Lh4ASr+F5Hh3XwVWnQYzUkVlX1nccplAb1SN6Y/sfgmlK64VS8wimldIv/0yj2QLkHizG0iWP4AVAfQ34DVQONAAAAAElFTkSuQmCC",
"light": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAx0lEQVR4nJWSwQ2CQBBFX0jAcjgqXUgPJNiIsQQrIVCIFy8GC6ABDcGDX7Mus9n1Xz7zZ+fPsLPwH4bUg0dD2wMPcbR48Uxq4AKU4iSTDwZ1LhWXipN/B3V0J6hjBTvgLHZNonewBXrgDpzEvXSIjN0BE3AACmmF4kl5F6tNzcCoLpW0SvGovFvsb4oZ2AANcAOu4ka6axCcINN3rg654sww+CYsPD0OwjcozFNh/Qcd78tqVbCIW+n+Fky472Bh/Q6SYb1EEy8tDzd+9IsVPAAAAABJRU5ErkJggg=="},
"is_builtin": true, "package": "promptflow-tools", "package_version": "1.1.0rc2",
"default_prompt": "# system:\nAs an AI assistant, your task involves interpreting
images and responding to questions about the image.\nRemember to provide accurate
answers based on the information present in the image.\n\n# user:\nCan you
tell me what the image depicts?\n\n", "enable_kwargs":
false, "tool_state": "preview"}, {"name": "Serp API", "type": "python", "inputs":
{"connection": {"type": ["SerpConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "engine": {"type": ["string"], "default":
"google", "enum": ["google", "bing"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "location": {"type": ["string"], "default":
"", "allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"num": {"type": ["int"], "default": "10", "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "query": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "safe": {"type":
["string"], "default": "off", "enum": ["active", "off"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}}, "description":
"Use Serp API to obtain search results from a specific search engine.", "module":
"promptflow.tools.serpapi", "class_name": "SerpAPI", "function": "search",
"is_builtin": true, "package": "promptflow-tools", "package_version": "1.1.0rc2",
"enable_kwargs": false, "tool_state": "stable"}, {"name": "Index Lookup",
"type": "python", "inputs": {"acs_content_field": {"type": ["string"], "enabled_by":
"index_type", "enabled_by_value": ["Azure AI Search"], "dynamic_list": {"func_path":
"promptflow_vectordb.tool.common_index_lookup_utils.list_acs_index_fields",
"func_kwargs": [{"name": "acs_connection", "optional": false, "reference":
"${inputs.acs_index_connection}", "type": ["CognitiveSearchConnection"]},
{"name": "acs_index_name", "optional": false, "reference": "${inputs.acs_index_name}",
"type": ["string"]}, {"default": "Edm.String", "name": "field_data_type",
"optional": false, "type": ["string"]}]}, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "uionly_hidden"}, "acs_embedding_field": {"type": ["string"],
"enabled_by": "index_type", "enabled_by_value": ["Azure AI Search"], "dynamic_list":
{"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_acs_index_fields",
"func_kwargs": [{"name": "acs_connection", "optional": false, "reference":
"${inputs.acs_index_connection}", "type": ["CognitiveSearchConnection"]},
{"name": "acs_index_name", "optional": false, "reference": "${inputs.acs_index_name}",
"type": ["string"]}, {"default": "Collection(Edm.Single)", "name": "field_data_type",
"optional": false, "type": ["string"]}]}, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "uionly_hidden"}, "acs_index_connection": {"type": ["CognitiveSearchConnection"],
"enabled_by": "index_type", "enabled_by_value": ["Azure AI Search"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "uionly_hidden"}, "acs_index_name":
{"type": ["string"], "enabled_by": "index_type", "enabled_by_value": ["Azure
AI Search"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_acs_indices",
"func_kwargs": [{"name": "acs_connection", "optional": false, "reference":
"${inputs.acs_index_connection}", "type": ["CognitiveSearchConnection"]}]},
"allow_manual_entry": false, "is_multi_select": false, "input_type": "uionly_hidden"},
"acs_metadata_field": {"type": ["string"], "enabled_by": "index_type", "enabled_by_value":
["Azure AI Search"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_acs_index_fields",
"func_kwargs": [{"name": "acs_connection", "optional": false, "reference":
"${inputs.acs_index_connection}", "type": ["CognitiveSearchConnection"]},
{"name": "acs_index_name", "optional": false, "reference": "${inputs.acs_index_name}",
"type": ["string"]}, {"default": "Edm.String", "name": "field_data_type",
"optional": false, "type": ["string"]}]}, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "uionly_hidden"}, "aoai_embedding_connection": {"type":
["AzureOpenAIConnection"], "enabled_by": "embedding_type", "enabled_by_value":
["Azure OpenAI"], "allow_manual_entry": false, "is_multi_select": false, "input_type":
"uionly_hidden"}, "embedding_deployment": {"type": ["string"], "enabled_by":
"embedding_type", "enabled_by_value": ["Azure OpenAI"], "dynamic_list": {"func_path":
"promptflow_vectordb.tool.common_index_lookup_utils.list_aoai_embedding_deployments",
"func_kwargs": [{"name": "aoai_connection", "optional": false, "reference":
"${inputs.aoai_embedding_connection}", "type": ["AzurOpenAIConnection"]}]},
"allow_manual_entry": false, "is_multi_select": false, "input_type": "uionly_hidden"},
"embedding_model": {"type": ["string"], "enabled_by": "embedding_type", "enabled_by_value":
["OpenAI", "Hugging Face"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_embedding_models",
"func_kwargs": [{"name": "embedding_type", "optional": false, "reference":
"${inputs.embedding_type}", "type": ["string"]}]}, "allow_manual_entry": false,
"is_multi_select": false, "input_type": "uionly_hidden"}, "embedding_type":
{"type": ["string"], "enabled_by": "index_type", "enabled_by_value": ["Azure
AI Search", "FAISS", "Pinecone"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_available_embedding_types",
"func_kwargs": [{"name": "index_type", "optional": false, "reference": "${inputs.index_type}",
"type": ["string"]}]}, "allow_manual_entry": false, "is_multi_select": false,
"input_type": "uionly_hidden"}, "faiss_index_path": {"type": ["string"], "enabled_by":
"index_type", "enabled_by_value": ["FAISS"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "uionly_hidden"}, "index_type": {"type":
["string"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_available_index_types"},
"allow_manual_entry": false, "is_multi_select": false, "input_type": "uionly_hidden"},
"mlindex_asset_id": {"type": ["string"], "enabled_by": "index_type", "enabled_by_value":
["Registered Index"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_registered_mlindices"},
"allow_manual_entry": false, "is_multi_select": false, "input_type": "uionly_hidden"},
"mlindex_content": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "generated_by": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.forward_mapping",
"func_kwargs": [{"name": "index_type", "reference": "${inputs.index_type}",
"type": ["string"]}, {"name": "mlindex_asset_id", "optional": true, "reference":
"${inputs.mlindex_asset_id}", "type": ["string"]}, {"name": "mlindex_path",
"optional": true, "reference": "${inputs.mlindex_path}", "type": ["string"]},
{"name": "acs_index_connection", "optional": true, "reference": "${inputs.acs_index_connection}",
"type": ["CognitiveSearchConnection"]}, {"name": "acs_index_name", "optional":
true, "reference": "${inputs.acs_index_name}", "type": ["string"]}, {"name":
"acs_content_field", "optional": true, "reference": "${inputs.acs_content_field}",
"type": ["string"]}, {"name": "acs_embedding_field", "optional": true, "reference":
"${inputs.acs_embedding_field}", "type": ["string"]}, {"name": "acs_metadata_field",
"optional": true, "reference": "${inputs.acs_metadata_field}", "type": ["string"]},
{"name": "semantic_configuration", "optional": true, "reference": "${inputs.semantic_configuration}",
"type": ["string"]}, {"name": "faiss_index_path", "optional": true, "reference":
"${inputs.faiss_index_path}", "type": ["string"]}, {"name": "pinecone_index_connection",
"optional": true, "reference": "${inputs.pinecone_index_connection}", "type":
["string"]}, {"name": "pinecone_index_name", "optional": true, "reference":
"${inputs.pinecone_index_name}", "type": ["string"]}, {"name": "pinecone_content_field",
"optional": true, "reference": "${inputs.pinecone_content_field}", "type":
["string"]}, {"name": "pinecone_metadata_field", "optional": true, "reference":
"${inputs.pinecone_metadata_field}", "type": ["string"]}, {"name": "embedding_type",
"optional": true, "reference": "${inputs.embedding_type}", "type": ["string"]},
{"name": "aoai_embedding_connection", "optional": true, "reference": "${inputs.aoai_embedding_connection}",
"type": ["AzureOpenAIConnection"]}, {"name": "oai_embedding_connection", "optional":
true, "reference": "${inputs.oai_embedding_connection}", "type": ["string"]},
{"name": "embedding_model", "optional": true, "reference": "${inputs.embedding_model}",
"type": ["string"]}, {"name": "embedding_deployment", "optional": true, "reference":
"${inputs.embedding_deployment}", "type": ["string"]}], "reverse_func_path":
"promptflow_vectordb.tool.common_index_lookup_utils.reverse_mapping"}, "input_type":
"default"}, "mlindex_path": {"type": ["string"], "enabled_by": "index_type",
"enabled_by_value": ["MLIndex file from path"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "uionly_hidden"}, "oai_embedding_connection":
{"type": ["OpenAIConnection"], "enabled_by": "embedding_type", "enabled_by_value":
["OpenAI"], "allow_manual_entry": false, "is_multi_select": false, "input_type":
"uionly_hidden"}, "pinecone_content_field": {"type": ["string"], "enabled_by":
"index_type", "enabled_by_value": ["Pinecone"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "uionly_hidden"}, "pinecone_index_connection":
{"type": ["PineconeConnection"], "enabled_by": "index_type", "enabled_by_value":
["Pinecone"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_pinecone_connections"},
"allow_manual_entry": false, "is_multi_select": false, "input_type": "uionly_hidden"},
"pinecone_index_name": {"type": ["string"], "enabled_by": "index_type", "enabled_by_value":
["Pinecone"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_pinecone_indices",
"func_kwargs": [{"name": "pinecone_connection_name", "optional": false, "reference":
"${inputs.pinecone_index_connection}", "type": ["string"]}]}, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "uionly_hidden"}, "pinecone_metadata_field":
{"type": ["string"], "enabled_by": "index_type", "enabled_by_value": ["Pinecone"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "uionly_hidden"},
"queries": {"type": ["object"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "query_type": {"type": ["string"], "dynamic_list":
{"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_available_query_types",
"func_kwargs": [{"name": "mlindex_content", "optional": false, "reference":
"${inputs.mlindex_content}", "type": ["string"]}]}, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "semantic_configuration":
{"type": ["string"], "enabled_by": "index_type", "enabled_by_value": ["Azure
AI Search"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_acs_index_semantic_configurations",
"func_kwargs": [{"name": "acs_connection", "optional": false, "reference":
"${inputs.acs_index_connection}", "type": ["CognitiveSearchConnection"]},
{"name": "acs_index_name", "optional": false, "reference": "${inputs.acs_index_name}",
"type": ["string"]}]}, "allow_manual_entry": false, "is_multi_select": false,
"input_type": "uionly_hidden"}, "top_k": {"type": ["int"], "default": 3, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}}, "description":
"Search an AzureML Vector Index for relevant results using one or more text
queries.", "module": "promptflow_vectordb.tool.common_index_lookup", "function":
"search", "is_builtin": true, "package": "promptflow-vectordb", "package_version":
"0.0.1", "enable_kwargs": false, "tool_state": "preview"}, {"name": "Faiss
Index Lookup", "type": "python", "inputs": {"path": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "top_k": {"type":
["int"], "default": "3", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "vector": {"type": ["list"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}}, "description":
"Search vector based query from the FAISS index file.", "module": "promptflow_vectordb.tool.faiss_index_lookup",
"class_name": "FaissIndexLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Vector DB Lookup", "type": "python",
"inputs": {"class_name": {"type": ["string"], "enabled_by": "connection",
"enabled_by_type": ["WeaviateConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "collection_name": {"type": ["string"], "enabled_by":
"connection", "enabled_by_type": ["QdrantConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "connection": {"type":
["CognitiveSearchConnection", "QdrantConnection", "WeaviateConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "index_name": {"type":
["string"], "enabled_by": "connection", "enabled_by_type": ["CognitiveSearchConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"search_filters": {"type": ["object"], "enabled_by": "connection", "enabled_by_type":
["CognitiveSearchConnection", "QdrantConnection"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "default"}, "search_params": {"type":
["object"], "enabled_by": "connection", "enabled_by_type": ["CognitiveSearchConnection",
"QdrantConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "text_field": {"type": ["string"], "enabled_by":
"connection", "enabled_by_type": ["CognitiveSearchConnection", "QdrantConnection",
"WeaviateConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "top_k": {"type": ["int"], "default": "3", "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "vector": {"type":
["list"], "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "vector_field": {"type": ["string"], "enabled_by": "connection",
"enabled_by_type": ["CognitiveSearchConnection"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "default"}}, "description": "Search
vector based query from existing Vector Database.", "module": "promptflow_vectordb.tool.vector_db_lookup",
"class_name": "VectorDBLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Vector Index Lookup", "type": "python",
"inputs": {"path": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "query": {"type": ["object"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "top_k": {"type":
["int"], "default": "3", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}}, "description": "Search text or vector based query
from AzureML Vector Index.", "module": "promptflow_vectordb.tool.vector_index_lookup",
"class_name": "VectorIndexLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "print_env.py", "type": "python",
"inputs": {"key": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "source": "print_env.py", "function": "get_env_var",
"is_builtin": false, "enable_kwargs": false, "tool_state": "stable"}], "inputs":
{"key": {"type": "string", "is_chat_input": false}}, "outputs": {"output":
{"type": "string", "reference": "${print_env.output.value}", "evaluation_only":
false, "is_chat_output": false}}}, "flowRunResourceId": "azureml://locations/eastus/workspaces/00000/flows/name/flowRuns/name",
"flowRunId": "name", "flowRunDisplayName": "name", "batchDataInput": {"dataUri":
"azureml://datastores/workspaceblobstore/paths/LocalUpload/c32a61842e439cecc022ebcff5dc0da4/env_var_names.jsonl"},
"flowRunType": "FlowRun", "flowType": "Default", "runtimeName": "automatic",
"inputsMapping": {}, "outputDatastoreName": "workspaceblobstore", "childRunBasePath":
"promptflow/PromptFlowArtifacts/name/flow_artifacts", "flowDagFileRelativePath":
"flow.dag.yaml", "flowSnapshotId": "f70ec21e-2e5f-4f8a-8877-19d060899638",
"studioPortalEndpoint": "https://ml.azure.com/runs/name?wsid=/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000"}'
headers:
connection:
- keep-alive
content-length:
- '26127'
content-type:
- application/json; charset=utf-8
strict-transport-security:
- max-age=15724800; includeSubDomains; preload
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '0.361'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- promptflow-sdk/0.0.1 azsdk-python-azuremachinelearningdesignerserviceclient/unknown
Python/3.11.5 (Windows-10-10.0.22621-SP0)
method: GET
uri: https://eastus.api.azureml.ms/flow/api/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/BulkRuns/name
response:
body:
string: '{"flowGraph": {"nodes": [{"name": "print_env", "type": "python", "source":
{"type": "code", "path": "print_env.py"}, "inputs": {"key": "${inputs.key}"},
"tool": "print_env.py", "reduce": false}], "tools": [{"name": "Azure OpenAI
GPT-4 Turbo with Vision", "type": "custom_llm", "inputs": {"connection": {"type":
["AzureOpenAIConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "deployment_name": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "frequency_penalty":
{"type": ["double"], "default": 0, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "max_tokens": {"type": ["int"], "default":
512, "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "presence_penalty": {"type": ["double"], "default": 0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "stop": {"type":
["list"], "default": "", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "temperature": {"type": ["double"], "default": 1,
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"top_p": {"type": ["double"], "default": 1, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use Azure OpenAI GPT-4 Turbo
with Vision to leverage AOAI vision ability.", "module": "promptflow.tools.aoai_gpt4v",
"class_name": "AzureOpenAI", "function": "chat", "icon": {"dark": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAA2ElEQVR4nJXSzW3CQBAF4DUSTjk+Al1AD0ikESslpBIEheRALhEpgAYSWV8OGUublf/yLuP3PPNmdndS+gdwXZrYDmh7fGE/W+wXbaYd8IYm4rxJPnZ0boI3wZcdJxs/n+AwV7DFK7aFyfQdYIMLPvES8YJNf5yp4jMeeEYdWh38gXOR35YGHe5xabvQdsHv6PLi8qV6gycc8YH3iMfQu6Lh4ASr+F5Hh3XwVWnQYzUkVlX1nccplAb1SN6Y/sfgmlK64VS8wimldIv/0yj2QLkHizG0iWP4AVAfQ34DVQONAAAAAElFTkSuQmCC",
"light": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAx0lEQVR4nJWSwQ2CQBBFX0jAcjgqXUgPJNiIsQQrIVCIFy8GC6ABDcGDX7Mus9n1Xz7zZ+fPsLPwH4bUg0dD2wMPcbR48Uxq4AKU4iSTDwZ1LhWXipN/B3V0J6hjBTvgLHZNonewBXrgDpzEvXSIjN0BE3AACmmF4kl5F6tNzcCoLpW0SvGovFvsb4oZ2AANcAOu4ka6axCcINN3rg654sww+CYsPD0OwjcozFNh/Qcd78tqVbCIW+n+Fky472Bh/Q6SYb1EEy8tDzd+9IsVPAAAAABJRU5ErkJggg=="},
"is_builtin": true, "package": "promptflow-tools", "package_version": "1.1.0rc2",
"default_prompt": "# system:\nAs an AI assistant, your task involves interpreting
images and responding to questions about the image.\nRemember to provide accurate
answers based on the information present in the image.\n\n# user:\nCan you
tell me what the image depicts?\n\n", "enable_kwargs":
false, "tool_state": "preview"}, {"name": "Content Safety (Text Analyze)",
"type": "python", "inputs": {"connection": {"type": ["AzureContentSafetyConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"hate_category": {"type": ["string"], "default": "medium_sensitivity", "enum":
["disable", "low_sensitivity", "medium_sensitivity", "high_sensitivity"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"self_harm_category": {"type": ["string"], "default": "medium_sensitivity",
"enum": ["disable", "low_sensitivity", "medium_sensitivity", "high_sensitivity"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"sexual_category": {"type": ["string"], "default": "medium_sensitivity", "enum":
["disable", "low_sensitivity", "medium_sensitivity", "high_sensitivity"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"text": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "violence_category": {"type": ["string"],
"default": "medium_sensitivity", "enum": ["disable", "low_sensitivity", "medium_sensitivity",
"high_sensitivity"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}}, "description": "Use Azure Content Safety to detect
harmful content.", "module": "promptflow.tools.azure_content_safety", "function":
"analyze_text", "is_builtin": true, "package": "promptflow-tools", "package_version":
"1.1.0rc2", "enable_kwargs": false, "deprecated_tools": ["content_safety_text.tools.content_safety_text_tool.analyze_text"],
"tool_state": "stable"}, {"name": "Embedding", "type": "python", "inputs":
{"connection": {"type": ["AzureOpenAIConnection", "OpenAIConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "deployment_name":
{"type": ["string"], "enabled_by": "connection", "enabled_by_type": ["AzureOpenAIConnection"],
"model_list": ["text-embedding-ada-002", "text-search-ada-doc-001", "text-search-ada-query-001"],
"capabilities": {"completion": false, "chat_completion": false, "embeddings":
true}, "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "input": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "model": {"type": ["string"], "enum": ["text-embedding-ada-002",
"text-search-ada-doc-001", "text-search-ada-query-001"], "enabled_by": "connection",
"enabled_by_type": ["OpenAIConnection"], "allow_manual_entry": true, "is_multi_select":
false, "input_type": "default"}}, "description": "Use Open AI''s embedding
model to create an embedding vector representing the input text.", "module":
"promptflow.tools.embedding", "function": "embedding", "is_builtin": true,
"package": "promptflow-tools", "package_version": "1.1.0rc2", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Open Model LLM", "type": "custom_llm",
"inputs": {"api": {"type": ["string"], "enum": ["chat", "completion"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "deployment_name":
{"type": ["string"], "default": "", "dynamic_list": {"func_path": "promptflow.tools.open_model_llm.list_deployment_names",
"func_kwargs": [{"name": "endpoint", "optional": true, "reference": "${inputs.endpoint}",
"type": ["string"]}]}, "allow_manual_entry": true, "is_multi_select": false,
"input_type": "default"}, "endpoint_name": {"type": ["string"], "dynamic_list":
{"func_path": "promptflow.tools.open_model_llm.list_endpoint_names"}, "allow_manual_entry":
true, "is_multi_select": false, "input_type": "default"}, "max_new_tokens":
{"type": ["int"], "default": 500, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "model_kwargs": {"type": ["object"], "default":
"{}", "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default", "advanced": true}, "temperature": {"type": ["double"], "default":
1.0, "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "top_p": {"type": ["double"], "default": 1.0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default", "advanced": true}},
"description": "Use an open model from the Azure Model catalog, deployed to
an AzureML Online Endpoint for LLM Chat or Completion API calls.", "module":
"promptflow.tools.open_model_llm", "class_name": "OpenModelLLM", "function":
"call", "icon": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACgElEQVR4nGWSz2vcVRTFP/e9NzOZ1KDGohASslLEH6VLV0ak4l/QpeDCrfQPcNGliODKnVm4EBdBsIjQIlhciKW0ycKFVCSNbYnjdDLtmPnmO/nO9917XcxMkjYX3uLx7nnn3HOuMK2Nix4fP78ZdrYXVkLVWjf3l3B1B+HpcjzGFtmqa6cePz7/x0dnn1n5qhj3iBJPYREIURAJuCtpY8PjReDbrf9WG7H1fuefwQU9qKztTcMJT+PNnEFvjGVDBDlSsH6p/9MLzy6+NxwVqI8RAg4IPmWedMckdLYP6O6UpIaQfvyyXG012+e79/ZfHukoS1ISMT2hGTB1RkUmNgQ5QZ0w+a2VWDq73MbdEWmfnnv6UWe7oNzPaLapl5CwuLTXK9WUGBuCjqekzhP+z52ZXOrKMD3OJg0Hh778aiOuvpnYvp05d6GJO4iAO4QAe/eV36/X5LFRV4Zmn+AdkqlL8Vjp3oVioOz+WTPzzYEgsN+fgPLYyJVheSbPPVl2ikeGZRjtG52/8rHuaV9VOlpP2OtKyVndcRVCSqOhsvxa4vW359i6OuKdD+aP8Q4SYPdOzS/flGjt1JUSaMqZ5nwa1Y8qWb/Ud/eZZkHisYezEM0m+fcelDr8F1SqW2LNK6r1jXQwyLzy1hxvrLXZulry7ocL+FS6G4QIu3fG/Px1gdYeW7LIgXU2P/115TOA5G7e3Rmj2aS/m7l5pThiZzrCcE/d1XHzbln373nw7y6veeoUm5KCNKT/IPPwbiY1hYd/l5MIT65BMFt87sU4v9D7/JMflr44uV6hGh1+L4RCkg6z5iK2tAhNLeLsNGwYA4fDYnC/drvuuFxe86NV/x+Ut27g0FvykgAAAABJRU5ErkJggg==",
"is_builtin": true, "package": "promptflow-tools", "package_version": "1.1.0rc2",
"enable_kwargs": false, "tool_state": "stable"}, {"name": "OpenAI GPT-4V",
"type": "custom_llm", "inputs": {"connection": {"type": ["OpenAIConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"frequency_penalty": {"type": ["double"], "default": 0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "max_tokens": {"type":
["int"], "default": 512, "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "model": {"type": ["string"], "enum": ["gpt-4-vision-preview"],
"allow_manual_entry": true, "is_multi_select": false, "input_type": "default"},
"presence_penalty": {"type": ["double"], "default": 0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "stop": {"type":
["list"], "default": "", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "temperature": {"type": ["double"], "default": 1,
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"top_p": {"type": ["double"], "default": 1, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use OpenAI GPT-4V to leverage
vision ability.", "module": "promptflow.tools.openai_gpt4v", "class_name":
"OpenAI", "function": "chat", "icon": {"dark": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAA2ElEQVR4nJXSzW3CQBAF4DUSTjk+Al1AD0ikESslpBIEheRALhEpgAYSWV8OGUublf/yLuP3PPNmdndS+gdwXZrYDmh7fGE/W+wXbaYd8IYm4rxJPnZ0boI3wZcdJxs/n+AwV7DFK7aFyfQdYIMLPvES8YJNf5yp4jMeeEYdWh38gXOR35YGHe5xabvQdsHv6PLi8qV6gycc8YH3iMfQu6Lh4ASr+F5Hh3XwVWnQYzUkVlX1nccplAb1SN6Y/sfgmlK64VS8wimldIv/0yj2QLkHizG0iWP4AVAfQ34DVQONAAAAAElFTkSuQmCC",
"light": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAx0lEQVR4nJWSwQ2CQBBFX0jAcjgqXUgPJNiIsQQrIVCIFy8GC6ABDcGDX7Mus9n1Xz7zZ+fPsLPwH4bUg0dD2wMPcbR48Uxq4AKU4iSTDwZ1LhWXipN/B3V0J6hjBTvgLHZNonewBXrgDpzEvXSIjN0BE3AACmmF4kl5F6tNzcCoLpW0SvGovFvsb4oZ2AANcAOu4ka6axCcINN3rg654sww+CYsPD0OwjcozFNh/Qcd78tqVbCIW+n+Fky472Bh/Q6SYb1EEy8tDzd+9IsVPAAAAABJRU5ErkJggg=="},
"is_builtin": true, "package": "promptflow-tools", "package_version": "1.1.0rc2",
"default_prompt": "# system:\nAs an AI assistant, your task involves interpreting
images and responding to questions about the image.\nRemember to provide accurate
answers based on the information present in the image.\n\n# user:\nCan you
tell me what the image depicts?\n\n", "enable_kwargs":
false, "tool_state": "preview"}, {"name": "Serp API", "type": "python", "inputs":
{"connection": {"type": ["SerpConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "engine": {"type": ["string"], "default":
"google", "enum": ["google", "bing"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "location": {"type": ["string"], "default":
"", "allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"num": {"type": ["int"], "default": "10", "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "query": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "safe": {"type":
["string"], "default": "off", "enum": ["active", "off"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}}, "description":
"Use Serp API to obtain search results from a specific search engine.", "module":
"promptflow.tools.serpapi", "class_name": "SerpAPI", "function": "search",
"is_builtin": true, "package": "promptflow-tools", "package_version": "1.1.0rc2",
"enable_kwargs": false, "tool_state": "stable"}, {"name": "Index Lookup",
"type": "python", "inputs": {"acs_content_field": {"type": ["string"], "enabled_by":
"index_type", "enabled_by_value": ["Azure AI Search"], "dynamic_list": {"func_path":
"promptflow_vectordb.tool.common_index_lookup_utils.list_acs_index_fields",
"func_kwargs": [{"name": "acs_connection", "optional": false, "reference":
"${inputs.acs_index_connection}", "type": ["CognitiveSearchConnection"]},
{"name": "acs_index_name", "optional": false, "reference": "${inputs.acs_index_name}",
"type": ["string"]}, {"default": "Edm.String", "name": "field_data_type",
"optional": false, "type": ["string"]}]}, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "uionly_hidden"}, "acs_embedding_field": {"type": ["string"],
"enabled_by": "index_type", "enabled_by_value": ["Azure AI Search"], "dynamic_list":
{"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_acs_index_fields",
"func_kwargs": [{"name": "acs_connection", "optional": false, "reference":
"${inputs.acs_index_connection}", "type": ["CognitiveSearchConnection"]},
{"name": "acs_index_name", "optional": false, "reference": "${inputs.acs_index_name}",
"type": ["string"]}, {"default": "Collection(Edm.Single)", "name": "field_data_type",
"optional": false, "type": ["string"]}]}, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "uionly_hidden"}, "acs_index_connection": {"type": ["CognitiveSearchConnection"],
"enabled_by": "index_type", "enabled_by_value": ["Azure AI Search"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "uionly_hidden"}, "acs_index_name":
{"type": ["string"], "enabled_by": "index_type", "enabled_by_value": ["Azure
AI Search"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_acs_indices",
"func_kwargs": [{"name": "acs_connection", "optional": false, "reference":
"${inputs.acs_index_connection}", "type": ["CognitiveSearchConnection"]}]},
"allow_manual_entry": false, "is_multi_select": false, "input_type": "uionly_hidden"},
"acs_metadata_field": {"type": ["string"], "enabled_by": "index_type", "enabled_by_value":
["Azure AI Search"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_acs_index_fields",
"func_kwargs": [{"name": "acs_connection", "optional": false, "reference":
"${inputs.acs_index_connection}", "type": ["CognitiveSearchConnection"]},
{"name": "acs_index_name", "optional": false, "reference": "${inputs.acs_index_name}",
"type": ["string"]}, {"default": "Edm.String", "name": "field_data_type",
"optional": false, "type": ["string"]}]}, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "uionly_hidden"}, "aoai_embedding_connection": {"type":
["AzureOpenAIConnection"], "enabled_by": "embedding_type", "enabled_by_value":
["Azure OpenAI"], "allow_manual_entry": false, "is_multi_select": false, "input_type":
"uionly_hidden"}, "embedding_deployment": {"type": ["string"], "enabled_by":
"embedding_type", "enabled_by_value": ["Azure OpenAI"], "dynamic_list": {"func_path":
"promptflow_vectordb.tool.common_index_lookup_utils.list_aoai_embedding_deployments",
"func_kwargs": [{"name": "aoai_connection", "optional": false, "reference":
"${inputs.aoai_embedding_connection}", "type": ["AzurOpenAIConnection"]}]},
"allow_manual_entry": false, "is_multi_select": false, "input_type": "uionly_hidden"},
"embedding_model": {"type": ["string"], "enabled_by": "embedding_type", "enabled_by_value":
["OpenAI", "Hugging Face"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_embedding_models",
"func_kwargs": [{"name": "embedding_type", "optional": false, "reference":
"${inputs.embedding_type}", "type": ["string"]}]}, "allow_manual_entry": false,
"is_multi_select": false, "input_type": "uionly_hidden"}, "embedding_type":
{"type": ["string"], "enabled_by": "index_type", "enabled_by_value": ["Azure
AI Search", "FAISS", "Pinecone"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_available_embedding_types",
"func_kwargs": [{"name": "index_type", "optional": false, "reference": "${inputs.index_type}",
"type": ["string"]}]}, "allow_manual_entry": false, "is_multi_select": false,
"input_type": "uionly_hidden"}, "faiss_index_path": {"type": ["string"], "enabled_by":
"index_type", "enabled_by_value": ["FAISS"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "uionly_hidden"}, "index_type": {"type":
["string"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_available_index_types"},
"allow_manual_entry": false, "is_multi_select": false, "input_type": "uionly_hidden"},
"mlindex_asset_id": {"type": ["string"], "enabled_by": "index_type", "enabled_by_value":
["Registered Index"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_registered_mlindices"},
"allow_manual_entry": false, "is_multi_select": false, "input_type": "uionly_hidden"},
"mlindex_content": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "generated_by": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.forward_mapping",
"func_kwargs": [{"name": "index_type", "reference": "${inputs.index_type}",
"type": ["string"]}, {"name": "mlindex_asset_id", "optional": true, "reference":
"${inputs.mlindex_asset_id}", "type": ["string"]}, {"name": "mlindex_path",
"optional": true, "reference": "${inputs.mlindex_path}", "type": ["string"]},
{"name": "acs_index_connection", "optional": true, "reference": "${inputs.acs_index_connection}",
"type": ["CognitiveSearchConnection"]}, {"name": "acs_index_name", "optional":
true, "reference": "${inputs.acs_index_name}", "type": ["string"]}, {"name":
"acs_content_field", "optional": true, "reference": "${inputs.acs_content_field}",
"type": ["string"]}, {"name": "acs_embedding_field", "optional": true, "reference":
"${inputs.acs_embedding_field}", "type": ["string"]}, {"name": "acs_metadata_field",
"optional": true, "reference": "${inputs.acs_metadata_field}", "type": ["string"]},
{"name": "semantic_configuration", "optional": true, "reference": "${inputs.semantic_configuration}",
"type": ["string"]}, {"name": "faiss_index_path", "optional": true, "reference":
"${inputs.faiss_index_path}", "type": ["string"]}, {"name": "pinecone_index_connection",
"optional": true, "reference": "${inputs.pinecone_index_connection}", "type":
["string"]}, {"name": "pinecone_index_name", "optional": true, "reference":
"${inputs.pinecone_index_name}", "type": ["string"]}, {"name": "pinecone_content_field",
"optional": true, "reference": "${inputs.pinecone_content_field}", "type":
["string"]}, {"name": "pinecone_metadata_field", "optional": true, "reference":
"${inputs.pinecone_metadata_field}", "type": ["string"]}, {"name": "embedding_type",
"optional": true, "reference": "${inputs.embedding_type}", "type": ["string"]},
{"name": "aoai_embedding_connection", "optional": true, "reference": "${inputs.aoai_embedding_connection}",
"type": ["AzureOpenAIConnection"]}, {"name": "oai_embedding_connection", "optional":
true, "reference": "${inputs.oai_embedding_connection}", "type": ["string"]},
{"name": "embedding_model", "optional": true, "reference": "${inputs.embedding_model}",
"type": ["string"]}, {"name": "embedding_deployment", "optional": true, "reference":
"${inputs.embedding_deployment}", "type": ["string"]}], "reverse_func_path":
"promptflow_vectordb.tool.common_index_lookup_utils.reverse_mapping"}, "input_type":
"default"}, "mlindex_path": {"type": ["string"], "enabled_by": "index_type",
"enabled_by_value": ["MLIndex file from path"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "uionly_hidden"}, "oai_embedding_connection":
{"type": ["OpenAIConnection"], "enabled_by": "embedding_type", "enabled_by_value":
["OpenAI"], "allow_manual_entry": false, "is_multi_select": false, "input_type":
"uionly_hidden"}, "pinecone_content_field": {"type": ["string"], "enabled_by":
"index_type", "enabled_by_value": ["Pinecone"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "uionly_hidden"}, "pinecone_index_connection":
{"type": ["PineconeConnection"], "enabled_by": "index_type", "enabled_by_value":
["Pinecone"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_pinecone_connections"},
"allow_manual_entry": false, "is_multi_select": false, "input_type": "uionly_hidden"},
"pinecone_index_name": {"type": ["string"], "enabled_by": "index_type", "enabled_by_value":
["Pinecone"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_pinecone_indices",
"func_kwargs": [{"name": "pinecone_connection_name", "optional": false, "reference":
"${inputs.pinecone_index_connection}", "type": ["string"]}]}, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "uionly_hidden"}, "pinecone_metadata_field":
{"type": ["string"], "enabled_by": "index_type", "enabled_by_value": ["Pinecone"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "uionly_hidden"},
"queries": {"type": ["object"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "query_type": {"type": ["string"], "dynamic_list":
{"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_available_query_types",
"func_kwargs": [{"name": "mlindex_content", "optional": false, "reference":
"${inputs.mlindex_content}", "type": ["string"]}]}, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "semantic_configuration":
{"type": ["string"], "enabled_by": "index_type", "enabled_by_value": ["Azure
AI Search"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_acs_index_semantic_configurations",
"func_kwargs": [{"name": "acs_connection", "optional": false, "reference":
"${inputs.acs_index_connection}", "type": ["CognitiveSearchConnection"]},
{"name": "acs_index_name", "optional": false, "reference": "${inputs.acs_index_name}",
"type": ["string"]}]}, "allow_manual_entry": false, "is_multi_select": false,
"input_type": "uionly_hidden"}, "top_k": {"type": ["int"], "default": 3, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}}, "description":
"Search an AzureML Vector Index for relevant results using one or more text
queries.", "module": "promptflow_vectordb.tool.common_index_lookup", "function":
"search", "is_builtin": true, "package": "promptflow-vectordb", "package_version":
"0.0.1", "enable_kwargs": false, "tool_state": "preview"}, {"name": "Faiss
Index Lookup", "type": "python", "inputs": {"path": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "top_k": {"type":
["int"], "default": "3", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "vector": {"type": ["list"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}}, "description":
"Search vector based query from the FAISS index file.", "module": "promptflow_vectordb.tool.faiss_index_lookup",
"class_name": "FaissIndexLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Vector DB Lookup", "type": "python",
"inputs": {"class_name": {"type": ["string"], "enabled_by": "connection",
"enabled_by_type": ["WeaviateConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "collection_name": {"type": ["string"], "enabled_by":
"connection", "enabled_by_type": ["QdrantConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "connection": {"type":
["CognitiveSearchConnection", "QdrantConnection", "WeaviateConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "index_name": {"type":
["string"], "enabled_by": "connection", "enabled_by_type": ["CognitiveSearchConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"search_filters": {"type": ["object"], "enabled_by": "connection", "enabled_by_type":
["CognitiveSearchConnection", "QdrantConnection"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "default"}, "search_params": {"type":
["object"], "enabled_by": "connection", "enabled_by_type": ["CognitiveSearchConnection",
"QdrantConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "text_field": {"type": ["string"], "enabled_by":
"connection", "enabled_by_type": ["CognitiveSearchConnection", "QdrantConnection",
"WeaviateConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "top_k": {"type": ["int"], "default": "3", "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "vector": {"type":
["list"], "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "vector_field": {"type": ["string"], "enabled_by": "connection",
"enabled_by_type": ["CognitiveSearchConnection"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "default"}}, "description": "Search
vector based query from existing Vector Database.", "module": "promptflow_vectordb.tool.vector_db_lookup",
"class_name": "VectorDBLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Vector Index Lookup", "type": "python",
"inputs": {"path": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "query": {"type": ["object"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "top_k": {"type":
["int"], "default": "3", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}}, "description": "Search text or vector based query
from AzureML Vector Index.", "module": "promptflow_vectordb.tool.vector_index_lookup",
"class_name": "VectorIndexLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "print_env.py", "type": "python",
"inputs": {"key": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "source": "print_env.py", "function": "get_env_var",
"is_builtin": false, "enable_kwargs": false, "tool_state": "stable"}], "inputs":
{"key": {"type": "string", "is_chat_input": false}}, "outputs": {"output":
{"type": "string", "reference": "${print_env.output.value}", "evaluation_only":
false, "is_chat_output": false}}}, "flowRunResourceId": "azureml://locations/eastus/workspaces/00000/flows/name/flowRuns/name",
"flowRunId": "name", "flowRunDisplayName": "name", "batchDataInput": {"dataUri":
"azureml://datastores/workspaceblobstore/paths/LocalUpload/c32a61842e439cecc022ebcff5dc0da4/env_var_names.jsonl"},
"flowRunType": "FlowRun", "flowType": "Default", "runtimeName": "automatic",
"inputsMapping": {}, "outputDatastoreName": "workspaceblobstore", "childRunBasePath":
"promptflow/PromptFlowArtifacts/name/flow_artifacts", "flowDagFileRelativePath":
"flow.dag.yaml", "flowSnapshotId": "f70ec21e-2e5f-4f8a-8877-19d060899638",
"studioPortalEndpoint": "https://ml.azure.com/runs/name?wsid=/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000"}'
headers:
connection:
- keep-alive
content-length:
- '26127'
content-type:
- application/json; charset=utf-8
strict-transport-security:
- max-age=15724800; includeSubDomains; preload
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '1.342'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- promptflow-sdk/0.0.1 azsdk-python-azuremachinelearningdesignerserviceclient/unknown
Python/3.11.5 (Windows-10-10.0.22621-SP0)
method: GET
uri: https://eastus.api.azureml.ms/flow/api/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/BulkRuns/name
response:
body:
string: '{"flowGraph": {"nodes": [{"name": "print_env", "type": "python", "source":
{"type": "code", "path": "print_env.py"}, "inputs": {"key": "${inputs.key}"},
"tool": "print_env.py", "reduce": false}], "tools": [{"name": "Azure OpenAI
GPT-4 Turbo with Vision", "type": "custom_llm", "inputs": {"connection": {"type":
["AzureOpenAIConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "deployment_name": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "frequency_penalty":
{"type": ["double"], "default": 0, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "max_tokens": {"type": ["int"], "default":
512, "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "presence_penalty": {"type": ["double"], "default": 0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "stop": {"type":
["list"], "default": "", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "temperature": {"type": ["double"], "default": 1,
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"top_p": {"type": ["double"], "default": 1, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use Azure OpenAI GPT-4 Turbo
with Vision to leverage AOAI vision ability.", "module": "promptflow.tools.aoai_gpt4v",
"class_name": "AzureOpenAI", "function": "chat", "icon": {"dark": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAA2ElEQVR4nJXSzW3CQBAF4DUSTjk+Al1AD0ikESslpBIEheRALhEpgAYSWV8OGUublf/yLuP3PPNmdndS+gdwXZrYDmh7fGE/W+wXbaYd8IYm4rxJPnZ0boI3wZcdJxs/n+AwV7DFK7aFyfQdYIMLPvES8YJNf5yp4jMeeEYdWh38gXOR35YGHe5xabvQdsHv6PLi8qV6gycc8YH3iMfQu6Lh4ASr+F5Hh3XwVWnQYzUkVlX1nccplAb1SN6Y/sfgmlK64VS8wimldIv/0yj2QLkHizG0iWP4AVAfQ34DVQONAAAAAElFTkSuQmCC",
"light": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAx0lEQVR4nJWSwQ2CQBBFX0jAcjgqXUgPJNiIsQQrIVCIFy8GC6ABDcGDX7Mus9n1Xz7zZ+fPsLPwH4bUg0dD2wMPcbR48Uxq4AKU4iSTDwZ1LhWXipN/B3V0J6hjBTvgLHZNonewBXrgDpzEvXSIjN0BE3AACmmF4kl5F6tNzcCoLpW0SvGovFvsb4oZ2AANcAOu4ka6axCcINN3rg654sww+CYsPD0OwjcozFNh/Qcd78tqVbCIW+n+Fky472Bh/Q6SYb1EEy8tDzd+9IsVPAAAAABJRU5ErkJggg=="},
"is_builtin": true, "package": "promptflow-tools", "package_version": "1.1.0rc2",
"default_prompt": "# system:\nAs an AI assistant, your task involves interpreting
images and responding to questions about the image.\nRemember to provide accurate
answers based on the information present in the image.\n\n# user:\nCan you
tell me what the image depicts?\n\n", "enable_kwargs":
false, "tool_state": "preview"}, {"name": "Content Safety (Text Analyze)",
"type": "python", "inputs": {"connection": {"type": ["AzureContentSafetyConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"hate_category": {"type": ["string"], "default": "medium_sensitivity", "enum":
["disable", "low_sensitivity", "medium_sensitivity", "high_sensitivity"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"self_harm_category": {"type": ["string"], "default": "medium_sensitivity",
"enum": ["disable", "low_sensitivity", "medium_sensitivity", "high_sensitivity"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"sexual_category": {"type": ["string"], "default": "medium_sensitivity", "enum":
["disable", "low_sensitivity", "medium_sensitivity", "high_sensitivity"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"text": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "violence_category": {"type": ["string"],
"default": "medium_sensitivity", "enum": ["disable", "low_sensitivity", "medium_sensitivity",
"high_sensitivity"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}}, "description": "Use Azure Content Safety to detect
harmful content.", "module": "promptflow.tools.azure_content_safety", "function":
"analyze_text", "is_builtin": true, "package": "promptflow-tools", "package_version":
"1.1.0rc2", "enable_kwargs": false, "deprecated_tools": ["content_safety_text.tools.content_safety_text_tool.analyze_text"],
"tool_state": "stable"}, {"name": "Embedding", "type": "python", "inputs":
{"connection": {"type": ["AzureOpenAIConnection", "OpenAIConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "deployment_name":
{"type": ["string"], "enabled_by": "connection", "enabled_by_type": ["AzureOpenAIConnection"],
"model_list": ["text-embedding-ada-002", "text-search-ada-doc-001", "text-search-ada-query-001"],
"capabilities": {"completion": false, "chat_completion": false, "embeddings":
true}, "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "input": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "model": {"type": ["string"], "enum": ["text-embedding-ada-002",
"text-search-ada-doc-001", "text-search-ada-query-001"], "enabled_by": "connection",
"enabled_by_type": ["OpenAIConnection"], "allow_manual_entry": true, "is_multi_select":
false, "input_type": "default"}}, "description": "Use Open AI''s embedding
model to create an embedding vector representing the input text.", "module":
"promptflow.tools.embedding", "function": "embedding", "is_builtin": true,
"package": "promptflow-tools", "package_version": "1.1.0rc2", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Open Model LLM", "type": "custom_llm",
"inputs": {"api": {"type": ["string"], "enum": ["chat", "completion"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "deployment_name":
{"type": ["string"], "default": "", "dynamic_list": {"func_path": "promptflow.tools.open_model_llm.list_deployment_names",
"func_kwargs": [{"name": "endpoint", "optional": true, "reference": "${inputs.endpoint}",
"type": ["string"]}]}, "allow_manual_entry": true, "is_multi_select": false,
"input_type": "default"}, "endpoint_name": {"type": ["string"], "dynamic_list":
{"func_path": "promptflow.tools.open_model_llm.list_endpoint_names"}, "allow_manual_entry":
true, "is_multi_select": false, "input_type": "default"}, "max_new_tokens":
{"type": ["int"], "default": 500, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "model_kwargs": {"type": ["object"], "default":
"{}", "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default", "advanced": true}, "temperature": {"type": ["double"], "default":
1.0, "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "top_p": {"type": ["double"], "default": 1.0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default", "advanced": true}},
"description": "Use an open model from the Azure Model catalog, deployed to
an AzureML Online Endpoint for LLM Chat or Completion API calls.", "module":
"promptflow.tools.open_model_llm", "class_name": "OpenModelLLM", "function":
"call", "icon": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACgElEQVR4nGWSz2vcVRTFP/e9NzOZ1KDGohASslLEH6VLV0ak4l/QpeDCrfQPcNGliODKnVm4EBdBsIjQIlhciKW0ycKFVCSNbYnjdDLtmPnmO/nO9917XcxMkjYX3uLx7nnn3HOuMK2Nix4fP78ZdrYXVkLVWjf3l3B1B+HpcjzGFtmqa6cePz7/x0dnn1n5qhj3iBJPYREIURAJuCtpY8PjReDbrf9WG7H1fuefwQU9qKztTcMJT+PNnEFvjGVDBDlSsH6p/9MLzy6+NxwVqI8RAg4IPmWedMckdLYP6O6UpIaQfvyyXG012+e79/ZfHukoS1ISMT2hGTB1RkUmNgQ5QZ0w+a2VWDq73MbdEWmfnnv6UWe7oNzPaLapl5CwuLTXK9WUGBuCjqekzhP+z52ZXOrKMD3OJg0Hh778aiOuvpnYvp05d6GJO4iAO4QAe/eV36/X5LFRV4Zmn+AdkqlL8Vjp3oVioOz+WTPzzYEgsN+fgPLYyJVheSbPPVl2ikeGZRjtG52/8rHuaV9VOlpP2OtKyVndcRVCSqOhsvxa4vW359i6OuKdD+aP8Q4SYPdOzS/flGjt1JUSaMqZ5nwa1Y8qWb/Ud/eZZkHisYezEM0m+fcelDr8F1SqW2LNK6r1jXQwyLzy1hxvrLXZulry7ocL+FS6G4QIu3fG/Px1gdYeW7LIgXU2P/115TOA5G7e3Rmj2aS/m7l5pThiZzrCcE/d1XHzbln373nw7y6veeoUm5KCNKT/IPPwbiY1hYd/l5MIT65BMFt87sU4v9D7/JMflr44uV6hGh1+L4RCkg6z5iK2tAhNLeLsNGwYA4fDYnC/drvuuFxe86NV/x+Ut27g0FvykgAAAABJRU5ErkJggg==",
"is_builtin": true, "package": "promptflow-tools", "package_version": "1.1.0rc2",
"enable_kwargs": false, "tool_state": "stable"}, {"name": "OpenAI GPT-4V",
"type": "custom_llm", "inputs": {"connection": {"type": ["OpenAIConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"frequency_penalty": {"type": ["double"], "default": 0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "max_tokens": {"type":
["int"], "default": 512, "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "model": {"type": ["string"], "enum": ["gpt-4-vision-preview"],
"allow_manual_entry": true, "is_multi_select": false, "input_type": "default"},
"presence_penalty": {"type": ["double"], "default": 0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "stop": {"type":
["list"], "default": "", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "temperature": {"type": ["double"], "default": 1,
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"top_p": {"type": ["double"], "default": 1, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use OpenAI GPT-4V to leverage
vision ability.", "module": "promptflow.tools.openai_gpt4v", "class_name":
"OpenAI", "function": "chat", "icon": {"dark": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAA2ElEQVR4nJXSzW3CQBAF4DUSTjk+Al1AD0ikESslpBIEheRALhEpgAYSWV8OGUublf/yLuP3PPNmdndS+gdwXZrYDmh7fGE/W+wXbaYd8IYm4rxJPnZ0boI3wZcdJxs/n+AwV7DFK7aFyfQdYIMLPvES8YJNf5yp4jMeeEYdWh38gXOR35YGHe5xabvQdsHv6PLi8qV6gycc8YH3iMfQu6Lh4ASr+F5Hh3XwVWnQYzUkVlX1nccplAb1SN6Y/sfgmlK64VS8wimldIv/0yj2QLkHizG0iWP4AVAfQ34DVQONAAAAAElFTkSuQmCC",
"light": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAx0lEQVR4nJWSwQ2CQBBFX0jAcjgqXUgPJNiIsQQrIVCIFy8GC6ABDcGDX7Mus9n1Xz7zZ+fPsLPwH4bUg0dD2wMPcbR48Uxq4AKU4iSTDwZ1LhWXipN/B3V0J6hjBTvgLHZNonewBXrgDpzEvXSIjN0BE3AACmmF4kl5F6tNzcCoLpW0SvGovFvsb4oZ2AANcAOu4ka6axCcINN3rg654sww+CYsPD0OwjcozFNh/Qcd78tqVbCIW+n+Fky472Bh/Q6SYb1EEy8tDzd+9IsVPAAAAABJRU5ErkJggg=="},
"is_builtin": true, "package": "promptflow-tools", "package_version": "1.1.0rc2",
"default_prompt": "# system:\nAs an AI assistant, your task involves interpreting
images and responding to questions about the image.\nRemember to provide accurate
answers based on the information present in the image.\n\n# user:\nCan you
tell me what the image depicts?\n\n", "enable_kwargs":
false, "tool_state": "preview"}, {"name": "Serp API", "type": "python", "inputs":
{"connection": {"type": ["SerpConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "engine": {"type": ["string"], "default":
"google", "enum": ["google", "bing"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "location": {"type": ["string"], "default":
"", "allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"num": {"type": ["int"], "default": "10", "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "query": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "safe": {"type":
["string"], "default": "off", "enum": ["active", "off"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}}, "description":
"Use Serp API to obtain search results from a specific search engine.", "module":
"promptflow.tools.serpapi", "class_name": "SerpAPI", "function": "search",
"is_builtin": true, "package": "promptflow-tools", "package_version": "1.1.0rc2",
"enable_kwargs": false, "tool_state": "stable"}, {"name": "Index Lookup",
"type": "python", "inputs": {"acs_content_field": {"type": ["string"], "enabled_by":
"index_type", "enabled_by_value": ["Azure AI Search"], "dynamic_list": {"func_path":
"promptflow_vectordb.tool.common_index_lookup_utils.list_acs_index_fields",
"func_kwargs": [{"name": "acs_connection", "optional": false, "reference":
"${inputs.acs_index_connection}", "type": ["CognitiveSearchConnection"]},
{"name": "acs_index_name", "optional": false, "reference": "${inputs.acs_index_name}",
"type": ["string"]}, {"default": "Edm.String", "name": "field_data_type",
"optional": false, "type": ["string"]}]}, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "uionly_hidden"}, "acs_embedding_field": {"type": ["string"],
"enabled_by": "index_type", "enabled_by_value": ["Azure AI Search"], "dynamic_list":
{"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_acs_index_fields",
"func_kwargs": [{"name": "acs_connection", "optional": false, "reference":
"${inputs.acs_index_connection}", "type": ["CognitiveSearchConnection"]},
{"name": "acs_index_name", "optional": false, "reference": "${inputs.acs_index_name}",
"type": ["string"]}, {"default": "Collection(Edm.Single)", "name": "field_data_type",
"optional": false, "type": ["string"]}]}, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "uionly_hidden"}, "acs_index_connection": {"type": ["CognitiveSearchConnection"],
"enabled_by": "index_type", "enabled_by_value": ["Azure AI Search"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "uionly_hidden"}, "acs_index_name":
{"type": ["string"], "enabled_by": "index_type", "enabled_by_value": ["Azure
AI Search"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_acs_indices",
"func_kwargs": [{"name": "acs_connection", "optional": false, "reference":
"${inputs.acs_index_connection}", "type": ["CognitiveSearchConnection"]}]},
"allow_manual_entry": false, "is_multi_select": false, "input_type": "uionly_hidden"},
"acs_metadata_field": {"type": ["string"], "enabled_by": "index_type", "enabled_by_value":
["Azure AI Search"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_acs_index_fields",
"func_kwargs": [{"name": "acs_connection", "optional": false, "reference":
"${inputs.acs_index_connection}", "type": ["CognitiveSearchConnection"]},
{"name": "acs_index_name", "optional": false, "reference": "${inputs.acs_index_name}",
"type": ["string"]}, {"default": "Edm.String", "name": "field_data_type",
"optional": false, "type": ["string"]}]}, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "uionly_hidden"}, "aoai_embedding_connection": {"type":
["AzureOpenAIConnection"], "enabled_by": "embedding_type", "enabled_by_value":
["Azure OpenAI"], "allow_manual_entry": false, "is_multi_select": false, "input_type":
"uionly_hidden"}, "embedding_deployment": {"type": ["string"], "enabled_by":
"embedding_type", "enabled_by_value": ["Azure OpenAI"], "dynamic_list": {"func_path":
"promptflow_vectordb.tool.common_index_lookup_utils.list_aoai_embedding_deployments",
"func_kwargs": [{"name": "aoai_connection", "optional": false, "reference":
"${inputs.aoai_embedding_connection}", "type": ["AzurOpenAIConnection"]}]},
"allow_manual_entry": false, "is_multi_select": false, "input_type": "uionly_hidden"},
"embedding_model": {"type": ["string"], "enabled_by": "embedding_type", "enabled_by_value":
["OpenAI", "Hugging Face"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_embedding_models",
"func_kwargs": [{"name": "embedding_type", "optional": false, "reference":
"${inputs.embedding_type}", "type": ["string"]}]}, "allow_manual_entry": false,
"is_multi_select": false, "input_type": "uionly_hidden"}, "embedding_type":
{"type": ["string"], "enabled_by": "index_type", "enabled_by_value": ["Azure
AI Search", "FAISS", "Pinecone"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_available_embedding_types",
"func_kwargs": [{"name": "index_type", "optional": false, "reference": "${inputs.index_type}",
"type": ["string"]}]}, "allow_manual_entry": false, "is_multi_select": false,
"input_type": "uionly_hidden"}, "faiss_index_path": {"type": ["string"], "enabled_by":
"index_type", "enabled_by_value": ["FAISS"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "uionly_hidden"}, "index_type": {"type":
["string"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_available_index_types"},
"allow_manual_entry": false, "is_multi_select": false, "input_type": "uionly_hidden"},
"mlindex_asset_id": {"type": ["string"], "enabled_by": "index_type", "enabled_by_value":
["Registered Index"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_registered_mlindices"},
"allow_manual_entry": false, "is_multi_select": false, "input_type": "uionly_hidden"},
"mlindex_content": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "generated_by": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.forward_mapping",
"func_kwargs": [{"name": "index_type", "reference": "${inputs.index_type}",
"type": ["string"]}, {"name": "mlindex_asset_id", "optional": true, "reference":
"${inputs.mlindex_asset_id}", "type": ["string"]}, {"name": "mlindex_path",
"optional": true, "reference": "${inputs.mlindex_path}", "type": ["string"]},
{"name": "acs_index_connection", "optional": true, "reference": "${inputs.acs_index_connection}",
"type": ["CognitiveSearchConnection"]}, {"name": "acs_index_name", "optional":
true, "reference": "${inputs.acs_index_name}", "type": ["string"]}, {"name":
"acs_content_field", "optional": true, "reference": "${inputs.acs_content_field}",
"type": ["string"]}, {"name": "acs_embedding_field", "optional": true, "reference":
"${inputs.acs_embedding_field}", "type": ["string"]}, {"name": "acs_metadata_field",
"optional": true, "reference": "${inputs.acs_metadata_field}", "type": ["string"]},
{"name": "semantic_configuration", "optional": true, "reference": "${inputs.semantic_configuration}",
"type": ["string"]}, {"name": "faiss_index_path", "optional": true, "reference":
"${inputs.faiss_index_path}", "type": ["string"]}, {"name": "pinecone_index_connection",
"optional": true, "reference": "${inputs.pinecone_index_connection}", "type":
["string"]}, {"name": "pinecone_index_name", "optional": true, "reference":
"${inputs.pinecone_index_name}", "type": ["string"]}, {"name": "pinecone_content_field",
"optional": true, "reference": "${inputs.pinecone_content_field}", "type":
["string"]}, {"name": "pinecone_metadata_field", "optional": true, "reference":
"${inputs.pinecone_metadata_field}", "type": ["string"]}, {"name": "embedding_type",
"optional": true, "reference": "${inputs.embedding_type}", "type": ["string"]},
{"name": "aoai_embedding_connection", "optional": true, "reference": "${inputs.aoai_embedding_connection}",
"type": ["AzureOpenAIConnection"]}, {"name": "oai_embedding_connection", "optional":
true, "reference": "${inputs.oai_embedding_connection}", "type": ["string"]},
{"name": "embedding_model", "optional": true, "reference": "${inputs.embedding_model}",
"type": ["string"]}, {"name": "embedding_deployment", "optional": true, "reference":
"${inputs.embedding_deployment}", "type": ["string"]}], "reverse_func_path":
"promptflow_vectordb.tool.common_index_lookup_utils.reverse_mapping"}, "input_type":
"default"}, "mlindex_path": {"type": ["string"], "enabled_by": "index_type",
"enabled_by_value": ["MLIndex file from path"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "uionly_hidden"}, "oai_embedding_connection":
{"type": ["OpenAIConnection"], "enabled_by": "embedding_type", "enabled_by_value":
["OpenAI"], "allow_manual_entry": false, "is_multi_select": false, "input_type":
"uionly_hidden"}, "pinecone_content_field": {"type": ["string"], "enabled_by":
"index_type", "enabled_by_value": ["Pinecone"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "uionly_hidden"}, "pinecone_index_connection":
{"type": ["PineconeConnection"], "enabled_by": "index_type", "enabled_by_value":
["Pinecone"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_pinecone_connections"},
"allow_manual_entry": false, "is_multi_select": false, "input_type": "uionly_hidden"},
"pinecone_index_name": {"type": ["string"], "enabled_by": "index_type", "enabled_by_value":
["Pinecone"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_pinecone_indices",
"func_kwargs": [{"name": "pinecone_connection_name", "optional": false, "reference":
"${inputs.pinecone_index_connection}", "type": ["string"]}]}, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "uionly_hidden"}, "pinecone_metadata_field":
{"type": ["string"], "enabled_by": "index_type", "enabled_by_value": ["Pinecone"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "uionly_hidden"},
"queries": {"type": ["object"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "query_type": {"type": ["string"], "dynamic_list":
{"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_available_query_types",
"func_kwargs": [{"name": "mlindex_content", "optional": false, "reference":
"${inputs.mlindex_content}", "type": ["string"]}]}, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "semantic_configuration":
{"type": ["string"], "enabled_by": "index_type", "enabled_by_value": ["Azure
AI Search"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_acs_index_semantic_configurations",
"func_kwargs": [{"name": "acs_connection", "optional": false, "reference":
"${inputs.acs_index_connection}", "type": ["CognitiveSearchConnection"]},
{"name": "acs_index_name", "optional": false, "reference": "${inputs.acs_index_name}",
"type": ["string"]}]}, "allow_manual_entry": false, "is_multi_select": false,
"input_type": "uionly_hidden"}, "top_k": {"type": ["int"], "default": 3, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}}, "description":
"Search an AzureML Vector Index for relevant results using one or more text
queries.", "module": "promptflow_vectordb.tool.common_index_lookup", "function":
"search", "is_builtin": true, "package": "promptflow-vectordb", "package_version":
"0.0.1", "enable_kwargs": false, "tool_state": "preview"}, {"name": "Faiss
Index Lookup", "type": "python", "inputs": {"path": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "top_k": {"type":
["int"], "default": "3", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "vector": {"type": ["list"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}}, "description":
"Search vector based query from the FAISS index file.", "module": "promptflow_vectordb.tool.faiss_index_lookup",
"class_name": "FaissIndexLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Vector DB Lookup", "type": "python",
"inputs": {"class_name": {"type": ["string"], "enabled_by": "connection",
"enabled_by_type": ["WeaviateConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "collection_name": {"type": ["string"], "enabled_by":
"connection", "enabled_by_type": ["QdrantConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "connection": {"type":
["CognitiveSearchConnection", "QdrantConnection", "WeaviateConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "index_name": {"type":
["string"], "enabled_by": "connection", "enabled_by_type": ["CognitiveSearchConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"search_filters": {"type": ["object"], "enabled_by": "connection", "enabled_by_type":
["CognitiveSearchConnection", "QdrantConnection"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "default"}, "search_params": {"type":
["object"], "enabled_by": "connection", "enabled_by_type": ["CognitiveSearchConnection",
"QdrantConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "text_field": {"type": ["string"], "enabled_by":
"connection", "enabled_by_type": ["CognitiveSearchConnection", "QdrantConnection",
"WeaviateConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "top_k": {"type": ["int"], "default": "3", "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "vector": {"type":
["list"], "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "vector_field": {"type": ["string"], "enabled_by": "connection",
"enabled_by_type": ["CognitiveSearchConnection"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "default"}}, "description": "Search
vector based query from existing Vector Database.", "module": "promptflow_vectordb.tool.vector_db_lookup",
"class_name": "VectorDBLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Vector Index Lookup", "type": "python",
"inputs": {"path": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "query": {"type": ["object"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "top_k": {"type":
["int"], "default": "3", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}}, "description": "Search text or vector based query
from AzureML Vector Index.", "module": "promptflow_vectordb.tool.vector_index_lookup",
"class_name": "VectorIndexLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "print_env.py", "type": "python",
"inputs": {"key": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "source": "print_env.py", "function": "get_env_var",
"is_builtin": false, "enable_kwargs": false, "tool_state": "stable"}], "inputs":
{"key": {"type": "string", "is_chat_input": false}}, "outputs": {"output":
{"type": "string", "reference": "${print_env.output.value}", "evaluation_only":
false, "is_chat_output": false}}}, "flowRunResourceId": "azureml://locations/eastus/workspaces/00000/flows/name/flowRuns/name",
"flowRunId": "name", "flowRunDisplayName": "name", "batchDataInput": {"dataUri":
"azureml://datastores/workspaceblobstore/paths/LocalUpload/c32a61842e439cecc022ebcff5dc0da4/env_var_names.jsonl"},
"flowRunType": "FlowRun", "flowType": "Default", "runtimeName": "automatic",
"inputsMapping": {}, "outputDatastoreName": "workspaceblobstore", "childRunBasePath":
"promptflow/PromptFlowArtifacts/name/flow_artifacts", "flowDagFileRelativePath":
"flow.dag.yaml", "flowSnapshotId": "f70ec21e-2e5f-4f8a-8877-19d060899638",
"studioPortalEndpoint": "https://ml.azure.com/runs/name?wsid=/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000"}'
headers:
connection:
- keep-alive
content-length:
- '26127'
content-type:
- application/json; charset=utf-8
strict-transport-security:
- max-age=15724800; includeSubDomains; preload
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '0.299'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- promptflow-sdk/0.0.1 azsdk-python-azuremachinelearningdesignerserviceclient/unknown
Python/3.11.5 (Windows-10-10.0.22621-SP0)
method: GET
uri: https://eastus.api.azureml.ms/flow/api/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/BulkRuns/name
response:
body:
string: '{"flowGraph": {"nodes": [{"name": "print_env", "type": "python", "source":
{"type": "code", "path": "print_env.py"}, "inputs": {"key": "${inputs.key}"},
"tool": "print_env.py", "reduce": false}], "tools": [{"name": "Azure OpenAI
GPT-4 Turbo with Vision", "type": "custom_llm", "inputs": {"connection": {"type":
["AzureOpenAIConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "deployment_name": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "frequency_penalty":
{"type": ["double"], "default": 0, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "max_tokens": {"type": ["int"], "default":
512, "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "presence_penalty": {"type": ["double"], "default": 0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "stop": {"type":
["list"], "default": "", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "temperature": {"type": ["double"], "default": 1,
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"top_p": {"type": ["double"], "default": 1, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use Azure OpenAI GPT-4 Turbo
with Vision to leverage AOAI vision ability.", "module": "promptflow.tools.aoai_gpt4v",
"class_name": "AzureOpenAI", "function": "chat", "icon": {"dark": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAA2ElEQVR4nJXSzW3CQBAF4DUSTjk+Al1AD0ikESslpBIEheRALhEpgAYSWV8OGUublf/yLuP3PPNmdndS+gdwXZrYDmh7fGE/W+wXbaYd8IYm4rxJPnZ0boI3wZcdJxs/n+AwV7DFK7aFyfQdYIMLPvES8YJNf5yp4jMeeEYdWh38gXOR35YGHe5xabvQdsHv6PLi8qV6gycc8YH3iMfQu6Lh4ASr+F5Hh3XwVWnQYzUkVlX1nccplAb1SN6Y/sfgmlK64VS8wimldIv/0yj2QLkHizG0iWP4AVAfQ34DVQONAAAAAElFTkSuQmCC",
"light": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAx0lEQVR4nJWSwQ2CQBBFX0jAcjgqXUgPJNiIsQQrIVCIFy8GC6ABDcGDX7Mus9n1Xz7zZ+fPsLPwH4bUg0dD2wMPcbR48Uxq4AKU4iSTDwZ1LhWXipN/B3V0J6hjBTvgLHZNonewBXrgDpzEvXSIjN0BE3AACmmF4kl5F6tNzcCoLpW0SvGovFvsb4oZ2AANcAOu4ka6axCcINN3rg654sww+CYsPD0OwjcozFNh/Qcd78tqVbCIW+n+Fky472Bh/Q6SYb1EEy8tDzd+9IsVPAAAAABJRU5ErkJggg=="},
"is_builtin": true, "package": "promptflow-tools", "package_version": "1.1.0rc2",
"default_prompt": "# system:\nAs an AI assistant, your task involves interpreting
images and responding to questions about the image.\nRemember to provide accurate
answers based on the information present in the image.\n\n# user:\nCan you
tell me what the image depicts?\n\n", "enable_kwargs":
false, "tool_state": "preview"}, {"name": "Content Safety (Text Analyze)",
"type": "python", "inputs": {"connection": {"type": ["AzureContentSafetyConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"hate_category": {"type": ["string"], "default": "medium_sensitivity", "enum":
["disable", "low_sensitivity", "medium_sensitivity", "high_sensitivity"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"self_harm_category": {"type": ["string"], "default": "medium_sensitivity",
"enum": ["disable", "low_sensitivity", "medium_sensitivity", "high_sensitivity"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"sexual_category": {"type": ["string"], "default": "medium_sensitivity", "enum":
["disable", "low_sensitivity", "medium_sensitivity", "high_sensitivity"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"text": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "violence_category": {"type": ["string"],
"default": "medium_sensitivity", "enum": ["disable", "low_sensitivity", "medium_sensitivity",
"high_sensitivity"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}}, "description": "Use Azure Content Safety to detect
harmful content.", "module": "promptflow.tools.azure_content_safety", "function":
"analyze_text", "is_builtin": true, "package": "promptflow-tools", "package_version":
"1.1.0rc2", "enable_kwargs": false, "deprecated_tools": ["content_safety_text.tools.content_safety_text_tool.analyze_text"],
"tool_state": "stable"}, {"name": "Embedding", "type": "python", "inputs":
{"connection": {"type": ["AzureOpenAIConnection", "OpenAIConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "deployment_name":
{"type": ["string"], "enabled_by": "connection", "enabled_by_type": ["AzureOpenAIConnection"],
"model_list": ["text-embedding-ada-002", "text-search-ada-doc-001", "text-search-ada-query-001"],
"capabilities": {"completion": false, "chat_completion": false, "embeddings":
true}, "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "input": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "model": {"type": ["string"], "enum": ["text-embedding-ada-002",
"text-search-ada-doc-001", "text-search-ada-query-001"], "enabled_by": "connection",
"enabled_by_type": ["OpenAIConnection"], "allow_manual_entry": true, "is_multi_select":
false, "input_type": "default"}}, "description": "Use Open AI''s embedding
model to create an embedding vector representing the input text.", "module":
"promptflow.tools.embedding", "function": "embedding", "is_builtin": true,
"package": "promptflow-tools", "package_version": "1.1.0rc2", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Open Model LLM", "type": "custom_llm",
"inputs": {"api": {"type": ["string"], "enum": ["chat", "completion"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "deployment_name":
{"type": ["string"], "default": "", "dynamic_list": {"func_path": "promptflow.tools.open_model_llm.list_deployment_names",
"func_kwargs": [{"name": "endpoint", "optional": true, "reference": "${inputs.endpoint}",
"type": ["string"]}]}, "allow_manual_entry": true, "is_multi_select": false,
"input_type": "default"}, "endpoint_name": {"type": ["string"], "dynamic_list":
{"func_path": "promptflow.tools.open_model_llm.list_endpoint_names"}, "allow_manual_entry":
true, "is_multi_select": false, "input_type": "default"}, "max_new_tokens":
{"type": ["int"], "default": 500, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "model_kwargs": {"type": ["object"], "default":
"{}", "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default", "advanced": true}, "temperature": {"type": ["double"], "default":
1.0, "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "top_p": {"type": ["double"], "default": 1.0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default", "advanced": true}},
"description": "Use an open model from the Azure Model catalog, deployed to
an AzureML Online Endpoint for LLM Chat or Completion API calls.", "module":
"promptflow.tools.open_model_llm", "class_name": "OpenModelLLM", "function":
"call", "icon": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACgElEQVR4nGWSz2vcVRTFP/e9NzOZ1KDGohASslLEH6VLV0ak4l/QpeDCrfQPcNGliODKnVm4EBdBsIjQIlhciKW0ycKFVCSNbYnjdDLtmPnmO/nO9917XcxMkjYX3uLx7nnn3HOuMK2Nix4fP78ZdrYXVkLVWjf3l3B1B+HpcjzGFtmqa6cePz7/x0dnn1n5qhj3iBJPYREIURAJuCtpY8PjReDbrf9WG7H1fuefwQU9qKztTcMJT+PNnEFvjGVDBDlSsH6p/9MLzy6+NxwVqI8RAg4IPmWedMckdLYP6O6UpIaQfvyyXG012+e79/ZfHukoS1ISMT2hGTB1RkUmNgQ5QZ0w+a2VWDq73MbdEWmfnnv6UWe7oNzPaLapl5CwuLTXK9WUGBuCjqekzhP+z52ZXOrKMD3OJg0Hh778aiOuvpnYvp05d6GJO4iAO4QAe/eV36/X5LFRV4Zmn+AdkqlL8Vjp3oVioOz+WTPzzYEgsN+fgPLYyJVheSbPPVl2ikeGZRjtG52/8rHuaV9VOlpP2OtKyVndcRVCSqOhsvxa4vW359i6OuKdD+aP8Q4SYPdOzS/flGjt1JUSaMqZ5nwa1Y8qWb/Ud/eZZkHisYezEM0m+fcelDr8F1SqW2LNK6r1jXQwyLzy1hxvrLXZulry7ocL+FS6G4QIu3fG/Px1gdYeW7LIgXU2P/115TOA5G7e3Rmj2aS/m7l5pThiZzrCcE/d1XHzbln373nw7y6veeoUm5KCNKT/IPPwbiY1hYd/l5MIT65BMFt87sU4v9D7/JMflr44uV6hGh1+L4RCkg6z5iK2tAhNLeLsNGwYA4fDYnC/drvuuFxe86NV/x+Ut27g0FvykgAAAABJRU5ErkJggg==",
"is_builtin": true, "package": "promptflow-tools", "package_version": "1.1.0rc2",
"enable_kwargs": false, "tool_state": "stable"}, {"name": "OpenAI GPT-4V",
"type": "custom_llm", "inputs": {"connection": {"type": ["OpenAIConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"frequency_penalty": {"type": ["double"], "default": 0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "max_tokens": {"type":
["int"], "default": 512, "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "model": {"type": ["string"], "enum": ["gpt-4-vision-preview"],
"allow_manual_entry": true, "is_multi_select": false, "input_type": "default"},
"presence_penalty": {"type": ["double"], "default": 0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "stop": {"type":
["list"], "default": "", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "temperature": {"type": ["double"], "default": 1,
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"top_p": {"type": ["double"], "default": 1, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use OpenAI GPT-4V to leverage
vision ability.", "module": "promptflow.tools.openai_gpt4v", "class_name":
"OpenAI", "function": "chat", "icon": {"dark": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAA2ElEQVR4nJXSzW3CQBAF4DUSTjk+Al1AD0ikESslpBIEheRALhEpgAYSWV8OGUublf/yLuP3PPNmdndS+gdwXZrYDmh7fGE/W+wXbaYd8IYm4rxJPnZ0boI3wZcdJxs/n+AwV7DFK7aFyfQdYIMLPvES8YJNf5yp4jMeeEYdWh38gXOR35YGHe5xabvQdsHv6PLi8qV6gycc8YH3iMfQu6Lh4ASr+F5Hh3XwVWnQYzUkVlX1nccplAb1SN6Y/sfgmlK64VS8wimldIv/0yj2QLkHizG0iWP4AVAfQ34DVQONAAAAAElFTkSuQmCC",
"light": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAx0lEQVR4nJWSwQ2CQBBFX0jAcjgqXUgPJNiIsQQrIVCIFy8GC6ABDcGDX7Mus9n1Xz7zZ+fPsLPwH4bUg0dD2wMPcbR48Uxq4AKU4iSTDwZ1LhWXipN/B3V0J6hjBTvgLHZNonewBXrgDpzEvXSIjN0BE3AACmmF4kl5F6tNzcCoLpW0SvGovFvsb4oZ2AANcAOu4ka6axCcINN3rg654sww+CYsPD0OwjcozFNh/Qcd78tqVbCIW+n+Fky472Bh/Q6SYb1EEy8tDzd+9IsVPAAAAABJRU5ErkJggg=="},
"is_builtin": true, "package": "promptflow-tools", "package_version": "1.1.0rc2",
"default_prompt": "# system:\nAs an AI assistant, your task involves interpreting
images and responding to questions about the image.\nRemember to provide accurate
answers based on the information present in the image.\n\n# user:\nCan you
tell me what the image depicts?\n\n", "enable_kwargs":
false, "tool_state": "preview"}, {"name": "Serp API", "type": "python", "inputs":
{"connection": {"type": ["SerpConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "engine": {"type": ["string"], "default":
"google", "enum": ["google", "bing"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "location": {"type": ["string"], "default":
"", "allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"num": {"type": ["int"], "default": "10", "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "query": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "safe": {"type":
["string"], "default": "off", "enum": ["active", "off"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}}, "description":
"Use Serp API to obtain search results from a specific search engine.", "module":
"promptflow.tools.serpapi", "class_name": "SerpAPI", "function": "search",
"is_builtin": true, "package": "promptflow-tools", "package_version": "1.1.0rc2",
"enable_kwargs": false, "tool_state": "stable"}, {"name": "Index Lookup",
"type": "python", "inputs": {"acs_content_field": {"type": ["string"], "enabled_by":
"index_type", "enabled_by_value": ["Azure AI Search"], "dynamic_list": {"func_path":
"promptflow_vectordb.tool.common_index_lookup_utils.list_acs_index_fields",
"func_kwargs": [{"name": "acs_connection", "optional": false, "reference":
"${inputs.acs_index_connection}", "type": ["CognitiveSearchConnection"]},
{"name": "acs_index_name", "optional": false, "reference": "${inputs.acs_index_name}",
"type": ["string"]}, {"default": "Edm.String", "name": "field_data_type",
"optional": false, "type": ["string"]}]}, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "uionly_hidden"}, "acs_embedding_field": {"type": ["string"],
"enabled_by": "index_type", "enabled_by_value": ["Azure AI Search"], "dynamic_list":
{"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_acs_index_fields",
"func_kwargs": [{"name": "acs_connection", "optional": false, "reference":
"${inputs.acs_index_connection}", "type": ["CognitiveSearchConnection"]},
{"name": "acs_index_name", "optional": false, "reference": "${inputs.acs_index_name}",
"type": ["string"]}, {"default": "Collection(Edm.Single)", "name": "field_data_type",
"optional": false, "type": ["string"]}]}, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "uionly_hidden"}, "acs_index_connection": {"type": ["CognitiveSearchConnection"],
"enabled_by": "index_type", "enabled_by_value": ["Azure AI Search"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "uionly_hidden"}, "acs_index_name":
{"type": ["string"], "enabled_by": "index_type", "enabled_by_value": ["Azure
AI Search"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_acs_indices",
"func_kwargs": [{"name": "acs_connection", "optional": false, "reference":
"${inputs.acs_index_connection}", "type": ["CognitiveSearchConnection"]}]},
"allow_manual_entry": false, "is_multi_select": false, "input_type": "uionly_hidden"},
"acs_metadata_field": {"type": ["string"], "enabled_by": "index_type", "enabled_by_value":
["Azure AI Search"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_acs_index_fields",
"func_kwargs": [{"name": "acs_connection", "optional": false, "reference":
"${inputs.acs_index_connection}", "type": ["CognitiveSearchConnection"]},
{"name": "acs_index_name", "optional": false, "reference": "${inputs.acs_index_name}",
"type": ["string"]}, {"default": "Edm.String", "name": "field_data_type",
"optional": false, "type": ["string"]}]}, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "uionly_hidden"}, "aoai_embedding_connection": {"type":
["AzureOpenAIConnection"], "enabled_by": "embedding_type", "enabled_by_value":
["Azure OpenAI"], "allow_manual_entry": false, "is_multi_select": false, "input_type":
"uionly_hidden"}, "embedding_deployment": {"type": ["string"], "enabled_by":
"embedding_type", "enabled_by_value": ["Azure OpenAI"], "dynamic_list": {"func_path":
"promptflow_vectordb.tool.common_index_lookup_utils.list_aoai_embedding_deployments",
"func_kwargs": [{"name": "aoai_connection", "optional": false, "reference":
"${inputs.aoai_embedding_connection}", "type": ["AzurOpenAIConnection"]}]},
"allow_manual_entry": false, "is_multi_select": false, "input_type": "uionly_hidden"},
"embedding_model": {"type": ["string"], "enabled_by": "embedding_type", "enabled_by_value":
["OpenAI", "Hugging Face"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_embedding_models",
"func_kwargs": [{"name": "embedding_type", "optional": false, "reference":
"${inputs.embedding_type}", "type": ["string"]}]}, "allow_manual_entry": false,
"is_multi_select": false, "input_type": "uionly_hidden"}, "embedding_type":
{"type": ["string"], "enabled_by": "index_type", "enabled_by_value": ["Azure
AI Search", "FAISS", "Pinecone"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_available_embedding_types",
"func_kwargs": [{"name": "index_type", "optional": false, "reference": "${inputs.index_type}",
"type": ["string"]}]}, "allow_manual_entry": false, "is_multi_select": false,
"input_type": "uionly_hidden"}, "faiss_index_path": {"type": ["string"], "enabled_by":
"index_type", "enabled_by_value": ["FAISS"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "uionly_hidden"}, "index_type": {"type":
["string"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_available_index_types"},
"allow_manual_entry": false, "is_multi_select": false, "input_type": "uionly_hidden"},
"mlindex_asset_id": {"type": ["string"], "enabled_by": "index_type", "enabled_by_value":
["Registered Index"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_registered_mlindices"},
"allow_manual_entry": false, "is_multi_select": false, "input_type": "uionly_hidden"},
"mlindex_content": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "generated_by": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.forward_mapping",
"func_kwargs": [{"name": "index_type", "reference": "${inputs.index_type}",
"type": ["string"]}, {"name": "mlindex_asset_id", "optional": true, "reference":
"${inputs.mlindex_asset_id}", "type": ["string"]}, {"name": "mlindex_path",
"optional": true, "reference": "${inputs.mlindex_path}", "type": ["string"]},
{"name": "acs_index_connection", "optional": true, "reference": "${inputs.acs_index_connection}",
"type": ["CognitiveSearchConnection"]}, {"name": "acs_index_name", "optional":
true, "reference": "${inputs.acs_index_name}", "type": ["string"]}, {"name":
"acs_content_field", "optional": true, "reference": "${inputs.acs_content_field}",
"type": ["string"]}, {"name": "acs_embedding_field", "optional": true, "reference":
"${inputs.acs_embedding_field}", "type": ["string"]}, {"name": "acs_metadata_field",
"optional": true, "reference": "${inputs.acs_metadata_field}", "type": ["string"]},
{"name": "semantic_configuration", "optional": true, "reference": "${inputs.semantic_configuration}",
"type": ["string"]}, {"name": "faiss_index_path", "optional": true, "reference":
"${inputs.faiss_index_path}", "type": ["string"]}, {"name": "pinecone_index_connection",
"optional": true, "reference": "${inputs.pinecone_index_connection}", "type":
["string"]}, {"name": "pinecone_index_name", "optional": true, "reference":
"${inputs.pinecone_index_name}", "type": ["string"]}, {"name": "pinecone_content_field",
"optional": true, "reference": "${inputs.pinecone_content_field}", "type":
["string"]}, {"name": "pinecone_metadata_field", "optional": true, "reference":
"${inputs.pinecone_metadata_field}", "type": ["string"]}, {"name": "embedding_type",
"optional": true, "reference": "${inputs.embedding_type}", "type": ["string"]},
{"name": "aoai_embedding_connection", "optional": true, "reference": "${inputs.aoai_embedding_connection}",
"type": ["AzureOpenAIConnection"]}, {"name": "oai_embedding_connection", "optional":
true, "reference": "${inputs.oai_embedding_connection}", "type": ["string"]},
{"name": "embedding_model", "optional": true, "reference": "${inputs.embedding_model}",
"type": ["string"]}, {"name": "embedding_deployment", "optional": true, "reference":
"${inputs.embedding_deployment}", "type": ["string"]}], "reverse_func_path":
"promptflow_vectordb.tool.common_index_lookup_utils.reverse_mapping"}, "input_type":
"default"}, "mlindex_path": {"type": ["string"], "enabled_by": "index_type",
"enabled_by_value": ["MLIndex file from path"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "uionly_hidden"}, "oai_embedding_connection":
{"type": ["OpenAIConnection"], "enabled_by": "embedding_type", "enabled_by_value":
["OpenAI"], "allow_manual_entry": false, "is_multi_select": false, "input_type":
"uionly_hidden"}, "pinecone_content_field": {"type": ["string"], "enabled_by":
"index_type", "enabled_by_value": ["Pinecone"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "uionly_hidden"}, "pinecone_index_connection":
{"type": ["PineconeConnection"], "enabled_by": "index_type", "enabled_by_value":
["Pinecone"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_pinecone_connections"},
"allow_manual_entry": false, "is_multi_select": false, "input_type": "uionly_hidden"},
"pinecone_index_name": {"type": ["string"], "enabled_by": "index_type", "enabled_by_value":
["Pinecone"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_pinecone_indices",
"func_kwargs": [{"name": "pinecone_connection_name", "optional": false, "reference":
"${inputs.pinecone_index_connection}", "type": ["string"]}]}, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "uionly_hidden"}, "pinecone_metadata_field":
{"type": ["string"], "enabled_by": "index_type", "enabled_by_value": ["Pinecone"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "uionly_hidden"},
"queries": {"type": ["object"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "query_type": {"type": ["string"], "dynamic_list":
{"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_available_query_types",
"func_kwargs": [{"name": "mlindex_content", "optional": false, "reference":
"${inputs.mlindex_content}", "type": ["string"]}]}, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "semantic_configuration":
{"type": ["string"], "enabled_by": "index_type", "enabled_by_value": ["Azure
AI Search"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_acs_index_semantic_configurations",
"func_kwargs": [{"name": "acs_connection", "optional": false, "reference":
"${inputs.acs_index_connection}", "type": ["CognitiveSearchConnection"]},
{"name": "acs_index_name", "optional": false, "reference": "${inputs.acs_index_name}",
"type": ["string"]}]}, "allow_manual_entry": false, "is_multi_select": false,
"input_type": "uionly_hidden"}, "top_k": {"type": ["int"], "default": 3, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}}, "description":
"Search an AzureML Vector Index for relevant results using one or more text
queries.", "module": "promptflow_vectordb.tool.common_index_lookup", "function":
"search", "is_builtin": true, "package": "promptflow-vectordb", "package_version":
"0.0.1", "enable_kwargs": false, "tool_state": "preview"}, {"name": "Faiss
Index Lookup", "type": "python", "inputs": {"path": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "top_k": {"type":
["int"], "default": "3", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "vector": {"type": ["list"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}}, "description":
"Search vector based query from the FAISS index file.", "module": "promptflow_vectordb.tool.faiss_index_lookup",
"class_name": "FaissIndexLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Vector DB Lookup", "type": "python",
"inputs": {"class_name": {"type": ["string"], "enabled_by": "connection",
"enabled_by_type": ["WeaviateConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "collection_name": {"type": ["string"], "enabled_by":
"connection", "enabled_by_type": ["QdrantConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "connection": {"type":
["CognitiveSearchConnection", "QdrantConnection", "WeaviateConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "index_name": {"type":
["string"], "enabled_by": "connection", "enabled_by_type": ["CognitiveSearchConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"search_filters": {"type": ["object"], "enabled_by": "connection", "enabled_by_type":
["CognitiveSearchConnection", "QdrantConnection"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "default"}, "search_params": {"type":
["object"], "enabled_by": "connection", "enabled_by_type": ["CognitiveSearchConnection",
"QdrantConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "text_field": {"type": ["string"], "enabled_by":
"connection", "enabled_by_type": ["CognitiveSearchConnection", "QdrantConnection",
"WeaviateConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "top_k": {"type": ["int"], "default": "3", "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "vector": {"type":
["list"], "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "vector_field": {"type": ["string"], "enabled_by": "connection",
"enabled_by_type": ["CognitiveSearchConnection"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "default"}}, "description": "Search
vector based query from existing Vector Database.", "module": "promptflow_vectordb.tool.vector_db_lookup",
"class_name": "VectorDBLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Vector Index Lookup", "type": "python",
"inputs": {"path": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "query": {"type": ["object"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "top_k": {"type":
["int"], "default": "3", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}}, "description": "Search text or vector based query
from AzureML Vector Index.", "module": "promptflow_vectordb.tool.vector_index_lookup",
"class_name": "VectorIndexLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "print_env.py", "type": "python",
"inputs": {"key": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "source": "print_env.py", "function": "get_env_var",
"is_builtin": false, "enable_kwargs": false, "tool_state": "stable"}], "inputs":
{"key": {"type": "string", "is_chat_input": false}}, "outputs": {"output":
{"type": "string", "reference": "${print_env.output.value}", "evaluation_only":
false, "is_chat_output": false}}}, "flowRunResourceId": "azureml://locations/eastus/workspaces/00000/flows/name/flowRuns/name",
"flowRunId": "name", "flowRunDisplayName": "name", "batchDataInput": {"dataUri":
"azureml://datastores/workspaceblobstore/paths/LocalUpload/c32a61842e439cecc022ebcff5dc0da4/env_var_names.jsonl"},
"flowRunType": "FlowRun", "flowType": "Default", "runtimeName": "automatic",
"inputsMapping": {}, "outputDatastoreName": "workspaceblobstore", "childRunBasePath":
"promptflow/PromptFlowArtifacts/name/flow_artifacts", "flowDagFileRelativePath":
"flow.dag.yaml", "flowSnapshotId": "f70ec21e-2e5f-4f8a-8877-19d060899638",
"studioPortalEndpoint": "https://ml.azure.com/runs/name?wsid=/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000"}'
headers:
connection:
- keep-alive
content-length:
- '26127'
content-type:
- application/json; charset=utf-8
strict-transport-security:
- max-age=15724800; includeSubDomains; preload
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '1.342'
status:
code: 200
message: OK
- request:
body: '{}'
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
Content-Length:
- '2'
Content-Type:
- application/json
User-Agent:
- python-requests/2.31.0
method: POST
uri: https://eastus.api.azureml.ms/metric/v2.0/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/runs/name/lastvalues
response:
body:
string: '{"value": [{"dataContainerId": "dcid.name", "name": "__pf__.nodes.print_env.completed",
"columns": {"__pf__.nodes.print_env.completed": "Double"}, "properties": {"uxMetricType":
"azureml.v1.scalar", "dataLocation": null}, "namespace": null, "standardSchemaId":
null, "value": [{"metricId": "01092792-6bd6-45aa-868a-973271205a28", "createdUtc":
"2024-01-19T08:11:45.231+00:00", "step": 0, "data": {"__pf__.nodes.print_env.completed":
1.0}}]}, {"dataContainerId": "dcid.name", "name": "__pf__.lines.completed",
"columns": {"__pf__.lines.completed": "Double"}, "properties": {"uxMetricType":
"azureml.v1.scalar", "dataLocation": null}, "namespace": null, "standardSchemaId":
null, "value": [{"metricId": "6dc08009-42ee-4619-90ab-9a43b1b5912b", "createdUtc":
"2024-01-19T08:11:45.607+00:00", "step": 0, "data": {"__pf__.lines.completed":
1.0}}]}, {"dataContainerId": "dcid.name", "name": "__pf__.lines.failed", "columns":
{"__pf__.lines.failed": "Double"}, "properties": {"uxMetricType": "azureml.v1.scalar",
"dataLocation": null}, "namespace": null, "standardSchemaId": null, "value":
[{"metricId": "4339576f-f2a2-4246-aca2-e899080b64c4", "createdUtc": "2024-01-19T08:11:46.017+00:00",
"step": 0, "data": {"__pf__.lines.failed": 0.0}}]}]}'
headers:
connection:
- keep-alive
content-length:
- '1885'
content-type:
- application/json; charset=utf-8
strict-transport-security:
- max-age=15724800; includeSubDomains; preload
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '0.060'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- promptflow-sdk/0.0.1 azsdk-python-azuremachinelearningdesignerserviceclient/unknown
Python/3.11.5 (Windows-10-10.0.22621-SP0)
method: GET
uri: https://eastus.api.azureml.ms/flow/api/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/BulkRuns/name
response:
body:
string: '{"flowGraph": {"nodes": [{"name": "print_env", "type": "python", "source":
{"type": "code", "path": "print_env.py"}, "inputs": {"key": "${inputs.key}"},
"tool": "print_env.py", "reduce": false}], "tools": [{"name": "Azure OpenAI
GPT-4 Turbo with Vision", "type": "custom_llm", "inputs": {"connection": {"type":
["AzureOpenAIConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "deployment_name": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "frequency_penalty":
{"type": ["double"], "default": 0, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "max_tokens": {"type": ["int"], "default":
512, "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "presence_penalty": {"type": ["double"], "default": 0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "stop": {"type":
["list"], "default": "", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "temperature": {"type": ["double"], "default": 1,
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"top_p": {"type": ["double"], "default": 1, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use Azure OpenAI GPT-4 Turbo
with Vision to leverage AOAI vision ability.", "module": "promptflow.tools.aoai_gpt4v",
"class_name": "AzureOpenAI", "function": "chat", "icon": {"dark": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAA2ElEQVR4nJXSzW3CQBAF4DUSTjk+Al1AD0ikESslpBIEheRALhEpgAYSWV8OGUublf/yLuP3PPNmdndS+gdwXZrYDmh7fGE/W+wXbaYd8IYm4rxJPnZ0boI3wZcdJxs/n+AwV7DFK7aFyfQdYIMLPvES8YJNf5yp4jMeeEYdWh38gXOR35YGHe5xabvQdsHv6PLi8qV6gycc8YH3iMfQu6Lh4ASr+F5Hh3XwVWnQYzUkVlX1nccplAb1SN6Y/sfgmlK64VS8wimldIv/0yj2QLkHizG0iWP4AVAfQ34DVQONAAAAAElFTkSuQmCC",
"light": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAx0lEQVR4nJWSwQ2CQBBFX0jAcjgqXUgPJNiIsQQrIVCIFy8GC6ABDcGDX7Mus9n1Xz7zZ+fPsLPwH4bUg0dD2wMPcbR48Uxq4AKU4iSTDwZ1LhWXipN/B3V0J6hjBTvgLHZNonewBXrgDpzEvXSIjN0BE3AACmmF4kl5F6tNzcCoLpW0SvGovFvsb4oZ2AANcAOu4ka6axCcINN3rg654sww+CYsPD0OwjcozFNh/Qcd78tqVbCIW+n+Fky472Bh/Q6SYb1EEy8tDzd+9IsVPAAAAABJRU5ErkJggg=="},
"is_builtin": true, "package": "promptflow-tools", "package_version": "1.1.0rc2",
"default_prompt": "# system:\nAs an AI assistant, your task involves interpreting
images and responding to questions about the image.\nRemember to provide accurate
answers based on the information present in the image.\n\n# user:\nCan you
tell me what the image depicts?\n\n", "enable_kwargs":
false, "tool_state": "preview"}, {"name": "Content Safety (Text Analyze)",
"type": "python", "inputs": {"connection": {"type": ["AzureContentSafetyConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"hate_category": {"type": ["string"], "default": "medium_sensitivity", "enum":
["disable", "low_sensitivity", "medium_sensitivity", "high_sensitivity"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"self_harm_category": {"type": ["string"], "default": "medium_sensitivity",
"enum": ["disable", "low_sensitivity", "medium_sensitivity", "high_sensitivity"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"sexual_category": {"type": ["string"], "default": "medium_sensitivity", "enum":
["disable", "low_sensitivity", "medium_sensitivity", "high_sensitivity"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"text": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "violence_category": {"type": ["string"],
"default": "medium_sensitivity", "enum": ["disable", "low_sensitivity", "medium_sensitivity",
"high_sensitivity"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}}, "description": "Use Azure Content Safety to detect
harmful content.", "module": "promptflow.tools.azure_content_safety", "function":
"analyze_text", "is_builtin": true, "package": "promptflow-tools", "package_version":
"1.1.0rc2", "enable_kwargs": false, "deprecated_tools": ["content_safety_text.tools.content_safety_text_tool.analyze_text"],
"tool_state": "stable"}, {"name": "Embedding", "type": "python", "inputs":
{"connection": {"type": ["AzureOpenAIConnection", "OpenAIConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "deployment_name":
{"type": ["string"], "enabled_by": "connection", "enabled_by_type": ["AzureOpenAIConnection"],
"model_list": ["text-embedding-ada-002", "text-search-ada-doc-001", "text-search-ada-query-001"],
"capabilities": {"completion": false, "chat_completion": false, "embeddings":
true}, "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "input": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "model": {"type": ["string"], "enum": ["text-embedding-ada-002",
"text-search-ada-doc-001", "text-search-ada-query-001"], "enabled_by": "connection",
"enabled_by_type": ["OpenAIConnection"], "allow_manual_entry": true, "is_multi_select":
false, "input_type": "default"}}, "description": "Use Open AI''s embedding
model to create an embedding vector representing the input text.", "module":
"promptflow.tools.embedding", "function": "embedding", "is_builtin": true,
"package": "promptflow-tools", "package_version": "1.1.0rc2", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Open Model LLM", "type": "custom_llm",
"inputs": {"api": {"type": ["string"], "enum": ["chat", "completion"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "deployment_name":
{"type": ["string"], "default": "", "dynamic_list": {"func_path": "promptflow.tools.open_model_llm.list_deployment_names",
"func_kwargs": [{"name": "endpoint", "optional": true, "reference": "${inputs.endpoint}",
"type": ["string"]}]}, "allow_manual_entry": true, "is_multi_select": false,
"input_type": "default"}, "endpoint_name": {"type": ["string"], "dynamic_list":
{"func_path": "promptflow.tools.open_model_llm.list_endpoint_names"}, "allow_manual_entry":
true, "is_multi_select": false, "input_type": "default"}, "max_new_tokens":
{"type": ["int"], "default": 500, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "model_kwargs": {"type": ["object"], "default":
"{}", "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default", "advanced": true}, "temperature": {"type": ["double"], "default":
1.0, "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "top_p": {"type": ["double"], "default": 1.0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default", "advanced": true}},
"description": "Use an open model from the Azure Model catalog, deployed to
an AzureML Online Endpoint for LLM Chat or Completion API calls.", "module":
"promptflow.tools.open_model_llm", "class_name": "OpenModelLLM", "function":
"call", "icon": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACgElEQVR4nGWSz2vcVRTFP/e9NzOZ1KDGohASslLEH6VLV0ak4l/QpeDCrfQPcNGliODKnVm4EBdBsIjQIlhciKW0ycKFVCSNbYnjdDLtmPnmO/nO9917XcxMkjYX3uLx7nnn3HOuMK2Nix4fP78ZdrYXVkLVWjf3l3B1B+HpcjzGFtmqa6cePz7/x0dnn1n5qhj3iBJPYREIURAJuCtpY8PjReDbrf9WG7H1fuefwQU9qKztTcMJT+PNnEFvjGVDBDlSsH6p/9MLzy6+NxwVqI8RAg4IPmWedMckdLYP6O6UpIaQfvyyXG012+e79/ZfHukoS1ISMT2hGTB1RkUmNgQ5QZ0w+a2VWDq73MbdEWmfnnv6UWe7oNzPaLapl5CwuLTXK9WUGBuCjqekzhP+z52ZXOrKMD3OJg0Hh778aiOuvpnYvp05d6GJO4iAO4QAe/eV36/X5LFRV4Zmn+AdkqlL8Vjp3oVioOz+WTPzzYEgsN+fgPLYyJVheSbPPVl2ikeGZRjtG52/8rHuaV9VOlpP2OtKyVndcRVCSqOhsvxa4vW359i6OuKdD+aP8Q4SYPdOzS/flGjt1JUSaMqZ5nwa1Y8qWb/Ud/eZZkHisYezEM0m+fcelDr8F1SqW2LNK6r1jXQwyLzy1hxvrLXZulry7ocL+FS6G4QIu3fG/Px1gdYeW7LIgXU2P/115TOA5G7e3Rmj2aS/m7l5pThiZzrCcE/d1XHzbln373nw7y6veeoUm5KCNKT/IPPwbiY1hYd/l5MIT65BMFt87sU4v9D7/JMflr44uV6hGh1+L4RCkg6z5iK2tAhNLeLsNGwYA4fDYnC/drvuuFxe86NV/x+Ut27g0FvykgAAAABJRU5ErkJggg==",
"is_builtin": true, "package": "promptflow-tools", "package_version": "1.1.0rc2",
"enable_kwargs": false, "tool_state": "stable"}, {"name": "OpenAI GPT-4V",
"type": "custom_llm", "inputs": {"connection": {"type": ["OpenAIConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"frequency_penalty": {"type": ["double"], "default": 0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "max_tokens": {"type":
["int"], "default": 512, "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "model": {"type": ["string"], "enum": ["gpt-4-vision-preview"],
"allow_manual_entry": true, "is_multi_select": false, "input_type": "default"},
"presence_penalty": {"type": ["double"], "default": 0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "stop": {"type":
["list"], "default": "", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "temperature": {"type": ["double"], "default": 1,
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"top_p": {"type": ["double"], "default": 1, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use OpenAI GPT-4V to leverage
vision ability.", "module": "promptflow.tools.openai_gpt4v", "class_name":
"OpenAI", "function": "chat", "icon": {"dark": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAA2ElEQVR4nJXSzW3CQBAF4DUSTjk+Al1AD0ikESslpBIEheRALhEpgAYSWV8OGUublf/yLuP3PPNmdndS+gdwXZrYDmh7fGE/W+wXbaYd8IYm4rxJPnZ0boI3wZcdJxs/n+AwV7DFK7aFyfQdYIMLPvES8YJNf5yp4jMeeEYdWh38gXOR35YGHe5xabvQdsHv6PLi8qV6gycc8YH3iMfQu6Lh4ASr+F5Hh3XwVWnQYzUkVlX1nccplAb1SN6Y/sfgmlK64VS8wimldIv/0yj2QLkHizG0iWP4AVAfQ34DVQONAAAAAElFTkSuQmCC",
"light": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAx0lEQVR4nJWSwQ2CQBBFX0jAcjgqXUgPJNiIsQQrIVCIFy8GC6ABDcGDX7Mus9n1Xz7zZ+fPsLPwH4bUg0dD2wMPcbR48Uxq4AKU4iSTDwZ1LhWXipN/B3V0J6hjBTvgLHZNonewBXrgDpzEvXSIjN0BE3AACmmF4kl5F6tNzcCoLpW0SvGovFvsb4oZ2AANcAOu4ka6axCcINN3rg654sww+CYsPD0OwjcozFNh/Qcd78tqVbCIW+n+Fky472Bh/Q6SYb1EEy8tDzd+9IsVPAAAAABJRU5ErkJggg=="},
"is_builtin": true, "package": "promptflow-tools", "package_version": "1.1.0rc2",
"default_prompt": "# system:\nAs an AI assistant, your task involves interpreting
images and responding to questions about the image.\nRemember to provide accurate
answers based on the information present in the image.\n\n# user:\nCan you
tell me what the image depicts?\n\n", "enable_kwargs":
false, "tool_state": "preview"}, {"name": "Serp API", "type": "python", "inputs":
{"connection": {"type": ["SerpConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "engine": {"type": ["string"], "default":
"google", "enum": ["google", "bing"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "location": {"type": ["string"], "default":
"", "allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"num": {"type": ["int"], "default": "10", "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "query": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "safe": {"type":
["string"], "default": "off", "enum": ["active", "off"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}}, "description":
"Use Serp API to obtain search results from a specific search engine.", "module":
"promptflow.tools.serpapi", "class_name": "SerpAPI", "function": "search",
"is_builtin": true, "package": "promptflow-tools", "package_version": "1.1.0rc2",
"enable_kwargs": false, "tool_state": "stable"}, {"name": "Index Lookup",
"type": "python", "inputs": {"acs_content_field": {"type": ["string"], "enabled_by":
"index_type", "enabled_by_value": ["Azure AI Search"], "dynamic_list": {"func_path":
"promptflow_vectordb.tool.common_index_lookup_utils.list_acs_index_fields",
"func_kwargs": [{"name": "acs_connection", "optional": false, "reference":
"${inputs.acs_index_connection}", "type": ["CognitiveSearchConnection"]},
{"name": "acs_index_name", "optional": false, "reference": "${inputs.acs_index_name}",
"type": ["string"]}, {"default": "Edm.String", "name": "field_data_type",
"optional": false, "type": ["string"]}]}, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "uionly_hidden"}, "acs_embedding_field": {"type": ["string"],
"enabled_by": "index_type", "enabled_by_value": ["Azure AI Search"], "dynamic_list":
{"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_acs_index_fields",
"func_kwargs": [{"name": "acs_connection", "optional": false, "reference":
"${inputs.acs_index_connection}", "type": ["CognitiveSearchConnection"]},
{"name": "acs_index_name", "optional": false, "reference": "${inputs.acs_index_name}",
"type": ["string"]}, {"default": "Collection(Edm.Single)", "name": "field_data_type",
"optional": false, "type": ["string"]}]}, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "uionly_hidden"}, "acs_index_connection": {"type": ["CognitiveSearchConnection"],
"enabled_by": "index_type", "enabled_by_value": ["Azure AI Search"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "uionly_hidden"}, "acs_index_name":
{"type": ["string"], "enabled_by": "index_type", "enabled_by_value": ["Azure
AI Search"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_acs_indices",
"func_kwargs": [{"name": "acs_connection", "optional": false, "reference":
"${inputs.acs_index_connection}", "type": ["CognitiveSearchConnection"]}]},
"allow_manual_entry": false, "is_multi_select": false, "input_type": "uionly_hidden"},
"acs_metadata_field": {"type": ["string"], "enabled_by": "index_type", "enabled_by_value":
["Azure AI Search"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_acs_index_fields",
"func_kwargs": [{"name": "acs_connection", "optional": false, "reference":
"${inputs.acs_index_connection}", "type": ["CognitiveSearchConnection"]},
{"name": "acs_index_name", "optional": false, "reference": "${inputs.acs_index_name}",
"type": ["string"]}, {"default": "Edm.String", "name": "field_data_type",
"optional": false, "type": ["string"]}]}, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "uionly_hidden"}, "aoai_embedding_connection": {"type":
["AzureOpenAIConnection"], "enabled_by": "embedding_type", "enabled_by_value":
["Azure OpenAI"], "allow_manual_entry": false, "is_multi_select": false, "input_type":
"uionly_hidden"}, "embedding_deployment": {"type": ["string"], "enabled_by":
"embedding_type", "enabled_by_value": ["Azure OpenAI"], "dynamic_list": {"func_path":
"promptflow_vectordb.tool.common_index_lookup_utils.list_aoai_embedding_deployments",
"func_kwargs": [{"name": "aoai_connection", "optional": false, "reference":
"${inputs.aoai_embedding_connection}", "type": ["AzurOpenAIConnection"]}]},
"allow_manual_entry": false, "is_multi_select": false, "input_type": "uionly_hidden"},
"embedding_model": {"type": ["string"], "enabled_by": "embedding_type", "enabled_by_value":
["OpenAI", "Hugging Face"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_embedding_models",
"func_kwargs": [{"name": "embedding_type", "optional": false, "reference":
"${inputs.embedding_type}", "type": ["string"]}]}, "allow_manual_entry": false,
"is_multi_select": false, "input_type": "uionly_hidden"}, "embedding_type":
{"type": ["string"], "enabled_by": "index_type", "enabled_by_value": ["Azure
AI Search", "FAISS", "Pinecone"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_available_embedding_types",
"func_kwargs": [{"name": "index_type", "optional": false, "reference": "${inputs.index_type}",
"type": ["string"]}]}, "allow_manual_entry": false, "is_multi_select": false,
"input_type": "uionly_hidden"}, "faiss_index_path": {"type": ["string"], "enabled_by":
"index_type", "enabled_by_value": ["FAISS"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "uionly_hidden"}, "index_type": {"type":
["string"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_available_index_types"},
"allow_manual_entry": false, "is_multi_select": false, "input_type": "uionly_hidden"},
"mlindex_asset_id": {"type": ["string"], "enabled_by": "index_type", "enabled_by_value":
["Registered Index"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_registered_mlindices"},
"allow_manual_entry": false, "is_multi_select": false, "input_type": "uionly_hidden"},
"mlindex_content": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "generated_by": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.forward_mapping",
"func_kwargs": [{"name": "index_type", "reference": "${inputs.index_type}",
"type": ["string"]}, {"name": "mlindex_asset_id", "optional": true, "reference":
"${inputs.mlindex_asset_id}", "type": ["string"]}, {"name": "mlindex_path",
"optional": true, "reference": "${inputs.mlindex_path}", "type": ["string"]},
{"name": "acs_index_connection", "optional": true, "reference": "${inputs.acs_index_connection}",
"type": ["CognitiveSearchConnection"]}, {"name": "acs_index_name", "optional":
true, "reference": "${inputs.acs_index_name}", "type": ["string"]}, {"name":
"acs_content_field", "optional": true, "reference": "${inputs.acs_content_field}",
"type": ["string"]}, {"name": "acs_embedding_field", "optional": true, "reference":
"${inputs.acs_embedding_field}", "type": ["string"]}, {"name": "acs_metadata_field",
"optional": true, "reference": "${inputs.acs_metadata_field}", "type": ["string"]},
{"name": "semantic_configuration", "optional": true, "reference": "${inputs.semantic_configuration}",
"type": ["string"]}, {"name": "faiss_index_path", "optional": true, "reference":
"${inputs.faiss_index_path}", "type": ["string"]}, {"name": "pinecone_index_connection",
"optional": true, "reference": "${inputs.pinecone_index_connection}", "type":
["string"]}, {"name": "pinecone_index_name", "optional": true, "reference":
"${inputs.pinecone_index_name}", "type": ["string"]}, {"name": "pinecone_content_field",
"optional": true, "reference": "${inputs.pinecone_content_field}", "type":
["string"]}, {"name": "pinecone_metadata_field", "optional": true, "reference":
"${inputs.pinecone_metadata_field}", "type": ["string"]}, {"name": "embedding_type",
"optional": true, "reference": "${inputs.embedding_type}", "type": ["string"]},
{"name": "aoai_embedding_connection", "optional": true, "reference": "${inputs.aoai_embedding_connection}",
"type": ["AzureOpenAIConnection"]}, {"name": "oai_embedding_connection", "optional":
true, "reference": "${inputs.oai_embedding_connection}", "type": ["string"]},
{"name": "embedding_model", "optional": true, "reference": "${inputs.embedding_model}",
"type": ["string"]}, {"name": "embedding_deployment", "optional": true, "reference":
"${inputs.embedding_deployment}", "type": ["string"]}], "reverse_func_path":
"promptflow_vectordb.tool.common_index_lookup_utils.reverse_mapping"}, "input_type":
"default"}, "mlindex_path": {"type": ["string"], "enabled_by": "index_type",
"enabled_by_value": ["MLIndex file from path"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "uionly_hidden"}, "oai_embedding_connection":
{"type": ["OpenAIConnection"], "enabled_by": "embedding_type", "enabled_by_value":
["OpenAI"], "allow_manual_entry": false, "is_multi_select": false, "input_type":
"uionly_hidden"}, "pinecone_content_field": {"type": ["string"], "enabled_by":
"index_type", "enabled_by_value": ["Pinecone"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "uionly_hidden"}, "pinecone_index_connection":
{"type": ["PineconeConnection"], "enabled_by": "index_type", "enabled_by_value":
["Pinecone"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_pinecone_connections"},
"allow_manual_entry": false, "is_multi_select": false, "input_type": "uionly_hidden"},
"pinecone_index_name": {"type": ["string"], "enabled_by": "index_type", "enabled_by_value":
["Pinecone"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_pinecone_indices",
"func_kwargs": [{"name": "pinecone_connection_name", "optional": false, "reference":
"${inputs.pinecone_index_connection}", "type": ["string"]}]}, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "uionly_hidden"}, "pinecone_metadata_field":
{"type": ["string"], "enabled_by": "index_type", "enabled_by_value": ["Pinecone"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "uionly_hidden"},
"queries": {"type": ["object"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "query_type": {"type": ["string"], "dynamic_list":
{"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_available_query_types",
"func_kwargs": [{"name": "mlindex_content", "optional": false, "reference":
"${inputs.mlindex_content}", "type": ["string"]}]}, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "semantic_configuration":
{"type": ["string"], "enabled_by": "index_type", "enabled_by_value": ["Azure
AI Search"], "dynamic_list": {"func_path": "promptflow_vectordb.tool.common_index_lookup_utils.list_acs_index_semantic_configurations",
"func_kwargs": [{"name": "acs_connection", "optional": false, "reference":
"${inputs.acs_index_connection}", "type": ["CognitiveSearchConnection"]},
{"name": "acs_index_name", "optional": false, "reference": "${inputs.acs_index_name}",
"type": ["string"]}]}, "allow_manual_entry": false, "is_multi_select": false,
"input_type": "uionly_hidden"}, "top_k": {"type": ["int"], "default": 3, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}}, "description":
"Search an AzureML Vector Index for relevant results using one or more text
queries.", "module": "promptflow_vectordb.tool.common_index_lookup", "function":
"search", "is_builtin": true, "package": "promptflow-vectordb", "package_version":
"0.0.1", "enable_kwargs": false, "tool_state": "preview"}, {"name": "Faiss
Index Lookup", "type": "python", "inputs": {"path": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "top_k": {"type":
["int"], "default": "3", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "vector": {"type": ["list"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}}, "description":
"Search vector based query from the FAISS index file.", "module": "promptflow_vectordb.tool.faiss_index_lookup",
"class_name": "FaissIndexLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Vector DB Lookup", "type": "python",
"inputs": {"class_name": {"type": ["string"], "enabled_by": "connection",
"enabled_by_type": ["WeaviateConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "collection_name": {"type": ["string"], "enabled_by":
"connection", "enabled_by_type": ["QdrantConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "connection": {"type":
["CognitiveSearchConnection", "QdrantConnection", "WeaviateConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "index_name": {"type":
["string"], "enabled_by": "connection", "enabled_by_type": ["CognitiveSearchConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"search_filters": {"type": ["object"], "enabled_by": "connection", "enabled_by_type":
["CognitiveSearchConnection", "QdrantConnection"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "default"}, "search_params": {"type":
["object"], "enabled_by": "connection", "enabled_by_type": ["CognitiveSearchConnection",
"QdrantConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "text_field": {"type": ["string"], "enabled_by":
"connection", "enabled_by_type": ["CognitiveSearchConnection", "QdrantConnection",
"WeaviateConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "top_k": {"type": ["int"], "default": "3", "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "vector": {"type":
["list"], "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "vector_field": {"type": ["string"], "enabled_by": "connection",
"enabled_by_type": ["CognitiveSearchConnection"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "default"}}, "description": "Search
vector based query from existing Vector Database.", "module": "promptflow_vectordb.tool.vector_db_lookup",
"class_name": "VectorDBLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Vector Index Lookup", "type": "python",
"inputs": {"path": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "query": {"type": ["object"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "top_k": {"type":
["int"], "default": "3", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}}, "description": "Search text or vector based query
from AzureML Vector Index.", "module": "promptflow_vectordb.tool.vector_index_lookup",
"class_name": "VectorIndexLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "print_env.py", "type": "python",
"inputs": {"key": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "source": "print_env.py", "function": "get_env_var",
"is_builtin": false, "enable_kwargs": false, "tool_state": "stable"}], "inputs":
{"key": {"type": "string", "is_chat_input": false}}, "outputs": {"output":
{"type": "string", "reference": "${print_env.output.value}", "evaluation_only":
false, "is_chat_output": false}}}, "flowRunResourceId": "azureml://locations/eastus/workspaces/00000/flows/name/flowRuns/name",
"flowRunId": "name", "flowRunDisplayName": "name", "batchDataInput": {"dataUri":
"azureml://datastores/workspaceblobstore/paths/LocalUpload/c32a61842e439cecc022ebcff5dc0da4/env_var_names.jsonl"},
"flowRunType": "FlowRun", "flowType": "Default", "runtimeName": "automatic",
"inputsMapping": {}, "outputDatastoreName": "workspaceblobstore", "childRunBasePath":
"promptflow/PromptFlowArtifacts/name/flow_artifacts", "flowDagFileRelativePath":
"flow.dag.yaml", "flowSnapshotId": "f70ec21e-2e5f-4f8a-8877-19d060899638",
"studioPortalEndpoint": "https://ml.azure.com/runs/name?wsid=/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000"}'
headers:
connection:
- keep-alive
content-length:
- '26127'
content-type:
- application/json; charset=utf-8
strict-transport-security:
- max-age=15724800; includeSubDomains; preload
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '0.365'
status:
code: 200
message: OK
- request:
body: '{"value": "azureml://locations/eastus/workspaces/00000/data/azureml_name_output_data_debug_info/versions/1"}'
headers:
accept:
- '*/*'
accept-encoding:
- gzip, deflate
connection:
- keep-alive
content-length:
- '171'
content-type:
- application/json
host:
- eastus.api.azureml.ms
user-agent:
- python-httpx/0.26.0
method: POST
uri: https://eastus.api.azureml.ms/data/v1.0/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/dataversion/getByAssetId
response:
content: '{"dataVersion": {"assetId": "azureml://locations/eastus/workspaces/00000/data/azureml_name_output_data_debug_info/versions/1",
"dataContainerName": "azureml_name_output_data_debug_info", "dataType": "UriFolder",
"dataUri": "azureml://subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/00000/workspaces/00000/datastores/workspaceblobstore/paths/promptflow/PromptFlowArtifacts/name/",
"versionId": "1", "mutableProps": {"dataExpiryTime": null, "description": null,
"tags": null, "isArchived": false, "stage": "Logged", "autoDeleteSetting": null},
"referencedDataUris": null, "properties": null, "initialAssetId": "azureml://locations/eastus/workspaces/00000/data/azureml_name_output_data_debug_info/versions/1",
"isRegistered": false, "runId": "name", "originAssetId": null}, "entityMetadata":
{"etag": "\"2f00b525-0000-0100-0000-65aa2ecc0000\"", "createdTime": "2024-01-19T08:11:56.5286266+00:00",
"modifiedTime": "2024-01-19T08:11:56.5367895+00:00", "createdBy": {"userObjectId":
"00000000-0000-0000-0000-000000000000", "userPuId": "100320005227D154", "userIdp":
null, "userAltSecId": null, "userIss": "https://sts.windows.net/00000000-0000-0000-0000-000000000000/",
"userTenantId": "00000000-0000-0000-0000-000000000000", "userName": "Han Wang",
"upn": "[email protected]"}, "modifiedBy": null}, "legacyDatasetId": "04ab4f78-3116-4f3f-b6f5-dd98f4d14ff8",
"isV2": true, "legacyDatasetType": null, "legacyDataflowType": null, "legacyDataflow":
null, "legacySavedDatasetId": null, "putAssetLROResponseDto": null}'
headers:
connection:
- keep-alive
content-type:
- application/json; charset=utf-8
strict-transport-security:
- max-age=15724800; includeSubDomains; preload
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '0.039'
http_version: HTTP/1.1
status_code: 200
- request:
body: '{"snapshotOrAssetId": "f70ec21e-2e5f-4f8a-8877-19d060899638"}'
headers:
accept:
- '*/*'
accept-encoding:
- gzip, deflate
connection:
- keep-alive
content-length:
- '61'
content-type:
- application/json
host:
- eastus.api.azureml.ms
user-agent:
- python-httpx/0.26.0
method: POST
uri: https://eastus.api.azureml.ms/content/v2.0/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/snapshots/sas
response:
content: '{"name": "", "hash": null, "type": "Directory", "timestamp": "0001-01-01T00:00:00+00:00",
"sasUrl": null, "absoluteUrl": null, "sizeBytes": 0, "sizeSet": false, "children":
{"flow.dag.yaml": {"name": "flow.dag.yaml", "hash": "24CE4714C02FA409AEADB8878E7E204E",
"type": "File", "timestamp": "0001-01-01T00:00:00+00:00", "sasUrl": "https://promptfloweast4063704120.blob.core.windows.net/azureml-blobstore-3e123da1-f9a5-4c91-9234-8d9ffbb39ff5/runs/name/flow.dag.yaml?sv=2019-07-07&sr=b&sig=IrX0ZM%2FdLL%2BgZS75bUdarEhFwZYtQ8Etksmtrw%2FQpi0%3D&st=2024-01-19T08%3A03%3A36Z&se=2024-01-19T16%3A13%3A36Z&sp=r&rscd=filename%3Dflow.dag.yaml",
"absoluteUrl": "https://promptfloweast4063704120.blob.core.windows.net/azureml-blobstore-3e123da1-f9a5-4c91-9234-8d9ffbb39ff5/runs/name/flow.dag.yaml",
"sizeBytes": 300, "sizeSet": true, "children": {}}, "print_env.py": {"name":
"print_env.py", "hash": "B668E4950699A7A20D8129DC61D34581", "type": "File",
"timestamp": "0001-01-01T00:00:00+00:00", "sasUrl": "https://promptfloweast4063704120.blob.core.windows.net/azureml-blobstore-3e123da1-f9a5-4c91-9234-8d9ffbb39ff5/runs/name/print_env.py?sv=2019-07-07&sr=b&sig=tGiNZjTCTMAQ%2BLE3YSC%2F4NemP0qBbNI9Alyc7JPoztw%3D&st=2024-01-19T08%3A03%3A36Z&se=2024-01-19T16%3A13%3A36Z&sp=r&rscd=filename%3Dprint_env.py",
"absoluteUrl": "https://promptfloweast4063704120.blob.core.windows.net/azureml-blobstore-3e123da1-f9a5-4c91-9234-8d9ffbb39ff5/runs/name/print_env.py",
"sizeBytes": 248, "sizeSet": true, "children": {}}, "requirements": {"name":
"requirements", "hash": "2C39BC19B761AC36DC046245D1D47FE6", "type": "File",
"timestamp": "0001-01-01T00:00:00+00:00", "sasUrl": "https://promptfloweast4063704120.blob.core.windows.net/azureml-blobstore-3e123da1-f9a5-4c91-9234-8d9ffbb39ff5/runs/name/requirements?sv=2019-07-07&sr=b&sig=FKorDxRbWkYZkpIH2%2Bbh%2FjFXW5wb62Re4sMqlEl5F%2B4%3D&st=2024-01-19T08%3A03%3A36Z&se=2024-01-19T16%3A13%3A36Z&sp=r&rscd=filename%3Drequirements",
"absoluteUrl": "https://promptfloweast4063704120.blob.core.windows.net/azureml-blobstore-3e123da1-f9a5-4c91-9234-8d9ffbb39ff5/runs/name/requirements",
"sizeBytes": 10, "sizeSet": true, "children": {}}}}'
headers:
connection:
- keep-alive
content-type:
- application/json; charset=utf-8
strict-transport-security:
- max-age=15724800; includeSubDomains; preload
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '0.048'
http_version: HTTP/1.1
status_code: 200
- request:
body: null
headers:
Accept:
- application/xml
User-Agent:
- azsdk-python-storage-blob/12.19.0 Python/3.11.5 (Windows-10-10.0.22621-SP0)
x-ms-date:
- Fri, 19 Jan 2024 08:13:40 GMT
x-ms-range:
- bytes=0-33554431
x-ms-version:
- '2023-11-03'
method: GET
uri: https://fake_account_name.blob.core.windows.net/fake-container-name/runs/name/flow.dag.yaml
response:
body:
string: "inputs:\r\n key:\r\n type: string\r\noutputs:\r\n output:\r\n
\ type: string\r\n reference: ${print_env.output.value}\r\nnodes:\r\n-
name: print_env\r\n type: python\r\n source:\r\n type: code\r\n path:
print_env.py\r\n inputs:\r\n key: ${inputs.key}\r\nenvironment:\r\n python_requirements_txt:
requirements\r\n"
headers:
accept-ranges:
- bytes
content-length:
- '300'
content-range:
- bytes 0-299/300
content-type:
- application/octet-stream
last-modified:
- Fri, 19 Jan 2024 08:11:29 GMT
server:
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
vary:
- Origin
x-ms-blob-content-md5:
- JM5HFMAvpAmurbiHjn4gTg==
x-ms-blob-type:
- BlockBlob
x-ms-copy-completion-time:
- Fri, 19 Jan 2024 08:11:29 GMT
x-ms-copy-id:
- 7c4d31aa-4ce9-45c1-83da-0aa076508ac7
x-ms-copy-progress:
- 300/300
x-ms-copy-source:
- https://promptfloweast4063704120.blob.core.windows.net/azureml-blobstore-3e123da1-f9a5-4c91-9234-8d9ffbb39ff5/LocalUpload/74854f49405e7ffcddc484d043cf0ef3/code_with_additional_includes/flow.dag.yaml
x-ms-copy-status:
- success
x-ms-creation-time:
- Fri, 19 Jan 2024 08:11:29 GMT
x-ms-meta-name:
- 10fdeb53-9a64-43e0-8211-9f82a8918f9e
x-ms-meta-upload_status:
- completed
x-ms-meta-version:
- '1'
x-ms-version:
- '2023-11-03'
status:
code: 206
message: Partial Content
- request:
body: null
headers:
Accept:
- application/xml
User-Agent:
- azsdk-python-storage-blob/12.19.0 Python/3.11.5 (Windows-10-10.0.22621-SP0)
x-ms-date:
- Fri, 19 Jan 2024 08:13:40 GMT
x-ms-range:
- bytes=0-33554431
x-ms-version:
- '2023-11-03'
method: GET
uri: https://fake_account_name.blob.core.windows.net/fake-container-name/runs/name/requirements
response:
body:
string: tensorflow
headers:
accept-ranges:
- bytes
content-length:
- '10'
content-range:
- bytes 0-9/10
content-type:
- application/octet-stream
last-modified:
- Fri, 19 Jan 2024 08:11:29 GMT
server:
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
vary:
- Origin
x-ms-blob-content-md5:
- LDm8GbdhrDbcBGJF0dR/5g==
x-ms-blob-type:
- BlockBlob
x-ms-copy-completion-time:
- Fri, 19 Jan 2024 08:11:29 GMT
x-ms-copy-id:
- fdd5ec4f-d3ab-4e64-9c48-63daf3e9bb2b
x-ms-copy-progress:
- 10/10
x-ms-copy-source:
- https://promptfloweast4063704120.blob.core.windows.net/azureml-blobstore-3e123da1-f9a5-4c91-9234-8d9ffbb39ff5/LocalUpload/74854f49405e7ffcddc484d043cf0ef3/code_with_additional_includes/requirements
x-ms-copy-status:
- success
x-ms-creation-time:
- Fri, 19 Jan 2024 08:11:29 GMT
x-ms-version:
- '2023-11-03'
status:
code: 206
message: Partial Content
- request:
body: null
headers:
Accept:
- application/xml
User-Agent:
- azsdk-python-storage-blob/12.19.0 Python/3.11.5 (Windows-10-10.0.22621-SP0)
x-ms-date:
- Fri, 19 Jan 2024 08:13:40 GMT
x-ms-range:
- bytes=0-33554431
x-ms-version:
- '2023-11-03'
method: GET
uri: https://fake_account_name.blob.core.windows.net/fake-container-name/runs/name/print_env.py
response:
body:
string: "import os\r\n\r\nfrom promptflow import tool\r\n\r\n\r\n@tool\r\ndef
get_env_var(key: str):\r\n from tensorflow import __version__\r\n\r\n print(__version__)\r\n
\ print(os.environ.get(key))\r\n\r\n # get from env var\r\n return
{\"value\": os.environ.get(key)}\r\n"
headers:
accept-ranges:
- bytes
content-length:
- '248'
content-range:
- bytes 0-247/248
content-type:
- application/octet-stream
last-modified:
- Fri, 19 Jan 2024 08:11:29 GMT
server:
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
vary:
- Origin
x-ms-blob-content-md5:
- tmjklQaZp6INgSncYdNFgQ==
x-ms-blob-type:
- BlockBlob
x-ms-copy-completion-time:
- Fri, 19 Jan 2024 08:11:29 GMT
x-ms-copy-id:
- a3ba9cb2-712b-4175-9a78-e135ed562c7d
x-ms-copy-progress:
- 248/248
x-ms-copy-source:
- https://promptfloweast4063704120.blob.core.windows.net/azureml-blobstore-3e123da1-f9a5-4c91-9234-8d9ffbb39ff5/LocalUpload/74854f49405e7ffcddc484d043cf0ef3/code_with_additional_includes/print_env.py
x-ms-copy-status:
- success
x-ms-creation-time:
- Fri, 19 Jan 2024 08:11:29 GMT
x-ms-version:
- '2023-11-03'
status:
code: 206
message: Partial Content
- request:
body: null
headers:
Accept:
- application/xml
User-Agent:
- azsdk-python-storage-blob/12.19.0 Python/3.11.5 (Windows-10-10.0.22621-SP0)
x-ms-date:
- Fri, 19 Jan 2024 08:13:36 GMT
x-ms-version:
- '2023-11-03'
method: GET
uri: https://fake_account_name.blob.core.windows.net/fake-container-name?comp=list&prefix=promptflow%2FPromptFlowArtifacts%2Fname%2F&restype=container
response:
body:
string: "\uFEFF<?xml version=\"1.0\" encoding=\"utf-8\"?><EnumerationResults
ServiceEndpoint=\"https://promptfloweast4063704120.blob.core.windows.net/\"
ContainerName=\"azureml-blobstore-3e123da1-f9a5-4c91-9234-8d9ffbb39ff5\"><Prefix>promptflow/PromptFlowArtifacts/name/</Prefix><Blobs><Blob><Name>promptflow/PromptFlowArtifacts/name/flow_artifacts/000000000_000000024.jsonl</Name><Properties><Creation-Time>Fri,
19 Jan 2024 08:11:44 GMT</Creation-Time><Last-Modified>Fri, 19 Jan 2024 08:11:44
GMT</Last-Modified><Etag>0x8DC18C6464190D9</Etag><Content-Length>1432</Content-Length><Content-Type>application/octet-stream</Content-Type><Content-Encoding
/><Content-Language /><Content-CRC64 /><Content-MD5 /><Cache-Control /><Content-Disposition
/><BlobType>AppendBlob</BlobType><LeaseStatus>unlocked</LeaseStatus><LeaseState>available</LeaseState><ServerEncrypted>true</ServerEncrypted></Properties><OrMetadata
/></Blob><Blob><Name>promptflow/PromptFlowArtifacts/name/flow_outputs/output.jsonl</Name><Properties><Creation-Time>Fri,
19 Jan 2024 08:11:56 GMT</Creation-Time><Last-Modified>Fri, 19 Jan 2024 08:11:56
GMT</Last-Modified><Etag>0x8DC18C64DB586D4</Etag><Content-Length>35</Content-Length><Content-Type>application/octet-stream</Content-Type><Content-Encoding
/><Content-Language /><Content-CRC64 /><Content-MD5>/e0Zn1phO4FyeGCAse5gGw==</Content-MD5><Cache-Control
/><Content-Disposition /><BlobType>BlockBlob</BlobType><AccessTier>Hot</AccessTier><AccessTierInferred>true</AccessTierInferred><LeaseStatus>unlocked</LeaseStatus><LeaseState>available</LeaseState><ServerEncrypted>true</ServerEncrypted></Properties><OrMetadata
/></Blob><Blob><Name>promptflow/PromptFlowArtifacts/name/instance_results.jsonl</Name><Properties><Creation-Time>Fri,
19 Jan 2024 08:11:44 GMT</Creation-Time><Last-Modified>Fri, 19 Jan 2024 08:11:44
GMT</Last-Modified><Etag>0x8DC18C64645F8A6</Etag><Content-Length>109</Content-Length><Content-Type>application/octet-stream</Content-Type><Content-Encoding
/><Content-Language /><Content-CRC64 /><Content-MD5 /><Cache-Control /><Content-Disposition
/><BlobType>AppendBlob</BlobType><LeaseStatus>unlocked</LeaseStatus><LeaseState>available</LeaseState><ServerEncrypted>true</ServerEncrypted></Properties><OrMetadata
/></Blob><Blob><Name>promptflow/PromptFlowArtifacts/name/meta.json</Name><Properties><Creation-Time>Fri,
19 Jan 2024 08:11:40 GMT</Creation-Time><Last-Modified>Fri, 19 Jan 2024 08:11:40
GMT</Last-Modified><Etag>0x8DC18C64419CAF1</Etag><Content-Length>18</Content-Length><Content-Type>application/octet-stream</Content-Type><Content-Encoding
/><Content-Language /><Content-CRC64 /><Content-MD5>/u1NXUpgXMFDmZEw835qnw==</Content-MD5><Cache-Control
/><Content-Disposition /><BlobType>BlockBlob</BlobType><AccessTier>Hot</AccessTier><AccessTierInferred>true</AccessTierInferred><LeaseStatus>unlocked</LeaseStatus><LeaseState>available</LeaseState><ServerEncrypted>true</ServerEncrypted></Properties><OrMetadata
/></Blob><Blob><Name>promptflow/PromptFlowArtifacts/name/node_artifacts/print_env/000000000.jsonl</Name><Properties><Creation-Time>Fri,
19 Jan 2024 08:11:44 GMT</Creation-Time><Last-Modified>Fri, 19 Jan 2024 08:11:44
GMT</Last-Modified><Etag>0x8DC18C6463C18AF</Etag><Content-Length>1141</Content-Length><Content-Type>application/octet-stream</Content-Type><Content-Encoding
/><Content-Language /><Content-CRC64 /><Content-MD5>rDx89XmW939YhK5e8LOGYQ==</Content-MD5><Cache-Control
/><Content-Disposition /><BlobType>BlockBlob</BlobType><AccessTier>Hot</AccessTier><AccessTierInferred>true</AccessTierInferred><LeaseStatus>unlocked</LeaseStatus><LeaseState>available</LeaseState><ServerEncrypted>true</ServerEncrypted></Properties><OrMetadata
/></Blob></Blobs><NextMarker /></EnumerationResults>"
headers:
content-type:
- application/xml
server:
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
transfer-encoding:
- chunked
vary:
- Origin
x-ms-version:
- '2023-11-03'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/xml
User-Agent:
- azsdk-python-storage-blob/12.19.0 Python/3.11.5 (Windows-10-10.0.22621-SP0)
x-ms-date:
- Fri, 19 Jan 2024 08:13:43 GMT
x-ms-range:
- bytes=0-33554431
x-ms-version:
- '2023-11-03'
method: GET
uri: https://fake_account_name.blob.core.windows.net/fake-container-name/promptflow/PromptFlowArtifacts/name/flow_artifacts/000000000_000000024.jsonl
response:
body:
string: '{"line_number": 0, "run_info": {"run_id": "name_0", "status": "Completed",
"error": null, "inputs": {"key": "API_BASE", "line_number": 0}, "output":
{"output": null}, "metrics": null, "request": null, "parent_run_id": "name",
"root_run_id": "name", "source_run_id": null, "flow_id": "default_flow_id",
"start_time": "2024-01-19T08:11:41.857673Z", "end_time": "2024-01-19T08:11:44.056761Z",
"index": 0, "api_calls": [{"name": "flow", "node_name": "flow", "type": "Flow",
"start_time": 1705651901.857673, "end_time": 1705651904.056761, "children":
[{"name": "get_env_var", "type": "Tool", "inputs": {"key": "API_BASE"}, "output":
{"value": null}, "start_time": 1705651901.861366, "end_time": 1705651904.054938,
"error": null, "children": [], "node_name": "print_env", "parent_id": "",
"id": "d9302caf-a93e-469c-9dc9-86c788dcc0b5", "system_metrics": {}}], "system_metrics":
{"duration": 2.199088, "prompt_tokens": 0, "completion_tokens": 0, "total_tokens":
0}}], "variant_id": "", "name": "", "description": "", "tags": null, "system_metrics":
{"duration": 2.199088, "prompt_tokens": 0, "completion_tokens": 0, "total_tokens":
0}, "result": {"output": null}, "upload_metrics": false}, "start_time": "2024-01-19T08:11:41.857673",
"end_time": "2024-01-19T08:11:44.056761", "name": "", "description": "", "status":
"Completed", "tags": null}
'
headers:
accept-ranges:
- bytes
content-length:
- '1432'
content-range:
- bytes 0-1431/1432
content-type:
- application/octet-stream
last-modified:
- Fri, 19 Jan 2024 08:11:44 GMT
server:
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
vary:
- Origin
x-ms-blob-committed-block-count:
- '1'
x-ms-blob-type:
- AppendBlob
x-ms-creation-time:
- Fri, 19 Jan 2024 08:11:44 GMT
x-ms-version:
- '2023-11-03'
status:
code: 206
message: Partial Content
- request:
body: null
headers:
Accept:
- application/xml
User-Agent:
- azsdk-python-storage-blob/12.19.0 Python/3.11.5 (Windows-10-10.0.22621-SP0)
x-ms-date:
- Fri, 19 Jan 2024 08:13:43 GMT
x-ms-range:
- bytes=0-33554431
x-ms-version:
- '2023-11-03'
method: GET
uri: https://fake_account_name.blob.core.windows.net/fake-container-name/promptflow/PromptFlowArtifacts/name/flow_outputs/output.jsonl
response:
body:
string: '{"line_number": 0, "output": null}
'
headers:
accept-ranges:
- bytes
content-length:
- '35'
content-range:
- bytes 0-34/35
content-type:
- application/octet-stream
last-modified:
- Fri, 19 Jan 2024 08:11:56 GMT
server:
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
vary:
- Origin
x-ms-blob-content-md5:
- /e0Zn1phO4FyeGCAse5gGw==
x-ms-blob-type:
- BlockBlob
x-ms-creation-time:
- Fri, 19 Jan 2024 08:11:56 GMT
x-ms-version:
- '2023-11-03'
status:
code: 206
message: Partial Content
- request:
body: null
headers:
Accept:
- application/xml
User-Agent:
- azsdk-python-storage-blob/12.19.0 Python/3.11.5 (Windows-10-10.0.22621-SP0)
x-ms-date:
- Fri, 19 Jan 2024 08:13:43 GMT
x-ms-range:
- bytes=0-33554431
x-ms-version:
- '2023-11-03'
method: GET
uri: https://fake_account_name.blob.core.windows.net/fake-container-name/promptflow/PromptFlowArtifacts/name/instance_results.jsonl
response:
body:
string: '{"line_number": 0, "status": "Completed", "inputs.key": "API_BASE",
"inputs.line_number": 0, "output": null}
'
headers:
accept-ranges:
- bytes
content-length:
- '109'
content-range:
- bytes 0-108/109
content-type:
- application/octet-stream
last-modified:
- Fri, 19 Jan 2024 08:11:44 GMT
server:
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
vary:
- Origin
x-ms-blob-committed-block-count:
- '1'
x-ms-blob-type:
- AppendBlob
x-ms-creation-time:
- Fri, 19 Jan 2024 08:11:44 GMT
x-ms-version:
- '2023-11-03'
status:
code: 206
message: Partial Content
- request:
body: null
headers:
Accept:
- application/xml
User-Agent:
- azsdk-python-storage-blob/12.19.0 Python/3.11.5 (Windows-10-10.0.22621-SP0)
x-ms-date:
- Fri, 19 Jan 2024 08:13:43 GMT
x-ms-range:
- bytes=0-33554431
x-ms-version:
- '2023-11-03'
method: GET
uri: https://fake_account_name.blob.core.windows.net/fake-container-name/promptflow/PromptFlowArtifacts/name/meta.json
response:
body:
string: '{"batch_size": 25}'
headers:
accept-ranges:
- bytes
content-length:
- '18'
content-range:
- bytes 0-17/18
content-type:
- application/octet-stream
last-modified:
- Fri, 19 Jan 2024 08:11:40 GMT
server:
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
vary:
- Origin
x-ms-blob-content-md5:
- /u1NXUpgXMFDmZEw835qnw==
x-ms-blob-type:
- BlockBlob
x-ms-creation-time:
- Fri, 19 Jan 2024 08:11:40 GMT
x-ms-version:
- '2023-11-03'
status:
code: 206
message: Partial Content
- request:
body: null
headers:
Accept:
- application/xml
User-Agent:
- azsdk-python-storage-blob/12.19.0 Python/3.11.5 (Windows-10-10.0.22621-SP0)
x-ms-date:
- Fri, 19 Jan 2024 08:13:43 GMT
x-ms-range:
- bytes=0-33554431
x-ms-version:
- '2023-11-03'
method: GET
uri: https://fake_account_name.blob.core.windows.net/fake-container-name/promptflow/PromptFlowArtifacts/name/node_artifacts/print_env/000000000.jsonl
response:
body:
string: '{"node_name": "print_env", "line_number": 0, "run_info": {"node": "print_env",
"flow_run_id": "name", "run_id": "name_print_env_0", "status": "Completed",
"inputs": {"key": "API_BASE"}, "output": {"value": null}, "metrics": null,
"error": null, "parent_run_id": "name_0", "start_time": "2024-01-19T08:11:41.860384Z",
"end_time": "2024-01-19T08:11:44.055422Z", "index": 0, "api_calls": [{"name":
"get_env_var", "type": "Tool", "inputs": {"key": "API_BASE"}, "output": {"value":
null}, "start_time": 1705651901.861366, "end_time": 1705651904.054938, "error":
null, "children": [], "node_name": "print_env", "parent_id": "", "id": "d9302caf-a93e-469c-9dc9-86c788dcc0b5",
"system_metrics": {}}], "variant_id": "", "cached_run_id": null, "cached_flow_run_id":
null, "logs": {"stdout": "[2024-01-19T08:11:44+0000] 2.15.0\n[2024-01-19T08:11:44+0000]
None\n", "stderr": ""}, "system_metrics": {"duration": 2.195038}, "result":
{"value": null}}, "start_time": "2024-01-19T08:11:41.860384", "end_time":
"2024-01-19T08:11:44.055422", "status": "Completed"}'
headers:
accept-ranges:
- bytes
content-length:
- '1141'
content-range:
- bytes 0-1140/1141
content-type:
- application/octet-stream
last-modified:
- Fri, 19 Jan 2024 08:11:44 GMT
server:
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
vary:
- Origin
x-ms-blob-content-md5:
- rDx89XmW939YhK5e8LOGYQ==
x-ms-blob-type:
- BlockBlob
x-ms-creation-time:
- Fri, 19 Jan 2024 08:11:44 GMT
x-ms-version:
- '2023-11-03'
status:
code: 206
message: Partial Content
- request:
body: '{"runId": "name", "selectRunMetadata": true, "selectRunDefinition": true,
"selectJobSpecification": true}'
headers:
accept:
- '*/*'
accept-encoding:
- gzip, deflate
connection:
- keep-alive
content-length:
- '137'
content-type:
- application/json
host:
- eastus.api.azureml.ms
user-agent:
- python-httpx/0.26.0
method: POST
uri: https://eastus.api.azureml.ms/history/v1.0/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/rundata
response:
content: '{"runMetadata": {"runNumber": 1705651879, "rootRunId": "name", "createdUtc":
"2024-01-19T08:11:19.8397061+00:00", "createdBy": {"userObjectId": "00000000-0000-0000-0000-000000000000",
"userPuId": "100320005227D154", "userIdp": null, "userAltSecId": null, "userIss":
"https://sts.windows.net/00000000-0000-0000-0000-000000000000/", "userTenantId":
"00000000-0000-0000-0000-000000000000", "userName": "Han Wang", "upn": null},
"userId": "00000000-0000-0000-0000-000000000000", "token": null, "tokenExpiryTimeUtc":
null, "error": null, "warnings": null, "revision": 6, "statusRevision": 3, "runUuid":
"2dcd6208-7f09-4ef0-884e-f99c0c1aa73e", "parentRunUuid": null, "rootRunUuid":
"2dcd6208-7f09-4ef0-884e-f99c0c1aa73e", "lastStartTimeUtc": null, "currentComputeTime":
null, "computeDuration": "00:00:15.8157799", "effectiveStartTimeUtc": null,
"lastModifiedBy": {"userObjectId": "00000000-0000-0000-0000-000000000000", "userPuId":
"100320005227D154", "userIdp": null, "userAltSecId": null, "userIss": "https://sts.windows.net/00000000-0000-0000-0000-000000000000/",
"userTenantId": "00000000-0000-0000-0000-000000000000", "userName": "Han Wang",
"upn": "[email protected]"}, "lastModifiedUtc": "2024-01-19T08:11:50.5800828+00:00",
"duration": "00:00:15.8157799", "cancelationReason": null, "currentAttemptId":
1, "runId": "name", "parentRunId": null, "experimentId": "e366b94e-bc01-491b-95af-7881c0f5996c",
"status": "Completed", "startTimeUtc": "2024-01-19T08:11:41.4356867+00:00",
"endTimeUtc": "2024-01-19T08:11:57.2514666+00:00", "scheduleId": null, "displayName":
"name", "name": null, "dataContainerId": "dcid.name", "description": null, "hidden":
false, "runType": "azureml.promptflow.FlowRun", "runTypeV2": {"orchestrator":
null, "traits": [], "attribution": "PromptFlow", "computeType": null}, "properties":
{"azureml.promptflow.runtime_name": "automatic", "azureml.promptflow.runtime_version":
"20240116.v1", "azureml.promptflow.definition_file_name": "flow.dag.yaml", "azureml.promptflow.session_id":
"17c09ed8548069d9bd446905de3053ccbf23ff6fa8b7bef7", "azureml.promptflow.flow_lineage_id":
"d840b60c94e02e27c7f8e15df8562a32fd8bd4dfe1f5951f1a01fe8efcf3be8f", "azureml.promptflow.flow_definition_datastore_name":
"workspaceblobstore", "azureml.promptflow.flow_definition_blob_path": "LocalUpload/74854f49405e7ffcddc484d043cf0ef3/code_with_additional_includes/flow.dag.yaml",
"azureml.promptflow.input_data": "azureml://datastores/workspaceblobstore/paths/LocalUpload/c32a61842e439cecc022ebcff5dc0da4/env_var_names.jsonl",
"_azureml.evaluation_run": "promptflow.BatchRun", "azureml.promptflow.snapshot_id":
"f70ec21e-2e5f-4f8a-8877-19d060899638", "azureml.promptflow.total_tokens": "0",
"_azureml.evaluate_artifacts": "[{\"path\": \"instance_results.jsonl\", \"type\":
\"table\"}]"}, "parameters": {}, "actionUris": {}, "scriptName": null, "target":
null, "uniqueChildRunComputeTargets": [], "tags": {}, "settings": {}, "services":
{}, "inputDatasets": [], "outputDatasets": [], "runDefinition": null, "jobSpecification":
null, "primaryMetricName": null, "createdFrom": null, "cancelUri": null, "completeUri":
null, "diagnosticsUri": null, "computeRequest": null, "compute": null, "retainForLifetimeOfWorkspace":
false, "queueingInfo": null, "inputs": null, "outputs": {"debug_info": {"assetId":
"azureml://locations/eastus/workspaces/00000/data/azureml_name_output_data_debug_info/versions/1",
"type": "UriFolder"}, "flow_outputs": {"assetId": "azureml://locations/eastus/workspaces/00000/data/azureml_name_output_data_flow_outputs/versions/1",
"type": "UriFolder"}}}, "runDefinition": null, "jobSpecification": null, "systemSettings":
null}'
headers:
connection:
- keep-alive
content-type:
- application/json; charset=utf-8
strict-transport-security:
- max-age=15724800; includeSubDomains; preload
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '0.061'
http_version: HTTP/1.1
status_code: 200
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
Content-Type:
- application/json
User-Agent:
- promptflow-sdk/0.0.1 azsdk-python-azuremachinelearningdesignerserviceclient/unknown
Python/3.11.5 (Windows-10-10.0.22621-SP0)
method: GET
uri: https://eastus.api.azureml.ms/flow/api/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/BulkRuns/name/logContent
response:
body:
string: '"2024-01-19 08:11:34 +0000 49 promptflow-runtime INFO [name]
Receiving v2 bulk run request 700358bb-ca8a-4d06-90aa-712a335034e2: {\"flow_id\":
\"name\", \"flow_run_id\": \"name\", \"flow_source\": {\"flow_source_type\":
1, \"flow_source_info\": {\"snapshot_id\": \"f70ec21e-2e5f-4f8a-8877-19d060899638\"},
\"flow_dag_file\": \"flow.dag.yaml\"}, \"log_path\": \"https://promptfloweast4063704120.blob.core.windows.net/azureml/ExperimentRun/dcid.name/logs/azureml/executionlogs.txt?sv=2019-07-07&sr=b&sig=**data_scrubbed**&skoid=55b92eba-d7c7-4afd-ab76-7bb1cd345283&sktid=00000000-0000-0000-0000-000000000000&skt=2024-01-19T07%3A50%3A15Z&ske=2024-01-20T16%3A00%3A15Z&sks=b&skv=2019-07-07&st=2024-01-19T08%3A01%3A33Z&se=2024-01-19T16%3A11%3A33Z&sp=rcw\",
\"app_insights_instrumentation_key\": \"InstrumentationKey=**data_scrubbed**;IngestionEndpoint=https://eastus-6.in.applicationinsights.azure.com/;LiveEndpoint=https://eastus.livediagnostics.monitor.azure.com/\",
\"data_inputs\": {\"data\": \"azureml://datastores/workspaceblobstore/paths/LocalUpload/c32a61842e439cecc022ebcff5dc0da4/env_var_names.jsonl\"},
\"azure_storage_setting\": {\"azure_storage_mode\": 1, \"storage_account_name\":
\"promptfloweast4063704120\", \"blob_container_name\": \"azureml-blobstore-3e123da1-f9a5-4c91-9234-8d9ffbb39ff5\",
\"flow_artifacts_root_path\": \"promptflow/PromptFlowArtifacts/name\", \"blob_container_sas_token\":
\"?sv=2019-07-07&sr=c&sig=**data_scrubbed**&skoid=55b92eba-d7c7-4afd-ab76-7bb1cd345283&sktid=00000000-0000-0000-0000-000000000000&skt=2024-01-19T08%3A11%3A33Z&ske=2024-01-26T08%3A11%3A33Z&sks=b&skv=2019-07-07&se=2024-01-26T08%3A11%3A33Z&sp=racwl\",
\"output_datastore_name\": \"workspaceblobstore\"}}\n2024-01-19 08:11:35 +0000 49
promptflow-runtime INFO Runtime version: 20240116.v1. PromptFlow version:
1.4.0rc3\n2024-01-19 08:11:35 +0000 49 promptflow-runtime INFO Updating
name to Status.Preparing...\n2024-01-19 08:11:35 +0000 49 promptflow-runtime
INFO Downloading snapshot to /mnt/host/service/app/45731/requests/name\n2024-01-19
08:11:35 +0000 49 promptflow-runtime INFO Get snapshot sas url for
f70ec21e-2e5f-4f8a-8877-19d060899638.\n2024-01-19 08:11:35 +0000 49 promptflow-runtime
INFO Snapshot f70ec21e-2e5f-4f8a-8877-19d060899638 contains 3 files.\n2024-01-19
08:11:35 +0000 49 promptflow-runtime INFO Download snapshot f70ec21e-2e5f-4f8a-8877-19d060899638
completed.\n2024-01-19 08:11:35 +0000 49 promptflow-runtime INFO Successfully
download snapshot to /mnt/host/service/app/45731/requests/name\n2024-01-19
08:11:35 +0000 49 promptflow-runtime INFO About to execute a python
flow.\n2024-01-19 08:11:35 +0000 49 promptflow-runtime INFO Use spawn
method to start child process.\n2024-01-19 08:11:35 +0000 49 promptflow-runtime
INFO Starting to check process 388 status for run name\n2024-01-19 08:11:35
+0000 49 promptflow-runtime INFO Start checking run status for run
name\n2024-01-19 08:11:39 +0000 388 promptflow-runtime INFO [49--388]
Start processing flowV2......\n2024-01-19 08:11:39 +0000 388 promptflow-runtime
INFO Runtime version: 20240116.v1. PromptFlow version: 1.4.0rc3\n2024-01-19
08:11:40 +0000 388 promptflow-runtime INFO Setting mlflow tracking
uri...\n2024-01-19 08:11:40 +0000 388 promptflow-runtime INFO Validating
''AzureML Data Scientist'' user authentication...\n2024-01-19 08:11:40 +0000 388
promptflow-runtime INFO Successfully validated ''AzureML Data Scientist''
user authentication.\n2024-01-19 08:11:40 +0000 388 promptflow-runtime
INFO Using AzureMLRunStorageV2\n2024-01-19 08:11:40 +0000 388 promptflow-runtime
INFO Setting mlflow tracking uri to ''azureml://eastus.api.azureml.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/promptflow-eastus''\n2024-01-19
08:11:40 +0000 388 promptflow-runtime INFO Initialized blob service
client for AzureMLRunTracker.\n2024-01-19 08:11:40 +0000 388 promptflow-runtime
INFO Setting mlflow tracking uri to ''azureml://eastus.api.azureml.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/promptflow-eastus''\n2024-01-19
08:11:41 +0000 388 promptflow-runtime INFO Resolve data from url finished
in 0.5640277000002243 seconds\n2024-01-19 08:11:41 +0000 388 promptflow-runtime
INFO Starting the aml run ''name''...\n2024-01-19 08:11:41 +0000 388
execution WARNING Starting run without column mapping may lead to
unexpected results. Please consult the following documentation for more information:
https://aka.ms/pf/column-mapping\n2024-01-19 08:11:41 +0000 388 execution.bulk INFO Set
process count to 1 by taking the minimum value among the factors of {''default_worker_count'':
16, ''row_count'': 1}.\n2024-01-19 08:11:41 +0000 429 execution.bulk INFO Process
429 started.\n2024-01-19 08:11:41 +0000 388 execution.bulk INFO Process
name: ForkProcess-4:2, Process id: 429, Line number: 0 start execution.\n2024-01-19
08:11:44 +0000 388 execution.bulk INFO Process name: ForkProcess-4:2,
Process id: 429, Line number: 0 completed.\n2024-01-19 08:11:44 +0000 388
execution.bulk INFO Finished 1 / 1 lines.\n2024-01-19 08:11:44 +0000 388
execution.bulk INFO Average execution time for completed lines: 2.38
seconds. Estimated time for incomplete lines: 0.0 seconds.\n2024-01-19 08:11:45
+0000 388 promptflow-runtime INFO Post processing batch result...\n2024-01-19
08:11:50 +0000 388 execution.bulk INFO Upload status summary metrics
for run name finished in 5.290677923999283 seconds\n2024-01-19 08:11:50 +0000 388
promptflow-runtime INFO Successfully write run properties {\"azureml.promptflow.total_tokens\":
0, \"_azureml.evaluate_artifacts\": \"[{\\\"path\\\": \\\"instance_results.jsonl\\\",
\\\"type\\\": \\\"table\\\"}]\"} with run id ''name''\n2024-01-19 08:11:50
+0000 388 execution.bulk INFO Upload RH properties for run name
finished in 0.08102953700017679 seconds\n2024-01-19 08:11:50 +0000 388
promptflow-runtime INFO Creating unregistered output Asset for Run name...\n2024-01-19
08:11:56 +0000 388 promptflow-runtime INFO Created debug_info Asset:
azureml://locations/eastus/workspaces/00000/data/azureml_name_output_data_debug_info/versions/1\n2024-01-19
08:11:56 +0000 388 promptflow-runtime INFO Creating unregistered output
Asset for Run name...\n2024-01-19 08:11:56 +0000 388 promptflow-runtime
INFO Created flow_outputs output Asset: azureml://locations/eastus/workspaces/00000/data/azureml_name_output_data_flow_outputs/versions/1\n2024-01-19
08:11:56 +0000 388 promptflow-runtime INFO Creating Artifact for Run
name...\n2024-01-19 08:11:56 +0000 388 promptflow-runtime INFO Created
instance_results.jsonl Artifact.\n2024-01-19 08:11:57 +0000 388 promptflow-runtime
INFO Patching name...\n2024-01-19 08:11:57 +0000 388 promptflow-runtime
INFO Ending the aml run ''name'' with status ''Completed''...\n2024-01-19
08:12:41 +0000 49 promptflow-runtime INFO Process 388 finished\n2024-01-19
08:12:41 +0000 49 promptflow-runtime INFO [49] Child process finished!\n2024-01-19
08:12:41 +0000 49 promptflow-runtime INFO [name] End processing bulk
run\n2024-01-19 08:12:41 +0000 49 promptflow-runtime INFO Cleanup
working dir /mnt/host/service/app/45731/requests/name for bulk run\n"'
headers:
connection:
- keep-alive
content-length:
- '8472'
content-type:
- application/json; charset=utf-8
strict-transport-security:
- max-age=15724800; includeSubDomains; preload
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '0.467'
status:
code: 200
message: OK
version: 1
| promptflow/src/promptflow/tests/test_configs/recordings/test_run_operations_TestFlowRun_test_requirements_in_additional_includes.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/recordings/test_run_operations_TestFlowRun_test_requirements_in_additional_includes.yaml",
"repo_id": "promptflow",
"token_count": 117214
} | 69 |
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-10-10.0.22631-SP0)
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000
response:
body:
string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000",
"name": "00000", "type": "Microsoft.MachineLearningServices/workspaces", "location":
"eastus", "tags": {}, "etag": null, "kind": "Default", "sku": {"name": "Basic",
"tier": "Basic"}, "properties": {"discoveryUrl": "https://eastus.api.azureml.ms/discovery"}}'
headers:
cache-control:
- no-cache
content-length:
- '3630'
content-type:
- application/json; charset=utf-8
expires:
- '-1'
pragma:
- no-cache
strict-transport-security:
- max-age=31536000; includeSubDomains
transfer-encoding:
- chunked
vary:
- Accept-Encoding,Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '0.023'
status:
code: 200
message: OK
- 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-10-10.0.22631-SP0)
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores?count=30&isDefault=true&orderByAsc=false
response:
body:
string: '{"value": [{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore",
"name": "workspaceblobstore", "type": "Microsoft.MachineLearningServices/workspaces/datastores",
"properties": {"description": null, "tags": null, "properties": null, "isDefault":
true, "credentials": {"credentialsType": "AccountKey"}, "intellectualProperty":
null, "subscriptionId": "00000000-0000-0000-0000-000000000000", "resourceGroup":
"00000", "datastoreType": "AzureBlob", "accountName": "fake_account_name",
"containerName": "fake-container-name", "endpoint": "core.windows.net", "protocol":
"https", "serviceDataAccessAuthIdentity": "WorkspaceSystemAssignedIdentity"},
"systemData": {"createdAt": "2023-04-08T02:53:06.5886442+00:00", "createdBy":
"779301c0-18b2-4cdc-801b-a0a3368fee0a", "createdByType": "Application", "lastModifiedAt":
"2023-04-08T02:53:07.521127+00:00", "lastModifiedBy": "779301c0-18b2-4cdc-801b-a0a3368fee0a",
"lastModifiedByType": "Application"}}]}'
headers:
cache-control:
- no-cache
content-length:
- '1372'
content-type:
- application/json; charset=utf-8
expires:
- '-1'
pragma:
- no-cache
strict-transport-security:
- max-age=31536000; includeSubDomains
transfer-encoding:
- chunked
vary:
- Accept-Encoding,Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '0.077'
status:
code: 200
message: OK
- 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-10-10.0.22631-SP0)
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore
response:
body:
string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore",
"name": "workspaceblobstore", "type": "Microsoft.MachineLearningServices/workspaces/datastores",
"properties": {"description": null, "tags": null, "properties": null, "isDefault":
true, "credentials": {"credentialsType": "AccountKey"}, "intellectualProperty":
null, "subscriptionId": "00000000-0000-0000-0000-000000000000", "resourceGroup":
"00000", "datastoreType": "AzureBlob", "accountName": "fake_account_name",
"containerName": "fake-container-name", "endpoint": "core.windows.net", "protocol":
"https", "serviceDataAccessAuthIdentity": "WorkspaceSystemAssignedIdentity"},
"systemData": {"createdAt": "2023-04-08T02:53:06.5886442+00:00", "createdBy":
"779301c0-18b2-4cdc-801b-a0a3368fee0a", "createdByType": "Application", "lastModifiedAt":
"2023-04-08T02:53:07.521127+00:00", "lastModifiedBy": "779301c0-18b2-4cdc-801b-a0a3368fee0a",
"lastModifiedByType": "Application"}}'
headers:
cache-control:
- no-cache
content-length:
- '1227'
content-type:
- application/json; charset=utf-8
expires:
- '-1'
pragma:
- no-cache
strict-transport-security:
- max-age=31536000; includeSubDomains
transfer-encoding:
- chunked
vary:
- Accept-Encoding,Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '0.110'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
Content-Length:
- '0'
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-10-10.0.22631-SP0)
method: POST
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore/listSecrets
response:
body:
string: '{"secretsType": "AccountKey", "key": "dGhpcyBpcyBmYWtlIGtleQ=="}'
headers:
cache-control:
- no-cache
content-length:
- '134'
content-type:
- application/json; charset=utf-8
expires:
- '-1'
pragma:
- no-cache
strict-transport-security:
- max-age=31536000; includeSubDomains
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '0.150'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/xml
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- azsdk-python-storage-blob/12.19.0 Python/3.10.13 (Windows-10-10.0.22631-SP0)
x-ms-date:
- Fri, 12 Jan 2024 07:54:16 GMT
x-ms-version:
- '2023-11-03'
method: HEAD
uri: https://fake_account_name.blob.core.windows.net/fake-container-name/LocalUpload/000000000000000000000000000000000000/webClassification3.jsonl
response:
body:
string: ''
headers:
accept-ranges:
- bytes
content-length:
- '379'
content-md5:
- lI/pz9jzTQ7Td3RHPL7y7w==
content-type:
- application/octet-stream
last-modified:
- Mon, 06 Nov 2023 08:30:18 GMT
server:
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
vary:
- Origin
x-ms-blob-type:
- BlockBlob
x-ms-creation-time:
- Mon, 06 Nov 2023 08:30:18 GMT
x-ms-meta-name:
- 94331215-cf7f-452a-9f1a-1d276bc9b0e4
x-ms-meta-upload_status:
- completed
x-ms-meta-version:
- 3f163752-edb0-4afc-a6f5-b0a670bd7c24
x-ms-version:
- '2023-11-03'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/xml
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- azsdk-python-storage-blob/12.19.0 Python/3.10.13 (Windows-10-10.0.22631-SP0)
x-ms-date:
- Fri, 12 Jan 2024 07:54:17 GMT
x-ms-version:
- '2023-11-03'
method: HEAD
uri: https://fake_account_name.blob.core.windows.net/fake-container-name/az-ml-artifacts/000000000000000000000000000000000000/webClassification3.jsonl
response:
body:
string: ''
headers:
server:
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
transfer-encoding:
- chunked
vary:
- Origin
x-ms-error-code:
- BlobNotFound
x-ms-version:
- '2023-11-03'
status:
code: 404
message: The specified blob does not exist.
- 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-10-10.0.22631-SP0)
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore
response:
body:
string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore",
"name": "workspaceblobstore", "type": "Microsoft.MachineLearningServices/workspaces/datastores",
"properties": {"description": null, "tags": null, "properties": null, "isDefault":
true, "credentials": {"credentialsType": "AccountKey"}, "intellectualProperty":
null, "subscriptionId": "00000000-0000-0000-0000-000000000000", "resourceGroup":
"00000", "datastoreType": "AzureBlob", "accountName": "fake_account_name",
"containerName": "fake-container-name", "endpoint": "core.windows.net", "protocol":
"https", "serviceDataAccessAuthIdentity": "WorkspaceSystemAssignedIdentity"},
"systemData": {"createdAt": "2023-04-08T02:53:06.5886442+00:00", "createdBy":
"779301c0-18b2-4cdc-801b-a0a3368fee0a", "createdByType": "Application", "lastModifiedAt":
"2023-04-08T02:53:07.521127+00:00", "lastModifiedBy": "779301c0-18b2-4cdc-801b-a0a3368fee0a",
"lastModifiedByType": "Application"}}'
headers:
cache-control:
- no-cache
content-length:
- '1227'
content-type:
- application/json; charset=utf-8
expires:
- '-1'
pragma:
- no-cache
strict-transport-security:
- max-age=31536000; includeSubDomains
transfer-encoding:
- chunked
vary:
- Accept-Encoding,Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '0.079'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
Content-Length:
- '0'
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-10-10.0.22631-SP0)
method: POST
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/datastores/workspaceblobstore/listSecrets
response:
body:
string: '{"secretsType": "AccountKey", "key": "dGhpcyBpcyBmYWtlIGtleQ=="}'
headers:
cache-control:
- no-cache
content-length:
- '134'
content-type:
- application/json; charset=utf-8
expires:
- '-1'
pragma:
- no-cache
strict-transport-security:
- max-age=31536000; includeSubDomains
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '0.122'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/xml
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- azsdk-python-storage-blob/12.19.0 Python/3.10.13 (Windows-10-10.0.22631-SP0)
x-ms-date:
- Fri, 12 Jan 2024 07:54:19 GMT
x-ms-version:
- '2023-11-03'
method: HEAD
uri: https://fake_account_name.blob.core.windows.net/fake-container-name/LocalUpload/000000000000000000000000000000000000/hello-world/flow.dag.yaml
response:
body:
string: ''
headers:
accept-ranges:
- bytes
content-length:
- '266'
content-md5:
- UZm3TyOoKWjSR23+Up6qUA==
content-type:
- application/octet-stream
last-modified:
- Tue, 19 Dec 2023 06:05:25 GMT
server:
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
vary:
- Origin
x-ms-blob-type:
- BlockBlob
x-ms-creation-time:
- Tue, 19 Dec 2023 06:05:25 GMT
x-ms-meta-name:
- 7b68bf5e-6ef4-4eb3-9f49-28f9a5baad87
x-ms-meta-upload_status:
- completed
x-ms-meta-version:
- '1'
x-ms-version:
- '2023-11-03'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/xml
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- azsdk-python-storage-blob/12.19.0 Python/3.10.13 (Windows-10-10.0.22631-SP0)
x-ms-date:
- Fri, 12 Jan 2024 07:54:21 GMT
x-ms-version:
- '2023-11-03'
method: HEAD
uri: https://fake_account_name.blob.core.windows.net/fake-container-name/az-ml-artifacts/000000000000000000000000000000000000/hello-world/flow.dag.yaml
response:
body:
string: ''
headers:
server:
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
transfer-encoding:
- chunked
vary:
- Origin
x-ms-error-code:
- BlobNotFound
x-ms-version:
- '2023-11-03'
status:
code: 404
message: The specified blob does not exist.
- request:
body: '{"flowDefinitionDataStoreName": "workspaceblobstore", "flowDefinitionBlobPath":
"LocalUpload/000000000000000000000000000000000000/hello-world/flow.dag.yaml",
"runId": "batch_run_name", "runDisplayName": "sdk-cli-test-fixture-batch-run-without-llm",
"runExperimentName": "", "batchDataInput": {"dataUri": "azureml://datastores/workspaceblobstore/paths/LocalUpload/000000000000000000000000000000000000/webClassification3.jsonl"},
"inputsMapping": {"name": "${data.url}"}, "connections": {}, "environmentVariables":
{}, "runtimeName": "fake-runtime-name", "sessionId": "000000000000000000000000000000000000000000000000",
"sessionSetupMode": "SystemWait", "flowLineageId": "0000000000000000000000000000000000000000000000000000000000000000",
"runDisplayNameGenerationType": "UserProvidedMacro"}'
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
Content-Length:
- '812'
Content-Type:
- application/json
User-Agent:
- promptflow-sdk/0.0.1 azsdk-python-azuremachinelearningdesignerserviceclient/unknown
Python/3.10.13 (Windows-10-10.0.22631-SP0)
method: POST
uri: https://eastus.api.azureml.ms/flow/api/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/BulkRuns/submit
response:
body:
string: '"batch_run_name"'
headers:
connection:
- keep-alive
content-length:
- '38'
content-type:
- application/json; charset=utf-8
strict-transport-security:
- max-age=15724800; includeSubDomains; preload
x-content-type-options:
- nosniff
x-request-time:
- '6.861'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- promptflow-sdk/0.0.1 azsdk-python-azuremachinelearningdesignerserviceclient/unknown
Python/3.10.13 (Windows-10-10.0.22631-SP0)
method: GET
uri: https://eastus.api.azureml.ms/flow/api/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/BulkRuns/batch_run_name
response:
body:
string: '{"flowGraph": {"nodes": [{"name": "hello_world", "type": "python",
"source": {"type": "code", "path": "hello_world.py"}, "inputs": {"name": "${inputs.name}"},
"tool": "hello_world.py", "reduce": false}], "tools": [{"name": "Content Safety
(Text Analyze)", "type": "python", "inputs": {"connection": {"type": ["AzureContentSafetyConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"hate_category": {"type": ["string"], "default": "medium_sensitivity", "enum":
["disable", "low_sensitivity", "medium_sensitivity", "high_sensitivity"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"self_harm_category": {"type": ["string"], "default": "medium_sensitivity",
"enum": ["disable", "low_sensitivity", "medium_sensitivity", "high_sensitivity"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"sexual_category": {"type": ["string"], "default": "medium_sensitivity", "enum":
["disable", "low_sensitivity", "medium_sensitivity", "high_sensitivity"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"text": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "violence_category": {"type": ["string"],
"default": "medium_sensitivity", "enum": ["disable", "low_sensitivity", "medium_sensitivity",
"high_sensitivity"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}}, "description": "Use Azure Content Safety to detect
harmful content.", "module": "promptflow.tools.azure_content_safety", "function":
"analyze_text", "is_builtin": true, "package": "promptflow-tools", "package_version":
"0.0.216", "enable_kwargs": false, "deprecated_tools": ["content_safety_text.tools.content_safety_text_tool.analyze_text"],
"tool_state": "stable"}, {"name": "Embedding", "type": "python", "inputs":
{"connection": {"type": ["AzureOpenAIConnection", "OpenAIConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "deployment_name":
{"type": ["string"], "enabled_by": "connection", "enabled_by_type": ["AzureOpenAIConnection"],
"model_list": ["text-embedding-ada-002", "text-search-ada-doc-001", "text-search-ada-query-001"],
"capabilities": {"completion": false, "chat_completion": false, "embeddings":
true}, "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "input": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "model": {"type": ["string"], "enum": ["text-embedding-ada-002",
"text-search-ada-doc-001", "text-search-ada-query-001"], "enabled_by": "connection",
"enabled_by_type": ["OpenAIConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use Open AI''s embedding
model to create an embedding vector representing the input text.", "module":
"promptflow.tools.embedding", "function": "embedding", "is_builtin": true,
"package": "promptflow-tools", "package_version": "0.0.216", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Open Source LLM", "type": "custom_llm",
"inputs": {"api": {"type": ["string"], "enum": ["chat", "completion"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "connection": {"type":
["CustomConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "deployment_name": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "endpoint_name":
{"type": ["string"], "default": "-- please enter an endpoint name --", "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "max_new_tokens":
{"type": ["int"], "default": 500, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "model_kwargs": {"type": ["object"], "default":
"{}", "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default", "advanced": true}, "temperature": {"type": ["double"], "default":
1.0, "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "top_p": {"type": ["double"], "default": 1.0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default", "advanced": true}},
"description": "Use an Open Source model from the Azure Model catalog, deployed
to an AzureML Online Endpoint for LLM Chat or Completion API calls.", "module":
"promptflow.tools.open_source_llm", "class_name": "OpenSourceLLM", "function":
"call", "icon": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACgElEQVR4nGWSz2vcVRTFP/e9NzOZ1KDGohASslLEH6VLV0ak4l/QpeDCrfQPcNGliODKnVm4EBdBsIjQIlhciKW0ycKFVCSNbYnjdDLtmPnmO/nO9917XcxMkjYX3uLx7nnn3HOuMK2Nix4fP78ZdrYXVkLVWjf3l3B1B+HpcjzGFtmqa6cePz7/x0dnn1n5qhj3iBJPYREIURAJuCtpY8PjReDbrf9WG7H1fuefwQU9qKztTcMJT+PNnEFvjGVDBDlSsH6p/9MLzy6+NxwVqI8RAg4IPmWedMckdLYP6O6UpIaQfvyyXG012+e79/ZfHukoS1ISMT2hGTB1RkUmNgQ5QZ0w+a2VWDq73MbdEWmfnnv6UWe7oNzPaLapl5CwuLTXK9WUGBuCjqekzhP+z52ZXOrKMD3OJg0Hh778aiOuvpnYvp05d6GJO4iAO4QAe/eV36/X5LFRV4Zmn+AdkqlL8Vjp3oVioOz+WTPzzYEgsN+fgPLYyJVheSbPPVl2ikeGZRjtG52/8rHuaV9VOlpP2OtKyVndcRVCSqOhsvxa4vW359i6OuKdD+aP8Q4SYPdOzS/flGjt1JUSaMqZ5nwa1Y8qWb/Ud/eZZkHisYezEM0m+fcelDr8F1SqW2LNK6r1jXQwyLzy1hxvrLXZulry7ocL+FS6G4QIu3fG/Px1gdYeW7LIgXU2P/115TOA5G7e3Rmj2aS/m7l5pThiZzrCcE/d1XHzbln373nw7y6veeoUm5KCNKT/IPPwbiY1hYd/l5MIT65BMFt87sU4v9D7/JMflr44uV6hGh1+L4RCkg6z5iK2tAhNLeLsNGwYA4fDYnC/drvuuFxe86NV/x+Ut27g0FvykgAAAABJRU5ErkJggg==",
"is_builtin": true, "package": "promptflow-tools", "package_version": "0.0.216",
"enable_kwargs": false, "tool_state": "stable"}, {"name": "OpenAI GPT-4V",
"type": "custom_llm", "inputs": {"connection": {"type": ["OpenAIConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"frequency_penalty": {"type": ["double"], "default": 0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "max_tokens": {"type":
["int"], "default": "", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "model": {"type": ["string"], "enum": ["gpt-4-vision-preview"],
"allow_manual_entry": true, "is_multi_select": false, "input_type": "default"},
"presence_penalty": {"type": ["double"], "default": 0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "stop": {"type":
["list"], "default": "", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "temperature": {"type": ["double"], "default": 1,
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"top_p": {"type": ["double"], "default": 1, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use OpenAI GPT-4V to leverage
vision ability.", "module": "promptflow.tools.openai_gpt4v", "class_name":
"OpenAI", "function": "chat", "is_builtin": true, "package": "promptflow-tools",
"package_version": "0.0.216", "default_prompt": "# system:\nAs an AI assistant,
your task involves interpreting images and responding to questions about the
image.\nRemember to provide accurate answers based on the information present
in the image.\n\n# user:\nCan you tell me what the image depicts?\n\n",
"enable_kwargs": false, "tool_state": "stable"}, {"name": "Serp API", "type":
"python", "inputs": {"connection": {"type": ["SerpConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "engine": {"type":
["string"], "default": "google", "enum": ["google", "bing"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "location": {"type":
["string"], "default": "", "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "num": {"type": ["int"], "default": "10",
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"query": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "safe": {"type": ["string"], "default": "off",
"enum": ["active", "off"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use Serp API to obtain search
results from a specific search engine.", "module": "promptflow.tools.serpapi",
"class_name": "SerpAPI", "function": "search", "is_builtin": true, "package":
"promptflow-tools", "package_version": "0.0.216", "enable_kwargs": false,
"tool_state": "stable"}, {"name": "Faiss Index Lookup", "type": "python",
"inputs": {"path": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "top_k": {"type": ["int"], "default": "3",
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"vector": {"type": ["list"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Search vector based query
from the FAISS index file.", "module": "promptflow_vectordb.tool.faiss_index_lookup",
"class_name": "FaissIndexLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Vector DB Lookup", "type": "python",
"inputs": {"class_name": {"type": ["string"], "enabled_by": "connection",
"enabled_by_type": ["WeaviateConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "collection_name": {"type": ["string"], "enabled_by":
"connection", "enabled_by_type": ["QdrantConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "connection": {"type":
["CognitiveSearchConnection", "QdrantConnection", "WeaviateConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "index_name": {"type":
["string"], "enabled_by": "connection", "enabled_by_type": ["CognitiveSearchConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"search_filters": {"type": ["object"], "enabled_by": "connection", "enabled_by_type":
["CognitiveSearchConnection", "QdrantConnection"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "default"}, "search_params": {"type":
["object"], "enabled_by": "connection", "enabled_by_type": ["CognitiveSearchConnection",
"QdrantConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "text_field": {"type": ["string"], "enabled_by":
"connection", "enabled_by_type": ["CognitiveSearchConnection", "QdrantConnection",
"WeaviateConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "top_k": {"type": ["int"], "default": "3", "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "vector": {"type":
["list"], "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "vector_field": {"type": ["string"], "enabled_by": "connection",
"enabled_by_type": ["CognitiveSearchConnection"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "default"}}, "description": "Search
vector based query from existing Vector Database.", "module": "promptflow_vectordb.tool.vector_db_lookup",
"class_name": "VectorDBLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Vector Index Lookup", "type": "python",
"inputs": {"path": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "query": {"type": ["object"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "top_k": {"type":
["int"], "default": "3", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}}, "description": "Search text or vector based query
from AzureML Vector Index.", "module": "promptflow_vectordb.tool.vector_index_lookup",
"class_name": "VectorIndexLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "hello_world.py", "type": "python",
"inputs": {"name": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "source": "hello_world.py", "function":
"hello_world", "is_builtin": false, "enable_kwargs": false, "tool_state":
"stable"}], "inputs": {"name": {"type": "string", "default": "hod", "is_chat_input":
false}}, "outputs": {"result": {"type": "string", "reference": "${hello_world.output}",
"evaluation_only": false, "is_chat_output": false}}}, "flowRunResourceId":
"azureml://locations/eastus/workspaces/00000/flows/batch_run_name/flowRuns/batch_run_name",
"flowRunId": "batch_run_name", "flowRunDisplayName": "sdk-cli-test-fixture-batch-run-without-llm",
"batchDataInput": {"dataUri": "azureml://datastores/workspaceblobstore/paths/LocalUpload/74c11bba717480b2d6b04b8e746d09d7/webClassification3.jsonl"},
"flowRunType": "FlowRun", "flowType": "Default", "runtimeName": "test-runtime-ci",
"inputsMapping": {"name": "${data.url}"}, "outputDatastoreName": "workspaceblobstore",
"childRunBasePath": "promptflow/PromptFlowArtifacts/batch_run_name/flow_artifacts",
"flowDagFileRelativePath": "flow.dag.yaml", "flowSnapshotId": "85a4b96f-edcb-4164-acea-98bd08d40e22",
"studioPortalEndpoint": "https://ml.azure.com/runs/batch_run_name?wsid=/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000"}'
headers:
connection:
- keep-alive
content-length:
- '12912'
content-type:
- application/json; charset=utf-8
strict-transport-security:
- max-age=15724800; includeSubDomains; preload
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '0.509'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- promptflow-sdk/0.0.1 azsdk-python-azuremachinelearningdesignerserviceclient/unknown
Python/3.10.13 (Windows-10-10.0.22631-SP0)
method: GET
uri: https://eastus.api.azureml.ms/flow/api/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/BulkRuns/batch_run_name
response:
body:
string: '{"flowGraph": {"nodes": [{"name": "hello_world", "type": "python",
"source": {"type": "code", "path": "hello_world.py"}, "inputs": {"name": "${inputs.name}"},
"tool": "hello_world.py", "reduce": false}], "tools": [{"name": "Content Safety
(Text Analyze)", "type": "python", "inputs": {"connection": {"type": ["AzureContentSafetyConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"hate_category": {"type": ["string"], "default": "medium_sensitivity", "enum":
["disable", "low_sensitivity", "medium_sensitivity", "high_sensitivity"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"self_harm_category": {"type": ["string"], "default": "medium_sensitivity",
"enum": ["disable", "low_sensitivity", "medium_sensitivity", "high_sensitivity"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"sexual_category": {"type": ["string"], "default": "medium_sensitivity", "enum":
["disable", "low_sensitivity", "medium_sensitivity", "high_sensitivity"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"text": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "violence_category": {"type": ["string"],
"default": "medium_sensitivity", "enum": ["disable", "low_sensitivity", "medium_sensitivity",
"high_sensitivity"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}}, "description": "Use Azure Content Safety to detect
harmful content.", "module": "promptflow.tools.azure_content_safety", "function":
"analyze_text", "is_builtin": true, "package": "promptflow-tools", "package_version":
"0.0.216", "enable_kwargs": false, "deprecated_tools": ["content_safety_text.tools.content_safety_text_tool.analyze_text"],
"tool_state": "stable"}, {"name": "Embedding", "type": "python", "inputs":
{"connection": {"type": ["AzureOpenAIConnection", "OpenAIConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "deployment_name":
{"type": ["string"], "enabled_by": "connection", "enabled_by_type": ["AzureOpenAIConnection"],
"model_list": ["text-embedding-ada-002", "text-search-ada-doc-001", "text-search-ada-query-001"],
"capabilities": {"completion": false, "chat_completion": false, "embeddings":
true}, "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "input": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "model": {"type": ["string"], "enum": ["text-embedding-ada-002",
"text-search-ada-doc-001", "text-search-ada-query-001"], "enabled_by": "connection",
"enabled_by_type": ["OpenAIConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use Open AI''s embedding
model to create an embedding vector representing the input text.", "module":
"promptflow.tools.embedding", "function": "embedding", "is_builtin": true,
"package": "promptflow-tools", "package_version": "0.0.216", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Open Source LLM", "type": "custom_llm",
"inputs": {"api": {"type": ["string"], "enum": ["chat", "completion"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "connection": {"type":
["CustomConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "deployment_name": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "endpoint_name":
{"type": ["string"], "default": "-- please enter an endpoint name --", "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "max_new_tokens":
{"type": ["int"], "default": 500, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "model_kwargs": {"type": ["object"], "default":
"{}", "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default", "advanced": true}, "temperature": {"type": ["double"], "default":
1.0, "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "top_p": {"type": ["double"], "default": 1.0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default", "advanced": true}},
"description": "Use an Open Source model from the Azure Model catalog, deployed
to an AzureML Online Endpoint for LLM Chat or Completion API calls.", "module":
"promptflow.tools.open_source_llm", "class_name": "OpenSourceLLM", "function":
"call", "icon": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACgElEQVR4nGWSz2vcVRTFP/e9NzOZ1KDGohASslLEH6VLV0ak4l/QpeDCrfQPcNGliODKnVm4EBdBsIjQIlhciKW0ycKFVCSNbYnjdDLtmPnmO/nO9917XcxMkjYX3uLx7nnn3HOuMK2Nix4fP78ZdrYXVkLVWjf3l3B1B+HpcjzGFtmqa6cePz7/x0dnn1n5qhj3iBJPYREIURAJuCtpY8PjReDbrf9WG7H1fuefwQU9qKztTcMJT+PNnEFvjGVDBDlSsH6p/9MLzy6+NxwVqI8RAg4IPmWedMckdLYP6O6UpIaQfvyyXG012+e79/ZfHukoS1ISMT2hGTB1RkUmNgQ5QZ0w+a2VWDq73MbdEWmfnnv6UWe7oNzPaLapl5CwuLTXK9WUGBuCjqekzhP+z52ZXOrKMD3OJg0Hh778aiOuvpnYvp05d6GJO4iAO4QAe/eV36/X5LFRV4Zmn+AdkqlL8Vjp3oVioOz+WTPzzYEgsN+fgPLYyJVheSbPPVl2ikeGZRjtG52/8rHuaV9VOlpP2OtKyVndcRVCSqOhsvxa4vW359i6OuKdD+aP8Q4SYPdOzS/flGjt1JUSaMqZ5nwa1Y8qWb/Ud/eZZkHisYezEM0m+fcelDr8F1SqW2LNK6r1jXQwyLzy1hxvrLXZulry7ocL+FS6G4QIu3fG/Px1gdYeW7LIgXU2P/115TOA5G7e3Rmj2aS/m7l5pThiZzrCcE/d1XHzbln373nw7y6veeoUm5KCNKT/IPPwbiY1hYd/l5MIT65BMFt87sU4v9D7/JMflr44uV6hGh1+L4RCkg6z5iK2tAhNLeLsNGwYA4fDYnC/drvuuFxe86NV/x+Ut27g0FvykgAAAABJRU5ErkJggg==",
"is_builtin": true, "package": "promptflow-tools", "package_version": "0.0.216",
"enable_kwargs": false, "tool_state": "stable"}, {"name": "OpenAI GPT-4V",
"type": "custom_llm", "inputs": {"connection": {"type": ["OpenAIConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"frequency_penalty": {"type": ["double"], "default": 0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "max_tokens": {"type":
["int"], "default": "", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "model": {"type": ["string"], "enum": ["gpt-4-vision-preview"],
"allow_manual_entry": true, "is_multi_select": false, "input_type": "default"},
"presence_penalty": {"type": ["double"], "default": 0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "stop": {"type":
["list"], "default": "", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "temperature": {"type": ["double"], "default": 1,
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"top_p": {"type": ["double"], "default": 1, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use OpenAI GPT-4V to leverage
vision ability.", "module": "promptflow.tools.openai_gpt4v", "class_name":
"OpenAI", "function": "chat", "is_builtin": true, "package": "promptflow-tools",
"package_version": "0.0.216", "default_prompt": "# system:\nAs an AI assistant,
your task involves interpreting images and responding to questions about the
image.\nRemember to provide accurate answers based on the information present
in the image.\n\n# user:\nCan you tell me what the image depicts?\n\n",
"enable_kwargs": false, "tool_state": "stable"}, {"name": "Serp API", "type":
"python", "inputs": {"connection": {"type": ["SerpConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "engine": {"type":
["string"], "default": "google", "enum": ["google", "bing"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "location": {"type":
["string"], "default": "", "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "num": {"type": ["int"], "default": "10",
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"query": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "safe": {"type": ["string"], "default": "off",
"enum": ["active", "off"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use Serp API to obtain search
results from a specific search engine.", "module": "promptflow.tools.serpapi",
"class_name": "SerpAPI", "function": "search", "is_builtin": true, "package":
"promptflow-tools", "package_version": "0.0.216", "enable_kwargs": false,
"tool_state": "stable"}, {"name": "Faiss Index Lookup", "type": "python",
"inputs": {"path": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "top_k": {"type": ["int"], "default": "3",
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"vector": {"type": ["list"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Search vector based query
from the FAISS index file.", "module": "promptflow_vectordb.tool.faiss_index_lookup",
"class_name": "FaissIndexLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Vector DB Lookup", "type": "python",
"inputs": {"class_name": {"type": ["string"], "enabled_by": "connection",
"enabled_by_type": ["WeaviateConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "collection_name": {"type": ["string"], "enabled_by":
"connection", "enabled_by_type": ["QdrantConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "connection": {"type":
["CognitiveSearchConnection", "QdrantConnection", "WeaviateConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "index_name": {"type":
["string"], "enabled_by": "connection", "enabled_by_type": ["CognitiveSearchConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"search_filters": {"type": ["object"], "enabled_by": "connection", "enabled_by_type":
["CognitiveSearchConnection", "QdrantConnection"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "default"}, "search_params": {"type":
["object"], "enabled_by": "connection", "enabled_by_type": ["CognitiveSearchConnection",
"QdrantConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "text_field": {"type": ["string"], "enabled_by":
"connection", "enabled_by_type": ["CognitiveSearchConnection", "QdrantConnection",
"WeaviateConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "top_k": {"type": ["int"], "default": "3", "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "vector": {"type":
["list"], "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "vector_field": {"type": ["string"], "enabled_by": "connection",
"enabled_by_type": ["CognitiveSearchConnection"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "default"}}, "description": "Search
vector based query from existing Vector Database.", "module": "promptflow_vectordb.tool.vector_db_lookup",
"class_name": "VectorDBLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Vector Index Lookup", "type": "python",
"inputs": {"path": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "query": {"type": ["object"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "top_k": {"type":
["int"], "default": "3", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}}, "description": "Search text or vector based query
from AzureML Vector Index.", "module": "promptflow_vectordb.tool.vector_index_lookup",
"class_name": "VectorIndexLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "hello_world.py", "type": "python",
"inputs": {"name": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "source": "hello_world.py", "function":
"hello_world", "is_builtin": false, "enable_kwargs": false, "tool_state":
"stable"}], "inputs": {"name": {"type": "string", "default": "hod", "is_chat_input":
false}}, "outputs": {"result": {"type": "string", "reference": "${hello_world.output}",
"evaluation_only": false, "is_chat_output": false}}}, "flowRunResourceId":
"azureml://locations/eastus/workspaces/00000/flows/batch_run_name/flowRuns/batch_run_name",
"flowRunId": "batch_run_name", "flowRunDisplayName": "sdk-cli-test-fixture-batch-run-without-llm",
"batchDataInput": {"dataUri": "azureml://datastores/workspaceblobstore/paths/LocalUpload/74c11bba717480b2d6b04b8e746d09d7/webClassification3.jsonl"},
"flowRunType": "FlowRun", "flowType": "Default", "runtimeName": "test-runtime-ci",
"inputsMapping": {"name": "${data.url}"}, "outputDatastoreName": "workspaceblobstore",
"childRunBasePath": "promptflow/PromptFlowArtifacts/batch_run_name/flow_artifacts",
"flowDagFileRelativePath": "flow.dag.yaml", "flowSnapshotId": "85a4b96f-edcb-4164-acea-98bd08d40e22",
"studioPortalEndpoint": "https://ml.azure.com/runs/batch_run_name?wsid=/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000"}'
headers:
connection:
- keep-alive
content-length:
- '12912'
content-type:
- application/json; charset=utf-8
strict-transport-security:
- max-age=15724800; includeSubDomains; preload
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '0.406'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- promptflow-sdk/0.0.1 azsdk-python-azuremachinelearningdesignerserviceclient/unknown
Python/3.10.13 (Windows-10-10.0.22631-SP0)
method: GET
uri: https://eastus.api.azureml.ms/flow/api/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/BulkRuns/batch_run_name
response:
body:
string: '{"flowGraph": {"nodes": [{"name": "hello_world", "type": "python",
"source": {"type": "code", "path": "hello_world.py"}, "inputs": {"name": "${inputs.name}"},
"tool": "hello_world.py", "reduce": false}], "tools": [{"name": "Content Safety
(Text Analyze)", "type": "python", "inputs": {"connection": {"type": ["AzureContentSafetyConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"hate_category": {"type": ["string"], "default": "medium_sensitivity", "enum":
["disable", "low_sensitivity", "medium_sensitivity", "high_sensitivity"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"self_harm_category": {"type": ["string"], "default": "medium_sensitivity",
"enum": ["disable", "low_sensitivity", "medium_sensitivity", "high_sensitivity"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"sexual_category": {"type": ["string"], "default": "medium_sensitivity", "enum":
["disable", "low_sensitivity", "medium_sensitivity", "high_sensitivity"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"text": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "violence_category": {"type": ["string"],
"default": "medium_sensitivity", "enum": ["disable", "low_sensitivity", "medium_sensitivity",
"high_sensitivity"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}}, "description": "Use Azure Content Safety to detect
harmful content.", "module": "promptflow.tools.azure_content_safety", "function":
"analyze_text", "is_builtin": true, "package": "promptflow-tools", "package_version":
"0.0.216", "enable_kwargs": false, "deprecated_tools": ["content_safety_text.tools.content_safety_text_tool.analyze_text"],
"tool_state": "stable"}, {"name": "Embedding", "type": "python", "inputs":
{"connection": {"type": ["AzureOpenAIConnection", "OpenAIConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "deployment_name":
{"type": ["string"], "enabled_by": "connection", "enabled_by_type": ["AzureOpenAIConnection"],
"model_list": ["text-embedding-ada-002", "text-search-ada-doc-001", "text-search-ada-query-001"],
"capabilities": {"completion": false, "chat_completion": false, "embeddings":
true}, "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "input": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "model": {"type": ["string"], "enum": ["text-embedding-ada-002",
"text-search-ada-doc-001", "text-search-ada-query-001"], "enabled_by": "connection",
"enabled_by_type": ["OpenAIConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use Open AI''s embedding
model to create an embedding vector representing the input text.", "module":
"promptflow.tools.embedding", "function": "embedding", "is_builtin": true,
"package": "promptflow-tools", "package_version": "0.0.216", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Open Source LLM", "type": "custom_llm",
"inputs": {"api": {"type": ["string"], "enum": ["chat", "completion"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "connection": {"type":
["CustomConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "deployment_name": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "endpoint_name":
{"type": ["string"], "default": "-- please enter an endpoint name --", "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "max_new_tokens":
{"type": ["int"], "default": 500, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "model_kwargs": {"type": ["object"], "default":
"{}", "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default", "advanced": true}, "temperature": {"type": ["double"], "default":
1.0, "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "top_p": {"type": ["double"], "default": 1.0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default", "advanced": true}},
"description": "Use an Open Source model from the Azure Model catalog, deployed
to an AzureML Online Endpoint for LLM Chat or Completion API calls.", "module":
"promptflow.tools.open_source_llm", "class_name": "OpenSourceLLM", "function":
"call", "icon": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACgElEQVR4nGWSz2vcVRTFP/e9NzOZ1KDGohASslLEH6VLV0ak4l/QpeDCrfQPcNGliODKnVm4EBdBsIjQIlhciKW0ycKFVCSNbYnjdDLtmPnmO/nO9917XcxMkjYX3uLx7nnn3HOuMK2Nix4fP78ZdrYXVkLVWjf3l3B1B+HpcjzGFtmqa6cePz7/x0dnn1n5qhj3iBJPYREIURAJuCtpY8PjReDbrf9WG7H1fuefwQU9qKztTcMJT+PNnEFvjGVDBDlSsH6p/9MLzy6+NxwVqI8RAg4IPmWedMckdLYP6O6UpIaQfvyyXG012+e79/ZfHukoS1ISMT2hGTB1RkUmNgQ5QZ0w+a2VWDq73MbdEWmfnnv6UWe7oNzPaLapl5CwuLTXK9WUGBuCjqekzhP+z52ZXOrKMD3OJg0Hh778aiOuvpnYvp05d6GJO4iAO4QAe/eV36/X5LFRV4Zmn+AdkqlL8Vjp3oVioOz+WTPzzYEgsN+fgPLYyJVheSbPPVl2ikeGZRjtG52/8rHuaV9VOlpP2OtKyVndcRVCSqOhsvxa4vW359i6OuKdD+aP8Q4SYPdOzS/flGjt1JUSaMqZ5nwa1Y8qWb/Ud/eZZkHisYezEM0m+fcelDr8F1SqW2LNK6r1jXQwyLzy1hxvrLXZulry7ocL+FS6G4QIu3fG/Px1gdYeW7LIgXU2P/115TOA5G7e3Rmj2aS/m7l5pThiZzrCcE/d1XHzbln373nw7y6veeoUm5KCNKT/IPPwbiY1hYd/l5MIT65BMFt87sU4v9D7/JMflr44uV6hGh1+L4RCkg6z5iK2tAhNLeLsNGwYA4fDYnC/drvuuFxe86NV/x+Ut27g0FvykgAAAABJRU5ErkJggg==",
"is_builtin": true, "package": "promptflow-tools", "package_version": "0.0.216",
"enable_kwargs": false, "tool_state": "stable"}, {"name": "OpenAI GPT-4V",
"type": "custom_llm", "inputs": {"connection": {"type": ["OpenAIConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"frequency_penalty": {"type": ["double"], "default": 0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "max_tokens": {"type":
["int"], "default": "", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "model": {"type": ["string"], "enum": ["gpt-4-vision-preview"],
"allow_manual_entry": true, "is_multi_select": false, "input_type": "default"},
"presence_penalty": {"type": ["double"], "default": 0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "stop": {"type":
["list"], "default": "", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "temperature": {"type": ["double"], "default": 1,
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"top_p": {"type": ["double"], "default": 1, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use OpenAI GPT-4V to leverage
vision ability.", "module": "promptflow.tools.openai_gpt4v", "class_name":
"OpenAI", "function": "chat", "is_builtin": true, "package": "promptflow-tools",
"package_version": "0.0.216", "default_prompt": "# system:\nAs an AI assistant,
your task involves interpreting images and responding to questions about the
image.\nRemember to provide accurate answers based on the information present
in the image.\n\n# user:\nCan you tell me what the image depicts?\n\n",
"enable_kwargs": false, "tool_state": "stable"}, {"name": "Serp API", "type":
"python", "inputs": {"connection": {"type": ["SerpConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "engine": {"type":
["string"], "default": "google", "enum": ["google", "bing"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "location": {"type":
["string"], "default": "", "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "num": {"type": ["int"], "default": "10",
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"query": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "safe": {"type": ["string"], "default": "off",
"enum": ["active", "off"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use Serp API to obtain search
results from a specific search engine.", "module": "promptflow.tools.serpapi",
"class_name": "SerpAPI", "function": "search", "is_builtin": true, "package":
"promptflow-tools", "package_version": "0.0.216", "enable_kwargs": false,
"tool_state": "stable"}, {"name": "Faiss Index Lookup", "type": "python",
"inputs": {"path": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "top_k": {"type": ["int"], "default": "3",
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"vector": {"type": ["list"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Search vector based query
from the FAISS index file.", "module": "promptflow_vectordb.tool.faiss_index_lookup",
"class_name": "FaissIndexLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Vector DB Lookup", "type": "python",
"inputs": {"class_name": {"type": ["string"], "enabled_by": "connection",
"enabled_by_type": ["WeaviateConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "collection_name": {"type": ["string"], "enabled_by":
"connection", "enabled_by_type": ["QdrantConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "connection": {"type":
["CognitiveSearchConnection", "QdrantConnection", "WeaviateConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "index_name": {"type":
["string"], "enabled_by": "connection", "enabled_by_type": ["CognitiveSearchConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"search_filters": {"type": ["object"], "enabled_by": "connection", "enabled_by_type":
["CognitiveSearchConnection", "QdrantConnection"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "default"}, "search_params": {"type":
["object"], "enabled_by": "connection", "enabled_by_type": ["CognitiveSearchConnection",
"QdrantConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "text_field": {"type": ["string"], "enabled_by":
"connection", "enabled_by_type": ["CognitiveSearchConnection", "QdrantConnection",
"WeaviateConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "top_k": {"type": ["int"], "default": "3", "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "vector": {"type":
["list"], "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "vector_field": {"type": ["string"], "enabled_by": "connection",
"enabled_by_type": ["CognitiveSearchConnection"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "default"}}, "description": "Search
vector based query from existing Vector Database.", "module": "promptflow_vectordb.tool.vector_db_lookup",
"class_name": "VectorDBLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Vector Index Lookup", "type": "python",
"inputs": {"path": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "query": {"type": ["object"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "top_k": {"type":
["int"], "default": "3", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}}, "description": "Search text or vector based query
from AzureML Vector Index.", "module": "promptflow_vectordb.tool.vector_index_lookup",
"class_name": "VectorIndexLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "hello_world.py", "type": "python",
"inputs": {"name": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "source": "hello_world.py", "function":
"hello_world", "is_builtin": false, "enable_kwargs": false, "tool_state":
"stable"}], "inputs": {"name": {"type": "string", "default": "hod", "is_chat_input":
false}}, "outputs": {"result": {"type": "string", "reference": "${hello_world.output}",
"evaluation_only": false, "is_chat_output": false}}}, "flowRunResourceId":
"azureml://locations/eastus/workspaces/00000/flows/batch_run_name/flowRuns/batch_run_name",
"flowRunId": "batch_run_name", "flowRunDisplayName": "sdk-cli-test-fixture-batch-run-without-llm",
"batchDataInput": {"dataUri": "azureml://datastores/workspaceblobstore/paths/LocalUpload/74c11bba717480b2d6b04b8e746d09d7/webClassification3.jsonl"},
"flowRunType": "FlowRun", "flowType": "Default", "runtimeName": "test-runtime-ci",
"inputsMapping": {"name": "${data.url}"}, "outputDatastoreName": "workspaceblobstore",
"childRunBasePath": "promptflow/PromptFlowArtifacts/batch_run_name/flow_artifacts",
"flowDagFileRelativePath": "flow.dag.yaml", "flowSnapshotId": "85a4b96f-edcb-4164-acea-98bd08d40e22",
"studioPortalEndpoint": "https://ml.azure.com/runs/batch_run_name?wsid=/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000"}'
headers:
connection:
- keep-alive
content-length:
- '12912'
content-type:
- application/json; charset=utf-8
strict-transport-security:
- max-age=15724800; includeSubDomains; preload
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '0.537'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- promptflow-sdk/0.0.1 azsdk-python-azuremachinelearningdesignerserviceclient/unknown
Python/3.10.13 (Windows-10-10.0.22631-SP0)
method: GET
uri: https://eastus.api.azureml.ms/flow/api/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/BulkRuns/batch_run_name
response:
body:
string: '{"flowGraph": {"nodes": [{"name": "hello_world", "type": "python",
"source": {"type": "code", "path": "hello_world.py"}, "inputs": {"name": "${inputs.name}"},
"tool": "hello_world.py", "reduce": false}], "tools": [{"name": "Content Safety
(Text Analyze)", "type": "python", "inputs": {"connection": {"type": ["AzureContentSafetyConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"hate_category": {"type": ["string"], "default": "medium_sensitivity", "enum":
["disable", "low_sensitivity", "medium_sensitivity", "high_sensitivity"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"self_harm_category": {"type": ["string"], "default": "medium_sensitivity",
"enum": ["disable", "low_sensitivity", "medium_sensitivity", "high_sensitivity"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"sexual_category": {"type": ["string"], "default": "medium_sensitivity", "enum":
["disable", "low_sensitivity", "medium_sensitivity", "high_sensitivity"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"text": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "violence_category": {"type": ["string"],
"default": "medium_sensitivity", "enum": ["disable", "low_sensitivity", "medium_sensitivity",
"high_sensitivity"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}}, "description": "Use Azure Content Safety to detect
harmful content.", "module": "promptflow.tools.azure_content_safety", "function":
"analyze_text", "is_builtin": true, "package": "promptflow-tools", "package_version":
"0.0.216", "enable_kwargs": false, "deprecated_tools": ["content_safety_text.tools.content_safety_text_tool.analyze_text"],
"tool_state": "stable"}, {"name": "Embedding", "type": "python", "inputs":
{"connection": {"type": ["AzureOpenAIConnection", "OpenAIConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "deployment_name":
{"type": ["string"], "enabled_by": "connection", "enabled_by_type": ["AzureOpenAIConnection"],
"model_list": ["text-embedding-ada-002", "text-search-ada-doc-001", "text-search-ada-query-001"],
"capabilities": {"completion": false, "chat_completion": false, "embeddings":
true}, "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "input": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "model": {"type": ["string"], "enum": ["text-embedding-ada-002",
"text-search-ada-doc-001", "text-search-ada-query-001"], "enabled_by": "connection",
"enabled_by_type": ["OpenAIConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use Open AI''s embedding
model to create an embedding vector representing the input text.", "module":
"promptflow.tools.embedding", "function": "embedding", "is_builtin": true,
"package": "promptflow-tools", "package_version": "0.0.216", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Open Source LLM", "type": "custom_llm",
"inputs": {"api": {"type": ["string"], "enum": ["chat", "completion"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "connection": {"type":
["CustomConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "deployment_name": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "endpoint_name":
{"type": ["string"], "default": "-- please enter an endpoint name --", "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "max_new_tokens":
{"type": ["int"], "default": 500, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "model_kwargs": {"type": ["object"], "default":
"{}", "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default", "advanced": true}, "temperature": {"type": ["double"], "default":
1.0, "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "top_p": {"type": ["double"], "default": 1.0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default", "advanced": true}},
"description": "Use an Open Source model from the Azure Model catalog, deployed
to an AzureML Online Endpoint for LLM Chat or Completion API calls.", "module":
"promptflow.tools.open_source_llm", "class_name": "OpenSourceLLM", "function":
"call", "icon": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACgElEQVR4nGWSz2vcVRTFP/e9NzOZ1KDGohASslLEH6VLV0ak4l/QpeDCrfQPcNGliODKnVm4EBdBsIjQIlhciKW0ycKFVCSNbYnjdDLtmPnmO/nO9917XcxMkjYX3uLx7nnn3HOuMK2Nix4fP78ZdrYXVkLVWjf3l3B1B+HpcjzGFtmqa6cePz7/x0dnn1n5qhj3iBJPYREIURAJuCtpY8PjReDbrf9WG7H1fuefwQU9qKztTcMJT+PNnEFvjGVDBDlSsH6p/9MLzy6+NxwVqI8RAg4IPmWedMckdLYP6O6UpIaQfvyyXG012+e79/ZfHukoS1ISMT2hGTB1RkUmNgQ5QZ0w+a2VWDq73MbdEWmfnnv6UWe7oNzPaLapl5CwuLTXK9WUGBuCjqekzhP+z52ZXOrKMD3OJg0Hh778aiOuvpnYvp05d6GJO4iAO4QAe/eV36/X5LFRV4Zmn+AdkqlL8Vjp3oVioOz+WTPzzYEgsN+fgPLYyJVheSbPPVl2ikeGZRjtG52/8rHuaV9VOlpP2OtKyVndcRVCSqOhsvxa4vW359i6OuKdD+aP8Q4SYPdOzS/flGjt1JUSaMqZ5nwa1Y8qWb/Ud/eZZkHisYezEM0m+fcelDr8F1SqW2LNK6r1jXQwyLzy1hxvrLXZulry7ocL+FS6G4QIu3fG/Px1gdYeW7LIgXU2P/115TOA5G7e3Rmj2aS/m7l5pThiZzrCcE/d1XHzbln373nw7y6veeoUm5KCNKT/IPPwbiY1hYd/l5MIT65BMFt87sU4v9D7/JMflr44uV6hGh1+L4RCkg6z5iK2tAhNLeLsNGwYA4fDYnC/drvuuFxe86NV/x+Ut27g0FvykgAAAABJRU5ErkJggg==",
"is_builtin": true, "package": "promptflow-tools", "package_version": "0.0.216",
"enable_kwargs": false, "tool_state": "stable"}, {"name": "OpenAI GPT-4V",
"type": "custom_llm", "inputs": {"connection": {"type": ["OpenAIConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"frequency_penalty": {"type": ["double"], "default": 0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "max_tokens": {"type":
["int"], "default": "", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "model": {"type": ["string"], "enum": ["gpt-4-vision-preview"],
"allow_manual_entry": true, "is_multi_select": false, "input_type": "default"},
"presence_penalty": {"type": ["double"], "default": 0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "stop": {"type":
["list"], "default": "", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "temperature": {"type": ["double"], "default": 1,
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"top_p": {"type": ["double"], "default": 1, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use OpenAI GPT-4V to leverage
vision ability.", "module": "promptflow.tools.openai_gpt4v", "class_name":
"OpenAI", "function": "chat", "is_builtin": true, "package": "promptflow-tools",
"package_version": "0.0.216", "default_prompt": "# system:\nAs an AI assistant,
your task involves interpreting images and responding to questions about the
image.\nRemember to provide accurate answers based on the information present
in the image.\n\n# user:\nCan you tell me what the image depicts?\n\n",
"enable_kwargs": false, "tool_state": "stable"}, {"name": "Serp API", "type":
"python", "inputs": {"connection": {"type": ["SerpConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "engine": {"type":
["string"], "default": "google", "enum": ["google", "bing"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "location": {"type":
["string"], "default": "", "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "num": {"type": ["int"], "default": "10",
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"query": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "safe": {"type": ["string"], "default": "off",
"enum": ["active", "off"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use Serp API to obtain search
results from a specific search engine.", "module": "promptflow.tools.serpapi",
"class_name": "SerpAPI", "function": "search", "is_builtin": true, "package":
"promptflow-tools", "package_version": "0.0.216", "enable_kwargs": false,
"tool_state": "stable"}, {"name": "Faiss Index Lookup", "type": "python",
"inputs": {"path": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "top_k": {"type": ["int"], "default": "3",
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"vector": {"type": ["list"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Search vector based query
from the FAISS index file.", "module": "promptflow_vectordb.tool.faiss_index_lookup",
"class_name": "FaissIndexLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Vector DB Lookup", "type": "python",
"inputs": {"class_name": {"type": ["string"], "enabled_by": "connection",
"enabled_by_type": ["WeaviateConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "collection_name": {"type": ["string"], "enabled_by":
"connection", "enabled_by_type": ["QdrantConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "connection": {"type":
["CognitiveSearchConnection", "QdrantConnection", "WeaviateConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "index_name": {"type":
["string"], "enabled_by": "connection", "enabled_by_type": ["CognitiveSearchConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"search_filters": {"type": ["object"], "enabled_by": "connection", "enabled_by_type":
["CognitiveSearchConnection", "QdrantConnection"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "default"}, "search_params": {"type":
["object"], "enabled_by": "connection", "enabled_by_type": ["CognitiveSearchConnection",
"QdrantConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "text_field": {"type": ["string"], "enabled_by":
"connection", "enabled_by_type": ["CognitiveSearchConnection", "QdrantConnection",
"WeaviateConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "top_k": {"type": ["int"], "default": "3", "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "vector": {"type":
["list"], "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "vector_field": {"type": ["string"], "enabled_by": "connection",
"enabled_by_type": ["CognitiveSearchConnection"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "default"}}, "description": "Search
vector based query from existing Vector Database.", "module": "promptflow_vectordb.tool.vector_db_lookup",
"class_name": "VectorDBLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Vector Index Lookup", "type": "python",
"inputs": {"path": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "query": {"type": ["object"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "top_k": {"type":
["int"], "default": "3", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}}, "description": "Search text or vector based query
from AzureML Vector Index.", "module": "promptflow_vectordb.tool.vector_index_lookup",
"class_name": "VectorIndexLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "hello_world.py", "type": "python",
"inputs": {"name": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "source": "hello_world.py", "function":
"hello_world", "is_builtin": false, "enable_kwargs": false, "tool_state":
"stable"}], "inputs": {"name": {"type": "string", "default": "hod", "is_chat_input":
false}}, "outputs": {"result": {"type": "string", "reference": "${hello_world.output}",
"evaluation_only": false, "is_chat_output": false}}}, "flowRunResourceId":
"azureml://locations/eastus/workspaces/00000/flows/batch_run_name/flowRuns/batch_run_name",
"flowRunId": "batch_run_name", "flowRunDisplayName": "sdk-cli-test-fixture-batch-run-without-llm",
"batchDataInput": {"dataUri": "azureml://datastores/workspaceblobstore/paths/LocalUpload/74c11bba717480b2d6b04b8e746d09d7/webClassification3.jsonl"},
"flowRunType": "FlowRun", "flowType": "Default", "runtimeName": "test-runtime-ci",
"inputsMapping": {"name": "${data.url}"}, "outputDatastoreName": "workspaceblobstore",
"childRunBasePath": "promptflow/PromptFlowArtifacts/batch_run_name/flow_artifacts",
"flowDagFileRelativePath": "flow.dag.yaml", "flowSnapshotId": "85a4b96f-edcb-4164-acea-98bd08d40e22",
"studioPortalEndpoint": "https://ml.azure.com/runs/batch_run_name?wsid=/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000"}'
headers:
connection:
- keep-alive
content-length:
- '12912'
content-type:
- application/json; charset=utf-8
strict-transport-security:
- max-age=15724800; includeSubDomains; preload
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '0.221'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- promptflow-sdk/0.0.1 azsdk-python-azuremachinelearningdesignerserviceclient/unknown
Python/3.10.13 (Windows-10-10.0.22631-SP0)
method: GET
uri: https://eastus.api.azureml.ms/flow/api/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/BulkRuns/batch_run_name
response:
body:
string: '{"flowGraph": {"nodes": [{"name": "hello_world", "type": "python",
"source": {"type": "code", "path": "hello_world.py"}, "inputs": {"name": "${inputs.name}"},
"tool": "hello_world.py", "reduce": false}], "tools": [{"name": "Content Safety
(Text Analyze)", "type": "python", "inputs": {"connection": {"type": ["AzureContentSafetyConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"hate_category": {"type": ["string"], "default": "medium_sensitivity", "enum":
["disable", "low_sensitivity", "medium_sensitivity", "high_sensitivity"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"self_harm_category": {"type": ["string"], "default": "medium_sensitivity",
"enum": ["disable", "low_sensitivity", "medium_sensitivity", "high_sensitivity"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"sexual_category": {"type": ["string"], "default": "medium_sensitivity", "enum":
["disable", "low_sensitivity", "medium_sensitivity", "high_sensitivity"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"text": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "violence_category": {"type": ["string"],
"default": "medium_sensitivity", "enum": ["disable", "low_sensitivity", "medium_sensitivity",
"high_sensitivity"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}}, "description": "Use Azure Content Safety to detect
harmful content.", "module": "promptflow.tools.azure_content_safety", "function":
"analyze_text", "is_builtin": true, "package": "promptflow-tools", "package_version":
"0.0.216", "enable_kwargs": false, "deprecated_tools": ["content_safety_text.tools.content_safety_text_tool.analyze_text"],
"tool_state": "stable"}, {"name": "Embedding", "type": "python", "inputs":
{"connection": {"type": ["AzureOpenAIConnection", "OpenAIConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "deployment_name":
{"type": ["string"], "enabled_by": "connection", "enabled_by_type": ["AzureOpenAIConnection"],
"model_list": ["text-embedding-ada-002", "text-search-ada-doc-001", "text-search-ada-query-001"],
"capabilities": {"completion": false, "chat_completion": false, "embeddings":
true}, "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "input": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "model": {"type": ["string"], "enum": ["text-embedding-ada-002",
"text-search-ada-doc-001", "text-search-ada-query-001"], "enabled_by": "connection",
"enabled_by_type": ["OpenAIConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use Open AI''s embedding
model to create an embedding vector representing the input text.", "module":
"promptflow.tools.embedding", "function": "embedding", "is_builtin": true,
"package": "promptflow-tools", "package_version": "0.0.216", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Open Source LLM", "type": "custom_llm",
"inputs": {"api": {"type": ["string"], "enum": ["chat", "completion"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "connection": {"type":
["CustomConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "deployment_name": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "endpoint_name":
{"type": ["string"], "default": "-- please enter an endpoint name --", "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "max_new_tokens":
{"type": ["int"], "default": 500, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "model_kwargs": {"type": ["object"], "default":
"{}", "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default", "advanced": true}, "temperature": {"type": ["double"], "default":
1.0, "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "top_p": {"type": ["double"], "default": 1.0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default", "advanced": true}},
"description": "Use an Open Source model from the Azure Model catalog, deployed
to an AzureML Online Endpoint for LLM Chat or Completion API calls.", "module":
"promptflow.tools.open_source_llm", "class_name": "OpenSourceLLM", "function":
"call", "icon": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACgElEQVR4nGWSz2vcVRTFP/e9NzOZ1KDGohASslLEH6VLV0ak4l/QpeDCrfQPcNGliODKnVm4EBdBsIjQIlhciKW0ycKFVCSNbYnjdDLtmPnmO/nO9917XcxMkjYX3uLx7nnn3HOuMK2Nix4fP78ZdrYXVkLVWjf3l3B1B+HpcjzGFtmqa6cePz7/x0dnn1n5qhj3iBJPYREIURAJuCtpY8PjReDbrf9WG7H1fuefwQU9qKztTcMJT+PNnEFvjGVDBDlSsH6p/9MLzy6+NxwVqI8RAg4IPmWedMckdLYP6O6UpIaQfvyyXG012+e79/ZfHukoS1ISMT2hGTB1RkUmNgQ5QZ0w+a2VWDq73MbdEWmfnnv6UWe7oNzPaLapl5CwuLTXK9WUGBuCjqekzhP+z52ZXOrKMD3OJg0Hh778aiOuvpnYvp05d6GJO4iAO4QAe/eV36/X5LFRV4Zmn+AdkqlL8Vjp3oVioOz+WTPzzYEgsN+fgPLYyJVheSbPPVl2ikeGZRjtG52/8rHuaV9VOlpP2OtKyVndcRVCSqOhsvxa4vW359i6OuKdD+aP8Q4SYPdOzS/flGjt1JUSaMqZ5nwa1Y8qWb/Ud/eZZkHisYezEM0m+fcelDr8F1SqW2LNK6r1jXQwyLzy1hxvrLXZulry7ocL+FS6G4QIu3fG/Px1gdYeW7LIgXU2P/115TOA5G7e3Rmj2aS/m7l5pThiZzrCcE/d1XHzbln373nw7y6veeoUm5KCNKT/IPPwbiY1hYd/l5MIT65BMFt87sU4v9D7/JMflr44uV6hGh1+L4RCkg6z5iK2tAhNLeLsNGwYA4fDYnC/drvuuFxe86NV/x+Ut27g0FvykgAAAABJRU5ErkJggg==",
"is_builtin": true, "package": "promptflow-tools", "package_version": "0.0.216",
"enable_kwargs": false, "tool_state": "stable"}, {"name": "OpenAI GPT-4V",
"type": "custom_llm", "inputs": {"connection": {"type": ["OpenAIConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"frequency_penalty": {"type": ["double"], "default": 0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "max_tokens": {"type":
["int"], "default": "", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "model": {"type": ["string"], "enum": ["gpt-4-vision-preview"],
"allow_manual_entry": true, "is_multi_select": false, "input_type": "default"},
"presence_penalty": {"type": ["double"], "default": 0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "stop": {"type":
["list"], "default": "", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "temperature": {"type": ["double"], "default": 1,
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"top_p": {"type": ["double"], "default": 1, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use OpenAI GPT-4V to leverage
vision ability.", "module": "promptflow.tools.openai_gpt4v", "class_name":
"OpenAI", "function": "chat", "is_builtin": true, "package": "promptflow-tools",
"package_version": "0.0.216", "default_prompt": "# system:\nAs an AI assistant,
your task involves interpreting images and responding to questions about the
image.\nRemember to provide accurate answers based on the information present
in the image.\n\n# user:\nCan you tell me what the image depicts?\n\n",
"enable_kwargs": false, "tool_state": "stable"}, {"name": "Serp API", "type":
"python", "inputs": {"connection": {"type": ["SerpConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "engine": {"type":
["string"], "default": "google", "enum": ["google", "bing"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "location": {"type":
["string"], "default": "", "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "num": {"type": ["int"], "default": "10",
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"query": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "safe": {"type": ["string"], "default": "off",
"enum": ["active", "off"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use Serp API to obtain search
results from a specific search engine.", "module": "promptflow.tools.serpapi",
"class_name": "SerpAPI", "function": "search", "is_builtin": true, "package":
"promptflow-tools", "package_version": "0.0.216", "enable_kwargs": false,
"tool_state": "stable"}, {"name": "Faiss Index Lookup", "type": "python",
"inputs": {"path": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "top_k": {"type": ["int"], "default": "3",
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"vector": {"type": ["list"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Search vector based query
from the FAISS index file.", "module": "promptflow_vectordb.tool.faiss_index_lookup",
"class_name": "FaissIndexLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Vector DB Lookup", "type": "python",
"inputs": {"class_name": {"type": ["string"], "enabled_by": "connection",
"enabled_by_type": ["WeaviateConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "collection_name": {"type": ["string"], "enabled_by":
"connection", "enabled_by_type": ["QdrantConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "connection": {"type":
["CognitiveSearchConnection", "QdrantConnection", "WeaviateConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "index_name": {"type":
["string"], "enabled_by": "connection", "enabled_by_type": ["CognitiveSearchConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"search_filters": {"type": ["object"], "enabled_by": "connection", "enabled_by_type":
["CognitiveSearchConnection", "QdrantConnection"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "default"}, "search_params": {"type":
["object"], "enabled_by": "connection", "enabled_by_type": ["CognitiveSearchConnection",
"QdrantConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "text_field": {"type": ["string"], "enabled_by":
"connection", "enabled_by_type": ["CognitiveSearchConnection", "QdrantConnection",
"WeaviateConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "top_k": {"type": ["int"], "default": "3", "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "vector": {"type":
["list"], "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "vector_field": {"type": ["string"], "enabled_by": "connection",
"enabled_by_type": ["CognitiveSearchConnection"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "default"}}, "description": "Search
vector based query from existing Vector Database.", "module": "promptflow_vectordb.tool.vector_db_lookup",
"class_name": "VectorDBLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Vector Index Lookup", "type": "python",
"inputs": {"path": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "query": {"type": ["object"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "top_k": {"type":
["int"], "default": "3", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}}, "description": "Search text or vector based query
from AzureML Vector Index.", "module": "promptflow_vectordb.tool.vector_index_lookup",
"class_name": "VectorIndexLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "hello_world.py", "type": "python",
"inputs": {"name": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "source": "hello_world.py", "function":
"hello_world", "is_builtin": false, "enable_kwargs": false, "tool_state":
"stable"}], "inputs": {"name": {"type": "string", "default": "hod", "is_chat_input":
false}}, "outputs": {"result": {"type": "string", "reference": "${hello_world.output}",
"evaluation_only": false, "is_chat_output": false}}}, "flowRunResourceId":
"azureml://locations/eastus/workspaces/00000/flows/batch_run_name/flowRuns/batch_run_name",
"flowRunId": "batch_run_name", "flowRunDisplayName": "sdk-cli-test-fixture-batch-run-without-llm",
"batchDataInput": {"dataUri": "azureml://datastores/workspaceblobstore/paths/LocalUpload/74c11bba717480b2d6b04b8e746d09d7/webClassification3.jsonl"},
"flowRunType": "FlowRun", "flowType": "Default", "runtimeName": "test-runtime-ci",
"inputsMapping": {"name": "${data.url}"}, "outputDatastoreName": "workspaceblobstore",
"childRunBasePath": "promptflow/PromptFlowArtifacts/batch_run_name/flow_artifacts",
"flowDagFileRelativePath": "flow.dag.yaml", "flowSnapshotId": "85a4b96f-edcb-4164-acea-98bd08d40e22",
"studioPortalEndpoint": "https://ml.azure.com/runs/batch_run_name?wsid=/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000"}'
headers:
connection:
- keep-alive
content-length:
- '12912'
content-type:
- application/json; charset=utf-8
strict-transport-security:
- max-age=15724800; includeSubDomains; preload
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '0.192'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- promptflow-sdk/0.0.1 azsdk-python-azuremachinelearningdesignerserviceclient/unknown
Python/3.10.13 (Windows-10-10.0.22631-SP0)
method: GET
uri: https://eastus.api.azureml.ms/flow/api/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/BulkRuns/batch_run_name/childRuns?endIndex=24&startIndex=0
response:
body:
string: '[{"run_id": "batch_run_name_0", "status": "Completed", "error": null,
"inputs": {"name": "https://www.youtube.com/watch?v=o5ZQyXaAv1g", "line_number":
0}, "output": {"result": "Hello World https://www.youtube.com/watch?v=o5ZQyXaAv1g!"},
"metrics": null, "request": null, "parent_run_id": "batch_run_name", "root_run_id":
"batch_run_name", "source_run_id": null, "flow_id": "default_flow_id", "start_time":
"2024-01-12T07:54:44.493902Z", "end_time": "2024-01-12T07:54:44.50176Z", "index":
0, "api_calls": [{"name": "hello_world", "type": "Tool", "inputs": {"name":
"https://www.youtube.com/watch?v=o5ZQyXaAv1g"}, "output": "Hello World https://www.youtube.com/watch?v=o5ZQyXaAv1g!",
"start_time": 1705046084.496958, "end_time": 1705046084.497766, "error": null,
"children": null, "node_name": "hello_world"}], "variant_id": "", "name":
"", "description": "", "tags": null, "system_metrics": {"duration": 0.007858,
"prompt_tokens": 0, "completion_tokens": 0, "total_tokens": 0}, "result":
{"result": "Hello World https://www.youtube.com/watch?v=o5ZQyXaAv1g!"}, "upload_metrics":
false}, {"run_id": "batch_run_name_1", "status": "Completed", "error": null,
"inputs": {"name": "https://www.youtube.com/watch?v=o5ZQyXaAv1g", "line_number":
1}, "output": {"result": "Hello World https://www.youtube.com/watch?v=o5ZQyXaAv1g!"},
"metrics": null, "request": null, "parent_run_id": "batch_run_name", "root_run_id":
"batch_run_name", "source_run_id": null, "flow_id": "default_flow_id", "start_time":
"2024-01-12T07:54:44.50188Z", "end_time": "2024-01-12T07:54:44.507707Z", "index":
1, "api_calls": [{"name": "hello_world", "type": "Tool", "inputs": {"name":
"https://www.youtube.com/watch?v=o5ZQyXaAv1g"}, "output": "Hello World https://www.youtube.com/watch?v=o5ZQyXaAv1g!",
"start_time": 1705046084.504962, "end_time": 1705046084.505848, "error": null,
"children": null, "node_name": "hello_world"}], "variant_id": "", "name":
"", "description": "", "tags": null, "system_metrics": {"duration": 0.005827,
"prompt_tokens": 0, "completion_tokens": 0, "total_tokens": 0}, "result":
{"result": "Hello World https://www.youtube.com/watch?v=o5ZQyXaAv1g!"}, "upload_metrics":
false}, {"run_id": "batch_run_name_2", "status": "Completed", "error": null,
"inputs": {"name": "https://www.youtube.com/watch?v=o5ZQyXaAv1g", "line_number":
2}, "output": {"result": "Hello World https://www.youtube.com/watch?v=o5ZQyXaAv1g!"},
"metrics": null, "request": null, "parent_run_id": "batch_run_name", "root_run_id":
"batch_run_name", "source_run_id": null, "flow_id": "default_flow_id", "start_time":
"2024-01-12T07:54:44.620862Z", "end_time": "2024-01-12T07:54:44.62622Z", "index":
2, "api_calls": [{"name": "hello_world", "type": "Tool", "inputs": {"name":
"https://www.youtube.com/watch?v=o5ZQyXaAv1g"}, "output": "Hello World https://www.youtube.com/watch?v=o5ZQyXaAv1g!",
"start_time": 1705046084.623683, "end_time": 1705046084.624476, "error": null,
"children": null, "node_name": "hello_world"}], "variant_id": "", "name":
"", "description": "", "tags": null, "system_metrics": {"duration": 0.005358,
"prompt_tokens": 0, "completion_tokens": 0, "total_tokens": 0}, "result":
{"result": "Hello World https://www.youtube.com/watch?v=o5ZQyXaAv1g!"}, "upload_metrics":
false}]'
headers:
connection:
- keep-alive
content-length:
- '3229'
content-type:
- application/json; charset=utf-8
strict-transport-security:
- max-age=15724800; includeSubDomains; preload
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '0.825'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- promptflow-sdk/0.0.1 azsdk-python-azuremachinelearningdesignerserviceclient/unknown
Python/3.10.13 (Windows-10-10.0.22631-SP0)
method: GET
uri: https://eastus.api.azureml.ms/flow/api/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/BulkRuns/batch_run_name
response:
body:
string: '{"flowGraph": {"nodes": [{"name": "hello_world", "type": "python",
"source": {"type": "code", "path": "hello_world.py"}, "inputs": {"name": "${inputs.name}"},
"tool": "hello_world.py", "reduce": false}], "tools": [{"name": "Content Safety
(Text Analyze)", "type": "python", "inputs": {"connection": {"type": ["AzureContentSafetyConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"hate_category": {"type": ["string"], "default": "medium_sensitivity", "enum":
["disable", "low_sensitivity", "medium_sensitivity", "high_sensitivity"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"self_harm_category": {"type": ["string"], "default": "medium_sensitivity",
"enum": ["disable", "low_sensitivity", "medium_sensitivity", "high_sensitivity"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"sexual_category": {"type": ["string"], "default": "medium_sensitivity", "enum":
["disable", "low_sensitivity", "medium_sensitivity", "high_sensitivity"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"text": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "violence_category": {"type": ["string"],
"default": "medium_sensitivity", "enum": ["disable", "low_sensitivity", "medium_sensitivity",
"high_sensitivity"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}}, "description": "Use Azure Content Safety to detect
harmful content.", "module": "promptflow.tools.azure_content_safety", "function":
"analyze_text", "is_builtin": true, "package": "promptflow-tools", "package_version":
"0.0.216", "enable_kwargs": false, "deprecated_tools": ["content_safety_text.tools.content_safety_text_tool.analyze_text"],
"tool_state": "stable"}, {"name": "Embedding", "type": "python", "inputs":
{"connection": {"type": ["AzureOpenAIConnection", "OpenAIConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "deployment_name":
{"type": ["string"], "enabled_by": "connection", "enabled_by_type": ["AzureOpenAIConnection"],
"model_list": ["text-embedding-ada-002", "text-search-ada-doc-001", "text-search-ada-query-001"],
"capabilities": {"completion": false, "chat_completion": false, "embeddings":
true}, "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "input": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "model": {"type": ["string"], "enum": ["text-embedding-ada-002",
"text-search-ada-doc-001", "text-search-ada-query-001"], "enabled_by": "connection",
"enabled_by_type": ["OpenAIConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use Open AI''s embedding
model to create an embedding vector representing the input text.", "module":
"promptflow.tools.embedding", "function": "embedding", "is_builtin": true,
"package": "promptflow-tools", "package_version": "0.0.216", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Open Source LLM", "type": "custom_llm",
"inputs": {"api": {"type": ["string"], "enum": ["chat", "completion"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "connection": {"type":
["CustomConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "deployment_name": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "endpoint_name":
{"type": ["string"], "default": "-- please enter an endpoint name --", "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "max_new_tokens":
{"type": ["int"], "default": 500, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "model_kwargs": {"type": ["object"], "default":
"{}", "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default", "advanced": true}, "temperature": {"type": ["double"], "default":
1.0, "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "top_p": {"type": ["double"], "default": 1.0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default", "advanced": true}},
"description": "Use an Open Source model from the Azure Model catalog, deployed
to an AzureML Online Endpoint for LLM Chat or Completion API calls.", "module":
"promptflow.tools.open_source_llm", "class_name": "OpenSourceLLM", "function":
"call", "icon": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACgElEQVR4nGWSz2vcVRTFP/e9NzOZ1KDGohASslLEH6VLV0ak4l/QpeDCrfQPcNGliODKnVm4EBdBsIjQIlhciKW0ycKFVCSNbYnjdDLtmPnmO/nO9917XcxMkjYX3uLx7nnn3HOuMK2Nix4fP78ZdrYXVkLVWjf3l3B1B+HpcjzGFtmqa6cePz7/x0dnn1n5qhj3iBJPYREIURAJuCtpY8PjReDbrf9WG7H1fuefwQU9qKztTcMJT+PNnEFvjGVDBDlSsH6p/9MLzy6+NxwVqI8RAg4IPmWedMckdLYP6O6UpIaQfvyyXG012+e79/ZfHukoS1ISMT2hGTB1RkUmNgQ5QZ0w+a2VWDq73MbdEWmfnnv6UWe7oNzPaLapl5CwuLTXK9WUGBuCjqekzhP+z52ZXOrKMD3OJg0Hh778aiOuvpnYvp05d6GJO4iAO4QAe/eV36/X5LFRV4Zmn+AdkqlL8Vjp3oVioOz+WTPzzYEgsN+fgPLYyJVheSbPPVl2ikeGZRjtG52/8rHuaV9VOlpP2OtKyVndcRVCSqOhsvxa4vW359i6OuKdD+aP8Q4SYPdOzS/flGjt1JUSaMqZ5nwa1Y8qWb/Ud/eZZkHisYezEM0m+fcelDr8F1SqW2LNK6r1jXQwyLzy1hxvrLXZulry7ocL+FS6G4QIu3fG/Px1gdYeW7LIgXU2P/115TOA5G7e3Rmj2aS/m7l5pThiZzrCcE/d1XHzbln373nw7y6veeoUm5KCNKT/IPPwbiY1hYd/l5MIT65BMFt87sU4v9D7/JMflr44uV6hGh1+L4RCkg6z5iK2tAhNLeLsNGwYA4fDYnC/drvuuFxe86NV/x+Ut27g0FvykgAAAABJRU5ErkJggg==",
"is_builtin": true, "package": "promptflow-tools", "package_version": "0.0.216",
"enable_kwargs": false, "tool_state": "stable"}, {"name": "OpenAI GPT-4V",
"type": "custom_llm", "inputs": {"connection": {"type": ["OpenAIConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"frequency_penalty": {"type": ["double"], "default": 0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "max_tokens": {"type":
["int"], "default": "", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "model": {"type": ["string"], "enum": ["gpt-4-vision-preview"],
"allow_manual_entry": true, "is_multi_select": false, "input_type": "default"},
"presence_penalty": {"type": ["double"], "default": 0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "stop": {"type":
["list"], "default": "", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "temperature": {"type": ["double"], "default": 1,
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"top_p": {"type": ["double"], "default": 1, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use OpenAI GPT-4V to leverage
vision ability.", "module": "promptflow.tools.openai_gpt4v", "class_name":
"OpenAI", "function": "chat", "is_builtin": true, "package": "promptflow-tools",
"package_version": "0.0.216", "default_prompt": "# system:\nAs an AI assistant,
your task involves interpreting images and responding to questions about the
image.\nRemember to provide accurate answers based on the information present
in the image.\n\n# user:\nCan you tell me what the image depicts?\n\n",
"enable_kwargs": false, "tool_state": "stable"}, {"name": "Serp API", "type":
"python", "inputs": {"connection": {"type": ["SerpConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "engine": {"type":
["string"], "default": "google", "enum": ["google", "bing"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "location": {"type":
["string"], "default": "", "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "num": {"type": ["int"], "default": "10",
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"query": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "safe": {"type": ["string"], "default": "off",
"enum": ["active", "off"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use Serp API to obtain search
results from a specific search engine.", "module": "promptflow.tools.serpapi",
"class_name": "SerpAPI", "function": "search", "is_builtin": true, "package":
"promptflow-tools", "package_version": "0.0.216", "enable_kwargs": false,
"tool_state": "stable"}, {"name": "Faiss Index Lookup", "type": "python",
"inputs": {"path": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "top_k": {"type": ["int"], "default": "3",
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"vector": {"type": ["list"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Search vector based query
from the FAISS index file.", "module": "promptflow_vectordb.tool.faiss_index_lookup",
"class_name": "FaissIndexLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Vector DB Lookup", "type": "python",
"inputs": {"class_name": {"type": ["string"], "enabled_by": "connection",
"enabled_by_type": ["WeaviateConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "collection_name": {"type": ["string"], "enabled_by":
"connection", "enabled_by_type": ["QdrantConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "connection": {"type":
["CognitiveSearchConnection", "QdrantConnection", "WeaviateConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "index_name": {"type":
["string"], "enabled_by": "connection", "enabled_by_type": ["CognitiveSearchConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"search_filters": {"type": ["object"], "enabled_by": "connection", "enabled_by_type":
["CognitiveSearchConnection", "QdrantConnection"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "default"}, "search_params": {"type":
["object"], "enabled_by": "connection", "enabled_by_type": ["CognitiveSearchConnection",
"QdrantConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "text_field": {"type": ["string"], "enabled_by":
"connection", "enabled_by_type": ["CognitiveSearchConnection", "QdrantConnection",
"WeaviateConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "top_k": {"type": ["int"], "default": "3", "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "vector": {"type":
["list"], "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "vector_field": {"type": ["string"], "enabled_by": "connection",
"enabled_by_type": ["CognitiveSearchConnection"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "default"}}, "description": "Search
vector based query from existing Vector Database.", "module": "promptflow_vectordb.tool.vector_db_lookup",
"class_name": "VectorDBLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Vector Index Lookup", "type": "python",
"inputs": {"path": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "query": {"type": ["object"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "top_k": {"type":
["int"], "default": "3", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}}, "description": "Search text or vector based query
from AzureML Vector Index.", "module": "promptflow_vectordb.tool.vector_index_lookup",
"class_name": "VectorIndexLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "hello_world.py", "type": "python",
"inputs": {"name": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "source": "hello_world.py", "function":
"hello_world", "is_builtin": false, "enable_kwargs": false, "tool_state":
"stable"}], "inputs": {"name": {"type": "string", "default": "hod", "is_chat_input":
false}}, "outputs": {"result": {"type": "string", "reference": "${hello_world.output}",
"evaluation_only": false, "is_chat_output": false}}}, "flowRunResourceId":
"azureml://locations/eastus/workspaces/00000/flows/batch_run_name/flowRuns/batch_run_name",
"flowRunId": "batch_run_name", "flowRunDisplayName": "sdk-cli-test-fixture-batch-run-without-llm",
"batchDataInput": {"dataUri": "azureml://datastores/workspaceblobstore/paths/LocalUpload/74c11bba717480b2d6b04b8e746d09d7/webClassification3.jsonl"},
"flowRunType": "FlowRun", "flowType": "Default", "runtimeName": "test-runtime-ci",
"inputsMapping": {"name": "${data.url}"}, "outputDatastoreName": "workspaceblobstore",
"childRunBasePath": "promptflow/PromptFlowArtifacts/batch_run_name/flow_artifacts",
"flowDagFileRelativePath": "flow.dag.yaml", "flowSnapshotId": "85a4b96f-edcb-4164-acea-98bd08d40e22",
"studioPortalEndpoint": "https://ml.azure.com/runs/batch_run_name?wsid=/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000"}'
headers:
connection:
- keep-alive
content-length:
- '12912'
content-type:
- application/json; charset=utf-8
strict-transport-security:
- max-age=15724800; includeSubDomains; preload
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '0.266'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- promptflow-sdk/0.0.1 azsdk-python-azuremachinelearningdesignerserviceclient/unknown
Python/3.10.13 (Windows-10-10.0.22631-SP0)
method: GET
uri: https://eastus.api.azureml.ms/flow/api/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/BulkRuns/batch_run_name/childRuns?endIndex=24&startIndex=0
response:
body:
string: '[{"run_id": "batch_run_name_0", "status": "Completed", "error": null,
"inputs": {"name": "https://www.youtube.com/watch?v=o5ZQyXaAv1g", "line_number":
0}, "output": {"result": "Hello World https://www.youtube.com/watch?v=o5ZQyXaAv1g!"},
"metrics": null, "request": null, "parent_run_id": "batch_run_name", "root_run_id":
"batch_run_name", "source_run_id": null, "flow_id": "default_flow_id", "start_time":
"2024-01-12T07:54:44.493902Z", "end_time": "2024-01-12T07:54:44.50176Z", "index":
0, "api_calls": [{"name": "hello_world", "type": "Tool", "inputs": {"name":
"https://www.youtube.com/watch?v=o5ZQyXaAv1g"}, "output": "Hello World https://www.youtube.com/watch?v=o5ZQyXaAv1g!",
"start_time": 1705046084.496958, "end_time": 1705046084.497766, "error": null,
"children": null, "node_name": "hello_world"}], "variant_id": "", "name":
"", "description": "", "tags": null, "system_metrics": {"duration": 0.007858,
"prompt_tokens": 0, "completion_tokens": 0, "total_tokens": 0}, "result":
{"result": "Hello World https://www.youtube.com/watch?v=o5ZQyXaAv1g!"}, "upload_metrics":
false}, {"run_id": "batch_run_name_1", "status": "Completed", "error": null,
"inputs": {"name": "https://www.youtube.com/watch?v=o5ZQyXaAv1g", "line_number":
1}, "output": {"result": "Hello World https://www.youtube.com/watch?v=o5ZQyXaAv1g!"},
"metrics": null, "request": null, "parent_run_id": "batch_run_name", "root_run_id":
"batch_run_name", "source_run_id": null, "flow_id": "default_flow_id", "start_time":
"2024-01-12T07:54:44.50188Z", "end_time": "2024-01-12T07:54:44.507707Z", "index":
1, "api_calls": [{"name": "hello_world", "type": "Tool", "inputs": {"name":
"https://www.youtube.com/watch?v=o5ZQyXaAv1g"}, "output": "Hello World https://www.youtube.com/watch?v=o5ZQyXaAv1g!",
"start_time": 1705046084.504962, "end_time": 1705046084.505848, "error": null,
"children": null, "node_name": "hello_world"}], "variant_id": "", "name":
"", "description": "", "tags": null, "system_metrics": {"duration": 0.005827,
"prompt_tokens": 0, "completion_tokens": 0, "total_tokens": 0}, "result":
{"result": "Hello World https://www.youtube.com/watch?v=o5ZQyXaAv1g!"}, "upload_metrics":
false}, {"run_id": "batch_run_name_2", "status": "Completed", "error": null,
"inputs": {"name": "https://www.youtube.com/watch?v=o5ZQyXaAv1g", "line_number":
2}, "output": {"result": "Hello World https://www.youtube.com/watch?v=o5ZQyXaAv1g!"},
"metrics": null, "request": null, "parent_run_id": "batch_run_name", "root_run_id":
"batch_run_name", "source_run_id": null, "flow_id": "default_flow_id", "start_time":
"2024-01-12T07:54:44.620862Z", "end_time": "2024-01-12T07:54:44.62622Z", "index":
2, "api_calls": [{"name": "hello_world", "type": "Tool", "inputs": {"name":
"https://www.youtube.com/watch?v=o5ZQyXaAv1g"}, "output": "Hello World https://www.youtube.com/watch?v=o5ZQyXaAv1g!",
"start_time": 1705046084.623683, "end_time": 1705046084.624476, "error": null,
"children": null, "node_name": "hello_world"}], "variant_id": "", "name":
"", "description": "", "tags": null, "system_metrics": {"duration": 0.005358,
"prompt_tokens": 0, "completion_tokens": 0, "total_tokens": 0}, "result":
{"result": "Hello World https://www.youtube.com/watch?v=o5ZQyXaAv1g!"}, "upload_metrics":
false}]'
headers:
connection:
- keep-alive
content-length:
- '3229'
content-type:
- application/json; charset=utf-8
strict-transport-security:
- max-age=15724800; includeSubDomains; preload
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '0.920'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- promptflow-sdk/0.0.1 azsdk-python-azuremachinelearningdesignerserviceclient/unknown
Python/3.10.13 (Windows-10-10.0.22631-SP0)
method: GET
uri: https://eastus.api.azureml.ms/flow/api/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/BulkRuns/batch_run_name
response:
body:
string: '{"flowGraph": {"nodes": [{"name": "hello_world", "type": "python",
"source": {"type": "code", "path": "hello_world.py"}, "inputs": {"name": "${inputs.name}"},
"tool": "hello_world.py", "reduce": false}], "tools": [{"name": "Content Safety
(Text Analyze)", "type": "python", "inputs": {"connection": {"type": ["AzureContentSafetyConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"hate_category": {"type": ["string"], "default": "medium_sensitivity", "enum":
["disable", "low_sensitivity", "medium_sensitivity", "high_sensitivity"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"self_harm_category": {"type": ["string"], "default": "medium_sensitivity",
"enum": ["disable", "low_sensitivity", "medium_sensitivity", "high_sensitivity"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"sexual_category": {"type": ["string"], "default": "medium_sensitivity", "enum":
["disable", "low_sensitivity", "medium_sensitivity", "high_sensitivity"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"text": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "violence_category": {"type": ["string"],
"default": "medium_sensitivity", "enum": ["disable", "low_sensitivity", "medium_sensitivity",
"high_sensitivity"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}}, "description": "Use Azure Content Safety to detect
harmful content.", "module": "promptflow.tools.azure_content_safety", "function":
"analyze_text", "is_builtin": true, "package": "promptflow-tools", "package_version":
"0.0.216", "enable_kwargs": false, "deprecated_tools": ["content_safety_text.tools.content_safety_text_tool.analyze_text"],
"tool_state": "stable"}, {"name": "Embedding", "type": "python", "inputs":
{"connection": {"type": ["AzureOpenAIConnection", "OpenAIConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "deployment_name":
{"type": ["string"], "enabled_by": "connection", "enabled_by_type": ["AzureOpenAIConnection"],
"model_list": ["text-embedding-ada-002", "text-search-ada-doc-001", "text-search-ada-query-001"],
"capabilities": {"completion": false, "chat_completion": false, "embeddings":
true}, "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "input": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "model": {"type": ["string"], "enum": ["text-embedding-ada-002",
"text-search-ada-doc-001", "text-search-ada-query-001"], "enabled_by": "connection",
"enabled_by_type": ["OpenAIConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use Open AI''s embedding
model to create an embedding vector representing the input text.", "module":
"promptflow.tools.embedding", "function": "embedding", "is_builtin": true,
"package": "promptflow-tools", "package_version": "0.0.216", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Open Source LLM", "type": "custom_llm",
"inputs": {"api": {"type": ["string"], "enum": ["chat", "completion"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "connection": {"type":
["CustomConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "deployment_name": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "endpoint_name":
{"type": ["string"], "default": "-- please enter an endpoint name --", "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "max_new_tokens":
{"type": ["int"], "default": 500, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "model_kwargs": {"type": ["object"], "default":
"{}", "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default", "advanced": true}, "temperature": {"type": ["double"], "default":
1.0, "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "top_p": {"type": ["double"], "default": 1.0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default", "advanced": true}},
"description": "Use an Open Source model from the Azure Model catalog, deployed
to an AzureML Online Endpoint for LLM Chat or Completion API calls.", "module":
"promptflow.tools.open_source_llm", "class_name": "OpenSourceLLM", "function":
"call", "icon": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACgElEQVR4nGWSz2vcVRTFP/e9NzOZ1KDGohASslLEH6VLV0ak4l/QpeDCrfQPcNGliODKnVm4EBdBsIjQIlhciKW0ycKFVCSNbYnjdDLtmPnmO/nO9917XcxMkjYX3uLx7nnn3HOuMK2Nix4fP78ZdrYXVkLVWjf3l3B1B+HpcjzGFtmqa6cePz7/x0dnn1n5qhj3iBJPYREIURAJuCtpY8PjReDbrf9WG7H1fuefwQU9qKztTcMJT+PNnEFvjGVDBDlSsH6p/9MLzy6+NxwVqI8RAg4IPmWedMckdLYP6O6UpIaQfvyyXG012+e79/ZfHukoS1ISMT2hGTB1RkUmNgQ5QZ0w+a2VWDq73MbdEWmfnnv6UWe7oNzPaLapl5CwuLTXK9WUGBuCjqekzhP+z52ZXOrKMD3OJg0Hh778aiOuvpnYvp05d6GJO4iAO4QAe/eV36/X5LFRV4Zmn+AdkqlL8Vjp3oVioOz+WTPzzYEgsN+fgPLYyJVheSbPPVl2ikeGZRjtG52/8rHuaV9VOlpP2OtKyVndcRVCSqOhsvxa4vW359i6OuKdD+aP8Q4SYPdOzS/flGjt1JUSaMqZ5nwa1Y8qWb/Ud/eZZkHisYezEM0m+fcelDr8F1SqW2LNK6r1jXQwyLzy1hxvrLXZulry7ocL+FS6G4QIu3fG/Px1gdYeW7LIgXU2P/115TOA5G7e3Rmj2aS/m7l5pThiZzrCcE/d1XHzbln373nw7y6veeoUm5KCNKT/IPPwbiY1hYd/l5MIT65BMFt87sU4v9D7/JMflr44uV6hGh1+L4RCkg6z5iK2tAhNLeLsNGwYA4fDYnC/drvuuFxe86NV/x+Ut27g0FvykgAAAABJRU5ErkJggg==",
"is_builtin": true, "package": "promptflow-tools", "package_version": "0.0.216",
"enable_kwargs": false, "tool_state": "stable"}, {"name": "OpenAI GPT-4V",
"type": "custom_llm", "inputs": {"connection": {"type": ["OpenAIConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"frequency_penalty": {"type": ["double"], "default": 0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "max_tokens": {"type":
["int"], "default": "", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "model": {"type": ["string"], "enum": ["gpt-4-vision-preview"],
"allow_manual_entry": true, "is_multi_select": false, "input_type": "default"},
"presence_penalty": {"type": ["double"], "default": 0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "stop": {"type":
["list"], "default": "", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "temperature": {"type": ["double"], "default": 1,
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"top_p": {"type": ["double"], "default": 1, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use OpenAI GPT-4V to leverage
vision ability.", "module": "promptflow.tools.openai_gpt4v", "class_name":
"OpenAI", "function": "chat", "is_builtin": true, "package": "promptflow-tools",
"package_version": "0.0.216", "default_prompt": "# system:\nAs an AI assistant,
your task involves interpreting images and responding to questions about the
image.\nRemember to provide accurate answers based on the information present
in the image.\n\n# user:\nCan you tell me what the image depicts?\n\n",
"enable_kwargs": false, "tool_state": "stable"}, {"name": "Serp API", "type":
"python", "inputs": {"connection": {"type": ["SerpConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "engine": {"type":
["string"], "default": "google", "enum": ["google", "bing"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "location": {"type":
["string"], "default": "", "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "num": {"type": ["int"], "default": "10",
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"query": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "safe": {"type": ["string"], "default": "off",
"enum": ["active", "off"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use Serp API to obtain search
results from a specific search engine.", "module": "promptflow.tools.serpapi",
"class_name": "SerpAPI", "function": "search", "is_builtin": true, "package":
"promptflow-tools", "package_version": "0.0.216", "enable_kwargs": false,
"tool_state": "stable"}, {"name": "Faiss Index Lookup", "type": "python",
"inputs": {"path": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "top_k": {"type": ["int"], "default": "3",
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"vector": {"type": ["list"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Search vector based query
from the FAISS index file.", "module": "promptflow_vectordb.tool.faiss_index_lookup",
"class_name": "FaissIndexLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Vector DB Lookup", "type": "python",
"inputs": {"class_name": {"type": ["string"], "enabled_by": "connection",
"enabled_by_type": ["WeaviateConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "collection_name": {"type": ["string"], "enabled_by":
"connection", "enabled_by_type": ["QdrantConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "connection": {"type":
["CognitiveSearchConnection", "QdrantConnection", "WeaviateConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "index_name": {"type":
["string"], "enabled_by": "connection", "enabled_by_type": ["CognitiveSearchConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"search_filters": {"type": ["object"], "enabled_by": "connection", "enabled_by_type":
["CognitiveSearchConnection", "QdrantConnection"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "default"}, "search_params": {"type":
["object"], "enabled_by": "connection", "enabled_by_type": ["CognitiveSearchConnection",
"QdrantConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "text_field": {"type": ["string"], "enabled_by":
"connection", "enabled_by_type": ["CognitiveSearchConnection", "QdrantConnection",
"WeaviateConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "top_k": {"type": ["int"], "default": "3", "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "vector": {"type":
["list"], "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "vector_field": {"type": ["string"], "enabled_by": "connection",
"enabled_by_type": ["CognitiveSearchConnection"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "default"}}, "description": "Search
vector based query from existing Vector Database.", "module": "promptflow_vectordb.tool.vector_db_lookup",
"class_name": "VectorDBLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Vector Index Lookup", "type": "python",
"inputs": {"path": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "query": {"type": ["object"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "top_k": {"type":
["int"], "default": "3", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}}, "description": "Search text or vector based query
from AzureML Vector Index.", "module": "promptflow_vectordb.tool.vector_index_lookup",
"class_name": "VectorIndexLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "hello_world.py", "type": "python",
"inputs": {"name": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "source": "hello_world.py", "function":
"hello_world", "is_builtin": false, "enable_kwargs": false, "tool_state":
"stable"}], "inputs": {"name": {"type": "string", "default": "hod", "is_chat_input":
false}}, "outputs": {"result": {"type": "string", "reference": "${hello_world.output}",
"evaluation_only": false, "is_chat_output": false}}}, "flowRunResourceId":
"azureml://locations/eastus/workspaces/00000/flows/batch_run_name/flowRuns/batch_run_name",
"flowRunId": "batch_run_name", "flowRunDisplayName": "sdk-cli-test-fixture-batch-run-without-llm",
"batchDataInput": {"dataUri": "azureml://datastores/workspaceblobstore/paths/LocalUpload/74c11bba717480b2d6b04b8e746d09d7/webClassification3.jsonl"},
"flowRunType": "FlowRun", "flowType": "Default", "runtimeName": "test-runtime-ci",
"inputsMapping": {"name": "${data.url}"}, "outputDatastoreName": "workspaceblobstore",
"childRunBasePath": "promptflow/PromptFlowArtifacts/batch_run_name/flow_artifacts",
"flowDagFileRelativePath": "flow.dag.yaml", "flowSnapshotId": "85a4b96f-edcb-4164-acea-98bd08d40e22",
"studioPortalEndpoint": "https://ml.azure.com/runs/batch_run_name?wsid=/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000"}'
headers:
connection:
- keep-alive
content-length:
- '12912'
content-type:
- application/json; charset=utf-8
strict-transport-security:
- max-age=15724800; includeSubDomains; preload
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '0.210'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- promptflow-sdk/0.0.1 azsdk-python-azuremachinelearningdesignerserviceclient/unknown
Python/3.10.13 (Windows-10-10.0.22631-SP0)
method: GET
uri: https://eastus.api.azureml.ms/flow/api/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/BulkRuns/batch_run_name/childRuns?endIndex=24&startIndex=0
response:
body:
string: '[{"run_id": "batch_run_name_0", "status": "Completed", "error": null,
"inputs": {"name": "https://www.youtube.com/watch?v=o5ZQyXaAv1g", "line_number":
0}, "output": {"result": "Hello World https://www.youtube.com/watch?v=o5ZQyXaAv1g!"},
"metrics": null, "request": null, "parent_run_id": "batch_run_name", "root_run_id":
"batch_run_name", "source_run_id": null, "flow_id": "default_flow_id", "start_time":
"2024-01-12T07:54:44.493902Z", "end_time": "2024-01-12T07:54:44.50176Z", "index":
0, "api_calls": [{"name": "hello_world", "type": "Tool", "inputs": {"name":
"https://www.youtube.com/watch?v=o5ZQyXaAv1g"}, "output": "Hello World https://www.youtube.com/watch?v=o5ZQyXaAv1g!",
"start_time": 1705046084.496958, "end_time": 1705046084.497766, "error": null,
"children": null, "node_name": "hello_world"}], "variant_id": "", "name":
"", "description": "", "tags": null, "system_metrics": {"duration": 0.007858,
"prompt_tokens": 0, "completion_tokens": 0, "total_tokens": 0}, "result":
{"result": "Hello World https://www.youtube.com/watch?v=o5ZQyXaAv1g!"}, "upload_metrics":
false}, {"run_id": "batch_run_name_1", "status": "Completed", "error": null,
"inputs": {"name": "https://www.youtube.com/watch?v=o5ZQyXaAv1g", "line_number":
1}, "output": {"result": "Hello World https://www.youtube.com/watch?v=o5ZQyXaAv1g!"},
"metrics": null, "request": null, "parent_run_id": "batch_run_name", "root_run_id":
"batch_run_name", "source_run_id": null, "flow_id": "default_flow_id", "start_time":
"2024-01-12T07:54:44.50188Z", "end_time": "2024-01-12T07:54:44.507707Z", "index":
1, "api_calls": [{"name": "hello_world", "type": "Tool", "inputs": {"name":
"https://www.youtube.com/watch?v=o5ZQyXaAv1g"}, "output": "Hello World https://www.youtube.com/watch?v=o5ZQyXaAv1g!",
"start_time": 1705046084.504962, "end_time": 1705046084.505848, "error": null,
"children": null, "node_name": "hello_world"}], "variant_id": "", "name":
"", "description": "", "tags": null, "system_metrics": {"duration": 0.005827,
"prompt_tokens": 0, "completion_tokens": 0, "total_tokens": 0}, "result":
{"result": "Hello World https://www.youtube.com/watch?v=o5ZQyXaAv1g!"}, "upload_metrics":
false}, {"run_id": "batch_run_name_2", "status": "Completed", "error": null,
"inputs": {"name": "https://www.youtube.com/watch?v=o5ZQyXaAv1g", "line_number":
2}, "output": {"result": "Hello World https://www.youtube.com/watch?v=o5ZQyXaAv1g!"},
"metrics": null, "request": null, "parent_run_id": "batch_run_name", "root_run_id":
"batch_run_name", "source_run_id": null, "flow_id": "default_flow_id", "start_time":
"2024-01-12T07:54:44.620862Z", "end_time": "2024-01-12T07:54:44.62622Z", "index":
2, "api_calls": [{"name": "hello_world", "type": "Tool", "inputs": {"name":
"https://www.youtube.com/watch?v=o5ZQyXaAv1g"}, "output": "Hello World https://www.youtube.com/watch?v=o5ZQyXaAv1g!",
"start_time": 1705046084.623683, "end_time": 1705046084.624476, "error": null,
"children": null, "node_name": "hello_world"}], "variant_id": "", "name":
"", "description": "", "tags": null, "system_metrics": {"duration": 0.005358,
"prompt_tokens": 0, "completion_tokens": 0, "total_tokens": 0}, "result":
{"result": "Hello World https://www.youtube.com/watch?v=o5ZQyXaAv1g!"}, "upload_metrics":
false}]'
headers:
connection:
- keep-alive
content-length:
- '3229'
content-type:
- application/json; charset=utf-8
strict-transport-security:
- max-age=15724800; includeSubDomains; preload
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '1.005'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- promptflow-sdk/0.0.1 azsdk-python-azuremachinelearningdesignerserviceclient/unknown
Python/3.10.13 (Windows-10-10.0.22631-SP0)
method: GET
uri: https://eastus.api.azureml.ms/flow/api/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/BulkRuns/batch_run_name/childRuns?endIndex=49&startIndex=25
response:
body:
string: '[]'
headers:
connection:
- keep-alive
content-length:
- '2'
content-type:
- application/json; charset=utf-8
strict-transport-security:
- max-age=15724800; includeSubDomains; preload
x-content-type-options:
- nosniff
x-request-time:
- '0.708'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- promptflow-sdk/0.0.1 azsdk-python-azuremachinelearningdesignerserviceclient/unknown
Python/3.10.13 (Windows-10-10.0.22631-SP0)
method: GET
uri: https://eastus.api.azureml.ms/flow/api/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/BulkRuns/batch_run_name
response:
body:
string: '{"flowGraph": {"nodes": [{"name": "hello_world", "type": "python",
"source": {"type": "code", "path": "hello_world.py"}, "inputs": {"name": "${inputs.name}"},
"tool": "hello_world.py", "reduce": false}], "tools": [{"name": "Content Safety
(Text Analyze)", "type": "python", "inputs": {"connection": {"type": ["AzureContentSafetyConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"hate_category": {"type": ["string"], "default": "medium_sensitivity", "enum":
["disable", "low_sensitivity", "medium_sensitivity", "high_sensitivity"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"self_harm_category": {"type": ["string"], "default": "medium_sensitivity",
"enum": ["disable", "low_sensitivity", "medium_sensitivity", "high_sensitivity"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"sexual_category": {"type": ["string"], "default": "medium_sensitivity", "enum":
["disable", "low_sensitivity", "medium_sensitivity", "high_sensitivity"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"text": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "violence_category": {"type": ["string"],
"default": "medium_sensitivity", "enum": ["disable", "low_sensitivity", "medium_sensitivity",
"high_sensitivity"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}}, "description": "Use Azure Content Safety to detect
harmful content.", "module": "promptflow.tools.azure_content_safety", "function":
"analyze_text", "is_builtin": true, "package": "promptflow-tools", "package_version":
"0.0.216", "enable_kwargs": false, "deprecated_tools": ["content_safety_text.tools.content_safety_text_tool.analyze_text"],
"tool_state": "stable"}, {"name": "Embedding", "type": "python", "inputs":
{"connection": {"type": ["AzureOpenAIConnection", "OpenAIConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "deployment_name":
{"type": ["string"], "enabled_by": "connection", "enabled_by_type": ["AzureOpenAIConnection"],
"model_list": ["text-embedding-ada-002", "text-search-ada-doc-001", "text-search-ada-query-001"],
"capabilities": {"completion": false, "chat_completion": false, "embeddings":
true}, "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "input": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "model": {"type": ["string"], "enum": ["text-embedding-ada-002",
"text-search-ada-doc-001", "text-search-ada-query-001"], "enabled_by": "connection",
"enabled_by_type": ["OpenAIConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use Open AI''s embedding
model to create an embedding vector representing the input text.", "module":
"promptflow.tools.embedding", "function": "embedding", "is_builtin": true,
"package": "promptflow-tools", "package_version": "0.0.216", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Open Source LLM", "type": "custom_llm",
"inputs": {"api": {"type": ["string"], "enum": ["chat", "completion"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "connection": {"type":
["CustomConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "deployment_name": {"type": ["string"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "endpoint_name":
{"type": ["string"], "default": "-- please enter an endpoint name --", "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "max_new_tokens":
{"type": ["int"], "default": 500, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "model_kwargs": {"type": ["object"], "default":
"{}", "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default", "advanced": true}, "temperature": {"type": ["double"], "default":
1.0, "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "top_p": {"type": ["double"], "default": 1.0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default", "advanced": true}},
"description": "Use an Open Source model from the Azure Model catalog, deployed
to an AzureML Online Endpoint for LLM Chat or Completion API calls.", "module":
"promptflow.tools.open_source_llm", "class_name": "OpenSourceLLM", "function":
"call", "icon": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACgElEQVR4nGWSz2vcVRTFP/e9NzOZ1KDGohASslLEH6VLV0ak4l/QpeDCrfQPcNGliODKnVm4EBdBsIjQIlhciKW0ycKFVCSNbYnjdDLtmPnmO/nO9917XcxMkjYX3uLx7nnn3HOuMK2Nix4fP78ZdrYXVkLVWjf3l3B1B+HpcjzGFtmqa6cePz7/x0dnn1n5qhj3iBJPYREIURAJuCtpY8PjReDbrf9WG7H1fuefwQU9qKztTcMJT+PNnEFvjGVDBDlSsH6p/9MLzy6+NxwVqI8RAg4IPmWedMckdLYP6O6UpIaQfvyyXG012+e79/ZfHukoS1ISMT2hGTB1RkUmNgQ5QZ0w+a2VWDq73MbdEWmfnnv6UWe7oNzPaLapl5CwuLTXK9WUGBuCjqekzhP+z52ZXOrKMD3OJg0Hh778aiOuvpnYvp05d6GJO4iAO4QAe/eV36/X5LFRV4Zmn+AdkqlL8Vjp3oVioOz+WTPzzYEgsN+fgPLYyJVheSbPPVl2ikeGZRjtG52/8rHuaV9VOlpP2OtKyVndcRVCSqOhsvxa4vW359i6OuKdD+aP8Q4SYPdOzS/flGjt1JUSaMqZ5nwa1Y8qWb/Ud/eZZkHisYezEM0m+fcelDr8F1SqW2LNK6r1jXQwyLzy1hxvrLXZulry7ocL+FS6G4QIu3fG/Px1gdYeW7LIgXU2P/115TOA5G7e3Rmj2aS/m7l5pThiZzrCcE/d1XHzbln373nw7y6veeoUm5KCNKT/IPPwbiY1hYd/l5MIT65BMFt87sU4v9D7/JMflr44uV6hGh1+L4RCkg6z5iK2tAhNLeLsNGwYA4fDYnC/drvuuFxe86NV/x+Ut27g0FvykgAAAABJRU5ErkJggg==",
"is_builtin": true, "package": "promptflow-tools", "package_version": "0.0.216",
"enable_kwargs": false, "tool_state": "stable"}, {"name": "OpenAI GPT-4V",
"type": "custom_llm", "inputs": {"connection": {"type": ["OpenAIConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"frequency_penalty": {"type": ["double"], "default": 0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "max_tokens": {"type":
["int"], "default": "", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "model": {"type": ["string"], "enum": ["gpt-4-vision-preview"],
"allow_manual_entry": true, "is_multi_select": false, "input_type": "default"},
"presence_penalty": {"type": ["double"], "default": 0, "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "stop": {"type":
["list"], "default": "", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "temperature": {"type": ["double"], "default": 1,
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"top_p": {"type": ["double"], "default": 1, "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use OpenAI GPT-4V to leverage
vision ability.", "module": "promptflow.tools.openai_gpt4v", "class_name":
"OpenAI", "function": "chat", "is_builtin": true, "package": "promptflow-tools",
"package_version": "0.0.216", "default_prompt": "# system:\nAs an AI assistant,
your task involves interpreting images and responding to questions about the
image.\nRemember to provide accurate answers based on the information present
in the image.\n\n# user:\nCan you tell me what the image depicts?\n\n",
"enable_kwargs": false, "tool_state": "stable"}, {"name": "Serp API", "type":
"python", "inputs": {"connection": {"type": ["SerpConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "engine": {"type":
["string"], "default": "google", "enum": ["google", "bing"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "location": {"type":
["string"], "default": "", "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "num": {"type": ["int"], "default": "10",
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"query": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "safe": {"type": ["string"], "default": "off",
"enum": ["active", "off"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Use Serp API to obtain search
results from a specific search engine.", "module": "promptflow.tools.serpapi",
"class_name": "SerpAPI", "function": "search", "is_builtin": true, "package":
"promptflow-tools", "package_version": "0.0.216", "enable_kwargs": false,
"tool_state": "stable"}, {"name": "Faiss Index Lookup", "type": "python",
"inputs": {"path": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "top_k": {"type": ["int"], "default": "3",
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"vector": {"type": ["list"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "description": "Search vector based query
from the FAISS index file.", "module": "promptflow_vectordb.tool.faiss_index_lookup",
"class_name": "FaissIndexLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Vector DB Lookup", "type": "python",
"inputs": {"class_name": {"type": ["string"], "enabled_by": "connection",
"enabled_by_type": ["WeaviateConnection"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "collection_name": {"type": ["string"], "enabled_by":
"connection", "enabled_by_type": ["QdrantConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "connection": {"type":
["CognitiveSearchConnection", "QdrantConnection", "WeaviateConnection"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "index_name": {"type":
["string"], "enabled_by": "connection", "enabled_by_type": ["CognitiveSearchConnection"],
"allow_manual_entry": false, "is_multi_select": false, "input_type": "default"},
"search_filters": {"type": ["object"], "enabled_by": "connection", "enabled_by_type":
["CognitiveSearchConnection", "QdrantConnection"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "default"}, "search_params": {"type":
["object"], "enabled_by": "connection", "enabled_by_type": ["CognitiveSearchConnection",
"QdrantConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "text_field": {"type": ["string"], "enabled_by":
"connection", "enabled_by_type": ["CognitiveSearchConnection", "QdrantConnection",
"WeaviateConnection"], "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}, "top_k": {"type": ["int"], "default": "3", "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "vector": {"type":
["list"], "allow_manual_entry": false, "is_multi_select": false, "input_type":
"default"}, "vector_field": {"type": ["string"], "enabled_by": "connection",
"enabled_by_type": ["CognitiveSearchConnection"], "allow_manual_entry": false,
"is_multi_select": false, "input_type": "default"}}, "description": "Search
vector based query from existing Vector Database.", "module": "promptflow_vectordb.tool.vector_db_lookup",
"class_name": "VectorDBLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "Vector Index Lookup", "type": "python",
"inputs": {"path": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}, "query": {"type": ["object"], "allow_manual_entry":
false, "is_multi_select": false, "input_type": "default"}, "top_k": {"type":
["int"], "default": "3", "allow_manual_entry": false, "is_multi_select": false,
"input_type": "default"}}, "description": "Search text or vector based query
from AzureML Vector Index.", "module": "promptflow_vectordb.tool.vector_index_lookup",
"class_name": "VectorIndexLookup", "function": "search", "is_builtin": true,
"package": "promptflow-vectordb", "package_version": "0.0.1", "enable_kwargs":
false, "tool_state": "stable"}, {"name": "hello_world.py", "type": "python",
"inputs": {"name": {"type": ["string"], "allow_manual_entry": false, "is_multi_select":
false, "input_type": "default"}}, "source": "hello_world.py", "function":
"hello_world", "is_builtin": false, "enable_kwargs": false, "tool_state":
"stable"}], "inputs": {"name": {"type": "string", "default": "hod", "is_chat_input":
false}}, "outputs": {"result": {"type": "string", "reference": "${hello_world.output}",
"evaluation_only": false, "is_chat_output": false}}}, "flowRunResourceId":
"azureml://locations/eastus/workspaces/00000/flows/batch_run_name/flowRuns/batch_run_name",
"flowRunId": "batch_run_name", "flowRunDisplayName": "sdk-cli-test-fixture-batch-run-without-llm",
"batchDataInput": {"dataUri": "azureml://datastores/workspaceblobstore/paths/LocalUpload/74c11bba717480b2d6b04b8e746d09d7/webClassification3.jsonl"},
"flowRunType": "FlowRun", "flowType": "Default", "runtimeName": "test-runtime-ci",
"inputsMapping": {"name": "${data.url}"}, "outputDatastoreName": "workspaceblobstore",
"childRunBasePath": "promptflow/PromptFlowArtifacts/batch_run_name/flow_artifacts",
"flowDagFileRelativePath": "flow.dag.yaml", "flowSnapshotId": "85a4b96f-edcb-4164-acea-98bd08d40e22",
"studioPortalEndpoint": "https://ml.azure.com/runs/batch_run_name?wsid=/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000"}'
headers:
connection:
- keep-alive
content-length:
- '12912'
content-type:
- application/json; charset=utf-8
strict-transport-security:
- max-age=15724800; includeSubDomains; preload
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '0.214'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- promptflow-sdk/0.0.1 azsdk-python-azuremachinelearningdesignerserviceclient/unknown
Python/3.10.13 (Windows-10-10.0.22631-SP0)
method: GET
uri: https://eastus.api.azureml.ms/flow/api/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/BulkRuns/batch_run_name/childRuns?endIndex=24&startIndex=0
response:
body:
string: '[{"run_id": "batch_run_name_0", "status": "Completed", "error": null,
"inputs": {"name": "https://www.youtube.com/watch?v=o5ZQyXaAv1g", "line_number":
0}, "output": {"result": "Hello World https://www.youtube.com/watch?v=o5ZQyXaAv1g!"},
"metrics": null, "request": null, "parent_run_id": "batch_run_name", "root_run_id":
"batch_run_name", "source_run_id": null, "flow_id": "default_flow_id", "start_time":
"2024-01-12T07:54:44.493902Z", "end_time": "2024-01-12T07:54:44.50176Z", "index":
0, "api_calls": [{"name": "hello_world", "type": "Tool", "inputs": {"name":
"https://www.youtube.com/watch?v=o5ZQyXaAv1g"}, "output": "Hello World https://www.youtube.com/watch?v=o5ZQyXaAv1g!",
"start_time": 1705046084.496958, "end_time": 1705046084.497766, "error": null,
"children": null, "node_name": "hello_world"}], "variant_id": "", "name":
"", "description": "", "tags": null, "system_metrics": {"duration": 0.007858,
"prompt_tokens": 0, "completion_tokens": 0, "total_tokens": 0}, "result":
{"result": "Hello World https://www.youtube.com/watch?v=o5ZQyXaAv1g!"}, "upload_metrics":
false}, {"run_id": "batch_run_name_1", "status": "Completed", "error": null,
"inputs": {"name": "https://www.youtube.com/watch?v=o5ZQyXaAv1g", "line_number":
1}, "output": {"result": "Hello World https://www.youtube.com/watch?v=o5ZQyXaAv1g!"},
"metrics": null, "request": null, "parent_run_id": "batch_run_name", "root_run_id":
"batch_run_name", "source_run_id": null, "flow_id": "default_flow_id", "start_time":
"2024-01-12T07:54:44.50188Z", "end_time": "2024-01-12T07:54:44.507707Z", "index":
1, "api_calls": [{"name": "hello_world", "type": "Tool", "inputs": {"name":
"https://www.youtube.com/watch?v=o5ZQyXaAv1g"}, "output": "Hello World https://www.youtube.com/watch?v=o5ZQyXaAv1g!",
"start_time": 1705046084.504962, "end_time": 1705046084.505848, "error": null,
"children": null, "node_name": "hello_world"}], "variant_id": "", "name":
"", "description": "", "tags": null, "system_metrics": {"duration": 0.005827,
"prompt_tokens": 0, "completion_tokens": 0, "total_tokens": 0}, "result":
{"result": "Hello World https://www.youtube.com/watch?v=o5ZQyXaAv1g!"}, "upload_metrics":
false}, {"run_id": "batch_run_name_2", "status": "Completed", "error": null,
"inputs": {"name": "https://www.youtube.com/watch?v=o5ZQyXaAv1g", "line_number":
2}, "output": {"result": "Hello World https://www.youtube.com/watch?v=o5ZQyXaAv1g!"},
"metrics": null, "request": null, "parent_run_id": "batch_run_name", "root_run_id":
"batch_run_name", "source_run_id": null, "flow_id": "default_flow_id", "start_time":
"2024-01-12T07:54:44.620862Z", "end_time": "2024-01-12T07:54:44.62622Z", "index":
2, "api_calls": [{"name": "hello_world", "type": "Tool", "inputs": {"name":
"https://www.youtube.com/watch?v=o5ZQyXaAv1g"}, "output": "Hello World https://www.youtube.com/watch?v=o5ZQyXaAv1g!",
"start_time": 1705046084.623683, "end_time": 1705046084.624476, "error": null,
"children": null, "node_name": "hello_world"}], "variant_id": "", "name":
"", "description": "", "tags": null, "system_metrics": {"duration": 0.005358,
"prompt_tokens": 0, "completion_tokens": 0, "total_tokens": 0}, "result":
{"result": "Hello World https://www.youtube.com/watch?v=o5ZQyXaAv1g!"}, "upload_metrics":
false}]'
headers:
connection:
- keep-alive
content-length:
- '3229'
content-type:
- application/json; charset=utf-8
strict-transport-security:
- max-age=15724800; includeSubDomains; preload
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '0.993'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- promptflow-sdk/0.0.1 azsdk-python-azuremachinelearningdesignerserviceclient/unknown
Python/3.10.13 (Windows-10-10.0.22631-SP0)
method: GET
uri: https://eastus.api.azureml.ms/flow/api/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/BulkRuns/batch_run_name/childRuns?endIndex=49&startIndex=25
response:
body:
string: '[]'
headers:
connection:
- keep-alive
content-length:
- '2'
content-type:
- application/json; charset=utf-8
strict-transport-security:
- max-age=15724800; includeSubDomains; preload
x-content-type-options:
- nosniff
x-request-time:
- '0.748'
status:
code: 200
message: OK
- request:
body: '{"runId": "batch_run_name", "selectRunMetadata": true, "selectRunDefinition":
true, "selectJobSpecification": true}'
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
Content-Length:
- '137'
Content-Type:
- application/json
User-Agent:
- python-requests/2.31.0
method: POST
uri: https://eastus.api.azureml.ms/history/v1.0/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/rundata
response:
body:
string: '{"runMetadata": {"runNumber": 1705046067, "rootRunId": "batch_run_name",
"createdUtc": "2024-01-12T07:54:27.159305+00:00", "createdBy": {"userObjectId":
"00000000-0000-0000-0000-000000000000", "userPuId": null, "userIdp": "https://sts.windows.net/00000000-0000-0000-0000-000000000000/",
"userAltSecId": null, "userIss": "https://sts.windows.net/00000000-0000-0000-0000-000000000000/",
"userTenantId": "00000000-0000-0000-0000-000000000000", "userName": "4cbd0e2e-aae4-4099-b4ba-94d3a4910587",
"upn": null}, "userId": "00000000-0000-0000-0000-000000000000", "token": null,
"tokenExpiryTimeUtc": null, "error": null, "warnings": null, "revision": 6,
"statusRevision": 3, "runUuid": "605728ab-d8cb-4ce5-a40c-67625a2b9471", "parentRunUuid":
null, "rootRunUuid": "605728ab-d8cb-4ce5-a40c-67625a2b9471", "lastStartTimeUtc":
null, "currentComputeTime": null, "computeDuration": "00:00:03.6893368", "effectiveStartTimeUtc":
null, "lastModifiedBy": {"userObjectId": "00000000-0000-0000-0000-000000000000",
"userPuId": null, "userIdp": "https://sts.windows.net/00000000-0000-0000-0000-000000000000/",
"userAltSecId": null, "userIss": "https://sts.windows.net/00000000-0000-0000-0000-000000000000/",
"userTenantId": "00000000-0000-0000-0000-000000000000", "userName": "18a66f5f-dbdf-4c17-9dd7-1634712a9cbe",
"upn": null}, "lastModifiedUtc": "2024-01-12T07:54:46.9642623+00:00", "duration":
"00:00:03.6893368", "cancelationReason": null, "currentAttemptId": 1, "runId":
"batch_run_name", "parentRunId": null, "experimentId": "b1e733a1-2a5f-4c17-bc34-4d66d2858228",
"status": "Completed", "startTimeUtc": "2024-01-12T07:54:44.1317315+00:00",
"endTimeUtc": "2024-01-12T07:54:47.8210683+00:00", "scheduleId": null, "displayName":
"sdk-cli-test-fixture-batch-run-without-llm", "name": null, "dataContainerId":
"dcid.batch_run_name", "description": null, "hidden": false, "runType": "azureml.promptflow.FlowRun",
"runTypeV2": {"orchestrator": null, "traits": [], "attribution": "PromptFlow",
"computeType": "AmlcDsi"}, "properties": {"azureml.promptflow.runtime_name":
"test-runtime-ci", "azureml.promptflow.runtime_version": "20231204.v4", "azureml.promptflow.definition_file_name":
"flow.dag.yaml", "azureml.promptflow.session_id": "bee356189f7e7f18671a79369c78df4cfb1bbd0c99069074",
"azureml.promptflow.flow_lineage_id": "f7ee724d91e4f4a7501bdc0b66995bc8b57f86b3a526fa2a81c34ebcccbbd912",
"azureml.promptflow.flow_definition_datastore_name": "workspaceblobstore",
"azureml.promptflow.flow_definition_blob_path": "LocalUpload/36774154bc3ecde4aa21054b3052221f/hello-world/flow.dag.yaml",
"azureml.promptflow.input_data": "azureml://datastores/workspaceblobstore/paths/LocalUpload/74c11bba717480b2d6b04b8e746d09d7/webClassification3.jsonl",
"azureml.promptflow.inputs_mapping": "{\"name\":\"${data.url}\"}", "_azureml.evaluation_run":
"promptflow.BatchRun", "azureml.promptflow.snapshot_id": "85a4b96f-edcb-4164-acea-98bd08d40e22",
"azureml.promptflow.total_tokens": "0", "_azureml.evaluate_artifacts": "[{\"path\":
\"instance_results.jsonl\", \"type\": \"table\"}]"}, "parameters": {}, "actionUris":
{}, "scriptName": null, "target": null, "uniqueChildRunComputeTargets": [],
"tags": {}, "settings": {}, "services": {}, "inputDatasets": [], "outputDatasets":
[], "runDefinition": null, "jobSpecification": null, "primaryMetricName":
null, "createdFrom": null, "cancelUri": null, "completeUri": null, "diagnosticsUri":
null, "computeRequest": null, "compute": null, "retainForLifetimeOfWorkspace":
false, "queueingInfo": null, "inputs": null, "outputs": {"debug_info": {"assetId":
"azureml://locations/eastus/workspaces/00000/data/azureml_batch_run_name_output_data_debug_info/versions/1",
"type": "UriFolder"}, "flow_outputs": {"assetId": "azureml://locations/eastus/workspaces/00000/data/azureml_batch_run_name_output_data_flow_outputs/versions/1",
"type": "UriFolder"}}}, "runDefinition": null, "jobSpecification": null, "systemSettings":
null}'
headers:
connection:
- keep-alive
content-length:
- '4648'
content-type:
- application/json; charset=utf-8
strict-transport-security:
- max-age=15724800; includeSubDomains; preload
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '0.041'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
Content-Type:
- application/json
User-Agent:
- promptflow-sdk/0.0.1 azsdk-python-azuremachinelearningdesignerserviceclient/unknown
Python/3.10.13 (Windows-10-10.0.22631-SP0)
method: GET
uri: https://eastus.api.azureml.ms/flow/api/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/BulkRuns/batch_run_name/logContent
response:
body:
string: '"2024-01-12 07:54:31 +0000 49 promptflow-runtime INFO [batch_run_name]
Receiving v2 bulk run request a234ccdf-0cdb-4a6d-b615-45a49ec26dcc: {\"flow_id\":
\"batch_run_name\", \"flow_run_id\": \"batch_run_name\", \"flow_source\":
{\"flow_source_type\": 1, \"flow_source_info\": {\"snapshot_id\": \"85a4b96f-edcb-4164-acea-98bd08d40e22\"},
\"flow_dag_file\": \"flow.dag.yaml\"}, \"log_path\": \"https://promptfloweast4063704120.blob.core.windows.net/azureml/ExperimentRun/dcid.batch_run_name/logs/azureml/executionlogs.txt?sv=2019-07-07&sr=b&sig=**data_scrubbed**&skoid=55b92eba-d7c7-4afd-ab76-7bb1cd345283&sktid=00000000-0000-0000-0000-000000000000&skt=2024-01-12T07%3A43%3A15Z&ske=2024-01-13T15%3A53%3A15Z&sks=b&skv=2019-07-07&st=2024-01-12T07%3A44%3A30Z&se=2024-01-12T15%3A54%3A30Z&sp=rcw\",
\"app_insights_instrumentation_key\": \"InstrumentationKey=**data_scrubbed**;IngestionEndpoint=https://eastus-6.in.applicationinsights.azure.com/;LiveEndpoint=https://eastus.livediagnostics.monitor.azure.com/\",
\"data_inputs\": {\"data\": \"azureml://datastores/workspaceblobstore/paths/LocalUpload/74c11bba717480b2d6b04b8e746d09d7/webClassification3.jsonl\"},
\"inputs_mapping\": {\"name\": \"${data.url}\"}, \"azure_storage_setting\":
{\"azure_storage_mode\": 1, \"storage_account_name\": \"promptfloweast4063704120\",
\"blob_container_name\": \"azureml-blobstore-3e123da1-f9a5-4c91-9234-8d9ffbb39ff5\",
\"flow_artifacts_root_path\": \"promptflow/PromptFlowArtifacts/batch_run_name\",
\"blob_container_sas_token\": \"?sv=2019-07-07&sr=c&sig=**data_scrubbed**&skoid=55b92eba-d7c7-4afd-ab76-7bb1cd345283&sktid=00000000-0000-0000-0000-000000000000&skt=2024-01-12T07%3A54%3A31Z&ske=2024-01-19T07%3A54%3A31Z&sks=b&skv=2019-07-07&se=2024-01-19T07%3A54%3A31Z&sp=racwl\",
\"output_datastore_name\": \"workspaceblobstore\"}}\n2024-01-12 07:54:31 +0000 49
promptflow-runtime INFO Runtime version: 20231204.v4. PromptFlow version:
1.2.0rc1\n2024-01-12 07:54:31 +0000 49 promptflow-runtime INFO Updating
batch_run_name to Status.Preparing...\n2024-01-12 07:54:31 +0000 49 promptflow-runtime
INFO Downloading snapshot to /mnt/host/service/app/39649/requests/batch_run_name\n2024-01-12
07:54:32 +0000 49 promptflow-runtime INFO Get snapshot sas url for
85a4b96f-edcb-4164-acea-98bd08d40e22...\n2024-01-12 07:54:38 +0000 49
promptflow-runtime INFO Downloading snapshot 85a4b96f-edcb-4164-acea-98bd08d40e22
from uri https://promptfloweast4063704120.blob.core.windows.net/snapshotzips/promptflow-eastus:3e123da1-f9a5-4c91-9234-8d9ffbb39ff5:snapshotzip/85a4b96f-edcb-4164-acea-98bd08d40e22.zip...\n2024-01-12
07:54:38 +0000 49 promptflow-runtime INFO Downloaded file /mnt/host/service/app/39649/requests/batch_run_name/85a4b96f-edcb-4164-acea-98bd08d40e22.zip
with size 495 for snapshot 85a4b96f-edcb-4164-acea-98bd08d40e22.\n2024-01-12
07:54:38 +0000 49 promptflow-runtime INFO Download snapshot 85a4b96f-edcb-4164-acea-98bd08d40e22
completed.\n2024-01-12 07:54:38 +0000 49 promptflow-runtime INFO Successfully
download snapshot to /mnt/host/service/app/39649/requests/batch_run_name\n2024-01-12
07:54:38 +0000 49 promptflow-runtime INFO About to execute a python
flow.\n2024-01-12 07:54:38 +0000 49 promptflow-runtime INFO Use spawn
method to start child process.\n2024-01-12 07:54:38 +0000 49 promptflow-runtime
INFO Starting to check process 3015 status for run batch_run_name\n2024-01-12
07:54:38 +0000 49 promptflow-runtime INFO Start checking run status
for run batch_run_name\n2024-01-12 07:54:42 +0000 3015 promptflow-runtime
INFO [49--3015] Start processing flowV2......\n2024-01-12 07:54:42 +0000 3015
promptflow-runtime INFO Runtime version: 20231204.v4. PromptFlow version:
1.2.0rc1\n2024-01-12 07:54:42 +0000 3015 promptflow-runtime INFO Setting
mlflow tracking uri...\n2024-01-12 07:54:42 +0000 3015 promptflow-runtime
INFO Validating ''AzureML Data Scientist'' user authentication...\n2024-01-12
07:54:43 +0000 3015 promptflow-runtime INFO Successfully validated
''AzureML Data Scientist'' user authentication.\n2024-01-12 07:54:43 +0000 3015
promptflow-runtime INFO Using AzureMLRunStorageV2\n2024-01-12 07:54:43
+0000 3015 promptflow-runtime INFO Setting mlflow tracking uri to ''azureml://eastus.api.azureml.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/promptflow-eastus''\n2024-01-12
07:54:43 +0000 3015 promptflow-runtime INFO Initialized blob service
client for AzureMLRunTracker.\n2024-01-12 07:54:43 +0000 3015 promptflow-runtime
INFO Setting mlflow tracking uri to ''azureml://eastus.api.azureml.ms/mlflow/v1.0/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/promptflow-eastus''\n2024-01-12
07:54:43 +0000 3015 promptflow-runtime INFO Resolve data from url finished
in 0.5407421309500933 seconds\n2024-01-12 07:54:43 +0000 3015 promptflow-runtime
INFO Starting the aml run ''batch_run_name''...\n2024-01-12 07:54:44 +0000 3015
execution.bulk INFO Using fork, process count: 3\n2024-01-12 07:54:44
+0000 3062 execution.bulk INFO Process 3062 started.\n2024-01-12
07:54:44 +0000 3056 execution.bulk INFO Process 3056 started.\n2024-01-12
07:54:44 +0000 3015 execution.bulk INFO Process name: ForkProcess-36:3,
Process id: 3062, Line number: 0 start execution.\n2024-01-12 07:54:44 +0000 3015
execution.bulk INFO Process name: ForkProcess-36:2, Process id: 3056,
Line number: 1 start execution.\n2024-01-12 07:54:44 +0000 3015 execution.bulk INFO Process
name: ForkProcess-36:3, Process id: 3062, Line number: 0 completed.\n2024-01-12
07:54:44 +0000 3067 execution.bulk INFO Process 3067 started.\n2024-01-12
07:54:44 +0000 3015 execution.bulk INFO Finished 1 / 3 lines.\n2024-01-12
07:54:44 +0000 3015 execution.bulk INFO Process name: ForkProcess-36:4,
Process id: 3067, Line number: 2 start execution.\n2024-01-12 07:54:44 +0000 3015
execution.bulk INFO Average execution time for completed lines: 0.22
seconds. Estimated time for incomplete lines: 0.44 seconds.\n2024-01-12 07:54:44
+0000 3015 execution.bulk INFO Process name: ForkProcess-36:2,
Process id: 3056, Line number: 1 completed.\n2024-01-12 07:54:44 +0000 3015
execution.bulk INFO Finished 2 / 3 lines.\n2024-01-12 07:54:44 +0000 3015
execution.bulk INFO Average execution time for completed lines: 0.14
seconds. Estimated time for incomplete lines: 0.14 seconds.\n2024-01-12 07:54:44
+0000 3015 execution.bulk INFO Process name: ForkProcess-36:4,
Process id: 3067, Line number: 2 completed.\n2024-01-12 07:54:44 +0000 3015
execution.bulk INFO Finished 3 / 3 lines.\n2024-01-12 07:54:44 +0000 3015
execution.bulk INFO Average execution time for completed lines: 0.12
seconds. Estimated time for incomplete lines: 0.0 seconds.\n2024-01-12 07:54:46
+0000 3015 execution.bulk INFO Upload status summary metrics for
run batch_run_name finished in 1.1236545331776142 seconds\n2024-01-12 07:54:46
+0000 3015 promptflow-runtime INFO Successfully write run properties
{\"azureml.promptflow.total_tokens\": 0, \"_azureml.evaluate_artifacts\":
\"[{\\\"path\\\": \\\"instance_results.jsonl\\\", \\\"type\\\": \\\"table\\\"}]\"}
with run id ''batch_run_name''\n2024-01-12 07:54:46 +0000 3015 execution.bulk INFO Upload
RH properties for run batch_run_name finished in 0.07583864592015743 seconds\n2024-01-12
07:54:47 +0000 3015 promptflow-runtime INFO Creating unregistered output
Asset for Run batch_run_name...\n2024-01-12 07:54:47 +0000 3015 promptflow-runtime
INFO Created debug_info Asset: azureml://locations/eastus/workspaces/00000/data/azureml_batch_run_name_output_data_debug_info/versions/1\n2024-01-12
07:54:47 +0000 3015 promptflow-runtime INFO Creating unregistered output
Asset for Run batch_run_name...\n2024-01-12 07:54:47 +0000 3015 promptflow-runtime
INFO Created flow_outputs output Asset: azureml://locations/eastus/workspaces/00000/data/azureml_batch_run_name_output_data_flow_outputs/versions/1\n2024-01-12
07:54:47 +0000 3015 promptflow-runtime INFO Creating Artifact for Run
batch_run_name...\n2024-01-12 07:54:47 +0000 3015 promptflow-runtime INFO Created
instance_results.jsonl Artifact.\n2024-01-12 07:54:47 +0000 3015 promptflow-runtime
INFO Patching batch_run_name...\n2024-01-12 07:54:47 +0000 3015 promptflow-runtime
INFO Ending the aml run ''batch_run_name'' with status ''Completed''...\n2024-01-12
07:54:48 +0000 49 promptflow-runtime INFO Process 3015 finished\n2024-01-12
07:54:49 +0000 49 promptflow-runtime INFO [49] Child process finished!\n2024-01-12
07:54:49 +0000 49 promptflow-runtime INFO [batch_run_name] End processing
bulk run\n2024-01-12 07:54:49 +0000 49 promptflow-runtime INFO Cleanup
working dir /mnt/host/service/app/39649/requests/batch_run_name for bulk run\n"'
headers:
connection:
- keep-alive
content-length:
- '9817'
content-type:
- application/json; charset=utf-8
strict-transport-security:
- max-age=15724800; includeSubDomains; preload
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
x-request-time:
- '0.661'
status:
code: 200
message: OK
version: 1
| promptflow/src/promptflow/tests/test_configs/recordings/test_run_operations_TestFlowRun_test_show_run_details.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/recordings/test_run_operations_TestFlowRun_test_show_run_details.yaml",
"repo_id": "promptflow",
"token_count": 76292
} | 70 |
flow: ../flows/web_classification
data: ../datas/webClassification1.jsonl
column_mapping:
url: "${data.url}"
variant: ${summarize_text_content.variant_0}
# run config: env related
environment_variables: env_file
connections:
classify_with_llm:
connection: new_ai_connection
| promptflow/src/promptflow/tests/test_configs/runs/run_with_connections.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/runs/run_with_connections.yaml",
"repo_id": "promptflow",
"token_count": 106
} | 71 |
inputs:
groundtruth:
type: string
prediction:
type: string
outputs:
grade:
type: string
reference: ${grade.output}
nodes:
- name: grade
type: python
source:
type: code
path: grade.py
inputs:
groundtruth: ${inputs.groundtruth}
prediction: ${inputs.prediction}
- name: calculate_accuracy
type: python
source:
type: code
path: calculate_accuracy.py
inputs:
grades: ${grade.output}
aggregation: true
- name: test_node
type: python
source:
type: code
path: test_node.py
inputs:
input1: ${calculate_accuracy.output}
| promptflow/src/promptflow/tests/test_configs/wrong_flows/non_aggregation_reference_aggregation/flow.dag.yaml/0 | {
"file_path": "promptflow/src/promptflow/tests/test_configs/wrong_flows/non_aggregation_reference_aggregation/flow.dag.yaml",
"repo_id": "promptflow",
"token_count": 229
} | 72 |
With prompt flow, you can use variants to tune your prompt. In this article, you'll learn the prompt flow variants concept.
# Variants
A variant refers to a specific version of a tool node that has distinct settings. Currently, variants are supported only in the LLM tool. For example, in the LLM tool, a new variant can represent either a different prompt content or different connection settings.
Suppose you want to generate a summary of a news article. You can set different variants of prompts and settings like this:
| Variants | Prompt | Connection settings |
| --------- | ------------------------------------------------------------ | ------------------- |
| Variant 0 | `Summary: {{input sentences}}` | Temperature = 1 |
| Variant 1 | `Summary: {{input sentences}}` | Temperature = 0.7 |
| Variant 2 | `What is the main point of this article? {{input sentences}}` | Temperature = 1 |
| Variant 3 | `What is the main point of this article? {{input sentences}}` | Temperature = 0.7 |
By utilizing different variants of prompts and settings, you can explore how the model responds to various inputs and outputs, enabling you to discover the most suitable combination for your requirements.
## Benefits of using variants
- **Enhance the quality of your LLM generation**: By creating multiple variants of the same LLM node with diverse prompts and configurations, you can identify the optimal combination that produces high-quality content aligned with your needs.
- **Save time and effort**: Even slight modifications to a prompt can yield significantly different results. It's crucial to track and compare the performance of each prompt version. With variants, you can easily manage the historical versions of your LLM nodes, facilitating updates based on any variant without the risk of forgetting previous iterations. This saves you time and effort in managing prompt tuning history.
- **Boost productivity**: Variants streamline the optimization process for LLM nodes, making it simpler to create and manage multiple variations. You can achieve improved results in less time, thereby increasing your overall productivity.
- **Facilitate easy comparison**: You can effortlessly compare the results obtained from different variants side by side, enabling you to make data-driven decisions regarding the variant that generates the best outcomes.
## Next steps
- [Tune prompts with variants](../how-to-guides/tune-prompts-with-variants.md) | promptflow/docs/concepts/concept-variants.md/0 | {
"file_path": "promptflow/docs/concepts/concept-variants.md",
"repo_id": "promptflow",
"token_count": 642
} | 0 |
# Referencing external files/folders in a flow
Sometimes, pre-existing code assets are essential for the flow reference. In most cases, you can accomplish this by importing a Python package into your flow. However, if a Python package is not available or it is heavy to create a package, you can still reference external files or folders located outside of the current flow folder by using our **additional includes** feature in your flow configuration.
This feature provides an efficient mechanism to list relative file or folder paths that are outside of the flow folder, integrating them seamlessly into your flow.dag.yaml. For example:
```yaml
additional_includes:
- ../web-classification/classify_with_llm.jinja2
- ../web-classification/convert_to_dict.py
- ../web-classification/fetch_text_content_from_url.py
- ../web-classification/prepare_examples.py
- ../web-classification/summarize_text_content.jinja2
- ../web-classification/summarize_text_content__variant_1.jinja2
```
You can add this field `additional_includes` into the flow.dag.yaml. The value of this field is a list of the **relative file/folder path** to the flow folder.
Just as with the common definition of the tool node entry, you can define the tool node entry in the flow.dag.yaml using only the file name, eliminating the need to specify the relative path again. For example:
```yaml
nodes:
- name: fetch_text_content_from_url
type: python
source:
type: code
path: fetch_text_content_from_url.py
inputs:
url: ${inputs.url}
- name: summarize_text_content
use_variants: true
- name: prepare_examples
type: python
source:
type: code
path: prepare_examples.py
inputs: {}
```
The entry file "fetch_text_content_from_url.py" of the tool node "fetch_text_content_from_url" is located in "../web-classification/fetch_text_content_from_url.py", as specified in the additional_includes field. The same applies to the "summarize_text_content" tool nodes.
> **Note**:
>
> 1. If you have two files with the same name located in different folders specified in the `additional_includes` field, and the file name is also specified as the entry of a tool node, the system will reference the **last one** it encounters in the `additional_includes` field.
> > 1. If you have a file in the flow folder with the same name as a file specified in the `additional_includes` field, the system will prioritize the file listed in the `additional_includes` field.
Take the following YAML structure as an example:
```yaml
additional_includes:
- ../web-classification/prepare_examples.py
- ../tmp/prepare_examples.py
...
nodes:
- name: summarize_text_content
use_variants: true
- name: prepare_examples
type: python
source:
type: code
path: prepare_examples.py
inputs: {}
```
In this case, the system will use "../tmp/prepare_examples.py" as the entry file for the tool node "prepare_examples". Even if there is a file named "prepare_examples.py" in the flow folder, the system will still use the file "../tmp/prepare_examples.py" specified in the `additional_includes` field.
> Tips:
> The additional includes feature can significantly streamline your workflow by eliminating the need to manually handle these references.
> 1. To get a hands-on experience with this feature, practice with our sample [flow-with-additional-includes](https://github.com/microsoft/promptflow/tree/main/examples/flows/standard/flow-with-additional-includes).
> 1. You can learn more about [How the 'additional includes' flow operates during the transition to the cloud](../../cloud/azureai/quick-start.md#run-snapshot-of-the-flow-with-additional-includes). | promptflow/docs/how-to-guides/develop-a-flow/referencing-external-files-or-folders-in-a-flow.md/0 | {
"file_path": "promptflow/docs/how-to-guides/develop-a-flow/referencing-external-files-or-folders-in-a-flow.md",
"repo_id": "promptflow",
"token_count": 1053
} | 1 |
# Manage runs
:::{admonition} Experimental feature
This is an experimental feature, and may change at any time. Learn [more](faq.md#stable-vs-experimental).
:::
This documentation will walk you through how to manage your runs with CLI, SDK and VS Code Extension.
In general:
- For `CLI`, you can run `pf/pfazure run --help` in terminal to see the help messages.
- For `SDK`, you can refer to [Promptflow Python Library Reference](../reference/python-library-reference/promptflow.md) and check `PFClient.runs` for more run operations.
Let's take a look at the following topics:
- [Manage runs](#manage-runs)
- [Create a run](#create-a-run)
- [Get a run](#get-a-run)
- [Show run details](#show-run-details)
- [Show run metrics](#show-run-metrics)
- [Visualize a run](#visualize-a-run)
- [List runs](#list-runs)
- [Update a run](#update-a-run)
- [Archive a run](#archive-a-run)
- [Restore a run](#restore-a-run)
- [Delete a run](#delete-a-run)
## Create a run
::::{tab-set}
:::{tab-item} CLI
:sync: CLI
To create a run against bulk inputs, you can write the following YAML file.
```yaml
$schema: https://azuremlschemas.azureedge.net/promptflow/latest/Run.schema.json
flow: ../web_classification
data: ../webClassification1.jsonl
column_mapping:
url: "${data.url}"
variant: ${summarize_text_content.variant_0}
```
To create a run against existing run, you can write the following YAML file.
```yaml
$schema: https://azuremlschemas.azureedge.net/promptflow/latest/Run.schema.json
flow: ../classification_accuracy_evaluation
data: ../webClassification1.jsonl
column_mapping:
groundtruth: "${data.answer}"
prediction: "${run.outputs.category}"
run: <existing-flow-run-name>
```
Reference [here](https://aka.ms/pf/column-mapping) for detailed information for column mapping.
You can find additional information about flow yaml schema in [Run YAML Schema](../reference/run-yaml-schema-reference.md).
After preparing the yaml file, use the CLI command below to create them:
```bash
# create the flow run
pf run create -f <path-to-flow-run>
# create the flow run and stream output
pf run create -f <path-to-flow-run> --stream
```
The expected result is as follows if the run is created successfully.

:::
:::{tab-item} SDK
:sync: SDK
Using SDK, create `Run` object and submit it with `PFClient`. The following code snippet shows how to import the required class and create the run:
```python
from promptflow import PFClient
from promptflow.entities import Run
# Get a pf client to manage runs
pf = PFClient()
# Initialize an Run object
run = Run(
flow="<path-to-local-flow>",
# run flow against local data or existing run, only one of data & run can be specified.
data="<path-to-data>",
run="<existing-run-name>",
column_mapping={"url": "${data.url}"},
variant="${summarize_text_content.variant_0}"
)
# Create the run
result = pf.runs.create_or_update(run)
print(result)
```
:::
:::{tab-item} VS Code Extension
:sync: VS Code Extension
You can click on the actions on the top of the default yaml editor or the visual editor for the flow.dag.yaml files to trigger flow batch runs.


:::
::::
## Get a run
::::{tab-set}
:::{tab-item} CLI
:sync: CLI
Get a run in CLI with JSON format.
```bash
pf run show --name <run-name>
```

:::
:::{tab-item} SDK
:sync: SDK
Show run with `PFClient`
```python
from promptflow import PFClient
# Get a pf client to manage runs
pf = PFClient()
# Get and print the run
run = pf.runs.get(name="<run-name>")
print(run)
```
:::
:::{tab-item} VS Code Extension
:sync: VSC

:::
::::
## Show run details
::::{tab-set}
:::{tab-item} CLI
:sync: CLI
Get run details with TABLE format.
```bash
pf run show --name <run-name>
```

:::
:::{tab-item} SDK
:sync: SDK
Show run details with `PFClient`
```python
from promptflow import PFClient
from tabulate import tabulate
# Get a pf client to manage runs
pf = PFClient()
# Get and print the run-details
run_details = pf.runs.get_details(name="<run-name>")
print(tabulate(details.head(max_results), headers="keys", tablefmt="grid"))
```
:::
:::{tab-item} VS Code Extension
:sync: VSC

:::
::::
## Show run metrics
::::{tab-set}
:::{tab-item} CLI
:sync: CLI
Get run metrics with JSON format.
```bash
pf run show-metrics --name <run-name>
```

:::
:::{tab-item} SDK
:sync: SDK
Show run metrics with `PFClient`
```python
from promptflow import PFClient
import json
# Get a pf client to manage runs
pf = PFClient()
# Get and print the run-metrics
run_details = pf.runs.get_metrics(name="<run-name>")
print(json.dumps(metrics, indent=4))
```
:::
::::
## Visualize a run
::::{tab-set}
:::{tab-item} CLI
:sync: CLI
Visualize run in browser.
```bash
pf run visualize --names <run-name>
```
A browser will open and display run outputs.

:::
:::{tab-item} SDK
:sync: SDK
Visualize run with `PFClient`
```python
from promptflow import PFClient
# Get a pf client to manage runs
pf = PFClient()
# Visualize the run
client.runs.visualize(runs="<run-name>")
```
:::
:::{tab-item} VS Code Extension
:sync: VSC
On the VS Code primary sidebar > the prompt flow pane, there is a run list. It will list all the runs on your machine. Select one or more items and click the "visualize" button on the top-right to visualize the local runs.

:::
::::
## List runs
::::{tab-set}
:::{tab-item} CLI
:sync: CLI
List runs with JSON format.
```bash
pf run list
```

:::
:::{tab-item} SDK
:sync: SDK
List with `PFClient`
```python
from promptflow import PFClient
# Get a pf client to manage runs
pf = PFClient()
# list runs
runs = pf.runs.list()
print(runs)
```
:::
:::{tab-item} VS Code Extension
:sync: VSC
On the VS Code primary sidebar > the prompt flow pane, there is a run list. It will list all the runs on your machine. Hover on it to view more details.

:::
::::
## Update a run
::::{tab-set}
:::{tab-item} CLI
:sync: CLI
Get run metrics with JSON format.
```bash
pf run update --name <run-name> --set display_name=new_display_name
```
:::
:::{tab-item} SDK
:sync: SDK
Update run with `PFClient`
```python
from promptflow import PFClient
# Get a pf client to manage runs
pf = PFClient()
# Get and print the run-metrics
run = pf.runs.update(name="<run-name>", display_name="new_display_name")
print(run)
```
:::
::::
## Archive a run
::::{tab-set}
:::{tab-item} CLI
:sync: CLI
Archive the run so it won't show in run list results.
```bash
pf run archive --name <run-name>
```
:::
:::{tab-item} SDK
:sync: SDK
Archive with `PFClient`
```python
from promptflow import PFClient
# Get a pf client to manage runs
pf = PFClient()
# archive a run
client.runs.archive(name="<run-name>")
```
:::
:::{tab-item} VS Code Extension
:sync: VSC

:::
::::
## Restore a run
::::{tab-set}
:::{tab-item} CLI
:sync: CLI
Restore an archived run so it can show in run list results.
```bash
pf run restore --name <run-name>
```
:::
:::{tab-item} SDK
:sync: SDK
Restore with `PFClient`
```python
from promptflow import PFClient
# Get a pf client to manage runs
pf = PFClient()
# restore a run
client.runs.restore(name="<run-name>")
```
:::
::::
## Delete a run
::::{tab-set}
:::{tab-item} CLI
:sync: CLI
Caution: pf run delete is irreversible. This operation will delete the run permanently from your local disk. Both run entity and output data will be deleted.
Delete will fail if the run name is not valid.
```bash
pf run delete --name <run-name>
```
:::
:::{tab-item} SDK
:sync: SDK
Delete with `PFClient`
```python
from promptflow import PFClient
# Get a pf client to manage runs
pf = PFClient()
# delete a run
client.runs.delete(name="run-name")
```
:::
:::: | promptflow/docs/how-to-guides/manage-runs.md/0 | {
"file_path": "promptflow/docs/how-to-guides/manage-runs.md",
"repo_id": "promptflow",
"token_count": 2998
} | 2 |
api_key=<your_api_key> | promptflow/examples/connections/.env.example/0 | {
"file_path": "promptflow/examples/connections/.env.example",
"repo_id": "promptflow",
"token_count": 11
} | 3 |
import sys
import os
sys.path.append(
os.path.join(os.path.dirname(os.path.abspath(__file__)), "chat_with_pdf")
)
| promptflow/examples/flows/chat/chat-with-pdf/__init__.py/0 | {
"file_path": "promptflow/examples/flows/chat/chat-with-pdf/__init__.py",
"repo_id": "promptflow",
"token_count": 52
} | 4 |
# Azure OpenAI, uncomment below section if you want to use Azure OpenAI
# Note: EMBEDDING_MODEL_DEPLOYMENT_NAME and CHAT_MODEL_DEPLOYMENT_NAME are deployment names for Azure OpenAI
OPENAI_API_TYPE=azure
OPENAI_API_BASE=<your_AOAI_endpoint>
OPENAI_API_KEY=<your_AOAI_key>
OPENAI_API_VERSION=2023-05-15
EMBEDDING_MODEL_DEPLOYMENT_NAME=text-embedding-ada-002
CHAT_MODEL_DEPLOYMENT_NAME=gpt-4
# OpenAI, uncomment below section if you want to use OpenAI
# Note: EMBEDDING_MODEL_DEPLOYMENT_NAME and CHAT_MODEL_DEPLOYMENT_NAME are model names for OpenAI
#OPENAI_API_KEY=<your_openai_key>
#OPENAI_ORG_ID=<your_openai_org_id> # this is optional
#EMBEDDING_MODEL_DEPLOYMENT_NAME=text-embedding-ada-002
#CHAT_MODEL_DEPLOYMENT_NAME=gpt-4
PROMPT_TOKEN_LIMIT=2000
MAX_COMPLETION_TOKENS=1024
CHUNK_SIZE=256
CHUNK_OVERLAP=16
VERBOSE=True | promptflow/examples/flows/chat/chat-with-pdf/chat_with_pdf/.env.example/0 | {
"file_path": "promptflow/examples/flows/chat/chat-with-pdf/chat_with_pdf/.env.example",
"repo_id": "promptflow",
"token_count": 353
} | 5 |
You are able to reason from previous conversation and the recent question, to come up with a rewrite of the question which is concise but with enough information that people without knowledge of previous conversation can understand the question.
A few examples:
# Example 1
## Previous conversation
user: Who is Bill Clinton?
assistant: Bill Clinton is an American politician who served as the 42nd President of the United States from 1993 to 2001.
## Question
user: When was he born?
## Rewritten question
When was Bill Clinton born?
# Example 2
## Previous conversation
user: What is BERT?
assistant: BERT stands for "Bidirectional Encoder Representations from Transformers." It is a natural language processing (NLP) model developed by Google.
user: What data was used for its training?
assistant: The BERT (Bidirectional Encoder Representations from Transformers) model was trained on a large corpus of publicly available text from the internet. It was trained on a combination of books, articles, websites, and other sources to learn the language patterns and relationships between words.
## Question
user: What NLP tasks can it perform well?
## Rewritten question
What NLP tasks can BERT perform well?
Now comes the actual work - please respond with the rewritten question in the same language as the question, nothing else.
## Previous conversation
{% for item in history %}
{{item["role"]}}: {{item["content"]}}
{% endfor %}
## Question
{{question}}
## Rewritten question | promptflow/examples/flows/chat/chat-with-pdf/chat_with_pdf/rewrite_question_prompt.md/0 | {
"file_path": "promptflow/examples/flows/chat/chat-with-pdf/chat_with_pdf/rewrite_question_prompt.md",
"repo_id": "promptflow",
"token_count": 342
} | 6 |
$schema: https://azuremlschemas.azureedge.net/promptflow/latest/Flow.schema.json
inputs:
chat_history:
type: list
default: []
pdf_url:
type: string
default: https://arxiv.org/pdf/1810.04805.pdf
question:
type: string
is_chat_input: true
default: what is BERT?
config:
type: object
default:
EMBEDDING_MODEL_DEPLOYMENT_NAME: text-embedding-ada-002
CHAT_MODEL_DEPLOYMENT_NAME: gpt-4
PROMPT_TOKEN_LIMIT: 3000
MAX_COMPLETION_TOKENS: 1024
VERBOSE: true
CHUNK_SIZE: 1024
CHUNK_OVERLAP: 64
outputs:
answer:
type: string
is_chat_output: true
reference: ${qna_tool.output.answer}
context:
type: string
reference: ${find_context_tool.output.context}
nodes:
- name: setup_env
type: python
source:
type: code
path: setup_env.py
inputs:
connection: open_ai_connection
config: ${inputs.config}
- name: download_tool
type: python
source:
type: code
path: download_tool.py
inputs:
url: ${inputs.pdf_url}
env_ready_signal: ${setup_env.output}
- name: build_index_tool
type: python
source:
type: code
path: build_index_tool.py
inputs:
pdf_path: ${download_tool.output}
- name: find_context_tool
type: python
source:
type: code
path: find_context_tool.py
inputs:
question: ${rewrite_question_tool.output}
index_path: ${build_index_tool.output}
- name: qna_tool
type: python
source:
type: code
path: qna_tool.py
inputs:
prompt: ${find_context_tool.output.prompt}
history: ${inputs.chat_history}
- name: rewrite_question_tool
type: python
source:
type: code
path: rewrite_question_tool.py
inputs:
question: ${inputs.question}
history: ${inputs.chat_history}
env_ready_signal: ${setup_env.output}
environment:
python_requirements_txt: requirements.txt
| promptflow/examples/flows/chat/chat-with-pdf/flow.dag.yaml/0 | {
"file_path": "promptflow/examples/flows/chat/chat-with-pdf/flow.dag.yaml",
"repo_id": "promptflow",
"token_count": 778
} | 7 |
import re
import bs4
import requests
from promptflow import tool
def decode_str(string):
return string.encode().decode("unicode-escape").encode("latin1").decode("utf-8")
def remove_nested_parentheses(string):
pattern = r"\([^()]+\)"
while re.search(pattern, string):
string = re.sub(pattern, "", string)
return string
@tool
def get_wiki_url(entity: str, count=2):
# Send a request to the URL
url = f"https://en.wikipedia.org/w/index.php?search={entity}"
url_list = []
try:
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) "
"Chrome/113.0.0.0 Safari/537.36 Edg/113.0.1774.35"
}
response = requests.get(url, headers=headers)
if response.status_code == 200:
# Parse the HTML content using BeautifulSoup
soup = bs4.BeautifulSoup(response.text, "html.parser")
mw_divs = soup.find_all("div", {"class": "mw-search-result-heading"})
if mw_divs: # mismatch
result_titles = [decode_str(div.get_text().strip()) for div in mw_divs]
result_titles = [remove_nested_parentheses(result_title) for result_title in result_titles]
print(f"Could not find {entity}. Similar entity: {result_titles[:count]}.")
url_list.extend(
[f"https://en.wikipedia.org/w/index.php?search={result_title}" for result_title in result_titles]
)
else:
page_content = [p_ul.get_text().strip() for p_ul in soup.find_all("p") + soup.find_all("ul")]
if any("may refer to:" in p for p in page_content):
url_list.extend(get_wiki_url("[" + entity + "]"))
else:
url_list.append(url)
else:
msg = (
f"Get url failed with status code {response.status_code}.\nURL: {url}\nResponse: "
f"{response.text[:100]}"
)
print(msg)
return url_list[:count]
except Exception as e:
print("Get url failed with error: {}".format(e))
return url_list
| promptflow/examples/flows/chat/chat-with-wikipedia/get_wiki_url.py/0 | {
"file_path": "promptflow/examples/flows/chat/chat-with-wikipedia/get_wiki_url.py",
"repo_id": "promptflow",
"token_count": 1054
} | 8 |
{"groundtruth": "Tomorrow's weather will be sunny.","prediction": "The weather will be sunny tomorrow."}
| promptflow/examples/flows/evaluation/eval-basic/data.jsonl/0 | {
"file_path": "promptflow/examples/flows/evaluation/eval-basic/data.jsonl",
"repo_id": "promptflow",
"token_count": 25
} | 9 |
# Entity match rate evaluation
This is a flow evaluates: entity match rate.
Tools used in this flow:
- `python` tool
## Prerequisites
Install promptflow sdk and other dependencies:
```bash
pip install -r requirements.txt
```
### 1. Test flow/node
```bash
# test with default input value in flow.dag.yaml
pf flow test --flow .
```
### 2. create flow run with multi line data
```bash
pf run create --flow . --data ./data.jsonl --column-mapping ground_truth='${data.ground_truth}' entities='${data.entities}' --stream
```
You can also skip providing `column-mapping` if provided data has same column name as the flow.
Reference [here](https://aka.ms/pf/column-mapping) for default behavior when `column-mapping` not provided in CLI.
| promptflow/examples/flows/evaluation/eval-entity-match-rate/README.md/0 | {
"file_path": "promptflow/examples/flows/evaluation/eval-entity-match-rate/README.md",
"repo_id": "promptflow",
"token_count": 227
} | 10 |
from typing import List
from promptflow import tool
@tool
def aggregate(perceived_intelligence_score: List[float]):
aggregated_results = {"perceived_intelligence_score": 0.0, "count": 0}
# Calculate average perceived_intelligence_score
for i in range(len(perceived_intelligence_score)):
aggregated_results["perceived_intelligence_score"] += perceived_intelligence_score[i]
aggregated_results["count"] += 1
aggregated_results["perceived_intelligence_score"] /= aggregated_results["count"]
# Log metric for each variant
from promptflow import log_metric
log_metric(key="perceived_intelligence_score", value=aggregated_results["perceived_intelligence_score"])
return aggregated_results
| promptflow/examples/flows/evaluation/eval-perceived-intelligence/aggregate.py/0 | {
"file_path": "promptflow/examples/flows/evaluation/eval-perceived-intelligence/aggregate.py",
"repo_id": "promptflow",
"token_count": 225
} | 11 |
system:
You are an AI assistant. You will be given the definition of an evaluation metric for assessing the quality of an answer in a question-answering task. Your job is to compute an accurate evaluation score using the provided evaluation metric.
user:
Relevance measures how well the answer addresses the main aspects of the question, based on the context. Consider whether all and only the important aspects are contained in the answer when evaluating relevance. Given the context and question, score the relevance of the answer between one to five stars using the following rating scale:
One star: the answer completely lacks relevance
Two stars: the answer mostly lacks relevance
Three stars: the answer is partially relevant
Four stars: the answer is mostly relevant
Five stars: the answer has perfect relevance
This rating value should always be an integer between 1 and 5. So the rating produced should be 1 or 2 or 3 or 4 or 5.
context: Marie Curie was a Polish-born physicist and chemist who pioneered research on radioactivity and was the first woman to win a Nobel Prize.
question: What field did Marie Curie excel in?
answer: Marie Curie was a renowned painter who focused mainly on impressionist styles and techniques.
stars: 1
context: The Beatles were an English rock band formed in Liverpool in 1960, and they are widely regarded as the most influential music band in history.
question: Where were The Beatles formed?
answer: The band The Beatles began their journey in London, England, and they changed the history of music.
stars: 2
context: The recent Mars rover, Perseverance, was launched in 2020 with the main goal of searching for signs of ancient life on Mars. The rover also carries an experiment called MOXIE, which aims to generate oxygen from the Martian atmosphere.
question: What are the main goals of Perseverance Mars rover mission?
answer: The Perseverance Mars rover mission focuses on searching for signs of ancient life on Mars.
stars: 3
context: The Mediterranean diet is a commonly recommended dietary plan that emphasizes fruits, vegetables, whole grains, legumes, lean proteins, and healthy fats. Studies have shown that it offers numerous health benefits, including a reduced risk of heart disease and improved cognitive health.
question: What are the main components of the Mediterranean diet?
answer: The Mediterranean diet primarily consists of fruits, vegetables, whole grains, and legumes.
stars: 4
context: The Queen's Royal Castle is a well-known tourist attraction in the United Kingdom. It spans over 500 acres and contains extensive gardens and parks. The castle was built in the 15th century and has been home to generations of royalty.
question: What are the main attractions of the Queen's Royal Castle?
answer: The main attractions of the Queen's Royal Castle are its expansive 500-acre grounds, extensive gardens, parks, and the historical castle itself, which dates back to the 15th century and has housed generations of royalty.
stars: 5
context: {{context}}
question: {{question}}
answer: {{answer}}
stars: | promptflow/examples/flows/evaluation/eval-qna-non-rag/gpt_relevance_prompt.jinja2/0 | {
"file_path": "promptflow/examples/flows/evaluation/eval-qna-non-rag/gpt_relevance_prompt.jinja2",
"repo_id": "promptflow",
"token_count": 648
} | 12 |
system:
Your task is to break down compound sentences into separate sentences.
For simple sentences just repeat the user input.
Remember to use a json array for the output.
user:
The output must be a json array.
Here are a few examples:
user input: Play Eric Clapton and turn down the volume.
OUTPUT: ["Play Eric Clapton.","Turn down the volume."]
user input: Play some Pink Floyd
OUTPUT: ["Play some Pink Floyd."]
user input: Change the radio station and turn on the seat heating.
OUTPUT: ["Change the radio station.","Turn on the seat heating."]
Process the given user input :
user input: {{question}}
OUTPUT: | promptflow/examples/flows/integrations/azure-ai-language/multi_intent_conversational_language_understanding/chat.jinja2/0 | {
"file_path": "promptflow/examples/flows/integrations/azure-ai-language/multi_intent_conversational_language_understanding/chat.jinja2",
"repo_id": "promptflow",
"token_count": 166
} | 13 |
from bs4 import BeautifulSoup
import re
import requests
def decode_str(string):
return string.encode().decode("unicode-escape").encode("latin1").decode("utf-8")
def get_page_sentence(page, count: int = 10):
# find all paragraphs
paragraphs = page.split("\n")
paragraphs = [p.strip() for p in paragraphs if p.strip()]
# find all sentence
sentences = []
for p in paragraphs:
sentences += p.split('. ')
sentences = [s.strip() + '.' for s in sentences if s.strip()]
# get first `count` number of sentences
return ' '.join(sentences[:count])
def remove_nested_parentheses(string):
pattern = r'\([^()]+\)'
while re.search(pattern, string):
string = re.sub(pattern, '', string)
return string
def search(entity: str, count: int = 10):
"""
The input is an exact entity name. The action will search this entity name on Wikipedia and returns the first
count sentences if it exists. If not, it will return some related entities to search next.
"""
entity_ = entity.replace(" ", "+")
search_url = f"https://en.wikipedia.org/w/index.php?search={entity_}"
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) "
"Chrome/113.0.0.0 Safari/537.36 Edg/113.0.1774.35"
}
response_text = requests.get(search_url, headers=headers).text
soup = BeautifulSoup(response_text, features="html.parser")
result_divs = soup.find_all("div", {"class": "mw-search-result-heading"})
if result_divs: # mismatch
result_titles = [decode_str(div.get_text().strip()) for div in result_divs]
result_titles = [remove_nested_parentheses(result_title) for result_title in result_titles]
obs = f"Could not find {entity}. Similar: {result_titles[:5]}."
else:
page_content = [p_ul.get_text().strip() for p_ul in soup.find_all("p") + soup.find_all("ul")]
if any("may refer to:" in p for p in page_content):
obs = search("[" + entity + "]")
else:
page = ""
for content in page_content:
if len(content.split(" ")) > 2:
page += decode_str(content)
if not content.endswith("\n"):
page += "\n"
obs = get_page_sentence(page, count=count)
return obs
| promptflow/examples/flows/standard/autonomous-agent/wiki_search.py/0 | {
"file_path": "promptflow/examples/flows/standard/autonomous-agent/wiki_search.py",
"repo_id": "promptflow",
"token_count": 975
} | 14 |
$schema: https://azuremlschemas.azureedge.net/promptflow/latest/Flow.schema.json
environment:
python_requirements_txt: requirements.txt
inputs:
text:
type: string
default: Hello World!
outputs:
output:
type: string
reference: ${llm.output}
nodes:
- name: hello_prompt
type: prompt
source:
type: code
path: hello.jinja2
inputs:
text: ${inputs.text}
- name: llm
type: python
source:
type: code
path: hello.py
inputs:
prompt: ${hello_prompt.output}
deployment_name: text-davinci-003
max_tokens: "120"
| promptflow/examples/flows/standard/basic/flow.dag.yaml/0 | {
"file_path": "promptflow/examples/flows/standard/basic/flow.dag.yaml",
"repo_id": "promptflow",
"token_count": 230
} | 15 |
from promptflow import tool
@tool
def class_check(llm_result: str) -> str:
intentions_list = ["order_search", "product_info", "product_recommendation"]
matches = [intention for intention in intentions_list if intention in llm_result.lower()]
return matches[0] if matches else "unknown"
| promptflow/examples/flows/standard/conditional-flow-for-switch/class_check.py/0 | {
"file_path": "promptflow/examples/flows/standard/conditional-flow-for-switch/class_check.py",
"repo_id": "promptflow",
"token_count": 91
} | 16 |
This is the docstring style of sphinx:
"""Description of the function.
:param [ParamName]: [ParamDescription](, defaults to [DefaultParamVal].)
:type [ParamName]: [ParamType](, optional)
...
:raises [ErrorType]: [ErrorDescription]
...
:return: [ReturnDescription]
:rtype: [ReturnType]
"""
Note:
For custom class types, please use the full path, for example:
"~azure.ai.ml.entities._inputs_outputs.Input" is full path for "Input" because of "from azure.ai.ml.entities._inputs_outputs import Input, Output"
"~import_node.Import" is full path for "Import" because of "import import_node.Import"
Complete function docstring example:
from azure.ai.ml.entities._inputs_outputs import Input, Output
from azure.ai.ml.constants import JobType
def output(input: Input, import_node: Import, startHnd=1, endHnd=None, uuids=None) -> Output:
"""Create an Output object.
:param input: The input object.
:type input: ~azure.ai.ml.entities._inputs_outputs.Input
:param import_node: The Import object.
:type import_node: ~import_node.Import
:param startHnd: Start index, defaults to 1
:type startHnd: int, optional
:param endHnd: End index, defaults to None
:type endHnd: int, optional
:return: The Output object.
:rtype: ~azure.ai.ml.entities._inputs_outputs.Output
"""
pass
Here's some code for you:
{{module}}
{{code}}
Please follow the sphinx style and refer above complete function docstring example, then output the docstring for the following class/functions.
Please replace "{docstring}" with the actual docstring.
{% for func in functions %}
{{func}}
{docstring}
pass
{% endfor %} | promptflow/examples/flows/standard/gen-docstring/doc_format.jinja2/0 | {
"file_path": "promptflow/examples/flows/standard/gen-docstring/doc_format.jinja2",
"repo_id": "promptflow",
"token_count": 534
} | 17 |
<jupyter_start><jupyter_code># setup pf client and execution path
from promptflow import PFClient
import json
import os
pf = PFClient()
root = os.path.join(os.getcwd(), "../")
flow = os.path.join(root, "maths-to-code")
data = os.path.join(flow, "math_data.jsonl")
eval_flow = os.path.join(root, "../evaluation/eval-accuracy-maths-to-code")
# start batch run of maths-to-code
base_run = pf.run(
flow = flow,
data = data,
column_mapping={"math_question": "${data.question}"},
display_name="maths_to_code_batch_run",
stream=True
)
# Show output of flow run
pf.get_details(base_run)
# evaluate against the batch run and groundtruth data
eval_run = pf.run(
flow = eval_flow,
data = data,
run = base_run,
column_mapping={"groundtruth": "${data.answer}", "prediction": "${run.outputs.answer}"},
display_name="maths_to_code_eval_run",
stream=True
)
pf.get_details(eval_run)
# Get metrics of the evaluation flow run
pf.get_metrics(eval_run)
# Visualize the flow run and evaluation run with HTML
pf.visualize([base_run, eval_run])<jupyter_output><empty_output><jupyter_text>Run on AzureIf you want to run and evaluate your flow on Azure, you can using following example to setup your Azure ML workspace<jupyter_code>from azure.identity import DefaultAzureCredential, InteractiveBrowserCredential
# init credential
try:
credential = DefaultAzureCredential()
# Check if given credential can get token successfully.
credential.get_token("https://management.azure.com/.default")
except Exception as ex:
# Fall back to InteractiveBrowserCredential in case DefaultAzureCredential not work
credential = InteractiveBrowserCredential()
from promptflow.azure import PFClient
try:
pf = PFClient.from_config(credential=credential)
except Exception as ex:
# NOTE: Update following workspace information if not correctly configure before
client_config = {
"subscription_id": "<SUBSCRIPTION_ID>",
"resource_group": "<RESOURCE_GROUP>",
"workspace_name": "<AML_WORKSPACE_NAME>",
}
if client_config["subscription_id"].startswith("<"):
print(
"please update your <SUBSCRIPTION_ID> <RESOURCE_GROUP> <AML_WORKSPACE_NAME> in notebook cell"
)
raise ex
else: # write and reload from config file
import json, os
config_path = "../.azureml/config.json"
os.makedirs(os.path.dirname(config_path), exist_ok=True)
with open(config_path, "w") as fo:
fo.write(json.dumps(client_config))
pf = PFClient.from_config(credential=credential, path=config_path)
print(pf)
# NOTE: note that you need to replace <open_ai_connection> and <gpt-35-turbo> with your own connection and deployment name in your Azure Machine Learning workspace
connection_mapping = {"code_gen": {"connection": "<my_azure_open_ai_connection>", "deployment_name": "<gpt-35-turbo>"}}
# batch run of maths to code
base_run = pf.run(
flow = flow,
data = data,
column_mapping = {"math_question": "${data.question}"},
connections = connection_mapping,
stream = True,
)
# get output of flow run
pf.get_details(base_run)
# evaluation run against base run
eval_run = pf.run(
flow = eval_flow,
data = data,
run = base_run,
column_mapping={"groundtruth": "${data.answer}", "prediction": "${run.outputs.answer}"},
stream = True,
)
# get output of evaluation run
pf.get_details(eval_run)
metrics = pf.get_metrics(eval_run)
print(json.dumps(metrics, indent=4))<jupyter_output>{
"accuracy": 0.9,
"error_rate": 0.1
} | promptflow/examples/flows/standard/maths-to-code/math_test.ipynb/0 | {
"file_path": "promptflow/examples/flows/standard/maths-to-code/math_test.ipynb",
"repo_id": "promptflow",
"token_count": 1340
} | 18 |
my_tool_package.tools.tool_with_file_path_input.my_tool:
function: my_tool
inputs:
input_file:
type:
- file_path
input_text:
type:
- string
module: my_tool_package.tools.tool_with_file_path_input
name: Tool with FilePath Input
description: This is a tool to demonstrate the usage of FilePath input
type: python
| promptflow/examples/tools/tool-package-quickstart/my_tool_package/yamls/tool_with_file_path_input.yaml/0 | {
"file_path": "promptflow/examples/tools/tool-package-quickstart/my_tool_package/yamls/tool_with_file_path_input.yaml",
"repo_id": "promptflow",
"token_count": 135
} | 19 |
# Basic flow with tool using a dynamic list input
This is a flow demonstrating how to use a tool with a dynamic list input.
Tools used in this flow:
- `python` Tool
Connections used in this flow:
- None
## Prerequisites
Install promptflow sdk and other dependencies:
```bash
pip install -r requirements.txt
```
## Run flow
- Test flow
```bash
pf flow test --flow .
```
| promptflow/examples/tools/use-cases/dynamic-list-input-tool-showcase/README.md/0 | {
"file_path": "promptflow/examples/tools/use-cases/dynamic-list-input-tool-showcase/README.md",
"repo_id": "promptflow",
"token_count": 111
} | 20 |
from promptflow import tool
from promptflow.connections import AzureOpenAIConnection
@tool
def echo_connection(flow_input: str, node_input: str, connection: AzureOpenAIConnection):
print(f"Flow input: {flow_input}")
print(f"Node input: {node_input}")
print(f"Flow connection: {connection._to_dict()}")
# get from env var
return {"value": flow_input}
| promptflow/examples/tutorials/flow-deploy/create-service-with-flow/echo_connection_flow/echo_connection.py/0 | {
"file_path": "promptflow/examples/tutorials/flow-deploy/create-service-with-flow/echo_connection_flow/echo_connection.py",
"repo_id": "promptflow",
"token_count": 128
} | 21 |
<jupyter_start><jupyter_text>Execute flow as a function**Requirements** - In order to benefit from this tutorial, you will need:- A python environment- Installed prompt flow SDK**Learning Objectives** - By the end of this tutorial, you should be able to:- Execute a flow as a function- Execute a flow function with in-memory connection object override- Execute a flow function with fields override- Execute a flow function with streaming output**Motivations** - This guide will walk you through the main scenarios of executing flow as a function. You will learn how to consume flow as a function in different scenarios for more pythonnic usage. Example1: Load flow as a function with inputs<jupyter_code>from promptflow import load_flow
flow_path = "../../flows/standard/web-classification"
sample_url = "https://www.youtube.com/watch?v=o5ZQyXaAv1g"
f = load_flow(source=flow_path)
result = f(url=sample_url)
print(result)<jupyter_output><empty_output><jupyter_text>Example2: Load flow as a function with in-memory connection override You will need to have a connection named "new_ai_connection" to run flow with new connection.<jupyter_code># provide parameters to create connection
conn_name = "new_ai_connection"
api_key = "<user-input>"
api_base = "<user-input>"
api_version = "<user-input>"
# create needed connection
import promptflow
from promptflow.entities import AzureOpenAIConnection, OpenAIConnection
# Follow https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/create-resource?pivots=web-portal to create an Azure Open AI resource.
connection = AzureOpenAIConnection(
name=conn_name,
api_key=api_key,
api_base=api_base,
api_type="azure",
api_version=api_version,
)
# use this if you have an existing OpenAI account
# connection = OpenAIConnection(
# name=conn_name,
# api_key=api_key,
# )
f = load_flow(
source=flow_path,
)
# directly use connection created above
f.context.connections = {"classify_with_llm": {"connection": connection}}
result = f(url=sample_url)
print(result)<jupyter_output><empty_output><jupyter_text>Example 3: Local flow as a function with flow inputs override<jupyter_code>from promptflow.entities import FlowContext
f = load_flow(source=flow_path)
f.context = FlowContext(
# node "fetch_text_content_from_url" will take inputs from the following command instead of from flow input
overrides={"nodes.fetch_text_content_from_url.inputs.url": sample_url},
)
# the url="unknown" will not take effect
result = f(url="unknown")
print(result)<jupyter_output><empty_output><jupyter_text>Example 4: Load flow as a function with streaming output<jupyter_code>f = load_flow(source="../../flows/chat/basic-chat")
f.context.streaming = True
result = f(
chat_history=[
{
"inputs": {"chat_input": "Hi"},
"outputs": {"chat_output": "Hello! How can I assist you today?"},
}
],
question="How are you?",
)
answer = ""
# the result will be a generator, iterate it to get the result
for r in result["answer"]:
answer += r
print(answer)<jupyter_output><empty_output> | promptflow/examples/tutorials/get-started/flow-as-function.ipynb/0 | {
"file_path": "promptflow/examples/tutorials/get-started/flow-as-function.ipynb",
"repo_id": "promptflow",
"token_count": 1011
} | 22 |
import argparse
import json
import os
import re
from datetime import datetime, timedelta
from azure.storage.blob import (
AccountSasPermissions,
BlobServiceClient,
ContentSettings,
ResourceTypes,
generate_account_sas,
)
def get_connection_string(storage_account, storage_key):
return f"DefaultEndpointsProtocol=https;AccountName={storage_account};AccountKey={storage_key};EndpointSuffix=core.windows.net" # noqa: E501
def get_object_sas_token(storage_account, storage_key):
sas_token = generate_account_sas(
account_name=storage_account,
account_key=storage_key,
resource_types=ResourceTypes(object=True),
permission=AccountSasPermissions(read=True),
expiry=datetime.utcnow() + timedelta(days=365),
)
return sas_token
def get_wheel_distribution_name(package_name):
"""The wheel filename is {distribution}-{version}(-{build tag})?-{python tag}-{abi tag}-{platform tag}.whl.
The distribution name is normalized from the package name."""
return package_name.replace(".", "_").replace("-", "_").replace(" ", "_")
def package_name_based_blob_prefix(package_name):
"""Convert package name to a valid blob prefix."""
prefix = package_name.replace(".", "-")
prefix = prefix.replace("_", "-")
prefix = prefix.lower()
return prefix
def override_version_with_latest(distribution_name):
return re.sub("-([0-9.]*)-", "-latest-", distribution_name, count=1)
def publish_package_internal(package_dir_path, storage_key, release_config):
index = release_config["index"]
index_config = config_json["targets"][index]
storage_account = index_config["storage_account"]
packages_container = index_config["packages_container"]
index_container = index_config["index_container"]
blob_prefix = index_config["blob_prefix"]
pypi_endpoint = index_config["endpoint"]
account_url = f"https://{storage_account}.blob.core.windows.net"
wheel_pattern = re.compile(r".+\.whl$")
whl_distributions = [d for d in os.listdir(package_dir_path) if wheel_pattern.match(d)]
if len(whl_distributions) != 1:
print(
f"[Error] Found {len(whl_distributions)} wheel distributions in {package_dir_path}. "
"There should be exactly one."
)
exit(1)
whl_distribution = whl_distributions[0]
# Create the BlobServiceClient with connection string
blob_service_client = BlobServiceClient.from_connection_string(get_connection_string(storage_account, storage_key))
container_client = blob_service_client.get_container_client(packages_container)
# Upload the wheel package to blob storage
package_blob = os.path.join(blob_prefix, whl_distribution)
package_blob_client = blob_service_client.get_blob_client(container=packages_container, blob=package_blob)
upload_file_path = os.path.join(package_dir_path, whl_distribution)
with open(file=upload_file_path, mode="rb") as package_file:
print(f"[Debug] Uploading {whl_distribution} to container: {packages_container}, blob: {package_blob}...")
package_blob_client.upload_blob(package_file, overwrite=True)
if upload_as_latest:
latest_distribution = override_version_with_latest(whl_distribution)
latest_package_blob = os.path.join(blob_prefix, latest_distribution)
latest_package_blob_client = blob_service_client.get_blob_client(
container=packages_container, blob=latest_package_blob
)
upload_file_path = os.path.join(package_dir_path, whl_distribution)
with open(file=upload_file_path, mode="rb") as package_file:
print(
f"[Debug] Uploading {whl_distribution} as latest distribution to "
f"container: {packages_container}, blob: {latest_package_blob}..."
)
latest_package_blob_client.upload_blob(package_file, overwrite=True)
# List the blobs and generate download sas urls
sas_token = get_object_sas_token(storage_account, storage_key)
print(f"Listing wheel packages with prefix {blob_prefix} in container...")
blob_list = container_client.list_blobs(name_starts_with=f"{blob_prefix}/")
distribution_blobs = [d for d in blob_list if wheel_pattern.match(d.name)]
# Reverse the list so that the latest distribution is at the top
distribution_blobs.reverse()
packages_indexes = {} # {package_name: [distributions]}
for blob in distribution_blobs:
distribution_name = blob.name.split("/")[-1]
package_name = package_name_based_blob_prefix(distribution_name.split("-")[0])
print(f"[Debug] Blob: {blob.name}. Package distribution: {distribution_name}. Package name: {package_name}")
download_link = f"{account_url}/{blob.container}/{blob.name}?{sas_token}"
index_item = f"<a href='{download_link}' rel='external'>{distribution_name}</a><br/>"
if package_name in packages_indexes:
packages_indexes[package_name].append(index_item)
else:
packages_indexes[package_name] = [index_item]
# Update index.html in the top level blob prefix for the project
project_index_file = "project_index.html"
with open(project_index_file, "w", encoding="utf8") as index_file:
index_file.write("<!DOCTYPE html>\n")
index_file.write(
"<html lang='en'><head><meta charset='utf-8'>"
"<meta name='api-version' value='2'/>"
"<title>Simple Index</title></head><body>\n"
)
for package_name in packages_indexes:
package_index_url = f"https://{pypi_endpoint}/{blob_prefix}/{package_name}"
print(f"[Debug] Updated package_index_url: {package_index_url}")
index_file.write(f"<a href='{package_index_url}'>{package_name}</a><br/>\n")
index_file.write("</body></html>\n")
project_index_blob = os.path.join(blob_prefix, "index.html")
project_index_blob_client = blob_service_client.get_blob_client(container=index_container, blob=project_index_blob)
content_settings = ContentSettings(content_type="text/html")
with open(file=project_index_file, mode="rb") as index:
print(f"Uploading {project_index_file} to container: {index_container}, blob: {project_index_blob}...")
project_index_blob_client.upload_blob(index, overwrite=True, content_settings=content_settings)
# Update index.html for the package distributions
for package_name, distribution_indexes in packages_indexes.items():
package_index_file = f"{package_name}_index.html"
if len(distribution_indexes) > 0:
print(f"{len(distribution_indexes)} distributions found for package {package_name}. Updating index.html...")
with open(package_index_file, "w", encoding="utf8") as index_file:
index_file.write("<!DOCTYPE html>\n")
index_file.write(
f"<html lang='en'><head><meta charset='utf-8'><title>{package_name}</title></head><body>\n"
)
for item in distribution_indexes:
index_file.write(f"{item}\n")
index_file.write("</body></html>\n")
# Update the index.html to the blob with prefix: <blob_prefix>/<normalized package_name>
index_blob = os.path.join(blob_prefix, package_name, "index.html")
index_blob_client = blob_service_client.get_blob_client(container=index_container, blob=index_blob)
content_settings = ContentSettings(content_type="text/html")
with open(file=package_index_file, mode="rb") as index:
print(f"Uploading {package_index_file} to container: {index_container}, blob: {index_blob}...")
index_blob_client.upload_blob(index, overwrite=True, content_settings=content_settings)
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--config", type=str)
parser.add_argument("--src_folder_name", type=str)
parser.add_argument("--package_dir_path", type=str)
parser.add_argument("--storage_key", type=str)
parser.add_argument("--upload_as_latest", type=str, default="False")
parser.add_argument("--pypi_type", type=str, default="internal") # internal or public pypi
parser.add_argument("--release_type", type=str, default="release") # release or test
args = parser.parse_args()
print("[Debug] Arguments:")
print(f"[Debug] config: {args.config}")
print(f"[Debug] src_folder_name: {args.src_folder_name}")
print(f"[Debug] package_dir_path: {args.package_dir_path}")
upload_as_latest = args.upload_as_latest.lower() == "true"
print(f"[Debug] upload_as_latest: {args.upload_as_latest}. Boolean upload_as_latest: {upload_as_latest}")
print(f"[Debug] pypi_type: {args.pypi_type}")
print(f"[Debug] release_type: {args.release_type}")
cwd = os.getcwd()
print(f"Current working directory: {cwd}")
with open(os.path.join(os.getcwd(), args.config), "r") as config_file:
config_json = json.load(config_file)
package_dir_path = os.path.join(cwd, args.package_dir_path)
release_config = config_json["releases"][args.pypi_type][f"{args.src_folder_name}-{args.release_type}"]
if args.pypi_type == "internal":
publish_package_internal(package_dir_path, args.storage_key, release_config)
| promptflow/scripts/distributing/publish_package.py/0 | {
"file_path": "promptflow/scripts/distributing/publish_package.py",
"repo_id": "promptflow",
"token_count": 3675
} | 23 |
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Project -->
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>3.10</ProductVersion>
<ProjectGuid>04ff6707-750d-4474-89b3-7922c84721be</ProjectGuid>
<SchemaVersion>2.0</SchemaVersion>
<OutputName>promptflow-$(env.CLI_VERSION)</OutputName>
<OutputType>Package</OutputType>
<WixTargetsPath Condition=" '$(WixTargetsPath)' == '' AND '$(MSBuildExtensionsPath32)' != '' ">$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
<WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
</PropertyGroup>
<!-- Local WiX -->
<PropertyGroup>
<LocalWixRoot>wix</LocalWixRoot>
<WixToolPath>$(MSBuildThisFileDirectory)$(LocalWixRoot)</WixToolPath>
<WixTargetsPath Condition="Exists('$(WixToolPath)\Wix.targets')">$(WixToolPath)\Wix.targets</WixTargetsPath>
<WixTasksPath Condition="Exists('$(WixToolPath)\wixtasks.dll')">$(WixToolPath)\wixtasks.dll</WixTasksPath>
<PromptflowSource>scripts\dist\promptflow</PromptflowSource>
<LinkerAdditionalOptions>-fv</LinkerAdditionalOptions>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<OutputPath>out\$(Configuration)\</OutputPath>
<IntermediateOutputPath>out\obj\$(Configuration)\</IntermediateOutputPath>
<DefineConstants>Debug;PromptflowSource=$(PromptflowSource)</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>out\</OutputPath>
<IntermediateOutputPath>out\obj\$(Configuration)\</IntermediateOutputPath>
<DefineConstants>PromptflowSource=$(PromptflowSource)</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
<OutputPath>out\$(Configuration)\</OutputPath>
<IntermediateOutputPath>out\obj\$(Configuration)\</IntermediateOutputPath>
<DefineConstants>Debug;PromptflowSource=$(PromptflowSource)</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
<OutputPath>out\</OutputPath>
<IntermediateOutputPath>out\obj\$(Configuration)\</IntermediateOutputPath>
<DefineConstants>PromptflowSource=$(PromptflowSource)</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Compile Include="out\promptflow.wxs">
<Link>promptflow.wxs</Link>
</Compile>
<Compile Include="product.wxs" />
</ItemGroup>
<ItemGroup>
<None Include=".\resources\logo_pf.png" />
</ItemGroup>
<!-- UI -->
<ItemGroup>
<WixExtension Include="WixUIExtension">
<HintPath>$(WixExtDir)\WixUIExtension.dll</HintPath>
<Name>WixUIExtension</Name>
</WixExtension>
<WixExtension Include="WixUtilExtension">
<HintPath>$(WixExtDir)\WixUtilExtension.dll</HintPath>
<Name>WixUtilExtension</Name>
</WixExtension>
</ItemGroup>
<Import Project="$(WixTargetsPath)" Condition=" '$(WixTargetsPath)' != '' " />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\wix.targets" Condition=" '$(WixTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\wix.targets') " />
<Target Name="EnsureWixToolsetInstalled" Condition=" '$(WixTargetsImported)' != 'true' ">
<Error Text="The WiX Toolset v3.10 build tools must be installed to build this project. To download the WiX Toolset, see https://wixtoolset.org/releases/v3.10/stable" />
</Target>
<Target Name="BeforeBuild">
<HeatDirectory Directory="$(PromptflowSource)" ToolPath="$(WixToolPath)" AutogenerateGuids="true" ComponentGroupName="PromptflowCliComponentGroup" SuppressRootDirectory="true" DirectoryRefId="APPLICATIONFOLDER" OutputFile="out\promptflow.wxs" PreprocessorVariable="var.PromptflowSource" />
</Target>
</Project>
| promptflow/scripts/installer/windows/promptflow.wixproj/0 | {
"file_path": "promptflow/scripts/installer/windows/promptflow.wixproj",
"repo_id": "promptflow",
"token_count": 1537
} | 24 |
import argparse
from pathlib import Path
from jinja2 import Environment, FileSystemLoader
from ghactions_driver.readme_parse import readme_parser
from ghactions_driver.readme_step import ReadmeStepsManage
def write_readme_shell(readme_path: str, output_folder: str):
full_text = readme_parser(readme_path)
Path(ReadmeStepsManage.git_base_dir())
bash_script_path = (
Path(ReadmeStepsManage.git_base_dir()) / output_folder / "bash_script.sh"
)
template_env = Environment(
loader=FileSystemLoader(
Path(ReadmeStepsManage.git_base_dir())
/ "scripts/readme/ghactions_driver/bash_script"
)
)
bash_script_template = template_env.get_template("bash_script.sh.jinja2")
with open(bash_script_path, "w") as f:
f.write(bash_script_template.render({"command": full_text}))
if __name__ == "__main__":
# setup argparse
parser = argparse.ArgumentParser()
parser.add_argument(
"-f",
"--readme-file",
help="Input README.md example 'examples/flows/standard/basic/README.md'",
)
parser.add_argument(
"-o",
"--output-folder",
help="Output folder for bash_script.sh example 'examples/flows/standard/basic/'",
)
args = parser.parse_args()
write_readme_shell(args.readme_file, args.output_folder)
| promptflow/scripts/readme/extract_steps_from_readme.py/0 | {
"file_path": "promptflow/scripts/readme/extract_steps_from_readme.py",
"repo_id": "promptflow",
"token_count": 549
} | 25 |
- name: {{ step_name }}
working-directory: examples
run: |
if [[ -e requirements.txt ]]; then
python -m pip install --upgrade pip
pip install -r requirements.txt
fi | promptflow/scripts/readme/ghactions_driver/workflow_steps/step_install_deps.yml.jinja2/0 | {
"file_path": "promptflow/scripts/readme/ghactions_driver/workflow_steps/step_install_deps.yml.jinja2",
"repo_id": "promptflow",
"token_count": 67
} | 26 |
from promptflow import ToolProvider, tool
import urllib.request
class {{ class_name }}(ToolProvider):
def __init__(self, url: str):
super().__init__()
# Load content from url might be slow, so we do it in __init__ method to make sure it is loaded only once.
self.content = urllib.request.urlopen(url).read()
@tool
def {{ function_name }}(self, query: str) -> str:
# Replace with your tool code.
return "Hello " + query | promptflow/scripts/tool/templates/tool2.py.j2/0 | {
"file_path": "promptflow/scripts/tool/templates/tool2.py.j2",
"repo_id": "promptflow",
"token_count": 171
} | 27 |
# Development Guide
## Prerequisites
```bash
pip install -r requirements.txt
pip install pytest pytest-mock
```
## Run tests
- Create connection config file by `cp connections.json.example connections.json`.
- Fill in fields manually in `connections.json`.
- `cd tests` and run `pytest -s -v` to run all tests.
## Run tests in CI
Use this [workflow](https://github.com/microsoft/promptflow/actions/workflows/tools_secret_upload.yml) to upload secrets in key vault. The secrets you uploaded would be used in [tools tests](https://github.com/microsoft/promptflow/actions/workflows/tools_tests.yml). Note that you only need to upload the SECRETS.
> [!NOTE] After triggering the workflow, kindly request approval from Promptflow Support before proceeding further.
## PR check-in criteria
Here's a friendly heads-up! We've got some criteria for you to self-review your code changes. It's a great way to double-check your work and make sure everything is in order before you share it. Happy coding!
### Maintain code quality
The code you submit in your pull request should adhere to the following guidelines:
- **Maintain clean code**: The code should be clean, easy to understand, and well-structured to promote readability and maintainability.
- **Comment on your code**: Use comments to explain the purpose of certain code segments, particularly complex or non-obvious ones. This assists other developers in understanding your work.
- **Correct typos and grammatical errors**: Ensure that the code and file names are free from spelling mistakes and grammatical errors. This enhances the overall presentation and clarity of your code.
- **Avoid hard-coded values**: It is best to avoid hard-coding values unless absolutely necessary. Instead, use variables, constants, or configuration files, which can be easily modified without changing the source code.
- **Prevent code duplication**: Modify the original code to be more general instead of duplicating it. Code duplication can lead to longer, more complex code that is harder to maintain.
- **Implement effective error handling**: Good error handling is critical for troubleshooting customer issues and analyzing key metrics. Follow the guidelines provided in the [Error Handling Guideline](https://msdata.visualstudio.com/Vienna/_git/PromptFlow?path=/docs/error_handling_guidance.md&_a=preview) and reference the [exception.py](https://github.com/microsoft/promptflow/blob/main/src/promptflow-tools/promptflow/tools/exception.py) file for examples.
### Ensure high test coverage
Test coverage is crucial for maintaining code quality. Please adhere to the following guidelines:
- **Comprehensive Testing**: Include unit tests and e2e tests for any new functionality introduced.
- **Exception Testing**: Make sure to incorporate unit tests for all exceptions. These tests should verify error codes, error messages, and other important values. For reference, you can check out [TestHandleOpenAIError](https://github.com/microsoft/promptflow/blob/main/src/promptflow-tools/tests/test_handle_openai_error.py).
- **VSCode Testing**: If you're adding a new built-in tool, make sure to test your tool within the VSCode environment prior to submitting your PR. For more guidance on this, refer to [Use your tool from VSCode Extension](https://github.com/microsoft/promptflow/blob/main/docs/how-to-guides/develop-a-tool/create-and-use-tool-package.md#use-your-tool-from-vscode-extension).
### Add documents
Ensure to include documentation for your new built-in tool, following the guidelines below:
- **Error-Free Content**: Rectify all typographical and grammatical errors in the documentation. This will ensure clarity and readability.
- **Code Alignment**: The documentation should accurately reflect the current state of your code. Ensure that all described functionalities and behaviors match with your implemented code.
- **Functional Links**: Verify that all embedded links within the documentation are functioning properly, leading to the correct resources or references.
| promptflow/src/promptflow-tools/README.dev.md/0 | {
"file_path": "promptflow/src/promptflow-tools/README.dev.md",
"repo_id": "promptflow",
"token_count": 991
} | 28 |
promptflow.tools.aoai_gpt4v.AzureOpenAI.chat:
name: Azure OpenAI GPT-4 Turbo with Vision
description: Use Azure OpenAI GPT-4 Turbo with Vision to leverage AOAI vision ability.
type: custom_llm
module: promptflow.tools.aoai_gpt4v
class_name: AzureOpenAI
function: chat
tool_state: preview
icon:
light: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAx0lEQVR4nJWSwQ2CQBBFX0jAcjgqXUgPJNiIsQQrIVCIFy8GC6ABDcGDX7Mus9n1Xz7zZ+fPsLPwH4bUg0dD2wMPcbR48Uxq4AKU4iSTDwZ1LhWXipN/B3V0J6hjBTvgLHZNonewBXrgDpzEvXSIjN0BE3AACmmF4kl5F6tNzcCoLpW0SvGovFvsb4oZ2AANcAOu4ka6axCcINN3rg654sww+CYsPD0OwjcozFNh/Qcd78tqVbCIW+n+Fky472Bh/Q6SYb1EEy8tDzd+9IsVPAAAAABJRU5ErkJggg==
dark: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAA2ElEQVR4nJXSzW3CQBAF4DUSTjk+Al1AD0ikESslpBIEheRALhEpgAYSWV8OGUublf/yLuP3PPNmdndS+gdwXZrYDmh7fGE/W+wXbaYd8IYm4rxJPnZ0boI3wZcdJxs/n+AwV7DFK7aFyfQdYIMLPvES8YJNf5yp4jMeeEYdWh38gXOR35YGHe5xabvQdsHv6PLi8qV6gycc8YH3iMfQu6Lh4ASr+F5Hh3XwVWnQYzUkVlX1nccplAb1SN6Y/sfgmlK64VS8wimldIv/0yj2QLkHizG0iWP4AVAfQ34DVQONAAAAAElFTkSuQmCC
default_prompt: |
# system:
As an AI assistant, your task involves interpreting images and responding to questions about the image.
Remember to provide accurate answers based on the information present in the image.
# user:
Can you tell me what the image depicts?

inputs:
connection:
type:
- AzureOpenAIConnection
deployment_name:
type:
- string
temperature:
default: 1
type:
- double
top_p:
default: 1
type:
- double
max_tokens:
default: 512
type:
- int
stop:
default: ""
type:
- list
presence_penalty:
default: 0
type:
- double
frequency_penalty:
default: 0
type:
- double
| promptflow/src/promptflow-tools/promptflow/tools/yamls/aoai_gpt4v.yaml/0 | {
"file_path": "promptflow/src/promptflow-tools/promptflow/tools/yamls/aoai_gpt4v.yaml",
"repo_id": "promptflow",
"token_count": 1018
} | 29 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import argparse
import json
import re
import shutil
from pathlib import Path
from promptflow._cli._params import add_param_set_tool_extra_info, base_params
from promptflow._cli._pf._init_entry_generators import (
InitGenerator,
SetupGenerator,
ToolPackageGenerator,
ToolPackageUtilsGenerator,
ToolReadmeGenerator,
)
from promptflow._cli._utils import activate_action, exception_handler, list_of_dict_to_dict
from promptflow._sdk._constants import DEFAULT_ENCODING
from promptflow._sdk._pf_client import PFClient
from promptflow._utils.logger_utils import get_cli_sdk_logger
from promptflow.exceptions import UserErrorException
logger = get_cli_sdk_logger()
def add_tool_parser(subparsers):
"""Add flow parser to the pf subparsers."""
tool_parser = subparsers.add_parser(
"tool",
description="Manage tools for promptflow.",
help="pf tool",
)
subparsers = tool_parser.add_subparsers()
add_parser_init_tool(subparsers)
add_parser_list_tool(subparsers)
add_parser_validate_tool(subparsers)
tool_parser.set_defaults(action="tool")
def add_parser_init_tool(subparsers):
"""Add tool init parser to the pf tool subparsers."""
epilog = """
Examples:
# Creating a package tool from scratch:
pf tool init --package package_tool --tool tool_name
# Creating a package tool with extra info:
pf tool init --package package_tool --tool tool_name --set icon=<icon-path> category=<category>
# Creating a python tool from scratch:
pf tool init --tool tool_name
""" # noqa: E501
add_param_package = lambda parser: parser.add_argument( # noqa: E731
"--package", type=str, help="The package name to create."
)
add_param_tool = lambda parser: parser.add_argument( # noqa: E731
"--tool", type=str, required=True, help="The tool name to create."
)
add_params = [
add_param_package,
add_param_tool,
add_param_set_tool_extra_info,
] + base_params
return activate_action(
name="init",
description="Creating a tool.",
epilog=epilog,
add_params=add_params,
subparsers=subparsers,
help_message="Initialize a tool directory.",
action_param_name="sub_action",
)
def add_parser_list_tool(subparsers):
"""Add tool list parser to the pf tool subparsers."""
epilog = """
Examples:
# List all package tool in the environment:
pf tool list
# List all package tool and code tool in the flow:
pf tool list --flow flow-path
""" # noqa: E501
add_param_flow = lambda parser: parser.add_argument("--flow", type=str, help="the flow directory") # noqa: E731
add_params = [
add_param_flow,
] + base_params
return activate_action(
name="list",
description="List tools.",
epilog=epilog,
add_params=add_params,
subparsers=subparsers,
help_message="List all tools in the environment.",
action_param_name="sub_action",
)
def add_parser_validate_tool(subparsers):
"""Add tool list parser to the pf tool subparsers."""
epilog = """
Examples:
# Validate single function tool:
pf tool validate -–source <package_name>.<module_name>.<tool_function>
# Validate all tool in a package tool:
pf tool validate -–source <package_name>
# Validate tools in a python script:
pf tool validate --source <path_to_tool_script>
""" # noqa: E501
def add_param_source(parser):
parser.add_argument("--source", type=str, help="The tool source to be used.", required=True)
return activate_action(
name="validate",
description="Validate tool.",
epilog=epilog,
add_params=[
add_param_source,
],
subparsers=subparsers,
help_message="Validate tool. Will raise error if it is not valid.",
action_param_name="sub_action",
)
def dispatch_tool_commands(args: argparse.Namespace):
if args.sub_action == "init":
init_tool(args)
elif args.sub_action == "list":
list_tool(args)
elif args.sub_action == "validate":
validate_tool(args)
@exception_handler("Tool init")
def init_tool(args):
# Validate package/tool name
pattern = r"^[a-zA-Z_][a-zA-Z0-9_]*$"
if args.package and not re.match(pattern, args.package):
raise UserErrorException(f"The package name {args.package} is a invalid identifier.")
if not re.match(pattern, args.tool):
raise UserErrorException(f"The tool name {args.tool} is a invalid identifier.")
print("Creating tool from scratch...")
extra_info = list_of_dict_to_dict(args.extra_info)
icon_path = extra_info.pop("icon", None)
if icon_path and not Path(icon_path).exists():
raise UserErrorException(f"Cannot find the icon path {icon_path}.")
if args.package:
package_path = Path(args.package)
package_name = package_path.stem
script_code_path = package_path / package_name
script_code_path.mkdir(parents=True, exist_ok=True)
# Generate manifest file
manifest_file = package_path / "MANIFEST.in"
manifest_file.touch(exist_ok=True)
with open(manifest_file, "r") as f:
manifest_contents = [line.strip() for line in f.readlines()]
if icon_path:
package_icon_path = package_path / "icons"
package_icon_path.mkdir(exist_ok=True)
dst = shutil.copy2(icon_path, package_icon_path)
icon_path = f'Path(__file__).parent.parent / "icons" / "{Path(dst).name}"'
icon_manifest = f"include {package_name}/icons"
if icon_manifest not in manifest_contents:
manifest_contents.append(icon_manifest)
with open(manifest_file, "w", encoding=DEFAULT_ENCODING) as f:
f.writelines("\n".join(set(manifest_contents)))
# Generate package setup.py
SetupGenerator(package_name=package_name, tool_name=args.tool).generate_to_file(package_path / "setup.py")
# Generate utils.py to list meta data of tools.
ToolPackageUtilsGenerator(package_name=package_name).generate_to_file(script_code_path / "utils.py")
ToolReadmeGenerator(package_name=package_name, tool_name=args.tool).generate_to_file(package_path / "README.md")
else:
script_code_path = Path(".")
if icon_path:
icon_path = f'"{Path(icon_path).as_posix()}"'
# Generate tool script
ToolPackageGenerator(tool_name=args.tool, icon=icon_path, extra_info=extra_info).generate_to_file(
script_code_path / f"{args.tool}.py"
)
InitGenerator().generate_to_file(script_code_path / "__init__.py")
print(f'Done. Created the tool "{args.tool}" in {script_code_path.resolve()}.')
@exception_handler("Tool list")
def list_tool(args):
pf_client = PFClient()
package_tools = pf_client._tools.list(args.flow)
print(json.dumps(package_tools, indent=4))
@exception_handler("Tool validate")
def validate_tool(args):
import importlib
pf_client = PFClient()
try:
__import__(args.source)
source = importlib.import_module(args.source)
logger.debug(f"The source {args.source} is used as a package to validate.")
except ImportError:
try:
module_name, func_name = args.source.rsplit(".", 1)
module = importlib.import_module(module_name)
source = getattr(module, func_name)
logger.debug(f"The source {args.source} is used as a function to validate.")
except Exception:
if not Path(args.source).exists():
raise UserErrorException("Invalid source to validate tools.")
logger.debug(f"The source {args.source} is used as a script to validate.")
source = args.source
validation_result = pf_client._tools.validate(source)
print(repr(validation_result))
if not validation_result.passed:
exit(1)
| promptflow/src/promptflow/promptflow/_cli/_pf/_tool.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_cli/_pf/_tool.py",
"repo_id": "promptflow",
"token_count": 3192
} | 30 |
$schema: https://azuremlschemas.azureedge.net/promptflow/latest/Flow.schema.json
inputs:
chat_history:
type: list
is_chat_history: true
default: []
question:
type: string
is_chat_input: true
outputs:
answer:
type: string
reference: ${chat.output}
is_chat_output: true
nodes:
- name: chat
type: llm
source:
type: code
path: chat.jinja2
inputs:
deployment_name: {{ deployment }}
max_tokens: '256'
temperature: '0.7'
chat_history: ${inputs.chat_history}
question: ${inputs.question}
api: chat
connection: {{ connection }}
environment:
python_requirements_txt: requirements.txt
| promptflow/src/promptflow/promptflow/_cli/data/chat_flow/template/flow.dag.yaml.jinja2/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_cli/data/chat_flow/template/flow.dag.yaml.jinja2",
"repo_id": "promptflow",
"token_count": 257
} | 31 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import asyncio
import functools
import importlib
import inspect
import logging
import os
from datetime import datetime
from importlib.metadata import version
import openai
from promptflow._core.operation_context import OperationContext
from promptflow.contracts.trace import Trace, TraceType
from .tracer import Tracer
USER_AGENT_HEADER = "x-ms-useragent"
PROMPTFLOW_PREFIX = "ms-azure-ai-promptflow-"
IS_LEGACY_OPENAI = version("openai").startswith("0.")
def inject_function_async(args_to_ignore=None, trace_type=TraceType.LLM):
args_to_ignore = args_to_ignore or []
args_to_ignore = set(args_to_ignore)
def wrapper(f):
sig = inspect.signature(f).parameters
@functools.wraps(f)
async def wrapped_method(*args, **kwargs):
if not Tracer.active():
return await f(*args, **kwargs)
all_kwargs = {**{k: v for k, v in zip(sig.keys(), args)}, **kwargs}
for key in args_to_ignore:
all_kwargs.pop(key, None)
name = f.__qualname__ if not f.__module__ else f.__module__ + "." + f.__qualname__
trace = Trace(
name=name,
type=trace_type,
inputs=all_kwargs,
start_time=datetime.utcnow().timestamp(),
)
Tracer.push(trace)
try:
result = await f(*args, **kwargs)
except Exception as ex:
Tracer.pop(error=ex)
raise
else:
result = Tracer.pop(result)
return result
return wrapped_method
return wrapper
def inject_function_sync(args_to_ignore=None, trace_type=TraceType.LLM):
args_to_ignore = args_to_ignore or []
args_to_ignore = set(args_to_ignore)
def wrapper(f):
sig = inspect.signature(f).parameters
@functools.wraps(f)
def wrapped_method(*args, **kwargs):
if not Tracer.active():
return f(*args, **kwargs)
all_kwargs = {**{k: v for k, v in zip(sig.keys(), args)}, **kwargs}
for key in args_to_ignore:
all_kwargs.pop(key, None)
name = f.__qualname__ if not f.__module__ else f.__module__ + "." + f.__qualname__
trace = Trace(
name=name,
type=trace_type,
inputs=all_kwargs,
start_time=datetime.utcnow().timestamp(),
)
Tracer.push(trace)
try:
result = f(*args, **kwargs)
except Exception as ex:
Tracer.pop(error=ex)
raise
else:
result = Tracer.pop(result)
return result
return wrapped_method
return wrapper
def get_aoai_telemetry_headers() -> dict:
"""Get the http headers for AOAI request.
The header, whose name starts with "ms-azure-ai-" or "x-ms-", is used to track the request in AOAI. The
value in this dict will be recorded as telemetry, so please do not put any sensitive information in it.
Returns:
A dictionary of http headers.
"""
# get promptflow info from operation context
operation_context = OperationContext.get_instance()
context_info = operation_context.get_context_dict()
promptflow_info = {k.replace("_", "-"): v for k, v in context_info.items()}
# init headers
headers = {USER_AGENT_HEADER: operation_context.get_user_agent()}
# update header with promptflow info
headers.update({f"{PROMPTFLOW_PREFIX}{k}": str(v) if v is not None else "" for k, v in promptflow_info.items()})
return headers
def inject_operation_headers(f):
def inject_headers(kwargs):
# Inject headers from operation context, overwrite injected header with headers from kwargs.
injected_headers = get_aoai_telemetry_headers()
original_headers = kwargs.get("headers" if IS_LEGACY_OPENAI else "extra_headers")
if original_headers and isinstance(original_headers, dict):
injected_headers.update(original_headers)
kwargs["headers" if IS_LEGACY_OPENAI else "extra_headers"] = injected_headers
if asyncio.iscoroutinefunction(f):
@functools.wraps(f)
async def wrapper(*args, **kwargs):
inject_headers(kwargs)
return await f(*args, **kwargs)
else:
@functools.wraps(f)
def wrapper(*args, **kwargs):
inject_headers(kwargs)
return f(*args, **kwargs)
return wrapper
def inject_async(f):
wrapper_fun = inject_operation_headers((inject_function_async(["api_key", "headers", "extra_headers"])(f)))
wrapper_fun._original = f
return wrapper_fun
def inject_sync(f):
wrapper_fun = inject_operation_headers((inject_function_sync(["api_key", "headers", "extra_headers"])(f)))
wrapper_fun._original = f
return wrapper_fun
def _openai_api_list():
if IS_LEGACY_OPENAI:
sync_apis = (
("openai", "Completion", "create"),
("openai", "ChatCompletion", "create"),
("openai", "Embedding", "create"),
)
async_apis = (
("openai", "Completion", "acreate"),
("openai", "ChatCompletion", "acreate"),
("openai", "Embedding", "acreate"),
)
else:
sync_apis = (
("openai.resources.chat", "Completions", "create"),
("openai.resources", "Completions", "create"),
("openai.resources", "Embeddings", "create"),
)
async_apis = (
("openai.resources.chat", "AsyncCompletions", "create"),
("openai.resources", "AsyncCompletions", "create"),
("openai.resources", "AsyncEmbeddings", "create"),
)
yield sync_apis, inject_sync
yield async_apis, inject_async
def _generate_api_and_injector(apis):
for apis, injector in apis:
for module_name, class_name, method_name in apis:
try:
module = importlib.import_module(module_name)
api = getattr(module, class_name)
if hasattr(api, method_name):
yield api, method_name, injector
except AttributeError as e:
# Log the attribute exception with the missing class information
logging.warning(
f"AttributeError: The module '{module_name}' does not have the class '{class_name}'. {str(e)}"
)
except Exception as e:
# Log other exceptions as a warning, as we're not sure what they might be
logging.warning(f"An unexpected error occurred: {str(e)}")
def available_openai_apis_and_injectors():
"""
Generates a sequence of tuples containing OpenAI API classes, method names, and
corresponding injector functions based on whether the legacy OpenAI interface is used.
This function handles the discrepancy reported in https://github.com/openai/openai-python/issues/996,
where async interfaces were not recognized as coroutines. It ensures that decorators
are applied correctly to both synchronous and asynchronous methods.
Yields:
Tuples of (api_class, method_name, injector_function)
"""
yield from _generate_api_and_injector(_openai_api_list())
def inject_openai_api():
"""This function:
1. Modifies the create methods of the OpenAI API classes to inject logic before calling the original methods.
It stores the original methods as _original attributes of the create methods.
2. Updates the openai api configs from environment variables.
"""
for api, method, injector in available_openai_apis_and_injectors():
# Check if the create method of the openai_api class has already been modified
if not hasattr(getattr(api, method), "_original"):
setattr(api, method, injector(getattr(api, method)))
if IS_LEGACY_OPENAI:
# For the openai versions lower than 1.0.0, it reads api configs from environment variables only at
# import time. So we need to update the openai api configs from environment variables here.
# Please refer to this issue: https://github.com/openai/openai-python/issues/557.
# The issue has been fixed in openai>=1.0.0.
openai.api_key = os.environ.get("OPENAI_API_KEY", openai.api_key)
openai.api_key_path = os.environ.get("OPENAI_API_KEY_PATH", openai.api_key_path)
openai.organization = os.environ.get("OPENAI_ORGANIZATION", openai.organization)
openai.api_base = os.environ.get("OPENAI_API_BASE", openai.api_base)
openai.api_type = os.environ.get("OPENAI_API_TYPE", openai.api_type)
openai.api_version = os.environ.get("OPENAI_API_VERSION", openai.api_version)
def recover_openai_api():
"""This function restores the original create methods of the OpenAI API classes
by assigning them back from the _original attributes of the modified methods.
"""
for api, method, _ in available_openai_apis_and_injectors():
if hasattr(getattr(api, method), "_original"):
setattr(api, method, getattr(getattr(api, method), "_original"))
| promptflow/src/promptflow/promptflow/_core/openai_injector.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_core/openai_injector.py",
"repo_id": "promptflow",
"token_count": 3923
} | 32 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore
from promptflow._sdk._orm.run_info import RunInfo
from .connection import Connection
from .experiment import Experiment
from .session import mgmt_db_session
__all__ = [
"RunInfo",
"Connection",
"Experiment",
"mgmt_db_session",
]
| promptflow/src/promptflow/promptflow/_sdk/_orm/__init__.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_sdk/_orm/__init__.py",
"repo_id": "promptflow",
"token_count": 140
} | 33 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import argparse
import json
import logging
import os
import sys
import waitress
from promptflow._cli._utils import _get_cli_activity_name
from promptflow._constants import PF_NO_INTERACTIVE_LOGIN
from promptflow._sdk._constants import LOGGER_NAME
from promptflow._sdk._service.app import create_app
from promptflow._sdk._service.utils.utils import (
get_port_from_config,
get_started_service_info,
is_port_in_use,
kill_exist_service,
)
from promptflow._sdk._telemetry import ActivityType, get_telemetry_logger, log_activity
from promptflow._sdk._utils import get_promptflow_sdk_version, print_pf_version
from promptflow.exceptions import UserErrorException
def add_start_service_action(subparsers):
"""Add action to start pfs."""
start_pfs_parser = subparsers.add_parser(
"start",
description="Start promptflow service.",
help="pfs start",
)
start_pfs_parser.add_argument("-p", "--port", type=int, help="port of the promptflow service")
start_pfs_parser.add_argument(
"--force",
action="store_true",
help="If the port is used, the existing service will be terminated and restart a new service.",
)
start_pfs_parser.set_defaults(action="start")
def add_show_status_action(subparsers):
"""Add action to show pfs status."""
show_status_parser = subparsers.add_parser(
"show-status",
description="Display the started promptflow service info.",
help="pfs show-status",
)
show_status_parser.set_defaults(action="show-status")
def start_service(args):
port = args.port
app, _ = create_app()
if port and is_port_in_use(port):
app.logger.warning(f"Service port {port} is used.")
raise UserErrorException(f"Service port {port} is used.")
if not port:
port = get_port_from_config(create_if_not_exists=True)
if is_port_in_use(port):
if args.force:
app.logger.warning(f"Force restart the service on the port {port}.")
kill_exist_service(port)
else:
app.logger.warning(f"Service port {port} is used.")
raise UserErrorException(f"Service port {port} is used.")
# Set host to localhost, only allow request from localhost.
app.logger.info(f"Start Prompt Flow Service on http://localhost:{port}, version: {get_promptflow_sdk_version()}")
waitress.serve(app, host="127.0.0.1", port=port)
def main():
command_args = sys.argv[1:]
if len(command_args) == 1 and command_args[0] == "version":
version_dict = {"promptflow": get_promptflow_sdk_version()}
return json.dumps(version_dict, ensure_ascii=False, indent=2, sort_keys=True, separators=(",", ": ")) + "\n"
if len(command_args) == 0:
command_args.append("-h")
# User Agent will be set based on header in request, so not set globally here.
os.environ[PF_NO_INTERACTIVE_LOGIN] = "true"
entry(command_args)
def entry(command_args):
parser = argparse.ArgumentParser(
prog="pfs",
formatter_class=argparse.RawDescriptionHelpFormatter,
description="Prompt Flow Service",
)
parser.add_argument(
"-v", "--version", dest="version", action="store_true", help="show current PromptflowService version and exit"
)
subparsers = parser.add_subparsers()
add_start_service_action(subparsers)
add_show_status_action(subparsers)
args = parser.parse_args(command_args)
activity_name = _get_cli_activity_name(cli=parser.prog, args=args)
logger = get_telemetry_logger()
with log_activity(logger, activity_name, activity_type=ActivityType.INTERNALCALL):
run_command(args)
def run_command(args):
if args.version:
print_pf_version()
return
elif args.action == "show-status":
port = get_port_from_config()
status = get_started_service_info(port)
if status:
print(status)
return
else:
logger = logging.getLogger(LOGGER_NAME)
logger.warning("Promptflow service is not started.")
exit(1)
elif args.action == "start":
start_service(args)
if __name__ == "__main__":
main()
| promptflow/src/promptflow/promptflow/_sdk/_service/entry.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_sdk/_service/entry.py",
"repo_id": "promptflow",
"token_count": 1683
} | 34 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
from pathlib import Path
from typing import Callable, Union
from promptflow import PFClient
from promptflow._constants import LINE_NUMBER_KEY
from promptflow._sdk._load_functions import load_flow
from promptflow._sdk._serving._errors import UnexpectedConnectionProviderReturn, UnsupportedConnectionProvider
from promptflow._sdk._serving.flow_result import FlowResult
from promptflow._sdk._serving.utils import validate_request_data
from promptflow._sdk._utils import (
dump_flow_result,
get_local_connections_from_executable,
override_connection_config_with_environment_variable,
resolve_connections_environment_variable_reference,
update_environment_variables_with_connections,
)
from promptflow._sdk.entities._connection import _Connection
from promptflow._sdk.entities._flow import Flow
from promptflow._sdk.operations._flow_operations import FlowOperations
from promptflow._utils.logger_utils import LoggerFactory
from promptflow._utils.multimedia_utils import convert_multimedia_data_to_base64, persist_multimedia_data
from promptflow.contracts.flow import Flow as ExecutableFlow
from promptflow.executor import FlowExecutor
from promptflow.storage._run_storage import DefaultRunStorage
class FlowInvoker:
"""
The invoker of a flow.
:param flow: The path of the flow, or the flow loaded by load_flow().
:type flow: [str, ~promptflow._sdk.entities._flow.Flow]
:param connection_provider: The connection provider, defaults to None
:type connection_provider: [str, Callable], optional
:param streaming: The function or bool to determine enable streaming or not, defaults to lambda: False
:type streaming: Union[Callable[[], bool], bool], optional
:param connections: Pre-resolved connections used when executing, defaults to None
:type connections: dict, optional
:param connections_name_overrides: The connection name overrides, defaults to None
Example: ``{"aoai_connection": "azure_open_ai_connection"}``
The node with reference to connection 'aoai_connection' will be resolved to the actual connection 'azure_open_ai_connection'. # noqa: E501
:type connections_name_overrides: dict, optional
:param raise_ex: Whether to raise exception when executing flow, defaults to True
:type raise_ex: bool, optional
"""
def __init__(
self,
flow: [str, Flow],
connection_provider: [str, Callable] = None,
streaming: Union[Callable[[], bool], bool] = False,
connections: dict = None,
connections_name_overrides: dict = None,
raise_ex: bool = True,
**kwargs,
):
self.logger = kwargs.get("logger", LoggerFactory.get_logger("flowinvoker"))
self.flow_entity = flow if isinstance(flow, Flow) else load_flow(source=flow)
self._executable_flow = ExecutableFlow._from_dict(
flow_dag=self.flow_entity.dag, working_dir=self.flow_entity.code
)
self.connections = connections or {}
self.connections_name_overrides = connections_name_overrides or {}
self.raise_ex = raise_ex
self.storage = kwargs.get("storage", None)
self.streaming = streaming if isinstance(streaming, Callable) else lambda: streaming
# Pass dump_to path to dump flow result for extension.
self._dump_to = kwargs.get("dump_to", None)
# The credential is used as an option to override
# DefaultAzureCredential when using workspace connection provider
self._credential = kwargs.get("credential", None)
self._init_connections(connection_provider)
self._init_executor()
self.flow = self.executor._flow
self._dump_file_prefix = "chat" if self._is_chat_flow else "flow"
def _init_connections(self, connection_provider):
self._is_chat_flow, _, _ = FlowOperations._is_chat_flow(self._executable_flow)
connection_provider = "local" if connection_provider is None else connection_provider
if isinstance(connection_provider, str):
self.logger.info(f"Getting connections from pf client with provider {connection_provider}...")
connections_to_ignore = list(self.connections.keys())
connections_to_ignore.extend(self.connections_name_overrides.keys())
# Note: The connection here could be local or workspace, depends on the connection.provider in pf.yaml.
connections = get_local_connections_from_executable(
executable=self._executable_flow,
client=PFClient(config={"connection.provider": connection_provider}, credential=self._credential),
connections_to_ignore=connections_to_ignore,
# fetch connections with name override
connections_to_add=list(self.connections_name_overrides.values()),
)
# use original name for connection with name override
override_name_to_original_name_mapping = {v: k for k, v in self.connections_name_overrides.items()}
for name, conn in connections.items():
if name in override_name_to_original_name_mapping:
self.connections[override_name_to_original_name_mapping[name]] = conn
else:
self.connections[name] = conn
elif isinstance(connection_provider, Callable):
self.logger.info("Getting connections from custom connection provider...")
connection_list = connection_provider()
if not isinstance(connection_list, list):
raise UnexpectedConnectionProviderReturn(
f"Connection provider {connection_provider} should return a list of connections."
)
if any(not isinstance(item, _Connection) for item in connection_list):
raise UnexpectedConnectionProviderReturn(
f"All items returned by {connection_provider} should be connection type, got {connection_list}."
)
# TODO(2824058): support connection provider when executing function
connections = {item.name: item.to_execution_connection_dict() for item in connection_list}
self.connections.update(connections)
else:
raise UnsupportedConnectionProvider(connection_provider)
override_connection_config_with_environment_variable(self.connections)
resolve_connections_environment_variable_reference(self.connections)
update_environment_variables_with_connections(self.connections)
self.logger.info(f"Promptflow get connections successfully. keys: {self.connections.keys()}")
def _init_executor(self):
self.logger.info("Promptflow executor starts initializing...")
storage = None
if self._dump_to:
storage = DefaultRunStorage(base_dir=self._dump_to, sub_dir=Path(".promptflow/intermediate"))
else:
storage = self.storage
self.executor = FlowExecutor._create_from_flow(
flow=self._executable_flow,
working_dir=self.flow_entity.code,
connections=self.connections,
raise_ex=self.raise_ex,
storage=storage,
)
self.executor.enable_streaming_for_llm_flow(self.streaming)
self.logger.info("Promptflow executor initiated successfully.")
def _invoke(self, data: dict, run_id=None, disable_input_output_logging=False):
"""
Process a flow request in the runtime.
:param data: The request data dict with flow input as keys, for example: {"question": "What is ChatGPT?"}.
:type data: dict
:param run_id: The run id of the flow request, defaults to None
:type run_id: str, optional
:return: The result of executor.
:rtype: ~promptflow.executor._result.LineResult
"""
log_data = "<REDACTED>" if disable_input_output_logging else data
self.logger.info(f"Validating flow input with data {log_data!r}")
validate_request_data(self.flow, data)
self.logger.info(f"Execute flow with data {log_data!r}")
# Pass index 0 as extension require for dumped result.
# TODO: Remove this index after extension remove this requirement.
result = self.executor.exec_line(data, index=0, run_id=run_id, allow_generator_output=self.streaming())
if LINE_NUMBER_KEY in result.output:
# Remove line number from output
del result.output[LINE_NUMBER_KEY]
return result
def invoke(self, data: dict, run_id=None, disable_input_output_logging=False):
"""
Process a flow request in the runtime and return the output of the executor.
:param data: The request data dict with flow input as keys, for example: {"question": "What is ChatGPT?"}.
:type data: dict
:return: The flow output dict, for example: {"answer": "ChatGPT is a chatbot."}.
:rtype: dict
"""
result = self._invoke(data, run_id=run_id, disable_input_output_logging=disable_input_output_logging)
# Get base64 for multi modal object
resolved_outputs = self._convert_multimedia_data_to_base64(result)
self._dump_invoke_result(result)
log_outputs = "<REDACTED>" if disable_input_output_logging else result.output
self.logger.info(f"Flow run result: {log_outputs}")
if not self.raise_ex:
# If raise_ex is False, we will return the trace flow & node run info.
return FlowResult(
output=resolved_outputs or {},
run_info=result.run_info,
node_run_infos=result.node_run_infos,
)
return resolved_outputs
def _convert_multimedia_data_to_base64(self, invoke_result):
resolved_outputs = {
k: convert_multimedia_data_to_base64(v, with_type=True, dict_type=True)
for k, v in invoke_result.output.items()
}
return resolved_outputs
def _dump_invoke_result(self, invoke_result):
if self._dump_to:
invoke_result.output = persist_multimedia_data(
invoke_result.output, base_dir=self._dump_to, sub_dir=Path(".promptflow/output")
)
dump_flow_result(flow_folder=self._dump_to, flow_result=invoke_result, prefix=self._dump_file_prefix)
| promptflow/src/promptflow/promptflow/_sdk/_serving/flow_invoker.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_sdk/_serving/flow_invoker.py",
"repo_id": "promptflow",
"token_count": 4000
} | 35 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
# this file is a middle layer between the local SDK and executor, it'll have some similar logic with cloud PFS.
import contextlib
import os
import re
import tempfile
import time
from collections import defaultdict
from os import PathLike
from pathlib import Path
from types import GeneratorType
import pydash
from dotenv import load_dotenv
from pydash import objects
from promptflow._sdk._constants import (
ALL_CONNECTION_TYPES,
DEFAULT_VAR_ID,
INPUTS,
NODE,
NODE_VARIANTS,
NODES,
SUPPORTED_CONNECTION_FIELDS,
USE_VARIANTS,
VARIANTS,
ConnectionFields,
)
from promptflow._sdk._errors import InvalidFlowError
from promptflow._sdk._load_functions import load_flow
from promptflow._sdk._utils import (
_get_additional_includes,
_merge_local_code_and_additional_includes,
get_local_connections_from_executable,
get_used_connection_names_from_dict,
update_dict_value_with_connections,
)
from promptflow._sdk.entities._flow import Flow, ProtectedFlow
from promptflow._utils.context_utils import _change_working_dir
from promptflow._utils.flow_utils import dump_flow_dag, load_flow_dag
from promptflow._utils.logger_utils import get_cli_sdk_logger
from promptflow.contracts.flow import Flow as ExecutableFlow
logger = get_cli_sdk_logger()
def overwrite_variant(flow_dag: dict, tuning_node: str = None, variant: str = None, drop_node_variants: bool = False):
# need to overwrite default variant if tuning node and variant not specified.
# check tuning_node & variant
node_name_2_node = {node["name"]: node for node in flow_dag[NODES]}
if tuning_node and tuning_node not in node_name_2_node:
raise InvalidFlowError(f"Node {tuning_node} not found in flow")
if tuning_node and variant:
try:
flow_dag[NODE_VARIANTS][tuning_node][VARIANTS][variant]
except KeyError as e:
raise InvalidFlowError(f"Variant {variant} not found for node {tuning_node}") from e
try:
node_variants = flow_dag.pop(NODE_VARIANTS, {}) if drop_node_variants else flow_dag.get(NODE_VARIANTS, {})
updated_nodes = []
for node in flow_dag.get(NODES, []):
if not node.get(USE_VARIANTS, False):
updated_nodes.append(node)
continue
# update variant
node_name = node["name"]
if node_name not in node_variants:
raise InvalidFlowError(f"No variant for the node {node_name}.")
variants_cfg = node_variants[node_name]
variant_id = variant if node_name == tuning_node else None
if not variant_id:
if DEFAULT_VAR_ID not in variants_cfg:
raise InvalidFlowError(f"Default variant id is not specified for {node_name}.")
variant_id = variants_cfg[DEFAULT_VAR_ID]
if variant_id not in variants_cfg.get(VARIANTS, {}):
raise InvalidFlowError(f"Cannot find the variant {variant_id} for {node_name}.")
variant_cfg = variants_cfg[VARIANTS][variant_id][NODE]
updated_nodes.append({"name": node_name, **variant_cfg})
flow_dag[NODES] = updated_nodes
except KeyError as e:
raise InvalidFlowError("Failed to overwrite tuning node with variant") from e
def overwrite_connections(flow_dag: dict, connections: dict, working_dir: PathLike):
if not connections:
return
if not isinstance(connections, dict):
raise InvalidFlowError(f"Invalid connections overwrite format: {connections}, only list is supported.")
# Load executable flow to check if connection is LLM connection
executable_flow = ExecutableFlow._from_dict(flow_dag=flow_dag, working_dir=Path(working_dir))
node_name_2_node = {node["name"]: node for node in flow_dag[NODES]}
for node_name, connection_dict in connections.items():
if node_name not in node_name_2_node:
raise InvalidFlowError(f"Node {node_name} not found in flow")
if not isinstance(connection_dict, dict):
raise InvalidFlowError(f"Invalid connection overwrite format: {connection_dict}, only dict is supported.")
node = node_name_2_node[node_name]
executable_node = executable_flow.get_node(node_name=node_name)
if executable_flow.is_llm_node(executable_node):
unsupported_keys = connection_dict.keys() - SUPPORTED_CONNECTION_FIELDS
if unsupported_keys:
raise InvalidFlowError(
f"Unsupported llm connection overwrite keys: {unsupported_keys},"
f" only {SUPPORTED_CONNECTION_FIELDS} are supported."
)
try:
connection = connection_dict.get(ConnectionFields.CONNECTION)
if connection:
node[ConnectionFields.CONNECTION] = connection
deploy_name = connection_dict.get(ConnectionFields.DEPLOYMENT_NAME)
if deploy_name:
node[INPUTS][ConnectionFields.DEPLOYMENT_NAME] = deploy_name
except KeyError as e:
raise InvalidFlowError(
f"Failed to overwrite llm node {node_name} with connections {connections}"
) from e
else:
connection_inputs = executable_flow.get_connection_input_names_for_node(node_name=node_name)
for c, v in connection_dict.items():
if c not in connection_inputs:
raise InvalidFlowError(f"Connection with name {c} not found in node {node_name}'s inputs")
node[INPUTS][c] = v
def overwrite_flow(flow_dag: dict, params_overrides: dict):
if not params_overrides:
return
# update flow dag & change nodes list to name: obj dict
flow_dag[NODES] = {node["name"]: node for node in flow_dag[NODES]}
# apply overrides on flow dag
for param, val in params_overrides.items():
objects.set_(flow_dag, param, val)
# revert nodes to list
flow_dag[NODES] = list(flow_dag[NODES].values())
def remove_additional_includes(flow_path: Path):
flow_path, flow_dag = load_flow_dag(flow_path=flow_path)
flow_dag.pop("additional_includes", None)
dump_flow_dag(flow_dag, flow_path)
@contextlib.contextmanager
def variant_overwrite_context(
flow_path: Path,
tuning_node: str = None,
variant: str = None,
connections: dict = None,
*,
overrides: dict = None,
drop_node_variants: bool = False,
):
"""Override variant and connections in the flow."""
flow_dag_path, flow_dag = load_flow_dag(flow_path)
flow_dir_path = flow_dag_path.parent
if _get_additional_includes(flow_dag_path):
# Merge the flow folder and additional includes to temp folder.
with _merge_local_code_and_additional_includes(code_path=flow_path) as temp_dir:
# always overwrite variant since we need to overwrite default variant if not specified.
overwrite_variant(flow_dag, tuning_node, variant, drop_node_variants=drop_node_variants)
overwrite_connections(flow_dag, connections, working_dir=flow_dir_path)
overwrite_flow(flow_dag, overrides)
flow_dag.pop("additional_includes", None)
dump_flow_dag(flow_dag, Path(temp_dir))
flow = load_flow(temp_dir)
yield flow
else:
# Generate a flow, the code path points to the original flow folder,
# the dag path points to the temp dag file after overwriting variant.
with tempfile.TemporaryDirectory() as temp_dir:
overwrite_variant(flow_dag, tuning_node, variant, drop_node_variants=drop_node_variants)
overwrite_connections(flow_dag, connections, working_dir=flow_dir_path)
overwrite_flow(flow_dag, overrides)
flow_path = dump_flow_dag(flow_dag, Path(temp_dir))
flow = ProtectedFlow(code=flow_dir_path, path=flow_path, dag=flow_dag)
yield flow
class SubmitterHelper:
@classmethod
def init_env(cls, environment_variables):
# TODO: remove when executor supports env vars in request
if isinstance(environment_variables, dict):
os.environ.update(environment_variables)
elif isinstance(environment_variables, (str, PathLike, Path)):
load_dotenv(environment_variables)
@staticmethod
def resolve_connections(flow: Flow, client=None, connections_to_ignore=None) -> dict:
# TODO 2856400: use resolve_used_connections instead of this function to avoid using executable in control-plane
from promptflow._sdk.entities._eager_flow import EagerFlow
from .._pf_client import PFClient
if isinstance(flow, EagerFlow):
# TODO(2898247): support prompt flow management connection for eager flow
return {}
client = client or PFClient()
with _change_working_dir(flow.code):
executable = ExecutableFlow.from_yaml(flow_file=flow.path, working_dir=flow.code)
executable.name = str(Path(flow.code).stem)
return get_local_connections_from_executable(
executable=executable, client=client, connections_to_ignore=connections_to_ignore
)
@staticmethod
def resolve_used_connections(flow: ProtectedFlow, tools_meta: dict, client, connections_to_ignore=None) -> dict:
from .._pf_client import PFClient
client = client or PFClient()
connection_names = SubmitterHelper.get_used_connection_names(tools_meta=tools_meta, flow_dag=flow.dag)
connections_to_ignore = connections_to_ignore or []
result = {}
for n in connection_names:
if n not in connections_to_ignore:
conn = client.connections.get(name=n, with_secrets=True)
result[n] = conn._to_execution_connection_dict()
return result
@staticmethod
def get_used_connection_names(tools_meta: dict, flow_dag: dict):
# TODO: handle code tool meta for python
connection_inputs = defaultdict(set)
for package_id, package_meta in tools_meta.get("package", {}).items():
for tool_input_key, tool_input_meta in package_meta.get("inputs", {}).items():
if ALL_CONNECTION_TYPES.intersection(set(tool_input_meta.get("type"))):
connection_inputs[package_id].add(tool_input_key)
connection_names = set()
# TODO: we assume that all variants are resolved here
# TODO: only literal connection inputs are supported
# TODO: check whether we should put this logic in executor as seems it's not possible to avoid touching
# information for executable
for node in flow_dag.get("nodes", []):
package_id = pydash.get(node, "source.tool")
if package_id in connection_inputs:
for connection_input in connection_inputs[package_id]:
connection_name = pydash.get(node, f"inputs.{connection_input}")
if connection_name and not re.match(r"\${.*}", connection_name):
connection_names.add(connection_name)
return list(connection_names)
@classmethod
def load_and_resolve_environment_variables(cls, flow: Flow, environment_variables: dict, client=None):
environment_variables = ExecutableFlow.load_env_variables(
flow_file=flow.path, working_dir=flow.code, environment_variables_overrides=environment_variables
)
cls.resolve_environment_variables(environment_variables, client)
return environment_variables
@classmethod
def resolve_environment_variables(cls, environment_variables: dict, client=None):
from .._pf_client import PFClient
client = client or PFClient()
if not environment_variables:
return None
connection_names = get_used_connection_names_from_dict(environment_variables)
logger.debug("Used connection names: %s", connection_names)
connections = cls.resolve_connection_names(connection_names=connection_names, client=client)
update_dict_value_with_connections(built_connections=connections, connection_dict=environment_variables)
@staticmethod
def resolve_connection_names(connection_names, client, raise_error=False):
result = {}
for n in connection_names:
try:
conn = client.connections.get(name=n, with_secrets=True)
result[n] = conn._to_execution_connection_dict()
except Exception as e:
if raise_error:
raise e
return result
def show_node_log_and_output(node_run_infos, show_node_output, generator_record):
"""Show stdout and output of nodes."""
from colorama import Fore
for node_name, node_result in node_run_infos.items():
# Prefix of node stdout is "%Y-%m-%dT%H:%M:%S%z"
pattern = r"\[\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\+\d{4}\] "
if node_result.logs:
node_logs = re.sub(pattern, "", node_result.logs["stdout"])
if node_logs:
for log in node_logs.rstrip("\n").split("\n"):
print(f"{Fore.LIGHTBLUE_EX}[{node_name}]:", end=" ")
print(log)
if show_node_output:
print(f"{Fore.CYAN}{node_name}: ", end="")
# TODO executor return a type string of generator
node_output = node_result.output
if isinstance(node_result.output, GeneratorType):
node_output = "".join(get_result_output(node_output, generator_record))
print(f"{Fore.LIGHTWHITE_EX}{node_output}")
def print_chat_output(output, generator_record):
if isinstance(output, GeneratorType):
for event in get_result_output(output, generator_record):
print(event, end="")
# For better animation effects
time.sleep(0.01)
# Print a new line at the end of the response
print()
else:
print(output)
def get_result_output(output, generator_record):
if isinstance(output, GeneratorType):
if output in generator_record:
if hasattr(generator_record[output], "items"):
output = iter(generator_record[output].items)
else:
output = iter(generator_record[output])
else:
if hasattr(output.gi_frame.f_locals, "proxy"):
proxy = output.gi_frame.f_locals["proxy"]
generator_record[output] = proxy
else:
generator_record[output] = list(output)
output = generator_record[output]
return output
def resolve_generator(flow_result, generator_record):
# resolve generator in flow result
for k, v in flow_result.run_info.output.items():
if isinstance(v, GeneratorType):
flow_output = "".join(get_result_output(v, generator_record))
flow_result.run_info.output[k] = flow_output
flow_result.run_info.result[k] = flow_output
flow_result.output[k] = flow_output
# resolve generator in node outputs
for node_name, node in flow_result.node_run_infos.items():
if isinstance(node.output, GeneratorType):
node_output = "".join(get_result_output(node.output, generator_record))
node.output = node_output
node.result = node_output
return flow_result
| promptflow/src/promptflow/promptflow/_sdk/_submitter/utils.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_sdk/_submitter/utils.py",
"repo_id": "promptflow",
"token_count": 6479
} | 36 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import abc
import importlib
import json
import types
from os import PathLike
from pathlib import Path
from typing import Dict, List, Union
from promptflow._core.token_provider import AzureTokenProvider, TokenProviderABC
from promptflow._sdk._constants import (
BASE_PATH_CONTEXT_KEY,
PARAMS_OVERRIDE_KEY,
SCHEMA_KEYS_CONTEXT_CONFIG_KEY,
SCHEMA_KEYS_CONTEXT_SECRET_KEY,
SCRUBBED_VALUE,
SCRUBBED_VALUE_NO_CHANGE,
SCRUBBED_VALUE_USER_INPUT,
ConfigValueType,
ConnectionType,
CustomStrongTypeConnectionConfigs,
)
from promptflow._sdk._errors import UnsecureConnectionError, SDKError
from promptflow._sdk._orm.connection import Connection as ORMConnection
from promptflow._sdk._utils import (
decrypt_secret_value,
encrypt_secret_value,
find_type_in_override,
in_jupyter_notebook,
print_yellow_warning,
snake_to_camel,
)
from promptflow._sdk.entities._yaml_translatable import YAMLTranslatableMixin
from promptflow._sdk.schemas._connection import (
AzureContentSafetyConnectionSchema,
AzureOpenAIConnectionSchema,
CognitiveSearchConnectionSchema,
CustomConnectionSchema,
CustomStrongTypeConnectionSchema,
FormRecognizerConnectionSchema,
OpenAIConnectionSchema,
QdrantConnectionSchema,
SerpConnectionSchema,
WeaviateConnectionSchema,
)
from promptflow._utils.logger_utils import LoggerFactory
from promptflow.contracts.types import Secret
from promptflow.exceptions import ValidationException, UserErrorException
logger = LoggerFactory.get_logger(name=__name__)
PROMPTFLOW_CONNECTIONS = "promptflow.connections"
class _Connection(YAMLTranslatableMixin):
"""A connection entity that stores the connection information.
:param name: Connection name
:type name: str
:param type: Possible values include: "OpenAI", "AzureOpenAI", "Custom".
:type type: str
:param module: The module of connection class, used for execution.
:type module: str
:param configs: The configs kv pairs.
:type configs: Dict[str, str]
:param secrets: The secrets kv pairs.
:type secrets: Dict[str, str]
"""
TYPE = ConnectionType._NOT_SET
def __init__(
self,
name: str = "default_connection",
module: str = "promptflow.connections",
configs: Dict[str, str] = None,
secrets: Dict[str, str] = None,
**kwargs,
):
self.name = name
self.type = self.TYPE
self.class_name = f"{self.TYPE.value}Connection" # The type in executor connection dict
self.configs = configs or {}
self.module = module
# Note the connection secrets value behaviors:
# --------------------------------------------------------------------------------
# | secret value | CLI create | CLI update | SDK create_or_update |
# --------------------------------------------------------------------------------
# | empty or all "*" | prompt input | use existing values | use existing values |
# | <no-change> | prompt input | use existing values | use existing values |
# | <user-input> | prompt input | prompt input | raise error |
# --------------------------------------------------------------------------------
self.secrets = secrets or {}
self._secrets = {**self.secrets} # Un-scrubbed secrets
self.expiry_time = kwargs.get("expiry_time", None)
self.created_date = kwargs.get("created_date", None)
self.last_modified_date = kwargs.get("last_modified_date", None)
# Conditional assignment to prevent entity bloat when unused.
print_as_yaml = kwargs.pop("print_as_yaml", in_jupyter_notebook())
if print_as_yaml:
self.print_as_yaml = True
@classmethod
def _casting_type(cls, typ):
type_dict = {
"azure_open_ai": ConnectionType.AZURE_OPEN_AI.value,
"open_ai": ConnectionType.OPEN_AI.value,
}
if typ in type_dict:
return type_dict.get(typ)
return snake_to_camel(typ)
def keys(self) -> List:
"""Return keys of the connection properties."""
return list(self.configs.keys()) + list(self.secrets.keys())
def __getitem__(self, item):
# Note: This is added to allow usage **connection().
if item in self.secrets:
return self.secrets[item]
if item in self.configs:
return self.configs[item]
# raise UserErrorException(error=KeyError(f"Key {item!r} not found in connection {self.name!r}."))
# Cant't raise UserErrorException due to the code exit(1) of promptflow._cli._utils.py line 368.
raise KeyError(f"Key {item!r} not found in connection {self.name!r}.")
@classmethod
def _is_scrubbed_value(cls, value):
"""For scrubbed value, cli will get original for update, and prompt user to input for create."""
if value is None or not value:
return True
if all([v == "*" for v in value]):
return True
return value == SCRUBBED_VALUE_NO_CHANGE
@classmethod
def _is_user_input_value(cls, value):
"""The value will prompt user to input in cli for both create and update."""
return value == SCRUBBED_VALUE_USER_INPUT
def _validate_and_encrypt_secrets(self):
encrypt_secrets = {}
invalid_secrets = []
for k, v in self.secrets.items():
# In sdk experience, if v is not scrubbed, use it.
# If v is scrubbed, try to use the value in _secrets.
# If v is <user-input>, raise error.
if self._is_scrubbed_value(v):
# Try to get the value not scrubbed.
v = self._secrets.get(k)
if self._is_scrubbed_value(v) or self._is_user_input_value(v):
# Can't find the original value or is <user-input>, raise error.
invalid_secrets.append(k)
continue
encrypt_secrets[k] = encrypt_secret_value(v)
if invalid_secrets:
raise ValidationException(
f"Connection {self.name!r} secrets {invalid_secrets} value invalid, please fill them."
)
return encrypt_secrets
@classmethod
def _load_from_dict(cls, data: Dict, context: Dict, additional_message: str = None, **kwargs):
schema_cls = cls._get_schema_cls()
try:
loaded_data = schema_cls(context=context).load(data, **kwargs)
except Exception as e:
raise SDKError(f"Load connection failed with {str(e)}. f{(additional_message or '')}.")
return cls(base_path=context[BASE_PATH_CONTEXT_KEY], **loaded_data)
def _to_dict(self) -> Dict:
schema_cls = self._get_schema_cls()
return schema_cls(context={BASE_PATH_CONTEXT_KEY: "./"}).dump(self)
@classmethod
# pylint: disable=unused-argument
def _resolve_cls_and_type(cls, data, params_override=None):
type_in_override = find_type_in_override(params_override)
type_str = type_in_override or data.get("type")
if type_str is None:
raise ValidationException("type is required for connection.")
type_str = cls._casting_type(type_str)
type_cls = _supported_types.get(type_str)
if type_cls is None:
raise ValidationException(
f"connection_type {type_str!r} is not supported. Supported types are: {list(_supported_types.keys())}"
)
return type_cls, type_str
@abc.abstractmethod
def _to_orm_object(self) -> ORMConnection:
pass
@classmethod
def _from_mt_rest_object(cls, mt_rest_obj) -> "_Connection":
type_cls, _ = cls._resolve_cls_and_type(data={"type": mt_rest_obj.connection_type})
obj = type_cls._from_mt_rest_object(mt_rest_obj)
return obj
@classmethod
def _from_orm_object_with_secrets(cls, orm_object: ORMConnection):
# !!! Attention !!!: Do not use this function to user facing api, use _from_orm_object to remove secrets.
type_cls, _ = cls._resolve_cls_and_type(data={"type": orm_object.connectionType})
obj = type_cls._from_orm_object_with_secrets(orm_object)
return obj
@classmethod
def _from_orm_object(cls, orm_object: ORMConnection):
"""This function will create a connection object then scrub secrets."""
type_cls, _ = cls._resolve_cls_and_type(data={"type": orm_object.connectionType})
obj = type_cls._from_orm_object_with_secrets(orm_object)
# Note: we may can't get secret keys for custom connection from MT
obj.secrets = {k: SCRUBBED_VALUE for k in obj.secrets}
return obj
@classmethod
def _load(
cls,
data: Dict = None,
yaml_path: Union[PathLike, str] = None,
params_override: list = None,
**kwargs,
) -> "_Connection":
"""Load a job object from a yaml file.
:param cls: Indicates that this is a class method.
:type cls: class
:param data: Data Dictionary, defaults to None
:type data: Dict, optional
:param yaml_path: YAML Path, defaults to None
:type yaml_path: Union[PathLike, str], optional
:param params_override: Fields to overwrite on top of the yaml file.
Format is [{"field1": "value1"}, {"field2": "value2"}], defaults to None
:type params_override: List[Dict], optional
:param kwargs: A dictionary of additional configuration parameters.
:type kwargs: dict
:raises Exception: An exception
:return: Loaded job object.
:rtype: Job
"""
data = data or {}
params_override = params_override or []
context = {
BASE_PATH_CONTEXT_KEY: Path(yaml_path).parent if yaml_path else Path("../../azure/_entities/"),
PARAMS_OVERRIDE_KEY: params_override,
}
connection_type, type_str = cls._resolve_cls_and_type(data, params_override)
connection = connection_type._load_from_dict(
data=data,
context=context,
additional_message=f"If you are trying to configure a job that is not of type {type_str}, please specify "
f"the correct connection type in the 'type' property.",
**kwargs,
)
return connection
def _to_execution_connection_dict(self) -> dict:
value = {**self.configs, **self.secrets}
secret_keys = list(self.secrets.keys())
return {
"type": self.class_name, # Required class name for connection in executor
"module": self.module,
"value": {k: v for k, v in value.items() if v is not None}, # Filter None value out
"secret_keys": secret_keys,
}
@classmethod
def _from_execution_connection_dict(cls, name, data) -> "_Connection":
type_cls, _ = cls._resolve_cls_and_type(data={"type": data.get("type")[: -len("Connection")]})
value_dict = data.get("value", {})
if type_cls == CustomConnection:
secrets = {k: v for k, v in value_dict.items() if k in data.get("secret_keys", [])}
configs = {k: v for k, v in value_dict.items() if k not in secrets}
return CustomConnection(name=name, configs=configs, secrets=secrets)
return type_cls(name=name, **value_dict)
def _get_scrubbed_secrets(self):
"""Return the scrubbed secrets of connection."""
return {key: val for key, val in self.secrets.items() if self._is_scrubbed_value(val)}
class _StrongTypeConnection(_Connection):
def _to_orm_object(self):
# Both keys & secrets will be stored in configs for strong type connection.
secrets = self._validate_and_encrypt_secrets()
return ORMConnection(
connectionName=self.name,
connectionType=self.type.value,
configs=json.dumps({**self.configs, **secrets}),
customConfigs="{}",
expiryTime=self.expiry_time,
createdDate=self.created_date,
lastModifiedDate=self.last_modified_date,
)
@classmethod
def _from_orm_object_with_secrets(cls, orm_object: ORMConnection):
# !!! Attention !!!: Do not use this function to user facing api, use _from_orm_object to remove secrets.
# Both keys & secrets will be stored in configs for strong type connection.
type_cls, _ = cls._resolve_cls_and_type(data={"type": orm_object.connectionType})
obj = type_cls(
name=orm_object.connectionName,
expiry_time=orm_object.expiryTime,
created_date=orm_object.createdDate,
last_modified_date=orm_object.lastModifiedDate,
**json.loads(orm_object.configs),
)
obj.secrets = {k: decrypt_secret_value(obj.name, v) for k, v in obj.secrets.items()}
obj._secrets = {**obj.secrets}
return obj
@classmethod
def _from_mt_rest_object(cls, mt_rest_obj):
type_cls, _ = cls._resolve_cls_and_type(data={"type": mt_rest_obj.connection_type})
configs = mt_rest_obj.configs or {}
# For not ARM strong type connection, e.g. OpenAI, api_key will not be returned, but is required argument.
# For ARM strong type connection, api_key will be None and missing when conn._to_dict(), so set a scrubbed one.
configs.update({"api_key": SCRUBBED_VALUE})
obj = type_cls(
name=mt_rest_obj.connection_name,
expiry_time=mt_rest_obj.expiry_time,
created_date=mt_rest_obj.created_date,
last_modified_date=mt_rest_obj.last_modified_date,
**configs,
)
return obj
@property
def api_key(self):
"""Return the api key."""
return self.secrets.get("api_key", SCRUBBED_VALUE)
@api_key.setter
def api_key(self, value):
"""Set the api key."""
self.secrets["api_key"] = value
class AzureOpenAIConnection(_StrongTypeConnection):
"""Azure Open AI connection.
:param api_key: The api key.
:type api_key: str
:param api_base: The api base.
:type api_base: str
:param api_type: The api type, default "azure".
:type api_type: str
:param api_version: The api version, default "2023-07-01-preview".
:type api_version: str
:param token_provider: The token provider.
:type token_provider: promptflow._core.token_provider.TokenProviderABC
:param name: Connection name.
:type name: str
"""
TYPE = ConnectionType.AZURE_OPEN_AI
def __init__(
self,
api_key: str,
api_base: str,
api_type: str = "azure",
api_version: str = "2023-07-01-preview",
token_provider: TokenProviderABC = None,
**kwargs,
):
configs = {"api_base": api_base, "api_type": api_type, "api_version": api_version}
secrets = {"api_key": api_key}
self._token_provider = token_provider
super().__init__(configs=configs, secrets=secrets, **kwargs)
@classmethod
def _get_schema_cls(cls):
return AzureOpenAIConnectionSchema
@property
def api_base(self):
"""Return the connection api base."""
return self.configs.get("api_base")
@api_base.setter
def api_base(self, value):
"""Set the connection api base."""
self.configs["api_base"] = value
@property
def api_type(self):
"""Return the connection api type."""
return self.configs.get("api_type")
@api_type.setter
def api_type(self, value):
"""Set the connection api type."""
self.configs["api_type"] = value
@property
def api_version(self):
"""Return the connection api version."""
return self.configs.get("api_version")
@api_version.setter
def api_version(self, value):
"""Set the connection api version."""
self.configs["api_version"] = value
def get_token(self):
"""Return the connection token."""
if not self._token_provider:
self._token_provider = AzureTokenProvider()
return self._token_provider.get_token()
class OpenAIConnection(_StrongTypeConnection):
"""Open AI connection.
:param api_key: The api key.
:type api_key: str
:param organization: Optional. The unique identifier for your organization which can be used in API requests.
:type organization: str
:param base_url: Optional. Specify when use customized api base, leave None to use open ai default api base.
:type base_url: str
:param name: Connection name.
:type name: str
"""
TYPE = ConnectionType.OPEN_AI
def __init__(self, api_key: str, organization: str = None, base_url=None, **kwargs):
if base_url == "":
# Keep empty as None to avoid disturbing openai pick the default api base.
base_url = None
configs = {"organization": organization, "base_url": base_url}
secrets = {"api_key": api_key}
super().__init__(configs=configs, secrets=secrets, **kwargs)
@classmethod
def _get_schema_cls(cls):
return OpenAIConnectionSchema
@property
def organization(self):
"""Return the connection organization."""
return self.configs.get("organization")
@organization.setter
def organization(self, value):
"""Set the connection organization."""
self.configs["organization"] = value
@property
def base_url(self):
"""Return the connection api base."""
return self.configs.get("base_url")
@base_url.setter
def base_url(self, value):
"""Set the connection api base."""
self.configs["base_url"] = value
class SerpConnection(_StrongTypeConnection):
"""Serp connection.
:param api_key: The api key.
:type api_key: str
:param name: Connection name.
:type name: str
"""
TYPE = ConnectionType.SERP
def __init__(self, api_key: str, **kwargs):
secrets = {"api_key": api_key}
super().__init__(secrets=secrets, **kwargs)
@classmethod
def _get_schema_cls(cls):
return SerpConnectionSchema
class _EmbeddingStoreConnection(_StrongTypeConnection):
TYPE = ConnectionType._NOT_SET
def __init__(self, api_key: str, api_base: str, **kwargs):
configs = {"api_base": api_base}
secrets = {"api_key": api_key}
super().__init__(module="promptflow_vectordb.connections", configs=configs, secrets=secrets, **kwargs)
@property
def api_base(self):
return self.configs.get("api_base")
@api_base.setter
def api_base(self, value):
self.configs["api_base"] = value
class QdrantConnection(_EmbeddingStoreConnection):
"""Qdrant connection.
:param api_key: The api key.
:type api_key: str
:param api_base: The api base.
:type api_base: str
:param name: Connection name.
:type name: str
"""
TYPE = ConnectionType.QDRANT
@classmethod
def _get_schema_cls(cls):
return QdrantConnectionSchema
class WeaviateConnection(_EmbeddingStoreConnection):
"""Weaviate connection.
:param api_key: The api key.
:type api_key: str
:param api_base: The api base.
:type api_base: str
:param name: Connection name.
:type name: str
"""
TYPE = ConnectionType.WEAVIATE
@classmethod
def _get_schema_cls(cls):
return WeaviateConnectionSchema
class CognitiveSearchConnection(_StrongTypeConnection):
"""Cognitive Search connection.
:param api_key: The api key.
:type api_key: str
:param api_base: The api base.
:type api_base: str
:param api_version: The api version, default "2023-07-01-Preview".
:type api_version: str
:param name: Connection name.
:type name: str
"""
TYPE = ConnectionType.COGNITIVE_SEARCH
def __init__(self, api_key: str, api_base: str, api_version: str = "2023-07-01-Preview", **kwargs):
configs = {"api_base": api_base, "api_version": api_version}
secrets = {"api_key": api_key}
super().__init__(configs=configs, secrets=secrets, **kwargs)
@classmethod
def _get_schema_cls(cls):
return CognitiveSearchConnectionSchema
@property
def api_base(self):
"""Return the connection api base."""
return self.configs.get("api_base")
@api_base.setter
def api_base(self, value):
"""Set the connection api base."""
self.configs["api_base"] = value
@property
def api_version(self):
"""Return the connection api version."""
return self.configs.get("api_version")
@api_version.setter
def api_version(self, value):
"""Set the connection api version."""
self.configs["api_version"] = value
class AzureContentSafetyConnection(_StrongTypeConnection):
"""Azure Content Safety connection.
:param api_key: The api key.
:type api_key: str
:param endpoint: The api endpoint.
:type endpoint: str
:param api_version: The api version, default "2023-04-30-preview".
:type api_version: str
:param api_type: The api type, default "Content Safety".
:type api_type: str
:param name: Connection name.
:type name: str
"""
TYPE = ConnectionType.AZURE_CONTENT_SAFETY
def __init__(
self,
api_key: str,
endpoint: str,
api_version: str = "2023-10-01",
api_type: str = "Content Safety",
**kwargs,
):
configs = {"endpoint": endpoint, "api_version": api_version, "api_type": api_type}
secrets = {"api_key": api_key}
super().__init__(configs=configs, secrets=secrets, **kwargs)
@classmethod
def _get_schema_cls(cls):
return AzureContentSafetyConnectionSchema
@property
def endpoint(self):
"""Return the connection endpoint."""
return self.configs.get("endpoint")
@endpoint.setter
def endpoint(self, value):
"""Set the connection endpoint."""
self.configs["endpoint"] = value
@property
def api_version(self):
"""Return the connection api version."""
return self.configs.get("api_version")
@api_version.setter
def api_version(self, value):
"""Set the connection api version."""
self.configs["api_version"] = value
@property
def api_type(self):
"""Return the connection api type."""
return self.configs.get("api_type")
@api_type.setter
def api_type(self, value):
"""Set the connection api type."""
self.configs["api_type"] = value
class FormRecognizerConnection(AzureContentSafetyConnection):
"""Form Recognizer connection.
:param api_key: The api key.
:type api_key: str
:param endpoint: The api endpoint.
:type endpoint: str
:param api_version: The api version, default "2023-07-31".
:type api_version: str
:param api_type: The api type, default "Form Recognizer".
:type api_type: str
:param name: Connection name.
:type name: str
"""
# Note: FormRecognizer and ContentSafety are using CognitiveService type in ARM, so keys are the same.
TYPE = ConnectionType.FORM_RECOGNIZER
def __init__(
self, api_key: str, endpoint: str, api_version: str = "2023-07-31", api_type: str = "Form Recognizer", **kwargs
):
super().__init__(api_key=api_key, endpoint=endpoint, api_version=api_version, api_type=api_type, **kwargs)
@classmethod
def _get_schema_cls(cls):
return FormRecognizerConnectionSchema
class CustomStrongTypeConnection(_Connection):
"""Custom strong type connection.
.. note::
This connection type should not be used directly. Below is an example of how to use CustomStrongTypeConnection:
.. code-block:: python
class MyCustomConnection(CustomStrongTypeConnection):
api_key: Secret
api_base: str
:param configs: The configs kv pairs.
:type configs: Dict[str, str]
:param secrets: The secrets kv pairs.
:type secrets: Dict[str, str]
:param name: Connection name
:type name: str
"""
def __init__(
self,
secrets: Dict[str, str],
configs: Dict[str, str] = None,
**kwargs,
):
# There are two cases to init a Custom strong type connection:
# 1. The connection is created through SDK PFClient, custom_type and custom_module are not in the kwargs.
# 2. The connection is loaded from template file, custom_type and custom_module are in the kwargs.
custom_type = kwargs.get(CustomStrongTypeConnectionConfigs.TYPE, None)
custom_module = kwargs.get(CustomStrongTypeConnectionConfigs.MODULE, None)
if custom_type:
configs.update({CustomStrongTypeConnectionConfigs.PROMPTFLOW_TYPE_KEY: custom_type})
if custom_module:
configs.update({CustomStrongTypeConnectionConfigs.PROMPTFLOW_MODULE_KEY: custom_module})
self.kwargs = kwargs
super().__init__(configs=configs, secrets=secrets, **kwargs)
self.module = kwargs.get("module", self.__class__.__module__)
self.custom_type = custom_type or self.__class__.__name__
self.package = kwargs.get(CustomStrongTypeConnectionConfigs.PACKAGE, None)
self.package_version = kwargs.get(CustomStrongTypeConnectionConfigs.PACKAGE_VERSION, None)
def __getattribute__(self, item):
# Note: The reason to overwrite __getattribute__ instead of __getattr__ is as follows:
# Custom strong type connection is written this way:
# class MyCustomConnection(CustomStrongTypeConnection):
# api_key: Secret
# api_base: str = "This is a default value"
# api_base has a default value, my_custom_connection_instance.api_base would not trigger __getattr__.
# The default value will be returned directly instead of the real value in configs.
annotations = getattr(super().__getattribute__("__class__"), "__annotations__", {})
if item in annotations:
if annotations[item] == Secret:
return self.secrets[item]
else:
return self.configs[item]
return super().__getattribute__(item)
def __setattr__(self, key, value):
annotations = getattr(super().__getattribute__("__class__"), "__annotations__", {})
if key in annotations:
if annotations[key] == Secret:
self.secrets[key] = value
else:
self.configs[key] = value
return super().__setattr__(key, value)
def _to_orm_object(self) -> ORMConnection:
custom_connection = self._convert_to_custom()
return custom_connection._to_orm_object()
def _convert_to_custom(self):
# update configs
self.configs.update({CustomStrongTypeConnectionConfigs.PROMPTFLOW_TYPE_KEY: self.custom_type})
self.configs.update({CustomStrongTypeConnectionConfigs.PROMPTFLOW_MODULE_KEY: self.module})
if self.package and self.package_version:
self.configs.update({CustomStrongTypeConnectionConfigs.PROMPTFLOW_PACKAGE_KEY: self.package})
self.configs.update(
{CustomStrongTypeConnectionConfigs.PROMPTFLOW_PACKAGE_VERSION_KEY: self.package_version}
)
custom_connection = CustomConnection(configs=self.configs, secrets=self.secrets, **self.kwargs)
return custom_connection
@classmethod
def _get_custom_keys(cls, data: Dict):
# The data could be either from yaml or from DB.
# If from yaml, 'custom_type' and 'module' are outside the configs of data.
# If from DB, 'custom_type' and 'module' are within the configs of data.
if not data.get(CustomStrongTypeConnectionConfigs.TYPE) or not data.get(
CustomStrongTypeConnectionConfigs.MODULE
):
if (
not data["configs"][CustomStrongTypeConnectionConfigs.PROMPTFLOW_TYPE_KEY]
or not data["configs"][CustomStrongTypeConnectionConfigs.PROMPTFLOW_MODULE_KEY]
):
error = ValueError("custom_type and module are required for custom strong type connections.")
raise UserErrorException(message=str(error), error=error)
else:
m = data["configs"][CustomStrongTypeConnectionConfigs.PROMPTFLOW_MODULE_KEY]
custom_cls = data["configs"][CustomStrongTypeConnectionConfigs.PROMPTFLOW_TYPE_KEY]
else:
m = data[CustomStrongTypeConnectionConfigs.MODULE]
custom_cls = data[CustomStrongTypeConnectionConfigs.TYPE]
try:
module = importlib.import_module(m)
cls = getattr(module, custom_cls)
except ImportError:
error = ValueError(
f"Can't find module {m} in current environment. Please check the module is correctly configured."
)
raise UserErrorException(message=str(error), error=error)
except AttributeError:
error = ValueError(
f"Can't find class {custom_cls} in module {m}. "
f"Please check the custom_type is correctly configured."
)
raise UserErrorException(message=str(error), error=error)
schema_configs = {}
schema_secrets = {}
for k, v in cls.__annotations__.items():
if v == Secret:
schema_secrets[k] = v
else:
schema_configs[k] = v
return schema_configs, schema_secrets
@classmethod
def _get_schema_cls(cls):
return CustomStrongTypeConnectionSchema
@classmethod
def _load_from_dict(cls, data: Dict, context: Dict, additional_message: str = None, **kwargs):
schema_config_keys, schema_secret_keys = cls._get_custom_keys(data)
context[SCHEMA_KEYS_CONTEXT_CONFIG_KEY] = schema_config_keys
context[SCHEMA_KEYS_CONTEXT_SECRET_KEY] = schema_secret_keys
return (super()._load_from_dict(data, context, additional_message, **kwargs))._convert_to_custom()
class CustomConnection(_Connection):
"""Custom connection.
:param configs: The configs kv pairs.
:type configs: Dict[str, str]
:param secrets: The secrets kv pairs.
:type secrets: Dict[str, str]
:param name: Connection name
:type name: str
"""
TYPE = ConnectionType.CUSTOM
def __init__(
self,
secrets: Dict[str, str],
configs: Dict[str, str] = None,
**kwargs,
):
super().__init__(secrets=secrets, configs=configs, **kwargs)
@classmethod
def _get_schema_cls(cls):
return CustomConnectionSchema
@classmethod
def _load_from_dict(cls, data: Dict, context: Dict, additional_message: str = None, **kwargs):
# If context has params_override, it means the data would be updated by overridden values.
# Provide CustomStrongTypeConnectionSchema if 'custom_type' in params_override, else CustomConnectionSchema.
# For example:
# If a user updates an existing connection by re-upserting a connection file,
# the 'data' from DB is CustomConnection,
# but 'params_override' would actually contain custom strong type connection data.
is_custom_strong_type = data.get(CustomStrongTypeConnectionConfigs.TYPE) or any(
CustomStrongTypeConnectionConfigs.TYPE in d for d in context.get(PARAMS_OVERRIDE_KEY, [])
)
if is_custom_strong_type:
return CustomStrongTypeConnection._load_from_dict(data, context, additional_message, **kwargs)
return super()._load_from_dict(data, context, additional_message, **kwargs)
def __getattr__(self, item):
# Note: This is added for compatibility with promptflow.connections custom connection usage.
if item == "secrets":
# Usually obj.secrets will not reach here
# This is added to handle copy.deepcopy loop issue
return super().__getattribute__("secrets")
if item == "configs":
# Usually obj.configs will not reach here
# This is added to handle copy.deepcopy loop issue
return super().__getattribute__("configs")
if item in self.secrets:
logger.warning("Please use connection.secrets[key] to access secrets.")
return self.secrets[item]
if item in self.configs:
logger.warning("Please use connection.configs[key] to access configs.")
return self.configs[item]
return super().__getattribute__(item)
def is_secret(self, item):
"""Check if item is a secret."""
# Note: This is added for compatibility with promptflow.connections custom connection usage.
return item in self.secrets
def _to_orm_object(self):
# Both keys & secrets will be set in custom configs with value type specified for custom connection.
if not self.secrets:
error = ValueError(
"Secrets is required for custom connection, "
"please use CustomConnection(configs={key1: val1}, secrets={key2: val2}) "
"to initialize custom connection."
)
raise UserErrorException(message=str(error), error=error)
custom_configs = {
k: {"configValueType": ConfigValueType.STRING.value, "value": v} for k, v in self.configs.items()
}
encrypted_secrets = self._validate_and_encrypt_secrets()
custom_configs.update(
{k: {"configValueType": ConfigValueType.SECRET.value, "value": v} for k, v in encrypted_secrets.items()}
)
return ORMConnection(
connectionName=self.name,
connectionType=self.type.value,
configs="{}",
customConfigs=json.dumps(custom_configs),
expiryTime=self.expiry_time,
createdDate=self.created_date,
lastModifiedDate=self.last_modified_date,
)
@classmethod
def _from_orm_object_with_secrets(cls, orm_object: ORMConnection):
# !!! Attention !!!: Do not use this function to user facing api, use _from_orm_object to remove secrets.
# Both keys & secrets will be set in custom configs with value type specified for custom connection.
configs = {
k: v["value"]
for k, v in json.loads(orm_object.customConfigs).items()
if v["configValueType"] == ConfigValueType.STRING.value
}
secrets = {}
unsecure_connection = False
custom_type = None
for k, v in json.loads(orm_object.customConfigs).items():
if k == CustomStrongTypeConnectionConfigs.PROMPTFLOW_TYPE_KEY:
custom_type = v["value"]
continue
if not v["configValueType"] == ConfigValueType.SECRET.value:
continue
try:
secrets[k] = decrypt_secret_value(orm_object.connectionName, v["value"])
except UnsecureConnectionError:
# This is to workaround old custom secrets that are not encrypted with Fernet.
unsecure_connection = True
secrets[k] = v["value"]
if unsecure_connection:
print_yellow_warning(
f"Warning: Please delete and re-create connection {orm_object.connectionName} "
"due to a security issue in the old sdk version."
)
return cls(
name=orm_object.connectionName,
configs=configs,
secrets=secrets,
custom_type=custom_type,
expiry_time=orm_object.expiryTime,
created_date=orm_object.createdDate,
last_modified_date=orm_object.lastModifiedDate,
)
@classmethod
def _from_mt_rest_object(cls, mt_rest_obj):
type_cls, _ = cls._resolve_cls_and_type(data={"type": mt_rest_obj.connection_type})
if not mt_rest_obj.custom_configs:
mt_rest_obj.custom_configs = {}
configs = {
k: v.value
for k, v in mt_rest_obj.custom_configs.items()
if v.config_value_type == ConfigValueType.STRING.value
}
secrets = {
k: v.value
for k, v in mt_rest_obj.custom_configs.items()
if v.config_value_type == ConfigValueType.SECRET.value
}
return cls(
name=mt_rest_obj.connection_name,
configs=configs,
secrets=secrets,
expiry_time=mt_rest_obj.expiry_time,
created_date=mt_rest_obj.created_date,
last_modified_date=mt_rest_obj.last_modified_date,
)
def _is_custom_strong_type(self):
return (
CustomStrongTypeConnectionConfigs.PROMPTFLOW_TYPE_KEY in self.configs
and self.configs[CustomStrongTypeConnectionConfigs.PROMPTFLOW_TYPE_KEY]
)
def _convert_to_custom_strong_type(self, module=None, to_class=None) -> CustomStrongTypeConnection:
# There are two scenarios to convert a custom connection to custom strong type connection:
# 1. The connection is created from a custom strong type connection template file.
# Custom type and module name are present in the configs.
# 2. The connection is created through SDK PFClient or a custom connection template file.
# Custom type and module name are not present in the configs. Module and class must be passed for conversion.
if to_class == self.__class__.__name__:
# No need to convert.
return self
import importlib
if (
CustomStrongTypeConnectionConfigs.PROMPTFLOW_MODULE_KEY in self.configs
and CustomStrongTypeConnectionConfigs.PROMPTFLOW_TYPE_KEY in self.configs
):
module_name = self.configs.get(CustomStrongTypeConnectionConfigs.PROMPTFLOW_MODULE_KEY)
module = importlib.import_module(module_name)
custom_conn_name = self.configs.get(CustomStrongTypeConnectionConfigs.PROMPTFLOW_TYPE_KEY)
elif isinstance(module, str) and isinstance(to_class, str):
module_name = module
module = importlib.import_module(module_name)
custom_conn_name = to_class
elif isinstance(module, types.ModuleType) and isinstance(to_class, str):
custom_conn_name = to_class
else:
error = ValueError(
f"Failed to convert to custom strong type connection because of "
f"invalid module or class: {module}, {to_class}"
)
raise UserErrorException(message=str(error), error=error)
custom_defined_connection_class = getattr(module, custom_conn_name)
connection_instance = custom_defined_connection_class(configs=self.configs, secrets=self.secrets)
return connection_instance
_supported_types = {
v.TYPE.value: v
for v in globals().values()
if isinstance(v, type) and issubclass(v, _Connection) and not v.__name__.startswith("_")
}
| promptflow/src/promptflow/promptflow/_sdk/entities/_connection.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_sdk/entities/_connection.py",
"repo_id": "promptflow",
"token_count": 16239
} | 37 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import copy
import datetime
import json
import logging
import shutil
from dataclasses import asdict, dataclass
from functools import partial
from pathlib import Path
from typing import Any, Dict, List, NewType, Optional, Tuple, Union
from filelock import FileLock
from promptflow import load_flow
from promptflow._sdk._constants import (
HOME_PROMPT_FLOW_DIR,
LINE_NUMBER,
LOCAL_STORAGE_BATCH_SIZE,
PROMPT_FLOW_DIR_NAME,
LocalStorageFilenames,
RunInfoSources,
)
from promptflow._sdk._errors import BulkRunException, InvalidRunError
from promptflow._sdk._utils import (
PromptflowIgnoreFile,
generate_flow_tools_json,
json_dump,
json_load,
pd_read_json,
read_open,
write_open,
)
from promptflow._sdk.entities import Run
from promptflow._sdk.entities._eager_flow import EagerFlow
from promptflow._sdk.entities._flow import Flow
from promptflow._utils.dataclass_serializer import serialize
from promptflow._utils.exception_utils import PromptflowExceptionPresenter
from promptflow._utils.logger_utils import LogContext, get_cli_sdk_logger
from promptflow._utils.multimedia_utils import get_file_reference_encoder
from promptflow._utils.yaml_utils import load_yaml
from promptflow.batch._result import BatchResult
from promptflow.contracts.multimedia import Image
from promptflow.contracts.run_info import FlowRunInfo
from promptflow.contracts.run_info import RunInfo as NodeRunInfo
from promptflow.contracts.run_info import Status
from promptflow.contracts.run_mode import RunMode
from promptflow.exceptions import UserErrorException
from promptflow.storage import AbstractRunStorage
logger = get_cli_sdk_logger()
RunInputs = NewType("RunInputs", Dict[str, List[Any]])
RunOutputs = NewType("RunOutputs", Dict[str, List[Any]])
RunMetrics = NewType("RunMetrics", Dict[str, Any])
@dataclass
class LoggerOperations(LogContext):
stream: bool = False
@property
def log_path(self) -> str:
return str(self.file_path)
def get_logs(self) -> str:
with read_open(self.file_path) as f:
return f.read()
def _get_execute_loggers_list(cls) -> List[logging.Logger]:
result = super()._get_execute_loggers_list()
result.append(logger)
return result
def get_initializer(self):
return partial(
LoggerOperations,
file_path=self.file_path,
run_mode=self.run_mode,
credential_list=self.credential_list,
stream=self.stream,
)
def __enter__(self):
log_path = Path(self.log_path)
log_path.parent.mkdir(parents=True, exist_ok=True)
if self.run_mode == RunMode.Batch:
log_path.touch(exist_ok=True)
else:
if log_path.exists():
# for non batch run, clean up previous log content
try:
with write_open(log_path) as file:
file.truncate(0)
except Exception as e:
logger.warning(f"Failed to clean up the previous log content because {e}")
else:
log_path.touch()
for _logger in self._get_execute_loggers_list():
for handler in _logger.handlers:
if self.stream is False and isinstance(handler, logging.StreamHandler):
handler.setLevel(logging.CRITICAL)
super().__enter__()
def __exit__(self, *args):
super().__exit__(*args)
for _logger in self._get_execute_loggers_list():
for handler in _logger.handlers:
if self.stream is False and isinstance(handler, logging.StreamHandler):
handler.setLevel(logging.CRITICAL)
@dataclass
class NodeRunRecord:
NodeName: str
line_number: int
run_info: str
start_time: datetime
end_time: datetime
status: str
@staticmethod
def from_run_info(node_run_info: NodeRunInfo) -> "NodeRunRecord":
return NodeRunRecord(
NodeName=node_run_info.node,
line_number=node_run_info.index,
run_info=serialize(node_run_info),
start_time=node_run_info.start_time.isoformat(),
end_time=node_run_info.end_time.isoformat(),
status=node_run_info.status.value,
)
def dump(self, path: Path, run_name: str) -> None:
# for nodes in first line run and all reduce nodes, the target filename is 000000000.jsonl
# so we need to handle concurrent write with file lock
filename_need_lock = "0".zfill(LocalStorageOperations.LINE_NUMBER_WIDTH) + ".jsonl"
if path.name == filename_need_lock:
file_lock_path = (HOME_PROMPT_FLOW_DIR / f"{run_name}.{self.NodeName}.lock").resolve()
lock = FileLock(file_lock_path)
lock.acquire()
try:
json_dump(asdict(self), path)
finally:
lock.release()
else:
# for normal nodes in other line runs, directly write
json_dump(asdict(self), path)
@dataclass
class LineRunRecord:
line_number: int
run_info: str
start_time: datetime.datetime
end_time: datetime.datetime
name: str
description: str
status: str
tags: str
@staticmethod
def from_flow_run_info(flow_run_info: FlowRunInfo) -> "LineRunRecord":
return LineRunRecord(
line_number=flow_run_info.index,
run_info=serialize(flow_run_info),
start_time=flow_run_info.start_time.isoformat(),
end_time=flow_run_info.end_time.isoformat(),
name=flow_run_info.name,
description=flow_run_info.description,
status=flow_run_info.status.value,
tags=flow_run_info.tags,
)
def dump(self, path: Path) -> None:
json_dump(asdict(self), path)
class LocalStorageOperations(AbstractRunStorage):
"""LocalStorageOperations."""
LINE_NUMBER_WIDTH = 9
def __init__(self, run: Run, stream=False, run_mode=RunMode.Test):
self._run = run
self.path = self._prepare_folder(self._run._output_path)
self.logger = LoggerOperations(
file_path=self.path / LocalStorageFilenames.LOG, stream=stream, run_mode=run_mode
)
# snapshot
self._snapshot_folder_path = self._prepare_folder(self.path / LocalStorageFilenames.SNAPSHOT_FOLDER)
self._dag_path = self._snapshot_folder_path / LocalStorageFilenames.DAG
self._flow_tools_json_path = (
self._snapshot_folder_path / PROMPT_FLOW_DIR_NAME / LocalStorageFilenames.FLOW_TOOLS_JSON
)
self._inputs_path = self.path / LocalStorageFilenames.INPUTS # keep this for other usages
# below inputs and outputs are dumped by SDK
self._sdk_inputs_path = self._inputs_path
self._sdk_output_path = self.path / LocalStorageFilenames.OUTPUTS
# metrics
self._metrics_path = self.path / LocalStorageFilenames.METRICS
# legacy files: detail.json and outputs.jsonl(not the one in flow_outputs folder)
self._detail_path = self.path / LocalStorageFilenames.DETAIL
self._legacy_outputs_path = self.path / LocalStorageFilenames.OUTPUTS
# for line run records, store per line
# for normal node run records, store per node per line;
# for reduce node run records, store centralized in 000000000.jsonl per node
self.outputs_folder = self._prepare_folder(self.path / "flow_outputs")
self._outputs_path = self.outputs_folder / "output.jsonl" # dumped by executor
self._node_infos_folder = self._prepare_folder(self.path / "node_artifacts")
self._run_infos_folder = self._prepare_folder(self.path / "flow_artifacts")
self._data_path = Path(run.data) if run.data is not None else None
self._meta_path = self.path / LocalStorageFilenames.META
self._exception_path = self.path / LocalStorageFilenames.EXCEPTION
self._dump_meta_file()
self._eager_mode = self._calculate_eager_mode(run)
@property
def eager_mode(self) -> bool:
return self._eager_mode
@classmethod
def _calculate_eager_mode(cls, run: Run) -> bool:
if run._run_source == RunInfoSources.LOCAL:
try:
flow_obj = load_flow(source=run.flow)
return isinstance(flow_obj, EagerFlow)
except Exception as e:
# For run with incomplete flow snapshot, ignore load flow error to make sure it can still show.
logger.debug(f"Failed to load flow from {run.flow} due to {e}.")
return False
elif run._run_source in [RunInfoSources.INDEX_SERVICE, RunInfoSources.RUN_HISTORY]:
return run._properties.get("azureml.promptflow.run_mode") == "Eager"
# TODO(2901279): support eager mode for run created from run folder
return False
def delete(self) -> None:
def on_rmtree_error(func, path, exc_info):
raise InvalidRunError(f"Failed to delete run {self.path} due to {exc_info[1]}.")
shutil.rmtree(path=self.path, onerror=on_rmtree_error)
def _dump_meta_file(self) -> None:
json_dump({"batch_size": LOCAL_STORAGE_BATCH_SIZE}, self._meta_path)
def dump_snapshot(self, flow: Flow) -> None:
"""Dump flow directory to snapshot folder, input file will be dumped after the run."""
patterns = [pattern for pattern in PromptflowIgnoreFile.IGNORE_FILE]
# ignore current output parent folder to avoid potential recursive copy
patterns.append(self._run._output_path.parent.name)
shutil.copytree(
flow.code.as_posix(),
self._snapshot_folder_path,
ignore=shutil.ignore_patterns(*patterns),
dirs_exist_ok=True,
)
# replace DAG file with the overwrite one
if not self._eager_mode:
self._dag_path.unlink()
shutil.copy(flow.path, self._dag_path)
def load_dag_as_string(self) -> str:
if self._eager_mode:
return ""
with read_open(self._dag_path) as f:
return f.read()
def load_flow_tools_json(self) -> dict:
if self._eager_mode:
# no tools json for eager mode
return {}
if not self._flow_tools_json_path.is_file():
return generate_flow_tools_json(self._snapshot_folder_path, dump=False)
else:
return json_load(self._flow_tools_json_path)
def load_io_spec(self) -> Tuple[Dict[str, Dict[str, str]], Dict[str, Dict[str, str]]]:
"""Load input/output spec from DAG."""
# TODO(2898455): support eager mode
with read_open(self._dag_path) as f:
flow_dag = load_yaml(f)
return flow_dag["inputs"], flow_dag["outputs"]
def load_inputs(self) -> RunInputs:
df = pd_read_json(self._inputs_path)
return df.to_dict("list")
def load_outputs(self) -> RunOutputs:
# for legacy run, simply read the output file and return as list of dict
if not self._outputs_path.is_file():
df = pd_read_json(self._legacy_outputs_path)
return df.to_dict("list")
df = pd_read_json(self._outputs_path)
if len(df) > 0:
df = df.set_index(LINE_NUMBER)
return df.to_dict("list")
def dump_inputs_and_outputs(self) -> None:
inputs, outputs = self._collect_io_from_debug_info()
with write_open(self._sdk_inputs_path) as f:
inputs.to_json(f, orient="records", lines=True, force_ascii=False)
with write_open(self._sdk_output_path) as f:
outputs.to_json(f, orient="records", lines=True, force_ascii=False)
def dump_metrics(self, metrics: Optional[RunMetrics]) -> None:
metrics = metrics or dict()
json_dump(metrics, self._metrics_path)
def dump_exception(self, exception: Exception, batch_result: BatchResult) -> None:
"""Dump exception to local storage.
:param exception: Exception raised during bulk run.
:param batch_result: Bulk run outputs. If exception not raised, store line run error messages.
"""
# extract line run errors
errors = []
if batch_result:
for line_error in batch_result.error_summary.error_list:
errors.append(line_error.to_dict())
# collect aggregation node error
for node_name, aggr_error in batch_result.error_summary.aggr_error_dict.items():
errors.append({"error": aggr_error, "aggregation_node_name": node_name})
if errors:
try:
# use first line run error message as exception message if no exception raised
error = errors[0]
message = error["error"]["message"]
except Exception:
message = (
"Failed to extract error message from line runs. "
f"Please check {self._outputs_path} for more info."
)
elif exception and isinstance(exception, UserErrorException):
# SystemError will be raised above and users can see it, so we don't need to dump it.
message = str(exception)
else:
return
if not isinstance(exception, BulkRunException):
# If other errors raised, pass it into PromptflowException
exception = BulkRunException(
message=message,
error=exception,
failed_lines=batch_result.failed_lines if batch_result else "unknown",
total_lines=batch_result.total_lines if batch_result else "unknown",
errors={"errors": errors},
)
json_dump(PromptflowExceptionPresenter.create(exception).to_dict(include_debug_info=True), self._exception_path)
def load_exception(self) -> Dict:
try:
return json_load(self._exception_path)
except Exception:
return {}
def load_detail(self, parse_const_as_str: bool = False) -> Dict[str, list]:
if self._detail_path.is_file():
# legacy run with local file detail.json, then directly load from the file
return json_load(self._detail_path)
else:
# nan, inf and -inf are not JSON serializable
# according to https://docs.python.org/3/library/json.html#json.loads
# `parse_constant` will be called to handle these values
# so if parse_const_as_str is True, we will parse these values as str with a lambda function
json_loads = json.loads if not parse_const_as_str else partial(json.loads, parse_constant=lambda x: str(x))
# collect from local files and concat in the memory
flow_runs, node_runs = [], []
for line_run_record_file in sorted(self._run_infos_folder.iterdir()):
# In addition to the output jsonl files, there may be multimedia files in the output folder,
# so we should skip them.
if line_run_record_file.suffix.lower() != ".jsonl":
continue
with read_open(line_run_record_file) as f:
new_runs = [json_loads(line)["run_info"] for line in list(f)]
flow_runs += new_runs
for node_folder in sorted(self._node_infos_folder.iterdir()):
for node_run_record_file in sorted(node_folder.iterdir()):
if node_run_record_file.suffix.lower() != ".jsonl":
continue
with read_open(node_run_record_file) as f:
new_runs = [json_loads(line)["run_info"] for line in list(f)]
node_runs += new_runs
return {"flow_runs": flow_runs, "node_runs": node_runs}
def load_metrics(self) -> Dict[str, Union[int, float, str]]:
return json_load(self._metrics_path)
def persist_node_run(self, run_info: NodeRunInfo) -> None:
"""Persist node run record to local storage."""
node_folder = self._prepare_folder(self._node_infos_folder / run_info.node)
self._persist_run_multimedia(run_info, node_folder)
node_run_record = NodeRunRecord.from_run_info(run_info)
# for reduce nodes, the line_number is None, store the info in the 000000000.jsonl
# align with AzureMLRunStorageV2, which is a storage contract with PFS
line_number = 0 if node_run_record.line_number is None else node_run_record.line_number
filename = f"{str(line_number).zfill(self.LINE_NUMBER_WIDTH)}.jsonl"
node_run_record.dump(node_folder / filename, run_name=self._run.name)
def persist_flow_run(self, run_info: FlowRunInfo) -> None:
"""Persist line run record to local storage."""
if not Status.is_terminated(run_info.status):
logger.info("Line run is not terminated, skip persisting line run record.")
return
self._persist_run_multimedia(run_info, self._run_infos_folder)
line_run_record = LineRunRecord.from_flow_run_info(run_info)
# calculate filename according to the batch size
# note that if batch_size > 1, need to well handle concurrent write scenario
lower_bound = line_run_record.line_number // LOCAL_STORAGE_BATCH_SIZE * LOCAL_STORAGE_BATCH_SIZE
upper_bound = lower_bound + LOCAL_STORAGE_BATCH_SIZE - 1
filename = (
f"{str(lower_bound).zfill(self.LINE_NUMBER_WIDTH)}_"
f"{str(upper_bound).zfill(self.LINE_NUMBER_WIDTH)}.jsonl"
)
line_run_record.dump(self._run_infos_folder / filename)
def persist_result(self, result: Optional[BatchResult]) -> None:
"""Persist metrics from return of executor."""
if result is None:
return
self.dump_inputs_and_outputs()
self.dump_metrics(result.metrics)
def _persist_run_multimedia(self, run_info: Union[FlowRunInfo, NodeRunInfo], folder_path: Path):
if run_info.inputs:
run_info.inputs = self._serialize_multimedia(run_info.inputs, folder_path)
if run_info.output:
run_info.output = self._serialize_multimedia(run_info.output, folder_path)
run_info.result = None
if run_info.api_calls:
run_info.api_calls = self._serialize_multimedia(run_info.api_calls, folder_path)
def _serialize_multimedia(self, value, folder_path: Path, relative_path: Path = None):
pfbytes_file_reference_encoder = get_file_reference_encoder(folder_path, relative_path, use_absolute_path=True)
serialization_funcs = {Image: partial(Image.serialize, **{"encoder": pfbytes_file_reference_encoder})}
return serialize(value, serialization_funcs=serialization_funcs)
@staticmethod
def _prepare_folder(path: Union[str, Path]) -> Path:
path = Path(path)
path.mkdir(parents=True, exist_ok=True)
return path
@staticmethod
def _outputs_padding(df: "DataFrame", inputs_line_numbers: List[int]) -> "DataFrame":
import pandas as pd
if len(df) == len(inputs_line_numbers):
return df
missing_lines = []
lines_set = set(df[LINE_NUMBER].values)
for i in inputs_line_numbers:
if i not in lines_set:
missing_lines.append({LINE_NUMBER: i})
df_to_append = pd.DataFrame(missing_lines)
res = pd.concat([df, df_to_append], ignore_index=True)
res = res.sort_values(by=LINE_NUMBER, ascending=True)
return res
def load_inputs_and_outputs(self) -> Tuple["DataFrame", "DataFrame"]:
if not self._sdk_inputs_path.is_file() or not self._sdk_output_path.is_file():
inputs, outputs = self._collect_io_from_debug_info()
else:
inputs = pd_read_json(self._sdk_inputs_path)
outputs = pd_read_json(self._sdk_output_path)
# if all line runs are failed, no need to fill
if len(outputs) > 0:
outputs = self._outputs_padding(outputs, inputs[LINE_NUMBER].tolist())
outputs.fillna(value="(Failed)", inplace=True) # replace nan with explicit prompt
outputs = outputs.set_index(LINE_NUMBER)
return inputs, outputs
def _collect_io_from_debug_info(self) -> Tuple["DataFrame", "DataFrame"]:
import pandas as pd
inputs, outputs = [], []
for line_run_record_file in sorted(self._run_infos_folder.iterdir()):
if line_run_record_file.suffix.lower() != ".jsonl":
continue
with read_open(line_run_record_file) as f:
datas = [json.loads(line) for line in list(f)]
for data in datas:
line_number: int = data[LINE_NUMBER]
line_run_info: dict = data["run_info"]
current_inputs = line_run_info.get("inputs")
current_outputs = line_run_info.get("output")
inputs.append(copy.deepcopy(current_inputs))
if current_outputs is not None:
current_outputs[LINE_NUMBER] = line_number
outputs.append(copy.deepcopy(current_outputs))
return pd.DataFrame(inputs), pd.DataFrame(outputs)
| promptflow/src/promptflow/promptflow/_sdk/operations/_local_storage_operations.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_sdk/operations/_local_storage_operations.py",
"repo_id": "promptflow",
"token_count": 9375
} | 38 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
from dataclasses import fields, is_dataclass
from datetime import datetime
from enum import Enum
from typing import Any, Callable, Dict, List, Type, TypeVar
from promptflow._core.generator_proxy import GeneratorProxy
from promptflow.contracts.tool import ConnectionType
T = TypeVar("T")
def get_type(obj: type):
if is_dataclass(obj):
return obj
if isinstance(obj, list):
return List[get_type(obj[0])]
if isinstance(obj, dict):
return Dict[str, get_type(obj[list(obj.keys())[0]])]
return obj
def deserialize_dataclass(cls: Type[T], data: dict) -> T:
if not is_dataclass(cls):
raise ValueError(f"{cls} is not a dataclass")
if not isinstance(data, dict):
raise ValueError(f"{data} is not a dict")
kwargs = {}
for field in fields(cls):
if field.name not in data:
kwargs[field.name] = field.default
continue
field_type = get_type(field.type)
kwargs[field.name] = deserialize_value(data[field.name], field_type)
return cls(**kwargs)
def deserialize_value(obj, field_type):
if not isinstance(field_type, type):
return obj
if is_dataclass(field_type):
return deserialize_dataclass(field_type, obj)
if issubclass(field_type, Enum):
return field_type(obj)
if issubclass(field_type, datetime) and obj is not None:
# Remove Z/z at the end of the string.
if obj.endswith("Z") or obj.endswith("z"):
return datetime.fromisoformat(obj[:-1])
return datetime.fromisoformat(obj)
return obj
def serialize(value: object, remove_null: bool = False, serialization_funcs: Dict[type, Callable] = None) -> dict:
if serialization_funcs:
for cls, f in serialization_funcs.items():
if isinstance(value, cls):
return f(value)
if isinstance(value, datetime):
return value.isoformat() + "Z"
if isinstance(value, Enum):
return value.value
if isinstance(value, list):
return [serialize(v, remove_null, serialization_funcs) for v in value]
if isinstance(value, GeneratorProxy):
# TODO: The current implementation of the serialize function is not self-explanatory, as value.items is mutable
# whereas the serialize function should deal with a fixed object. We should rename the function to
# to_serializable to better reflect its purpose.
return value.items
# Note that custom connection check should before dict check
if ConnectionType.is_connection_value(value):
return ConnectionType.serialize_conn(value)
if isinstance(value, dict):
return {k: serialize(v, remove_null, serialization_funcs) for k, v in value.items()}
if is_dataclass(value):
if hasattr(value, "serialize"):
result = value.serialize()
else:
result = {
f.name: serialize(getattr(value, f.name), remove_null, serialization_funcs) for f in fields(value)
}
if not remove_null:
return result
null_keys = [k for k, v in result.items() if v is None]
for k in null_keys:
result.pop(k)
return result
try:
from pydantic import BaseModel
if isinstance(value, BaseModel): # Handle pydantic model, which is used in langchain
return value.dict()
except ImportError:
# Ignore ImportError if pydantic is not installed
pass
return value
def assertEqual(a: dict, b: dict, path: str = ""):
if isinstance(a, dict):
assert isinstance(b, dict), f"{path}: {type(a)} != {type(b)}"
assert set(a.keys()) == set(b.keys()), f"{path}: {set(a.keys())} != {set(b.keys())}"
for key in a.keys():
assertEqual(a[key], b[key], path + "." + key)
elif isinstance(a, list):
assert isinstance(b, list), f"{path}: {type(a)} != {type(b)}"
assert len(a) == len(b), f"{path}: {len(a)} != {len(b)}"
for i in range(len(a)):
assertEqual(a[i], b[i], path + f"[{i}]")
else:
assert a == b, f"{path}: {a} != {b}"
def convert_eager_flow_output_to_dict(value: Any):
"""
Convert the output of eager flow to a dict. Since the output of eager flow
may not be a dict, we need to convert it to a dict in batch mode.
Examples:
1. If the output is a dict, return it directly:
value = {"output": 1} -> {"output": 1}
2. If the output is a dataclass, convert it to a dict:
value = SampleDataClass(output=1) -> {"output": 1}
3. If the output is not a dict or dataclass, convert it to a dict by adding a key "output":
value = 1 -> {"output": 1}
"""
if isinstance(value, dict):
return value
elif is_dataclass(value):
return {f.name: getattr(value, f.name) for f in fields(value)}
else:
return {"output": value}
| promptflow/src/promptflow/promptflow/_utils/dataclass_serializer.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/_utils/dataclass_serializer.py",
"repo_id": "promptflow",
"token_count": 2062
} | 39 |
# coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.8.0, generator: @autorest/[email protected])
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import functools
from typing import Any, Callable, Dict, Generic, Optional, TypeVar
import warnings
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._flows_provider_operations import build_get_index_entity_by_id_request, build_get_updated_entity_ids_for_workspace_request
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class FlowsProviderOperations:
"""FlowsProviderOperations async operations.
You should not instantiate this class directly. Instead, you should create a Client instance that
instantiates it for you and attaches it as an attribute.
:ivar models: Alias to model classes used in this operation group.
:type models: ~flow.models
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
"""
models = _models
def __init__(self, client, config, serializer, deserializer) -> None:
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self._config = config
@distributed_trace_async
async def get_index_entity_by_id(
self,
subscription_id: str,
resource_group_name: str,
workspace_name: str,
body: Optional["_models.UnversionedEntityRequestDto"] = None,
**kwargs: Any
) -> "_models.UnversionedEntityResponseDto":
"""get_index_entity_by_id.
:param subscription_id: The Azure Subscription ID.
:type subscription_id: str
:param resource_group_name: The Name of the resource group in which the workspace is located.
:type resource_group_name: str
:param workspace_name: The name of the workspace.
:type workspace_name: str
:param body:
:type body: ~flow.models.UnversionedEntityRequestDto
:keyword callable cls: A custom type or function that will be passed the direct response
:return: UnversionedEntityResponseDto, or the result of cls(response)
:rtype: ~flow.models.UnversionedEntityResponseDto
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["_models.UnversionedEntityResponseDto"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
content_type = kwargs.pop('content_type', "application/json") # type: Optional[str]
if body is not None:
_json = self._serialize.body(body, 'UnversionedEntityRequestDto')
else:
_json = None
request = build_get_index_entity_by_id_request(
subscription_id=subscription_id,
resource_group_name=resource_group_name,
workspace_name=workspace_name,
content_type=content_type,
json=_json,
template_url=self.get_index_entity_by_id.metadata['url'],
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error)
deserialized = self._deserialize('UnversionedEntityResponseDto', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_index_entity_by_id.metadata = {'url': '/flow/v1.0/flows/getIndexEntities'} # type: ignore
@distributed_trace_async
async def get_updated_entity_ids_for_workspace(
self,
subscription_id: str,
resource_group_name: str,
workspace_name: str,
body: Optional["_models.UnversionedRebuildIndexDto"] = None,
**kwargs: Any
) -> "_models.UnversionedRebuildResponseDto":
"""get_updated_entity_ids_for_workspace.
:param subscription_id: The Azure Subscription ID.
:type subscription_id: str
:param resource_group_name: The Name of the resource group in which the workspace is located.
:type resource_group_name: str
:param workspace_name: The name of the workspace.
:type workspace_name: str
:param body:
:type body: ~flow.models.UnversionedRebuildIndexDto
:keyword callable cls: A custom type or function that will be passed the direct response
:return: UnversionedRebuildResponseDto, or the result of cls(response)
:rtype: ~flow.models.UnversionedRebuildResponseDto
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["_models.UnversionedRebuildResponseDto"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
content_type = kwargs.pop('content_type', "application/json") # type: Optional[str]
if body is not None:
_json = self._serialize.body(body, 'UnversionedRebuildIndexDto')
else:
_json = None
request = build_get_updated_entity_ids_for_workspace_request(
subscription_id=subscription_id,
resource_group_name=resource_group_name,
workspace_name=workspace_name,
content_type=content_type,
json=_json,
template_url=self.get_updated_entity_ids_for_workspace.metadata['url'],
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error)
deserialized = self._deserialize('UnversionedRebuildResponseDto', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_updated_entity_ids_for_workspace.metadata = {'url': '/flow/v1.0/flows/rebuildIndex'} # type: ignore
| promptflow/src/promptflow/promptflow/azure/_restclient/flow/aio/operations/_flows_provider_operations.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/azure/_restclient/flow/aio/operations/_flows_provider_operations.py",
"repo_id": "promptflow",
"token_count": 2881
} | 40 |
# coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.8.0, generator: @autorest/[email protected])
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import functools
from typing import TYPE_CHECKING
import warnings
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from msrest import Serializer
from .. import models as _models
from .._vendor import _convert_request, _format_url_section
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from typing import Any, Callable, Dict, Generic, Optional, TypeVar
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
_SERIALIZER = Serializer()
_SERIALIZER.client_side_validation = False
# fmt: off
def build_get_index_entity_by_id_request(
subscription_id, # type: str
resource_group_name, # type: str
workspace_name, # type: str
**kwargs # type: Any
):
# type: (...) -> HttpRequest
content_type = kwargs.pop('content_type', None) # type: Optional[str]
accept = "application/json"
# Construct URL
url = kwargs.pop("template_url", '/flow/v1.0/flows/getIndexEntities')
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'),
"resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'),
"workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'),
}
url = _format_url_section(url, **path_format_arguments)
# Construct headers
header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any]
if content_type is not None:
header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str')
header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str')
return HttpRequest(
method="POST",
url=url,
headers=header_parameters,
**kwargs
)
def build_get_updated_entity_ids_for_workspace_request(
subscription_id, # type: str
resource_group_name, # type: str
workspace_name, # type: str
**kwargs # type: Any
):
# type: (...) -> HttpRequest
content_type = kwargs.pop('content_type', None) # type: Optional[str]
accept = "application/json"
# Construct URL
url = kwargs.pop("template_url", '/flow/v1.0/flows/rebuildIndex')
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'),
"resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'),
"workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'),
}
url = _format_url_section(url, **path_format_arguments)
# Construct headers
header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any]
if content_type is not None:
header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str')
header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str')
return HttpRequest(
method="POST",
url=url,
headers=header_parameters,
**kwargs
)
# fmt: on
class FlowsProviderOperations(object):
"""FlowsProviderOperations operations.
You should not instantiate this class directly. Instead, you should create a Client instance that
instantiates it for you and attaches it as an attribute.
:ivar models: Alias to model classes used in this operation group.
:type models: ~flow.models
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
"""
models = _models
def __init__(self, client, config, serializer, deserializer):
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self._config = config
@distributed_trace
def get_index_entity_by_id(
self,
subscription_id, # type: str
resource_group_name, # type: str
workspace_name, # type: str
body=None, # type: Optional["_models.UnversionedEntityRequestDto"]
**kwargs # type: Any
):
# type: (...) -> "_models.UnversionedEntityResponseDto"
"""get_index_entity_by_id.
:param subscription_id: The Azure Subscription ID.
:type subscription_id: str
:param resource_group_name: The Name of the resource group in which the workspace is located.
:type resource_group_name: str
:param workspace_name: The name of the workspace.
:type workspace_name: str
:param body:
:type body: ~flow.models.UnversionedEntityRequestDto
:keyword callable cls: A custom type or function that will be passed the direct response
:return: UnversionedEntityResponseDto, or the result of cls(response)
:rtype: ~flow.models.UnversionedEntityResponseDto
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["_models.UnversionedEntityResponseDto"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
content_type = kwargs.pop('content_type', "application/json") # type: Optional[str]
if body is not None:
_json = self._serialize.body(body, 'UnversionedEntityRequestDto')
else:
_json = None
request = build_get_index_entity_by_id_request(
subscription_id=subscription_id,
resource_group_name=resource_group_name,
workspace_name=workspace_name,
content_type=content_type,
json=_json,
template_url=self.get_index_entity_by_id.metadata['url'],
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error)
deserialized = self._deserialize('UnversionedEntityResponseDto', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_index_entity_by_id.metadata = {'url': '/flow/v1.0/flows/getIndexEntities'} # type: ignore
@distributed_trace
def get_updated_entity_ids_for_workspace(
self,
subscription_id, # type: str
resource_group_name, # type: str
workspace_name, # type: str
body=None, # type: Optional["_models.UnversionedRebuildIndexDto"]
**kwargs # type: Any
):
# type: (...) -> "_models.UnversionedRebuildResponseDto"
"""get_updated_entity_ids_for_workspace.
:param subscription_id: The Azure Subscription ID.
:type subscription_id: str
:param resource_group_name: The Name of the resource group in which the workspace is located.
:type resource_group_name: str
:param workspace_name: The name of the workspace.
:type workspace_name: str
:param body:
:type body: ~flow.models.UnversionedRebuildIndexDto
:keyword callable cls: A custom type or function that will be passed the direct response
:return: UnversionedRebuildResponseDto, or the result of cls(response)
:rtype: ~flow.models.UnversionedRebuildResponseDto
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["_models.UnversionedRebuildResponseDto"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
content_type = kwargs.pop('content_type', "application/json") # type: Optional[str]
if body is not None:
_json = self._serialize.body(body, 'UnversionedRebuildIndexDto')
else:
_json = None
request = build_get_updated_entity_ids_for_workspace_request(
subscription_id=subscription_id,
resource_group_name=resource_group_name,
workspace_name=workspace_name,
content_type=content_type,
json=_json,
template_url=self.get_updated_entity_ids_for_workspace.metadata['url'],
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error)
deserialized = self._deserialize('UnversionedRebuildResponseDto', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_updated_entity_ids_for_workspace.metadata = {'url': '/flow/v1.0/flows/rebuildIndex'} # type: ignore
| promptflow/src/promptflow/promptflow/azure/_restclient/flow/operations/_flows_provider_operations.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/azure/_restclient/flow/operations/_flows_provider_operations.py",
"repo_id": "promptflow",
"token_count": 3934
} | 41 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import os
from collections import defaultdict
from functools import cached_property
from multiprocessing import Lock
from pathlib import Path
from typing import Any, Dict, Optional
from azure.ai.ml._artifacts._fileshare_storage_helper import FileStorageClient
from azure.ai.ml._utils._asset_utils import (
DirectoryUploadProgressBar,
FileUploadProgressBar,
IgnoreFile,
get_directory_size,
)
from azure.core.exceptions import ResourceExistsError
from azure.storage.fileshare import DirectoryProperties, ShareDirectoryClient
from promptflow._sdk._vendor import get_upload_files_from_folder
from promptflow.azure._constants._flow import PROMPTFLOW_FILE_SHARE_DIR
from promptflow.azure._utils.gerneral import get_user_alias_from_credential
uploading_lock = defaultdict(Lock)
class FlowFileStorageClient(FileStorageClient):
def __init__(self, credential: str, file_share_name: str, account_url: str, azure_cred):
super().__init__(credential=credential, file_share_name=file_share_name, account_url=account_url)
try:
user_alias = get_user_alias_from_credential(azure_cred)
except Exception:
# fall back to unknown user when failed to get credential.
user_alias = "unknown_user"
self._user_alias = user_alias
# TODO: update this after we finalize the design for flow file storage client
# create user folder if not exist
for directory_path in ["Users", f"Users/{user_alias}", f"Users/{user_alias}/{PROMPTFLOW_FILE_SHARE_DIR}"]:
self.directory_client = ShareDirectoryClient(
account_url=account_url,
credential=credential,
share_name=file_share_name,
directory_path=directory_path,
)
# try to create user folder if not exist
try:
self.directory_client.create_directory()
except ResourceExistsError:
pass
@cached_property
def file_share_prefix(self) -> str:
return f"Users/{self._user_alias}/{PROMPTFLOW_FILE_SHARE_DIR}"
def upload(
self,
source: str,
name: str,
version: str,
ignore_file: IgnoreFile = IgnoreFile(None),
asset_hash: Optional[str] = None,
show_progress: bool = True,
) -> Dict[str, str]:
"""Upload a file or directory to a path inside the file system."""
source_name = Path(source).name
dest = asset_hash
# truncate path longer than 50 chars for terminal display
if show_progress and len(source_name) >= 50:
formatted_path = "{:.47}".format(source_name) + "..."
else:
formatted_path = source_name
msg = f"Uploading {formatted_path}"
# lock to prevent concurrent uploading of the same file or directory
with uploading_lock[self.directory_client.directory_path + "/" + dest]:
# start upload
if os.path.isdir(source):
subdir = self.directory_client.get_subdirectory_client(dest)
if not subdir.exists():
# directory is uploaded based on asset hash for now, so skip uploading if subdir exists
self.upload_dir(
source,
dest,
msg=msg,
show_progress=show_progress,
ignore_file=ignore_file,
)
else:
self.upload_file(source, dest=dest, msg=msg, show_progress=show_progress)
artifact_info = {"remote path": dest, "name": name, "version": version}
return artifact_info
def upload_file(
self,
source: str,
dest: str,
show_progress: Optional[bool] = None,
msg: Optional[str] = None,
in_directory: bool = False,
subdirectory_client: Optional[ShareDirectoryClient] = None,
callback: Optional[Any] = None,
) -> None:
""" " Upload a single file to a path inside the file system
directory."""
validate_content = os.stat(source).st_size > 0 # don't do checksum for empty files
# relative path from root
relative_path = Path(subdirectory_client.directory_path).relative_to(self.directory_client.directory_path)
dest = Path(dest).relative_to(relative_path).as_posix()
if "/" in dest:
# dest is a folder, need to switch subdirectory client
dest_dir, dest = dest.rsplit("/", 1)
subdirectory_client = subdirectory_client.get_subdirectory_client(dest_dir)
with open(source, "rb") as data:
if in_directory:
file_name = dest.rsplit("/")[-1]
if show_progress:
subdirectory_client.upload_file(
file_name=file_name,
data=data,
validate_content=validate_content,
raw_response_hook=callback,
)
else:
subdirectory_client.upload_file(
file_name=file_name,
data=data,
validate_content=validate_content,
)
else:
if show_progress:
with FileUploadProgressBar(msg=msg) as progress_bar:
self.directory_client.upload_file(
file_name=dest,
data=data,
validate_content=validate_content,
raw_response_hook=progress_bar.update_to,
)
else:
self.directory_client.upload_file(file_name=dest, data=data, validate_content=validate_content)
self.uploaded_file_count = self.uploaded_file_count + 1
def upload_dir(
self,
source: str,
dest: str,
msg: str,
show_progress: bool,
ignore_file: IgnoreFile,
) -> None:
"""Upload a directory to a path inside the fileshare directory."""
subdir = self.directory_client.create_subdirectory(dest)
source_path = Path(source).resolve()
prefix = dest + "/"
upload_paths = get_upload_files_from_folder(
path=source_path,
prefix=prefix,
ignore_file=ignore_file,
)
upload_paths = sorted(upload_paths)
self.total_file_count = len(upload_paths)
# travers all directories recursively and create them in the fileshare
def travers_recursively(child_dir, source_dir):
for item in os.listdir(source_dir):
item_path = os.path.join(source_dir, item)
if os.path.isdir(item_path):
new_dir = child_dir.create_subdirectory(item)
travers_recursively(new_dir, item_path)
travers_recursively(child_dir=subdir, source_dir=source)
if show_progress:
with DirectoryUploadProgressBar(dir_size=get_directory_size(source_path), msg=msg) as progress_bar:
for src, destination in upload_paths:
self.upload_file(
src,
destination,
in_directory=True,
subdirectory_client=subdir,
show_progress=show_progress,
callback=progress_bar.update_to,
)
else:
for src, destination in upload_paths:
self.upload_file(
src,
destination,
in_directory=True,
subdirectory_client=subdir,
show_progress=show_progress,
)
def _check_file_share_directory_exist(self, dest) -> bool:
"""Check if the file share directory exists."""
return self.directory_client.get_subdirectory_client(dest).exists()
def _check_file_share_file_exist(self, dest) -> bool:
"""Check if the file share directory exists."""
if dest.startswith(self.file_share_prefix):
dest = dest.replace(f"{self.file_share_prefix}/", "")
file_client = self.directory_client.get_file_client(dest)
try:
file_client.get_file_properties()
except Exception:
return False
return True
def _delete_file_share_directory(self, dir_client) -> None:
"""Recursively delete a directory with content in the file share."""
for item in dir_client.list_directories_and_files():
if isinstance(item, DirectoryProperties):
self._delete_file_share_directory(dir_client.get_subdirectory_client(item.name))
else:
dir_client.delete_file(item.name)
dir_client.delete_directory()
| promptflow/src/promptflow/promptflow/azure/operations/_fileshare_storeage_helper.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/azure/operations/_fileshare_storeage_helper.py",
"repo_id": "promptflow",
"token_count": 4252
} | 42 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import json
import logging
import sys
from dataclasses import asdict, dataclass
from enum import Enum
from pathlib import Path
from typing import Any, Dict, List, Optional
from promptflow._utils.yaml_utils import load_yaml
from promptflow.contracts._errors import FlowDefinitionError
from promptflow.exceptions import ErrorTarget
from .._constants import LANGUAGE_KEY, FlowLanguage
from .._sdk._constants import DEFAULT_ENCODING
from .._utils.dataclass_serializer import serialize
from .._utils.utils import try_import
from ._errors import FailedToImportModule
from .tool import ConnectionType, Tool, ToolType, ValueType
logger = logging.getLogger(__name__)
class InputValueType(Enum):
"""The enum of input value type."""
LITERAL = "Literal"
FLOW_INPUT = "FlowInput"
NODE_REFERENCE = "NodeReference"
FLOW_INPUT_PREFIX = "flow."
FLOW_INPUT_PREFIXES = [FLOW_INPUT_PREFIX, "inputs."] # Use a list for backward compatibility
@dataclass
class InputAssignment:
"""This class represents the assignment of an input value.
:param value: The value of the input assignment.
:type value: Any
:param value_type: The type of the input assignment.
:type value_type: ~promptflow.contracts.flow.InputValueType
:param section: The section of the input assignment, usually the output.
:type section: str
:param property: The property of the input assignment that exists in the section.
:type property: str
"""
value: Any
value_type: InputValueType = InputValueType.LITERAL
section: str = ""
property: str = ""
def serialize(self):
"""Serialize the input assignment to a string."""
if self.value_type == InputValueType.FLOW_INPUT:
return f"${{{FLOW_INPUT_PREFIX}{self.value}}}"
elif self.value_type == InputValueType.NODE_REFERENCE:
if self.property:
return f"${{{self.value}.{self.section}.{self.property}}}"
return f"${{{self.value}.{self.section}}}"
elif ConnectionType.is_connection_value(self.value):
return ConnectionType.serialize_conn(self.value)
return self.value
@staticmethod
def deserialize(value: str) -> "InputAssignment":
"""Deserialize the input assignment from a string.
:param value: The string to be deserialized.
:type value: str
:return: The input assignment constructed from the string.
:rtype: ~promptflow.contracts.flow.InputAssignment
"""
literal_value = InputAssignment(value, InputValueType.LITERAL)
if isinstance(value, str) and value.startswith("$") and len(value) > 2:
value = value[1:]
if value[0] != "{" or value[-1] != "}":
return literal_value
value = value[1:-1]
return InputAssignment.deserialize_reference(value)
return literal_value
@staticmethod
def deserialize_reference(value: str) -> "InputAssignment":
"""Deserialize the reference(including node/flow reference) part of an input assignment.
:param value: The string to be deserialized.
:type value: str
:return: The input assignment of reference types.
:rtype: ~promptflow.contracts.flow.InputAssignment
"""
if FlowInputAssignment.is_flow_input(value):
return FlowInputAssignment.deserialize(value)
return InputAssignment.deserialize_node_reference(value)
@staticmethod
def deserialize_node_reference(data: str) -> "InputAssignment":
"""Deserialize the node reference part of an input assignment.
:param data: The string to be deserialized.
:type data: str
:return: Input assignment of node reference type.
:rtype: ~promptflow.contracts.flow.InputAssignment
"""
value_type = InputValueType.NODE_REFERENCE
if "." not in data:
return InputAssignment(data, value_type, "output")
node_name, port_name = data.split(".", 1)
if "." not in port_name:
return InputAssignment(node_name, value_type, port_name)
section, property = port_name.split(".", 1)
return InputAssignment(node_name, value_type, section, property)
@dataclass
class FlowInputAssignment(InputAssignment):
"""This class represents the assignment of a flow input value.
:param prefix: The prefix of the flow input.
:type prefix: str
"""
prefix: str = FLOW_INPUT_PREFIX
@staticmethod
def is_flow_input(input_value: str) -> bool:
"""Check whether the input value is a flow input.
:param input_value: The input value to be checked.
:type input_value: str
:return: Whether the input value is a flow input.
:rtype: bool
"""
for prefix in FLOW_INPUT_PREFIXES:
if input_value.startswith(prefix):
return True
return False
@staticmethod
def deserialize(value: str) -> "FlowInputAssignment":
"""Deserialize the flow input assignment from a string.
:param value: The string to be deserialized.
:type value: str
:return: The flow input assignment constructed from the string.
:rtype: ~promptflow.contracts.flow.FlowInputAssignment
"""
for prefix in FLOW_INPUT_PREFIXES:
if value.startswith(prefix):
return FlowInputAssignment(
value=value[len(prefix) :], value_type=InputValueType.FLOW_INPUT, prefix=prefix
)
raise ValueError(f"Unexpected flow input value {value}")
class ToolSourceType(str, Enum):
"""The enum of tool source type."""
Code = "code"
Package = "package"
PackageWithPrompt = "package_with_prompt"
@dataclass
class ToolSource:
"""This class represents the source of a tool.
:param type: The type of the tool source.
:type type: ~promptflow.contracts.flow.ToolSourceType
:param tool: The tool of the tool source.
:type tool: str
:param path: The path of the tool source.
:type path: str
"""
type: ToolSourceType = ToolSourceType.Code
tool: Optional[str] = None
path: Optional[str] = None
@staticmethod
def deserialize(data: dict) -> "ToolSource":
"""Deserialize the tool source from a dict.
:param data: The dict to be deserialized.
:type data: dict
:return: The tool source constructed from the dict.
:rtype: ~promptflow.contracts.flow.ToolSource
"""
result = ToolSource(data.get("type", ToolSourceType.Code.value))
if "tool" in data:
result.tool = data["tool"]
if "path" in data:
result.path = data["path"]
return result
@dataclass
class ActivateCondition:
"""This class represents the activate condition of a node.
:param condition: The condition of the activate condition.
:type condition: ~promptflow.contracts.flow.InputAssignment
:param condition_value: The value of the condition.
:type condition_value: Any
"""
condition: InputAssignment
condition_value: Any
@staticmethod
def deserialize(data: dict, node_name: str = None) -> "ActivateCondition":
"""Deserialize the activate condition from a dict.
:param data: The dict to be deserialized.
:type data: dict
:return: The activate condition constructed from the dict.
:rtype: ~promptflow.contracts.flow.ActivateCondition
"""
node_name = node_name if node_name else ""
if "when" in data and "is" in data:
if data["when"] is None and data["is"] is None:
logger.warning(
f"The activate config for node {node_name} has empty 'when' and 'is'. "
"Please check your flow yaml to ensure it aligns with your expectations."
)
return ActivateCondition(
condition=InputAssignment.deserialize(data["when"]),
condition_value=data["is"],
)
else:
raise FlowDefinitionError(
message_format=(
"The definition of activate config for node {node_name} "
"is incorrect. Please check your flow yaml and resubmit."
),
node_name=node_name,
)
@dataclass
class Node:
"""This class represents a node in a flow.
:param name: The name of the node.
:type name: str
:param tool: The tool of the node.
:type tool: str
:param inputs: The inputs of the node.
:type inputs: Dict[str, InputAssignment]
:param comment: The comment of the node.
:type comment: str
:param api: The api of the node.
:type api: str
:param provider: The provider of the node.
:type provider: str
:param module: The module of the node.
:type module: str
:param connection: The connection of the node.
:type connection: str
:param aggregation: Whether the node is an aggregation node.
:type aggregation: bool
:param enable_cache: Whether the node enable cache.
:type enable_cache: bool
:param use_variants: Whether the node use variants.
:type use_variants: bool
:param source: The source of the node.
:type source: ~promptflow.contracts.flow.ToolSource
:param type: The tool type of the node.
:type type: ~promptflow.contracts.tool.ToolType
:param activate: The activate condition of the node.
:type activate: ~promptflow.contracts.flow.ActivateCondition
"""
name: str
tool: str
inputs: Dict[str, InputAssignment]
comment: str = ""
api: str = None
provider: str = None
module: str = None # The module of provider to import
connection: str = None
aggregation: bool = False
enable_cache: bool = False
use_variants: bool = False
source: Optional[ToolSource] = None
type: Optional[ToolType] = None
activate: Optional[ActivateCondition] = None
def serialize(self):
"""Serialize the node to a dict.
:return: The dict of the node.
:rtype: dict
"""
data = asdict(self, dict_factory=lambda x: {k: v for (k, v) in x if v})
self.inputs = self.inputs or {}
data.update({"inputs": {name: i.serialize() for name, i in self.inputs.items()}})
if self.aggregation:
data["aggregation"] = True
data["reduce"] = True # TODO: Remove this fallback.
if self.type:
data["type"] = self.type.value
return data
@staticmethod
def deserialize(data: dict) -> "Node":
"""Deserialize the node from a dict.
:param data: The dict to be deserialized.
:type data: dict
:return: The node constructed from the dict.
:rtype: ~promptflow.contracts.flow.Node
"""
node = Node(
name=data.get("name"),
tool=data.get("tool"),
inputs={name: InputAssignment.deserialize(v) for name, v in (data.get("inputs") or {}).items()},
comment=data.get("comment", ""),
api=data.get("api", None),
provider=data.get("provider", None),
module=data.get("module", None),
connection=data.get("connection", None),
aggregation=data.get("aggregation", False) or data.get("reduce", False), # TODO: Remove this fallback.
enable_cache=data.get("enable_cache", False),
use_variants=data.get("use_variants", False),
)
if "source" in data:
node.source = ToolSource.deserialize(data["source"])
if "type" in data:
node.type = ToolType(data["type"])
if "activate" in data:
node.activate = ActivateCondition.deserialize(data["activate"], node.name)
return node
@dataclass
class FlowInputDefinition:
"""This class represents the definition of a flow input.
:param type: The type of the flow input.
:type type: ~promptflow.contracts.tool.ValueType
:param default: The default value of the flow input.
:type default: str
:param description: The description of the flow input.
:type description: str
:param enum: The enum of the flow input.
:type enum: List[str]
:param is_chat_input: Whether the flow input is a chat input.
:type is_chat_input: bool
:param is_chat_history: Whether the flow input is a chat history.
:type is_chat_history: bool
"""
type: ValueType
default: str = None
description: str = None
enum: List[str] = None
is_chat_input: bool = False
is_chat_history: bool = None
def serialize(self):
"""Serialize the flow input definition to a dict.
:return: The dict of the flow input definition.
:rtype: dict
"""
data = {}
data["type"] = self.type.value
if self.default:
data["default"] = str(self.default)
if self.description:
data["description"] = self.description
if self.enum:
data["enum"] = self.enum
if self.is_chat_input:
data["is_chat_input"] = True
if self.is_chat_history:
data["is_chat_history"] = True
return data
@staticmethod
def deserialize(data: dict) -> "FlowInputDefinition":
"""Deserialize the flow input definition from a dict.
:param data: The dict to be deserialized.
:type data: dict
:return: The flow input definition constructed from the dict.
:rtype: ~promptflow.contracts.flow.FlowInputDefinition
"""
return FlowInputDefinition(
ValueType(data["type"]),
data.get("default", None),
data.get("description", ""),
data.get("enum", []),
data.get("is_chat_input", False),
data.get("is_chat_history", None),
)
@dataclass
class FlowOutputDefinition:
"""This class represents the definition of a flow output.
:param type: The type of the flow output.
:type type: ~promptflow.contracts.tool.ValueType
:param reference: The reference of the flow output.
:type reference: ~promptflow.contracts.flow.InputAssignment
:param description: The description of the flow output.
:type description: str
:param evaluation_only: Whether the flow output is for evaluation only.
:type evaluation_only: bool
:param is_chat_output: Whether the flow output is a chat output.
:type is_chat_output: bool
"""
type: ValueType
reference: InputAssignment
description: str = ""
evaluation_only: bool = False
is_chat_output: bool = False
def serialize(self):
"""Serialize the flow output definition to a dict.
:return: The dict of the flow output definition.
:rtype: dict
"""
data = {}
data["type"] = self.type.value
if self.reference:
data["reference"] = self.reference.serialize()
if self.description:
data["description"] = self.description
if self.evaluation_only:
data["evaluation_only"] = True
if self.is_chat_output:
data["is_chat_output"] = True
return data
@staticmethod
def deserialize(data: dict):
"""Deserialize the flow output definition from a dict.
:param data: The dict to be deserialized.
:type data: dict
:return: The flow output definition constructed from the dict.
:rtype: ~promptflow.contracts.flow.FlowOutputDefinition
"""
return FlowOutputDefinition(
ValueType(data["type"]),
InputAssignment.deserialize(data.get("reference", "")),
data.get("description", ""),
data.get("evaluation_only", False),
data.get("is_chat_output", False),
)
@dataclass
class NodeVariant:
"""This class represents a node variant.
:param node: The node of the node variant.
:type node: ~promptflow.contracts.flow.Node
:param description: The description of the node variant.
:type description: str
"""
node: Node
description: str = ""
@staticmethod
def deserialize(data: dict) -> "NodeVariant":
"""Deserialize the node variant from a dict.
:param data: The dict to be deserialized.
:type data: dict
:return: The node variant constructed from the dict.
:rtype: ~promptflow.contracts.flow.NodeVariant
"""
return NodeVariant(
Node.deserialize(data["node"]),
data.get("description", ""),
)
@dataclass
class NodeVariants:
"""This class represents the variants of a node.
:param default_variant_id: The default variant id of the node.
:type default_variant_id: str
:param variants: The variants of the node.
:type variants: Dict[str, NodeVariant]
"""
default_variant_id: str # The default variant id of the node
variants: Dict[str, NodeVariant] # The variants of the node
@staticmethod
def deserialize(data: dict) -> "NodeVariants":
"""Deserialize the node variants from a dict.
:param data: The dict to be deserialized.
:type data: dict
:return: The node variants constructed from the dict.
:rtype: ~promptflow.contracts.flow.NodeVariants
"""
variants = {}
for variant_id, node in data["variants"].items():
variants[variant_id] = NodeVariant.deserialize(node)
return NodeVariants(default_variant_id=data.get("default_variant_id", ""), variants=variants)
@dataclass
class Flow:
"""This class represents a flow.
:param id: The id of the flow.
:type id: str
:param name: The name of the flow.
:type name: str
:param nodes: The nodes of the flow.
:type nodes: List[Node]
:param inputs: The inputs of the flow.
:type inputs: Dict[str, FlowInputDefinition]
:param outputs: The outputs of the flow.
:type outputs: Dict[str, FlowOutputDefinition]
:param tools: The tools of the flow.
:type tools: List[Tool]
:param node_variants: The node variants of the flow.
:type node_variants: Dict[str, NodeVariants]
:param program_language: The program language of the flow.
:type program_language: str
:param environment_variables: The default environment variables of the flow.
:type environment_variables: Dict[str, object]
"""
id: str
name: str
nodes: List[Node]
inputs: Dict[str, FlowInputDefinition]
outputs: Dict[str, FlowOutputDefinition]
tools: List[Tool]
node_variants: Dict[str, NodeVariants] = None
program_language: str = FlowLanguage.Python
environment_variables: Dict[str, object] = None
def serialize(self):
"""Serialize the flow to a dict.
:return: The dict of the flow.
:rtype: dict
"""
data = {
"id": self.id,
"name": self.name,
"nodes": [n.serialize() for n in self.nodes],
"inputs": {name: i.serialize() for name, i in self.inputs.items()},
"outputs": {name: o.serialize() for name, o in self.outputs.items()},
"tools": [serialize(t) for t in self.tools],
"language": self.program_language,
}
return data
@staticmethod
def _import_requisites(tools, nodes):
"""This function will import tools/nodes required modules to ensure type exists so flow can be executed."""
try:
# Import tool modules to ensure register_builtins & registered_connections executed
for tool in tools:
if tool.module:
try_import(tool.module, f"Import tool {tool.name!r} module {tool.module!r} failed.")
# Import node provider to ensure register_apis executed so that provider & connection exists.
for node in nodes:
if node.module:
try_import(node.module, f"Import node {node.name!r} provider module {node.module!r} failed.")
except Exception as e:
logger.warning("Failed to import modules...")
raise FailedToImportModule(
message=f"Failed to import modules with error: {str(e)}.", target=ErrorTarget.RUNTIME
) from e
@staticmethod
def deserialize(data: dict) -> "Flow":
"""Deserialize the flow from a dict.
:param data: The dict to be deserialized.
:type data: dict
:return: The flow constructed from the dict.
:rtype: ~promptflow.contracts.flow.Flow
"""
tools = [Tool.deserialize(t) for t in data.get("tools") or []]
nodes = [Node.deserialize(n) for n in data.get("nodes") or []]
Flow._import_requisites(tools, nodes)
inputs = data.get("inputs") or {}
outputs = data.get("outputs") or {}
return Flow(
# TODO: Remove this fallback.
data.get("id", data.get("name", "default_flow_id")),
data.get("name", "default_flow"),
nodes,
{name: FlowInputDefinition.deserialize(i) for name, i in inputs.items()},
{name: FlowOutputDefinition.deserialize(o) for name, o in outputs.items()},
tools=tools,
node_variants={name: NodeVariants.deserialize(v) for name, v in (data.get("node_variants") or {}).items()},
program_language=data.get(LANGUAGE_KEY, FlowLanguage.Python),
environment_variables=data.get("environment_variables") or {},
)
def _apply_default_node_variants(self: "Flow"):
self.nodes = [
self._apply_default_node_variant(node, self.node_variants) if node.use_variants else node
for node in self.nodes
]
return self
@staticmethod
def _apply_default_node_variant(node: Node, node_variants: Dict[str, NodeVariants]) -> Node:
if not node_variants:
return node
node_variant = node_variants.get(node.name)
if not node_variant:
return node
default_variant = node_variant.variants.get(node_variant.default_variant_id)
if not default_variant:
return node
default_variant.node.name = node.name
return default_variant.node
@classmethod
def _resolve_working_dir(cls, flow_file: Path, working_dir=None) -> Path:
working_dir = cls._parse_working_dir(flow_file, working_dir)
cls._update_working_dir(working_dir)
return working_dir
@classmethod
def _parse_working_dir(cls, flow_file: Path, working_dir=None) -> Path:
if working_dir is None:
working_dir = Path(flow_file).resolve().parent
working_dir = Path(working_dir).absolute()
return working_dir
@classmethod
def _update_working_dir(cls, working_dir: Path):
sys.path.insert(0, str(working_dir))
@classmethod
def from_yaml(cls, flow_file: Path, working_dir=None) -> "Flow":
"""Load flow from yaml file."""
working_dir = cls._parse_working_dir(flow_file, working_dir)
with open(working_dir / flow_file, "r", encoding=DEFAULT_ENCODING) as fin:
flow_dag = load_yaml(fin)
return Flow._from_dict(flow_dag=flow_dag, working_dir=working_dir)
@classmethod
def _from_dict(cls, flow_dag: dict, working_dir: Path) -> "Flow":
"""Load flow from dict."""
cls._update_working_dir(working_dir)
flow = Flow.deserialize(flow_dag)
flow._set_tool_loader(working_dir)
return flow
@classmethod
def load_env_variables(
cls, flow_file: Path, working_dir=None, environment_variables_overrides: Dict[str, str] = None
) -> Dict[str, str]:
"""
Read flow_environment_variables from flow yaml.
If environment_variables_overrides exists, override yaml level configuration.
Returns the merged environment variables dict.
"""
if Path(flow_file).suffix.lower() != ".yaml":
# The flow_file type of eager flow is .py
return environment_variables_overrides or {}
working_dir = cls._parse_working_dir(flow_file, working_dir)
with open(working_dir / flow_file, "r", encoding=DEFAULT_ENCODING) as fin:
flow_dag = load_yaml(fin)
flow = Flow.deserialize(flow_dag)
return flow.get_environment_variables_with_overrides(
environment_variables_overrides=environment_variables_overrides
)
def get_environment_variables_with_overrides(
self, environment_variables_overrides: Dict[str, str] = None
) -> Dict[str, str]:
environment_variables = {
k: (json.dumps(v) if isinstance(v, (dict, list)) else str(v)) for k, v in self.environment_variables.items()
}
if environment_variables_overrides is not None:
for k, v in environment_variables_overrides.items():
environment_variables[k] = v
return environment_variables
def _set_tool_loader(self, working_dir):
package_tool_keys = [node.source.tool for node in self.nodes if node.source and node.source.tool]
from promptflow._core.tools_manager import ToolLoader
# TODO: consider refactor this. It will raise an error if promptflow-tools
# is not installed even for csharp flow.
self._tool_loader = ToolLoader(working_dir, package_tool_keys)
def _apply_node_overrides(self, node_overrides):
"""Apply node overrides to update the nodes in the flow.
Example:
node_overrides = {
"llm_node1.connection": "some_connection",
"python_node1.some_key": "some_value",
}
We will update the connection field of llm_node1 and the input value of python_node1.some_key.
"""
if not node_overrides:
return self
# We don't do detailed error handling here, since it should never fail
for key, value in node_overrides.items():
node_name, input_name = key.split(".")
node = self.get_node(node_name)
if node is None:
raise ValueError(f"Cannot find node {node_name} in flow {self.name}")
# For LLM node, here we override the connection field in node
if node.connection and input_name == "connection":
node.connection = value
# Other scenarios we override the input value of the inputs
else:
node.inputs[input_name] = InputAssignment(value=value)
return self
def has_aggregation_node(self):
"""Return whether the flow has aggregation node."""
return any(n.aggregation for n in self.nodes)
def get_node(self, node_name):
"""Return the node with the given name."""
return next((n for n in self.nodes if n.name == node_name), None)
def get_tool(self, tool_name):
"""Return the tool with the given name."""
return next((t for t in self.tools if t.name == tool_name), None)
def is_reduce_node(self, node_name):
"""Return whether the node is a reduce node."""
node = next((n for n in self.nodes if n.name == node_name), None)
return node is not None and node.aggregation
def is_normal_node(self, node_name):
"""Return whether the node is a normal node."""
node = next((n for n in self.nodes if n.name == node_name), None)
return node is not None and not node.aggregation
def is_llm_node(self, node):
"""Given a node, return whether it uses LLM tool."""
return node.type == ToolType.LLM
def is_referenced_by_flow_output(self, node):
"""Given a node, return whether it is referenced by output."""
return any(
output
for output in self.outputs.values()
if all(
(
output.reference.value_type == InputValueType.NODE_REFERENCE,
output.reference.value == node.name,
)
)
)
def is_node_referenced_by(self, node: Node, other_node: Node):
"""Given two nodes, return whether the first node is referenced by the second node."""
return other_node.inputs and any(
input
for input in other_node.inputs.values()
if input.value_type == InputValueType.NODE_REFERENCE and input.value == node.name
)
def is_referenced_by_other_node(self, node):
"""Given a node, return whether it is referenced by other node."""
return any(flow_node for flow_node in self.nodes if self.is_node_referenced_by(node, flow_node))
def is_chat_flow(self):
"""Return whether the flow is a chat flow."""
chat_input_name = self.get_chat_input_name()
return chat_input_name is not None
def get_chat_input_name(self):
"""Return the name of the chat input."""
return next((name for name, i in self.inputs.items() if i.is_chat_input), None)
def get_chat_output_name(self):
"""Return the name of the chat output."""
return next((name for name, o in self.outputs.items() if o.is_chat_output), None)
def _get_connection_name_from_tool(self, tool: Tool, node: Node):
connection_names = {}
value_types = set({v.value for v in ValueType.__members__.values()})
for k, v in tool.inputs.items():
input_type = [typ.value if isinstance(typ, Enum) else typ for typ in v.type]
if all(typ.lower() in value_types for typ in input_type):
# All type is value type, the key is not a possible connection key.
continue
input_assignment = node.inputs.get(k)
# Add literal node assignment values to results, skip node reference
if isinstance(input_assignment, InputAssignment) and input_assignment.value_type == InputValueType.LITERAL:
connection_names[k] = input_assignment.value
return connection_names
def get_connection_names(self):
"""Return connection names."""
connection_names = set({})
nodes = [
self._apply_default_node_variant(node, self.node_variants) if node.use_variants else node
for node in self.nodes
]
for node in nodes:
if node.connection:
connection_names.add(node.connection)
continue
if node.type == ToolType.PROMPT or node.type == ToolType.LLM:
continue
logger.debug(f"Try loading connection names for node {node.name}.")
tool = self.get_tool(node.tool) or self._tool_loader.load_tool_for_node(node)
if tool:
node_connection_names = list(self._get_connection_name_from_tool(tool, node).values())
else:
node_connection_names = []
if node_connection_names:
logger.debug(f"Connection names of node {node.name}: {node_connection_names}")
else:
logger.debug(f"Node {node.name} doesn't reference any connection.")
connection_names.update(node_connection_names)
return set({item for item in connection_names if item})
def get_connection_input_names_for_node(self, node_name):
"""Return connection input names."""
node = self.get_node(node_name)
if node and node.use_variants:
node = self._apply_default_node_variant(node, self.node_variants)
# Ignore Prompt node and LLM node, due to they do not have connection inputs.
if not node or node.type == ToolType.PROMPT or node.type == ToolType.LLM:
return []
tool = self.get_tool(node.tool) or self._tool_loader.load_tool_for_node(node)
if tool:
return list(self._get_connection_name_from_tool(tool, node).keys())
return []
def _replace_with_variant(self, variant_node: Node, variant_tools: list):
for index, node in enumerate(self.nodes):
if node.name == variant_node.name:
self.nodes[index] = variant_node
break
self.tools = self.tools + variant_tools
| promptflow/src/promptflow/promptflow/contracts/flow.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/contracts/flow.py",
"repo_id": "promptflow",
"token_count": 13223
} | 43 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import re
from promptflow._core._errors import NotSupported
from promptflow.contracts.flow import InputAssignment, InputValueType
from promptflow.executor._errors import (
InputNotFound,
InputNotFoundFromAncestorNodeOutput,
InvalidReferenceProperty,
UnsupportedReference,
)
def parse_value(i: InputAssignment, nodes_outputs: dict, flow_inputs: dict):
if i.value_type == InputValueType.LITERAL:
return i.value
if i.value_type == InputValueType.FLOW_INPUT:
if i.value not in flow_inputs:
flow_input_keys = ", ".join(flow_inputs.keys()) if flow_inputs is not None else None
raise InputNotFound(
message_format=(
"Flow execution failed. "
"The input '{input_name}' is not found from flow inputs '{flow_input_keys}'. "
"Please check the input name and try again."
),
input_name=i.value,
flow_input_keys=flow_input_keys,
)
return flow_inputs[i.value]
if i.value_type == InputValueType.NODE_REFERENCE:
if i.section != "output":
raise UnsupportedReference(
message_format=(
"Flow execution failed. "
"The section '{reference_section}' of reference is currently unsupported. "
"Please specify the output part of the node '{reference_node_name}'."
),
reference_section=i.section,
reference_node_name=i.value,
)
if i.value not in nodes_outputs:
node_output_keys = [output_keys for output_keys in nodes_outputs.keys() if nodes_outputs]
raise InputNotFoundFromAncestorNodeOutput(
message_format=(
"Flow execution failed. "
"The input '{input_name}' is not found from ancestor node outputs {node_output_keys}. "
"Please check the node name and try again."
),
input_name=i.value,
node_output_keys=node_output_keys,
)
return parse_node_property(i.value, nodes_outputs[i.value], i.property)
raise NotSupported(
message_format=(
"Flow execution failed. "
"The type '{input_type}' is currently unsupported. "
"Please choose from available types: {supported_output_type} and try again."
),
input_type=i.value_type.value if hasattr(i.value_type, "value") else i.value_type,
supported_output_type=[value_type.value for value_type in InputValueType],
)
property_pattern = r"(\w+)|(\['.*?'\])|(\[\d+\])"
def parse_node_property(node_name, node_val, property=""):
val = node_val
property_parts = re.findall(property_pattern, property)
try:
for part in property_parts:
part = [p for p in part if p][0]
if part.startswith("[") and part.endswith("]"):
index = part[1:-1]
if index.startswith("'") and index.endswith("'") or index.startswith('"') and index.endswith('"'):
index = index[1:-1]
elif index.isdigit():
index = int(index)
else:
raise InvalidReferenceProperty(
message_format=(
"Flow execution failed. "
"Invalid index '{index}' when accessing property '{property}' of the node '{node_name}'. "
"Please check the index and try again."
),
index=index,
property=property,
node_name=node_name,
)
val = val[index]
else:
if isinstance(val, dict):
val = val[part]
else:
val = getattr(val, part)
except (KeyError, IndexError, AttributeError) as e:
message_format = (
"Flow execution failed. "
"Invalid property '{property}' when accessing the node '{node_name}'. "
"Please check the property and try again."
)
raise InvalidReferenceProperty(message_format=message_format, property=property, node_name=node_name) from e
return val
| promptflow/src/promptflow/promptflow/executor/_input_assignment_parser.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/executor/_input_assignment_parser.py",
"repo_id": "promptflow",
"token_count": 2155
} | 44 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import json
from dataclasses import asdict, dataclass
from datetime import datetime
from promptflow._utils.dataclass_serializer import serialize
from promptflow.contracts.run_info import FlowRunInfo, RunInfo
@dataclass
class NodeRunRecord:
"""Dataclass for storing the run record of each node during single line execution on the flow
:param str node_name: The name of the node
:param int line_number: The line number in the source file
:param str run_info: The information about the run
:param datetime start_time: The time the node started running
:param datetime end_time: The time the node finished running
:param str status: The status of the node run
"""
node_name: str
line_number: int
run_info: str
start_time: datetime
end_time: datetime
status: str
@staticmethod
def from_run_info(run_info: RunInfo) -> "NodeRunRecord":
"""Create a NodeRunRecord from a RunInfo object.
:param RunInfo run_info: The run info to create the NodeRunRecord from
:return: The created NodeRunRecord
:rtype: NodeRunRecord
"""
return NodeRunRecord(
node_name=run_info.node,
line_number=run_info.index,
run_info=serialize(run_info),
start_time=run_info.start_time.isoformat(),
end_time=run_info.end_time.isoformat(),
status=run_info.status.value,
)
def serialize(self) -> str:
"""Serialize the NodeRunRecord for storage in blob.
:return: The serialized result
:rtype: str
"""
return json.dumps(asdict(self))
@dataclass
class LineRunRecord:
"""A dataclass for storing the run record of a single line execution on the flow.
:param int line_number: The line number in the record
:param str run_info: The information about the line run
:param datetime start_time: The time the line started executing
:param datetime end_time: The time the line finished executing
:param str name: The name of the line run
:param str description: The description of the line run
:param str status: The status of the line execution
:param str tags: The tags associated with the line run
"""
line_number: int
run_info: str
start_time: datetime
end_time: datetime
name: str
description: str
status: str
tags: str
@staticmethod
def from_run_info(run_info: FlowRunInfo) -> "LineRunRecord":
"""Create a LineRunRecord from a FlowRunInfo object.
:param FlowRunInfo run_info: The run info to create the LineRunRecord from
:return: The created LineRunRecord
:rtype: LineRunRecord
"""
return LineRunRecord(
line_number=run_info.index,
run_info=serialize(run_info),
start_time=run_info.start_time.isoformat(),
end_time=run_info.end_time.isoformat(),
name=run_info.name,
description=run_info.description,
status=run_info.status.value,
tags=run_info.tags,
)
def serialize(self) -> str:
"""Serialize the LineRunRecord for storage in a blob.
:return: The serialized result
:rtype: str
"""
return json.dumps(asdict(self))
| promptflow/src/promptflow/promptflow/storage/run_records.py/0 | {
"file_path": "promptflow/src/promptflow/promptflow/storage/run_records.py",
"repo_id": "promptflow",
"token_count": 1297
} | 45 |
import logging
import multiprocessing
import os
import re
import shutil
import sys
from pathlib import Path
from types import GeneratorType
import pytest
from promptflow.contracts.run_info import Status
from promptflow.exceptions import UserErrorException
from promptflow.executor import FlowExecutor
from promptflow.executor._errors import ConnectionNotFound, InputTypeError, ResolveToolError
from promptflow.executor.flow_executor import execute_flow
from promptflow.storage._run_storage import DefaultRunStorage
from ..utils import FLOW_ROOT, get_flow_folder, get_flow_sample_inputs, get_yaml_file, is_image_file
SAMPLE_FLOW = "web_classification_no_variants"
@pytest.mark.usefixtures("use_secrets_config_file", "dev_connections")
@pytest.mark.e2etest
class TestExecutor:
def get_line_inputs(self, flow_folder=""):
if flow_folder:
inputs = self.get_bulk_inputs(flow_folder)
return inputs[0]
return {
"url": "https://www.microsoft.com/en-us/windows/",
"text": "some_text",
}
def get_bulk_inputs(self, nlinee=4, flow_folder="", sample_inputs_file="", return_dict=False):
if flow_folder:
if not sample_inputs_file:
sample_inputs_file = "samples.json"
inputs = get_flow_sample_inputs(flow_folder, sample_inputs_file=sample_inputs_file)
if isinstance(inputs, list) and len(inputs) > 0:
return inputs
elif isinstance(inputs, dict):
if return_dict:
return inputs
return [inputs]
else:
raise Exception(f"Invalid type of bulk input: {inputs}")
return [self.get_line_inputs() for _ in range(nlinee)]
def skip_serp(self, flow_folder, dev_connections):
serp_required_flows = ["package_tools"]
# Real key is usually more than 32 chars
serp_key = dev_connections.get("serp_connection", {"value": {"api_key": ""}})["value"]["api_key"]
if flow_folder in serp_required_flows and len(serp_key) < 32:
pytest.skip("serp_connection is not prepared")
@pytest.mark.parametrize(
"flow_folder",
[
SAMPLE_FLOW,
"prompt_tools",
"script_with___file__",
"script_with_import",
"package_tools",
"connection_as_input",
"async_tools",
"async_tools_with_sync_tools",
"tool_with_assistant_definition",
],
)
def test_executor_exec_line(self, flow_folder, dev_connections):
self.skip_serp(flow_folder, dev_connections)
os.chdir(get_flow_folder(flow_folder))
executor = FlowExecutor.create(get_yaml_file(flow_folder), dev_connections)
flow_result = executor.exec_line(self.get_line_inputs())
assert not executor._run_tracker._flow_runs, "Flow runs in run tracker should be empty."
assert not executor._run_tracker._node_runs, "Node runs in run tracker should be empty."
assert isinstance(flow_result.output, dict)
assert flow_result.run_info.status == Status.Completed
node_count = len(executor._flow.nodes)
assert isinstance(flow_result.run_info.api_calls, list) and len(flow_result.run_info.api_calls) == 1
assert (
isinstance(flow_result.run_info.api_calls[0]["children"], list)
and len(flow_result.run_info.api_calls[0]["children"]) == node_count
)
assert len(flow_result.node_run_infos) == node_count
for node, node_run_info in flow_result.node_run_infos.items():
assert node_run_info.status == Status.Completed
assert node_run_info.node == node
assert isinstance(node_run_info.api_calls, list) # api calls is set
def test_long_running_log(self, dev_connections, capsys):
# TODO: investigate why flow_logger does not output to stdout in test case
from promptflow._utils.logger_utils import flow_logger
flow_logger.addHandler(logging.StreamHandler(sys.stdout))
os.environ["PF_TASK_PEEKING_INTERVAL"] = "1"
executor = FlowExecutor.create(get_yaml_file("async_tools"), dev_connections)
executor.exec_line(self.get_line_inputs())
captured = capsys.readouterr()
expected_long_running_str_1 = r".*.*Task async_passthrough has been running for 1 seconds, stacktrace:\n.*async_passthrough\.py.*in passthrough_str_and_wait\n.*await asyncio.sleep\(1\).*tasks\.py.*" # noqa E501
assert re.match(
expected_long_running_str_1, captured.out, re.DOTALL
), "flow_logger should contain long running async tool log"
expected_long_running_str_2 = r".*.*Task async_passthrough has been running for 2 seconds, stacktrace:\n.*async_passthrough\.py.*in passthrough_str_and_wait\n.*await asyncio.sleep\(1\).*tasks\.py.*" # noqa E501
assert re.match(
expected_long_running_str_2, captured.out, re.DOTALL
), "flow_logger should contain long running async tool log"
flow_logger.handlers.pop()
os.environ.pop("PF_TASK_PEEKING_INTERVAL")
@pytest.mark.parametrize(
"flow_folder, node_name, flow_inputs, dependency_nodes_outputs",
[
("web_classification_no_variants", "summarize_text_content", {}, {"fetch_text_content_from_url": "Hello"}),
("prompt_tools", "summarize_text_content_prompt", {"text": "text"}, {}),
("script_with___file__", "node1", {"text": "text"}, None),
("script_with___file__", "node2", None, {"node1": "text"}),
("script_with___file__", "node3", None, None),
("package_tools", "search_by_text", {"text": "elon mask"}, None), # Skip since no api key in CI
("connection_as_input", "conn_node", None, None),
("simple_aggregation", "accuracy", {"text": "A"}, {"passthrough": "B"}),
("script_with_import", "node1", {"text": "text"}, None),
],
)
def test_executor_exec_node(self, flow_folder, node_name, flow_inputs, dependency_nodes_outputs, dev_connections):
self.skip_serp(flow_folder, dev_connections)
yaml_file = get_yaml_file(flow_folder)
run_info = FlowExecutor.load_and_exec_node(
yaml_file,
node_name,
flow_inputs=flow_inputs,
dependency_nodes_outputs=dependency_nodes_outputs,
connections=dev_connections,
raise_ex=True,
)
assert run_info.output is not None
assert run_info.status == Status.Completed
assert isinstance(run_info.api_calls, list)
assert run_info.node == node_name
assert run_info.system_metrics["duration"] >= 0
def test_executor_exec_node_with_llm_node(self, dev_connections):
# Run the test in a new process to ensure the openai api is injected correctly for the single node run
context = multiprocessing.get_context("spawn")
queue = context.Queue()
process = context.Process(
target=exec_node_within_process,
args=(queue, "llm_tool", "joke", {"topic": "fruit"}, {}, dev_connections, True),
)
process.start()
process.join()
if not queue.empty():
raise queue.get()
def test_executor_node_overrides(self, dev_connections):
inputs = self.get_line_inputs()
executor = FlowExecutor.create(
get_yaml_file(SAMPLE_FLOW),
dev_connections,
node_override={"classify_with_llm.deployment_name": "dummy_deployment"},
raise_ex=True,
)
with pytest.raises(UserErrorException) as e:
executor.exec_line(inputs)
assert type(e.value).__name__ == "WrappedOpenAIError"
assert "The API deployment for this resource does not exist." in str(e.value)
with pytest.raises(ResolveToolError) as e:
executor = FlowExecutor.create(
get_yaml_file(SAMPLE_FLOW),
dev_connections,
node_override={"classify_with_llm.connection": "dummy_connection"},
raise_ex=True,
)
assert isinstance(e.value.inner_exception, ConnectionNotFound)
assert "Connection 'dummy_connection' not found" in str(e.value)
@pytest.mark.parametrize(
"flow_folder",
[
"no_inputs_outputs",
],
)
def test_flow_with_no_inputs_and_output(self, flow_folder, dev_connections):
executor = FlowExecutor.create(get_yaml_file(flow_folder, FLOW_ROOT), dev_connections)
flow_result = executor.exec_line({})
assert flow_result.output == {}
assert flow_result.run_info.status == Status.Completed
node_count = len(executor._flow.nodes)
assert isinstance(flow_result.run_info.api_calls, list) and len(flow_result.run_info.api_calls) == node_count
assert len(flow_result.node_run_infos) == node_count
for node, node_run_info in flow_result.node_run_infos.items():
assert node_run_info.status == Status.Completed
assert node_run_info.node == node
assert isinstance(node_run_info.api_calls, list) # api calls is set
@pytest.mark.parametrize(
"flow_folder",
[
"simple_flow_with_python_tool",
],
)
def test_convert_flow_input_types(self, flow_folder, dev_connections) -> None:
executor = FlowExecutor.create(get_yaml_file(flow_folder, FLOW_ROOT), dev_connections)
ret = executor.convert_flow_input_types(inputs={"num": "11"})
assert ret == {"num": 11}
ret = executor.convert_flow_input_types(inputs={"text": "12", "num": "11"})
assert ret == {"text": "12", "num": 11}
with pytest.raises(InputTypeError):
ret = executor.convert_flow_input_types(inputs={"num": "hello"})
executor.convert_flow_input_types(inputs={"num": "hello"})
def test_chat_flow_stream_mode(self, dev_connections) -> None:
executor = FlowExecutor.create(get_yaml_file("python_stream_tools", FLOW_ROOT), dev_connections)
# To run a flow with stream output, we need to set this flag to run tracker.
# TODO: refine the interface
inputs = {"text": "hello", "chat_history": []}
line_result = executor.exec_line(inputs, allow_generator_output=True)
# Assert there's only one output
assert len(line_result.output) == 1
assert set(line_result.output.keys()) == {"output_echo"}
# Assert the only output is a generator
output_echo = line_result.output["output_echo"]
assert isinstance(output_echo, GeneratorType)
assert list(output_echo) == ["Echo: ", "hello "]
# Assert the flow is completed and no errors are raised
flow_run_info = line_result.run_info
assert flow_run_info.status == Status.Completed
assert flow_run_info.error is None
@pytest.mark.parametrize(
"flow_folder",
[
"web_classification",
],
)
def test_executor_creation_with_default_variants(self, flow_folder, dev_connections):
executor = FlowExecutor.create(get_yaml_file(flow_folder), dev_connections)
flow_result = executor.exec_line(self.get_line_inputs())
assert flow_result.run_info.status == Status.Completed
def test_executor_creation_with_default_input(self):
# Assert for single node run.
default_input_value = "input value from default"
yaml_file = get_yaml_file("default_input")
executor = FlowExecutor.create(yaml_file, {})
node_result = executor.load_and_exec_node(yaml_file, "test_print_input")
assert node_result.status == Status.Completed
assert node_result.output == default_input_value
# Assert for flow run.
flow_result = executor.exec_line({})
assert flow_result.run_info.status == Status.Completed
assert flow_result.output["output"] == default_input_value
aggr_results = executor.exec_aggregation({}, aggregation_inputs={})
flow_aggregate_node = aggr_results.node_run_infos["aggregate_node"]
assert flow_aggregate_node.status == Status.Completed
assert flow_aggregate_node.output == [default_input_value]
# Assert for exec
exec_result = executor.exec({})
assert exec_result["output"] == default_input_value
def test_executor_for_script_tool_with_init(self, dev_connections):
executor = FlowExecutor.create(get_yaml_file("script_tool_with_init"), dev_connections)
flow_result = executor.exec_line({"input": "World"})
assert flow_result.run_info.status == Status.Completed
assert flow_result.output["output"] == "Hello World"
@pytest.mark.parametrize(
"output_dir_name, intermediate_dir_name, run_aggregation, expected_node_counts",
[
("output", "intermediate", True, 2),
("output_1", "intermediate_1", False, 1),
],
)
def test_execute_flow(
self, output_dir_name: str, intermediate_dir_name: str, run_aggregation: bool, expected_node_counts: int
):
flow_folder = get_flow_folder("eval_flow_with_simple_image")
# prepare output folder
output_dir = flow_folder / output_dir_name
intermediate_dir = flow_folder / intermediate_dir_name
output_dir.mkdir(exist_ok=True)
intermediate_dir.mkdir(exist_ok=True)
storage = DefaultRunStorage(base_dir=flow_folder, sub_dir=Path(intermediate_dir_name))
line_result = execute_flow(
flow_file=get_yaml_file(flow_folder),
working_dir=flow_folder,
output_dir=Path(output_dir_name),
inputs={},
connections={},
run_aggregation=run_aggregation,
storage=storage,
)
assert line_result.run_info.status == Status.Completed
assert len(line_result.node_run_infos) == expected_node_counts
assert all(is_image_file(output_file) for output_file in output_dir.iterdir())
assert all(is_image_file(output_file) for output_file in intermediate_dir.iterdir())
# clean up output folder
shutil.rmtree(output_dir)
shutil.rmtree(intermediate_dir)
def exec_node_within_process(queue, flow_file, node_name, flow_inputs, dependency_nodes_outputs, connections, raise_ex):
try:
result = FlowExecutor.load_and_exec_node(
flow_file=get_yaml_file(flow_file),
node_name=node_name,
flow_inputs=flow_inputs,
dependency_nodes_outputs=dependency_nodes_outputs,
connections=connections,
raise_ex=raise_ex,
)
# Assert llm single node run contains openai traces
# And the traces contains system metrics
OPENAI_AGGREGATE_METRICS = ["prompt_tokens", "completion_tokens", "total_tokens"]
assert len(result.api_calls) == 1
assert len(result.api_calls[0]["children"]) == 1
assert isinstance(result.api_calls[0]["children"][0]["system_metrics"], dict)
for key in OPENAI_AGGREGATE_METRICS:
assert key in result.api_calls[0]["children"][0]["system_metrics"]
for key in OPENAI_AGGREGATE_METRICS:
assert (
result.api_calls[0]["system_metrics"][key] == result.api_calls[0]["children"][0]["system_metrics"][key]
)
except Exception as ex:
queue.put(ex)
| promptflow/src/promptflow/tests/executor/e2etests/test_executor_happypath.py/0 | {
"file_path": "promptflow/src/promptflow/tests/executor/e2etests/test_executor_happypath.py",
"repo_id": "promptflow",
"token_count": 6745
} | 46 |
import pytest
from promptflow._core._errors import RunRecordNotFound
from promptflow._core.generator_proxy import GeneratorProxy
from promptflow._core.run_tracker import RunTracker
from promptflow.connections import AzureOpenAIConnection
from promptflow.contracts.run_info import Status
class UnserializableClass:
def __init__(self, data: str):
self.data = data
@pytest.mark.unittest
class TestRunTracker:
def test_run_tracker(self):
# TODO: Refactor this test case, it's very confusing now.
# Initialize run tracker with dummy run storage
run_tracker = RunTracker.init_dummy()
# Start flow run
run_tracker.start_flow_run("test_flow_id", "test_root_run_id", "test_flow_run_id")
assert len(run_tracker._flow_runs) == 1
assert run_tracker._current_run_id == "test_flow_run_id"
flow_input = {"flow_input": "input_0"}
run_tracker.set_inputs("test_flow_run_id", flow_input)
# Start node runs
run_info = run_tracker.start_node_run("node_0", "test_root_run_id", "test_flow_run_id", "run_id_0", index=0)
run_info.index = 0
run_info = run_tracker.start_node_run("node_0", "test_root_run_id", "test_flow_run_id", "run_id_1", index=1)
run_info.index = 1
run_tracker.start_node_run("node_aggr", "test_root_run_id", "test_flow_run_id", "run_id_aggr", index=None)
assert len(run_tracker._node_runs) == 3
assert run_tracker._current_run_id == "run_id_aggr"
# Test collect_all_run_infos_as_dicts
run_tracker.allow_generator_types = True
run_tracker.set_inputs(
"run_id_0",
{"input": "input_0", "connection": AzureOpenAIConnection("api_key", "api_base")}
)
run_tracker.set_inputs(
"run_id_1",
{"input": "input_1", "generator": GeneratorProxy(item for item in range(10))}
)
run_infos = run_tracker.collect_all_run_infos_as_dicts()
assert len(run_infos["flow_runs"]) == 1
assert len(run_infos["node_runs"]) == 3
assert run_infos["node_runs"][0]["inputs"] == {"input": "input_0", "connection": "AzureOpenAIConnection"}
assert run_infos["node_runs"][1]["inputs"] == {"input": "input_1", "generator": []}
# Test end run with normal result
result = {"result": "result"}
run_info_0 = run_tracker.end_run(run_id="run_id_0", result=result)
assert run_info_0.status == Status.Completed
assert run_info_0.output == result
# Test end run with unserializable result
result = {"unserialized_value": UnserializableClass("test")}
run_info_1 = run_tracker.end_run(run_id="run_id_1", result=result)
assert run_info_1.status == Status.Completed
assert run_info_1.output == str(result)
# Test end run with invalid run id
with pytest.raises(RunRecordNotFound):
run_tracker.end_run(run_id="invalid_run_id")
# Test end run with exception
ex = Exception("Failed")
run_info_aggr = run_tracker.end_run(run_id="run_id_aggr", ex=ex)
assert run_info_aggr.status == Status.Failed
assert run_info_aggr.error["message"] == "Failed"
# Test end flow run with unserializable result
result = {"unserialized_value": UnserializableClass("test")}
run_info_flow = run_tracker.end_run(run_id="test_flow_run_id", result=result)
assert run_info_flow.status == Status.Failed
assert "The output 'unserialized_value' for flow is incorrect." in run_info_flow.error["message"]
# Test _update_flow_run_info_with_node_runs
run_info_0.api_calls, run_info_0.system_metrics = [{"name": "caht"}], {"total_tokens": 10}
run_info_1.api_calls, run_info_1.system_metrics = [{"name": "completion"}], {"total_tokens": 20}
run_info_aggr.api_calls, run_info_aggr.system_metrics = [
{"name": "caht"}, {"name": "completion"}], {"total_tokens": 30}
run_tracker._update_flow_run_info_with_node_runs(run_info_flow)
assert len(run_info_flow.api_calls) == 1, "There should be only one top level api call for flow run."
assert run_info_flow.system_metrics["total_tokens"] == 60
assert run_info_flow.api_calls[0]["name"] == "flow"
assert run_info_flow.api_calls[0]["node_name"] == "flow"
assert run_info_flow.api_calls[0]["type"] == "Flow"
assert run_info_flow.api_calls[0]["system_metrics"]["total_tokens"] == 60
assert isinstance(run_info_flow.api_calls[0]["start_time"], float)
assert isinstance(run_info_flow.api_calls[0]["end_time"], float)
assert len(run_info_flow.api_calls[0]["children"]) == 4, "There should be 4 children under root."
# Test get_status_summary
status_summary = run_tracker.get_status_summary("test_root_run_id")
assert status_summary == {
"__pf__.lines.completed": 0,
"__pf__.lines.failed": 1,
"__pf__.nodes.node_0.completed": 2,
"__pf__.nodes.node_aggr.completed": 0,
}
def test_run_tracker_flow_run_without_node_run(self):
"""When line timeout, there will be flow run info without node run info."""
# Initialize run tracker with dummy run storage
run_tracker = RunTracker.init_dummy()
# Start flow run
run_tracker.start_flow_run("test_flow_id", "test_root_run_id", "test_flow_run_id_0", index=0)
run_tracker.end_run("test_flow_run_id_0", ex=Exception("Timeout"))
run_tracker.start_flow_run("test_flow_id", "test_root_run_id", "test_flow_run_id_1", index=1)
run_tracker.end_run("test_flow_run_id_1", result={"result": "result"})
assert len(run_tracker._flow_runs) == 2
# Start node runs
run_tracker.start_node_run("node_0", "test_root_run_id", "test_flow_run_id_2", "test_node_run_id_1", index=0)
run_tracker.end_run("test_node_run_id_1", result={"result": "result"})
assert len(run_tracker._node_runs) == 1
status_summary = run_tracker.get_status_summary("test_root_run_id")
assert status_summary == {
"__pf__.lines.completed": 1,
"__pf__.lines.failed": 1,
"__pf__.nodes.node_0.completed": 1,
}
| promptflow/src/promptflow/tests/executor/unittests/_core/test_run_tracker.py/0 | {
"file_path": "promptflow/src/promptflow/tests/executor/unittests/_core/test_run_tracker.py",
"repo_id": "promptflow",
"token_count": 2794
} | 47 |
import inspect
from typing import Union
import pytest
from promptflow._core._errors import DuplicateToolMappingError
from promptflow._utils.tool_utils import (
DynamicListError,
ListFunctionResponseError,
_find_deprecated_tools,
append_workspace_triple_to_func_input_params,
function_to_interface,
load_function_from_function_path,
param_to_definition,
validate_dynamic_list_func_response_type,
)
from promptflow.connections import AzureOpenAIConnection, CustomConnection
from promptflow.contracts.tool import ValueType, Tool, ToolType
# mock functions for dynamic list function testing
def mock_dynamic_list_func1():
pass
def mock_dynamic_list_func2(input1):
pass
def mock_dynamic_list_func3(input1, input2):
pass
def mock_dynamic_list_func4(input1, input2, **kwargs):
pass
def mock_dynamic_list_func5(input1, input2, subscription_id):
pass
def mock_dynamic_list_func6(input1, input2, subscription_id, resource_group_name, workspace_name):
pass
def mock_dynamic_list_func7(input1, input2, subscription_id, **kwargs):
pass
def mock_dynamic_list_func8(input1, input2, subscription_id, resource_group_name, workspace_name, **kwargs):
pass
@pytest.mark.unittest
class TestToolUtils:
def test_function_to_interface(self):
def func(conn: [AzureOpenAIConnection, CustomConnection], input: [str, int]):
pass
input_defs, _, connection_types, _ = function_to_interface(func)
assert len(input_defs) == 2
assert input_defs["conn"].type == ["AzureOpenAIConnection", "CustomConnection"]
assert input_defs["input"].type == [ValueType.OBJECT]
assert connection_types == [["AzureOpenAIConnection", "CustomConnection"]]
def test_function_to_interface_with_invalid_initialize_inputs(self):
def func(input_str: str):
pass
with pytest.raises(Exception) as exec_info:
function_to_interface(func, {"input_str": "test"})
assert "Duplicate inputs found from" in exec_info.value.args[0]
def test_function_to_interface_with_kwargs(self):
def func(input_str: str, **kwargs):
pass
_, _, _, enable_kwargs = function_to_interface(func)
assert enable_kwargs is True
def func(input_str: str):
pass
_, _, _, enable_kwargs = function_to_interface(func)
assert enable_kwargs is False
def test_param_to_definition(self):
from promptflow._sdk.entities import CustomStrongTypeConnection
from promptflow.contracts.tool import Secret
class MyFirstConnection(CustomStrongTypeConnection):
api_key: Secret
api_base: str
class MySecondConnection(CustomStrongTypeConnection):
api_key: Secret
api_base: str
def some_func(
conn1: MyFirstConnection,
conn2: Union[CustomConnection, MyFirstConnection],
conn3: Union[MyFirstConnection, CustomConnection],
conn4: Union[MyFirstConnection, MySecondConnection],
conn5: CustomConnection,
conn6: Union[CustomConnection, int],
conn7: Union[MyFirstConnection, int],
):
pass
sig = inspect.signature(some_func)
input_def, _ = param_to_definition(sig.parameters.get("conn1"), gen_custom_type_conn=True)
assert input_def.type == ["CustomConnection"]
assert input_def.custom_type == ["MyFirstConnection"]
input_def, _ = param_to_definition(sig.parameters.get("conn2"), gen_custom_type_conn=True)
assert input_def.type == ["CustomConnection"]
assert input_def.custom_type == ["MyFirstConnection"]
input_def, _ = param_to_definition(sig.parameters.get("conn3"), gen_custom_type_conn=True)
assert input_def.type == ["CustomConnection"]
assert input_def.custom_type == ["MyFirstConnection"]
input_def, _ = param_to_definition(sig.parameters.get("conn4"), gen_custom_type_conn=True)
assert input_def.type == ["CustomConnection"]
assert input_def.custom_type == ["MyFirstConnection", "MySecondConnection"]
input_def, _ = param_to_definition(sig.parameters.get("conn5"), gen_custom_type_conn=True)
assert input_def.type == ["CustomConnection"]
assert input_def.custom_type is None
input_def, _ = param_to_definition(sig.parameters.get("conn6"), gen_custom_type_conn=True)
assert input_def.type == [ValueType.OBJECT]
assert input_def.custom_type is None
input_def, _ = param_to_definition(sig.parameters.get("conn7"), gen_custom_type_conn=True)
assert input_def.type == [ValueType.OBJECT]
assert input_def.custom_type is None
@pytest.mark.parametrize(
"func, func_input_params_dict, use_ws_triple, expected_res",
[
(mock_dynamic_list_func1, None, False, {}),
(mock_dynamic_list_func2, {"input1": "value1"}, False, {"input1": "value1"}),
(
mock_dynamic_list_func3,
{"input1": "value1", "input2": "value2"},
False,
{"input1": "value1", "input2": "value2"},
),
(mock_dynamic_list_func3, {"input1": "value1"}, False, {"input1": "value1"}),
(mock_dynamic_list_func3, {"input1": "value1"}, True, {"input1": "value1"}),
(
mock_dynamic_list_func4,
{"input1": "value1"},
True,
{
"input1": "value1",
"subscription_id": "mock_subscription_id",
"resource_group_name": "mock_resource_group",
"workspace_name": "mock_workspace_name",
},
),
(
mock_dynamic_list_func5,
{"input1": "value1"},
True,
{"input1": "value1", "subscription_id": "mock_subscription_id"},
),
(
mock_dynamic_list_func5,
{"input1": "value1", "subscription_id": "input_subscription_id"},
True,
{"input1": "value1", "subscription_id": "input_subscription_id"},
),
(
mock_dynamic_list_func6,
{"input1": "value1"},
True,
{
"input1": "value1",
"subscription_id": "mock_subscription_id",
"resource_group_name": "mock_resource_group",
"workspace_name": "mock_workspace_name",
},
),
(
mock_dynamic_list_func6,
{
"input1": "value1",
"workspace_name": "input_workspace_name",
},
True,
{
"input1": "value1",
"workspace_name": "input_workspace_name",
"subscription_id": "mock_subscription_id",
"resource_group_name": "mock_resource_group",
},
),
(
mock_dynamic_list_func7,
{"input1": "value1"},
True,
{
"input1": "value1",
"subscription_id": "mock_subscription_id",
"resource_group_name": "mock_resource_group",
"workspace_name": "mock_workspace_name",
},
),
(
mock_dynamic_list_func7,
{"input1": "value1", "subscription_id": "input_subscription_id"},
True,
{
"input1": "value1",
"subscription_id": "input_subscription_id",
"resource_group_name": "mock_resource_group",
"workspace_name": "mock_workspace_name",
},
),
(
mock_dynamic_list_func8,
{"input1": "value1"},
True,
{
"input1": "value1",
"subscription_id": "mock_subscription_id",
"resource_group_name": "mock_resource_group",
"workspace_name": "mock_workspace_name",
},
),
(
mock_dynamic_list_func8,
{
"input1": "value1",
"subscription_id": "input_subscription_id",
"resource_group_name": "input_resource_group",
"workspace_name": "input_workspace_name",
},
True,
{
"input1": "value1",
"subscription_id": "input_subscription_id",
"resource_group_name": "input_resource_group",
"workspace_name": "input_workspace_name",
},
),
],
)
def test_append_workspace_triple_to_func_input_params(
self, func, func_input_params_dict, use_ws_triple, expected_res, mocked_ws_triple
):
ws_triple_dict = mocked_ws_triple._asdict() if use_ws_triple else None
func_sig_params = inspect.signature(func).parameters
actual_combined_inputs = append_workspace_triple_to_func_input_params(
func_sig_params=func_sig_params,
func_input_params_dict=func_input_params_dict,
ws_triple_dict=ws_triple_dict,
)
assert actual_combined_inputs == expected_res
@pytest.mark.parametrize(
"res",
[
(
[
{
"value": "fig0",
"display_value": "My_fig0",
"hyperlink": "https://www.bing.com/search?q=fig0",
"description": "this is 0 item",
},
{
"value": "kiwi1",
"display_value": "My_kiwi1",
"hyperlink": "https://www.bing.com/search?q=kiwi1",
"description": "this is 1 item",
},
]
),
([{"value": "fig0"}, {"value": "kiwi1"}]),
([{"value": "fig0", "display_value": "My_fig0"}, {"value": "kiwi1", "display_value": "My_kiwi1"}]),
(
[
{"value": "fig0", "display_value": "My_fig0", "hyperlink": "https://www.bing.com/search?q=fig0"},
{
"value": "kiwi1",
"display_value": "My_kiwi1",
"hyperlink": "https://www.bing.com/search?q=kiwi1",
},
]
),
([{"value": "fig0", "hyperlink": "https://www.bing.com/search?q=fig0"}]),
(
[
{"value": "fig0", "display_value": "My_fig0", "description": "this is 0 item"},
{
"value": "kiwi1",
"display_value": "My_kiwi1",
"hyperlink": "https://www.bing.com/search?q=kiwi1",
"description": "this is 1 item",
},
]
),
],
)
def test_validate_dynamic_list_func_response_type(self, res):
validate_dynamic_list_func_response_type(response=res, f="mock_func")
@pytest.mark.parametrize(
"res, err_msg",
[
(None, "mock_func response can not be empty."),
([], "mock_func response can not be empty."),
(["a", "b"], "mock_func response must be a list of dict. a is not a dict."),
({"a": "b"}, "mock_func response must be a list."),
([{"a": "b"}], "mock_func response dict must have 'value' key."),
([{"value": 1 + 2j}], "mock_func response dict value \\(1\\+2j\\) is not json serializable."),
],
)
def test_validate_dynamic_list_func_response_type_with_error(self, res, err_msg):
error_message = (
f"Unable to display list of items due to '{err_msg}'. \nPlease contact the tool "
f"author/support team for troubleshooting assistance."
)
with pytest.raises(ListFunctionResponseError, match=error_message):
validate_dynamic_list_func_response_type(response=res, f="mock_func")
def test_load_function_from_function_path(self, mock_module_with_list_func):
func_path = "my_tool_package.tools.tool_with_dynamic_list_input.my_list_func"
load_function_from_function_path(func_path)
def test_load_function_from_function_path_with_error(self, mock_module_with_list_func):
func_path = "mock_func_path"
with pytest.raises(
DynamicListError,
match="Unable to display list of items due to 'Failed to parse function from function path: "
"'mock_func_path'. Expected format: format 'my_module.my_func'. Detailed error: not enough "
"values to unpack \\(expected 2, got 1\\)'. \nPlease contact the tool author/support team for "
"troubleshooting assistance.",
):
load_function_from_function_path(func_path)
func_path = "fake_tool_pkg.tools.tool_with_dynamic_list_input.my_list_func"
with pytest.raises(
DynamicListError,
match="Unable to display list of items due to 'Failed to parse function from function path: "
"'fake_tool_pkg.tools.tool_with_dynamic_list_input.my_list_func'. Expected format: format "
"'my_module.my_func'. Detailed error: No module named 'fake_tool_pkg''. \nPlease contact the tool "
"author/support team for troubleshooting assistance.",
):
load_function_from_function_path(func_path)
func_path = "my_tool_package.tools.tool_with_dynamic_list_input.my_field"
with pytest.raises(
DynamicListError,
match="Unable to display list of items due to 'Failed to parse function from function path: "
"'my_tool_package.tools.tool_with_dynamic_list_input.my_field'. Expected format: "
"format 'my_module.my_func'. Detailed error: Unable to display list of items due to ''1' "
"is not callable.'. \nPlease contact the tool author/support team for troubleshooting assistance.",
):
load_function_from_function_path(func_path)
def test_find_deprecated_tools(self):
package_tools = {
"new_tool_1": Tool(
name="new tool 1", type=ToolType.PYTHON, inputs={}, deprecated_tools=["old_tool_1"]).serialize(),
"new_tool_2": Tool(
name="new tool 1", type=ToolType.PYTHON, inputs={}, deprecated_tools=["old_tool_1"]).serialize(),
}
with pytest.raises(DuplicateToolMappingError, match="secure operation"):
_find_deprecated_tools(package_tools)
| promptflow/src/promptflow/tests/executor/unittests/_utils/test_tool_utils.py/0 | {
"file_path": "promptflow/src/promptflow/tests/executor/unittests/_utils/test_tool_utils.py",
"repo_id": "promptflow",
"token_count": 7564
} | 48 |
import json
from pathlib import Path
from typing import Union, Dict
from promptflow._utils.yaml_utils import load_yaml
from promptflow.contracts.flow import Flow
from promptflow.contracts.run_info import FlowRunInfo
from promptflow.contracts.run_info import RunInfo as NodeRunInfo
from promptflow.storage import AbstractRunStorage
TEST_ROOT = Path(__file__).parent.parent
DATA_ROOT = TEST_ROOT / "test_configs/datas"
FLOW_ROOT = TEST_ROOT / "test_configs/flows"
EAGER_FLOW_ROOT = TEST_ROOT / "test_configs/eager_flows"
WRONG_FLOW_ROOT = TEST_ROOT / "test_configs/wrong_flows"
EAGER_FLOWS_ROOT = TEST_ROOT / "test_configs/eager_flows"
def get_flow_folder(folder_name, root: str = FLOW_ROOT):
flow_folder_path = Path(root) / folder_name
return flow_folder_path
def get_yaml_file(folder_name, root: str = FLOW_ROOT, file_name: str = "flow.dag.yaml"):
yaml_file = get_flow_folder(folder_name, root) / file_name
return yaml_file
def get_entry_file(folder_name, root: str = EAGER_FLOW_ROOT, file_name: str = "entry.py"):
entry_file = get_flow_folder(folder_name, root) / file_name
return entry_file
def get_flow_from_folder(folder_name, root: str = FLOW_ROOT, file_name: str = "flow.dag.yaml"):
flow_yaml = get_yaml_file(folder_name, root, file_name)
with open(flow_yaml, "r") as fin:
return Flow.deserialize(load_yaml(fin))
def get_flow_inputs_file(folder_name, root: str = FLOW_ROOT, file_name: str = "inputs.jsonl"):
inputs_file = get_flow_folder(folder_name, root) / file_name
return inputs_file
def get_flow_inputs(folder_name, root: str = FLOW_ROOT, file_name: str = "inputs.json"):
inputs = load_json(get_flow_inputs_file(folder_name, root, file_name))
return inputs[0] if isinstance(inputs, list) else inputs
def get_bulk_inputs_from_jsonl(folder_name, root: str = FLOW_ROOT, file_name: str = "inputs.jsonl"):
inputs = load_jsonl(get_flow_inputs_file(folder_name, root, file_name))
return inputs
def get_bulk_inputs(folder_name, root: str = FLOW_ROOT, file_name: str = "inputs.json"):
inputs = load_json(get_flow_inputs_file(folder_name, root=root, file_name=file_name))
return [inputs] if isinstance(inputs, dict) else inputs
def get_flow_sample_inputs(folder_name, root: str = FLOW_ROOT, sample_inputs_file="samples.json"):
samples_inputs = load_json(get_flow_folder(folder_name, root) / sample_inputs_file)
return samples_inputs
def get_flow_expected_metrics(folder_name):
samples_inputs = load_json(get_flow_folder(folder_name) / "expected_metrics.json")
return samples_inputs
def get_flow_expected_status_summary(folder_name):
samples_inputs = load_json(get_flow_folder(folder_name) / "expected_status_summary.json")
return samples_inputs
def get_flow_expected_result(folder_name):
samples_inputs = load_json(get_flow_folder(folder_name) / "expected_result.json")
return samples_inputs
def get_flow_package_tool_definition(folder_name):
return load_json(get_flow_folder(folder_name) / "package_tool_definition.json")
def load_json(source: Union[str, Path]) -> dict:
"""Load json file to dict"""
with open(source, "r") as f:
loaded_data = json.load(f)
return loaded_data
def load_jsonl(source: Union[str, Path]) -> list:
"""Load jsonl file to list"""
with open(source, "r") as f:
loaded_data = [json.loads(line.strip()) for line in f]
return loaded_data
def load_content(source: Union[str, Path]) -> str:
"""Load file content to string"""
return Path(source).read_text()
def is_jsonl_file(file_path: Path):
return file_path.suffix.lower() == ".jsonl"
def is_image_file(file_path: Path):
image_extensions = [".jpg", ".jpeg", ".png", ".gif", ".bmp", ".tiff"]
file_extension = file_path.suffix.lower()
return file_extension in image_extensions
class MemoryRunStorage(AbstractRunStorage):
def __init__(self):
self._node_runs: Dict[str, NodeRunInfo] = {}
self._flow_runs: Dict[str, FlowRunInfo] = {}
def persist_flow_run(self, run_info: FlowRunInfo):
self._flow_runs[run_info.run_id] = run_info
def persist_node_run(self, run_info: NodeRunInfo):
self._node_runs[run_info.run_id] = run_info
| promptflow/src/promptflow/tests/executor/utils.py/0 | {
"file_path": "promptflow/src/promptflow/tests/executor/utils.py",
"repo_id": "promptflow",
"token_count": 1627
} | 49 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
from .bases import PFAzureIntegrationTestRecording
from .constants import SanitizedValues
from .utils import get_created_flow_name_from_flow_path, get_pf_client_for_replay, is_live, is_record, is_replay
from .variable_recorder import VariableRecorder
__all__ = [
"PFAzureIntegrationTestRecording",
"SanitizedValues",
"VariableRecorder",
"get_created_flow_name_from_flow_path",
"get_pf_client_for_replay",
"is_live",
"is_record",
"is_replay",
]
| promptflow/src/promptflow/tests/sdk_cli_azure_test/recording_utilities/__init__.py/0 | {
"file_path": "promptflow/src/promptflow/tests/sdk_cli_azure_test/recording_utilities/__init__.py",
"repo_id": "promptflow",
"token_count": 208
} | 50 |
import tempfile
import pytest
from pytest_mock import MockerFixture
from promptflow.azure import PFClient
from promptflow.exceptions import UserErrorException
@pytest.mark.unittest
class TestRunOperations:
def test_download_run_with_invalid_workspace_datastore(self, pf: PFClient, mocker: MockerFixture):
# test download with invalid workspace datastore
mocker.patch.object(pf.runs, "_validate_for_run_download")
mocker.patch.object(pf.runs, "_workspace_default_datastore", "test")
with tempfile.TemporaryDirectory() as tmp_dir:
with pytest.raises(UserErrorException, match="workspace default datastore is not supported"):
pf.runs.download(run="fake_run_name", output=tmp_dir)
| promptflow/src/promptflow/tests/sdk_cli_azure_test/unittests/test_run_operations.py/0 | {
"file_path": "promptflow/src/promptflow/tests/sdk_cli_azure_test/unittests/test_run_operations.py",
"repo_id": "promptflow",
"token_count": 274
} | 51 |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import shutil
from pathlib import Path
from tempfile import TemporaryDirectory
from types import GeneratorType
import pytest
from promptflow import load_flow
from promptflow._sdk._errors import ConnectionNotFoundError, InvalidFlowError
from promptflow._sdk.entities import CustomConnection
from promptflow._sdk.operations._flow_context_resolver import FlowContextResolver
from promptflow._utils.flow_utils import dump_flow_dag, load_flow_dag
from promptflow.entities import FlowContext
from promptflow.exceptions import UserErrorException
FLOWS_DIR = "./tests/test_configs/flows"
RUNS_DIR = "./tests/test_configs/runs"
DATAS_DIR = "./tests/test_configs/datas"
@pytest.mark.usefixtures(
"use_secrets_config_file", "recording_injection", "setup_local_connection", "install_custom_tool_pkg"
)
@pytest.mark.sdk_test
@pytest.mark.e2etest
class TestFlowAsFunc:
def test_flow_as_a_func(self):
f = load_flow(f"{FLOWS_DIR}/print_env_var")
result = f(key="unknown")
assert result["output"] is None
assert "line_number" not in result
def test_flow_as_a_func_with_connection_overwrite(self):
from promptflow._sdk._errors import ConnectionNotFoundError
f = load_flow(f"{FLOWS_DIR}/web_classification")
f.context.connections = {"classify_with_llm": {"connection": "not_exist"}}
with pytest.raises(ConnectionNotFoundError) as e:
f(url="https://www.youtube.com/watch?v=o5ZQyXaAv1g")
assert "Connection 'not_exist' is not found" in str(e.value)
def test_flow_as_a_func_with_connection_obj(self):
f = load_flow(f"{FLOWS_DIR}/flow_with_custom_connection")
f.context.connections = {"hello_node": {"connection": CustomConnection(secrets={"k": "v"})}}
result = f(text="hello")
assert result["output"]["secrets"] == {"k": "v"}
def test_overrides(self):
f = load_flow(f"{FLOWS_DIR}/print_env_var")
f.context = FlowContext(
# node print_env will take "provided_key" instead of flow input
overrides={"nodes.print_env.inputs.key": "provided_key"},
)
# the key="unknown" will not take effect
result = f(key="unknown")
assert result["output"] is None
@pytest.mark.skip(reason="This experience has not finalized yet.")
def test_flow_as_a_func_with_token_based_connection(self):
class MyCustomConnection(CustomConnection):
def get_token(self):
return "fake_token"
f = load_flow(f"{FLOWS_DIR}/flow_with_custom_connection")
f.context.connections = {"hello_node": {"connection": MyCustomConnection(secrets={"k": "v"})}}
result = f(text="hello")
assert result == {}
def test_exception_handle(self):
f = load_flow(f"{FLOWS_DIR}/flow_with_invalid_import")
with pytest.raises(UserErrorException) as e:
f(text="hello")
assert "Failed to load python module " in str(e.value)
f = load_flow(f"{FLOWS_DIR}/print_env_var")
with pytest.raises(UserErrorException) as e:
f()
assert "Required input fields ['key'] are missing" in str(e.value)
def test_stream_output(self):
f = load_flow(f"{FLOWS_DIR}/chat_flow_with_python_node_streaming_output")
f.context.streaming = True
result = f(
chat_history=[
{"inputs": {"chat_input": "Hi"}, "outputs": {"chat_output": "Hello! How can I assist you today?"}}
],
question="How are you?",
)
assert isinstance(result["answer"], GeneratorType)
@pytest.mark.skip(reason="This experience has not finalized yet.")
def test_environment_variables(self):
f = load_flow(f"{FLOWS_DIR}/print_env_var")
f.context.environment_variables = {"key": "value"}
result = f(key="key")
assert result["output"] == "value"
def test_flow_as_a_func_with_variant(self):
flow_path = Path(f"{FLOWS_DIR}/flow_with_dict_input_with_variant").absolute()
f = load_flow(
flow_path,
)
f.context.variant = "${print_val.variant1}"
# variant1 will use a mock_custom_connection
with pytest.raises(ConnectionNotFoundError) as e:
f(key="a")
assert "Connection 'mock_custom_connection' is not found." in str(e.value)
# non-exist variant
f.context.variant = "${print_val.variant_2}"
with pytest.raises(InvalidFlowError) as e:
f(key="a")
assert "Variant variant_2 not found for node print_val" in str(e.value)
def test_non_scrubbed_connection(self):
f = load_flow(f"{FLOWS_DIR}/flow_with_custom_connection")
f.context.connections = {"hello_node": {"connection": CustomConnection(secrets={"k": "*****"})}}
with pytest.raises(UserErrorException) as e:
f(text="hello")
assert "please make sure connection has decrypted secrets to use in flow execution." in str(e)
def test_local_connection_object(self, pf, azure_open_ai_connection):
f = load_flow(f"{FLOWS_DIR}/flow_with_custom_connection")
# local connection without secret will lead to error
connection = pf.connections.get("azure_open_ai_connection", with_secrets=False)
f.context.connections = {"hello_node": {"connection": connection}}
with pytest.raises(UserErrorException) as e:
f(text="hello")
assert "please make sure connection has decrypted secrets to use in flow execution." in str(e)
def test_non_secret_connection(self):
f = load_flow(f"{FLOWS_DIR}/flow_with_custom_connection")
# execute connection without secrets won't get error since the connection doesn't have scrubbed secrets
# we only raise error when there are scrubbed secrets in connection
f.context.connections = {"hello_node": {"connection": CustomConnection(secrets={})}}
f(text="hello")
def test_flow_context_cache(self):
# same flow context has same hash
assert hash(FlowContext()) == hash(FlowContext())
# getting executor for same flow will hit cache
flow1 = load_flow(f"{FLOWS_DIR}/print_env_var")
flow2 = load_flow(f"{FLOWS_DIR}/print_env_var")
flow_executor1 = FlowContextResolver.resolve(
flow=flow1,
)
flow_executor2 = FlowContextResolver.resolve(
flow=flow2,
)
assert flow_executor1 is flow_executor2
# getting executor for same flow + context will hit cache
flow1 = load_flow(f"{FLOWS_DIR}/flow_with_custom_connection")
flow1.context = FlowContext(connections={"hello_node": {"connection": CustomConnection(secrets={"k": "v"})}})
flow2 = load_flow(f"{FLOWS_DIR}/flow_with_custom_connection")
flow2.context = FlowContext(connections={"hello_node": {"connection": CustomConnection(secrets={"k": "v"})}})
flow_executor1 = FlowContextResolver.resolve(
flow=flow1,
)
flow_executor2 = FlowContextResolver.resolve(
flow=flow2,
)
assert flow_executor1 is flow_executor2
flow1 = load_flow(f"{FLOWS_DIR}/flow_with_dict_input_with_variant")
flow1.context = FlowContext(
variant="${print_val.variant1}",
connections={"print_val": {"conn": CustomConnection(secrets={"k": "v"})}},
overrides={"nodes.print_val.inputs.key": "a"},
)
flow2 = load_flow(f"{FLOWS_DIR}/flow_with_dict_input_with_variant")
flow2.context = FlowContext(
variant="${print_val.variant1}",
connections={"print_val": {"conn": CustomConnection(secrets={"k": "v"})}},
overrides={"nodes.print_val.inputs.key": "a"},
)
flow_executor1 = FlowContextResolver.resolve(flow=flow1)
flow_executor2 = FlowContextResolver.resolve(flow=flow2)
assert flow_executor1 is flow_executor2
def test_flow_cache_not_hit(self):
with TemporaryDirectory() as tmp_dir:
shutil.copytree(f"{FLOWS_DIR}/print_env_var", f"{tmp_dir}/print_env_var")
flow_path = Path(f"{tmp_dir}/print_env_var")
# load same file with different content will not hit cache
flow1 = load_flow(flow_path)
# update content
_, flow_dag = load_flow_dag(flow_path)
flow_dag["inputs"] = {"key": {"type": "string", "default": "key1"}}
dump_flow_dag(flow_dag, flow_path)
flow2 = load_flow(f"{tmp_dir}/print_env_var")
flow_executor1 = FlowContextResolver.resolve(
flow=flow1,
)
flow_executor2 = FlowContextResolver.resolve(
flow=flow2,
)
assert flow_executor1 is not flow_executor2
def test_flow_context_cache_not_hit(self):
flow1 = load_flow(f"{FLOWS_DIR}/flow_with_custom_connection")
flow1.context = FlowContext(connections={"hello_node": {"connection": CustomConnection(secrets={"k": "v"})}})
flow2 = load_flow(f"{FLOWS_DIR}/flow_with_custom_connection")
flow2.context = FlowContext(connections={"hello_node": {"connection": CustomConnection(secrets={"k2": "v"})}})
flow_executor1 = FlowContextResolver.resolve(
flow=flow1,
)
flow_executor2 = FlowContextResolver.resolve(
flow=flow2,
)
assert flow_executor1 is not flow_executor2
flow1 = load_flow(f"{FLOWS_DIR}/flow_with_dict_input_with_variant")
flow1.context = FlowContext(
variant="${print_val.variant1}",
connections={"print_val": {"conn": CustomConnection(secrets={"k": "v"})}},
overrides={"nodes.print_val.inputs.key": "a"},
)
flow2 = load_flow(f"{FLOWS_DIR}/flow_with_dict_input_with_variant")
flow2.context = FlowContext(
variant="${print_val.variant1}",
connections={"print_val": {"conn": CustomConnection(secrets={"k": "v"})}},
overrides={"nodes.print_val.inputs.key": "b"},
)
flow_executor1 = FlowContextResolver.resolve(flow=flow1)
flow_executor2 = FlowContextResolver.resolve(flow=flow2)
assert flow_executor1 is not flow_executor2
@pytest.mark.timeout(10)
def test_flow_as_func_perf_test(self):
# this test should not take long due to caching logic
f = load_flow(f"{FLOWS_DIR}/print_env_var")
for i in range(100):
f(key="key")
| promptflow/src/promptflow/tests/sdk_cli_test/e2etests/test_flow_as_func.py/0 | {
"file_path": "promptflow/src/promptflow/tests/sdk_cli_test/e2etests/test_flow_as_func.py",
"repo_id": "promptflow",
"token_count": 4569
} | 52 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.