NeMo-Guardrails icon indicating copy to clipboard operation
NeMo-Guardrails copied to clipboard

docs: Revise GS example

Open mikemckiernan opened this issue 7 months ago • 1 comments

Description

Revise the GS example:

  • Replace errant model_name field with model in config.yml.
  • Remove printing the LLM timing calls.

Related Issue(s)

Checklist

  • [ ] I've read the CONTRIBUTING guidelines.
  • [ ] I've updated the documentation if applicable.
  • [ ] I've added tests if applicable.
  • [ ] @mentions of the person or team responsible for reviewing proposed changes.

mikemckiernan avatar Apr 25 '25 12:04 mikemckiernan

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 68.43%. Comparing base (36d625e) to head (87eec19).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #1146   +/-   ##
========================================
  Coverage    68.43%   68.43%           
========================================
  Files          161      161           
  Lines        15943    15943           
========================================
  Hits         10910    10910           
  Misses        5033     5033           
Flag Coverage Δ
python 68.43% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov-commenter avatar May 08 '25 18:05 codecov-commenter

Thank you @mikemckiernan , I still owe you a bug fix/triage.

langchain-nvidia-ai-endpoints will be supported as an optional dependency of nemoguardrails. (see #1105 )

do you think it is good to change the first to steps into one:

pip install "nemoguardrails[nvidia]"

I can go either way. The only thing that comes to mind against this update is that other than nemoguardrails[openai], for any other LangChain client, customers need to install the package themselves. Unless someone feels strongly, I guess I prefer the consistency of independent package installation. But not wed to it.

mikemckiernan avatar May 09 '25 12:05 mikemckiernan

@mikemckiernan the explain issue should be resolved in #1194

Pouyanpi avatar May 14 '25 16:05 Pouyanpi

@mikemckiernan the explain issue should be resolved in #1194

I was optimistic! I rebased off upstream/develop, but in my hands, I still get the traceback:

Traceback (most recent call last):
  File "/home/local/repos/nemo-guard-tk/examples/configs/gs_content_safety/demo.py", line 76, in <module>
    rails.explain_info.print_llm_calls_summary()
  File "/home/local/repos/nemo-guard-tk/nemoguardrails/logging/explain.py", line 103, in print_llm_calls_summary
    f"{i+1}. Task `{llm_call.task}` took {llm_call.duration:.2f} seconds "
                                         ^^^^^^^^^^^^^^^^^^^^^^^
TypeError: unsupported format string passed to NoneType.__format__

In the debugger, I can see that the duration of the second call is None. Looks to me like someone else thought it could be None as well.

mikemckiernan avatar May 14 '25 17:05 mikemckiernan

@mikemckiernan the explain issue should be resolved in #1194

I was optimistic! I rebased off upstream/develop, but in my hands, I still get the traceback:

Traceback (most recent call last):
  File "/home/local/repos/nemo-guard-tk/examples/configs/gs_content_safety/demo.py", line 76, in <module>
    rails.explain_info.print_llm_calls_summary()
  File "/home/local/repos/nemo-guard-tk/nemoguardrails/logging/explain.py", line 103, in print_llm_calls_summary
    f"{i+1}. Task `{llm_call.task}` took {llm_call.duration:.2f} seconds "
                                         ^^^^^^^^^^^^^^^^^^^^^^^
TypeError: unsupported format string passed to NoneType.__format__

In the debugger, I can see that the duration of the second call is None. Looks to me like someone else thought it could be None as well.

Thanks, the information is useful. I'll try to fix it 👍🏻

Pouyanpi avatar May 14 '25 17:05 Pouyanpi

@mikemckiernan You should be able to create and push branches directly to the cloned repo, no need to use a fork since you have write access. But if you prefer to fork no objection from my side 😃

Pouyanpi avatar May 14 '25 18:05 Pouyanpi