Skip to main content

GitHub License PyPI - Version PyPI - Python Version

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.

Metadata

Release files for haystack-opea 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for haystack-opea 0.1.2
File Size Uploaded
haystack_opea-0.1.2.tar.gz 13.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for haystack-opea 0.1.2
File Interpreter ABI Platform
haystack_opea-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 29.1 kB

Release files / haystack_opea-0.1.2.tar.gz

Download URL haystack_opea-0.1.2.tar.gz
Size 13.0 kB
Tags Source
SHA-256 checksum
How to use checksums
cf03997449628ccb7e98ec5abc3b41b5cae9ecb41c05bea9419511ccb6a22134
BLAKE2b-256 checksum
How to use checksums
f6c506cc8f5772949eeeac61a4beb9853bd821cb31aaf393152b9b884f91f88a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.1 CPython/3.12.5 Darwin/24.5.0

Release files / haystack_opea-0.1.2-py3-none-any.whl

Download URL haystack_opea-0.1.2-py3-none-any.whl
Size 16.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8f344af63bc1838d39fe547595ded81094d53efd2d0891becdce4810f825f56c
BLAKE2b-256 checksum
How to use checksums
1c7c36702ac82883df3b8e840b7dc85d7f40d9322c4b25449da5df8c84157b07
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.1 CPython/3.12.5 Darwin/24.5.0

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page