Skip to main content

Haystack 2.x component to embed strings and Documents using fastembed embedding model

Project description

fastembed-haystack

PyPI - Version PyPI - Python Version


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


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.4.0.tar.gz (19.5 kB view details)

Uploaded Source

Built Distribution

fastembed_haystack-1.4.0-py3-none-any.whl (19.5 kB view details)

Uploaded Python 3

File details

Details for the file fastembed_haystack-1.4.0.tar.gz.

File metadata

  • Download URL: fastembed_haystack-1.4.0.tar.gz
  • Upload date:
  • Size: 19.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.27.2

File hashes

Hashes for fastembed_haystack-1.4.0.tar.gz
Algorithm Hash digest
SHA256 5b7995fd618378a3ce44925663d1e2b9797f5129102623b242672dd4ef4288bb
MD5 3d6d5e11a76f1e09c4799499d949bace
BLAKE2b-256 fbc6a4f36efaa1148beba5eba3d2ff70ca8744293b09e777be2602ddf3e3ea39

See more details on using hashes here.

File details

Details for the file fastembed_haystack-1.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for fastembed_haystack-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b1bdc4b2a0e023148d48d18f22ae1ed4a68d1f92e12181382d8a076f13ae3589
MD5 afef224ebfde989498047d0d08cf2a90
BLAKE2b-256 8e65c3fe863ddab7ccc31fcb26d42d39ddd98270dcc2679b2b56190cfcd1758e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page