# Asta Summarizer Service
A flexible text summarization service that supports multiple AI providers including OpenAI-compatible APIs and HuggingFace Inference endpoints
with a consistent tone used for Asta.
## Features
- **Multiple Provider Support**: Works with both OpenAI-compatible APIs and HuggingFace Inference clients
- **Flexible Summarization Types**: Support for different summarization styles (default, thread titles, etc.)
- **Customizable Length**: Configure summary length to meet your needs
## Installation
```bash
pip install asta-summarizer-service
```
## Quick Start
### Using with OpenAI-compatible API
```python
import asyncio
from summarizer import SummarizerService, SummarizationType
async def main():
# Initialize with base_url for OpenAI-compatible API
service = SummarizerService(
base_url="https://your-api-endpoint.com/v1",
model="your-model-name",
api_key="your-api-key" # or set SUMMARIZER_API_KEY environment variable
)
text = "Your long text to summarize..."
summary = await service.summarize(
text=text,
length=100,
summarization_type=SummarizationType.DEFAULT
)
print(summary)
if __name__ == "__main__":
asyncio.run(main())
```
### Using with HuggingFace Provider
```python
import asyncio
from summarizer import SummarizerService, SummarizationType
async def main():
# Initialize with provider for HuggingFace Inference
service = SummarizerService(
provider="huggingface", # or other supported providers
model="your-model-name",
api_key="your-hf-token" # or set SUMMARIZER_API_KEY environment variable
)
text = "Your long text to summarize..."
summary = await service.summarize(
text=text,
length=200,
summarization_type=SummarizationType.THREAD_TITLE
)
print(summary)
if __name__ == "__main__":
asyncio.run(main())
```
## Configuration
### Initialization Parameters
- **model** (required): The model name to use for summarization
- **base_url** (optional): Base URL for OpenAI-compatible APIs (mutually exclusive with provider)
- **provider** (optional): Provider name for HuggingFace Inference (mutually exclusive with base_url)
- **api_key** (optional): API key for authentication (defaults to `SUMMARIZER_API_KEY` environment variable)
### Summarization Types
The service supports different summarization styles via the `SummarizationType` enum:
- `SummarizationType.DEFAULT`: Standard summarization. Pass in your own prompt alongside the text to summarize in the `text` field.
- `SummarizationType.THREAD_TITLE`: Optimized for creating thread titles
### Environment Variables
Set your API key as an environment variable:
```bash
export SUMMARIZER_API_KEY="your-api-key-here"
```
## Development
### Installing Dependencies
For development work:
```bash
# Install package in editable mode with development dependencies
pip install -e ".[dev]"
```
Or install dependencies manually:
```bash
# Core dependencies
pip install huggingface-hub>=0.20.0 openai>=1.0.0
# Development dependencies
pip install pytest>=7.0.0 pytest-asyncio>=0.21.0 black>=23.0.0 isort>=5.12.0 mypy>=1.0.0
```
### Code Formatting
```bash
black .
isort .
```
### Type Checking
```bash
mypy summarizer/
```
## Publication
You can publish a new version from your branch before merging to main, or from main after merging.
Edit the `version.txt` file with the new version, then run
```
export AI2_NORA_PYPI_TOKEN=<SECRET IN NORA VAULT>
make publish
```
This will publish the summarizer with the version number contained in `version.txt`
## License
MIT License - see [LICENSE](LICENSE) file for details.
Raw data
{
"_id": null,
"home_page": null,
"name": "asta-summarizer-service",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "text, summarization, ai, nlp, openai, huggingface",
"author": null,
"author_email": "Your Name <your.email@example.com>",
"download_url": "https://files.pythonhosted.org/packages/82/fc/4d570d92e5be4a4e23b143d9e8910da3c8f346985857f3aa24b44fbc1d20/asta_summarizer_service-0.1.0.tar.gz",
"platform": null,
"description": "# Asta Summarizer Service\n\nA flexible text summarization service that supports multiple AI providers including OpenAI-compatible APIs and HuggingFace Inference endpoints\nwith a consistent tone used for Asta.\n\n## Features\n\n- **Multiple Provider Support**: Works with both OpenAI-compatible APIs and HuggingFace Inference clients\n- **Flexible Summarization Types**: Support for different summarization styles (default, thread titles, etc.)\n- **Customizable Length**: Configure summary length to meet your needs\n\n## Installation\n\n```bash\npip install asta-summarizer-service\n```\n\n## Quick Start\n\n### Using with OpenAI-compatible API\n\n```python\nimport asyncio\nfrom summarizer import SummarizerService, SummarizationType\n\nasync def main():\n # Initialize with base_url for OpenAI-compatible API\n service = SummarizerService(\n base_url=\"https://your-api-endpoint.com/v1\",\n model=\"your-model-name\",\n api_key=\"your-api-key\" # or set SUMMARIZER_API_KEY environment variable\n )\n\n text = \"Your long text to summarize...\"\n\n summary = await service.summarize(\n text=text,\n length=100,\n summarization_type=SummarizationType.DEFAULT\n )\n\n print(summary)\n\nif __name__ == \"__main__\":\n asyncio.run(main())\n```\n\n### Using with HuggingFace Provider\n\n```python\nimport asyncio\nfrom summarizer import SummarizerService, SummarizationType\n\nasync def main():\n # Initialize with provider for HuggingFace Inference\n service = SummarizerService(\n provider=\"huggingface\", # or other supported providers\n model=\"your-model-name\",\n api_key=\"your-hf-token\" # or set SUMMARIZER_API_KEY environment variable\n )\n\n text = \"Your long text to summarize...\"\n\n summary = await service.summarize(\n text=text,\n length=200,\n summarization_type=SummarizationType.THREAD_TITLE\n )\n\n print(summary)\n\nif __name__ == \"__main__\":\n asyncio.run(main())\n```\n\n## Configuration\n\n### Initialization Parameters\n\n- **model** (required): The model name to use for summarization\n- **base_url** (optional): Base URL for OpenAI-compatible APIs (mutually exclusive with provider)\n- **provider** (optional): Provider name for HuggingFace Inference (mutually exclusive with base_url)\n- **api_key** (optional): API key for authentication (defaults to `SUMMARIZER_API_KEY` environment variable)\n\n### Summarization Types\n\nThe service supports different summarization styles via the `SummarizationType` enum:\n\n- `SummarizationType.DEFAULT`: Standard summarization. Pass in your own prompt alongside the text to summarize in the `text` field.\n- `SummarizationType.THREAD_TITLE`: Optimized for creating thread titles\n\n### Environment Variables\n\nSet your API key as an environment variable:\n\n```bash\nexport SUMMARIZER_API_KEY=\"your-api-key-here\"\n```\n\n## Development\n\n### Installing Dependencies\n\nFor development work:\n\n```bash\n# Install package in editable mode with development dependencies\npip install -e \".[dev]\"\n```\n\nOr install dependencies manually:\n\n```bash\n# Core dependencies\npip install huggingface-hub>=0.20.0 openai>=1.0.0\n\n# Development dependencies\npip install pytest>=7.0.0 pytest-asyncio>=0.21.0 black>=23.0.0 isort>=5.12.0 mypy>=1.0.0\n```\n\n### Code Formatting\n\n```bash\nblack .\nisort .\n```\n\n### Type Checking\n\n```bash\nmypy summarizer/\n```\n\n## Publication\n\nYou can publish a new version from your branch before merging to main, or from main after merging.\n\nEdit the `version.txt` file with the new version, then run\n\n```\nexport AI2_NORA_PYPI_TOKEN=<SECRET IN NORA VAULT>\nmake publish\n```\n\nThis will publish the summarizer with the version number contained in `version.txt`\n\n## License\n\nMIT License - see [LICENSE](LICENSE) file for details.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A flexible text summarization service supporting multiple AI providers",
"version": "0.1.0",
"project_urls": {
"Homepage": "https://github.com/yourusername/asta-summarizer-service",
"Issues": "https://github.com/yourusername/asta-summarizer-service/issues",
"Repository": "https://github.com/yourusername/asta-summarizer-service"
},
"split_keywords": [
"text",
" summarization",
" ai",
" nlp",
" openai",
" huggingface"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "3485114807fcc7d9e88eb555b50ae12e18a0d9b774ca03c6d01c1187e0ac2374",
"md5": "7a7255715c6f8559913e6c8ddd9e1d50",
"sha256": "43937cc77cc799c93f7aace337cfcde7de6d1735e695decef67ecdaeaaf26b9d"
},
"downloads": -1,
"filename": "asta_summarizer_service-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7a7255715c6f8559913e6c8ddd9e1d50",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 6929,
"upload_time": "2025-07-23T18:29:44",
"upload_time_iso_8601": "2025-07-23T18:29:44.552083Z",
"url": "https://files.pythonhosted.org/packages/34/85/114807fcc7d9e88eb555b50ae12e18a0d9b774ca03c6d01c1187e0ac2374/asta_summarizer_service-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "82fc4d570d92e5be4a4e23b143d9e8910da3c8f346985857f3aa24b44fbc1d20",
"md5": "bf0e4aadba0e4e2c515e489a550115c5",
"sha256": "c61be65bc33c6192bfff6d7b18ca36035d0d3a384f3bdf67c2d7e844a72f6571"
},
"downloads": -1,
"filename": "asta_summarizer_service-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "bf0e4aadba0e4e2c515e489a550115c5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 7273,
"upload_time": "2025-07-23T18:29:45",
"upload_time_iso_8601": "2025-07-23T18:29:45.724899Z",
"url": "https://files.pythonhosted.org/packages/82/fc/4d570d92e5be4a4e23b143d9e8910da3c8f346985857f3aa24b44fbc1d20/asta_summarizer_service-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-23 18:29:45",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "yourusername",
"github_project": "asta-summarizer-service",
"github_not_found": true,
"lcname": "asta-summarizer-service"
}