AbstractIntegratedModule 0.2.1__tar.gz → 0.2.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: AbstractIntegratedModule
3
- Version: 0.2.1
4
- Summary: Advanced Integrated Non-LLM AI Module - Backend Framework for Non-LLM AI Agent Framework
3
+ Version: 0.2.3
4
+ Summary: Framework forAdvanced Integrated Non-LLM AI Module library - Backend Framework for Non-LLM AI Agent Framework
5
5
  Author: Micro-Novelty
6
6
  Author-email: hernikpuspita5@gmail.com
7
7
  License: MIT
@@ -40,11 +40,11 @@ https://github.com/Micro-Novelty/IntegratedPipeline-Specialized-Non-LLM-AI-Agent
40
40
  #### Note: The README here you are reading is a direct copy from my README Repository, to download the necessary files, you can visit my Repository with the provided link above.
41
41
 
42
42
  ### Library Short Description:
43
- - Development Stage: Beta, 0.2.0.
43
+ - Development Stage: Beta, 0.2.3.
44
44
  - Maintainer: Micro-Novelty.
45
45
  - library Source-Code is Open-sourced on github.
46
46
  - Purpose: Specifically Designed for providing Non-LLM AI Agent Framework for edge Devices, Optimized for ARM64 architecture.
47
- --------
47
+ - Proven Capabilities: Works on ARM64 Environment, Training and Prediction works efficient on Docker ARM64 environment with QEMU, good parallelizing behavior is guaranteed.
48
48
 
49
49
  <img width="1280" height="600" alt="WhatsApp Image 2026-05-27 at 07 16 32" src="https://github.com/user-attachments/assets/4b58a556-45a3-419b-96fd-9c1b76cac574" />
50
50
 
@@ -342,7 +342,8 @@ B. [=] Advanced Prediction without Transformer, Only Specialized MLP using AWE.
342
342
  ### Both performance Overview
343
343
  <img width="1536" height="1024" alt="WhatsApp Image 2026-05-24 at 10 27 00" src="https://github.com/user-attachments/assets/9404277f-281f-4893-8367-e494833230ea" />
344
344
 
345
- ## Source code of AbstractIntegratedModule
345
+ ## Source code of AbstractIntegratedModule
346
+ - Note: The source code is provided in the repository.
346
347
  - [=] Full Monolithic extensively-documented source code (12K+ Lines): [AbstractIntegratedPipeline-SourceCode.zip](AbstractIntegratedPipeline-SourceCode.zip)
347
348
  - [=] Separated Modules of AbstractIntegratedModule: [AbstractIntegratedModule-separated-modules](AbstractIntegratedModule-separated-modules)
348
349
  - [~] Note:
@@ -353,7 +354,21 @@ B. [=] Advanced Prediction without Transformer, Only Specialized MLP using AWE.
353
354
  - Commercialize it: Package, brand, and sell the software for profit.
354
355
 
355
356
  ## [=] Step's for in-depth Usage
356
- 1. Download:
357
+ 0. Download via PIP:
358
+ - Clone repository first:
359
+ ```bash
360
+ # Clone immediately for Windows and x86_64 only without prerequisites
361
+ git clone https://github.com/Micro-Novelty/IntegratedPipeline-Continous-Learning-AI-Agent-library-framework.git
362
+ cd IntegratedPipeline-Continous-Learning-AI-Agent-library-framework
363
+ ```
364
+
365
+ - Install the library via pip:
366
+ ```bash
367
+ pip install AbstractIntegratedModule #or
368
+ python -m pip install AbstractIntegratedModule
369
+ ```
370
+
371
+ 1. Download for binaries:
357
372
  - AbstractIntegratedModule.pyd (For Windows) (Python 3.13),
358
373
  - AbstractIntegratedModule.cpython-39-x86_64-linux-gnu.so (For linux x86_64) (Python 3.12)
359
374
  - AbstractIntegratedModule.cpython-39-aarch64-linux-gnu.so (for Linux ARM64 - Raspberry Pi) (Python 3.10)
@@ -467,8 +482,16 @@ B. [=] Advanced Prediction without Transformer, Only Specialized MLP using AWE.
467
482
  import numpy as np
468
483
 
469
484
  memory_name = 'agent_memory'
470
- main_model = IntegratedPipeline(memory_name, use_async=True, ssl_cert_file=cert_file, ssl_key_file=key_file) # provide cert_file path or key_file path (optional)
471
- main_prediction = PipelinePredictionManager(main_model, label_csv='example_manual_training.txt', target_title='window_title', label='label')
485
+ main_model = IntegratedPipeline(
486
+ memory_name=memory_name, use_async=True,
487
+ agent_port=5001, # this port is used to set AgentDistributedInference server.
488
+ singleton_permitted=False, # set IntegratedPipeline to singleton if you don't use it for P2P, False if you use P2P.
489
+ ssl_cert_file=cert_file, ssl_key_file=key_file) # provide your cert_file path or key_file path (optional)
490
+
491
+ main_prediction = PipelinePredictionManager(
492
+ main_model, label_csv='example_manual_training.txt',
493
+ target_title='window_title', label='label')
494
+
472
495
  # example_manual_training is a .txt file that contain csv format like above example.
473
496
 
474
497
 
@@ -518,8 +541,9 @@ B. [=] Advanced Prediction without Transformer, Only Specialized MLP using AWE.
518
541
  show_proba=False, top_k=3,
519
542
  use_transformer=True,
520
543
  return_attention=False,
521
- save_results=True)
522
-
544
+ save_results=True,
545
+ batch_size=2)
546
+ # batch size=2 is needed during transformer training for batching, if you have larger samples consider using batch_size > 8, for medium amount of samples (>10 -> <50 samples) consider using 2 or 4 batch_size.
523
547
  # ... more features you can add
524
548
  ```
525
549
 
@@ -600,6 +624,7 @@ predicted_output = async_manager.advanced_batch_prediction(test_titles, label_ma
600
624
  - To Make the Agent cooperate with other peers, consider using this setup:
601
625
  - [=] for ensemble prediction from multiple peers, exchanging predicted label with each other, consider using this setup:
602
626
  ```python
627
+
603
628
  # step 3
604
629
  from AbstractIntegratedModule import CohesiveAgentDeployment
605
630
  from AbstractIntegratedModule import PipelinePredictionManager
@@ -618,23 +643,25 @@ main_model.distribution.enable_ssl = False # set to false if you dont have SSL k
618
643
 
619
644
  # Agent 1 - Primary (Port 5555)
620
645
  agent1 = CohesiveAgentDeployment(
621
- memory_name="agent_primary",
622
- filename=<filename>,
623
- target_title=<title_name>,
646
+ pipeline=main_model, # main_model is your initialized integrated pipeline
647
+ memory_name="agent_primary", # any name you want for the agent.
648
+ filename=<filename>, # name of your .txt file that contains the CSV format and training labels
649
+ target_title=<title_name>,
624
650
  label_name=<label_name>,
625
- security_level="PRODUCTION",
626
- enable_peers=True,
651
+ security_level="PRODUCTION", # production level security
652
+ enable_peers=True, # allow peer discovery
627
653
  trusted_networks=['127.0.0.1/32', '192.168.1.0/24'], # for trusted networks, you need to provide the list of IPs of your peers.
628
654
  peer_discovery_port=5555, # peer port to start P2P
629
- secret_key=secret_key,
655
+ secret_key=secret_key, # your secret key
630
656
  shared_auth_token=secret_key, # your previous initialized secret_key
631
- predict_manager=prediction_manager,
657
+ predict_manager=prediction_manager, # your prediction manager
632
658
  peer_config = <'your_peer_ip_lists.json'> # you need to create .json file that contains your peer IP and Port lists
633
659
  consecutive_peer_config = <'your_second_fallback_peer_ip_lists.json'> # same for this one too, but for fallback.
634
- )
660
+ )
635
661
 
636
662
  # Agent 2 - Secondary (Port 5556)
637
663
  agent2 = CohesiveAgentDeployment(
664
+ pipeline=main_model,
638
665
  memory_name="agent_secondary",
639
666
  filename=<filename>,
640
667
  target_title=<title_name>,
@@ -648,21 +675,20 @@ agent2 = CohesiveAgentDeployment(
648
675
  predict_manager=prediction_manager,
649
676
  peer_config = <'your_peer_ip_lists.json'> # you need to create .json file that contains your peer IP and Port lists
650
677
  consecutive_peer_config = <'your_second_fallback_peer_ip_lists.json'> # same for this one too, but for fallback.
651
- )
678
+ )
652
679
 
