Skip to content
Draft
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
f4f7aa5
Fix typo in pipeline source node description
Tejeshyewale Apr 26, 2026
b22e844
docs: improve README clarity and deployment instructions
Tejeshyewale Apr 26, 2026
319fca1
Update README.md
Tejeshyewale Apr 26, 2026
7ce10e3
Create README.md
Tejeshyewale Apr 28, 2026
90fac4d
Create code.py
Tejeshyewale Apr 28, 2026
b0598a2
Create IGlobal.py
Tejeshyewale Apr 28, 2026
ca2b870
Create IInstance.py
Tejeshyewale Apr 28, 2026
5862bd8
Create services.json
Tejeshyewale Apr 28, 2026
b33eff4
Create requirements.txt
Tejeshyewale Apr 28, 2026
be13299
Update code.py
Tejeshyewale Apr 28, 2026
4d88f21
Add files via upload
Tejeshyewale Apr 28, 2026
48a784f
Rename IInstance.py to Instance.py
Tejeshyewale Apr 28, 2026
7e6963d
Update services.json
Tejeshyewale Apr 28, 2026
5952843
Update requirements.txt
Tejeshyewale Apr 28, 2026
c667348
Update README.md
Tejeshyewale Apr 28, 2026
12c00e2
Update requirements.txt
Tejeshyewale Apr 28, 2026
c587ada
Update code.py
Tejeshyewale Apr 28, 2026
bb482f0
Merge branch 'rocketride-org:develop' into develop
Tejeshyewale Apr 30, 2026
8e676e5
Fix PreProcessor structure and improve error handling
Tejeshyewale Apr 30, 2026
50a0bd4
Fix PreProcessor node structure and improve error handling
Tejeshyewale Apr 30, 2026
96cf781
Update IGlobal.py
Tejeshyewale Apr 30, 2026
92593be
Update Instance.py
Tejeshyewale Apr 30, 2026
fe1f418
Update code.py
Tejeshyewale Apr 30, 2026
89504f9
Update code.py
Tejeshyewale Apr 30, 2026
dc7f679
Update IGlobal.py
Tejeshyewale Apr 30, 2026
4c9d406
Update Instance.py
Tejeshyewale Apr 30, 2026
c39113d
Update services.json
Tejeshyewale Apr 30, 2026
47ad4f9
Update code.py
Tejeshyewale Apr 30, 2026
3e8e46b
Update IGlobal.py
Tejeshyewale Apr 30, 2026
5399865
Update Instance.py
Tejeshyewale Apr 30, 2026
43c725d
Update README.md
Tejeshyewale Apr 30, 2026
5602c71
Merge branch 'rocketride-org:develop' into develop
Tejeshyewale Apr 30, 2026
9eaba7e
Update IGlobal.py
Tejeshyewale May 1, 2026
efa13f6
Update Instance.py
Tejeshyewale May 1, 2026
66e54c3
Update code.py
Tejeshyewale May 1, 2026
cc8840e
Create __init__.py
Tejeshyewale May 1, 2026
1f33c2f
Update requirements.txt
Tejeshyewale May 1, 2026
4d29752
Update services.json
Tejeshyewale May 1, 2026
9ad5458
Rename Instance.py to IInstance.py
Tejeshyewale May 1, 2026
282a102
Delete nodes/src/nodes/ml_sklearn/model.pkl
Tejeshyewale May 1, 2026
718b5ce
Merge branch 'rocketride-org:develop' into develop
Tejeshyewale May 1, 2026
46d6428
Merge branch 'develop' into develop
kwit75 May 1, 2026
83abe32
Merge branch 'develop' into develop
kwit75 May 1, 2026
3d91916
Merge branch 'rocketride-org:develop' into develop
Tejeshyewale May 2, 2026
2f66442
Update code.py
Tejeshyewale May 5, 2026
7039924
Update IGlobal.py
Tejeshyewale May 5, 2026
dc2ab2f
Update IInstance.py
Tejeshyewale May 5, 2026
f36b225
Update services.json
Tejeshyewale May 5, 2026
0e4e36a
Update requirements.txt
Tejeshyewale May 5, 2026
c20d8ed
Merge branch 'rocketride-org:develop' into develop
Tejeshyewale May 5, 2026
5db3751
fix: ml_sklearn node - working inference, fixed services.json, added …
Tejeshyewale May 5, 2026
6c53920
fix: ruff linting issues in ml_sklearn node
Tejeshyewale May 5, 2026
40a4ee5
fix: ml_sklearn - forward input unchanged when no model loaded
Tejeshyewale May 5, 2026
d359ae4
fix: ml_sklearn - add writeText handler for text lane input
Tejeshyewale May 5, 2026
9671737
fix: ml_sklearn - ruff format fixes
Tejeshyewale May 5, 2026
57943c9
fix: ml_sklearn - writeText takes plain string not question object
Tejeshyewale May 6, 2026
26c9ac7
fix: ml_sklearn - use Answer object with getText/setText pattern
Tejeshyewale May 6, 2026
f61ba71
fix: ml_sklearn - use answers lane for input and test
Tejeshyewale May 6, 2026
6894f7b
fix: ml_sklearn - fix test case format to match guardrails pattern
Tejeshyewale May 6, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions nodes/src/nodes/ml_sklearn/IGlobal.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# =============================================================================
# MIT License
# Copyright (c) 2026 Aparavi Software AG
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
# =============================================================================

