Fast embedding alternative to Sentence transformers
Project description
FastEmbed Library
FastEmbed is a Python library that provides convenient methods for indexing and searching text documents using Qdrant, a high-dimensional vector indexing and search system.
Features
- Batch document insertion with automatic embedding using SentenceTransformers. With support for OpenAI and custom embeddings.
- Efficient batch searching with support for filtering by metadata.
- Automatic generation of unique IDs for documents.
- Convenient alias methods for adding documents and performing queries.
Installation
To install the FastEmbed library, we install Qdrant client as well with pip:
pip install fastembed qdrant-client
Usage
Here's a simple usage example, which works as is:
from qdrant_client import QdrantClient
# Initialize the client
client = QdrantClient(":memory:") # or QdrantClient(path="path/to/db")
# Prepare your documents, metadata, and IDs
docs = ["Qdrant has Langchain integrations", "Qdrant also has Llama Index integrations"]
metadatas = [
{"source": "Langchain-docs"},
{"source": "Linkedin-docs"},
]
ids = [42, 2]
# Use the new add method
client.add(collection_name="demo_collection", docs={"documents": docs, "metadatas": metadatas, "ids": ids})
search_result = client.query(collection_name="demo_collection", query_texts=["This is a query document"])
print(search_result)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
fastembed-0.0.1a2.tar.gz
(7.7 kB
view hashes)
Built Distribution
Close
Hashes for fastembed-0.0.1a2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0003e7e973a48d79ba8b78fb5da72131bbd09adac5cbfe80f1922c47bac67bff |
|
MD5 | c5c73b11038a45c14e406473af610417 |
|
BLAKE2b-256 | 4dd6eb785618ad0ec60f2759b69cce8652ee978fc7631ac2aa3a442b941fcf47 |