Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/voice Loosing Data On Crash #1149

Closed
gwpl opened this issue Aug 22, 2024 · 7 comments
Closed

/voice Loosing Data On Crash #1149

gwpl opened this issue Aug 22, 2024 · 7 comments
Labels
question Further information is requested

Comments

@gwpl
Copy link

gwpl commented Aug 22, 2024

Issue

I sometimes make a lot of effort giving longer step by step description to aider what to do (using it as helper with RSI to do more "typing by voice"), having said that I encountered multiple times crash, when aider crashed, and my few minutes of talking... It would be nice it temporarily recording would be stored somewhere from where I could recover it (/tmp/aider.$PID/ ?) , and manually run some STT script. (Also if openai STT is failing maybe good to have possibility for alternative of fallback ? like assemblyai?)


Initializing sound device...
Recording, press ENTER when done... 321.4sec ░█████████
Traceback (most recent call last):
  File "/home/username/.local/bin/aider", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/username/.local/pipx/venvs/aider-chat/lib/python3.12/site-packages/aider/main.py", line 640, in main
    coder.run()
  File "/home/username/.local/pipx/venvs/aider-chat/lib/python3.12/site-packages/aider/coders/base_coder.py", line 770, in run
    self.run_one(user_message, preproc)
  File "/home/username/.local/pipx/venvs/aider-chat/lib/python3.12/site-packages/aider/coders/base_coder.py", line 805, in run_one
    message = self.preproc_user_input(user_message)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/username/.local/pipx/venvs/aider-chat/lib/python3.12/site-packages/aider/coders/base_coder.py", line 794, in preproc_user_input
    return self.commands.run(inp)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/username/.local/pipx/venvs/aider-chat/lib/python3.12/site-packages/aider/commands.py", line 204, in run
    return self.do_run(matching_commands[0][1:], rest_inp)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/username/.local/pipx/venvs/aider-chat/lib/python3.12/site-packages/aider/commands.py", line 179, in do_run
    return cmd_method(args)
           ^^^^^^^^^^^^^^^^
  File "/home/username/.local/pipx/venvs/aider-chat/lib/python3.12/site-packages/aider/commands.py", line 958, in cmd_voice
    text = self.voice.record_and_transcribe(history, language=self.voice_language)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/username/.local/pipx/venvs/aider-chat/lib/python3.12/site-packages/aider/voice.py", line 72, in record_and_transcribe
    return self.raw_record_and_transcribe(history, language)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/username/.local/pipx/venvs/aider-chat/lib/python3.12/site-packages/aider/voice.py", line 100, in raw_record_and_transcribe
    transcript = litellm.transcription(
                 ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/username/.local/pipx/venvs/aider-chat/lib/python3.12/site-packages/litellm/utils.py", line 1086, in wrapper
    raise e
  File "/home/username/.local/pipx/venvs/aider-chat/lib/python3.12/site-packages/litellm/utils.py", line 966, in wrapper
    result = original_function(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/username/.local/pipx/venvs/aider-chat/lib/python3.12/site-packages/litellm/main.py", line 4577, in transcription
    response = openai_chat_completions.audio_transcriptions(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/username/.local/pipx/venvs/aider-chat/lib/python3.12/site-packages/litellm/llms/openai.py", line 1667, in audio_transcriptions
    _, response = self.make_sync_openai_audio_transcriptions_request(
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/username/.local/pipx/venvs/aider-chat/lib/python3.12/site-packages/litellm/llms/openai.py", line 1630, in make_sync_openai_audio_transcriptions_request
    raise e
  File "/home/username/.local/pipx/venvs/aider-chat/lib/python3.12/site-packages/litellm/llms/openai.py", line 1627, in make_sync_openai_audio_transcriptions_request
    response = openai_client.audio.transcriptions.create(**data, timeout=timeout)  # type: ignore
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/username/.local/pipx/venvs/aider-chat/lib/python3.12/site-packages/openai/resources/audio/transcriptions.py", line 114, in create
    return self._post(
           ^^^^^^^^^^^
  File "/home/username/.local/pipx/venvs/aider-chat/lib/python3.12/site-packages/openai/_base_client.py", line 1260, in post
    return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/username/.local/pipx/venvs/aider-chat/lib/python3.12/site-packages/openai/_base_client.py", line 937, in request
    return self._request(
           ^^^^^^^^^^^^^^
  File "/home/username/.local/pipx/venvs/aider-chat/lib/python3.12/site-packages/openai/_base_client.py", line 1041, in _request
    raise self._make_status_error_from_response(err.response) from None
openai.APIStatusError: Error code: 413 - {'error': {'message': 'Maximum content size limit (26214400) exceeded (26282390 bytes read)', 'type': 'server_error', 'param': None, 'code': None}}

Version and model info

Version: aider 0.51.1 (installed on archlinux via pipx install/upgrade )
Model: Happening for GPT-4 and GPT-4o (however it's audio, so openai whisper I guess)

@paul-gauthier
Copy link
Owner

Thanks for trying aider and filing this issue.

It looks like your voice recording file is too large for OpenAI to process.

I think you may want to use shorter prompts. Or use an external voice-to-text tool to transcript a longer prompt. Then you can copy & paste (/clipboard) it into the aider chat.

@paul-gauthier paul-gauthier added the question Further information is requested label Aug 26, 2024
@gwpl
Copy link
Author

gwpl commented Aug 27, 2024

Thank you for your quick response and for providing suggestions on handling this issue.

(I apologise if there is a bit of repetition, preparing message mostly by voice, due to limited typing capacity at the moment. I reviewed and corrected in critical places to ensure integrity of message)

TL;DR- If I don't know upfront how long will be message, I would have to use external tool all the time. I propose simple workaround (keeping recording file in predictable location like /tmp/aider.$PID unkess successfully processed) or clean solution: error handling providing user error message with path to recording, allowing user to use external tool when needed.

Importance of Preserving Voice Input Data

Thank you for your quick response and suggestions. I appreciate the advice to use shorter prompts or an external voice-to-text tool. However, there’s a key issue that this approach doesn't address:

  • Unpredictability of Recording Length:
    When I start speaking to aider, I don’t always know how long my recording will be. If the recording unexpectedly becomes too long and causes a crash, I end up losing all the data without any warning. This results in losing not just the transcription but also my train of thought, making it difficult or even impossible to recreate what I was saying.

    • given unpredictability of length of message I would need to copy and paste most of the time effectively making /voice feature of very little use...
  • Need for a Solution to Prevent Data Loss:
    For me, it's important to have a mechanism in place that either prevents data loss or provides a workaround, such as temporarily storing the recording. Without this, the risk of losing valuable input is significant, especially since some thoughts may not be easily recoverable.

Additional Suggestions for Error Handling:

  • It would be helpful if aider could handle this error more gracefully by:
    • Displaying an error message when the voice recording is too large.
    • Providing a path to a temporary file where the recording is stored. This would allow users to manually transcribe the audio using external tools if needed.

Use of External Tools:

Issue with Losing Transcriptions:

  • When using aider, I’m often not sure how long my speech will be. If aider crashes, I risk losing all my thoughts and the time invested, which is frustrating.
    • Proposed Solution: Storing the recording temporarily would allow me to retrieve it in case of a crash. I could then use my external tool to transcribe and resume my work with aider.
    • Ideal Implementation: Gracefully handling such cases by providing the user with the temporary file path, somthey can transcribe externally if needed.

Additional Suggestions for Error Handling:

  • It would be helpful if aider could handle this error more gracefully by:
    • Displaying an error message when the voice recording is too large.
    • Providing a path to a temporary file where the recording is stored. This would allow users to manually transcribe the audio using external tools if needed.

Use of External Tools:

  • Yes, I do have an external tool for transcribing longer recordings. You can find it here: STT Tool (inspired by aider).

Issue with Losing Transcriptions:

  • When using aider, I’m often not sure how long my speech will be. If aider crashes, I risk losing all my thoughts and the time invested, which is frustrating.
    • Proposed Solution: Storing the recording temporarily in oredictable location, e.g. in /tmp/aider.$PID/ . would allow me to retrieve it in case of a crash (assuming temporary recording would be not deleted, unless successfully processed). I could then use my external tool to transcribe and resume my work with aider.
    • Ideal Implementation: Gracefully handling such cases by providing the user with the temporary file path and the option to transcribe externally if needed.

This would significantly improve the user experience by ensuring that data isn’t lost in the event of a crash.

Thanks again for your continued development and support for aider 🙏.

@paul-gauthier
Copy link
Owner

Aider will not show you the filename of the wav file with the recording in it in case of an error. You can copy that file and transcribe it some other way if you like.

> /voice

Initializing sound device...
Recording, press ENTER when done... 1.8sec ░░████████
Unable to transcribe /var/folders/49/kxrdwwbx0h9bchx99397477c0000gn/T/tmpqn00i8oi.wav: <error message>

The change is available in the main branch. You can get it by installing the latest version from github:

aider --install-main-branch

# or...

python -m pip install --upgrade git+https://github.com/paul-gauthier/aider.git

If you have a chance to try it, let me know if it works better for you.

@gwpl
Copy link
Author

gwpl commented Sep 3, 2024

Aider will not show

"Aider will now show"

Thank you very much!

@paul-gauthier
Copy link
Owner

Ah yes, it will NOW show the filename. Sorry about that.

@gwpl
Copy link
Author

gwpl commented Sep 3, 2024

Thank you! You are the best!

@paul-gauthier
Copy link
Owner

I'm going to close this issue for now, but feel free to add a comment here and I will re-open or file a new issue any time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants
@gwpl @paul-gauthier and others