Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Publish Python Package to PyPI

on:
push:
branches:
- main

jobs:
build-and-publish:
name: Build and publish Python distribution to PyPI
runs-on: ubuntu-latest
environment: release # Optional: if you have a GitHub environment for releases
permissions:
id-token: write # Required for trusted publishing, if you choose that route later
contents: read # Needed to check out the repository

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.9" # Or another version like "3.x" or based on pyproject.toml

- name: Install build dependencies
run: python -m pip install --upgrade pip build

- name: Build package
run: python -m build

# Uncomment the section below to test with TestPyPI first
- name: Publish package to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/

# - name: Publish package to PyPI
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# user: __token__
# password: ${{ secrets.PYPI_API_TOKEN }}
# # Optionally, you can add:
# # repository_url: https://test.pypi.org/legacy/ # To publish to TestPyPI first
# # skip_existing: true # To skip publishing if the version already exists
31 changes: 31 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# NOTE: This file is auto generated by OpenAPI Generator.
# URL: https://openapi-generator.tech
#
# ref: https://docs.gitlab.com/ee/ci/README.html
# ref: https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Python.gitlab-ci.yml

stages:
- test

.pytest:
stage: test
script:
- pip install -r requirements.txt
- pip install -r test-requirements.txt
- pytest --cov=speechall

pytest-3.7:
extends: .pytest
image: python:3.7-alpine
pytest-3.8:
extends: .pytest
image: python:3.8-alpine
pytest-3.9:
extends: .pytest
image: python:3.9-alpine
pytest-3.10:
extends: .pytest
image: python:3.10-alpine
pytest-3.11:
extends: .pytest
image: python:3.11-alpine
41 changes: 41 additions & 0 deletions .openapi-generator-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator

# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.

# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs

# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux

# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux

# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md

