Filters and suppresses noisy warnings in CLI environments. Use this to clean up console output during execution of AI-related command-line tools.
# Source: https://github.com/MervinPraison/PraisonAI | License: MIT
# Provided via justclaw.it.com; keep this notice with the code.
# praisonai/cli/_warnings.py
"""Lightweight warning filter support for CLI usage.
This module contains self-contained warning filter functions that were
previously in cli/main.py. Extracted to avoid importing the heavy 7000-line
main.py module (with its yaml/rich/dotenv dependencies) just to set up
warning filters.
"""
import warnings
import atexit
_SUPPRESSED_PATTERNS = (
"Pydantic serializer warnings",
"PydanticSerializationUnexpectedValue",
"Expected ", # Narrowed from just "Expected" to avoid false positives
"StreamingChoices",
"serialized value may not be as expected",
"duckduckgo_search",
)
_installed = False
_original_showwa
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key