Skip to main content

lokutor-haystack

Lokutor text-to-speech and speech-to-text components for Haystack 2.x.

  • LokutorTextToSpeech: text to a WAV ByteStream (Versa 2.0; voices F1-F5, M1-M5, your cloned voices; en es ca gl eu pt fr it de).
  • LokutorSpeechToText: WAV files to Documents (Conv 2.0), with optional speaker diarization and word timings.

Get an API key at app.lokutor.com. API docs: docs.lokutor.com.

Installation

pip install lokutor-haystack

The key is read from the LOKUTOR_API_KEY environment variable (a Haystack Secret, so it is never serialized into a pipeline YAML).

Text to speech

from pathlib import Path
from haystack_integrations.components.audio.lokutor import LokutorTextToSpeech

tts = LokutorTextToSpeech(voice="F1", language="en")
audio = tts.run(text="Hello from Lokutor. [laugh]")["audio"]   # ByteStream, mime_type "audio/wav"
audio.to_file(Path("hello.wav"))

run also takes voice and language to override the init values; run_async is available. The text may carry expression tags. Limit: 5,000 characters per call. Output is 16-bit PCM, 44.1 kHz, mono WAV.

Speech to text

from haystack_integrations.components.audio.lokutor import LokutorSpeechToText

stt = LokutorSpeechToText(language="en", diarize=True, include_words=True)
docs = stt.run(sources=["meeting.wav"])["documents"]
print(docs[0].content, docs[0].meta["speakers"])

One Document per source (paths or ByteStreams); meta has file_path, language_code, and with diarize the speakers, with include_words the per-word words. Lokutor decodes WAV only (PCM 8/16 bit, 8-48 kHz): convert MP3/M4A first. Speaker labels are best on English meetings; short interjections and overlapping speech are less reliable (details).

An unreadable file is logged and skipped; an API error (bad key, unsupported audio, no balance) raises RuntimeError with Lokutor's message.

Example pipelines

examples/pipeline.py synthesizes a sentence, transcribes the result and indexes the transcript in a document store.

Development

pip install -e ".[test]" && pytest                       # unit tests, no network
LOKUTOR_API_KEY=... pytest -m integration                # one tiny live round trip

Licence

Apache-2.0.

Metadata

Release files for lokutor-haystack 0.1.0

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

Source distribution (sdist)

Source distribution for lokutor-haystack 0.1.0
File Size Uploaded Provenance Actions
lokutor_haystack-0.1.0.tar.gz 11.3 kB Without provenance Details for lokutor_haystack-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for lokutor-haystack 0.1.0
File Interpreter ABI Platform Actions
lokutor_haystack-0.1.0-py3-none-any.whl Python 3 none any Details for lokutor_haystack-0.1.0-py3-none-any.whl

Total release size: 23.4 kB

Release files / lokutor_haystack-0.1.0.tar.gz

Download URL lokutor_haystack-0.1.0.tar.gz
Size 11.3 kB
Tags Source
SHA-256 checksum
How to use checksums
9c98c320cd18c0ac8524f4c187be10c6b33bb889bbe377d94d3ae19654d23ecf
BLAKE2b-256 checksum
How to use checksums
a40d4613f0446c852d8179d4c19096c18230bcfd2fc3c75af61fd1301c07e328
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.2

Release files / lokutor_haystack-0.1.0-py3-none-any.whl

Download URL lokutor_haystack-0.1.0-py3-none-any.whl
Size 12.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
df7ff7488eaa93a3f13c9229e9623ba0d9788b3ddccfce5a14d09eccc13c374f
BLAKE2b-256 checksum
How to use checksums
84d88c334cd2b64b6bae88be8f0e3757ec183d44e3e2ff481c65e928fda21596
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.2

Security for lokutor-haystack 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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