653
680
  # Note: CohesiveAgentDeployment contains ConsecutivePeerAgent that can start a server once ensemble prediction from peer is started
654
681
  # be advised to stop the server too before shutdown-ing CohesiveAgentDeployment cluster
655
682
 
656
683
  # example peer_Ip_lists_config.json (de-comment to use)
657
684
  # {
658
- # "known_peers": [ # you must put "known_peers" in the config so python can identify the list of IPs and Ports
685
+ # you must put "known_peers" in the config so python can identify the list of IPs and Ports
686
+ # "known_peers": [
659
687
  # ["127.0.0.1", 5555], can be modified using real IP or local IP.
660
688
  # ["127.0.0.1", 5556]
661
689
  # ]
662
690
  # }
663
691
 
664
- agent1.pipeline = main_model # overrides agent1 baseline pipeline with your original initialized pipelinej
665
- agent2.pipeline = main_model
666
692
 
667
693
  try:
668
694
  # Start both agents
@@ -683,8 +709,8 @@ try:
683
709
 
684
710
  texts = {"test_titles": test_titles, "label_map": label_map, "rules": rules, "use_transformer": True, "agent_id": agent_id}
685
711
 
686
- # texts contains test_titles, label_map, and rules that you can assign,
687
- # agent ID can be strings, int, or floats, recommendeded to make it long for better security.
712
+ # texts dictionary must contain test_titles, label_map, and rules that you can assign,
713
+ # agent ID can be strings, int, or floats, recommendded to make it long for better security.
688
714
 
689
715
  # Make prediction with peer ensemble
690
716
  # Connection will be guaranteed successfull during discovery.
@@ -1493,8 +1493,9 @@ class WeightedEnsemblePredictor:
1493
1493
  return probs
1494
1494
 
1495
1495
 
