Skip to content

Conversation

tgasser-nv
Copy link
Collaborator

@tgasser-nv tgasser-nv commented Sep 8, 2025

Description

Only a few type-cleaning steps to add the actions server as a FastAPI Dependency to inject it into endpoint methods, rather than an attribute on the Fast API server. Also some logging cleanups (%s, not f-strings)

Test plan

Type-checking

$ pyright nemoguardrails/actions_server
0 errors, 0 warnings, 0 informations

Unit-tests

============================= test session starts ==============================
platform darwin -- Python 3.13.2, pytest-8.3.4, pluggy-1.5.0
rootdir: /Users/tgasser/projects/nemo_guardrails
configfile: pytest.ini
testpaths: tests, docs/colang-2/examples
plugins: cov-6.0.0, xdist-3.8.0, httpx-0.35.0, asyncio-0.25.3, anyio-4.8.0, profiling-1.8.1, langsmith-0.3.6
asyncio: mode=Mode.STRICT, asyncio_default_fixture_loop_scope=function
collected 1440 items

tests/colang/parser/test_basic.py ...                                    [  0%]
tests/colang/parser/v2_x/test_ast.py .                                   [  0%]

.......

============================================ 1340 passed, 100 skipped in 103.86s (0:01:43) ============================================

Action-server local test

Server-side

$ poetry run nemoguardrails actions-server
INFO:     Started server process [37991]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:8001 (Press CTRL+C to quit)
INFO:     127.0.0.1:50940 - "GET /v1/actions/list HTTP/1.1" 200 OK
INFO:     127.0.0.1:50941 - "GET /v1/actions/list HTTP/1.1" 200 OK
INFO:     127.0.0.1:50945 - "GET /v1/actions/list HTTP/1.1" 200 OK

Client-side

$  curl http://0.0.0.0:8001/v1/actions/list
["retrieve_relevant_chunks","create_event","wolfram alpha request","summarize_document","call_activefence_api","jailbreak_detection_heuristics","jailbreak_detection_model","protect_text","self_check_hallucination","GetAttentionPercentageAction","UpdateAttentionMaterializedViewAction","call cleanlab api","injection_detection","llama_guard_check_input","llama_guard_check_output","content_safety_check_input","content_safety_check_output","ClavataCheckAction","GetCurrentDateTimeAction","detect_sensitive_data","mask_sensitive_data","call gcpnlp api","topic_safety_check_input","validate_guardrails_ai_input","validate_guardrails_ai_output","call fiddler faithfulness","call fiddler safety on bot message","call fiddler safety on user message","pangea_ai_guard","autoalign_factcheck_output_api","autoalign_groundedness_output_api","autoalign_input_api","autoalign_output_api","alignscore_check_facts","alignscore request","self_check_facts","patronus_api_check_output","patronus_lynx_check_output_hallucination","self_check_input","self_check_output","detect_pii","mask_pii"]

Related Issue(s)

Top-level PR to combine all type-fixes into a single merge-to-develop: #1367

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.

@tgasser-nv tgasser-nv changed the base branch from develop to chore/type-clean-guardrails September 8, 2025 14:09
@tgasser-nv tgasser-nv self-assigned this Sep 8, 2025
@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 70.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.63%. Comparing base (71d00f0) to head (e8ee4da).

Files with missing lines Patch % Lines
nemoguardrails/actions_server/actions_server.py 70.00% 3 Missing ⚠️
Additional details and impacted files
@@                     Coverage Diff                      @@
##           chore/type-clean-guardrails    #1379   +/-   ##
============================================================
  Coverage                        71.62%   71.63%           
============================================================
  Files                              171      171           
  Lines                            17020    17023    +3     
============================================================
+ Hits                             12191    12194    +3     
  Misses                            4829     4829           
Flag Coverage Δ
python 71.63% <70.00%> (+<0.01%) ⬆️

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

Files with missing lines Coverage Δ
nemoguardrails/actions_server/actions_server.py 81.48% <70.00%> (+1.48%) ⬆️

... and 1 file with indirect coverage changes

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

@tgasser-nv
Copy link
Collaborator Author

Tagging @cparisien , @Pouyanpi , @trebedea for review

@tgasser-nv tgasser-nv changed the title chore(types): Type-clean actions_server chore(types): Type-clean /actions_server Sep 8, 2025
Copy link
Member

@trebedea trebedea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks cleaner! 👍

@tgasser-nv tgasser-nv changed the title chore(types): Type-clean /actions_server chore(types): Type-clean /actions_server (3 errors) Sep 10, 2025
Copy link
Collaborator

@Pouyanpi Pouyanpi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you Tim 👍🏻

@tgasser-nv tgasser-nv merged commit 7af0005 into chore/type-clean-guardrails Sep 16, 2025
50 checks passed
@tgasser-nv tgasser-nv deleted the chore/type-clean-actions_server branch September 16, 2025 20:37
tgasser-nv added a commit that referenced this pull request Sep 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants