Skip to main content

An integration package connecting OPEA and Haystack

Project description

Haystack-OPEA

This package contains the Haystack integrations for OPEA Compatible OPEA Microservices. At its core, OPEA offers a suite of containerized microservices—including components for LLMs, embedding, retrieval, and reranking—that can be orchestrated to build sophisticated AI workflows like Retrieval-Augmented Generation (RAG). These microservices are designed for flexibility, supporting deployment across various environments such as cloud platforms, data centers, and edge devices.​

For more information, see Getting Started with OPEA, OPEA Components and Full Examples.

Installation

You can install Haystack OPEA package in several ways:

Install from Source

To install the package from the source, run:

pip install poetry && poetry install --with test

Install from Wheel Package

To install the package from a pre-built wheel, run:

  1. Build the Wheels: Ensure the wheels are built using Poetry.
    poetry build
    
  2. Install via Wheel File: Install the package using the generated wheel file.
    pip install dist/haystack_opea-0.1.0-py3-none-any.whl
    

Examples

See the Examples folder; it contains two jupyter notebooks, using an OPEA LLM and text embedder. The folder also includes a docker compose configuration for starting the OPEA backend.

Embeddings

The classes OPEADocumentEmbedder and OPEATextEmbedder are introduced.

from haystack_opea import OPEATextEmbedder

text_to_embed = "I love pizza!"

text_embedder = OPEATextEmbedder(api_url="http://localhost:6006")
text_embedder.warm_up()

print(text_embedder.run(text_to_embed)

And similarly:

from haystack import Document
from haystack_opea import OPEADocumentEmbedder

doc = Document(content="I love pizza!")

document_embedder = OPEADocumentEmbedder(api_url="http://localhost:6006")
document_embedder.warm_up()

result = document_embedder.run([doc])
print(result["documents"][0].embedding)

LLMs

The class OPEAGenerator is introduced:

from haystack_opea import OPEAGenerator

generator = OPEAGenerator(
    "http://localhost:9009",
    model_arguments={
        "temperature": 0.2,
        "top_p": 0.7,
        "max_tokens": 1024,
    },
)
generator.warm_up()
result = generator.run(prompt="What is the answer?")

For more information, see Haystack Docs and OPEA.

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

haystack_opea-0.1.0.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

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

haystack_opea-0.1.0-py3-none-any.whl (16.0 kB view details)

Uploaded Python 3

File details

Details for the file haystack_opea-0.1.0.tar.gz.

File metadata

  • Download URL: haystack_opea-0.1.0.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.12.5 Darwin/24.4.0

File hashes

Hashes for haystack_opea-0.1.0.tar.gz
Algorithm Hash digest
SHA256 86ebd826e483474a80cf113c462356c5e8bd9e7bcf6a7e2573860d9a2327af13
MD5 a9dc9319bf73bb5889922cb284964401
BLAKE2b-256 9e599f3f39b686c6a87239121e694d0836d1ee48b82cb9b125deb405233bc8f9

See more details on using hashes here.

File details

Details for the file haystack_opea-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: haystack_opea-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.12.5 Darwin/24.4.0

File hashes

Hashes for haystack_opea-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fc993e172a1f6488ec2af5356dccf1edf0c5df1b1c892ec3d3cb90f4663e99ef
MD5 c0bce34faff7ff85e502f46cb26e5102
BLAKE2b-256 04c9f58771f3b1708399e9c7eaa7661f8b465bce91c02e822045725ea862e56e

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