1496
- def predict_single(self, text, mlp_probs, trans_probs, attn_weights, show_explanation=True):
1497
- result, explanation = self.explainer._get_prediction_details(text, mlp_probs, trans_probs, attn_weights)
1496
+ def predict_single(self, text, mlp_probs, trans_probs, attn_weights, show_explanation=True, batch_size=2):
1497
+ # small batch size is used to prevent memory overflow in explanation module when processing large attention weights, as it computes detailed explanations that can be memory intensive.
1498
+ result, explanation = self.explainer._get_prediction_details(text, mlp_probs, trans_probs, attn_weights, batch_size=batch_size)
1498
1499
  return {
1499
1500
  'prediction': result['final_label'],
1500
1501
  'confidence': result['final_confidence'],
@@ -1940,7 +1941,7 @@ class ExplainabilityModule:
1940
1941
  filled = int(value * max_width)
1941
1942
  return '█' * filled + '░' * (max_width - filled)
1942
1943
 
1943
- def _learn_from_feedback(self, text, correct_label, wrong_result):
1944
+ def _learn_from_feedback(self, text, correct_label, wrong_result, batch_size=2):
1944
1945
  eps = 1e-5
1945
1946
  print(f"\n[📚] Learning: '{text}' → {correct_label}...")
1946
1947
 
@@ -2044,7 +2045,7 @@ class ExplainabilityModule:
2044
2045
  self.pipeline.memory[memory_key] = (X, correct_label)
2045
2046
 
2046
2047
  if len(self.learned_from_feedback) % 10 == 0:
2047
- self.consolidate_supervised_memories()
2048
+ self.consolidate_supervised_memories(batch_size=batch_size)
2048
2049
 
2049
2050
  return X
2050
2051
 
@@ -2132,7 +2133,7 @@ class ExplainabilityModule:
2132
2133
  return choice
2133
2134
  return None
2134
2135
 
2135
- def analyze_with_feedback(self, details, input_text, mlp_probs, trans_probs, attn_weights, explanation, auto_ask=True):
2136
+ def analyze_with_feedback(self, details, input_text, mlp_probs, trans_probs, attn_weights, explanation, batch_size=2, auto_ask=True):
2136
2137
  uncertain = self.pipeline.confidence_threshold
2137
2138
 
2138
2139
  input_ids = np.array([self.pipeline.encode(input_text, self.pipeline.vocab)])
@@ -2150,13 +2151,13 @@ class ExplainabilityModule:
2150
2151
  print(f"[📚] Received feedback: '{input_text}' should be '{feedback}'")
2151
2152
  print('[=] Supervised learning took many trials to get right. This is normal. Please be patient as the model updates continously each label request...')
2152
2153
 
2153
- evaluated_input = self._learn_from_feedback(input_text, feedback, details)
2154
+ evaluated_input = self._learn_from_feedback(input_text, feedback, details, batch_size=2)
2154
2155
  self.supervised_learning = False # Prevent infinite loop
2155
2156
  return False
2156
2157
 
2157
2158
  return False
2158
2159
 
2159
- def consolidate_supervised_memories(self):
2160
+ def consolidate_supervised_memories(self, batch_size=2):
2160
2161
  if not self.learned_from_feedback:
2161
2162
  return
2162
2163
 
@@ -2171,7 +2172,7 @@ class ExplainabilityModule:
2171
2172
  self.initialize_fitting(labels)
2172
2173
  X = self.tfidf.transform(labels).toarray()
2173
2174
 
2174
- self.pipeline.transformer_utilities(dataset, X)
2175
+ self.pipeline.transformer_utilities(dataset, X, batch_size=batch_size)
2175
2176
 
2176
2177
  print("✅ Supervised memories consolidated!")
2177
2178
 
@@ -2195,7 +2196,7 @@ class ExplainabilityModule:
2195
2196
  return uncertain
2196
2197
 
2197
2198
 
2198
- def _get_prediction_details(self, input_text, mlp_probs, trans_probs, attn_weights):
2199
+ def _get_prediction_details(self, input_text, mlp_probs, trans_probs, attn_weights, batch_size=2):
2199
2200
  show_details = self.pipeline.show_explainability_details
2200
2201
  if trans_probs.ndim == 1:
2201
2202
  trans_probs = trans_probs.reshape(1, -1)
@@ -2274,7 +2275,7 @@ class ExplainabilityModule:
2274
2275
  self.get_uncertain_predictions(details)
2275
2276
 
2276
2277
  if details['final_confidence'] < 0.15 and not self.pipeline.autonomous:
2277
- self.analyze_with_feedback(details, input_text, mlp_probs, trans_probs, attn_weights, explanation)
2278
+ self.analyze_with_feedback(details, input_text, mlp_probs, trans_probs, attn_weights, explanation, batch_size=2)
2278
2279
 
2279
2280
  confidence = self.explain_confidence(details)
2280
2281
  if final_conf:
@@ -2289,18 +2290,25 @@ class ExplainabilityModule:
2289
2290
  if isinstance(mlp_conf, np.ndarray):
2290
2291
  mlp_conf = np.clip(np.mean(mlp_conf), 0, 1)
2291
2292
  if isinstance(trans_conf, np.ndarray):
2292
- mlp_conf = np.clip(np.mean(mlp_conf), 0, 1)
2293
+ trans_conf = np.clip(np.mean(trans_conf), 0, 1)
2293
2294
 
2294
2295
  if mlp_pred == trans_pred:
2295
2296
  final_pred = mlp_pred
2296
2297
  final_conf = max(mlp_conf, trans_conf)
2297
2298
  else:
2298
- sliced_anisotropy = self.pipeline.anisotropy_measurement(attn_weights[0])
2299
- deviation = 1.0 / (1.0 + np.std(attn_weights))
2299
+ sliced_attention_weight = attn_weights[0]
2300
+ if isinstance(sliced_attention_weight, np.ndarray):
2301
+ sliced_attention_weight = sliced_attention_weight[:, 0]
2302
+ sliced_attention_weight = sliced_attention_weight[0]
2303
+
2304
+ sliced_anisotropy = self.pipeline.anisotropy_measurement(sliced_attention_weight)
2305
+ sigmoid_growth = 1.0 / (1.0 + np.exp(-sliced_attention_weight))
2300
2306
  attn_quality = self._compute_attention_quality(attn_weights)
2301
2307
 
2302
- # abstract attention transformation
2303
- AAT = deviation * (1.0 - sliced_anisotropy) + eps
2308
+ # Abstract attention transformation
2309
+ AAT = sigmoid_growth * (1.0 - sliced_anisotropy) + eps
2310
+ # lower AAT means transformer is less reliable because abstraction is underserved/nonoptimal in this env.
2311
+ # Higher AAT means transformer is more focused and reliable and is near optimal.
2304
2312
 
2305
2313
  if mlp_conf > trans_conf:
2306
2314
  final_pred = mlp_pred
@@ -2309,6 +2317,15 @@ class ExplainabilityModule:
2309
2317
  final_pred = trans_pred
2310
2318
  final_conf = trans_conf * (1.0 - mlp_conf) * AAT + eps
2311
2319
 
2320
+ print(f'[= ABSTRACTION =] Consistency of abstraction transformation: {np.std(AAT)}')
2321
+ if isinstance(final_conf, np.ndarray):
2322
+ final_conf = 1.0 / (1.0 + np.std(final_conf))
2323
+ # growth deviation of arrayed final confidence helped to distinguish noise from unnecessary distribution,
2324
+ # with real covariance of distribution from the data.
2325
+
2326
+ if np.isnan(final_conf).any() or np.isinf(final_conf).any():
2327
+ final_conf = self.pipeline.confidence_threshold
2328
+
2312
2329
  return final_pred, final_conf
2313
2330
 
2314
2331
  def _get_attention_focus(self, attn_weights, text):
@@ -3874,26 +3891,6 @@ class ThreadedMessageQueue:
3874
3891
  # while also providing security features like authentication, rate limiting, and message validation.
3875
3892
  class AgentDistributedInference:
3876
3893
  def __init__(self, pipeline, storage, memory_name, port=5555, use_async=False, secret_key=None, ssl_cert_file=None, ssl_key_file=None, shared_auth_token=None, predict_manager=None):
3877
- super().__init__()
3878
-
3879
- # Only initialized once
3880
- if hasattr(self, '_singleton_initialized'):
3881
- print(f"[===] AgentDistributedInference already initialized, reusing...")
3882
- return
3883
-
3884
- self._singleton_initialized = True
3885
-
3886
- # Stored initialization params for debugging later
3887
- self._init_params = {
3888
- 'memory_name': memory_name,
3889
- 'port': port,
3890
- 'use_async': use_async,
3891
- 'secret_key': secret_key,
3892
- 'ssl_cert_file': ssl_cert_file,
3893
- 'ssl_key_file': ssl_key_file,
3894
- 'shared_auth_token': shared_auth_token
3895
- }
3896
-
3897
3894
  self.pipeline = pipeline
3898
3895
  self.memory_name = memory_name
3899
3896
  self.port = port
@@ -5239,7 +5236,9 @@ class AgentDistributedInference:
5239
5236
 
5240
5237
 
5241
5238
  def _calibrate_peer_probs(self, probs, target_preds, self_attn_weights, attn_weights, input_ids, AEL):
5239
+ eps = 1e-5
5242
5240
  calibrated = probs.copy()
5241
+
5243
5242
  try:
5244
5243
  n_classes = probs.shape[1]
5245
5244
  except:
@@ -5247,11 +5246,25 @@ class AgentDistributedInference:
5247
5246
 
5248
5247
  batch_size = len(target_preds)
5249
5248
  anisotropy = self.pipeline.anisotropy_measurement(attn_weights)
5250
- eps = 1e-5
5251
-
5249
+
5250
+ if isinstance(attn_weights, (str, np.str_)):
5251
+ clean_str = str(attn_weights).replace('[', '').replace(']', '')
5252
+ attn_weights = np.fromstring(clean_str, sep=' ')
5253
+ elif isinstance(attn_weights, np.ndarray) and np.issubdtype(attn_weights.dtype, np.character):
5254
+ # catches arrays filled with string text
5255
+ clean_str = ' '.join(attn_weights.astype(str).flatten()).replace('[', '').replace(']', '')
5256
+ attn_weights = np.fromstring(clean_str, sep=' ')
5257
+ else:
5258
+ # Ensure standard float array if it was integers or objects
5259
+ attn_weights = np.asarray(attn_weights, dtype=float)
5260
+
5261
+ target_preds = np.asarray(target_preds, dtype=np.float32)
5262
+
5252
5263
  for i in range(batch_size):
5253
- mlp_target = target_preds[i]
5254
- attn_target = attn_weights[i]
5264
+
5265
+ mlp_target = target_preds[i] if target_preds.ndim > 1 and target_preds.shape[0] > i else target_preds
5266
+ attn_target = attn_weights[i] if attn_weights.ndim > 1 and attn_weights.shape[0] > i else attn_weights
5267
+
5255
5268
  if self_attn_weights is not None and i < len(attn_weights):
5256
5269
  attn = self_attn_weights[i]
5257
5270
 
@@ -5298,7 +5311,21 @@ class AgentDistributedInference:
5298
5311
  def handle_peer_uncertainty(self, probs, target_preds, self_attn_weights, attn_weights, input_ids):
5299
5312
  try:
5300
5313
  if self_attn_weights is None:
5301
- _, _, self_attn_weights = self.pipeline.model2.predict(input_ids)
5314
+ _, _, self_attn_weights = self.pipeline.model2.predict(input_ids)
5315
+
5316
+
5317
+ if isinstance(attn_weights, tuple):
5318
+ attn_weights = attn_weights[0]
5319
+ if isinstance(self_attn_weights, tuple):
5320
+ self_attn_weights = self_attn_weights[0]
5321
+
5322
+ if isinstance(self_attn_weights, str):
5323
+ self_attn_weights = np.array(self_attn_weights)
5324
+ self_attn_weights = self_attn_weights[0]
5325
+
5326
+ if isinstance(attn_weights, str):
5327
+ attn_weights = np.array(attn_weights)
5328
+
5302
5329
  batch_similarity = self.pipeline.cosine_similarity(attn_weights, self_attn_weights)
5303
5330
 
5304
5331
  anisotropy = self.pipeline.anisotropy_measurement(attn_weights)
@@ -5316,7 +5343,8 @@ class AgentDistributedInference:
5316
5343
  return calibrated
5317
5344
 
5318
5345
  except Exception as e:
5319
- print(f"[-] Error in uncertainty handling: {e}")
5346
+ print(f"[= =] Error in uncertainty handling: {e}")
5347
+ traceback.print_exc()
5320
5348
  return probs
5321
5349
 
5322
5350
 
@@ -5968,24 +5996,33 @@ class AutoBatcherAutomation:
5968
5996
  # The IntegratedPipeline class serves as the central component that integrates all the different modules and functionalities of the system.
5969
5997
  # It manages the overall workflow, including data processing, model training, prediction, memory management, and interactions with other agents.
5970
5998
  class IntegratedPipeline:
5971
- def __init__(self, memory_name, use_async, agent_port=None, ssl_cert_file=None, ssl_key_file=None, secret_key=None, shared_auth_token=None, predict_manager=None):
5972
- super().__init__()
5999
+ def __init__(self, memory_name='agent_memory', use_async=False, agent_port=None, singleton_permitted=False, ssl_cert_file=None, ssl_key_file=None, secret_key=None, shared_auth_token=None, predict_manager=None):
6000
+ # Only initialized once and when allowed
6001
+
6002
+ print('[= MEMORY =] Initializing IntegratedPipeline with memory name:', memory_name)
5973
6003
 
5974
6004
  if hasattr(self, '_singleton_initialized'):
5975
- print(f"[===] IntegratedPipeline already initialized, reusing...")
6005
+ print("[=] IntegratedPipeline instance already initialized, skipping __init__")
5976
6006
  return
5977
-
5978
- self._singleton_initialized = True
5979
-
5980
- # Stored initialization params for debugging later
5981
- self._init_params = {
5982
- 'memory_name': memory_name,
5983
- 'port': agent_port,
5984
- 'secret_key': secret_key,
5985
- 'ssl_cert_file': ssl_cert_file,
5986
- 'ssl_key_file': ssl_key_file,
5987
- 'shared_auth_token': shared_auth_token
5988
- }
6007
+
6008
+ self.singleton_permitted = singleton_permitted
6009
+
6010
+ if self.singleton_permitted:
6011
+ super().__init__()
6012
+
6013
+ print("[= SINGLETON =] IntegratedPipeline singleton instance created")
6014
+ self._singleton_initialized = True
6015
+
6016
+ # Stored initialization params for debugging later
6017
+ self._init_params = {
6018
+ 'memory_name': memory_name,
6019
+ 'port': agent_port,
6020
+ 'use_async': use_async,
6021
+ 'secret_key': secret_key,
6022
+ 'ssl_cert_file': ssl_cert_file,
6023
+ 'ssl_key_file': ssl_key_file,
6024
+ 'shared_auth_token': shared_auth_token
6025
+ }
5989
6026
 
5990
6027
  self.ssl_cert_file = ssl_cert_file
5991
6028
  self.ssl_key_file = ssl_key_file
@@ -6003,10 +6040,12 @@ class IntegratedPipeline:
6003
6040
  self.batcher = AutoBatcherAutomation(self)
6004
6041
  self.query_node = QueryNode(self, memory_name, self.storage)
6005
6042
 
6006
- self._agent_mode = os.environ.get('AGENT_MODE', 'single')
6007
- self._agent_port = int(os.environ.get('AGENT_PORT', 5555))
6008
- self._use_async = os.environ.get('USE_ASYNC_QUEUE', 'true').lower() == 'true'
6009
-
6043
+ self._agent_mode = 'single'
6044
+ self._agent_port = int(agent_port) if int(agent_port) is not None else 5000
6045
+ self._use_async = use_async
6046
+
6047
+ print(f'[= PORT =] IntegratedPipeline initialized on port {self._agent_port}')
6048
+
6010
6049
  # Queue for managing async operations
6011
6050
  self._async_tasks = set()
6012
6051
  self._loop = None
@@ -6518,6 +6557,27 @@ class IntegratedPipeline:
6518
6557
  eps = 1e-5
6519
6558
  b = b[0]
6520
6559
 
6560
+ if isinstance(a, (str, np.str_)):
6561
+ clean_str = str(a).replace('[', '').replace(']', '')
6562
+ a = np.fromstring(clean_str, sep=' ')
6563
+ elif isinstance(a, np.ndarray) and np.issubdtype(a.dtype, np.character):
6564
+ # catches arrays filled with string text
6565
+ clean_str = ' '.join(a.astype(str).flatten()).replace('[', '').replace(']', '')
6566
+ a = np.fromstring(clean_str, sep=' ')
6567
+ else:
6568
+ # Ensure standard float array if it was integers or objects
6569
+ a = np.asarray(a, dtype=float)
6570
+
6571
+ # Handle variable b
6572
+ if isinstance(b, (str, np.str_)):
6573
+ clean_str = str(b).replace('[', '').replace(']', '')
6574
+ b = np.fromstring(clean_str, sep=' ')
6575
+ elif isinstance(b, np.ndarray) and np.issubdtype(b.dtype, np.character):
6576
+ clean_str = ' '.join(b.astype(str).flatten()).replace('[', '').replace(']', '')
6577
+ b = np.fromstring(clean_str, sep=' ')
6578
+ else:
6579
+ b = np.asarray(b, dtype=float)
6580
+
6521
6581
  norm_a = np.linalg.norm(a)
6522
6582
  norm_b = np.linalg.norm(b)
6523
6583
 
@@ -6542,7 +6602,6 @@ class IntegratedPipeline:
6542
6602
  print('[-] No similarity due to inhomogenous shapes and failed attempts to find subsets, returning low similarity score.')
6543
6603
  return 0.1
6544
6604
 
6545
-
6546
6605
  else:
6547
6606
  subset_a = a[:a.shape[0]]
6548
6607
  subset_b = b[:subset_a.shape[0]]
@@ -7842,7 +7901,15 @@ class IntegratedPipeline:
7842
7901
  def AME_Encoder(self, x):
7843
7902
  X = np.asarray(x)
7844
7903
 
7845
- gradient = np.gradient(x, axis=-1)
7904
+ if isinstance(X, (str, np.str_)):
7905
+ clean_str = str(X).replace('[', '').replace(']', '')
7906
+ X = np.fromstring(clean_str, sep=' ')
7907
+ if isinstance(X, np.ndarray) and np.issubdtype(X.dtype, np.character):
7908
+ # catches arrays filled with string text
7909
+ clean_str = ' '.join(X.astype(str).flatten()).replace('[', '').replace(']', '')
7910
+ X = np.fromstring(clean_str, sep=' ')
7911
+
7912
+ gradient = np.gradient(X, axis=-1)
7846
7913
  grad_energy = np.mean(np.linalg.norm(gradient, axis=-1))
7847
7914
  X_mag = np.mean(np.linalg.norm(X, axis=-1))
7848
7915
 
@@ -7851,6 +7918,7 @@ class IntegratedPipeline:
7851
7918
  if AME == 0.0:
7852
7919
  eps = 1e-5
7853
7920
  AME = AME + eps
7921
+
7854
7922
  return AME
7855
7923
 
7856
7924
  def feature_generation(self, rules, dataset):
@@ -7936,7 +8004,7 @@ class IntegratedPipeline:
7936
8004
  std_pool = np.std(sequence_inputs, axis=1)
7937
8005
  return np.concatenate([mean_pool, max_pool, std_pool], axis=-1)
7938
8006
 
7939
- def transformer_utilities(self, rules, datasets, X_raw):
8007
+ def transformer_utilities(self, rules, datasets, X_raw, batch_size=2):
7940
8008
  self.text_encoder(datasets)
7941
8009
  _, y_true = self.input_encoding(datasets)
7942
8010
  sequence_inputs = self.sequence_encoding(datasets)
@@ -7954,7 +8022,7 @@ class IntegratedPipeline:
7954
8022
  mode = 'fixed_backward'
7955
8023
 
7956
8024
  if self.use_transformer:
7957
- self.model2.train(sequence_inputs, y_true, epochs=100, mode=mode, lr=lr, embedded=True)
8025
+ self.model2.train(sequence_inputs, y_true, epochs=100, mode=mode, lr=lr, embedded=True, batch_size=batch_size)
7958
8026
 
7959
8027
  X_raw_generation, y, n_classes, input_dim = self.mlp_training_features(rules, datasets)
7960
8028
  X_raw_features = self.tfidf.transform(X_raw_generation).toarray()
@@ -9944,6 +10012,7 @@ class PipelineAsyncManager:
9944
10012
  class PipelinePredictionManager:
9945
10013
  def __init__(self, pipeline, label_csv='labels.csv', target_title='title', label='label'):
9946
10014
  self.pipeline = pipeline
10015
+
9947
10016
  try:
9948
10017
  print("📖 Loading labels from text file...")
9949
10018
  self.titles, self.y_raw, self.label_map = self.load_labels_from_csv(label_csv, target_title, label)
@@ -9985,7 +10054,7 @@ class PipelinePredictionManager:
9985
10054
 
9986
10055
 
9987
10056
 
9988
- def regular_prediction_method(self, titles, label_map, rules, show_proba=False, top_k=3, use_transformer=True):
10057
+ def regular_prediction_method(self, titles, label_map, rules, show_proba=False, top_k=3, batch_size=2,use_transformer=True):
9989
10058
  try:
9990
10059
  print(f"\n[🚀] Regular Prediction for labels with {len(titles)} titles...")
9991
10060
  self.pipeline.titles = titles
@@ -9996,7 +10065,7 @@ class PipelinePredictionManager:
9996
10065
 
9997
10066
  dataset, X = self.pipeline.data_preparation(titles, label_map)
9998
10067
  _, y, _, _ = self.pipeline.mlp_training_features(rules, dataset)
9999
- self.pipeline.transformer_utilities(rules, dataset, X)
10068
+ self.pipeline.transformer_utilities(rules, dataset, X, batch_size=batch_size)
10000
10069
  input_ids, _ = self.pipeline.input_encoding(dataset)
10001
10070
 
10002
10071
 
@@ -10244,7 +10313,7 @@ class PipelinePredictionManager:
10244
10313
  # Only recalibrate if models disagreed AND we have valid results
10245
10314
  if results and not results[0].get('models_agree', True):
10246
10315
  print("\n[⚠️] Disagreement detected between MLP and Transformer predictions. Using calibrated probabilities for final decision.")
10247
- calibrated_probs = self.pipeline.hybrid_prediction(input_ids, X)
10316
+ calibrated_probs = self.pipeline.hybrid_prediction(input_ids, X, batch_size=batch_size)
10248
10317
 
10249
10318
  if calibrated_probs is not None and len(calibrated_probs) > 0:
10250
10319
  final_idx = int(np.argmax(calibrated_probs[:num_classes]))
@@ -10270,8 +10339,8 @@ class PipelinePredictionManager:
10270
10339
 
10271
10340
  return results
10272
10341
 
10273
- def hybrid_model_prediction(self, datasets, X_raw):
10274
- self.pipeline.transformer_utilities(datasets, X_raw)
10342
+ def hybrid_model_prediction(self, datasets, X_raw, batch_size=2):
10343
+ self.pipeline.transformer_utilities(datasets, X_raw, batch_size=batch_size)
10275
10344
  input_datasets = self.pipeline.transformer_input_encoding([i[0] for i in datasets])
10276
10345
 
10277
10346
  probs = self.model.predict_proba(input_datasets, X_raw, type='Hybrid')[0]
@@ -10279,7 +10348,7 @@ class PipelinePredictionManager:
10279
10348
 
10280
10349
  return probs, pred
10281
10350
 
10282
- def robust_prediction(self, pipeline, titles, label_map, show_proba=True, top_k=3):
10351
+ def robust_prediction(self, pipeline, titles, label_map, show_proba=True, top_k=3, batch_size=2):
10283
10352
  self.pipeline.titles = titles
10284
10353
  self.pipeline.labels = label_map
10285
10354
 
@@ -10288,10 +10357,10 @@ class PipelinePredictionManager:
10288
10357
  datasets, X_raw = self.pipeline.data_preparation(titles, label_map)
10289
10358
  reverse_map = {v: k for k, v in label_map.items()}
10290
10359
 
10291
- self.pipeline.transformer_utilities(datasets, X_raw)
10360
+ self.pipeline.transformer_utilities(datasets, X_raw, batch_size=batch_size)
10292
10361
  input_datasets = self.pipeline.transformer_input_encoding(datasets)
10293
10362
  pred_probs = self.pipeline.predict_proba(input_datasets, X_raw, type='Hybrid')[0]
10294
- pred_result = self.pipeline.hybrid_prediction(input_datasets, X_raw)
10363
+ pred_result = self.pipeline.hybrid_prediction(input_datasets, X_raw, batch_size=batch_size)
10295
10364
 
10296
10365
  print("\n[🔍] Prediction result structure:")
10297
10366
  print(f"[=] Type: {type(pred_result)}")
@@ -10487,7 +10556,8 @@ class PipelinePredictionManager:
10487
10556
  show_proba=False, top_k=3,
10488
10557
  use_transformer=True,
10489
10558
  return_attention=False,
10490
- save_results=True):
10559
+ save_results=True,
10560
+ batch_size=2):
10491
10561
  try:
