-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Chore: AssemblyAI add dynamic keyterms + return language code + normalize preemptive generation validation #3802
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
base: main
Are you sure you want to change the base?
Conversation
|
|
||
| # Normalize text by lowercasing and removing punctuation for comparison | ||
| def normalize_text(text: str) -> str: | ||
| return text.lower().translate(str.maketrans("", "", string.punctuation)) |
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.
should we just use text.strip() to remove start and end spaces, different punctuation like ? or ! may have different TTS results?
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.
@longcw in my testing, the same input to an LLM but changing between blank, ?, ! has no effect on the LLM response
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.
IMO we shouldn't normalize the punctuations in the agents framework, maybe you can add it to the specific (validated) STT to reuse the latest transcript sent to the preemptive generation as the final version if the normalized text is the same.
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.
Done, thanks @longcw!
Let me know if there's anything else needed for this PR or all good to go
|
Hi @longcw @theomonnom may we have this updated PR reviewed? The type checks and tests are failing due to OpenAI plugin |
Hi team!
Added dynamic keyterms updating without closing the stream, sends a message with type "UpdateConfiguration" https://www.assemblyai.com/docs/api-reference/streaming-api/streaming-api#send.sendUpdateConfiguration
Language code is returned when "Language_detection" is True (set now by default), and we pass this in the preflight and final transcripts, its only returned with utterances so we store it when we get it
https://www.assemblyai.com/docs/api-reference/streaming-api/streaming-api#receive.receiveTurn.language_code
Also normalized the preemptive generation text in agent_activity before validation, so we only compare if there are new words and not any changes in casing or punctuation.