-
Notifications
You must be signed in to change notification settings - Fork 701
Add previous_text context to ElevenLabsHttpTTSService #1600
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
Add previous_text context to ElevenLabsHttpTTSService #1600
Conversation
Codecov ReportAttention: Patch coverage is
🚀 New features to boost your workflow:
|
- Added `previous_text` context support to ElevenLabsHttpTTSService, improving | ||
speech consistency across sentences within an 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.
Cool, it makes a lot of sense.
self._cumulative_time = 0 | ||
self._started = False | ||
self._previous_text = "" |
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 create a clear
or reset
function to centralize where we are resetting these internal states ?
self._started = False | ||
self._cumulative_time = 0 | ||
self._previous_text = "" |
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.
Like we are resetting the exactly same variables here.
# Include previous text as context if available | ||
if self._previous_text: | ||
payload["previous_text"] = self._previous_text | ||
print(f"Previous text: {self._previous_text}") |
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.
nit: should we keep it, maybe replace by logger
?
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.
Yes! My mistake.
Update: Actually, I'll just remove it. This log seems unnecessary.
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.
Just some nits, but all looks good, nice improvement.
3bb1ff8
to
384f809
Compare
4b21dab
to
1e0a9d7
Compare
Please describe the changes in your PR. If it is addressing an issue, please reference that as well.
From 11Labs docs on previous_text:
For HTTP requests, this parameter provides continuity between HTTP responses. We're passing in previous sentences from the bot's current turn.