π NIO-Weaver
NIO-Weaver is a graph-augmented analytics pipeline that converts natural-language CAN analysis requests into executable SQL workflows.
| Item |
Description |
| Domain |
Vehicle CAN signal analytics |
| Input |
Natural-language analysis request |
| Output |
Parsed signals, intermediate artifacts, and executable SQL |
| Core stack |
LLM + embedding retrieval + graph reasoning + SQL generation |
πΊοΈ Quick Navigation
ποΈ Architecture
- Build a domain graph from signal metadata.
- Parse user intent and relevant entities from a query.
- Retrieve candidate signals and context.
- Generate SQL with decomposition and iterative refinement.
- Optionally run candidate voting to select the best final SQL.
ποΈ Project Structure
NIO-Weaver/
ββ LLMAsAnalyst.py # Main orchestration class
ββ main.py # Example pipeline script
ββ prompts/
β ββ prompt/
β ββ prompt.yaml # Core prompts
β ββ decompose.yaml # SQL decomposition prompts
β ββ finalvote.yaml # Candidate SQL evaluation prompts
ββ src/
β ββ config.yaml # Runtime configuration
β ββ graphbuild.py # Graph building pipeline
β ββ signalparser.py # Query/signal parsing pipeline
β ββ sqlgenerate.py # SQL generation pipeline
β ββ Models/ # LLM + embedding implementations
β ββ GraphBuilderModules/ # Graph-building submodules
β ββ SignalSelectModules/ # Signal-retrieval submodules
β ββ utils/ # Shared utilities
ββ README.md
β
Requirements
π§© Runtime
- Python 3.10+ (recommended)
- Neo4j
- LLM provider credentials
π Python Dependencies
pyyaml, python-dotenv, pandas, tqdm, openai, anthropic, tiktoken, sentence-transformers, aiohttp, neo4j
π Quick Start
1) π§ Initialize
from LLMAsAnalyst import LLMAsAnalyst
analyst = LLMAsAnalyst()
2) πΈοΈ Build Graph
3) π§ Parse a Single Query
query = "Analyze MAI activation events under specific driving conditions."
analyst.signalparse(query)
4) π§Ύ Generate SQL in Batch
analyst.batch_generate_sql()
analyst.batch_iterative_sql_generation()
5) π³οΈ Final Candidate Voting
analyst.batch_final_sql_vote()
βοΈ Configuration Guide
Configuration file: src/config.yaml
| Section |
Purpose |
llm.* |
LLM provider/model/API settings |
embedding_model.* |
Embedding provider/model/API settings |
neo4j.* |
Graph database connection |
entity_extraction |
Entity extraction behavior |
entity_linking |
Entity linking behavior |
signal_parse |
Signal parsing and retrieval settings |
sql_generate |
SQL generation settings |
log_files.* |
Log output paths |
Before running:
- Fill
api_key and model in config.
- Confirm Neo4j connection settings.
- Keep prompt files under
prompts/prompt/ unless you also update loader logic.
π οΈ Common Workflows
π₯ Batch Query Parsing
analyst.batch_process_queries(
input_file="data/input/queries.xlsx",
checkpoint_dir="data/output/batch_results/checkpoints"
)
π§ͺ Batch Debug from Mid-Pipeline
analyst.batch_debug_queries(
input_file="data/input/queries.xlsx",
checkpoint_dir="data/process/debug_checkpoints"
)
π One-Query Iterative SQL Generation
result = analyst.single_iterative_sql_generation(
query_index=0,
retry_times=5,
max_iterations=3,
top_k_additional=6
)
π¦ Outputs
Typical outputs are generated under data/output/:
- parsed signal artifacts
- SQL generation results
- iterative checkpoints
- evaluation/voting outputs
Logs are written under logs/ according to src/config.yaml.
π Operational Notes
- Prompt YAML files are runtime dependencies. Keep syntax valid.
- Batch APIs with checkpointing are recommended for long jobs.
- Validate generated SQL in your target engine before production usage.
- In production, avoid logging raw user-sensitive content.
π§― Troubleshooting
| Symptom |
Likely Cause |
Action |
ModuleNotFoundError |
Missing dependency |
Install required Python packages |
| Neo4j connection failed |
Invalid neo4j.* settings |
Verify URI/user/password |
| LLM request failed |
Invalid provider or API config |
Check llm.provider/model/api_key/api_base |
| Prompt loading failed |
Missing prompt files |
Confirm prompts/prompt/*.yaml exists |