Metadata-Version: 2.4
Name: langchain-flowspeech
Version: 0.1.0
Summary: LangChain tools for FlowSpeech text-to-speech generation.
Project-URL: Homepage, https://flowspeech.io/
Project-URL: Documentation, https://flowspeech.io/docs
Project-URL: Source, https://github.com/waeckerlinfederowicz66-sketch/langchain-flowspeech
Project-URL: Issues, https://github.com/waeckerlinfederowicz66-sketch/langchain-flowspeech/issues
Author-email: FlowSpeech <support@flowspeech.io>
License-Expression: MIT
License-File: LICENSE
Keywords: ai-voice,flowspeech,langchain,text-to-speech,tts
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Multimedia :: Sound/Audio :: Speech
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Requires-Dist: httpx>=0.27
Requires-Dist: langchain-core<2.0,>=0.3
Requires-Dist: pydantic<3,>=2
Provides-Extra: test
Requires-Dist: pytest>=8; extra == 'test'
Requires-Dist: respx>=0.21; extra == 'test'
Description-Content-Type: text/markdown

# langchain-flowspeech

`langchain-flowspeech` provides LangChain tools for generating text-to-speech audio with [FlowSpeech](https://flowspeech.io/).

FlowSpeech is a context-aware text-to-speech service for human-like narration with emotion control, pause control, and multi-speaker voice configuration.

## Installation

```bash
pip install langchain-flowspeech
```

## Authentication

Create a FlowSpeech API key in your FlowSpeech account, then export it:

```bash
export FLOWSPEECH_API_KEY="..."
```

Do not commit API keys, cookies, session tokens, or provider credentials.

## Usage

```python
from langchain_flowspeech import FlowSpeechTextToSpeechTool

tool = FlowSpeechTextToSpeechTool()

result = tool.invoke({
    "text": "Welcome to FlowSpeech. This audio is generated from a LangChain tool.",
    "voice_name": "Kore",
    "output_path": "flowspeech-demo.wav",
})

print(result["output_path"])
print(result["mime_type"])
print(result["quota"])
```

## Multi-Speaker Speech

```python
from langchain_flowspeech import FlowSpeechSpeaker, FlowSpeechTextToSpeechTool

tool = FlowSpeechTextToSpeechTool()

result = tool.invoke({
    "text": "Speaker A: We can make this sound natural.\nSpeaker B: Great, let's use different voices.",
    "speakers": [
        FlowSpeechSpeaker(speaker="Speaker A", voice_name="Kore"),
        FlowSpeechSpeaker(speaker="Speaker B", voice_name="Puck"),
    ],
    "output_path": "conversation.wav",
})
```

## API Surface

The package uses the public FlowSpeech API:

- `GET /api/ai/text-to-speech/quota`
- `POST /api/ai/text-to-speech`

Responses include base64-encoded audio and metadata such as MIME type, sample rate, channel count, bit depth, and quota information.

## Development

```bash
python -m venv .venv
. .venv/bin/activate
pip install -e ".[test]"
pytest
```

## Publishing

This project is ready for PyPI packaging. Build locally with:

```bash
python -m pip install build
python -m build
```

For GitHub Actions trusted publishing, configure a PyPI trusted publisher for `waeckerlinfederowicz66-sketch/langchain-flowspeech`, then add a publishing workflow with `id-token: write`.

## Safety

This repository intentionally contains no secrets. Tests use mocked HTTP responses.
