Skip to main content

An integration package connecting OPEA and Haystack

Project description

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.

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.1.tar.gz (12.9 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.1-py3-none-any.whl (16.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: haystack_opea-0.1.1.tar.gz
  • Upload date:
  • Size: 12.9 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.1.tar.gz
Algorithm Hash digest
SHA256 5027ea8c0a20e1643d68a8b7b3531b6bff92a1fefe5baeedf8fefc48fc2ea682
MD5 59a8c2347a7a1e8b5b80a893c0fb6fcb
BLAKE2b-256 1b9f137c6df44145429a3c747dcf512b660ecc41282b0952f252467cb17eb990

See more details on using hashes here.

File details

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

File metadata

  • Download URL: haystack_opea-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 16.1 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 14ee958803de73edd5cac5785dd9fc271dee1d95a225b026053643485083e0f2
MD5 75dd41a42d894c0427df3e802407d3e7
BLAKE2b-256 296508cbf777aefded285c60ce8d851a8c8eacc79e69c522d3b375f23bc0613e

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