@@ -792,6 +792,12 @@ <h3>5. Visual Capabilities (CLIP + ChromaDB)</h3>
792792 < div class ="code-wrapper ">
793793 < pre > < button class ="copy-btn " onclick ="copyToClipboard(this) "> Copy</ button > < code class ="language-python "> from typing import TypedDict, List
794794import csv
795+ import os
796+ import chromadb
797+ from chromadb.config import Settings
798+ from PIL import Image
799+ from sentence_transformers import SentenceTransformer
800+ import uuid
795801
796802from langchain_ollama import ChatOllama
797803from langchain.tools import tool
@@ -873,16 +879,6 @@ <h3>5. Visual Capabilities (CLIP + ChromaDB)</h3>
873879 except Exception as e:
874880 return f"Error: {e}"
875881
876-
877- import os
878- import chromadb
879- from chromadb.config import Settings
880- from PIL import Image
881- from sentence_transformers import SentenceTransformer
882- import uuid
883-
884- # ... (existing imports) ...
885-
886882# =========================
887883# Image Indexing (CLIP + ChromaDB)
888884# =========================
@@ -893,8 +889,10 @@ <h3>5. Visual Capabilities (CLIP + ChromaDB)</h3>
893889
894890 # Initialize ChromaDB (persistent)
895891 self.client = chromadb.PersistentClient(path="./chroma_db")
896- self.collection = self.client.get_or_create_collection(name="local_images")
897-
892+ self.collection = self.client.get_or_create_collection(
893+ name="local_images",
894+ metadata={"hnsw:space": "cosine"}
895+ )
898896 # Load CLIP model
899897 print("Loading CLIP model...")
900898 self.model = SentenceTransformer('clip-ViT-B-32')
@@ -1016,7 +1014,6 @@ <h3>5. Visual Capabilities (CLIP + ChromaDB)</h3>
10161014 )
10171015)
10181016
1019-
10201017# =========================
10211018# Graph Nodes
10221019# =========================
0 commit comments