Skip to content

Separate promptflow-core package #8362

Separate promptflow-core package

Separate promptflow-core package #8362

GitHub Actions / SDK CLI Test Result [brynn/separate-promptflow-core](https://github.com/microsoft/promptflow/actions/workflows/promptflow-sdk-cli-test.yml?query=branch:brynn/separate-promptflow-core++) failed Mar 26, 2024 in 0s

4 fail, 17 skipped, 441 pass in 41m 52s

    4 files      4 suites   41m 52s ⏱️
  462 tests   441 ✅ 17 💤  4 ❌
1 848 runs  1 764 ✅ 68 💤 16 ❌

Results for commit eae4d65.

Annotations

Check warning on line 0 in tests.sdk_cli_test.e2etests.test_flow_run.TestFlowRun

See this annotation in the file changed.

@github-actions github-actions / SDK CLI Test Result [brynn/separate-promptflow-core](https://github.com/microsoft/promptflow/actions/workflows/promptflow-sdk-cli-test.yml?query=branch:brynn/separate-promptflow-core++)

All 4 runs failed: test_basic_flow_with_script_tool_with_custom_strong_type_connection (tests.sdk_cli_test.e2etests.test_flow_run.TestFlowRun)

artifacts/Test Results (Python 3.10) (OS ubuntu-latest)/test-results-sdk-cli.xml [took 0s]
artifacts/Test Results (Python 3.11) (OS ubuntu-latest)/test-results-sdk-cli.xml [took 0s]
artifacts/Test Results (Python 3.8) (OS ubuntu-latest)/test-results-sdk-cli.xml [took 0s]
artifacts/Test Results (Python 3.9) (OS ubuntu-latest)/test-results-sdk-cli.xml [took 0s]
Raw output
AttributeError: 'CustomConnection' object has no attribute '_to_orm_object'
self = <sdk_cli_test.e2etests.test_flow_run.TestFlowRun object at 0x7f197f2af250>
install_custom_tool_pkg = None
local_client = <promptflow._sdk._pf_client.PFClient object at 0x7f1961dee940>
pf = <promptflow._sdk._pf_client.PFClient object at 0x7f19621fe250>

    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)

tests/sdk_cli_test/e2etests/test_flow_run.py:384: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
promptflow/_sdk/_telemetry/activity.py:265: in wrapper
    return f(self, *args, **kwargs)
promptflow/_sdk/operations/_connection_operations.py:82: in create_or_update
    orm_object = connection._to_orm_object()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <promptflow.core._connection.CustomConnection object at 0x7f1960998040>
item = '_to_orm_object'

    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)
E       AttributeError: 'CustomConnection' object has no attribute '_to_orm_object'

/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/promptflow/core/_connection.py:682: AttributeError

Check warning on line 0 in tests.sdk_cli_test.e2etests.test_flow_test.TestFlowTest

See this annotation in the file changed.

@github-actions github-actions / SDK CLI Test Result [brynn/separate-promptflow-core](https://github.com/microsoft/promptflow/actions/workflows/promptflow-sdk-cli-test.yml?query=branch:brynn/separate-promptflow-core++)

All 4 runs failed: test_pf_test_flow_with_package_tool_with_custom_connection_as_input_value (tests.sdk_cli_test.e2etests.test_flow_test.TestFlowTest)

artifacts/Test Results (Python 3.10) (OS ubuntu-latest)/test-results-sdk-cli.xml [took 0s]
artifacts/Test Results (Python 3.11) (OS ubuntu-latest)/test-results-sdk-cli.xml [took 0s]
artifacts/Test Results (Python 3.8) (OS ubuntu-latest)/test-results-sdk-cli.xml [took 0s]
artifacts/Test Results (Python 3.9) (OS ubuntu-latest)/test-results-sdk-cli.xml [took 0s]
Raw output
AttributeError: 'CustomConnection' object has no attribute '_to_orm_object'
self = <sdk_cli_test.e2etests.test_flow_test.TestFlowTest object at 0x7fc4cab3eb50>
install_custom_tool_pkg = None

    def test_pf_test_flow_with_package_tool_with_custom_connection_as_input_value(self, install_custom_tool_pkg):
        # Prepare custom connection
        from promptflow.connections import CustomConnection
    
        conn = CustomConnection(name="custom_connection_3", secrets={"api_key": "test"}, configs={"api_base": "test"})
>       _client.connections.create_or_update(conn)

tests/sdk_cli_test/e2etests/test_flow_test.py:69: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
promptflow/_sdk/_telemetry/activity.py:265: in wrapper
    return f(self, *args, **kwargs)
promptflow/_sdk/operations/_connection_operations.py:82: in create_or_update
    orm_object = connection._to_orm_object()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <promptflow.core._connection.CustomConnection object at 0x7fc4c409ac10>
item = '_to_orm_object'

    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)
E       AttributeError: 'CustomConnection' object has no attribute '_to_orm_object'

/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/promptflow/core/_connection.py:682: AttributeError

Check warning on line 0 in tests.sdk_cli_test.e2etests.test_flow_test.TestFlowTest

See this annotation in the file changed.

