Skip to main content

Lightweight library for command/control/optimization/automation of smart home devices using LLMs

Project description

NuCoreAI Platform!

Goal

This library goal is to convert a user query written in natural language to commands, queries, and programs in any NuCore enabled platform (currently eisy).

Quick start

Installation:

git clone https://github.com/NuCoreAI/nucore-ai.git

Using Frontier LLMs

  • Create a directory called secrets in the root of this project
  • Create the following two files in this directory
mkdir __init__.py
mkdir keys.py
  • In keys.py, put your API KEYs in this format:
OPENAI_API_KEY="sk-proj-xxxx-your-api-key" (for OpenAI)
XAI_API_KEY_SAMPLES="xai-xxxx-your-api-key" (for xAI)
CLAUDE_API_KEY="sk-ant-xxxx-your-api-key" (for Claude)

Using local (edge) LLMs

llama.cpp compile and build

  1. Download llama.cpp and install prereqs
sudo apt install build-essential 
sudo apt install cmake
sudo apt install clang
sudo apt install libomp-dev
sudo apt install libcurl4-openssl-dev 
  1. Go to the directory and do as per one of the options below:

No GPU

cmake -B build.blis -DGGML_BLAS=on -DGGML_BLAS_VENDOR=FLAME

followed by

cmake --build build.blis --conifg release

This 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

Nvidia GPU

On Ubuntu:

sudo ubuntu-drivers install
sudo apt install nvidia-utils-{latest version}
sudo apt install nvidia-cuda-toolkit
sudo apt install nvidia-prime (for intel)

Now you are ready to build:

cmake -B build.cuda -DGGML_CUDA=on 

followed by

cmake --build build.cuda --config release

If 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-smi

if anything is running and using memory:

  1. Make the prime display point to the integrated one (say intel)
sudo prime-select intel
  1. Then, make it on demand
sudo prime-select on-demand
  1. Make sure your system sees it:
nvidia-smi

The Model

Qwen3-Instruct-4b-Q4M.gguf Choose Q4M quantization.

Command

build.cuda/bin/llama-server -m /home/michel/workspace/nucore/models/qwen3-instruct-4b.q4.gguf  -c 64000 --port 8013 --host 0.0.0.0 -t 15 --n-gpu-layers 50 --batch-size 8192

Testing

  1. For now, you will need an [eisy hardware] (https://www.universal-devices.com/product/eisy-home-r2/)
  2. Clone this repo anywhere
  3. There are three assistant types that use the same codebase:
  • src/assistant/generic_assistant.py -> uses local/edge LLM (qwen)
  • src/assistant/openai_assistant.py -> uses OpenAI (you need an API Key)
  • src/assistant/claude_assistant.py -> uses Clause (you need an API Key)

All have the same parameters:

    "--url"             , # The URL to fetch nodes and profiles from the nucore platform",
    "--username"        , # The username to authenticate with the nucore platform",
    "--password"        , # The password to authenticate with the nucore platform",
    "collection_path"   , # The path to the embedding collection db. If not provided, defaults to ~/.nucore_db.
    "--model_url"       , # The URL of the remote model. If provided, this should be a valid URL that responds to OpenAI's API requests. If frontier, use openai, claude, or xai"
    "--model_auth_token", # Optional authentication token for the remote model API (if required by the remote model) to be used in the Authorization header. You are responsible for refreshing the token if needed. This is in case you are hosing your own model in AWS or Runpod, etc. 
    "--embedder_url"    , # Embedder to use.  If nothing provided, then default local embedder will be used.  If a model name is provided, it will be used as the local embedder model downloaded at runtime from hg.  If a URL is provided, it should be a valid URL that responds to OpenAI's API requests."
    "--reranker_url"    , # The URL of the reranker service. If provided, this should be a valid URL that responds to OpenAI's API requests."
    "--prompt_type"     , # The type of prompt to use (e.g., 'per-device', 'shared-features', etc.)

Examples:

  1. Local/Edge
python3 src/assistant/generic_assistant.py\
    --url=http://192.168.6.126:8443 ,\ 
    --username=admin, \ 
    --password=admin, \ 
    --model_url=http://192.168.6.113:8013/v1/chat/completions, \ 
    --prompt_type=per-device
  1. OpenAI
python3 src/assistant/openai_assistant.py\
    --url=http://192.168.6.126:8443, \ 
    --username=admin, \
    --password=admin, \
    --model_url=openai, \
    --prompt_type=per-device

Documentation

The code is very well documented but we have not yet made and official documentation.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nucore_ai-1.2.1.tar.gz (67.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nucore_ai-1.2.1-py3-none-any.whl (79.9 kB view details)

Uploaded Python 3

File details

Details for the file nucore_ai-1.2.1.tar.gz.

File metadata

  • Download URL: nucore_ai-1.2.1.tar.gz
  • Upload date:
  • Size: 67.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nucore_ai-1.2.1.tar.gz
Algorithm Hash digest
SHA256 44e95e7954eeb151daa9d2f328d5c1322b863d8c373caecd9bfe29abea31e50a
MD5 d36b4256b00770429b54fb222849fa78
BLAKE2b-256 8d9f41c8de1669c92bfe401fc6564e7aec04c626b16e17f1f2441169ee92ce9b

See more details on using hashes here.

Provenance

The following attestation bundles were made for nucore_ai-1.2.1.tar.gz:

Publisher: python-publish.yml on NuCoreAI/nucore-ai

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nucore_ai-1.2.1-py3-none-any.whl.

File metadata

  • Download URL: nucore_ai-1.2.1-py3-none-any.whl
  • Upload date:
  • Size: 79.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nucore_ai-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0a3be9476849d8b218e4fdd00e2ee545c3c4d2478005f92a49aa3cd037ecd60f
MD5 0614b1a1dcc96722675043f1e0b01f2b
BLAKE2b-256 6c77f9b8829e0f8ffd7881b5670bc29d3c1e67d94bff78cd35eef828bb84c691

See more details on using hashes here.

Provenance

The following attestation bundles were made for nucore_ai-1.2.1-py3-none-any.whl:

Publisher: python-publish.yml on NuCoreAI/nucore-ai

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page