Haystack 2.x component to embed strings and Documents using fastembed embedding model
Project description
fastembed-haystack
Table of Contents
Installation
pip install fastembed-haystack
Usage
You can use FastembedTextEmbedder
and FastembedDocumentEmbedder
by importing as:
from haystack_integrations.components.embedders.fastembed import FastembedTextEmbedder
text = "fastembed is supported by and maintained by Qdrant."
text_embedder = FastembedTextEmbedder(
model="BAAI/bge-small-en-v1.5"
)
text_embedder.warm_up()
embedding = text_embedder.run(text)["embedding"]
from haystack_integrations.components.embedders.fastembed import FastembedDocumentEmbedder
from haystack.dataclasses import Document
embedder = FastembedDocumentEmbedder(
model="BAAI/bge-small-en-v1.5",
)
embedder.warm_up()
doc = Document(content="fastembed is supported by and maintained by Qdrant.", meta={"long_answer": "no",})
result = embedder.run(documents=[doc])
You can use FastembedSparseTextEmbedder
and FastembedSparseDocumentEmbedder
by importing as:
from haystack_integrations.components.embedders.fastembed import FastembedSparseTextEmbedder
text = "fastembed is supported by and maintained by Qdrant."
text_embedder = FastembedSparseTextEmbedder(
model="prithvida/Splade_PP_en_v1"
)
text_embedder.warm_up()
embedding = text_embedder.run(text)["embedding"]
from haystack_integrations.components.embedders.fastembed import FastembedSparseDocumentEmbedder
from haystack.dataclasses import Document
embedder = FastembedSparseDocumentEmbedder(
model="prithvida/Splade_PP_en_v1",
)
embedder.warm_up()
doc = Document(content="fastembed is supported by and maintained by Qdrant.", meta={"long_answer": "no",})
result = embedder.run(documents=[doc])
License
fastembed-haystack
is distributed under the terms of the Apache-2.0 license.
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_haystack-1.1.0.tar.gz
(15.5 kB
view hashes)
Built Distribution
Close
Hashes for fastembed_haystack-1.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 35000c75f68f507d23e47640a766f2c5f4eda288af8ae471ad16900d3ce53dcf |
|
MD5 | 41499385d5cc1be7aa1fa032a7fdeac2 |
|
BLAKE2b-256 | b3e84d7fd379e216fe4078a0f941787166338f83b5e918f94823a7cdab7d20aa |