Skip to content

Support Custom OpenAI-compatible endpoints for speech-to-text transcription (Fixes #136) - #140

Open
AdamMagued wants to merge 1 commit into
AAClause:masterfrom
AdamMagued:fix-custom-endpoint-transcription
Open

AdamMagued wants to merge 1 commit into
AAClause:masterfrom
AdamMagued:fix-custom-endpoint-transcription

Conversation

@AdamMagued

Copy link
Copy Markdown

Summary

Resolves #136.

Enables configured Custom OpenAI-compatible endpoints (such as OmniRoute, LocalAI, vLLM, etc.) to be selectable and used for speech-to-text (transcription) both in global dictation / recording and in dedicated transcription tools.

Key Changes

  1. Transcription Provider Options:

    • Added CUSTOM_OPENAI to TranscriptionProvider in consts.py (custom_openai).
    • Exposed Custom OpenAI in the settings dialog transcription provider choice list.
    • Added Custom OpenAI transcription account dropdown to the Provider account mapping group in the settings dialog.
    • Updated configspec.py with customOpenAITranscriptionAccountId and customOpenAITranscriptionModel.
  2. Transcription Routing and Endpoint Wiring:

    • Implemented _transcribe_custom_openai in RecordThread and updated transcribe_audio_file.
    • Wired transcription requests to call /audio/transcriptions on the configured custom base URL using the configured API credentials.
    • Added helper functions in transcription.py (list_transcription_providers, get_transcription_provider_choices, resolve_transcription_endpoint, and enhanced provider normalization).
    • Updated conversation_dialog.py _resolveDictationConfig to support Custom OpenAI transcription account mapping and model resolution.
  3. Tools Menu and Dedicated Dialog Integration:

    • Added ToolId.CUSTOM_OPENAI_TRANSCRIPTION to TOOLS_REGISTRY and included Provider.CustomOpenAI in _GROUP_ORDER in toolsmenu.py.
    • Added CustomOpenAITranscriptionToolDialog and updated OpenAITranscriptionToolDialog to display and configure accounts from Custom OpenAI.
    • Added TOOL_CUSTOM_OPENAI_TRANSCRIPTION to ConversationFormat and mapped it in conversations_manager_dialog.py.
  4. Robustness & Edge Cases:

    • Normalized custom base URLs to strip trailing slashes, preventing double-slash paths (e.g. //audio/transcriptions).
    • Allowed CustomOpenAI user endpoints with optional API keys so local servers without auth are supported without validation errors.
    • Ensured script_toggleRecording and script_askQuestion do not prematurely block recording when Custom OpenAI or local transcription is configured.
  5. Testing:

    • Added 22 unit tests in tests/test_custom_transcription.py covering provider listing, custom endpoint resolution, request wiring, URL normalization, tools menu registry, and dictation resolution.

Verification

  • All 22 unit tests pass (pytest -v).
  • Syntax validation passes across all modified modules.

…scription

- Add CUSTOM_OPENAI to TranscriptionProvider enum and include Custom OpenAI in settings transcription provider choices and account mapping.
- Wire Custom OpenAI transcription in RecordThread, transcribe_audio_file, and conversation dialog to send requests to /audio/transcriptions on the configured custom base URL with configured credentials.
- Add helper functions in transcription.py for provider listing, choices, and endpoint resolution.
- Expose Custom OpenAI transcription tool in Tools menu and support custom accounts in OpenAITranscriptionToolDialog.
- Normalize base URL trailing slashes and permit user endpoints with optional API keys.
- Add comprehensive unit tests verifying provider listing, endpoint resolution, and transcription call wiring.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Custom OpenAI-compatible endpoint not appearing in Speech-to-text (transcription) tool

1 participant