Back to Chroma

Test

examples/server_side_embeddings/huggingface/test.ipynb

1.5.9588 B
Original Source

Prior to running the below make sure that you have an HF server running:

You can run:

bash
docker compose -f examples/server_side_embeddings/huggingface/docker-compose.yml up -d
python
%cd ../../../
python
import chromadb

from chromadb.utils.embedding_functions import HuggingFaceEmbeddingServer


ef = HuggingFaceEmbeddingServer(url="http://localhost:8001/embed")

client = chromadb.HttpClient("http://localhost:8000/")

col=client.get_or_create_collection("test",embedding_function=ef)

col.add(documents=["test"],ids=["test"])

col.query(query_texts=["test"])