swarms/playground/memory/chroma_usage_example.py

16 lines
257 B

from swarms.memory import ChromaDB
# Initialize the memory
chroma = ChromaDB(
metric="cosine",
limit_tokens=1000,
verbose=True,
1 year ago
)
# Add text
text = "This is a test"
chroma.add(text)
# Search for similar text
similar_text = chroma.query(text)