LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows
Python ai-agentsdata-engineeringdocument-aigenerative-aiidpjson-extractionllmmcp-serverocrpdf-extractionprompt-engineeringstructured-output
UN-2950 [MISC] Modify check_feature_flag_status to handle None namespace_key and Support ENV based default value (#1645)
Ritwik G53138070c7cb
diff --git a/unstract/flags/src/unstract/flags/feature_flag.py b/unstract/flags/src/unstract/flags/feature_flag.pyindex 8785285dd..8b86335f6 100644--- a/unstract/flags/src/unstract/flags/feature_flag.py+++ b/unstract/flags/src/unstract/flags/feature_flag.py@@ -10,25 +10,31 @@ logger = logging.getLogger(__name__)def check_feature_flag_status(flag_key: str,- namespace_key: str = "default",+ namespace_key: str | None = None,entity_id: str = "unstract",context: dict[str, str] | None = None,) -> bool:"""Check the status of a feature flag for a given entity.Args:- namespace_key (str): The namespace key of the feature flag.flag_key (str): The flag key of the feature flag.+ namespace_key (str | None): The namespace key of the feature flag.+ If None, the function will read the environment variable+ UNSTRACT_FEATURE_FLAG_NAMESPACE and fall back to "default".entity_id (str): The ID of the entity for which the feature flag status- is checked.+ is checked.context (dict, optional): Additional context data for evaluating the- feature flag. Defaults to None.+ feature flag. Defaults to None.Returns:bool:True if the feature flag is enabled for the entity, False otherwise."""try:+ # Resolve namespace: use provided value, or env var, or fallback.+ if namespace_key is None:+ namespace_key = os.environ.get("UNSTRACT_FEATURE_FLAG_NAMESPACE", "default")+FLIPT_SERVICE_AVAILABLE = (os.environ.get("FLIPT_SERVICE_AVAILABLE", "false").lower() == "true")