AbstractIntegratedModule 0.3.7__tar.gz → 0.3.9__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.
- abstractintegratedmodule-0.3.9/AbstractIntegratedModule.cp313-win_amd64.pyd +0 -0
- {abstractintegratedmodule-0.3.7 → abstractintegratedmodule-0.3.9}/AbstractIntegratedModule.cpython-310-aarch64-linux-gnu.so +0 -0
- {abstractintegratedmodule-0.3.7 → abstractintegratedmodule-0.3.9}/AbstractIntegratedModule.cpython-312-x86_64-linux-gnu.so +0 -0
- {abstractintegratedmodule-0.3.7 → abstractintegratedmodule-0.3.9/AbstractIntegratedModule.egg-info}/PKG-INFO +3 -3
- {abstractintegratedmodule-0.3.7 → abstractintegratedmodule-0.3.9}/AbstractIntegratedModule.py +191 -79
- {abstractintegratedmodule-0.3.7/AbstractIntegratedModule.egg-info → abstractintegratedmodule-0.3.9}/PKG-INFO +3 -3
- {abstractintegratedmodule-0.3.7 → abstractintegratedmodule-0.3.9}/README.md +2 -2
- {abstractintegratedmodule-0.3.7 → abstractintegratedmodule-0.3.9}/setup.py +1 -1
- abstractintegratedmodule-0.3.7/AbstractIntegratedModule.cp313-win_amd64.pyd +0 -0
- {abstractintegratedmodule-0.3.7 → abstractintegratedmodule-0.3.9}/AbstractIntegratedModule.egg-info/SOURCES.txt +0 -0
- {abstractintegratedmodule-0.3.7 → abstractintegratedmodule-0.3.9}/AbstractIntegratedModule.egg-info/dependency_links.txt +0 -0
- {abstractintegratedmodule-0.3.7 → abstractintegratedmodule-0.3.9}/AbstractIntegratedModule.egg-info/requires.txt +0 -0
- {abstractintegratedmodule-0.3.7 → abstractintegratedmodule-0.3.9}/AbstractIntegratedModule.egg-info/top_level.txt +0 -0
- {abstractintegratedmodule-0.3.7 → abstractintegratedmodule-0.3.9}/MANIFEST.in +0 -0
- {abstractintegratedmodule-0.3.7 → abstractintegratedmodule-0.3.9}/pyproject.toml +0 -0
- {abstractintegratedmodule-0.3.7 → abstractintegratedmodule-0.3.9}/setup.cfg +0 -0
|
Binary file
|
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: AbstractIntegratedModule
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.9
|
|
4
4
|
Summary: Framework for Advanced 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
|
|
@@ -42,7 +42,7 @@ https://github.com/Micro-Novelty/IntegratedPipeline-Specialized-Non-LLM-AI-Agent
|
|
|
42
42
|
#### 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.
|
|
43
43
|
|
|
44
44
|
### Library Short Description:
|
|
45
|
-
- Development Stage: Beta, 0.3.
|
|
45
|
+
- Development Stage: Beta, 0.3.9.
|
|
46
46
|
- Maintainer: Micro-Novelty.
|
|
47
47
|
- library Source-Code is Open-sourced on github.
|
|
48
48
|
- Purpose: Specifically Designed for providing Non-LLM AI Agent Framework for edge Devices, Optimized for ARM64 architecture.
|
|
@@ -66,7 +66,7 @@ https://github.com/Micro-Novelty/IntegratedPipeline-Specialized-Non-LLM-AI-Agent
|
|
|
66
66
|
-----
|
|
67
67
|
|
|
68
68
|
<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" />
|
|
69
|
-
|
|
69
|
+
[](https://pepy.tech/projects/abstractintegratedmodule)
|
|
70
70
|
|
|
71
71
|
## [+] MANN Intro
|
|
72
72
|
[=] Memory augmented Neural network (MANN) is a neural network architecture coupled with an external, dynamic memory module, allowing it to store, retrieve, and update information similarly to a computer's RAM. Unlike traditional networks that store knowledge only in weight parameters, MANNs excel at fast learning, long-term dependency handling, and episodic recall, In IntegratedPipeline, Its memory is stored in a custom database inside your local machine, then later used for memory retrieval, transfered to the AI Dictionary where it can finnaly recall its memory when input condition matched with memory.
|
{abstractintegratedmodule-0.3.7 → abstractintegratedmodule-0.3.9}/AbstractIntegratedModule.py
RENAMED
|
@@ -295,6 +295,7 @@ class Singleton(metaclass=SingletonMeta):
|
|
|
295
295
|
# allowing it to better process data with varying geometric complexity, and providing a more stable training process in scarce data environment.
|
|
296
296
|
# It can be used as a general weight initialization and shaping method for various models, especially in scenarios where data geometry is complex and data is scarce.
|
|
297
297
|
|
|
298
|
+
|
|
298
299
|
class GeometricWeightShaping:
|
|
299
300
|
def __init__(self, input_size, output_size):
|
|
300
301
|
self.input_size = input_size
|
|
@@ -313,7 +314,7 @@ class GeometricWeightShaping:
|
|
|
313
314
|
|
|
314
315
|
anisotropy = self.anisotropy_measurement(raw_X)
|
|
315
316
|
|
|
316
|
-
structured_noise = np.random.uniform(
|
|
317
|
+
structured_noise = np.random.uniform(eps, mag, size=raw_X.shape)
|
|
317
318
|
X = np.vstack((raw_X, structured_noise))
|
|
318
319
|
if X.ndim == 2 and X.shape[1] == 1:
|
|
319
320
|
X = np.hstack((raw_X, structured_noise))
|
|
@@ -334,9 +335,9 @@ class GeometricWeightShaping:
|
|
|
334
335
|
trC = (1/6 + K_G) / (trB**2 - 1.0)
|
|
335
336
|
|
|
336
337
|
if np.isnan(trC) or np.isinf(trC):
|
|
337
|
-
trC = anisotropy * (1.0 -
|
|
338
|
+
trC = anisotropy * (1.0 - np.std(x)) + eps
|
|
338
339
|
|
|
339
|
-
floating_point = np.random.uniform(
|
|
340
|
+
floating_point = np.random.uniform(1e-10, trC, size=X.shape)
|
|
340
341
|
return k, floating_point, structured_noise
|
|
341
342
|
|
|
342
343
|
|
|
@@ -417,7 +418,7 @@ class GeometricWeightShaping:
|
|
|
417
418
|
if np.isnan(efficient_distributed_energy) or np.isinf(efficient_distributed_energy):
|
|
418
419
|
efficient_distributed_energy = (1 - AMR) + eps
|
|
419
420
|
|
|
420
|
-
floating_context = rng.uniform(
|
|
421
|
+
floating_context = rng.uniform(1e-10, efficient_distributed_energy, size=(input_size, output_size))
|
|
421
422
|
self.floating_context = floating_context
|
|
422
423
|
|
|
423
424
|
return floating_context
|
|
@@ -439,7 +440,6 @@ class GeometricWeightShaping:
|
|
|
439
440
|
return floating_context
|
|
440
441
|
|
|
441
442
|
|
|
442
|
-
|
|
443
443
|
# ________ UTILITY functions for activations and losses, can be used across different models and architectures _________
|
|
444
444
|
|
|
445
445
|
def sigmoid(x):
|
|
@@ -1710,6 +1710,7 @@ class LSTMEngine:
|
|
|
1710
1710
|
# cell state c is untouched —
|
|
1711
1711
|
# preserves long-term memory
|
|
1712
1712
|
if self.model.Wy is None:
|
|
1713
|
+
|
|
1713
1714
|
self.model.Wy = self.model.weight_shaper.weight_shaping(x_seq)
|
|
1714
1715
|
|
|
1715
1716
|
pred = h @ self.model.Wy.T + self.model.by
|
|
@@ -4755,11 +4756,19 @@ class ThreadedMessageQueue:
|
|
|
4755
4756
|
|
|
4756
4757
|
logger.info(f"[=] Threaded message queue started with {self._worker_threads} workers")
|
|
4757
4758
|
|
|
4758
|
-
def stop(self
|
|
4759
|
+
async def stop(self):
|
|
4759
4760
|
# Stop worker threads gracefully.
|
|
4760
|
-
self.
|
|
4761
|
-
|
|
4762
|
-
|
|
4761
|
+
await self.result_queue.stop()
|
|
4762
|
+
|
|
4763
|
+
# cancel and wait for all workers to exit cleanly
|
|
4764
|
+
for worker in self._workers:
|
|
4765
|
+
worker.cancel()
|
|
4766
|
+
|
|
4767
|
+
if self._workers:
|
|
4768
|
+
await asyncio.gather(*self._workers, return_exceptions=True)
|
|
4769
|
+
|
|
4770
|
+
self._workers.clear()
|
|
4771
|
+
|
|
4763
4772
|
logger.info("[=] Threaded message queue stopped")
|
|
4764
4773
|
|
|
4765
4774
|
def get_stats(self) -> Dict:
|
|
@@ -4856,6 +4865,7 @@ class AgentDistributedInference:
|
|
|
4856
4865
|
self.message_timeout = 30.0
|
|
4857
4866
|
self.CHUNK_SIZE = 8192
|
|
4858
4867
|
self.predict_manager = predict_manager
|
|
4868
|
+
self._health_check_interval = 30 # seconds
|
|
4859
4869
|
|
|
4860
4870
|
self.use_async = use_async
|
|
4861
4871
|
|
|
@@ -4875,7 +4885,6 @@ class AgentDistributedInference:
|
|
|
4875
4885
|
# Queue for outgoing messages (buffered with retry)
|
|
4876
4886
|
self.outgoing_queue = deque()
|
|
4877
4887
|
self.queue_processor_thread = None
|
|
4878
|
-
self._health_check_interval = 10 # seconds
|
|
4879
4888
|
self._last_health_check = time.time()
|
|
4880
4889
|
|
|
4881
4890
|
# Trust configuration
|
|
@@ -4886,7 +4895,6 @@ class AgentDistributedInference:
|
|
|
4886
4895
|
|
|
4887
4896
|
self.pending_requests = {} # request_id -> Future
|
|
4888
4897
|
self.request_lock = threading.Lock()
|
|
4889
|
-
|
|
4890
4898
|
|
|
4891
4899
|
# ============ SECURITY FEATURES ============
|
|
4892
4900
|
|
|
@@ -5191,6 +5199,8 @@ class AgentDistributedInference:
|
|
|
5191
5199
|
self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
5192
5200
|
self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
|
5193
5201
|
self.socket.bind(('0.0.0.0', self.port))
|
|
5202
|
+
|
|
5203
|
+
self.socket.settimeout(1.0)
|
|
5194
5204
|
self.socket.listen(5)
|
|
5195
5205
|
self.running = True
|
|
5196
5206
|
logger.info(f"[=] Server started on port {self.port} with SSL={'enabled' if self.enable_ssl else 'disabled'}")
|
|
@@ -5248,7 +5258,10 @@ class AgentDistributedInference:
|
|
|
5248
5258
|
thread = threading.Thread(target=self._handle_client, args=(client, addr))
|
|
5249
5259
|
thread.daemon = True
|
|
5250
5260
|
thread.start()
|
|
5251
|
-
|
|
5261
|
+
|
|
5262
|
+
except socket.timeout:
|
|
5263
|
+
continue
|
|
5264
|
+
|
|
5252
5265
|
except Exception as e:
|
|
5253
5266
|
if self.running:
|
|
5254
5267
|
print(f"[-] Accept error: {e}")
|
|
@@ -5272,18 +5285,26 @@ class AgentDistributedInference:
|
|
|
5272
5285
|
|
|
5273
5286
|
|
|
5274
5287
|
def stop_server(self):
|
|
5275
|
-
self.running = False
|
|
5276
|
-
if self.socket:
|
|
5277
|
-
self.socket.close()
|
|
5278
|
-
|
|
5288
|
+
self.running = False
|
|
5279
5289
|
# Close all connections
|
|
5280
5290
|
for conn in self.connections:
|
|
5281
|
-
try:
|
|
5291
|
+
try:
|
|
5282
5292
|
self._send_message(conn, {'type': self.MSG_TYPES['DISCONNECT']})
|
|
5293
|
+
|
|
5294
|
+
conn.shutdown(socket.SHUT_RDWR)
|
|
5283
5295
|
conn.close()
|
|
5284
|
-
except:
|
|
5296
|
+
except Exception as e:
|
|
5297
|
+
print(f'[= ERROR =] Socket cant be shutdown due to: {e}')
|
|
5285
5298
|
pass
|
|
5286
|
-
|
|
5299
|
+
|
|
5300
|
+
self.connections.clear()
|
|
5301
|
+
if self.socket:
|
|
5302
|
+
try:
|
|
5303
|
+
self.socket.close()
|
|
5304
|
+
except Exception as e:
|
|
5305
|
+
print(f'[= ERROR =] Socket cant be closed due to: {e}')
|
|
5306
|
+
pass
|
|
5307
|
+
|
|
5287
5308
|
print("[🛑] Server stopped")
|
|
5288
5309
|
|
|
5289
5310
|
# ============ CLIENT METHODS ============
|
|
@@ -5803,9 +5824,13 @@ class AgentDistributedInference:
|
|
|
5803
5824
|
def _start_health_checker(self):
|
|
5804
5825
|
# Start background health checker for async mode.
|
|
5805
5826
|
def health_check_loop():
|
|
5806
|
-
|
|
5807
|
-
|
|
5808
|
-
|
|
5827
|
+
for _ in range(self._health_check_interval * 10):
|
|
5828
|
+
if not self.running:
|
|
5829
|
+
return
|
|
5830
|
+
time.sleep(0.1)
|
|
5831
|
+
|
|
5832
|
+
if self.running:
|
|
5833
|
+
self._check_agent_health()
|
|
5809
5834
|
|
|
5810
5835
|
self._health_thread = threading.Thread(target=health_check_loop, daemon=True)
|
|
5811
5836
|
self._health_thread.start()
|
|
@@ -5842,7 +5867,18 @@ class AgentDistributedInference:
|
|
|
5842
5867
|
# Graceful shutdown.
|
|
5843
5868
|
logger.info("[=] Shutting down AgentDistributedInference...")
|
|
5844
5869
|
self.running = False
|
|
5845
|
-
|
|
5870
|
+
|
|
5871
|
+
try:
|
|
5872
|
+
loop = asyncio.get_event_loop()
|
|
5873
|
+
if loop.is_running():
|
|
5874
|
+
loop.call_soon_threadsafe(
|
|
5875
|
+
lambda: asyncio.ensure_future(self.message_queue.stop())
|
|
5876
|
+
)
|
|
5877
|
+
else:
|
|
5878
|
+
loop.run_until_complete(self.message_queue.stop())
|
|
5879
|
+
except Exception as e:
|
|
5880
|
+
logger.warning(f"[=] Message queue stop warning: {e}")
|
|
5881
|
+
|
|
5846
5882
|
logger.info("[=] Shutdown complete")
|
|
5847
5883
|
|
|
5848
5884
|
# ============ MESSAGE HANDLING ============
|
|
@@ -7448,12 +7484,21 @@ class IntegratedPipeline:
|
|
|
7448
7484
|
|
|
7449
7485
|
print("✅ Async shutdown complete")
|
|
7450
7486
|
|
|
7451
|
-
def shutdown(self):
|
|
7452
|
-
# Synchronous shutdown (for non-async contexts).
|
|
7487
|
+
async def shutdown(self):
|
|
7453
7488
|
if self.distribution:
|
|
7454
|
-
self.distribution.stop()
|
|
7455
|
-
|
|
7489
|
+
self.distribution.stop() # sync call
|
|
7490
|
+
self.distribution.stop_server()
|
|
7491
|
+
|
|
7492
|
+
|
|
7493
|
+
if hasattr(self, '_shutdown_event'):
|
|
7494
|
+
self._shutdown_event.set()
|
|
7456
7495
|
|
|
7496
|
+
# cancel async tasks
|
|
7497
|
+
if self._async_tasks:
|
|
7498
|
+
for task in self._async_tasks:
|
|
7499
|
+
if not task.done():
|
|
7500
|
+
task.cancel()
|
|
7501
|
+
await asyncio.gather(*self._async_tasks, return_exceptions=True)
|
|
7457
7502
|
|
|
7458
7503
|
|
|
7459
7504
|
def cosine_similarity(self, a, b):
|
|
@@ -9792,16 +9837,31 @@ class WorkerPool:
|
|
|
9792
9837
|
async def stop(self):
|
|
9793
9838
|
# Stop all workers
|
|
9794
9839
|
self._running = False
|
|
9840
|
+
await self.result_queue.stop()
|
|
9841
|
+
|
|
9842
|
+
# cancel and wait for all workers to exit cleanly
|
|
9795
9843
|
for worker in self._workers:
|
|
9796
9844
|
worker.cancel()
|
|
9797
|
-
|
|
9798
|
-
|
|
9845
|
+
|
|
9846
|
+
if self._workers:
|
|
9847
|
+
await asyncio.gather(*self._workers, return_exceptions=True)
|
|
9848
|
+
|
|
9849
|
+
self._workers.clear()
|
|
9850
|
+
|
|
9851
|
+
|
|
9799
9852
|
async def _worker(self, predict_func):
|
|
9800
9853
|
# Worker that processes requests
|
|
9801
9854
|
while self._running:
|
|
9802
9855
|
try:
|
|
9803
9856
|
# Get next pending request
|
|
9804
|
-
|
|
9857
|
+
try:
|
|
9858
|
+
request = await asyncio.wait_for(
|
|
9859
|
+
self.result_queue.get_pending(),
|
|
9860
|
+
timeout=1.0
|
|
9861
|
+
)
|
|
9862
|
+
except asyncio.TimeoutError:
|
|
9863
|
+
continue # no request yet, re-check self._running
|
|
9864
|
+
|
|
9805
9865
|
if not request:
|
|
9806
9866
|
continue
|
|
9807
9867
|
|
|
@@ -9811,20 +9871,29 @@ class WorkerPool:
|
|
|
9811
9871
|
|
|
9812
9872
|
try:
|
|
9813
9873
|
# Execute prediction (run sync function in thread pool)
|
|
9814
|
-
result = await asyncio.
|
|
9815
|
-
|
|
9816
|
-
|
|
9817
|
-
|
|
9818
|
-
|
|
9874
|
+
result = await asyncio.wait_for(
|
|
9875
|
+
asyncio.to_thread(
|
|
9876
|
+
predict_func,
|
|
9877
|
+
texts=request.texts,
|
|
9878
|
+
api_key=request.api_key,
|
|
9879
|
+
client_ip=request.client_ip
|
|
9880
|
+
),
|
|
9881
|
+
timeout=30.0
|
|
9819
9882
|
)
|
|
9820
9883
|
|
|
9821
9884
|
# Mark as completed
|
|
9822
9885
|
await self.result_queue.complete(request.request_id, result)
|
|
9823
|
-
|
|
9886
|
+
except asyncio.TimeoutError:
|
|
9887
|
+
await self.result_queue._mark_failed(request.request_id, 'timeout')
|
|
9888
|
+
except asyncio.CancelledError:
|
|
9889
|
+
# shutdown mid-prediction — mark failed and exit cleanly
|
|
9890
|
+
await self.result_queue._mark_failed(request.request_id, 'cancelled')
|
|
9891
|
+
break
|
|
9892
|
+
|
|
9824
9893
|
except Exception as e:
|
|
9825
9894
|
# Mark as failed
|
|
9826
9895
|
await self.result_queue._mark_failed(request.request_id, str(e))
|
|
9827
|
-
|
|
9896
|
+
|
|
9828
9897
|
except asyncio.CancelledError:
|
|
9829
9898
|
break
|
|
9830
9899
|
except Exception as e:
|
|
@@ -11038,8 +11107,8 @@ class PipelineAsyncManager:
|
|
|
11038
11107
|
self._thread = None
|
|
11039
11108
|
self._queue_worker = None
|
|
11040
11109
|
self._health_thread = None
|
|
11041
|
-
|
|
11042
|
-
logger.info("[-]
|
|
11110
|
+
print('[=] PipelineAsync Wrapper stopped')
|
|
11111
|
+
logger.info("[-] PipelineAsync Wrapper stopped")
|
|
11043
11112
|
return True
|
|
11044
11113
|
|
|
11045
11114
|
def __enter__(self):
|
|
@@ -12352,6 +12421,7 @@ class ConsecutivePeerAgent:
|
|
|
12352
12421
|
self.stats['predictions'] += 1
|
|
12353
12422
|
return best_result
|
|
12354
12423
|
|
|
12424
|
+
|
|
12355
12425
|
def start_server(self):
|
|
12356
12426
|
"""Start server to accept peer connections"""
|
|
12357
12427
|
|
|
@@ -12359,8 +12429,12 @@ class ConsecutivePeerAgent:
|
|
|
12359
12429
|
self.server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
12360
12430
|
self.server_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
|
12361
12431
|
self.server_socket.bind(('0.0.0.0', self.port))
|
|
12362
|
-
|
|
12432
|
+
self.server_socket.settimeout(1.0)
|
|
12363
12433
|
self.server_socket.listen(5)
|
|
12434
|
+
|
|
12435
|
+
if self.pipeline.distribution.enable_ssl and self.pipeline.distribution.ssl_context:
|
|
12436
|
+
self.server_socket = self.pipeline.distribution.ssl_context.wrap_socket(self.server_socket, server_side=True)
|
|
12437
|
+
|
|
12364
12438
|
self.running = True
|
|
12365
12439
|
|
|
12366
12440
|
print(f"[ConsecutivePeerAgent] Server listening on port {self.port}!")
|
|
@@ -12379,14 +12453,22 @@ class ConsecutivePeerAgent:
|
|
|
12379
12453
|
thread = threading.Thread(target=self._handle_client, args=(client, addr))
|
|
12380
12454
|
thread.daemon = True
|
|
12381
12455
|
thread.start()
|
|
12382
|
-
|
|
12456
|
+
except socket.timeout:
|
|
12457
|
+
continue
|
|
12383
12458
|
except Exception as e:
|
|
12384
12459
|
if self.running:
|
|
12385
|
-
|
|
12460
|
+
print(f"[ConsecutivePeerAgent] Server error: {e}")
|
|
12461
|
+
try:
|
|
12462
|
+
self.server_socket.close()
|
|
12463
|
+
except:
|
|
12464
|
+
pass
|
|
12465
|
+
|
|
12466
|
+
print("[ConsecutivePeerAgent] Server Successfully Stopped listening !")
|
|
12386
12467
|
|
|
12387
12468
|
thread = threading.Thread(target=server_loop, daemon=True)
|
|
12388
12469
|
thread.start()
|
|
12389
|
-
|
|
12470
|
+
|
|
12471
|
+
|
|
12390
12472
|
def _handle_client(self, client, addr):
|
|
12391
12473
|
# Handle incoming peer connection
|
|
12392
12474
|
print(f"[ConsecutivePeerAgent] Client connected from {addr}")
|
|
@@ -12452,21 +12534,32 @@ class ConsecutivePeerAgent:
|
|
|
12452
12534
|
def stop_server(self):
|
|
12453
12535
|
self.running = False
|
|
12454
12536
|
|
|
12455
|
-
print('[ConsecutivePeerAgent] Server shutdown
|
|
12456
|
-
if self.server_socket:
|
|
12457
|
-
self.server_socket.close()
|
|
12458
|
-
|
|
12537
|
+
print('[ConsecutivePeerAgent] Initiating Server shutdown...')
|
|
12459
12538
|
# Close all peer connections
|
|
12460
|
-
|
|
12461
|
-
|
|
12462
|
-
|
|
12463
|
-
|
|
12464
|
-
|
|
12465
|
-
|
|
12466
|
-
|
|
12467
|
-
|
|
12468
|
-
|
|
12469
|
-
|
|
12539
|
+
try:
|
|
12540
|
+
with self._lock:
|
|
12541
|
+
for key, info in self.connected_peers.items():
|
|
12542
|
+
try:
|
|
12543
|
+
info['sock'].shutdown(socket.SHUT_RDWR)
|
|
12544
|
+
info['sock'].close()
|
|
12545
|
+
except:
|
|
12546
|
+
pass
|
|
12547
|
+
|
|
12548
|
+
self.connected_peers.clear()
|
|
12549
|
+
if self.server_socket:
|
|
12550
|
+
try:
|
|
12551
|
+
self.server_socket.close()
|
|
12552
|
+
except Exception as e:
|
|
12553
|
+
print(f'[ConsecutivePeerAgent] Cant close socket: {e}')
|
|
12554
|
+
pass
|
|
12555
|
+
|
|
12556
|
+
print('[ConsecutivePeerAgent] Server Successfully Stopped listening !')
|
|
12557
|
+
|
|
12558
|
+
except Exception as e:
|
|
12559
|
+
print(f'[ConsecutivePeerAgent] Error closing socket: {e}')
|
|
12560
|
+
pass
|
|
12561
|
+
|
|
12562
|
+
|
|
12470
12563
|
def get_stats(self) -> Dict:
|
|
12471
12564
|
# Get statistics
|
|
12472
12565
|
return {
|
|
@@ -13654,23 +13747,40 @@ class CohesiveAgentDeployment:
|
|
|
13654
13747
|
# Graceful shutdown of all components
|
|
13655
13748
|
logger.info("🛑 Shutting down agent...")
|
|
13656
13749
|
|
|
13657
|
-
#
|
|
13750
|
+
# signal shutdown to all loops
|
|
13658
13751
|
self._shutdown_event.set()
|
|
13752
|
+
|
|
13753
|
+
# stop worker pool.
|
|
13754
|
+
if hasattr(self, 'worker_pool'):
|
|
13755
|
+
await self.worker_pool.stop()
|
|
13756
|
+
|
|
13757
|
+
if hasattr(self, 'result_queue'):
|
|
13758
|
+
await self.result_queue.stop()
|
|
13759
|
+
|
|
13760
|
+
# cancel peer tasks
|
|
13761
|
+
if self._peer_tasks:
|
|
13762
|
+
for task in self._peer_tasks:
|
|
13763
|
+
task.cancel()
|
|
13764
|
+
await asyncio.gather(*self._peer_tasks, return_exceptions=True)
|
|
13659
13765
|
|
|
13660
|
-
#
|
|
13661
|
-
|
|
13662
|
-
|
|
13663
|
-
|
|
13664
|
-
#
|
|
13766
|
+
# stop peer agent server
|
|
13767
|
+
if hasattr(self, '_peer_agent'):
|
|
13768
|
+
self._peer_agent.stop_server()
|
|
13769
|
+
|
|
13770
|
+
# stop distribution server
|
|
13665
13771
|
if self.enable_peers:
|
|
13666
13772
|
self.pipeline.distribution.stop_server()
|
|
13667
|
-
|
|
13668
|
-
#
|
|
13669
|
-
|
|
13670
|
-
|
|
13671
|
-
|
|
13672
|
-
|
|
13673
|
-
|
|
13773
|
+
|
|
13774
|
+
# FIX 1 — offload blocking stop() to thread so event loop stays free
|
|
13775
|
+
print('[=] Stopping Asynchronous manager setup...')
|
|
13776
|
+
await asyncio.get_event_loop().run_in_executor(
|
|
13777
|
+
None,
|
|
13778
|
+
lambda: self.async_manager.stop(timeout=5, force=True)
|
|
13779
|
+
)
|
|
13780
|
+
|
|
13781
|
+
await asyncio.sleep(0.5)
|
|
13782
|
+
print('✅ Agent shutdown complete')
|
|
13783
|
+
|
|
13674
13784
|
logger.info("✅ Agent shutdown complete")
|
|
13675
13785
|
|
|
13676
13786
|
def get_api_key(self) -> str:
|
|
@@ -13767,19 +13877,19 @@ async def run_secure_agent_cluster(pipeline,test_titles, label_map, rules, agent
|
|
|
13767
13877
|
print(f" Second Confidence: {result2.get('confidence', 0):.2%}")
|
|
13768
13878
|
|
|
13769
13879
|
# Keep running briefly
|
|
13770
|
-
print("\n⏳ Cluster stable. Waiting
|
|
13771
|
-
await asyncio.sleep(
|
|
13880
|
+
print("\n⏳ Cluster stable. Waiting 30 seconds before shutdown...")
|
|
13881
|
+
await asyncio.sleep(30)
|
|
13882
|
+
agent1._peer_agent.stop_server()
|
|
13772
13883
|
agent2._peer_agent.stop_server()
|
|
13773
13884
|
|
|
13774
13885
|
except Exception as e:
|
|
13775
13886
|
print(f"\n❌ Error in cluster: {e}")
|
|
13776
13887
|
traceback.print_exc()
|
|
13777
13888
|
|
|
13778
|
-
|
|
13779
|
-
|
|
13780
|
-
|
|
13781
|
-
|
|
13782
|
-
print("✅ Cluster shutdown complete")
|
|
13889
|
+
print("\n🛑 Shutting down cluster...")
|
|
13890
|
+
await agent1.shutdown()
|
|
13891
|
+
await agent2.shutdown()
|
|
13892
|
+
print("✅ Cluster shutdown complete")
|
|
13783
13893
|
|
|
13784
13894
|
|
|
13785
13895
|
|
|
@@ -13788,12 +13898,14 @@ async def example_async_with_result_queue(pipeline, test_titles, label_map, rule
|
|
|
13788
13898
|
# Example using the proper result queue
|
|
13789
13899
|
|
|
13790
13900
|
agent = CohesiveAgentDeployment(
|
|
13901
|
+
pipeline=pipeline,
|
|
13791
13902
|
memory_name="test_agent",
|
|
13792
13903
|
filename=filename,
|
|
13793
13904
|
target_title=title_name,
|
|
13794
13905
|
label_name=label_name,
|
|
13795
13906
|
security_level="DEVELOPMENT",
|
|
13796
|
-
enable_peers=False
|
|
13907
|
+
enable_peers=False,
|
|
13908
|
+
peer_discovery_port=5558
|
|
13797
13909
|
)
|
|
13798
13910
|
|
|
13799
13911
|
await agent.start()
|
|
@@ -13911,7 +14023,7 @@ def initiate_graceful_shutdown(pipeline, wrapper):
|
|
|
13911
14023
|
print("[!] Some requests still pending")
|
|
13912
14024
|
|
|
13913
14025
|
# Graceful shutdown
|
|
13914
|
-
wrapper.stop(
|
|
14026
|
+
wrapper.stop()
|
|
13915
14027
|
|
|
13916
14028
|
def AsyncWrappertest(pipeline, prediction_manager, test_titles, label_map, rules):
|
|
13917
14029
|
print("\n" + "="*60)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: AbstractIntegratedModule
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.9
|
|
4
4
|
Summary: Framework for Advanced 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
|
|
@@ -42,7 +42,7 @@ https://github.com/Micro-Novelty/IntegratedPipeline-Specialized-Non-LLM-AI-Agent
|
|
|
42
42
|
#### 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.
|
|
43
43
|
|
|
44
44
|
### Library Short Description:
|
|
45
|
-
- Development Stage: Beta, 0.3.
|
|
45
|
+
- Development Stage: Beta, 0.3.9.
|
|
46
46
|
- Maintainer: Micro-Novelty.
|
|
47
47
|
- library Source-Code is Open-sourced on github.
|
|
48
48
|
- Purpose: Specifically Designed for providing Non-LLM AI Agent Framework for edge Devices, Optimized for ARM64 architecture.
|
|
@@ -66,7 +66,7 @@ https://github.com/Micro-Novelty/IntegratedPipeline-Specialized-Non-LLM-AI-Agent
|
|
|
66
66
|
-----
|
|
67
67
|
|
|
68
68
|
<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" />
|
|
69
|
-
|
|
69
|
+
[](https://pepy.tech/projects/abstractintegratedmodule)
|
|
70
70
|
|
|
71
71
|
## [+] MANN Intro
|
|
72
72
|
[=] Memory augmented Neural network (MANN) is a neural network architecture coupled with an external, dynamic memory module, allowing it to store, retrieve, and update information similarly to a computer's RAM. Unlike traditional networks that store knowledge only in weight parameters, MANNs excel at fast learning, long-term dependency handling, and episodic recall, In IntegratedPipeline, Its memory is stored in a custom database inside your local machine, then later used for memory retrieval, transfered to the AI Dictionary where it can finnaly recall its memory when input condition matched with memory.
|
|
@@ -10,7 +10,7 @@ https://github.com/Micro-Novelty/IntegratedPipeline-Specialized-Non-LLM-AI-Agent
|
|
|
10
10
|
#### 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.
|
|
11
11
|
|
|
12
12
|
### Library Short Description:
|
|
13
|
-
- Development Stage: Beta, 0.3.
|
|
13
|
+
- Development Stage: Beta, 0.3.9.
|
|
14
14
|
- Maintainer: Micro-Novelty.
|
|
15
15
|
- library Source-Code is Open-sourced on github.
|
|
16
16
|
- Purpose: Specifically Designed for providing Non-LLM AI Agent Framework for edge Devices, Optimized for ARM64 architecture.
|
|
@@ -34,7 +34,7 @@ https://github.com/Micro-Novelty/IntegratedPipeline-Specialized-Non-LLM-AI-Agent
|
|
|
34
34
|
-----
|
|
35
35
|
|
|
36
36
|
<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" />
|
|
37
|
-
|
|
37
|
+
[](https://pepy.tech/projects/abstractintegratedmodule)
|
|
38
38
|
|
|
39
39
|
## [+] MANN Intro
|
|
40
40
|
[=] Memory augmented Neural network (MANN) is a neural network architecture coupled with an external, dynamic memory module, allowing it to store, retrieve, and update information similarly to a computer's RAM. Unlike traditional networks that store knowledge only in weight parameters, MANNs excel at fast learning, long-term dependency handling, and episodic recall, In IntegratedPipeline, Its memory is stored in a custom database inside your local machine, then later used for memory retrieval, transfered to the AI Dictionary where it can finnaly recall its memory when input condition matched with memory.
|
|
@@ -8,7 +8,7 @@ class BinaryDistribution(Distribution):
|
|
|
8
8
|
|
|
9
9
|
setup(
|
|
10
10
|
name="AbstractIntegratedModule",
|
|
11
|
-
version="0.3.
|
|
11
|
+
version="0.3.9",
|
|
12
12
|
description="Framework for Advanced Integrated Non-LLM AI Module library - Backend Framework for Non-LLM AI Agent Framework",
|
|
13
13
|
long_description=open("README.md", encoding="utf-8").read(),
|
|
14
14
|
long_description_content_type="text/markdown",
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|