Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 114 additions & 0 deletions industries/asset_lifecycle_management_agent/.cursor.rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,120 @@ configs/
.env # Environment variables
```

## NAT Version Compatibility

### NAT 1.2.1 vs 1.3.0

**Current Version**: NAT 1.2.1 (with pydantic 2.10.x)

**Key Compatibility Rules**:

1. **Optional String Fields**:
```python
# ❌ WRONG - Will fail validation
elasticsearch_url: str = Field(default=None)

# ✅ CORRECT - Use Optional for nullable strings
from typing import Optional
elasticsearch_url: Optional[str] = Field(default=None)
```

2. **Reference Field Types (NAT 1.2.1)**:
```python
# NAT 1.2.1 uses plain strings for references
llm_name: str = Field(description="LLM reference")
embedding_name: str = Field(description="Embedder reference")
```

3. **Reference Field Types (NAT 1.3.0 - Future)**:
```python
# NAT 1.3.0 requires typed references
from nat.data_models.component_ref import LLMRef, EmbedderRef, FunctionRef

llm_name: LLMRef = Field(description="LLM reference")
embedding_name: EmbedderRef = Field(description="Embedder reference")
code_execution_tool: FunctionRef = Field(description="Function reference")
```

4. **YAML Configuration Quoting**:
```yaml
# Always quote string references in YAML configs for pydantic 2.10+
functions:
sql_retriever:
llm_name: "sql_llm" # Quoted
embedding_name: "vanna_embedder" # Quoted
vector_store_type: "chromadb" # Quoted
db_type: "sqlite" # Quoted

data_analysis_assistant:
tool_names: [
"sql_retriever", # All tool names quoted
"predict_rul",
"plot_distribution"
]
```

### Pydantic 2.10+ Best Practices

**Type Annotations**:
```python
from typing import Optional

class ToolConfig(FunctionBaseConfig):
# Required fields
required_param: str = Field(description="Must be provided")

# Optional fields with None default
optional_param: Optional[str] = Field(default=None, description="Can be None")

# Optional fields with non-None default
param_with_default: str = Field(default="default_value", description="Has default")

# Numeric fields (can use None without Optional if you want)
max_retries: int = Field(default=3, description="Number of retries")
```

**Common Validation Errors**:
```
ValidationError: Input should be a valid string [input_value=None, input_type=NoneType]
→ Solution: Use Optional[str] instead of str for fields with default=None

ValidationError: functions: Input should be a valid string (4 times)
→ Solution: Quote all string values in YAML config, especially references
```

### Upgrading to NAT 1.3.0 (Future)

When upgrading, you'll need to:

1. Update pyproject.toml:
```toml
dependencies = [
"nvidia-nat[profiling,langchain,telemetry]==1.3.0",
"pydantic>=2.11.0,<3.0.0",
]
```

2. Update all tool configs:
```python
# Before (NAT 1.2.1)
llm_name: str = Field(...)

# After (NAT 1.3.0)
from nat.data_models.component_ref import LLMRef
llm_name: LLMRef = Field(...)
```

3. Update evaluator configs:
```python
# multimodal_llm_judge_evaluator_register.py
# llm_judge_evaluator_register.py
from nat.data_models.component_ref import LLMRef
llm_name: LLMRef = Field(...)
```

4. Keep Optional[str] for nullable fields (both versions need this)

## Debugging and Troubleshooting

### Common Issues and Solutions
Expand Down
141 changes: 109 additions & 32 deletions industries/asset_lifecycle_management_agent/.gitignore
Original file line number Diff line number Diff line change
@@ -1,46 +1,123 @@
# macOS system files
# Misc
config_examples.yml
config_examples.yaml
env.sh
frontend/
prompts.md

# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
*.egg
*.egg-info/
dist/
build/
*.whl
pip-wheel-metadata/
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

# Database and vector store files
database/
*.db
*.sqlite3
# Virtual environments
.venv/
venv/
ENV/
env/

# IDEs and Editors
.vscode/
.idea/
*.swp
*.swo
*~
.DS_Store

# Testing
.pytest_cache/
.coverage
htmlcov/
.tox/
.hypothesis/

# Jupyter Notebook
.ipynb_checkpoints/
*.ipynb_checkpoints/

# Output and generated files
# Output and Data Directories
output_data/
moment/
readmes/
*.html
*.csv
*.npy
eval_output/
example_eval_output/
output/
results/
logs/

# Python package metadata
src/**/*.egg-info/
*.egg-info/
# Database files
*.db
*.sqlite
*.sqlite3
database/*.db
database/*.sqlite

# Environment files (if they contain secrets)
env.sh
# Vector store data (ChromaDB)
database/
chroma_db/
vector_store/
vanna_vector_store/

# Model files (if large/binary)
# Model files (large binary files)
models/*.pkl
models/*.joblib
models/*.model
models/*.h5
models/*.pt
models/*.pth
models/*.ckpt
*.pkl
*.h5
*.pt
*.pth
moment/

# Logs
*.log
logs/
# Data files (CSV, JSON, etc. - be selective)
*.csv
*.json
!training_data.json
!vanna_training_data.yaml
!config*.json
!config*.yaml
!config*.yml
!pyproject.toml
!package.json

# Frontend build artifacts
frontend/node_modules/
frontend/dist/
frontend/build/
frontend/.next/
frontend/out/

# Environment and secrets
.env
.env.local
.env.*.local
*.secret
secrets/
credentials/

# Temporary files
*.tmp
*.temp
.pytest_cache/
__pycache__/
*.log
*.cache

# OS specific
Thumbs.db
Desktop.ini

# Experiment tracking
mlruns/
wandb/

# dot env
mydot.env
# Documentation builds
docs/_build/
docs/.doctrees/
site/
Loading