from rocketlib import IGlobalBase, OPEN_MODE
from ai.common.preprocessor import PreProcessorBase


class IGlobal(IGlobalBase):
preprocessor: PreProcessorBase | None = None

def beginGlobal(self):
# Are we in config mode or some other mode?
if self.IEndpoint.endpoint.openMode == OPEN_MODE.CONFIG:
# We are going to get a call to configureService but
# we don't actually need to load the driver for that
pass
else:
from .code import PreProcessor

# Get our bag
bag = self.IEndpoint.endpoint.bag

# Create the preprocessor
self.preprocessor = PreProcessor(self.glb.logicalType, self.glb.connConfig, bag)
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated

def endGlobal(self):
# Destroy the preprocessor
self.preprocessor = None
91 changes: 91 additions & 0 deletions nodes/src/nodes/ml_sklearn/Instance.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# =============================================================================
# MIT License
# Copyright (c) 2026 Aparavi Software AG
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
# =============================================================================

from rocketlib import IInstanceBase, Entry, warning
from typing import List
from ai.common.schema import Doc, DocMetadata
from . import IGlobal


class IInstance(IInstanceBase):
IGlobal: IGlobal

chunkId: int = 0
tableId: int = 0

def _writeTableOrText(self, text: str, isTable: bool = False):
# Fill in the metadata
metadata = DocMetadata(
self,
chunkId=0,
isTable=isTable,
tableId=0,
isDeleted=False,
)

# Chunk the document
textChunks = self.IGlobal.preprocessor.process(text)
if not textChunks:
warning(f'The file {self.instance.currentObject.path} could not be processed, because it does not appear to contain supported source code in one of these languages: c/c++, python, javascript, typescript, typescript.')
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
return

# Create the documents
documents: List[Doc] = []
for chunk in textChunks:
# Create the document from it
document = Doc(page_content=chunk, metadata=metadata.model_copy())

# Assign the chunk id
document.metadata.chunkId = self.chunkId
self.chunkId = self.chunkId + 1

# If this is a table or not
if isTable:
self.tableId = self.tableId
else:
self.tableId = 0

# Append it to the list
documents.append(document)

# If there are no documents, done
if not len(documents):
return

# If this is a table
if isTable:
metadata.tableId = self.tableId
self.tableId += 1

Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
# Write the documents
self.instance.writeDocuments(documents)

def open(self, object: Entry):
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
self.chunkId = 0
self.tableId = 0

def writeTable(self, table: str):
self._writeTableOrText(table, True)

def writeText(self, text: str):
self._writeTableOrText(text, False)
20 changes: 20 additions & 0 deletions nodes/src/nodes/ml_sklearn/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# ML Sklearn Prediction Node

This node performs predictions using a trained sklearn model.

## Input
- price (number)

## Output
- prediction (number)

## Example
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Input:
{
"price": 250
}

Output:
{
"prediction": 3.5
}
33 changes: 33 additions & 0 deletions nodes/src/nodes/ml_sklearn/code.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import pickle
import os

class PreProcessor:
'''ML Sklearn Prediction Node'''

def __init__(self, *args, **kwargs):
'''Load trained sklearn model'''
model_path = os.path.join(os.path.dirname(__file__), 'model.pkl')
with open(model_path, 'rb') as f:
self.model = pickle.load(f)
Comment thread
asclearuc marked this conversation as resolved.
Outdated

def run(self, input_data):
try:
if not isinstance(input_data, dict):
return {'error': 'Input must be a dictionary'}

price = input_data.get('price')

if price is None:
return {'error': "Missing 'price'"}

try:
price = float(price)
except (ValueError, TypeError):
return {'error': 'Price must be a number'}

prediction = self.model.predict([[price]])

return {'prediction': float(prediction[0])}

except Exception as e:
return {'error': str(e)}
Comment thread
asclearuc marked this conversation as resolved.
Outdated
Binary file added nodes/src/nodes/ml_sklearn/model.pkl
Binary file not shown.
2 changes: 2 additions & 0 deletions nodes/src/nodes/ml_sklearn/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
scikit-learn>=1.0
numpy>=1.21
29 changes: 29 additions & 0 deletions nodes/src/nodes/ml_sklearn/services.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"title": "ML Sklearn Prediction",
"protocol": "ml_sklearn://",
"classType": ["machine_learning"],
"capabilities": [],
"register": "filter",
"node": "python",
"path": "nodes.ml_sklearn",
"prefix": "ML",
"description": [
"A machine learning node that performs prediction using a trained sklearn model.",
"It accepts numerical input and returns predicted output."
],
"icon": "python.svg",
"documentation": "https://docs.rocketride.org",
"lanes": {
"input": ["data"]
},
"input": [
{
"lane": "input",
"output": [
{
"lane": "data"
}
]
}
]
}
Loading