This repository is maintained by KNIME Team spAIceship.
This repository contains the source code for the KNIME AI Extension. The extension offers nodes for building LLM-powered no-code workflows, and supports interfacing with hosted services, as well as locally-running models.
- Refer to the Python extension development documentation for building pure-Python nodes for KNIME.
- For working with this codebase or developing KNIME Analytics Platform extensions, see the knime-sdk-setup repository on BitBucket or GitHub.
- Use the Ruff Formatter to ensure consistent Python code style:
ruff format .
- Install dependencies using Pixi:
pixi install -e dev
- Ensure Java plugins are present:
The KNIME AI Extension now includes both Python and Java components. To use the extension, you must have the required Java plugins available in your KNIME Analytics Platform. You can achieve this in one of two ways:
- Option 1: Install the AI Extension
Install the AI Extension directly into your KNIME Analytics Platform using the standard update sites. This will ensure all necessary Java plugins are installed. - Option 2: Develop with Eclipse
If you are developing or modifying the Java plugins, check out the relevant plugin projects in Eclipse and launch KNIME from your Eclipse workspace. This allows you to work with the latest source code for both Java and Python components.
- Register the Python extension in KNIME Analytics Platform:
- Install the KNIME Python Extension Development feature. It might already be installed if you have any Python-based extension.
- Create or update your Python
config.yaml
with:org.knime.python.llm: src: "<path/to/this/repository>" conda_env_path: "<path/to/this/repository>/.pixi/envs/dev" debug_mode: true # Disables Python process caching for live code reloads (slower on Windows)
- Point KNIME to your config by adding to
knime.ini
:-Dknime.python.extension.config=<path/to/your/config.yaml>
- Note for Eclipse development:
When developing from Eclipse, the pluginorg.knime.python3.nodes
from the knime-python repository needs to be checked out or added to the target platform, as it is not included by default.
To use the dev
environment in VS Code for linting, formatting, and debugging:
Select the Python Interpreter:
- Open the Command Palette (Ctrl+Shift+P) and run
Python: Select Interpreter
. - Choose the interpreter from
.pixi\envs\dev
(on Windows) or.pixi/envs/dev/bin/python
(on Linux/macOS). - If you do not see the environment, click "Enter interpreter path..." and browse to the Python executable in the
dev
environment.
- Use
debugpy
to enable remote debugging:import debugpy debugpy.listen(5678) print("Waiting for debugger attach") debugpy.wait_for_client()
- Place this at the start of a node's
execute
method for best results (KNIME may start multiple processes; only one can attach). - To set breakpoints in code:
import debugpy # if not already imported debugpy.breakpoint()
- Place this at the start of a node's
- In VS Code, open the Run & Debug view (Ctrl+Shift+D), select "Remote Attach" (localhost:5678), and start debugging. Ensure a Python file is open to see Python debug options.
- For a better experience, add this to your
.vscode/launch.json
:{ "version": "0.2.0", "configurations": [ { "name": "Python: Remote Attach", "type": "python", "request": "attach", "connect": { "host": "localhost", "port": 5678 }, "justMyCode": false } ] }
- Setting
justMyCode
tofalse
allows stepping into library code
- Setting
- For a streamlined debugging experience, you can use the Debugpy Attacher VS Code extension.
- Install the extension:
- Open the Extensions view in VS Code (Ctrl+Shift+X) and search for "Debugpy Attacher".
- Click Install.
- Benefits:
- No need to manually enter host/port or edit configuration files.
- Quickly attach to any debugpy-enabled process from within VS Code.
- Usage:
- Refer the documentation for general usage.
- Note that when running in KNIME, you do not need to start the Python process, since KNIME will do it.
- Install the extension:
The repository is released under the GPL v3 License. Please refer to LICENSE.txt
. Refer to THIRD_PARTY_LICENSES.txt
for licenses corresponding to
third party libraries and frameworks used in this repository.