Skip to content

Commit 6d4b2ae

Browse files
vikalluruclaude
andcommitted
Add Asset Lifecycle Management (ALM) agent implementation
- Add complete ALM workflow for predictive maintenance of turbofan engines - Include SQL retrieval tools using Vanna AI - Add RUL (Remaining Useful Life) prediction tools with XGBoost and MOMENT foundation model - Include anomaly detection and visualization tools - Add NASA turbofan engine degradation dataset - Include comprehensive documentation and evaluation framework - Add MOMENT time-series foundation model integration as embedded content Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 7406837 commit 6d4b2ae

104 files changed

Lines changed: 319789 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "industries/asset_lifecycle_management/moment"]
2+
path = industries/asset_lifecycle_management/moment
3+
url = https://github.com/moment-timeseries-foundation-model/moment.git
Lines changed: 237 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,237 @@
1+
# SQL Tool Comparison Results
2+
3+
**Date:** 2026-01-25
4+
**Status:** Ready for Testing
5+
**Environment:** alm conda environment with Python 3.12.12
6+
7+
## Overview
8+
9+
This document compares two SQL retriever implementations for the Asset Lifecycle Management Agent:
10+
11+
1. **sql_retriever_old** - Original implementation (`generate_sql_query_and_retrieve_tool`)
12+
- Location: `src/nat_alm_agent/retrievers/generate_sql_query_and_retrieve_tool.py`
13+
- Uses VannaManager singleton pattern
14+
- ChromaDB vector store at `database/`
15+
16+
2. **sql_retriever_vanna** - New package-based implementation (`vanna_sql_tool`)
17+
- Location: `packages/nat_vanna_tool/src/nat_vanna_tool/vanna_sql_tool.py`
18+
- Standalone reusable NAT tool package
19+
- ChromaDB vector store at `database_vanna/`
20+
21+
## Test Setup
22+
23+
Both implementations are configured in `configs/config-reasoning.yaml`:
24+
25+
```yaml
26+
functions:
27+
# Original implementation (currently active as sql_retriever)
28+
sql_retriever_old:
29+
_type: generate_sql_query_and_retrieve_tool
30+
vector_store_path: "database"
31+
...
32+
33+
# New package implementation
34+
sql_retriever_vanna:
35+
_type: vanna_sql_tool
36+
vector_store_path: "database_vanna"
37+
...
38+
39+
# Active tool (change _type to switch implementations)
40+
sql_retriever:
41+
_type: generate_sql_query_and_retrieve_tool # <-- Change this to vanna_sql_tool to test new implementation
42+
...
43+
```
44+
45+
## Test Queries
46+
47+
| # | Description | Query |
48+
|---|-------------|-------|
49+
| 1 | Simple count | How many unique engines are in the FD001 training dataset? |
50+
| 2 | Column selection | Retrieve time in cycles and operational setting 1 from FD001 test for unit 1 |
51+
| 3 | Aggregation | What is the maximum sensor 2 value in the FD001 training dataset? |
52+
| 4 | Filter and column | Get sensor 4 measurements for engine 5 in FD001 train dataset |
53+
| 5 | RUL retrieval | Retrieve real RUL of each unit in FD001 test dataset |
54+
55+
## Testing Instructions
56+
57+
### 1. Test Old Implementation
58+
59+
```bash
60+
# Activate environment
61+
conda activate alm
62+
63+
# Set API key
64+
export NVIDIA_API_KEY=your-nvidia-api-key
65+
66+
# Config already uses sql_retriever_old by default
67+
cd ~/Documents/NeMo-Agent-Toolkit-Examples/industries/asset_lifecycle_management
68+
69+
# Start NAT server
70+
nat serve --config_file=configs/config-reasoning.yaml
71+
72+
# In another terminal, test queries
73+
# (or use the web UI at http://localhost:8000)
74+
```
75+
76+
Run each test query and record:
77+
- SQL generated
78+
- Data returned (check `output_data/`)
79+
- Response time
80+
- Any errors
81+
82+
### 2. Test New Implementation
83+
84+
```bash
85+
# Edit configs/config-reasoning.yaml
86+
# Change sql_retriever _type from:
87+
# _type: generate_sql_query_and_retrieve_tool
88+
# To:
89+
# _type: vanna_sql_tool
90+
91+
# Restart NAT server
92+
nat serve --config_file=configs/config-reasoning.yaml
93+
94+
# Run same test queries
95+
```
96+
97+
Record same metrics for comparison.
98+
99+
## Evaluation Criteria
100+
101+
| Criterion | Weight | Description |
102+
|-----------|--------|-------------|
103+
| **Correctness** | 30% | Valid SQL generation, no syntax errors |
104+
| **Accuracy** | 30% | Correct data returned matching expectations |
105+
| **Performance** | 20% | Response time, vector search speed |
106+
| **Reliability** | 10% | Error handling, edge case management |
107+
| **Maintainability** | 10% | Code clarity, debugging ease, reusability |
108+
109+
## Results
110+
111+
### Query 1: Simple Count Query
112+
*How many unique engines are in the FD001 training dataset?*
113+
114+
| Metric | sql_retriever_old | sql_retriever_vanna | Winner |
115+
|--------|-------------------|---------------------|---------|
116+
| SQL Generated | TBD | TBD | TBD |
117+
| Correct Result? | TBD | TBD | TBD |
118+
| Response Time | TBD | TBD | TBD |
119+
| Errors | TBD | TBD | TBD |
120+
121+
### Query 2: Column Selection Query
122+
*Retrieve time in cycles and operational setting 1 from FD001 test for unit 1*
123+
124+
| Metric | sql_retriever_old | sql_retriever_vanna | Winner |
125+
|--------|-------------------|---------------------|---------|
126+
| SQL Generated | TBD | TBD | TBD |
127+
| Correct Result? | TBD | TBD | TBD |
128+
| Response Time | TBD | TBD | TBD |
129+
| Errors | TBD | TBD | TBD |
130+
131+
### Query 3: Aggregation Query
132+
*What is the maximum sensor 2 value in the FD001 training dataset?*
133+
134+
| Metric | sql_retriever_old | sql_retriever_vanna | Winner |
135+
|--------|-------------------|---------------------|---------|
136+
| SQL Generated | TBD | TBD | TBD |
137+
| Correct Result? | TBD | TBD | TBD |
138+
| Response Time | TBD | TBD | TBD |
139+
| Errors | TBD | TBD | TBD |
140+
141+
### Query 4: Filter and Column Query
142+
*Get sensor 4 measurements for engine 5 in FD001 train dataset*
143+
144+
| Metric | sql_retriever_old | sql_retriever_vanna | Winner |
145+
|--------|-------------------|---------------------|---------|
146+
| SQL Generated | TBD | TBD | TBD |
147+
| Correct Result? | TBD | TBD | TBD |
148+
| Response Time | TBD | TBD | TBD |
149+
| Errors | TBD | TBD | TBD |
150+
151+
### Query 5: RUL Retrieval Query
152+
*Retrieve real RUL of each unit in FD001 test dataset*
153+
154+
| Metric | sql_retriever_old | sql_retriever_vanna | Winner |
155+
|--------|-------------------|---------------------|---------|
156+
| SQL Generated | TBD | TBD | TBD |
157+
| Correct Result? | TBD | TBD | TBD |
158+
| Response Time | TBD | TBD | TBD |
159+
| Errors | TBD | TBD | TBD |
160+
161+
## Summary Score
162+
163+
| Criterion | sql_retriever_old | sql_retriever_vanna | Notes |
164+
|-----------|-------------------|---------------------|-------|
165+
| Correctness (30%) | TBD/30 | TBD/30 | TBD |
166+
| Accuracy (30%) | TBD/30 | TBD/30 | TBD |
167+
| Performance (20%) | TBD/20 | TBD/20 | TBD |
168+
| Reliability (10%) | TBD/10 | TBD/10 | TBD |
169+
| Maintainability (10%) | TBD/10 | TBD/10 | TBD |
170+
| **TOTAL (100%)** | **TBD/100** | **TBD/100** | TBD |
171+
172+
## Decision
173+
174+
**Winner:** TBD
175+
176+
**Reasoning:** TBD
177+
178+
## Cleanup Steps
179+
180+
### If sql_retriever_vanna Wins
181+
182+
1. Delete old implementation:
183+
```bash
184+
rm -rf src/nat_alm_agent/retrievers/
185+
```
186+
187+
2. Update `src/nat_alm_agent/register.py`:
188+
```python
189+
# Remove:
190+
# from .retrievers import generate_sql_query_and_retrieve_tool
191+
```
192+
193+
3. Update config to use only vanna_sql_tool:
194+
```yaml
195+
functions:
196+
sql_retriever: # Single tool
197+
_type: vanna_sql_tool
198+
...
199+
```
200+
201+
4. Remove from dependencies if needed
202+
203+
### If sql_retriever_old Wins
204+
205+
1. Uninstall nat_vanna_tool:
206+
```bash
207+
uv pip uninstall nat_vanna_tool
208+
```
209+
210+
2. Remove package directory:
211+
```bash
212+
rm -rf ../../packages/nat_vanna_tool/
213+
```
214+
215+
3. Update `pyproject.toml`:
216+
```toml
217+
# Remove nat_vanna_tool from dependencies
218+
# Remove from [tool.uv.sources]
219+
```
220+
221+
4. Update config:
222+
```yaml
223+
functions:
224+
sql_retriever: # Single tool
225+
_type: generate_sql_query_and_retrieve_tool
226+
...
227+
```
228+
229+
## Lessons Learned
230+
231+
TBD - Document key insights from the comparison process
232+
233+
## References
234+
235+
- Test comparison suite: `tests/test_sql_comparison.py`
236+
- Comparison summary: `test_comparison_output/COMPARISON_SUMMARY.md`
237+
- Comparison report: `test_comparison_output/comparison_report.json`

0 commit comments

Comments
 (0)