10492
10562
  eps = 1e-5
10493
10563
  trans_probs = None
@@ -10504,7 +10574,7 @@ class PipelinePredictionManager:
10504
10574
 
10505
10575
  dataset, X = self.pipeline.data_preparation(titles, label_map)
10506
10576
  _, y, _, _ = self.pipeline.mlp_training_features(rules, dataset)
10507
- self.pipeline.transformer_utilities(rules, dataset, X)
10577
+ self.pipeline.transformer_utilities(rules, dataset, X, batch_size=batch_size)
10508
10578
  input_ids, _ = self.pipeline.input_encoding(dataset)
10509
10579
 
10510
10580
  if use_transformer and hasattr(self.pipeline, 'vocab') and self.pipeline.vocab:
@@ -10738,7 +10808,7 @@ class PipelinePredictionManager:
10738
10808
  elif results and not results[0].get('models_agree', True) or not self.pipeline.agreement:
10739
10809
  need_peer_condition = not results[0].get('models_agree', True) and self.pipeline.peer_assistance_threshold > 0.3
10740
10810
  print("\n[⚠️] Disagreement detected between MLP and Transformer predictions. Using calibrated probabilities for final decision.")
10741
- if need_peer_condition:
10811
+ if not self.pipeline.autonomous and need_peer_condition:
10742
10812
  print('|| Uncertain advanced prediction, requesting peer assistance if allowed...')