@github-actions github-actions / SDK CLI Test Result [brynn/separate-promptflow-core](https://github.com/microsoft/promptflow/actions/workflows/promptflow-sdk-cli-test.yml?query=branch:brynn/separate-promptflow-core++)

All 4 runs failed: test_pf_test_flow_with_script_tool_with_custom_strong_type_connection (tests.sdk_cli_test.e2etests.test_flow_test.TestFlowTest)

artifacts/Test Results (Python 3.10) (OS ubuntu-latest)/test-results-sdk-cli.xml [took 0s]
artifacts/Test Results (Python 3.11) (OS ubuntu-latest)/test-results-sdk-cli.xml [took 0s]
artifacts/Test Results (Python 3.8) (OS ubuntu-latest)/test-results-sdk-cli.xml [took 0s]
artifacts/Test Results (Python 3.9) (OS ubuntu-latest)/test-results-sdk-cli.xml [took 0s]
Raw output
AttributeError: 'CustomConnection' object has no attribute '_to_orm_object'
self = <sdk_cli_test.e2etests.test_flow_test.TestFlowTest object at 0x7fc4cab3eee0>

    def test_pf_test_flow_with_script_tool_with_custom_strong_type_connection(self):
        # Prepare custom connection
        from promptflow.connections import CustomConnection
    
        conn = CustomConnection(name="custom_connection_2", secrets={"api_key": "test"}, configs={"api_url": "test"})
>       _client.connections.create_or_update(conn)

tests/sdk_cli_test/e2etests/test_flow_test.py:83: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
promptflow/_sdk/_telemetry/activity.py:265: in wrapper
    return f(self, *args, **kwargs)
promptflow/_sdk/operations/_connection_operations.py:82: in create_or_update
    orm_object = connection._to_orm_object()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <promptflow.core._connection.CustomConnection object at 0x7fc4dba827f0>
item = '_to_orm_object'

    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)
E       AttributeError: 'CustomConnection' object has no attribute '_to_orm_object'

/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/promptflow/core/_connection.py:682: AttributeError

Check warning on line 0 in tests.sdk_cli_test.e2etests.test_flow_as_func.TestFlowAsFunc

See this annotation in the file changed.

@github-actions github-actions / SDK CLI Test Result [brynn/separate-promptflow-core](https://github.com/microsoft/promptflow/actions/workflows/promptflow-sdk-cli-test.yml?query=branch:brynn/separate-promptflow-core++)

All 4 runs failed: test_flow_with_default_variant (tests.sdk_cli_test.e2etests.test_flow_as_func.TestFlowAsFunc)

artifacts/Test Results (Python 3.10) (OS ubuntu-latest)/test-results-sdk-cli.xml [took 0s]
artifacts/Test Results (Python 3.11) (OS ubuntu-latest)/test-results-sdk-cli.xml [took 0s]
artifacts/Test Results (Python 3.8) (OS ubuntu-latest)/test-results-sdk-cli.xml [took 0s]
artifacts/Test Results (Python 3.9) (OS ubuntu-latest)/test-results-sdk-cli.xml [took 0s]
Raw output
AttributeError: 'AzureOpenAIConnection' object has no attribute '_to_dict'
self = <sdk_cli_test.e2etests.test_flow_as_func.TestFlowAsFunc object at 0x7fc4e462f0a0>
azure_open_ai_connection = <promptflow.core._connection.AzureOpenAIConnection object at 0x7fc4ace6cb80>

    def test_flow_with_default_variant(self, azure_open_ai_connection):
        f = load_flow(f"{FLOWS_DIR}/web_classification_default_variant_no_llm_type")
        f.context = FlowContext(
            connections={
                "summarize_text_content": {"connection": azure_open_ai_connection},
            }
        )
        # function can successfully run with connection override
>       f(url="https://www.youtube.com/watch?v=o5ZQyXaAv1g")

tests/sdk_cli_test/e2etests/test_flow_as_func.py:328: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
promptflow/_sdk/entities/_flow/base.py:239: in __call__
    result = self.invoke(inputs=kwargs)
promptflow/_sdk/entities/_flow/dag.py:155: in invoke
    return super().invoke(inputs=inputs)
promptflow/_sdk/entities/_flow/base.py:246: in invoke
    invoker = FlowContextResolver.resolve(flow=self)
promptflow/_sdk/entities/_flow/base.py:223: in __hash__
    return hash(self.context) ^ self._content_hash
promptflow/_sdk/entities/_flow/base.py:79: in __hash__
    self._resolve_connections()
promptflow/_sdk/entities/_flow/base.py:53: in _resolve_connections
    name = self._get_connection_obj_name(conn)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

cls = <class 'promptflow._sdk.entities._flow.base.FlowContext'>
connection = <promptflow.core._connection.AzureOpenAIConnection object at 0x7fc4ace6cb80>

    @classmethod
    def _get_connection_obj_name(cls, connection):
        # create a unique connection name for connection obj
        # will generate same name if connection has same content
>       connection_dict = connection._to_dict()
E       AttributeError: 'AzureOpenAIConnection' object has no attribute '_to_dict'

promptflow/_sdk/entities/_flow/base.py:61: AttributeError