-
Build and install OpenVINO from sources following the instructions. In this step, we need to build the OpenVINO Runtime that is required for OpenVINO GenAI. We don't need to configure any environment variables to create JS buildings here. The path to the OpenVINO install directory is referred as
<INSTALL_DIR>throughout the document. -
Clone OpenVINO GenAI repository and init submodules:
git clone --recursive https://github.com/openvinotoolkit/openvino.genai.git cd openvino.genai -
Set up the environment:
Linux and macOS:
source <INSTALL_DIR>/setupvars.sh
Windows Command Prompt:
call <INSTALL_DIR>\setupvars.bat
Windows PowerShell:
. <INSTALL_DIR>/setupvars.ps1
Linux:
export OpenVINO_DIR=<INSTALL_DIR>/runtime export PYTHONPATH=<INSTALL_DIR>/python:./build/:$PYTHONPATH export LD_LIBRARY_PATH=<INSTALL_DIR>/runtime/lib/intel64:$LD_LIBRARY_PATH
macOS:
export OpenVINO_DIR=<INSTALL_DIR>/runtime export PYTHONPATH=<INSTALL_DIR>/python:./build/:$PYTHONPATH export DYLD_LIBRARY_PATH=<INSTALL_DIR>/runtime/lib/intel64:$LD_LIBRARY_PATH
Windows Command Prompt:
set OpenVINO_DIR=<INSTALL_DIR>\runtime set PYTHONPATH=<INSTALL_DIR>\python;%CD%\build;%PYTHONPATH% set OPENVINO_LIB_PATHS=<INSTALL_DIR>\bin\intel64\Release;%OPENVINO_LIB_PATHS% set PATH=%OPENVINO_LIB_PATHS%;%PATH%
Windows PowerShell:
$env:OpenVINO_DIR = "<INSTALL_DIR>\runtime" $env:PYTHONPATH = "<INSTALL_DIR>\python;$PWD\build;$env:PYTHONPATH" $env:OPENVINO_LIB_PATHS = "<INSTALL_DIR>\bin\intel64\Release;$env:OPENVINO_LIB_PATHS" $env:PATH = "$env:OPENVINO_LIB_PATHS;$env:PATH"
-
Build OpenVINO GenAI Node.js bindings
cmake -DCMAKE_BUILD_TYPE=Release \ -DENABLE_JS=ON -DCPACK_GENERATOR=NPM \ -S . -B ./build cmake --build ./build --config Release -j cmake --install ./build/ --config Release --prefix ./src/js/bin
- Node.js v21+
Build OpenVINO™ GenAI JavaScript Bindings from sources following the instructions.
Since the OpenVINO GenAI NodeJS package depends on the OpenVINO NodeJS package, these packages must
be of the same version. If you intend to use one of the released versions, please check and install
the correct version of the openvino-node package in your project. If you want to use an unstable
version of the OpenVINO GenAI NodeJS package, you will also need to build and use OpenVINO™
JavaScript Bindings from source following the
instructions
to use it correctly.
Then you can use OpenVINO™ GenAI JavaScript Bindings in one of the following ways:
To use this package locally use npm link in src/js/ directory and npm link openvino-genai-node
in the folder where you want to add this package as a dependency
Add the openvino-genai-node package manually by specifying the path to the src/js/ directory in
your package.json:
"openvino-genai-node": "file:*path-to-current-directory*"
node -e "const { LLMPipeline } = require('openvino-genai-node'); console.log(LLMPipeline);"