Skip to content

Instantly share code, notes, and snippets.

@tazarov
Created November 24, 2023 12:55
Show Gist options
  • Save tazarov/76b239fcfd2823b5c62d1a79868a4b43 to your computer and use it in GitHub Desktop.
Save tazarov/76b239fcfd2823b5c62d1a79868a4b43 to your computer and use it in GitHub Desktop.
Keyword Search in Chroma
import chromadb
from chromadb.config import Settings
client = chromadb.PersistentClient(path="test", settings=Settings(allow_reset=True))
client.reset()
col = client.get_or_create_collection("test")
col.add(ids=["1", "2", "3"], documents=["He is a technology freak and he loves AI topics", "AI technology are advancing at a fast pace", "Innovation in LLMs is a hot topic"])
col.query(query_texts=["technology"], where_document={"$or":[{"$contains":"technology"}, {"$contains":"freak"}]})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment