NeMo Guardrailsnemoguardrails 0.24.0 · Python 3.10+
0%
1
Curious builder0 XP earned · 300 to level 2
0 daysFinish a lesson to begin
Badge collection0 of 6 unlocked
35 small wins to finish your pathNext lesson

Groq or Gemini in place of the stand-in

Everything in this course ran on the stand-in. Moving to a hosted model changes the models section of config.yml and one import, and it brings back the embedding download the course avoided.

The models sectionOptional

Lesson 1 set up a key. For a provider with an OpenAI-compatible API, NeMo's documentation uses the openai engine with that provider's base_url. With a free Groq key:

yaml
models:
  - type: main
    engine: openai
    model: openai/gpt-oss-120b
    api_key_env_var: GROQ_API_KEY
    parameters:
      base_url: https://api.groq.com/openai/v1

For Gemini, set model: gemini-2.5-flash, api_key_env_var: GEMINI_API_KEY and base_url: https://generativelanguage.googleapis.com/v1beta/openai/.

export GROQ_API_KEY=gsk_...

What else changes

Remove import pretend_nemo from config.py. The rails.llm.say calls in earlier lessons were the stand-in's, so tests that relied on them need a different way to fix the model's answer.

Remove the embeddings entry as well, or name a real embedding model. Without one, NeMo uses its default, all-MiniLM-L6-v2 through FastEmbed, and downloads it the first time a message is matched to an intent, as lesson 10 explained.

The prompts are where a real model differs most. The stand-in looked only at the words after Blocked topics:. A real model reads the whole prompt, so the self_check_input text should state what counts as blocked and ask for a one-word Yes or No answer, which is what lesson 14's parser expects.

This lesson has no captured output, because running it needs your key and a hosted model's wording changes from run to run.

Try it yourself
  • With a Groq key set, run the guarded assistant from lesson 34 on the real model.
  • Ask the real model a blocked question five times and check that the input rail refuses every time.
  • Print rails.explain().llm_calls[0].prompt after a real call and read what the model was sent.

Every expert started right here.