[project] name = "nemoguardrails" version = "0.25.0-rc1" description = "NeMo Guardrails is an open-source toolkit for easily adding programmable guardrails to LLM-based conversational systems." license = "Apache-2.0" license-files = ["LICENSE*", "LICENCES*"] readme = "README.md" requires-python = ">=3.10,<3.14" authors = [{ name = "NVIDIA", email = "nemoguardrails@nvidia.com" }] classifiers = [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] dependencies = [ "aiohttp (>=3.10.11)", "aiohttp-retry (>=2.9.0)", "dataclasses-json (>=0.6.7,<0.7.0)", "fastembed (>=0.2.2)", "onnxruntime (>=1.17.0,<1.24) ; python_version>='3.10' and python_version<'3.11'", "onnxruntime (>=1.17.0) ; python_version>='3.11'", "httpx (>=0.24.1)", "jinja2 (>=3.1.6)", "jsonschema (>=4.26.0,<5.0.0)", "lark (>=1.1.7)", "numpy (>=1.21) ; python_version>='3.10' and python_version<'3.12'", "numpy (>=1.26) ; python_version>='3.12' and python_version<'3.13'", "numpy (>=2.1.0) ; python_version>='3.13'", "prompt-toolkit (>=3.0)", "protobuf (>=5.29.5)", "pydantic (>=2.5,<3.0)", "pyyaml (>=6.0)", "rich (>=13.5.2)", "simpleeval (>=0.9.13)", "typer (>=0.8)", ] [project.optional-dependencies] nest-asyncio = ["nest-asyncio (>=1.5.6)"] tracing = ["opentelemetry-api (>=1.27.0,<2.0.0)", "aiofiles (>=24.1.0)"] server = [ "aiofiles (>=24.1.0)", "openai (>=1.0.0,<3.0.0)", "fastapi (>=0.103.0)", "starlette (>=0.49.1)", "uvicorn (>=0.23)", "watchdog (>=3.0.0)", "opentelemetry-api (>=1.27.0,<2.0.0)", "opentelemetry-sdk (>=1.27.0,<2.0.0)", "opentelemetry-exporter-prometheus (>=0.63b0,<1.0.0)", "prometheus-client (>=0.20.0,<2.0.0)", ] sdd = [ "presidio-analyzer (>=2.2) ; python_version<'3.13'", "presidio-anonymizer (>=2.2) ; python_version<'3.13'", ] gcp = ["google-cloud-language (>=2.14.0)"] jailbreak = ["yara-python (>=4.5.1,<5.0.0)"] cel = ["common-expression-language (>=0.10.0,<0.11.0) ; python_version>='3.11'"] multilingual = ["fast-langdetect (>=1.0.0)"] chat-ui = ["chainlit (>=2.11.0,<3.0.0)"] # eval eval = [ "tqdm (>=4.65,<5.0)", "streamlit (>=1.37.0,<2.0.0) ; python_version>='3.10' and python_version<'3.14'", "tornado (>=6.5.0) ; python_version>='3.10' and python_version<'3.14'", "pandas (>=1.4.0,<3.0.0)", "numpy (>=1.21) ; python_version>='3.10' and python_version<'3.12'", "numpy (>=1.26) ; python_version>='3.12' and python_version<'3.13'", "numpy (>=2.1.0) ; python_version>='3.13'", ] all = [ "presidio-analyzer (>=2.2) ; python_version<'3.13'", "presidio-anonymizer (>=2.2) ; python_version<'3.13'", "tqdm (>=4.65,<5.0)", "streamlit (>=1.37.0,<2.0.0) ; python_version>='3.10' and python_version<'3.14'", "tornado (>=6.5.0) ; python_version>='3.10' and python_version<'3.14'", "pandas (>=1.4.0,<3.0.0)", "numpy (>=1.21) ; python_version>='3.10' and python_version<'3.12'", "numpy (>=1.26) ; python_version>='3.12' and python_version<'3.13'", "numpy (>=2.1.0) ; python_version>='3.13'", "openai (>=1.0.0,<3.0.0)", "google-cloud-language (>=2.14.0)", "opentelemetry-api (>=1.27.0,<2.0.0)", "aiofiles (>=24.1.0)", "yara-python (>=4.5.1,<5.0.0)", "fast-langdetect (>=1.0.0)", "fastapi (>=0.103.0)", "starlette (>=0.49.1)", "uvicorn (>=0.23)", "watchdog (>=3.0.0)", "opentelemetry-sdk (>=1.27.0,<2.0.0)", "opentelemetry-exporter-prometheus (>=0.63b0,<1.0.0)", "prometheus-client (>=0.20.0,<2.0.0)", "chainlit (>=2.11.0,<3.0.0)", "common-expression-language (>=0.10.0,<0.11.0) ; python_version>='3.11'", ] [dependency-groups] lint = ["ruff==0.14.6"] typing = ["ty==0.0.56"] test = [ "pytest>=9.0.3,<10.0.0", "pytest-asyncio>=1.4.0,<2.0.0", "pytest-cov>=4.1.0", "pytest-httpx>=0.22.0", "pytest-xdist>=3.8.0,<4.0.0", "pytest-recording>=0.13.4,<0.14.0", "pytest-profiling>=1.7.0,<2.0.0", "inline-snapshot>=0.33.0,<0.34.0", ] test_integration = [ "aioresponses>=0.7.6", "streamlit>=1.37.0", "yara-python>=4.5.1,<5.0.0", "common-expression-language>=0.10.0,<0.11.0 ; python_version>='3.11'", "opentelemetry-api>=1.34.1,<2.0.0", "opentelemetry-sdk>=1.34.1,<2.0.0", "opentelemetry-exporter-prometheus>=0.63b0,<1.0.0", "prometheus-client>=0.20.0,<2.0.0", "fast-langdetect>=1.0.0", "openai>=1.0.0,<3.0.0", "fastapi>=0.103.0", "uvicorn>=0.23", "starlette>=0.49.1", "watchdog>=3.0.0", "chainlit>=2.11.0,<3.0.0", "langchain>=0.2.14,<2.0.0", "langchain-core>=0.2.14,<2.0.0", "langchain-community>=0.2.5,<2.0.0", "langchain-openai>=0.1.0", "langchain-nvidia-ai-endpoints>=0.2.0", ] dev = [ "pre-commit>=3.1.1", {include-group = "test"}, {include-group = "test_integration"}, {include-group = "lint"}, {include-group = "typing"}, ] [tool.uv] package = true exclude-newer = "7 days" # Flat layout: the importable package is ./nemoguardrails (not under ./src). # uv_build ships everything under the module dir (Python plus the .co/.lark/.yml # data files). The build helper stages the top-level examples under the module. [tool.uv.build-backend] module-root = "" module-name = "nemoguardrails" source-exclude = [ "/nemoguardrails/AGENTS.md", "/nemoguardrails/CLAUDE.md", "/nemoguardrails/library/AGENTS.md", ] # Directories in which to run ty type-checking [tool.ty.src] include = [ "nemoguardrails/rails/**", "nemoguardrails/actions/**", "nemoguardrails/llm/**", "nemoguardrails/embeddings/**", "nemoguardrails/cli/**", "nemoguardrails/kb/**", "nemoguardrails/logging/**", "nemoguardrails/tracing/**", "nemoguardrails/server/**", "nemoguardrails/guardrails/**", "nemoguardrails/manifests/**", "nemoguardrails/library/**/rail.py", "nemoguardrails/library/**/rail_config.py", "tests/recorded/**" ] exclude = [ "nemoguardrails/llm/providers/trtllm/**", ] [tool.ty.analysis] allowed-unresolved-imports = [ "aioredis", "cohere", "google.genai", ] [[tool.ty.overrides]] include = ["nemoguardrails/actions/v2_x/generation.py"] [tool.ty.overrides.rules] invalid-method-override = "ignore" [tool.pytest.ini_options] addopts = "-p no:warnings" log-level = "DEBUG" # The flag below should only be activated in special debug sessions # i.e. the test hangs and we need to see what happened up to that point. # There are some race conditions with how the logging streams are closed in the teardown # phase, which will cause tests to fail or "magically" ignored. log_cli = "False" [tool.inline-snapshot] format-command = "ruff format --stdin-filename {filename} -" [project.scripts] nemoguardrails = "nemoguardrails.__main__:app" [project.urls] homepage = "https://github.com/NVIDIA-NeMo/Guardrails" issues = "https://github.com/NVIDIA-NeMo/Guardrails/issues" changelog = "https://github.com/NVIDIA-NeMo/Guardrails/blob/develop/CHANGELOG.md" documentation = "https://docs.nvidia.com/nemo/guardrails/" repository = "https://github.com/NVIDIA-NeMo/Guardrails" [build-system] requires = ["uv_build>=0.11.17,<0.12.0"] build-backend = "uv_build"