Skip to main content

sumy model family support for aiSSEMBLE Inference

Project description

aiSSEMBLE OIP Sumy Module

Sumy library integration for text summarization support in the aiSSEMBLE Inference library.

Supported Algorithms

This module supports multiple summarization algorithms through the sumy library:

Algorithm Description
TextRank Graph-based ranking algorithm (default)
LSA Latent Semantic Analysis
LexRank Graph-based ranking with cosine similarity

Installation

pip install aissemble-inference-sumy

This will also install the required dependencies:

  • aissemble-inference-core
  • sumy (text summarization library)
  • nltk (natural language processing toolkit)

Usage

With MLServer

Create a model-settings.json:

{
    "name": "sumy",
    "implementation": "aissemble_inference_sumy.SumyRuntime",
    "parameters": {
        "algorithm": "textrank",
        "sentences_count": 3,
        "language": "english"
    }
}

Start MLServer:

mlserver start /path/to/models

With OIP Client

from aissemble_inference_core.client import InferenceClient
from aissemble_inference_core.client.registry import ModuleRegistry

# The module auto-registers via entry points
print(ModuleRegistry.instance().list_available())
# {'runtimes': ['sumy', ...], 'translators': ['sumy', ...], ...}

# Use with InferenceClient
client = InferenceClient(adapter, endpoint)
result = client.summarize("sumy").text("Long article text...").run()
print(result.summary)

Components

SumyRuntime

MLServer-compatible runtime that wraps sumy summarization algorithms:

  • Accepts text strings via OIP protocol
  • Returns summarized text
  • Configurable algorithm, sentence count, and language via parameters

SumyTranslator

Translator for sumy outputs:

  • Inherits from DefaultSummarizationTranslator
  • Can be extended with sumy-specific optimizations

Configuration Parameters

Parameter Type Default Description
algorithm string "textrank" Summarization algorithm (textrank, lsa, lexrank)
sentences_count int 3 Number of sentences in the summary
language string "english" Language for text tokenization

Note: The max_length and min_length parameters from SummarizationBuilder are not currently supported by this module. This is planned for a future enhancement.

Entry Points

This module registers the following entry points:

Group Name Class
inference.runtimes sumy SumyRuntime
inference.translators sumy SumyTranslator

Language Support

The sumy library supports multiple languages for tokenization and stemming. Specify the language using the language parameter in model-settings.json. Common languages include:

  • english
  • spanish
  • french
  • german
  • italian
  • portuguese
  • russian
  • czech
  • slovak

Refer to the sumy documentation for a complete list of supported languages.

Testing

This module includes comprehensive tests covering:

Unit Tests

  • Module registration and discovery
  • Runtime loading with different algorithms
  • Direct inference via SumyRuntime
  • Translator functionality
  • Error handling and validation

Integration Tests (tagged with @integration)

  • End-to-end OIP communication via MLServer
  • Real HTTP requests using InferenceClient
  • Algorithm switching (TextRank, LSA, LexRank)
  • Parameter configuration validation

Run tests:

# Run all tests (unit + integration)
mvn clean install

# Run only unit tests (excluding @integration tag)
behave --tags=-integration

The integration tests automatically:

  1. Start MLServer with configured models
  2. Execute real inference requests via OIP protocol
  3. Validate responses and summaries
  4. Clean up resources

See tests/features/ for test scenarios and tests/features/environment.py for MLServer test infrastructure.

Example

For a complete working example, see the aissemble-summarization-example in the examples directory:

cd aissemble-inference-examples/aissemble-summarization-example
uv sync --group test
uv run behave

The example demonstrates:

  • MLServer configuration for multiple summarization algorithms
  • Integration with InferenceClient and HttpOipAdapter
  • BDD test patterns for OIP-based applications
  • Sample article data for testing

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

aissemble_inference_sumy-1.5.0rc3.tar.gz (16.2 kB view details)

Uploaded Source

Built Distribution

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

aissemble_inference_sumy-1.5.0rc3-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file aissemble_inference_sumy-1.5.0rc3.tar.gz.

File metadata

  • Download URL: aissemble_inference_sumy-1.5.0rc3.tar.gz
  • Upload date:
  • Size: 16.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for aissemble_inference_sumy-1.5.0rc3.tar.gz
Algorithm Hash digest
SHA256 65c89a09ea8023a316768f676c9a57ffc38eb171a96236926472a1f0d95d9c2b
MD5 09437891b71154ea90d9257dc849cf2d
BLAKE2b-256 cd8c2350bbb186c6522b1e37b8f26ffb1ba6febbee8f0d58655281d9f1442a70

See more details on using hashes here.

File details

Details for the file aissemble_inference_sumy-1.5.0rc3-py3-none-any.whl.

File metadata

  • Download URL: aissemble_inference_sumy-1.5.0rc3-py3-none-any.whl
  • Upload date:
  • Size: 12.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for aissemble_inference_sumy-1.5.0rc3-py3-none-any.whl
Algorithm Hash digest
SHA256 032c4fd0d2560846a7a563fbfa46522e5ade580ff6dcba9b22cbe96cf4858d90
MD5 e0a06b909163d61ee838d11fc9f0ea76
BLAKE2b-256 d03832bc2db1159686b242a7b8f6d51126bfdce6b519fc19740cbae49324f99b

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