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

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fastembed_haystack-1.0.0-py3-none-any.whl (16.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for fastembed_haystack-1.0.0.tar.gz
Algorithm Hash digest
SHA256 16ac87116ab0bd68d9d4ca062ba23f09e0bb85dd4c7ff16e110284d9dc2fb054
MD5 0e0090f1922129ce60386c0dea9e7a19
BLAKE2b-256 a6d6a5b2f96fd9248afb204ac0b2ff97ab78f6b35cbf8d8390901103dd449448

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fastembed_haystack-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7bc39ad5fe39c9c167e2ea5a7787bda4b00561b99733dfb99ecfda2068652bb0
MD5 88b930664dee2f644e1d6af75e30e62b
BLAKE2b-256 8eae5362abce068308fe6a0a6b453e3691520e51ed9e9adf00c6b8fe17e7aac0

See more details on using hashes here.

Supported by

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