id int64 0 190k | prompt stringlengths 21 13.4M | docstring stringlengths 1 12k ⌀ |
|---|---|---|
3,975 |
def get_default_azure_credential():
from azure.identity import DefaultAzureCredential
try:
from azure.ai.ml._azure_environments import _get_default_cloud_name, EndpointURLS, _get_cloud, AzureEnvironments
except ImportError:
return DefaultAzureCredential()
# Support sovereign cloud case... | null |
3,976 | import re
from typing import Any, Dict, Mapping
from promptflow._constants import LINE_NUMBER_KEY
from promptflow._utils.logger_utils import LoggerFactory
from promptflow.batch._errors import InputMappingError
The provided code snippet includes necessary dependencies for implementing the `apply_inputs_mapping` functio... | Apply input mapping to inputs for new contract. .. admonition:: Examples .. code-block:: python inputs: { "data": {"answer": "I'm fine, thank you.", "question": "How are you?"}, "baseline": {"answer": "The weather is good."}, } inputs_mapping: { "question": "${data.question}", "groundtruth": "${data.answer}", "baseline... |
3,977 | import hashlib
import os
from os import PathLike
from pathlib import Path
from typing import Union
from promptflow._sdk._constants import DAG_FILE_NAME, DEFAULT_ENCODING
from promptflow._utils.logger_utils import LoggerFactory
from promptflow._utils.yaml_utils import dump_yaml, load_yaml
logger = LoggerFactory.get_logg... | Get the lineage id for flow. The flow lineage id will be same for same flow in same GIT repo or device. If the flow locates in GIT repo: use Repo name + relative path to flow_dir as session id Otherwise: use device id + absolute path to flow_dir as session id :param flow_dir: flow directory |
3,978 | import hashlib
import os
from os import PathLike
from pathlib import Path
from typing import Union
from promptflow._sdk._constants import DAG_FILE_NAME, DEFAULT_ENCODING
from promptflow._utils.logger_utils import LoggerFactory
from promptflow._utils.yaml_utils import dump_yaml, load_yaml
def resolve_flow_path(flow_path... | Load flow dag from given flow path. |
3,979 | import hashlib
import os
from os import PathLike
from pathlib import Path
from typing import Union
from promptflow._sdk._constants import DAG_FILE_NAME, DEFAULT_ENCODING
from promptflow._utils.logger_utils import LoggerFactory
from promptflow._utils.yaml_utils import dump_yaml, load_yaml
def resolve_flow_path(flow_path... | Dump flow dag to given flow path. |
3,980 | import contextlib
import contextvars
import functools
import importlib
import json
import logging
import os
import re
import shutil
import time
import traceback
from datetime import datetime
from pathlib import Path
from typing import Any, Dict, Iterable, Iterator, List, Optional, TypeVar, Union
from promptflow._consta... | null |
3,981 | import contextlib
import contextvars
import functools
import importlib
import json
import logging
import os
import re
import shutil
import time
import traceback
from datetime import datetime
from pathlib import Path
from typing import Any, Dict, Iterable, Iterator, List, Optional, TypeVar, Union
from promptflow._consta... | null |
3,982 | import contextlib
import contextvars
import functools
import importlib
import json
import logging
import os
import re
import shutil
import time
import traceback
from datetime import datetime
from pathlib import Path
from typing import Any, Dict, Iterable, Iterator, List, Optional, TypeVar, Union
from promptflow._consta... | null |
3,983 | import contextlib
import contextvars
import functools
import importlib
import json
import logging
import os
import re
import shutil
import time
import traceback
from datetime import datetime
from pathlib import Path
from typing import Any, Dict, Iterable, Iterator, List, Optional, TypeVar, Union
from promptflow._consta... | null |
3,984 | import contextlib
import contextvars
import functools
import importlib
import json
import logging
import os
import re
import shutil
import time
import traceback
from datetime import datetime
from pathlib import Path
from typing import Any, Dict, Iterable, Iterator, List, Optional, TypeVar, Union
from promptflow._consta... | null |
3,985 | import contextlib
import contextvars
import functools
import importlib
import json
import logging
import os
import re
import shutil
import time
import traceback
from datetime import datetime
from pathlib import Path
from typing import Any, Dict, Iterable, Iterator, List, Optional, TypeVar, Union
from promptflow._consta... | null |
3,986 | import contextlib
import contextvars
import functools
import importlib
import json
import logging
import os
import re
import shutil
import time
import traceback
from datetime import datetime
from pathlib import Path
from typing import Any, Dict, Iterable, Iterator, List, Optional, TypeVar, Union
from promptflow._consta... | null |
3,987 | import contextlib
import contextvars
import functools
import importlib
import json
import logging
import os
import re
import shutil
import time
import traceback
from datetime import datetime
from pathlib import Path
from typing import Any, Dict, Iterable, Iterator, List, Optional, TypeVar, Union
from promptflow._consta... | null |
3,988 | import contextlib
import contextvars
import functools
import importlib
import json
import logging
import os
import re
import shutil
import time
import traceback
from datetime import datetime
from pathlib import Path
from typing import Any, Dict, Iterable, Iterator, List, Optional, TypeVar, Union
from promptflow._consta... | null |
3,989 | import contextlib
import contextvars
import functools
import importlib
import json
import logging
import os
import re
import shutil
import time
import traceback
from datetime import datetime
from pathlib import Path
from typing import Any, Dict, Iterable, Iterator, List, Optional, TypeVar, Union
from promptflow._consta... | null |
3,990 | import contextlib
import contextvars
import functools
import importlib
import json
import logging
import os
import re
import shutil
import time
import traceback
from datetime import datetime
from pathlib import Path
from typing import Any, Dict, Iterable, Iterator, List, Optional, TypeVar, Union
from promptflow._consta... | null |
3,991 | import contextlib
import contextvars
import functools
import importlib
import json
import logging
import os
import re
import shutil
import time
import traceback
from datetime import datetime
from pathlib import Path
from typing import Any, Dict, Iterable, Iterator, List, Optional, TypeVar, Union
from promptflow._consta... | null |
3,992 | import contextlib
import contextvars
import functools
import importlib
import json
import logging
import os
import re
import shutil
import time
import traceback
from datetime import datetime
from pathlib import Path
from typing import Any, Dict, Iterable, Iterator, List, Optional, TypeVar, Union
from promptflow._consta... | null |
3,993 | import contextlib
import contextvars
import functools
import importlib
import json
import logging
import os
import re
import shutil
import time
import traceback
from datetime import datetime
from pathlib import Path
from typing import Any, Dict, Iterable, Iterator, List, Optional, TypeVar, Union
from promptflow._consta... | null |
3,994 | import contextlib
import contextvars
import functools
import importlib
import json
import logging
import os
import re
import shutil
import time
import traceback
from datetime import datetime
from pathlib import Path
from typing import Any, Dict, Iterable, Iterator, List, Optional, TypeVar, Union
from promptflow._consta... | Use this function to convert inputs_mapping to a string that can be passed to component as a string parameter, we have to do this since we can't pass a dict as a parameter to component. # TODO: Finalize the format of inputs_mapping |
3,995 | import contextlib
import contextvars
import functools
import importlib
import json
import logging
import os
import re
import shutil
import time
import traceback
from datetime import datetime
from pathlib import Path
from typing import Any, Dict, Iterable, Iterator, List, Optional, TypeVar, Union
from promptflow._consta... | null |
3,996 | import contextlib
import contextvars
import functools
import importlib
import json
import logging
import os
import re
import shutil
import time
import traceback
from datetime import datetime
from pathlib import Path
from typing import Any, Dict, Iterable, Iterator, List, Optional, TypeVar, Union
from promptflow._consta... | Resolve directory to absolute path with base_dir as root |
3,997 | import contextlib
import contextvars
import functools
import importlib
import json
import logging
import os
import re
import shutil
import time
import traceback
from datetime import datetime
from pathlib import Path
from typing import Any, Dict, Iterable, Iterator, List, Optional, TypeVar, Union
from promptflow._consta... | Parse string user agent to dict with name as ua name and value as ua version. |
3,998 | import contextlib
import contextvars
import functools
import importlib
import json
import logging
import os
import re
import shutil
import time
import traceback
from datetime import datetime
from pathlib import Path
from typing import Any, Dict, Iterable, Iterator, List, Optional, TypeVar, Union
from promptflow._consta... | The function `get_int_env_var` retrieves an integer environment variable value, with an optional default value if the variable is not set or cannot be converted to an integer. :param env_var_name: The name of the environment variable you want to retrieve the value of :param default_value: The default value is the value... |
3,999 | import contextlib
import contextvars
import functools
import importlib
import json
import logging
import os
import re
import shutil
import time
import traceback
from datetime import datetime
from pathlib import Path
from typing import Any, Dict, Iterable, Iterator, List, Optional, TypeVar, Union
from promptflow._consta... | null |
4,000 | import contextlib
import contextvars
import functools
import importlib
import json
import logging
import os
import re
import shutil
import time
import traceback
from datetime import datetime
from pathlib import Path
from typing import Any, Dict, Iterable, Iterator, List, Optional, TypeVar, Union
from promptflow._consta... | null |
4,001 | import contextlib
import contextvars
import functools
import importlib
import json
import logging
import os
import re
import shutil
import time
import traceback
from datetime import datetime
from pathlib import Path
from typing import Any, Dict, Iterable, Iterator, List, Optional, TypeVar, Union
from promptflow._consta... | null |
4,002 | import contextlib
import contextvars
import functools
import importlib
import json
import logging
import os
import re
import shutil
import time
import traceback
from datetime import datetime
from pathlib import Path
from typing import Any, Dict, Iterable, Iterator, List, Optional, TypeVar, Union
from promptflow._consta... | Copy all files from src_dir to dst_dir recursively, excluding a specific file directly under the root of src_dir. :param src_dir: Source directory path :type src_dir: str :param dst_dir: Destination directory path :type dst_dir: str :param exclude_file: Name of the file to exclude from copying :type exclude_file: str |
4,003 | import contextlib
import contextvars
import functools
import importlib
import json
import logging
import os
import re
import shutil
import time
import traceback
from datetime import datetime
from pathlib import Path
from typing import Any, Dict, Iterable, Iterator, List, Optional, TypeVar, Union
from promptflow._consta... | Checks if user is using a Jupyter Notebook. This is necessary because logging is not allowed in non-Jupyter contexts. Adapted from https://stackoverflow.com/a/22424821 |
4,004 | import contextlib
import contextvars
import functools
import importlib
import json
import logging
import os
import re
import shutil
import time
import traceback
from datetime import datetime
from pathlib import Path
from typing import Any, Dict, Iterable, Iterator, List, Optional, TypeVar, Union
from promptflow._consta... | null |
4,005 | import contextlib
import contextvars
import functools
import importlib
import json
import logging
import os
import re
import shutil
import time
import traceback
from datetime import datetime
from pathlib import Path
from typing import Any, Dict, Iterable, Iterator, List, Optional, TypeVar, Union
from promptflow._consta... | Create folder if not exists and return the folder path. |
4,006 | import time
from functools import wraps
from typing import Tuple, Type, Union
from requests import Response
from promptflow._utils.logger_utils import LoggerFactory
logger = LoggerFactory.get_logger(__name__)
The provided code snippet includes necessary dependencies for implementing the `retry` function. Write a Pytho... | From https://www.saltycrane.com/blog/2009/11/trying-out-retry-decorator-python/ Retry calling the decorated function using an exponential backoff. http://www.saltycrane.com/blog/2009/11/trying-out-retry-decorator-python/ original from: http://wiki.python.org/moin/PythonDecoratorLibrary#Retry :param exception_to_check: ... |
4,007 | import time
from functools import wraps
from typing import Tuple, Type, Union
from requests import Response
from promptflow._utils.logger_utils import LoggerFactory
logger = LoggerFactory.get_logger(__name__)
HTTP_RETRY_CODES = set(range(999)) - HTTP_SAFE_CODES
The provided code snippet includes necessary dependencies... | :param f: function to be retried, should return a Response object. :type f: Callable :param tries: number of times to try (not retry) before giving up :type tries: int :param delay: initial delay between retries in seconds :type delay: int :param backoff: backoff multiplier e.g. value of 2 will double the delay each re... |
4,008 | import logging
import os
import signal
import psutil
from promptflow._utils.logger_utils import bulk_logger
The provided code snippet includes necessary dependencies for implementing the `block_terminate_signal_to_parent` function. Write a Python function `def block_terminate_signal_to_parent()` to solve the following... | In uvicorn app, the main process listens for requests and handles graceful shutdowns through signal listeners set up at initialization. These listeners use a file descriptor for event notifications. However, when a child process is forked within the application, it inherits this file descriptor, leading to an issue whe... |
4,009 | import logging
import os
import signal
import psutil
from promptflow._utils.logger_utils import bulk_logger
The provided code snippet includes necessary dependencies for implementing the `get_available_max_worker_count` function. Write a Python function `def get_available_max_worker_count(logger: logging.Logger = bulk... | When creating processes using the spawn method, it consumes certain resources. So we can use this method to determine how many workers can be maximally created. |
4,010 | import logging
import os
from pathlib import Path
from typing import Any, Dict, List, Tuple, Union
from promptflow.exceptions import ErrorTarget, UserErrorException
def load_df(local_path: Union[str, Path], logger: logging.Logger = None, max_rows_count: int = None) -> "DataFrame":
"""load data from local file to df... | load data from local file |
4,011 | 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._constants import DEFAULT_OUTPUT_NAME
from promptflow._core.generator_proxy import GeneratorProxy
from promptflow.contracts.tool import ConnectionT... | null |
4,012 | 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._constants import DEFAULT_OUTPUT_NAME
from promptflow._core.generator_proxy import GeneratorProxy
from promptflow.contracts.tool import ConnectionT... | null |
4,013 | 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._constants import DEFAULT_OUTPUT_NAME
from promptflow._core.generator_proxy import GeneratorProxy
from promptflow.contracts.tool import ConnectionT... | 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(out... |
4,014 | import datetime
import json
import logging
from promptflow._constants import (
CLI_PACKAGE_NAME,
CURRENT_VERSION,
GET_PYPI_INTERVAL_DAY,
HINT_INTERVAL_DAY,
LAST_CHECK_TIME,
LAST_HINT_TIME,
LATEST_VERSION,
PF_VERSION_CHECK,
)
from promptflow._sdk._constants import HOME_PROMPT_FLOW_DIR
def... | Get the latest versions from a cached file |
4,015 | import datetime
import json
import logging
from promptflow._constants import (
CLI_PACKAGE_NAME,
CURRENT_VERSION,
GET_PYPI_INTERVAL_DAY,
HINT_INTERVAL_DAY,
LAST_CHECK_TIME,
LAST_HINT_TIME,
LATEST_VERSION,
PF_VERSION_CHECK,
)
from promptflow._sdk._constants import HOME_PROMPT_FLOW_DIR
log... | Check if there is a new version of prompt flow available every 7 days. IF yes, log debug info to hint customer to upgrade package. |
4,016 | import json
import os
from datetime import datetime
from enum import Enum
from traceback import TracebackException, format_tb
from types import TracebackType, FrameType
from promptflow.exceptions import PromptflowException, SystemErrorException, UserErrorException, ValidationException
The provided code snippet include... | Return the nth tb_next of input tb. If the tb does not have n tb_next, return the last tb which has a value. n = next_cnt |
4,017 | import json
import os
from datetime import datetime
from enum import Enum
from traceback import TracebackException, format_tb
from types import TracebackType, FrameType
from promptflow.exceptions import PromptflowException, SystemErrorException, UserErrorException, ValidationException
The provided code snippet include... | Return the line number where the error occurred. |
4,018 | import json
import os
from datetime import datetime
from enum import Enum
from traceback import TracebackException, format_tb
from types import TracebackType, FrameType
from promptflow.exceptions import PromptflowException, SystemErrorException, UserErrorException, ValidationException
class RootErrorCode:
USER_ERRO... | null |
4,019 | import json
import os
from datetime import datetime
from enum import Enum
from traceback import TracebackException, format_tb
from types import TracebackType, FrameType
from promptflow.exceptions import PromptflowException, SystemErrorException, UserErrorException, ValidationException
The provided code snippet include... | Check if the frame is from promptflow core code. |
4,020 | import json
import os
from datetime import datetime
from enum import Enum
from traceback import TracebackException, format_tb
from types import TracebackType, FrameType
from promptflow.exceptions import PromptflowException, SystemErrorException, UserErrorException, ValidationException
The provided code snippet include... | Given a string, removes specified suffix, if it has. >>> remove_suffix('hello world', 'world') 'hello ' >>> remove_suffix('hello world', 'hello ') 'hello world' >>> remove_suffix('NoColumnFoundError', 'Error') 'NoColumnFound' :param text: string from which prefix will be removed. :param suffix: suffix to be removed. :r... |
4,021 | import importlib
import inspect
import logging
import re
from dataclasses import asdict, fields, is_dataclass
from enum import Enum, EnumMeta
from typing import Any, Callable, Dict, List, Union, get_args, get_origin
from jinja2 import Environment, meta
from promptflow._constants import PF_MAIN_MODULE_NAME
from promptfl... | null |
4,022 | import importlib
import inspect
import logging
import re
from dataclasses import asdict, fields, is_dataclass
from enum import Enum, EnumMeta
from typing import Any, Callable, Dict, List, Union, get_args, get_origin
from jinja2 import Environment, meta
from promptflow._constants import PF_MAIN_MODULE_NAME
from promptfl... | Translate a function to tool definition. :param f: Function to be translated. :param type: Tool type :param initialize_inputs: The initialize() func inputs get by get_initialize_inputs() when function defined in class. We will merge those inputs with f() inputs. :return: The tool definition. |
4,023 | import importlib
import inspect
import logging
import re
from dataclasses import asdict, fields, is_dataclass
from enum import Enum, EnumMeta
from typing import Any, Callable, Dict, List, Union, get_args, get_origin
from jinja2 import Environment, meta
from promptflow._constants import PF_MAIN_MODULE_NAME
from promptfl... | Get all input variable names and definitions from a jinja2 template string. : param template_str: template string : type t: str : return: the input name to InputDefinition dict : rtype t: Dict[str, ~promptflow.contracts.tool.InputDefinition] Example: >>> get_inputs_for_prompt_template( template_str="A simple prompt wit... |
4,024 | import importlib
import inspect
import logging
import re
from dataclasses import asdict, fields, is_dataclass
from enum import Enum, EnumMeta
from typing import Any, Callable, Dict, List, Union, get_args, get_origin
from jinja2 import Environment, meta
from promptflow._constants import PF_MAIN_MODULE_NAME
from promptfl... | Get the param name of prompt template on provider. |
4,025 | import importlib
import inspect
import logging
import re
from dataclasses import asdict, fields, is_dataclass
from enum import Enum, EnumMeta
from typing import Any, Callable, Dict, List, Union, get_args, get_origin
from jinja2 import Environment, meta
from promptflow._constants import PF_MAIN_MODULE_NAME
from promptfl... | null |
4,026 | import importlib
import inspect
import logging
import re
from dataclasses import asdict, fields, is_dataclass
from enum import Enum, EnumMeta
from typing import Any, Callable, Dict, List, Union, get_args, get_origin
from jinja2 import Environment, meta
from promptflow._constants import PF_MAIN_MODULE_NAME
from promptfl... | Append workspace triple to func input params. :param func_sig_params: function signature parameters, full params. :param func_input_params_dict: user input param key-values for dynamic list function. :param ws_triple_dict: workspace triple dict, including subscription_id, resource_group_name, workspace_name. :return: c... |
4,027 | import importlib
import inspect
import logging
import re
from dataclasses import asdict, fields, is_dataclass
from enum import Enum, EnumMeta
from typing import Any, Callable, Dict, List, Union, get_args, get_origin
from jinja2 import Environment, meta
from promptflow._constants import PF_MAIN_MODULE_NAME
from promptfl... | Load a function from a function path. The function path should be in the format of "module_name.function_name". |
4,028 | import importlib
import inspect
import logging
import re
from dataclasses import asdict, fields, is_dataclass
from enum import Enum, EnumMeta
from typing import Any, Callable, Dict, List, Union, get_args, get_origin
from jinja2 import Environment, meta
from promptflow._constants import PF_MAIN_MODULE_NAME
from promptfl... | Automatically adds an index to the inputs of a tool based on their order in the tool's YAML. This function directly modifies the tool without returning any value. Example: - tool (dict): A dictionary representing a tool configuration. Inputs do not contain 'ui_hints': { 'name': 'My Custom LLM Tool', 'type': 'custom_llm... |
4,029 | import importlib
import inspect
import logging
import re
from dataclasses import asdict, fields, is_dataclass
from enum import Enum, EnumMeta
from typing import Any, Callable, Dict, List, Union, get_args, get_origin
from jinja2 import Environment, meta
from promptflow._constants import PF_MAIN_MODULE_NAME
from promptfl... | null |
4,030 | import importlib
import inspect
import logging
import re
from dataclasses import asdict, fields, is_dataclass
from enum import Enum, EnumMeta
from typing import Any, Callable, Dict, List, Union, get_args, get_origin
from jinja2 import Environment, meta
from promptflow._constants import PF_MAIN_MODULE_NAME
from promptfl... | null |
4,031 | import asyncio
import contextvars
from concurrent.futures import ThreadPoolExecutor
from promptflow._utils.utils import set_context
def _has_running_loop() -> bool:
"""Check if the current thread has a running event loop."""
# When using asyncio.get_running_loop(), a RuntimeError is raised if there is no runnin... | Run an async function in a new thread, allowing the current thread to have a running event loop. When run in an async environment (e.g., in a notebook), because each thread allows only one event loop, using asyncio.run directly leads to a RuntimeError ("asyncio.run() cannot be called from a running event loop"). To add... |
4,032 | from typing import AbstractSet, Any, Dict, List, Mapping
from promptflow._utils.logger_utils import logger
from promptflow.contracts.flow import Flow, FlowInputDefinition, InputAssignment, InputValueType
from promptflow.contracts.run_info import FlowRunInfo, Status
from promptflow.executor import _input_assignment_pars... | null |
4,033 | from typing import AbstractSet, Any, Dict, List, Mapping
from promptflow._utils.logger_utils import logger
from promptflow.contracts.flow import Flow, FlowInputDefinition, InputAssignment, InputValueType
from promptflow.contracts.run_info import FlowRunInfo, Status
from promptflow.executor import _input_assignment_pars... | Handle line failures in batch run |
4,034 | from typing import AbstractSet, Any, Dict, List, Mapping
from promptflow._utils.logger_utils import logger
from promptflow.contracts.flow import Flow, FlowInputDefinition, InputAssignment, InputValueType
from promptflow.contracts.run_info import FlowRunInfo, Status
from promptflow.executor import _input_assignment_pars... | Collect the values from the kvs according to the indexes. |
4,035 | from typing import AbstractSet, Any, Dict, List, Mapping
from promptflow._utils.logger_utils import logger
from promptflow.contracts.flow import Flow, FlowInputDefinition, InputAssignment, InputValueType
from promptflow.contracts.run_info import FlowRunInfo, Status
from promptflow.executor import _input_assignment_pars... | Extract the aggregation inputs of a flow from the nodes outputs. |
4,036 | import contextlib
import os
import sys
The provided code snippet includes necessary dependencies for implementing the `_change_working_dir` function. Write a Python function `def _change_working_dir(path, mkdir=True)` to solve the following problem:
Context manager for changing the current working directory
Here is t... | Context manager for changing the current working directory |
4,037 | import contextlib
import os
import sys
def inject_sys_path(path):
original_sys_path = sys.path.copy()
sys.path.insert(0, str(path))
try:
yield
finally:
sys.path = original_sys_path | null |
4,038 | from dataclasses import dataclass
from enum import Enum
from typing import Optional
class FeatureState(Enum):
"""The enum of feature state.
READY: The feature is ready to use.
E2ETEST: The feature is not ready to be shipped to customer and is in e2e testing.
"""
READY = "Ready"
E2ETEST = "E2ETes... | null |
4,039 | import io
import re
from jinja2 import Template
from .yaml_utils import dump_yaml, load_yaml_string
def generate_custom_strong_type_connection_spec(cls, package, package_version):
connection_spec = {
"connectionCategory": "CustomKeys",
"flowValueType": "CustomConnection",
"connectionType": ... | null |
4,040 | import io
import re
from jinja2 import Template
from .yaml_utils import dump_yaml, load_yaml_string
def render_comments(connection_template, cls, secrets, configs):
if cls.__doc__ is not None:
data = load_yaml_string(connection_template)
comments_map = extract_comments_mapping(list(secrets) + list(c... | null |
4,041 | import base64
import os
import re
import uuid
from functools import partial
from pathlib import Path
from typing import Any, Callable, Dict
from urllib.parse import urlparse
import requests
from promptflow._utils._errors import InvalidImageInput, LoadMultimediaDataError
from promptflow.contracts.flow import FlowInputDe... | null |
4,042 | import base64
import os
import re
import uuid
from functools import partial
from pathlib import Path
from typing import Any, Callable, Dict
from urllib.parse import urlparse
import requests
from promptflow._utils._errors import InvalidImageInput, LoadMultimediaDataError
from promptflow.contracts.flow import FlowInputDe... | null |
4,043 | import base64
import os
import re
import uuid
from functools import partial
from pathlib import Path
from typing import Any, Callable, Dict
from urllib.parse import urlparse
import requests
from promptflow._utils._errors import InvalidImageInput, LoadMultimediaDataError
from promptflow.contracts.flow import FlowInputDe... | null |
4,044 | import base64
import os
import re
import uuid
from functools import partial
from pathlib import Path
from typing import Any, Callable, Dict
from urllib.parse import urlparse
import requests
from promptflow._utils._errors import InvalidImageInput, LoadMultimediaDataError
from promptflow.contracts.flow import FlowInputDe... | null |
4,045 | import base64
import os
import re
import uuid
from functools import partial
from pathlib import Path
from typing import Any, Callable, Dict
from urllib.parse import urlparse
import requests
from promptflow._utils._errors import InvalidImageInput, LoadMultimediaDataError
from promptflow.contracts.flow import FlowInputDe... | null |
4,046 | from copy import deepcopy
from promptflow._core.generator_proxy import GeneratorProxy
The provided code snippet includes necessary dependencies for implementing the `_deep_copy_and_extract_items_from_generator_proxy` function. Write a Python function `def _deep_copy_and_extract_items_from_generator_proxy(value: object... | Deep copy value, and if there is a GeneratorProxy, deepcopy the items from it. :param value: Any object. :type value: Object :return: Deep copied value. :rtype: Object |
4,047 | import json
import logging
import os
import sys
from contextvars import ContextVar
from dataclasses import dataclass
from functools import partial
from typing import List, Optional
from promptflow._constants import PF_LOGGING_LEVEL
from promptflow._utils.credential_scrubber import CredentialScrubber
from promptflow._ut... | null |
4,048 | import json
import logging
import os
import sys
from contextvars import ContextVar
from dataclasses import dataclass
from functools import partial
from typing import List, Optional
from promptflow._constants import PF_LOGGING_LEVEL
from promptflow._utils.credential_scrubber import CredentialScrubber
from promptflow._ut... | Scrub credentials in string s. For example, for input string: "print accountkey=accountKey", the output will be: "print accountkey=**data_scrubbed**" |
4,049 | import json
import logging
import os
import sys
from contextvars import ContextVar
from dataclasses import dataclass
from functools import partial
from typing import List, Optional
from promptflow._constants import PF_LOGGING_LEVEL
from promptflow._utils.credential_scrubber import CredentialScrubber
from promptflow._ut... | Get logger used by CLI SDK. |
4,050 | import inspect
import json
import jsonschema
from promptflow._constants import ICON, ICON_DARK, ICON_LIGHT, SKIP_FUNC_PARAMS, TOOL_SCHEMA
def _validate_input_settings(tool_inputs, input_settings):
"""
Check whether input settings of the tool are legitimate.
:param tool_inputs: Tool inputs
:type tool_inp... | 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] :return: Validation result of ... |
4,051 | import inspect
import json
import jsonschema
from promptflow._constants import ICON, ICON_DARK, ICON_LIGHT, SKIP_FUNC_PARAMS, TOOL_SCHEMA
The provided code snippet includes necessary dependencies for implementing the `_validate_tool_schema` function. Write a Python function `def _validate_tool_schema(tool_dict)` to so... | Check whether the generated schema of the tool are legitimate. :param tool_dict: The generated tool dict :type tool_dict: Dict[str, obj] :return: Validation result of the tool :rtype: str |
4,052 | import importlib.util
import inspect
import json
import logging
import multiprocessing
import os
import re
import types
from pathlib import Path
from traceback import TracebackException
from typing import Mapping
from jinja2 import TemplateSyntaxError
from jinja2.environment import COMMENT_END_STRING, COMMENT_START_STR... | null |
4,053 | import importlib.util
import inspect
import json
import logging
import multiprocessing
import os
import re
import types
from pathlib import Path
from traceback import TracebackException
from typing import Mapping
from jinja2 import TemplateSyntaxError
from jinja2.environment import COMMENT_END_STRING, COMMENT_START_STR... | null |
4,054 | import importlib.util
import inspect
import json
import logging
import multiprocessing
import os
import re
import types
from pathlib import Path
from traceback import TracebackException
from typing import Mapping
from jinja2 import TemplateSyntaxError
from jinja2.environment import COMMENT_END_STRING, COMMENT_START_STR... | null |
4,055 | import importlib.util
import inspect
import json
import logging
import multiprocessing
import os
import re
import types
from pathlib import Path
from traceback import TracebackException
from typing import Mapping
from jinja2 import TemplateSyntaxError
from jinja2.environment import COMMENT_END_STRING, COMMENT_START_STR... | :param working_dir: The working directory where the tools are located. :type working_dir: Path :param tools: A dictionary of tool sources and their configurations. :type tools: Mapping[str, Mapping[str, str]] :param input_logger: The logger to log the input. :type input_logger: logging.Logger :param timeout: The timeou... |
4,056 | import importlib.util
import inspect
import json
import logging
import multiprocessing
import os
import re
import types
from pathlib import Path
from traceback import TracebackException
from typing import Mapping
from jinja2 import TemplateSyntaxError
from jinja2.environment import COMMENT_END_STRING, COMMENT_START_STR... | null |
4,057 | import inspect
import logging
from abc import ABC
from dataclasses import InitVar, asdict, dataclass, field
from enum import Enum
from typing import Callable, Dict, List, Optional, Union
from promptflow.tracing._trace import _traced
from promptflow.tracing.contracts.trace import TraceType
STREAMING_OPTION_PARAMETER_ATT... | Decorator for tool functions. The decorated function will be registered as a tool and can be used in a flow. :param name: The tool name. :type name: str :param description: The tool description. :type description: str :param type: The tool type. :type type: str :param input_settings: Dict of input setting. :type input_... |
4,058 | import inspect
import logging
from abc import ABC
from dataclasses import InitVar, asdict, dataclass, field
from enum import Enum
from typing import Callable, Dict, List, Optional, Union
from promptflow.tracing._trace import _traced
from promptflow.tracing.contracts.trace import TraceType
The provided code snippet inc... | Parse args + kwargs to kwargs. |
4,059 | import inspect
from typing import Callable
class MetricLoggerManager:
_instance = None
def __init__(self):
self._metric_loggers = []
def get_instance() -> "MetricLoggerManager":
if MetricLoggerManager._instance is None:
MetricLoggerManager._instance = MetricLoggerManager()
... | Log a metric for current promptflow run. :param key: Metric name. :type key: str :param value: Metric value. :type value: float :param variant_id: Variant id for the metric. :type variant_id: str |
4,060 | import inspect
from typing import Callable
class MetricLoggerManager:
def __init__(self):
def get_instance() -> "MetricLoggerManager":
def log_metric(self, key, value, variant_id=None):
def add_metric_logger(self, logger_func: Callable):
def remove_metric_logger(self, logger_func: Callable):
d... | null |
4,061 | import inspect
from typing import Callable
class MetricLoggerManager:
_instance = None
def __init__(self):
self._metric_loggers = []
def get_instance() -> "MetricLoggerManager":
if MetricLoggerManager._instance is None:
MetricLoggerManager._instance = MetricLoggerManager()
... | null |
4,062 | import hashlib
import json
from dataclasses import dataclass
from typing import Callable, List
from promptflow._utils.logger_utils import flow_logger
from promptflow.contracts.run_info import RunInfo
from promptflow.storage import AbstractCacheStorage, AbstractRunStorage
PROMPTFLOW_HASH_ATTR = "__promptflow_hash_func"
... | null |
4,063 | import hashlib
import json
from dataclasses import dataclass
from typing import Callable, List
from promptflow._utils.logger_utils import flow_logger
from promptflow.contracts.run_info import RunInfo
from promptflow.storage import AbstractCacheStorage, AbstractRunStorage
def set_calculate_cache_func(tool_func, calculat... | null |
4,064 | import importlib
import importlib.util
import inspect
import logging
import traceback
import types
from functools import partial
from pathlib import Path
from typing import Callable, Dict, List, Mapping, Optional, Tuple, Union
from promptflow._core._errors import (
InputTypeMismatch,
InvalidSource,
MissingR... | null |
4,065 | import importlib
import importlib.util
import inspect
import logging
import traceback
import types
from functools import partial
from pathlib import Path
from typing import Callable, Dict, List, Mapping, Optional, Tuple, Union
from promptflow._core._errors import (
InputTypeMismatch,
InvalidSource,
MissingR... | Collect all tools from all installed packages. |
4,066 | import importlib
import importlib.util
import inspect
import logging
import traceback
import types
from functools import partial
from pathlib import Path
from typing import Callable, Dict, List, Mapping, Optional, Tuple, Union
from promptflow._core._errors import (
InputTypeMismatch,
InvalidSource,
MissingR... | Collect all tools and custom strong type connections from all installed packages. |
4,067 | import importlib
import importlib.util
import inspect
import logging
import traceback
import types
from functools import partial
from pathlib import Path
from typing import Callable, Dict, List, Mapping, Optional, Tuple, Union
from promptflow._core._errors import (
InputTypeMismatch,
InvalidSource,
MissingR... | null |
4,068 | import importlib
import importlib.util
import inspect
import logging
import traceback
import types
from functools import partial
from pathlib import Path
from typing import Callable, Dict, List, Mapping, Optional, Tuple, Union
from promptflow._core._errors import (
InputTypeMismatch,
InvalidSource,
MissingR... | null |
4,069 | import importlib
import importlib.util
import inspect
import logging
import traceback
import types
from functools import partial
from pathlib import Path
from typing import Callable, Dict, List, Mapping, Optional, Tuple, Union
from promptflow._core._errors import (
InputTypeMismatch,
InvalidSource,
MissingR... | null |
4,070 | import importlib
import importlib.util
import inspect
import logging
import traceback
import types
from functools import partial
from pathlib import Path
from typing import Callable, Dict, List, Mapping, Optional, Tuple, Union
from promptflow._core._errors import (
InputTypeMismatch,
InvalidSource,
MissingR... | null |
4,071 | import importlib
import importlib.util
import inspect
import logging
import traceback
import types
from functools import partial
from pathlib import Path
from typing import Callable, Dict, List, Mapping, Optional, Tuple, Union
from promptflow._core._errors import (
InputTypeMismatch,
InvalidSource,
MissingR... | null |
4,072 | import importlib
import importlib.util
import inspect
import logging
import traceback
import types
from functools import partial
from pathlib import Path
from typing import Callable, Dict, List, Mapping, Optional, Tuple, Union
from promptflow._core._errors import (
InputTypeMismatch,
InvalidSource,
MissingR... | null |
4,073 | import importlib
import importlib.util
import inspect
import logging
import traceback
import types
from functools import partial
from pathlib import Path
from typing import Callable, Dict, List, Mapping, Optional, Tuple, Union
from promptflow._core._errors import (
InputTypeMismatch,
InvalidSource,
MissingR... | null |
4,074 | import io
from pathlib import Path
from promptflow._constants import ICON, ICON_DARK, ICON_LIGHT
from promptflow._utils.multimedia_utils import convert_multimedia_data_to_base64
from promptflow._utils.tool_utils import asdict_without_none
from promptflow.contracts.multimedia import Image
from promptflow.exceptions impo... | Parser input settings to dict :param tool_inputs: Tool inputs :type tool_inputs: Dict[str, obj] :param input_settings: Input settings of the tool :type input_settings: Dict[str, obj] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.