Metadata-Version: 2.4
Name: poemai-utils
Version: 3.2.5
Summary: Add a short description here!
Home-page: https://github.com/poemAI-ch/poemai-utils
Author: Markus Emmenegger
Author-email: markus.emmenegger@poemai.ch
License: MIT
Project-URL: Documentation, https://github.com/poemAI-ch/poemai-utils
Project-URL: Source, https://github.com/poemAI-ch/poemai-utils
Platform: any
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python
Description-Content-Type: text/markdown; charset=UTF-8
License-File: LICENSE.txt
Requires-Dist: importlib-metadata; python_version < "3.8"
Requires-Dist: sqlitedict
Requires-Dist: httpx
Requires-Dist: numpy
Requires-Dist: openai
Requires-Dist: requests
Requires-Dist: python-box~=7.0
Provides-Extra: testing
Requires-Dist: setuptools; extra == "testing"
Requires-Dist: pytest; extra == "testing"
Requires-Dist: pytest-cov; extra == "testing"
Requires-Dist: transformers; extra == "testing"
Dynamic: license-file

# poemai-utils

This package is a collection of utilities for AI projects.

## Text-to-speech

The audio API resolves a recommended OpenAI model and MP3 output format by
default, while still accepting enum values or raw model keys:

```python
from poemai_utils.audio import (
    DEFAULT_OPENAI_SPEECH_MODEL,
    OpenAITextToSpeech,
    SpeechOutputFormat,
    TextToSpeechRequest,
)

request = TextToSpeechRequest(
    "Welcome to the workshop.",
    model=DEFAULT_OPENAI_SPEECH_MODEL,
    output_format=SpeechOutputFormat.WAV,
)
request = TextToSpeechRequest("A preview.", model="future-openai-tts-model")
result = OpenAITextToSpeech(api_key="...").synthesize(request)

print(result.audio_bytes, result.content_type, result.file_extension)
print(result.provider_request_id)
```

Pass an API key explicitly when constructing the adapter; otherwise the OpenAI
SDK uses its normal environment configuration. Synthesis errors expose a
stable `code` and `retryable` flag.
