import os

from promptflow import tool
from promptflow.connections import CustomConnection

{{ function_import }}


@tool
def {{ tool_function }}(
{% for arg in tool_arg_list %}
    {{ arg.name }},
{% endfor %}
    connection: CustomConnection) -> str:

    # set environment variables
    for key, value in dict(connection).items():
        os.environ[key] = value

    # call the entry function
    return {{ entry_function }}(
    {% for arg in tool_arg_list %}
        {{ arg.name }}={{ arg.name }},
    {% endfor %}
    )