10743
10813
  final_probs = self.pipeline._handle_distributed_connections(final_probs, attn_weights, input_ids, agreement)
10744
10814
 
@@ -11348,7 +11418,8 @@ class CohesiveAgentDeployment:
11348
11418
  Handles graceful shutdown, error recovery, and peer connections.
11349
11419
  """
11350
11420
 
11351
- def __init__(self,
11421
+ def __init__(self,
11422
+ pipeline: IntegratedPipeline = None,
11352
11423
  memory_name: str,
11353
11424
  filename: str,
11354
11425
  target_title: str,
@@ -11363,33 +11434,8 @@ class CohesiveAgentDeployment:
11363
11434
  peer_config: Any='peer_config.json',
11364
11435
  consecutive_peer_config: Any=None
11365
11436
  ):
11366
- super().__init__()
11367
11437
 
11368
- if hasattr(self, '_singleton_initialized'):
11369
- print(f"[===] CohesiveAgentDeployment already initialized, reusing...")
11370
- return
11371
-
11372
- self._singleton_initialized = True
11373
-
11374
-
11375
- self._init_params = {
11376
- 'memory_name': memory_name,
11377
- 'port': peer_discovery_port,
11378
- 'secret_key': secret_key,
11379
- 'trusted_networks':trusted_networks,
11380
- 'shared_auth_token': shared_auth_token
11381
- }
11382
-
11383
- self.pipeline = IntegratedPipeline(
11384
- memory_name=memory_name,
11385
- use_async=True,
11386
- agent_port=peer_discovery_port,
11387
- ssl_cert_file=None,
11388
- ssl_key_file=None,
11389
- secret_key=secret_key,
11390
- shared_auth_token=shared_auth_token,
11391
- predict_manager=predict_manager
11392
- )
11438
+ self.pipeline = pipeline
11393
11439
 
11394
11440
  # Initialize prediction manager
11395
11441
  self.manager = PipelinePredictionManager(
@@ -12574,8 +12620,7 @@ class CohesiveAgentDeployment:
12574
12620
 
12575
12621
  # ============ EXAMPLE: SECURE PEER-TO-PEER CLUSTER ============
12576
12622
 
12577
-
12578
- async def run_secure_agent_cluster(test_titles, label_map, rules, agent_id, filename, title_name, label_name, manager):
12623
+ async def run_secure_agent_cluster(pipeline,test_titles, label_map, rules, agent_id, filename, title_name, label_name, manager):
12579
12624
  """
12580
12625
  Run multiple agents that securely communicate.
12581
12626
  Stops retrying once connected successfully.
