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

Uploaded Source

Built Distribution

fastembed_haystack-1.3.0-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for fastembed_haystack-1.3.0.tar.gz
Algorithm Hash digest
SHA256 1326c549dec73dd61af59b7f9aea4b7996d1614da85a18143083da373040dfc8
MD5 f5eae7eb39f9de0ae524f71be3dc6818
BLAKE2b-256 c7a2a62ade646b1f4238669423d0fb8214f8439967da218d960851bab6a2c5af

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fastembed_haystack-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 41d9bc0e33d8998989393f60bc6eab610983c6a4ba05ee655385f1a12c9a0521
MD5 61fd39810650ec6e74fd6cb1d9928395
BLAKE2b-256 1271401b7b879bf8085cd60b89dba845f8c23314d33a61b91ba199461ead4308

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