Skip to content

Model Initialization Fails with VertexAI.model_rebuild() Error and Dependency Conflicts in NeMo Guardrails 0.16.0 with Vertex AI Gemini #1418

@harshithkc9797-stack

Description

@harshithkc9797-stack

Did you check docs and existing issues?

  • I have read all the NeMo-Guardrails docs
  • I have updated the package to the latest version before submitting this issue
  • (optional) I have used the develop branch
  • I have searched the existing issues of NeMo-Guardrails

Python version (python --version)

3.11

Operating system/version

windows

NeMo-Guardrails version (if you must use a specific version and not the latest

0.16.0

Describe the bug

I'm experiencing two critical errors when initializing NeMo Guardrails 0.16.0 with Vertex AI integration:

ActionResult Import Error: Failed to register actions.py from actions.py in action dispatcher due to exception: cannot import name 'ActionResult' from 'nemoguardrails.actions.action_dispatcher'

VertexAI Pydantic Error: Failed to initialize model 'gemini-2.0-flash-001' with provider 'vertexai' in 'chat' mode: 'VertexAI' is not fully defined; you should define '_LanguageModel', then call 'VertexAI.model_rebuild()'

Environment Details
Python version: Python 3.11.x

Operating system: Windows 11

NeMo-Guardrails version: 0.16.0

langchain-google-vertexai version: Latest

Vertex AI integration: Google Cloud Project with service account authentication

Error Output
text
✅ NeMo Guardrails imports successful

Testing NeMo Guardrails 0.16.0 Setup

✅ Google API Key found: AIzaSyBsl1...
✅ Credentials file found: C:\Users\harshith.kc\Downloads\customizationagents\customization-agents.json
✅ Vertex AI initialized successfully
✅ Guardrails config created successfully
Failed to register actions.py from actions.py in action dispatcher due to exception: cannot import name 'ActionResult' from 'nemoguardrails.actions.action_dispatcher'
❌ Guardrails test failed: Failed to initialize model 'gemini-2.0-flash-001' with provider 'vertexai' in 'chat' mode: VertexAI is not fully defined; you should define _LanguageModel, then call VertexAI.model_rebuild().

Steps To Reproduce

Install NeMo Guardrails 0.16.0 with Vertex AI dependencies

Create a standard guardrails configuration with:

config.yml with Vertex AI model configuration

actions.py with custom actions using @action decorator

rails.co with Colang 1.0 syntax flows

Initialize LLMRails(config) in Python code

Error occurs during initialization

Expected Behavior

NeMo Guardrails should initialize successfully without import errors

Custom actions should register properly using the @action decorator

Vertex AI integration should work seamlessly with proper model initialization

Actual Behavior

ActionResult Import Error: The system attempts to import ActionResult from nemoguardrails.actions.action_dispatcher, which appears to be removed or relocated in version 0.16.0

VertexAI Initialization Error: Even after calling VertexAI.model_rebuild(), the Pydantic model remains incompletely defined during NeMo Guardrails initialization

LLMRails fails to initialize, preventing the guardrails system from working

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstatus: needs triageNew issues that have not yet been reviewed or categorized.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions