Skip to content

update python bindings for stream transcribe#351

Merged
HenryNdubuaku merged 1 commit intomainfrom
update-python-bindings-stream-transcribe
Feb 13, 2026
Merged

update python bindings for stream transcribe#351
HenryNdubuaku merged 1 commit intomainfrom
update-python-bindings-stream-transcribe

Conversation

@jakmro
Copy link
Copy Markdown
Collaborator

@jakmro jakmro commented Feb 13, 2026

No description provided.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Python bindings for the stream transcription API to align with changes in the underlying C FFI. The API is simplified by consolidating functions and changing their behavior.

Changes:

  • Renamed cactus_stream_transcribe_init to cactus_stream_transcribe_start with added options parameter
  • Removed cactus_stream_transcribe_insert function and merged its functionality into cactus_stream_transcribe_process
  • Updated cactus_stream_transcribe_process to accept PCM data directly and return transcription immediately
  • Renamed cactus_stream_transcribe_finalize to cactus_stream_transcribe_stop
  • Removed cactus_stream_transcribe_destroy function (cleanup now handled by stop)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

stream, buf, len(buf),
options.encode() if options else None
)
_lib.cactus_stream_transcribe_process(stream, arr, len(arr), buf, len(buf))
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The return value from _lib.cactus_stream_transcribe_process is not being checked. According to the C FFI header and usage in tests, this function returns an integer where negative values indicate errors. The function should check the return value and handle errors appropriately, similar to how other functions in this file handle errors from FFI calls.

Suggested change
_lib.cactus_stream_transcribe_process(stream, arr, len(arr), buf, len(buf))
result = _lib.cactus_stream_transcribe_process(stream, arr, len(arr), buf, len(buf))
if result < 0:
raise RuntimeError(f"cactus_stream_transcribe_process failed with error code {result}")

Copilot uses AI. Check for mistakes.
"""
buf = ctypes.create_string_buffer(65536)
_lib.cactus_stream_transcribe_finalize(stream, buf, len(buf))
_lib.cactus_stream_transcribe_stop(stream, buf, len(buf))
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The return value from _lib.cactus_stream_transcribe_stop is not being checked. According to the C FFI header and usage in tests, this function returns an integer where negative values indicate errors. The function should check the return value and handle errors appropriately before returning the buffer content.

Suggested change
_lib.cactus_stream_transcribe_stop(stream, buf, len(buf))
result = _lib.cactus_stream_transcribe_stop(stream, buf, len(buf))
if result < 0:
raise RuntimeError(f"cactus_stream_transcribe_stop failed with error code {result}")

Copilot uses AI. Check for mistakes.
@HenryNdubuaku HenryNdubuaku merged commit 0b07bf4 into main Feb 13, 2026
7 of 8 checks passed
ncylich pushed a commit that referenced this pull request Feb 24, 2026
cattermelon1234 pushed a commit to cattermelon1234/cactus that referenced this pull request Feb 28, 2026
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.

3 participants