Skip to content

Instantly share code, notes, and snippets.

@davidmezzetti
Created June 10, 2026 16:00
Show Gist options
  • Select an option

  • Save davidmezzetti/74b7b9ee8f2512b555201cf5167cd1e0 to your computer and use it in GitHub Desktop.

Select an option

Save davidmezzetti/74b7b9ee8f2512b555201cf5167cd1e0 to your computer and use it in GitHub Desktop.
# MINIMAL=1 pip install git+https://github.com/neuml/txtai
# pip install llama-cpp-python turbovec
# pip freeze
# diskcache==5.6.3
# Jinja2==3.1.6
# llama_cpp_python==0.3.28
# MarkupSafe==3.0.3
# numpy==2.2.6
# turbovec==0.7.1
# txtai_minimal @ git+https...
# typing_extensions==4.15.0
from txtai import Embeddings
embeddings = Embeddings(
path="all-MiniLM-L6-v2-Q4_K_M.gguf",
backend="turbovec",
content=True
)
embeddings.index([
"US tops 5 million confirmed virus cases",
"Canada's last fully intact ice shelf has suddenly collapsed, forming a Manhattan-sized iceberg",
"Beijing mobilises invasion craft along coast as Taiwan tensions escalate",
"The National Park Service warns against sacrificing slower friends in a bear attack",
"Maine man wins $1M from $25 lottery ticket",
"Make huge profits without work, earn up to $100,000 a day"
])
embeddings.search("dishonest junk", 1)
# [{
# 'id': '5',
# 'text': 'Make huge profits without work, earn up to $100,000 a day',
# 'score': 0.17288534343242645
# }]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment