Files
microdao-daarion/nats_test.py
Apple 4601c6fca8 feat: add Vision Encoder service + Vision RAG implementation
- Vision Encoder Service (OpenCLIP ViT-L/14, GPU-accelerated)
  - FastAPI app with text/image embedding endpoints (768-dim)
  - Docker support with NVIDIA GPU runtime
  - Port 8001, health checks, model info API

- Qdrant Vector Database integration
  - Port 6333/6334 (HTTP/gRPC)
  - Image embeddings storage (768-dim, Cosine distance)
  - Auto collection creation

- Vision RAG implementation
  - VisionEncoderClient (Python client for API)
  - Image Search module (text-to-image, image-to-image)
  - Vision RAG routing in DAGI Router (mode: image_search)
  - VisionEncoderProvider integration

- Documentation (5000+ lines)
  - SYSTEM-INVENTORY.md - Complete system inventory
  - VISION-ENCODER-STATUS.md - Service status
  - VISION-RAG-IMPLEMENTATION.md - Implementation details
  - vision_encoder_deployment_task.md - Deployment checklist
  - services/vision-encoder/README.md - Deployment guide
  - Updated WARP.md, INFRASTRUCTURE.md, Jupyter Notebook

- Testing
  - test-vision-encoder.sh - Smoke tests (6 tests)
  - Unit tests for client, image search, routing

- Services: 17 total (added Vision Encoder + Qdrant)
- AI Models: 3 (qwen3:8b, OpenCLIP ViT-L/14, BAAI/bge-m3)
- GPU Services: 2 (Vision Encoder, Ollama)
- VRAM Usage: ~10 GB (concurrent)

Status: Production Ready 
2025-11-17 05:24:36 -08:00

49 lines
1.6 KiB
Python

#!/usr/bin/env python3
import asyncio
import nats
import sys
async def test_nats_connection():
try:
print("Connecting to NATS...")
nc = await nats.connect('nats://localhost:4222')
print(f"Connected to NATS JetStream at port 4222")
# Check if STREAM_RAG exists
js = nc.jetstream()
try:
stream_info = await js.stream_info("STREAM_RAG")
print(f"STREAM_RAG already exists")
print(f"Subjects: {stream_info.config.subjects}")
except nats.js.errors.StreamNotFound:
print("STREAM_RAG not found, creating it...")
await js.add_stream(
name="STREAM_RAG",
subjects=["parser.document.parsed", "rag.document.ingested", "rwa.summary.created"],
retention=nats.RetentionPolicy.WORK_QUEUE,
storage=nats.StorageType.FILE,
replicas=3
)
print("STREAM_RAG created successfully")
except Exception as e:
print(f"Error creating STREAM_RAG: {e}")
# Test message publishing
print("\nTesting message publishing...")
await js.publish("parser.document.parsed", "{}")
print("Test message published successfully")
await nc.close()
return True
except Exception as e:
print(f"Error connecting to NATS: {e}")
return False
if __name__ == "__main__":
# Try to run the test
if not test_nats_connection():
print("Falling back to skip NATS integration tests")
sys.exit(1)
print("\n=== Test completed successfully ===")
sys.exit(0)