-
Notifications
You must be signed in to change notification settings - Fork 471
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
Dump logs for the deepgram issue detection #910
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -205,6 +205,7 @@ def stream_audio(audio_buffer): | |
file_path, duration = None, 0 | ||
if language == 'en' and (codec == 'opus' or codec == 'pcm16') and include_speech_profile: | ||
file_path = get_profile_audio_if_exists(uid) | ||
print(f'deepgram-obns3: file_path {file_path}') | ||
duration = AudioSegment.from_wav(file_path).duration_seconds + 5 if file_path else 0 | ||
|
||
# Deepgram | ||
|
@@ -219,6 +220,7 @@ def stream_audio(audio_buffer): | |
stream_transcript, speech_profile_stream_id, language, sample_rate, deepgram_codec_value, channels | ||
) | ||
|
||
print(f'deepgram-obns3: send_initial_file_path > deepgram_socket {deepgram_socket}') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
await send_initial_file_path(file_path, deepgram_socket) | ||
elif stt_service == STTService.soniox: | ||
soniox_socket = await process_audio_soniox( | ||
|
@@ -292,6 +294,8 @@ async def receive_audio(dg_socket1, dg_socket2, soniox_socket, speechmatics_sock | |
print("WebSocket disconnected") | ||
except Exception as e: | ||
print(f'Could not process audio: error {e}') | ||
print(f'deepgram-obns3: receive_audio > dg_socket1 {dg_socket1}') | ||
print(f'deepgram-obns3: receive_audio > dg_socket2 {dg_socket2}') | ||
Comment on lines
+297
to
+298
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, replace the print statements with debug log statements. - print(f'deepgram-obns3: receive_audio > dg_socket1 {dg_socket1}')
- print(f'deepgram-obns3: receive_audio > dg_socket2 {dg_socket2}')
+ logging.debug(f'deepgram-obns3: receive_audio > dg_socket1 {dg_socket1}')
+ logging.debug(f'deepgram-obns3: receive_audio > dg_socket2 {dg_socket2}') Remember to configure the logging level appropriately in your application's configuration or main function. |
||
websocket_close_code = 1011 | ||
finally: | ||
websocket_active = False | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Entelligence.AI
While it's understandable that you're adding print statements for debugging purposes, it's not a good practice to leave them in the production code. Instead, consider using a logging library which can be configured to output logs at different levels (DEBUG, INFO, WARNING, ERROR, CRITICAL). This way, you can set the level of logging at runtime without having to modify your code.