@@ -12589,6 +12634,7 @@ async def run_secure_agent_cluster(test_titles, label_map, rules, agent_id, file
12589
12634
 
12590
12635
  # Agent 1 - Primary (Port 5555)
12591
12636
  agent1 = CohesiveAgentDeployment(
12637
+ pipeline=pipeline,
12592
12638
  memory_name="agent_primary",
12593
12639
  filename=filename,
12594
12640
  target_title=title_name,
@@ -12604,6 +12650,7 @@ async def run_secure_agent_cluster(test_titles, label_map, rules, agent_id, file
12604
12650
 
12605
12651
  # Agent 2 - Secondary (Port 5556)
12606
12652
  agent2 = CohesiveAgentDeployment(
12653
+ pipeline=pipeline,
12607
12654
  memory_name="agent_secondary",
12608
12655
  filename=filename,
12609
12656
  target_title=title_name,
@@ -12677,7 +12724,7 @@ async def run_secure_agent_cluster(test_titles, label_map, rules, agent_id, file
12677
12724
 
12678
12725
 
12679
12726
 
12680
- async def example_async_with_result_queue(test_titles, label_map, rules, agent_id, filename, title_name, label_name):
12727
+ async def example_async_with_result_queue(pipeline, test_titles, label_map, rules, agent_id, filename, title_name, label_name):
12681
12728
  # Example using the proper result queue
12682
12729
 
12683
12730
  agent = CohesiveAgentDeployment(
@@ -12742,15 +12789,15 @@ async def example_async_with_result_queue(test_titles, label_map, rules, agent_i
12742
12789
 
12743
12790
 
12744
12791
 
12745
- def initiate_cohesive_agent_deployment_test(test_titles, label_map, rules, agent_id, filename, title_name, label_name, manager):
12792
+ def initiate_cohesive_agent_deployment_test(pipeline, test_titles, label_map, rules, agent_id, filename, title_name, label_name, manager):
12746
12793
  print("\n" + "="*60)
12747
12794
  print("🔮 = TESTING COHESIVE AGENT DEPLOYMENT WITH ASYNC MANAGER = ")
12748
12795
 
12749
12796
  print('Test 1 of Multi agent cluster')
12750
- asyncio.run(run_secure_agent_cluster(test_titles=test_titles, label_map=label_map, rules=rules, agent_id=agent_id, filename=filename, title_name=title_name, label_name=label_name, manager=manager))
12797
+ asyncio.run(run_secure_agent_cluster(pipeline=pipeline, test_titles=test_titles, label_map=label_map, rules=rules, agent_id=agent_id, filename=filename, title_name=title_name, label_name=label_name, manager=manager))
12751
12798
 
12752
12799
  print("\n1. Basic async with result queue")
12753
- asyncio.run(example_async_with_result_queue(test_titles=test_titles, label_map=label_map, rules=rules, agent_id=agent_id, filename=filename, title_name=title_name, label_name=label_name))
12800
+ asyncio.run(example_async_with_result_queue(pipeline=pipeline, test_titles=test_titles, label_map=label_map, rules=rules, agent_id=agent_id, filename=filename, title_name=title_name, label_name=label_name))
12754
12801
 
12755
12802
 
12756
12803
  # async manager setup examples
@@ -12877,10 +12924,10 @@ def PermissiveTest():
12877
12924
  key_file = None
12878
12925
 
12879
12926
  if file:
12880
- pipeline = IntegratedPipeline(file, use_async=True, agent_port=5001, ssl_cert_file=cert_file, ssl_key_file=key_file)
12927
+ pipeline = IntegratedPipeline(file, use_async=True, agent_port=5001, singleton_permitted=False,ssl_cert_file=cert_file, ssl_key_file=key_file)
12881
12928
  else:
12882
12929
  print('|| Using original csv_file.pkl file as fallback...')
12883
- pipeline = IntegratedPipeline('csv_file.pkl', use_async=True, agent_port=5001, ssl_cert_file=cert_file, ssl_key_file=key_file)
12930
+ pipeline = IntegratedPipeline('csv_file.pkl', use_async=True, agent_port=5001, singleton_permitted=False, ssl_cert_file=cert_file, ssl_key_file=key_file)
12884
12931
 
12885
12932
  manager = PipelinePredictionManager(pipeline, label_csv='ManualsTraining.txt', target_title='window_title', label='label')
12886
12933
 
@@ -13024,9 +13071,9 @@ def PermissiveTest():
13024
13071
  if cohesive_permission == 'Y' or cohesive_permission == 'y':
13025
13072
  if not (filename and title and label and filename != 'N'):
13026
13073
  print('[=] Searching fallback filename: ManualsTraining.txt, window_title, label')
13027
- initiate_cohesive_agent_deployment_test(test_titles, label_map, rules, agent_id, 'ManualsTraining.txt', 'window_title', 'label', manager)
13074
+ initiate_cohesive_agent_deployment_test(pipeline,test_titles, label_map, rules, agent_id, 'ManualsTraining.txt', 'window_title', 'label', manager)
13028
13075
  else:
13029
- initiate_cohesive_agent_deployment_test(test_titles, label_map, rules, agent_id, filename, title, label, manager)
13076
+ initiate_cohesive_agent_deployment_test(pipeline, test_titles, label_map, rules, agent_id, filename, title, label, manager)
13030
13077
  print('== Cohesive Agent Deployment Successfully tested! ==')
13031
13078
 
13032
13079
  else:
@@ -13043,3 +13090,4 @@ if __name__ == "__main__":
13043
13090
  traceback.print_exc()
13044
13091
  pass
13045
13092
 
13093
+
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: AbstractIntegratedModule
3
- Version: 0.2.1
4
- Summary: Advanced Integrated Non-LLM AI Module - Backend Framework for Non-LLM AI Agent Framework
3
+ Version: 0.2.3
4
+ Summary: Framework forAdvanced Integrated Non-LLM AI Module library - Backend Framework for Non-LLM AI Agent Framework
5
5
  Author: Micro-Novelty
6
6
  Author-email: hernikpuspita5@gmail.com
7
7
  License: MIT
@@ -40,11 +40,11 @@ https://github.com/Micro-Novelty/IntegratedPipeline-Specialized-Non-LLM-AI-Agent
40
40
  #### Note: The README here you are reading is a direct copy from my README Repository, to download the necessary files, you can visit my Repository with the provided link above.
41
41
 
42
42
  ### Library Short Description:
43
- - Development Stage: Beta, 0.2.0.
43
+ - Development Stage: Beta, 0.2.3.
44
44
  - Maintainer: Micro-Novelty.
45
45
  - library Source-Code is Open-sourced on github.
46
46
  - Purpose: Specifically Designed for providing Non-LLM AI Agent Framework for edge Devices, Optimized for ARM64 architecture.
47
- --------
47
+ - Proven Capabilities: Works on ARM64 Environment, Training and Prediction works efficient on Docker ARM64 environment with QEMU, good parallelizing behavior is guaranteed.
48
48
 
49
49
  <img width="1280" height="600" alt="WhatsApp Image 2026-05-27 at 07 16 32" src="https://github.com/user-attachments/assets/4b58a556-45a3-419b-96fd-9c1b76cac574" />
50
50
 
@@ -342,7 +342,8 @@ B. [=] Advanced Prediction without Transformer, Only Specialized MLP using AWE.
342
342
  ### Both performance Overview
343
343
  <img width="1536" height="1024" alt="WhatsApp Image 2026-05-24 at 10 27 00" src="https://github.com/user-attachments/assets/9404277f-281f-4893-8367-e494833230ea" />
344
344
 
345
- ## Source code of AbstractIntegratedModule
345
+ ## Source code of AbstractIntegratedModule
346
+ - Note: The source code is provided in the repository.
346
347
  - [=] Full Monolithic extensively-documented source code (12K+ Lines): [AbstractIntegratedPipeline-SourceCode.zip](AbstractIntegratedPipeline-SourceCode.zip)
347
348
  - [=] Separated Modules of AbstractIntegratedModule: [AbstractIntegratedModule-separated-modules](AbstractIntegratedModule-separated-modules)
348
349
  - [~] Note:
@@ -353,7 +354,21 @@ B. [=] Advanced Prediction without Transformer, Only Specialized MLP using AWE.
353
354
  - Commercialize it: Package, brand, and sell the software for profit.
354
355
 
355
356
  ## [=] Step's for in-depth Usage
356
- 1. Download:
357
+ 0. Download via PIP:
358
+ - Clone repository first:
359
+ ```bash
360
+ # Clone immediately for Windows and x86_64 only without prerequisites
361
+ git clone https://github.com/Micro-Novelty/IntegratedPipeline-Continous-Learning-AI-Agent-library-framework.git
362
+ cd IntegratedPipeline-Continous-Learning-AI-Agent-library-framework
363
+ ```
364
+
365
+ - Install the library via pip:
366
+ ```bash
367
+ pip install AbstractIntegratedModule #or
368
+ python -m pip install AbstractIntegratedModule
369
+ ```
370
+
371
+ 1. Download for binaries:
357
372
  - AbstractIntegratedModule.pyd (For Windows) (Python 3.13),
358
373
  - AbstractIntegratedModule.cpython-39-x86_64-linux-gnu.so (For linux x86_64) (Python 3.12)
359
374
  - AbstractIntegratedModule.cpython-39-aarch64-linux-gnu.so (for Linux ARM64 - Raspberry Pi) (Python 3.10)
@@ -467,8 +482,16 @@ B. [=] Advanced Prediction without Transformer, Only Specialized MLP using AWE.
467
482
  import numpy as np
468
483
 
469
484
  memory_name = 'agent_memory'
470
- main_model = IntegratedPipeline(memory_name, use_async=True, ssl_cert_file=cert_file, ssl_key_file=key_file) # provide cert_file path or key_file path (optional)
471
- main_prediction = PipelinePredictionManager(main_model, label_csv='example_manual_training.txt', target_title='window_title', label='label')
485
+ main_model = IntegratedPipeline(
486
+ memory_name=memory_name, use_async=True,
487
+ agent_port=5001, # this port is used to set AgentDistributedInference server.
488
+ singleton_permitted=False, # set IntegratedPipeline to singleton if you don't use it for P2P, False if you use P2P.
489
+ ssl_cert_file=cert_file, ssl_key_file=key_file) # provide your cert_file path or key_file path (optional)
490
+
491
+ main_prediction = PipelinePredictionManager(
492
+ main_model, label_csv='example_manual_training.txt',
493
+ target_title='window_title', label='label')
494
+
472
495
  # example_manual_training is a .txt file that contain csv format like above example.
473
496
 
474
497
 
@@ -518,8 +541,9 @@ B. [=] Advanced Prediction without Transformer, Only Specialized MLP using AWE.
518
541
  show_proba=False, top_k=3,
519
542
  use_transformer=True,
520
543
  return_attention=False,
521
- save_results=True)
522
-
544
+ save_results=True,
545
+ batch_size=2)
546
+ # batch size=2 is needed during transformer training for batching, if you have larger samples consider using batch_size > 8, for medium amount of samples (>10 -> <50 samples) consider using 2 or 4 batch_size.
523
547
  # ... more features you can add
524
548
  ```
525
549
 
@@ -600,6 +624,7 @@ predicted_output = async_manager.advanced_batch_prediction(test_titles, label_ma
600
624
  - To Make the Agent cooperate with other peers, consider using this setup:
601
625
  - [=] for ensemble prediction from multiple peers, exchanging predicted label with each other, consider using this setup:
602
626
  ```python
627
+
603
628
  # step 3
604
629
  from AbstractIntegratedModule import CohesiveAgentDeployment
605
630
  from AbstractIntegratedModule import PipelinePredictionManager
@@ -618,23 +643,25 @@ main_model.distribution.enable_ssl = False # set to false if you dont have SSL k
618
643
 
619
644
  # Agent 1 - Primary (Port 5555)
620
645
  agent1 = CohesiveAgentDeployment(
621
- memory_name="agent_primary",
622
- filename=<filename>,
623
- target_title=<title_name>,
646
+ pipeline=main_model, # main_model is your initialized integrated pipeline
647
+ memory_name="agent_primary", # any name you want for the agent.
648
+ filename=<filename>, # name of your .txt file that contains the CSV format and training labels
649
+ target_title=<title_name>,
624
650
  label_name=<label_name>,
625
- security_level="PRODUCTION",
626
- enable_peers=True,
651
+ security_level="PRODUCTION", # production level security
652
+ enable_peers=True, # allow peer discovery
627
653
  trusted_networks=['127.0.0.1/32', '192.168.1.0/24'], # for trusted networks, you need to provide the list of IPs of your peers.
628
654
  peer_discovery_port=5555, # peer port to start P2P
629
- secret_key=secret_key,
655
+ secret_key=secret_key, # your secret key
630
656
  shared_auth_token=secret_key, # your previous initialized secret_key
631
- predict_manager=prediction_manager,
657
+ predict_manager=prediction_manager, # your prediction manager
632
658
  peer_config = <'your_peer_ip_lists.json'> # you need to create .json file that contains your peer IP and Port lists
633
659
  consecutive_peer_config = <'your_second_fallback_peer_ip_lists.json'> # same for this one too, but for fallback.
634
- )
660
+ )
635
661
 
636
662
  # Agent 2 - Secondary (Port 5556)
637
663
  agent2 = CohesiveAgentDeployment(
664
+ pipeline=main_model,
638
665
  memory_name="agent_secondary",
639
666
  filename=<filename>,
640
667
  target_title=<title_name>,
@@ -648,21 +675,20 @@ agent2 = CohesiveAgentDeployment(
648
675
  predict_manager=prediction_manager,
649
676
  peer_config = <'your_peer_ip_lists.json'> # you need to create .json file that contains your peer IP and Port lists
650
677
  consecutive_peer_config = <'your_second_fallback_peer_ip_lists.json'> # same for this one too, but for fallback.
651
- )
678
+ )
652
679
 
653
680
  # Note: CohesiveAgentDeployment contains ConsecutivePeerAgent that can start a server once ensemble prediction from peer is started
654
681
  # be advised to stop the server too before shutdown-ing CohesiveAgentDeployment cluster
655
682
 
656
683
  # example peer_Ip_lists_config.json (de-comment to use)
657
684
  # {
658
- # "known_peers": [ # you must put "known_peers" in the config so python can identify the list of IPs and Ports
685
+ # you must put "known_peers" in the config so python can identify the list of IPs and Ports
686
+ # "known_peers": [
659
687
  # ["127.0.0.1", 5555], can be modified using real IP or local IP.
660
688
  # ["127.0.0.1", 5556]
661
689
  # ]
662
690
  # }
663
691
 
664
- agent1.pipeline = main_model # overrides agent1 baseline pipeline with your original initialized pipelinej
665
- agent2.pipeline = main_model
666
692
 
667
693
  try:
668
694
  # Start both agents
@@ -683,8 +709,8 @@ try:
683
709
 
684
710
  texts = {"test_titles": test_titles, "label_map": label_map, "rules": rules, "use_transformer": True, "agent_id": agent_id}
685
711
 
686
- # texts contains test_titles, label_map, and rules that you can assign,
687
- # agent ID can be strings, int, or floats, recommendeded to make it long for better security.
712
+ # texts dictionary must contain test_titles, label_map, and rules that you can assign,
713
+ # agent ID can be strings, int, or floats, recommendded to make it long for better security.
688
714
 
689
715
  # Make prediction with peer ensemble
690
716
  # Connection will be guaranteed successfull during discovery.
@@ -8,11 +8,11 @@ https://github.com/Micro-Novelty/IntegratedPipeline-Specialized-Non-LLM-AI-Agent
8
8
  #### Note: The README here you are reading is a direct copy from my README Repository, to download the necessary files, you can visit my Repository with the provided link above.
9
9
 
10
10
  ### Library Short Description:
11
- - Development Stage: Beta, 0.2.0.
11
+ - Development Stage: Beta, 0.2.3.
12
12
  - Maintainer: Micro-Novelty.
13
13
  - library Source-Code is Open-sourced on github.
14
14
  - Purpose: Specifically Designed for providing Non-LLM AI Agent Framework for edge Devices, Optimized for ARM64 architecture.
15
- --------
15
+ - Proven Capabilities: Works on ARM64 Environment, Training and Prediction works efficient on Docker ARM64 environment with QEMU, good parallelizing behavior is guaranteed.
16
16
 
17
17
  <img width="1280" height="600" alt="WhatsApp Image 2026-05-27 at 07 16 32" src="https://github.com/user-attachments/assets/4b58a556-45a3-419b-96fd-9c1b76cac574" />
18
18
 
@@ -310,7 +310,8 @@ B. [=] Advanced Prediction without Transformer, Only Specialized MLP using AWE.
310
310
  ### Both performance Overview
311
311
  <img width="1536" height="1024" alt="WhatsApp Image 2026-05-24 at 10 27 00" src="https://github.com/user-attachments/assets/9404277f-281f-4893-8367-e494833230ea" />
312
312
 
313
- ## Source code of AbstractIntegratedModule
313
+ ## Source code of AbstractIntegratedModule
314
+ - Note: The source code is provided in the repository.
314
315
  - [=] Full Monolithic extensively-documented source code (12K+ Lines): [AbstractIntegratedPipeline-SourceCode.zip](AbstractIntegratedPipeline-SourceCode.zip)
315
316
  - [=] Separated Modules of AbstractIntegratedModule: [AbstractIntegratedModule-separated-modules](AbstractIntegratedModule-separated-modules)
316
317
  - [~] Note:
@@ -321,7 +322,21 @@ B. [=] Advanced Prediction without Transformer, Only Specialized MLP using AWE.
321
322
  - Commercialize it: Package, brand, and sell the software for profit.
322
323
 
323
324
  ## [=] Step's for in-depth Usage
324
- 1. Download:
325
+ 0. Download via PIP:
326
+ - Clone repository first:
327
+ ```bash
328
+ # Clone immediately for Windows and x86_64 only without prerequisites
329
+ git clone https://github.com/Micro-Novelty/IntegratedPipeline-Continous-Learning-AI-Agent-library-framework.git
330
+ cd IntegratedPipeline-Continous-Learning-AI-Agent-library-framework
331
+ ```
332
+
333
+ - Install the library via pip:
334
+ ```bash
335
+ pip install AbstractIntegratedModule #or
336
+ python -m pip install AbstractIntegratedModule
337
+ ```
338
+
339
+ 1. Download for binaries:
325
340
  - AbstractIntegratedModule.pyd (For Windows) (Python 3.13),
326
341
  - AbstractIntegratedModule.cpython-39-x86_64-linux-gnu.so (For linux x86_64) (Python 3.12)
327
342
  - AbstractIntegratedModule.cpython-39-aarch64-linux-gnu.so (for Linux ARM64 - Raspberry Pi) (Python 3.10)
@@ -435,8 +450,16 @@ B. [=] Advanced Prediction without Transformer, Only Specialized MLP using AWE.
435
450
  import numpy as np
436
451
 
437
452
  memory_name = 'agent_memory'
438
- main_model = IntegratedPipeline(memory_name, use_async=True, ssl_cert_file=cert_file, ssl_key_file=key_file) # provide cert_file path or key_file path (optional)
439
- main_prediction = PipelinePredictionManager(main_model, label_csv='example_manual_training.txt', target_title='window_title', label='label')
453
+ main_model = IntegratedPipeline(
454
+ memory_name=memory_name, use_async=True,
455
+ agent_port=5001, # this port is used to set AgentDistributedInference server.
456
+ singleton_permitted=False, # set IntegratedPipeline to singleton if you don't use it for P2P, False if you use P2P.
457
+ ssl_cert_file=cert_file, ssl_key_file=key_file) # provide your cert_file path or key_file path (optional)
458
+
459
+ main_prediction = PipelinePredictionManager(
460
+ main_model, label_csv='example_manual_training.txt',
461
+ target_title='window_title', label='label')
462
+
440
463
  # example_manual_training is a .txt file that contain csv format like above example.
441
464
 
442
465
 
@@ -486,8 +509,9 @@ B. [=] Advanced Prediction without Transformer, Only Specialized MLP using AWE.
486
509
  show_proba=False, top_k=3,
487
510
  use_transformer=True,
488
511
  return_attention=False,
489
- save_results=True)
490
-
512
+ save_results=True,
513
+ batch_size=2)
514
+ # batch size=2 is needed during transformer training for batching, if you have larger samples consider using batch_size > 8, for medium amount of samples (>10 -> <50 samples) consider using 2 or 4 batch_size.
491
515
  # ... more features you can add
492
516
  ```
493
517
 
@@ -568,6 +592,7 @@ predicted_output = async_manager.advanced_batch_prediction(test_titles, label_ma
568
592
  - To Make the Agent cooperate with other peers, consider using this setup:
569
593
  - [=] for ensemble prediction from multiple peers, exchanging predicted label with each other, consider using this setup:
570
594
  ```python
595
+
571
596
  # step 3
572
597
  from AbstractIntegratedModule import CohesiveAgentDeployment
573
598
  from AbstractIntegratedModule import PipelinePredictionManager
@@ -586,23 +611,25 @@ main_model.distribution.enable_ssl = False # set to false if you dont have SSL k
586
611
 
587
612
  # Agent 1 - Primary (Port 5555)
588
613
  agent1 = CohesiveAgentDeployment(
589
- memory_name="agent_primary",
590
- filename=<filename>,
591
- target_title=<title_name>,
614
+ pipeline=main_model, # main_model is your initialized integrated pipeline
615
+ memory_name="agent_primary", # any name you want for the agent.
616
+ filename=<filename>, # name of your .txt file that contains the CSV format and training labels
617
+ target_title=<title_name>,
592
618
  label_name=<label_name>,
593
- security_level="PRODUCTION",
594
- enable_peers=True,
619
+ security_level="PRODUCTION", # production level security
620
+ enable_peers=True, # allow peer discovery
595
621
  trusted_networks=['127.0.0.1/32', '192.168.1.0/24'], # for trusted networks, you need to provide the list of IPs of your peers.
596
622
  peer_discovery_port=5555, # peer port to start P2P
597
- secret_key=secret_key,
623
+ secret_key=secret_key, # your secret key
598
624
  shared_auth_token=secret_key, # your previous initialized secret_key
599
- predict_manager=prediction_manager,
625
+ predict_manager=prediction_manager, # your prediction manager
600
626
  peer_config = <'your_peer_ip_lists.json'> # you need to create .json file that contains your peer IP and Port lists
601
627
  consecutive_peer_config = <'your_second_fallback_peer_ip_lists.json'> # same for this one too, but for fallback.
602
- )
628
+ )
603
629
 
604
630
  # Agent 2 - Secondary (Port 5556)
605
631
  agent2 = CohesiveAgentDeployment(
632
+ pipeline=main_model,
606
633
  memory_name="agent_secondary",
607
634
  filename=<filename>,
608
635
  target_title=<title_name>,
@@ -616,21 +643,20 @@ agent2 = CohesiveAgentDeployment(
616
643
  predict_manager=prediction_manager,
617
644
  peer_config = <'your_peer_ip_lists.json'> # you need to create .json file that contains your peer IP and Port lists
618
645
  consecutive_peer_config = <'your_second_fallback_peer_ip_lists.json'> # same for this one too, but for fallback.
619
- )
646
+ )
620
647
 
621
648
  # Note: CohesiveAgentDeployment contains ConsecutivePeerAgent that can start a server once ensemble prediction from peer is started
622
649
  # be advised to stop the server too before shutdown-ing CohesiveAgentDeployment cluster
623
650
 
624
651
  # example peer_Ip_lists_config.json (de-comment to use)
625
652
  # {
626
- # "known_peers": [ # you must put "known_peers" in the config so python can identify the list of IPs and Ports
653
+ # you must put "known_peers" in the config so python can identify the list of IPs and Ports
654
+ # "known_peers": [
627
655
  # ["127.0.0.1", 5555], can be modified using real IP or local IP.
628
656
  # ["127.0.0.1", 5556]
629
657
  # ]
630
658
  # }
631
659
 
632
- agent1.pipeline = main_model # overrides agent1 baseline pipeline with your original initialized pipelinej
633
- agent2.pipeline = main_model
634
660
 
635
661
  try:
636
662
  # Start both agents
@@ -651,8 +677,8 @@ try:
651
677
 
652
678
  texts = {"test_titles": test_titles, "label_map": label_map, "rules": rules, "use_transformer": True, "agent_id": agent_id}
653
679
 
654
- # texts contains test_titles, label_map, and rules that you can assign,
655
- # agent ID can be strings, int, or floats, recommendeded to make it long for better security.
680
+ # texts dictionary must contain test_titles, label_map, and rules that you can assign,
681
+ # agent ID can be strings, int, or floats, recommendded to make it long for better security.
656
682
 
657
683
  # Make prediction with peer ensemble
658
684
  # Connection will be guaranteed successfull during discovery.
@@ -3,8 +3,8 @@ from setuptools import setup
3
3
 
4
4
  setup(
5
5
  name="AbstractIntegratedModule",
6
- version="0.2.1",
7
- description="Advanced Integrated Non-LLM AI Module - Backend Framework for Non-LLM AI Agent Framework",
6
+ version="0.2.3",
7
+ description="Framework forAdvanced Integrated Non-LLM AI Module library - Backend Framework for Non-LLM AI Agent Framework",
8
8
  long_description=open("README.md", encoding="utf-8").read(),
9
9
  long_description_content_type="text/markdown",
10
10
  author="Micro-Novelty",