TalkLabs STT SDK - Speech-to-Text API compatible with Deepgram
Project description
TalkLabs STT SDK
SDK Python para TalkLabs Speech-to-Text API - Compatível com Deepgram
Features
- ✅ REST API - Transcrição completa de arquivos
- ✅ WebSocket Streaming - Transcrição em tempo real
- ✅ Deepgram Compatible - API compatível com Deepgram
- ✅ Múltiplos Modelos - Whisper large-v3, medium, small
- ✅ Async Support - WebSocket assíncrono
- ✅ Type Hints - Totalmente tipado
Instalação
pip install talklabs-stt
Quick Start
REST API (Síncrono)
from talklabs_stt import STTClient
client = STTClient(api_key="tlk_live_xxxxx")
result = client.transcribe_file("audio.wav")
print(result["results"]["channels"][0]["alternatives"][0]["transcript"])
WebSocket Streaming (Assíncrono)
import asyncio
from talklabs_stt import STTClient
async def main():
client = STTClient(api_key="tlk_live_xxxxx")
def on_transcript(data):
if data["is_final"]:
print(data["channel"]["alternatives"][0]["transcript"])
await client.transcribe_stream(
"audio.wav",
on_transcript=on_transcript
)
asyncio.run(main())
Uso Completo
Inicialização
from talklabs_stt import STTClient, TranscriptionOptions
# Cliente (sempre usa api.talklabs.com.br)
client = STTClient(api_key="tlk_live_xxxxx")
# Cliente com timeout customizado
client = STTClient(
api_key="tlk_live_xxxxx",
timeout=600 # 10 minutos
)
Opções de Transcrição
from talklabs_stt import TranscriptionOptions
options = TranscriptionOptions(
model="large-v3", # large-v3, medium, small
language="pt", # pt, en, es, etc.
punctuate=True, # Adicionar pontuação
smart_format=True, # Formatação inteligente
detect_language=False, # Detecção automática
vad_filter=False, # Filtro VAD
interim_results=True # Resultados intermediários (WebSocket)
)
result = client.transcribe_file("audio.wav", options=options)
Com kwargs diretos
result = client.transcribe_file(
"audio.wav",
model="large-v3",
language="pt",
punctuate=True,
smart_format=True
)
API Reference
STTClient
transcribe_file(audio_path, options=None, **kwargs)
Transcreve arquivo completo via REST API.
Args:
audio_path(str): Caminho do arquivo de áudiooptions(TranscriptionOptions, optional): Opções de transcrição**kwargs: Parâmetros adicionais
Returns: dict - Resultado Deepgram-compatible
transcribe_stream(audio_path, options=None, on_transcript=None, on_metadata=None, **kwargs)
Transcreve via WebSocket streaming (async).
Args:
audio_path(str): Caminho do arquivooptions(TranscriptionOptions, optional): Opçõeson_transcript(callable, optional): Callback para transcriçõeson_metadata(callable, optional): Callback para metadata**kwargs: Parâmetros adicionais
list_models()
Lista modelos disponíveis.
Returns: dict - Lista de modelos Whisper disponíveis
Migração do Deepgram
O SDK é 100% compatível com Deepgram. Para migrar:
# Deepgram
from deepgram import Deepgram
dg = Deepgram(api_key)
# TalkLabs
from talklabs_stt import STTClient
client = STTClient(api_key)
# Mesma interface!
result = client.transcribe_file("audio.wav", language="pt")
Exemplos
Ver pasta examples/:
transcribe_simple.py- REST API básicotranscribe_stream.py- WebSocket streaminglist_models.py- Listar modelosquick_start.py- Exemplo rápido de uso
Troubleshooting
Erro de autenticação
Verifique se a API key está correta e ativa.
Timeout
Aumente o timeout:
client = STTClient(api_key="...", timeout=600)
Formato de áudio
Formatos suportados: WAV, MP3, FLAC, OGG, M4A
License
MIT License - Ver LICENSE
Support
- Documentação: https://docs.talklabs.com.br/stt
- Issues: https://github.com/talklabs/talklabs-stt/issues
- Email: support@talklabs.com.br
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file talklabs_stt-1.0.1.tar.gz.
File metadata
- Download URL: talklabs_stt-1.0.1.tar.gz
- Upload date:
- Size: 17.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3a1bb906a3ac642f4a18b6a3e8808756361c606581d83d861fa251510a6091d0
|
|
| MD5 |
5792b6f72e5370e02fd311c66a4a1b1d
|
|
| BLAKE2b-256 |
88432130f6714f999605d5713fb4107befde5db9a069f0fb3a51786d821a404f
|
File details
Details for the file talklabs_stt-1.0.1-py3-none-any.whl.
File metadata
- Download URL: talklabs_stt-1.0.1-py3-none-any.whl
- Upload date:
- Size: 9.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5e5c4f61c90fe9749206be9be780d846441edc9e58427bbde26d1b82107061f4
|
|
| MD5 |
7b747e4f141f8320b9ae114b4a2b011b
|
|
| BLAKE2b-256 |
2576195fa88781666f66ef8a4b547bdb6cc56b31ccca07b88adcd9696a48de9f
|