# Custom files to preserve during regeneration
example_transcribe.py
simple_example.py
EXAMPLE_README.md
REGENERATION_GUIDE.md
pyproject.toml
uv.lock
.venv/**
*.pyc
__pycache__/**
Makefile
regenerate.sh
fix_transcription_response.py
.gitignore
.openapi-generator-ignore
# Ignore OpenAI-Compatible Speech-to-Text Endpoints
speechall/api/open_ai_compatible_speech_to_text_api.py
95 changes: 95 additions & 0 deletions .openapi-generator/FILES
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
.github/workflows/python.yml
.gitignore
.gitlab-ci.yml
.openapi-generator-ignore
.travis.yml
README.md
docs/BaseTranscriptionConfiguration.md
docs/CreateReplacementRuleset201Response.md
docs/CreateReplacementRulesetRequest.md
docs/ErrorResponse.md
docs/ExactRule.md
docs/OpenAICreateTranslationRequestModel.md
docs/OpenaiCompatibleCreateTranscription200Response.md
docs/OpenaiCompatibleCreateTranslation200Response.md
docs/RegexGroupRule.md
docs/RegexRule.md
docs/RemoteTranscriptionConfiguration.md
docs/ReplacementRule.md
docs/ReplacementRulesApi.md
docs/SpeechToTextApi.md
docs/SpeechToTextModel.md
docs/TranscriptLanguageCode.md
docs/TranscriptOutputFormat.md
docs/TranscriptionDetailed.md
docs/TranscriptionModelIdentifier.md
docs/TranscriptionOnlyText.md
docs/TranscriptionProvider.md
docs/TranscriptionResponse.md
docs/TranscriptionSegment.md
docs/TranscriptionWord.md
git_push.sh
pyproject.toml
requirements.txt
setup.cfg
setup.py
speechall/__init__.py
speechall/api/__init__.py
speechall/api/replacement_rules_api.py
speechall/api/speech_to_text_api.py
speechall/api_client.py
speechall/api_response.py
speechall/configuration.py
speechall/exceptions.py
speechall/models/__init__.py
speechall/models/base_transcription_configuration.py
speechall/models/create_replacement_ruleset201_response.py
speechall/models/create_replacement_ruleset_request.py
speechall/models/error_response.py
speechall/models/exact_rule.py
speechall/models/open_ai_create_translation_request_model.py
speechall/models/openai_compatible_create_transcription200_response.py
speechall/models/openai_compatible_create_translation200_response.py
speechall/models/regex_group_rule.py
speechall/models/regex_rule.py
speechall/models/remote_transcription_configuration.py
speechall/models/replacement_rule.py
speechall/models/speech_to_text_model.py
speechall/models/transcript_language_code.py
speechall/models/transcript_output_format.py
speechall/models/transcription_detailed.py
speechall/models/transcription_model_identifier.py
speechall/models/transcription_only_text.py
speechall/models/transcription_provider.py
speechall/models/transcription_response.py
speechall/models/transcription_segment.py
speechall/models/transcription_word.py
speechall/py.typed
speechall/rest.py
test-requirements.txt
test/__init__.py
test/test_base_transcription_configuration.py
test/test_create_replacement_ruleset201_response.py
test/test_create_replacement_ruleset_request.py
test/test_error_response.py
test/test_exact_rule.py
test/test_open_ai_create_translation_request_model.py
test/test_openai_compatible_create_transcription200_response.py
test/test_openai_compatible_create_translation200_response.py
test/test_regex_group_rule.py
test/test_regex_rule.py
test/test_remote_transcription_configuration.py
test/test_replacement_rule.py
test/test_replacement_rules_api.py
test/test_speech_to_text_api.py
test/test_speech_to_text_model.py
test/test_transcript_language_code.py
test/test_transcript_output_format.py
test/test_transcription_detailed.py
test/test_transcription_model_identifier.py
test/test_transcription_only_text.py
test/test_transcription_provider.py
test/test_transcription_response.py
test/test_transcription_segment.py
test/test_transcription_word.py
tox.ini
1 change: 1 addition & 0 deletions .openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7.13.0
17 changes: 17 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# ref: https://docs.travis-ci.com/user/languages/python
language: python
python:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
# uncomment the following if needed
#- "3.11-dev" # 3.11 development branch
#- "nightly" # nightly build
# command to install dependencies
install:
- "pip install -r requirements.txt"
- "pip install -r test-requirements.txt"
# command to run tests
script: pytest --cov=speechall
126 changes: 126 additions & 0 deletions EXAMPLE_README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# Speechall Python SDK Example

This repository contains a Python SDK for the Speechall API, generated using OpenAPI Generator, with example scripts demonstrating how to use the transcribe endpoint.

## Quick Start

### 1. Install Dependencies

Make sure you have `uv` installed, then run:

```bash
uv sync
```

### 2. Set Up Authentication

Set your Speechall API token as an environment variable:

```bash
export SPEECHALL_API_TOKEN="your-api-token-here"
```

### 3. Run the Example

```bash
uv run python example_transcribe.py
```

## Features Demonstrated

The example script shows how to:

- **List Available Models**: Get all available speech-to-text models and their capabilities
- **Transcribe Local Files**: Upload and transcribe audio files from your local machine
- **Transcribe Remote URLs**: Transcribe audio files directly from URLs
- **Advanced Features**: Use speaker diarization, custom vocabulary, and smart formatting

## Available Models

The SDK supports numerous speech-to-text providers and models, including:

- **OpenAI**: `openai.whisper-1`, `openai.gpt-4o-transcribe`
- **Deepgram**: `deepgram.nova-2`, `deepgram.nova-3`, `deepgram.whisper-large`
- **AssemblyAI**: `assemblyai.best`, `assemblyai.nano`
- **Google**: `google.enhanced`, `google.standard`
- **Azure**: `azure.standard`
- **Groq**: `groq.whisper-large-v3`, `groq.whisper-large-v3-turbo`
- And many more!

## Example Usage

### Basic Transcription

```python
from openapi_client import ApiClient, Configuration
from openapi_client.api.speech_to_text_api import SpeechToTextApi
from openapi_client.models.transcription_model_identifier import TranscriptionModelIdentifier

# Set up client
configuration = Configuration()
configuration.access_token = "your-api-token"
api_client = ApiClient(configuration)
api_instance = SpeechToTextApi(api_client)

# Transcribe audio file
with open("audio.wav", "rb") as f:
result = api_instance.transcribe(
model=TranscriptionModelIdentifier.OPENAI_DOT_WHISPER_MINUS_1,
body=f.read(),
language="en"
)
print(result)
```

### Advanced Features

```python
# Use advanced features like diarization and custom vocabulary
result = api_instance.transcribe(
model=TranscriptionModelIdentifier.DEEPGRAM_DOT_NOVA_MINUS_2,
body=audio_data,
language="en",
output_format="verbose_json",
diarization=True,
custom_vocabulary=["technical", "terms"],
speakers_expected=2
)
```

## Supported Audio Formats

The API supports various audio formats including:
- WAV
- MP3
- FLAC
- OGG
- M4A
- And more (depends on the selected model/provider)

## Error Handling

The SDK includes proper error handling for common scenarios:

```python
from openapi_client.exceptions import ApiException

try:
result = api_instance.transcribe(...)
except ApiException as e:
print(f"API Error: {e}")
except Exception as e:
print(f"Unexpected error: {e}")
```

## Next Steps

1. Get your API token from the Speechall dashboard
2. Replace the example audio file path with your actual audio file
3. Experiment with different models and parameters
4. Check the [Speechall API documentation](https://docs.speechall.com) for more details

## Support

For support and questions:
- Check the [Speechall documentation](https://docs.speechall.com)
- Contact support at team@speechall.com
Loading