Download src/backend/base/langflow/graph/vertex/utils.py from opendigital/agent-flow: direct link, hf CLI and curl.
- Browser
- Download file 743 Bytes
-
https://huggingface.co/opendigital/agent-flow/resolve/main/src/backend/base/langflow/graph/vertex/utils.py
- Command line
-
hf download hf://opendigital/agent-flow/src/backend/base/langflow/graph/vertex/utils.py
-
curl -L -o utils.py https://huggingface.co/opendigital/agent-flow/resolve/main/src/backend/base/langflow/graph/vertex/utils.py
743 Bytes
| from __future__ import annotations | |
| from typing import TYPE_CHECKING | |
| if TYPE_CHECKING: | |
| from langflow.graph.vertex.base import Vertex | |
| def build_clean_params(target: Vertex) -> dict: | |
| """Cleans the parameters of the target vertex.""" | |
| # Removes all keys that the values aren't python types like str, int, bool, etc. | |
| params = { | |
| key: value for key, value in target.params.items() if isinstance(value, str | int | bool | float | list | dict) | |
| } | |
| # if it is a list we need to check if the contents are python types | |
| for key, value in params.items(): | |
| if isinstance(value, list): | |
| params[key] = [item for item in value if isinstance(item, str | int | bool | float | list | dict)] | |
| return params | |