MCPcopy
hub / github.com/redis/redis-py / embed_text

Function embed_text

doctests/query_combined.py:14–15  ·  view source on GitHub ↗
(model, text)

Source from the content-addressed store, hash-verified

12
13
14def embed_text(model, text):
15 return np.array(model.encode(text)).astype(np.float32).tobytes()
16
17warnings.filterwarnings("ignore", category=FutureWarning, message=r".*clean_up_tokenization_spaces.*")
18model = SentenceTransformer('sentence-transformers/all-MiniLM-L6-v2')

Callers 1

query_combined.pyFile · 0.85

Calls 1

encodeMethod · 0.80

Tested by

no test coverage detected