Skip to main content

SIE integration for Haystack

Project description

sie-haystack

SIE integration for Haystack.

Installation

pip install sie-haystack

Imports

Preferred import paths follow Haystack's namespace convention:

from haystack_integrations.components.embedders.sie import (
    SIEDocumentEmbedder,
    SIETextEmbedder,
)
from haystack_integrations.components.rankers.sie import SIERanker
from haystack_integrations.components.extractors.sie import SIEExtractor

The legacy flat imports remain supported for compatibility:

from sie_haystack import SIEDocumentEmbedder, SIEExtractor, SIERanker, SIETextEmbedder

Usage

from haystack import Document
from haystack_integrations.components.embedders.sie import SIEDocumentEmbedder, SIETextEmbedder
from haystack_integrations.components.rankers.sie import SIERanker

# Embed a query
text_embedder = SIETextEmbedder(base_url="http://localhost:8080", model="BAAI/bge-m3")
result = text_embedder.run(text="What is machine learning?")
query_embedding = result["embedding"]

# Embed documents
doc_embedder = SIEDocumentEmbedder(base_url="http://localhost:8080", model="BAAI/bge-m3")
docs = [Document(content="Python is a programming language.")]
result = doc_embedder.run(documents=docs)
embedded_docs = result["documents"]

# Rerank documents
ranker = SIERanker(
    base_url="http://localhost:8080",
    model="jinaai/jina-reranker-v2-base-multilingual"
)
result = ranker.run(query="What is Python?", documents=embedded_docs, top_k=3)
ranked_docs = result["documents"]

Relation models such as GLiREL classify relations between supplied entity spans. Extract those spans first, then pass them through the relation extractor's entities input:

from haystack_integrations.components.extractors.sie import SIEExtractor

text = "Tim Cook is the CEO of Apple Inc."
entity_extractor = SIEExtractor(
    model="urchade/gliner_multi-v2.1",
    labels=["person", "organization"],
)
relation_extractor = SIEExtractor(
    model="jackboyla/glirel-large-v0",
    labels=["ceo_of"],
)

entities = entity_extractor.run(text=text)["entities"]
result = relation_extractor.run(text=text, entities=entities)

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

sie_haystack-0.6.20.tar.gz (18.5 kB view details)

Uploaded Source

Built Distribution

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

sie_haystack-0.6.20-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file sie_haystack-0.6.20.tar.gz.

File metadata

  • Download URL: sie_haystack-0.6.20.tar.gz
  • Upload date:
  • Size: 18.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sie_haystack-0.6.20.tar.gz
Algorithm Hash digest
SHA256 ddfe0c95ac717ae0bcdc9cd216ffca75e0e0230a6439c18f27d9e1ca868edf4d
MD5 dfc21514d2d67b0de44698a52ef704dd
BLAKE2b-256 eef099eb768fb8ae8122e40f9bddb59d349926b74d6405e3796145091c625c72

See more details on using hashes here.

Provenance

The following attestation bundles were made for sie_haystack-0.6.20.tar.gz:

Publisher: release-python.yml on superlinked/sie-internal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sie_haystack-0.6.20-py3-none-any.whl.

File metadata

  • Download URL: sie_haystack-0.6.20-py3-none-any.whl
  • Upload date:
  • Size: 10.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sie_haystack-0.6.20-py3-none-any.whl
Algorithm Hash digest
SHA256 1d7354fd78d822907695330e614eb4450a7b2abde684901304c3885bda2eb332
MD5 7101ce375e5de18c490b62785635f2a6
BLAKE2b-256 c757ab1e73710d2c29f9ce45eb78cdf630fef714f92d3e59c2893817af5890de

See more details on using hashes here.

Provenance

The following attestation bundles were made for sie_haystack-0.6.20-py3-none-any.whl:

Publisher: release-python.yml on superlinked/sie-internal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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