How to use redis/langcache-embed-v2 with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("redis/langcache-embed-v2") sentences = [ "What are civil cases and what are some examples?", "What are criminal cases and what are no examples?", "Civil cases involve disputes between individuals or organizations, typically seeking monetary compensation or specific performance, and *do not* include criminal prosecutions by the government.", "Criminal cases involve disputes between individuals or organizations, seeking monetary damages or specific performance, while civil cases concern offenses against the state punishable by imprisonment.", "What are some examples of civil cases?" ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [5, 5]
The community tab is the place to discuss and collaborate with the HF community!