- Download llama.cpp
- Go to the directory and do as per one of the options below:
cmake -B build.blis -DGGML_BLAS=on -DGGML_BLAS_VENDOR=FLAMEfollowed by
cmake --build build.blis --conifg releaseThis will install llama.cpp binaries in build.blis directory local to llama.cpp installation. The reason we are using build.blis directory is that you may want to experiment with the GPU version
On Ubuntu:
sudo ubuntu-drivers install
sudo apt install nvidia-utils-{latest version}
sudo apt install nvidia-cuda-toolkitNow you are ready to build:
cmake -B build.cuda -DGGML_CUDA=on followed by
cmake --build build.cuda --config releaseIf you have x running, you may want to have it release resources. First use nvidia-smi utility to see what's running and how much memory is being used by other things:
sudo nvidia-smiif anything is running and using memory:
- Make the prime display point to the integrated one (say intel)
sudo prime-select intel- Then, make it on demand
sudo prime-select on-demand- Make sure your system sees it:
nvidia-smiThis library goal is to convert a user query written in natural language to programs for IoX systems.
Installation:
git clone https://github.com/NuCoreAI/ai-workflow.git
cd ai-workflow
make setupNow, you need 2 models using the GGUF format (llama.cpp):
- A large language model (for instance llama-3.1-8b you can find here)
- A re-ranker model (for instance bge-reranker-v2-m3 you can find here)
For the next part you need:
- a IoX profile using the JSON format
- a XML export of the IoX nodes
python3 -m ai_iox_workflow.cli \
--workflow-llm-model llama-3.1-8b \
--profile profile.json \
--nodes nodes.xml \
"If the electricity price is above 0.4$, stop charging the car"Example response:
Identifying relevant nodes...
Found:
- sensor: Utility Signals (oadr3) [Electricity price]
- sensor: Charging Info [Estimated Range]
- sensor: Charging Info [Charge energy added]
- sensor: Charging Info [Charger voltage]
- sensor: Charging Info [Last Command Status]
- sensor: Charging Info [Charging Requested]
- sensor: Charging Info [Charging Power]
- command: Charging Info [Charging Control]
- command: Charging Info [Set Max Charge Current]
- command: Charging Info [Charge Port Control]
Building workflow...
================================================================================
Workflow Details:
Transition:
Guard:
Conditions: AND
- Utility Signals (oadr3) [Electricity price] GREATER THAN ITokenValue(value=0.4)
Output:
Set Charging Info [Charging Control] to Stop
================================================================================
JSON Representation
{
"transition": {
"inputs": [
{
"place": "sensor: Utility Signals (oadr3) [Electricity price]"
}
],
"guard": {
"conditions": [
{
"place_state": {
"place": "Utility Signals (oadr3) [Electricity price]",
"operator": "GREATER THAN",
"value": {
"value": 0.4
}
}
}
],
"conditions_operator": "AND"
},
"output": {
"place": "command: Charging Info [Charging Control]",
"token_produced": {
"set_value": "Charging Info [Charging Control]",
"to": {
"value": "Stop"
}
}
}
}
}
First install dependencies:
cd ui/
npm i
# then launch the dev server:
npx vite dev
# browse to http://localhost:5173/Then generate a workflow with --output-workflow
python3 -m ai_iox_workflow.cli \
--workflow-llm-model qwen3-1.7b \
--profile profile.json \
--nodes nodes.xml \
--output-workflow ui/client/public/assets/workflow.json \
"If the electricity price is lower than 0.4 and the remaining range of the car is under 100 miles, charge the car"See the Workflow, Transition, Place, TokenType classes in models.py from llm-tap
python3 -m ai_iox_workflow.cli -h
usage: cli.py [-h] --profile PROFILE --nodes NODES [--workflow-llm-model WORKFLOW_LLM_MODEL]
[--reranker-model RERANKER_MODEL]
query
Generate an AI workflow based on a query.
positional arguments:
query The query to generate the workflow from.
options:
-h, --help show this help message and exit
--profile PROFILE Path to the profile JSON file.
--nodes NODES Path to the nodes XML file.
--workflow-llm-model WORKFLOW_LLM_MODEL
Accepts any GGUF LLM models
--reranker-model RERANKER_MODEL
Accepts GGUF re-ranking models. Qwen3 reranking is *not* yet supported by llama.cpp.- "Turn on the fan when the temperature exceeds 30°C in the office."
- "If the electricity price is below 0.5$, start charging the car."
- "Set the thermostat to cooling mode if the room temperature is above 75°F."
- "Activate the siren when the door is forced open."
- "Change the light color to blue when it's cloudy outside."
- "Stop playing music on the AudioPlayer if Bluetooth service is disabled."
- "Turn off the lights when the room occupancy is 'Away'."
- "Start the fan for 10 minutes if the humidity is above 70%."
- "Dim the lights to 50% when it's nighttime."
- "Increase the thermostat heat setpoint by 2°C when the weather is cold."
- "Stop charging the electric vehicle if the battery percentage reaches 80%."
- "Enable Weather updates when it's enabled in the system."
- "Unlock the front door when security mode is disarmed."
- "Close the charge port if the EV battery is full."
- "Turn off the relay if the price of electricity exceeds $1.2 per kWh."
- "Start the audio playback on the speaker if Bluetooth is paired."
- "Turn off all lights if any light's status is 'Off'."
- "Activate the dehumidifier when indoor humidity exceeds 60%."
- "If the air quality score is poor, adjust the HVAC system to improve air quality."
- "Play a sound notification on the AudioPlayer when the door is opened."
To run the example queries and store each result in a dedicated text file, you can use the following commands:
./run-examples.sh