NeMo Guardrails is an open-source toolkit developed by NVIDIA for adding programmable guardrails to LLM-based conversational systems. It helps define rules, enable safety, and ensure desired behavior for AI assistants. As of version 0.21.0, it supports flexible integration with various LLMs and frameworks, often releasing updates regularly to enhance features and stability.
pip install nemoguardrailsVerified import paths — ran on the pinned version, not inferred.
This quickstart initializes `NeMo Guardrails` with a basic configuration using OpenAI's GPT-3.5-turbo. It defines a simple greeting flow. Ensure your `OPENAI_API_KEY` environment variable is set for the example to successfully interact with the LLM.
Update imports from `from nemoguardrails.rails import ...` to `from nemoguardrails import ...`.
Custom LLM providers should now be registered either by passing them through the `RailsConfig` `config` dictionary or using `rails.register_llm_provider()`.
Use `RailsConfig.from_path(path)` to create a `RailsConfig` object, then pass it to the `LLMRails` constructor as `LLMRails(config=...)`.
Always `await` asynchronous methods within an `async` function and run the async function using `asyncio.run()` or similar mechanisms (e.g., in Jupyter).
Change your import statements from `from nemoguardrails.rails import ...` to `from nemoguardrails import ...`.
Set the API key as an environment variable (e.g., `export OPENAI_API_KEY='sk-...'`) or explicitly pass it in the `config` dictionary within your `RailsConfig`.
Ensure all calls to async methods like `generate_async` are prefixed with `await` and executed within an `async` function, which is then run using `asyncio.run()`.
If in an environment like Jupyter, use `await` directly in a cell if the environment supports it, or use `nest_asyncio` (`import nest_asyncio; nest_asyncio.apply()`) to allow nested event loops.
No dependency data recorded yet.