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

Integration settings for twilio #414

Merged
merged 7 commits into from
Jul 25, 2024
Merged

Integration settings for twilio #414

merged 7 commits into from
Jul 25, 2024

Conversation

SanderGi
Copy link
Member

@SanderGi SanderGi commented Jul 19, 2024

Task: https://app.asana.com/0/1203067047205953/1207805759212356
No connect UI, just the integration settings as requested.

Q/A checklist

  • If you add new dependencies, did you update the lock file?
poetry lock --no-update
  • Run tests
ulimit -n unlimited && ./scripts/run-tests.sh
  • Do a self code review of the changes - Read the diff at least twice.
  • Carefully think about the stuff that might break because of this change - this sounds obvious but it's easy to forget to do "Go to references" on each function you're changing and see if it's used in a way you didn't expect.
  • The relevant pages still run when you press submit
  • The API for those pages still work (API tab)
  • The public API interface doesn't change if you didn't want it to (check API tab > docs page)
  • Do your UI changes (if applicable) look acceptable on mobile?
  • Ensure you have not regressed the import time unless you have a good reason to do so.
    You can visualize this using tuna:
python3 -X importtime -c 'import server' 2> out.log && tuna out.log

To measure import time for a specific library:

$ time python -c 'import pandas'

________________________________________________________
Executed in    1.15 secs    fish           external
   usr time    2.22 secs   86.00 micros    2.22 secs
   sys time    0.72 secs  613.00 micros    0.72 secs

To reduce import times, import libraries that take a long time inside the functions that use them instead of at the top of the file:

def my_function():
    import pandas as pd
    ...

Legal Boilerplate

Look, I get it. The entity doing business as “Gooey.AI” and/or “Dara.network” was incorporated in the State of Delaware in 2020 as Dara Network Inc. and is gonna need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Dara Network Inc can use, modify, copy, and redistribute my contributions, under its choice of terms.

@devxpy
Copy link
Member

devxpy commented Jul 19, 2024

Just a thought - can we remove twilio tts setting from bot integration, given that we already list the google voices in the saved run? If we already support google tts, we can just change the logic to say if the saved run has selected google tts, we use twilio inbuilt google tts with the same voice.
we can add support for polly too in time but not needed for now.

similarly for the asr model, if its set to auto detect in the saved run, we can pick up the language setting and use that for twilio too

I have seen in user testing that its hard to have 2 places to configure things + this makes it slightly easier to test without releasing the bot integration

this looks pretty good to me otherwise

@SanderGi
Copy link
Member Author

Just a thought - can we remove twilio tts setting from bot integration, given that we already list the google voices in the saved run? If we already support google tts, we can just change the logic to say if the saved run has selected google tts, we use twilio inbuilt google tts with the same voice. we can add support for polly too in time but not needed for now.

similarly for the asr model, if its set to auto detect in the saved run, we can pick up the language setting and use that for twilio too

I have seen in user testing that its hard to have 2 places to configure things + this makes it slightly easier to test without releasing the bot integration

this looks pretty good to me otherwise

What about the current use case for these settings where asr/tts isn’t enabled on the underlying gooey run? Should we just default to an arbitrary twilio tts voice and english for asr?

@devxpy
Copy link
Member

devxpy commented Jul 19, 2024

Just a thought - can we remove twilio tts setting from bot integration, given that we already list the google voices in the saved run? If we already support google tts, we can just change the logic to say if the saved run has selected google tts, we use twilio inbuilt google tts with the same voice. we can add support for polly too in time but not needed for now.
similarly for the asr model, if its set to auto detect in the saved run, we can pick up the language setting and use that for twilio too
I have seen in user testing that its hard to have 2 places to configure things + this makes it slightly easier to test without releasing the bot integration
this looks pretty good to me otherwise

What about the current use case for these settings where asr/tts isn’t enabled on the underlying gooey run? Should we just default to an arbitrary twilio tts voice and english for asr?

Yup, the default we hardcoded now can work. We can also force people to do this at time of creation of the twilio bot, but probably ok to use the hardcoded defaults right now

@devxpy
Copy link
Member

devxpy commented Jul 19, 2024

I just realised the user language support list can be different from the Twilio asr supported languages.

If such an edge case happens, just fallback to gooey asr

daras_ai_v2/asr.py Outdated Show resolved Hide resolved
routers/twilio_api.py Outdated Show resolved Hide resolved
SanderGi and others added 6 commits July 25, 2024 18:09
- Remove message quicklink not available for Twilio
- Replace `twilio_phone_number_sid` condition with `twilio_phone_number` in `get_bot_test_link` to fix /chat links
- Use `furl` for constructing URLs, improving readability and maintainability.
@devxpy devxpy force-pushed the twilio_settings_ui branch from 7553d2b to 94cdb47 Compare July 25, 2024 13:33
@devxpy
Copy link
Member

devxpy commented Jul 25, 2024

image ??

@SanderGi
Copy link
Member Author

SanderGi commented Jul 25, 2024

image ??

Is this before or after your refactor? You probably just set the phone number sid incorrectly in the db. The old code works when the settings in the db are correct

…t handling

- Fix KeyError when calling a bot that has no asr/tts selected
- Remove the `get_twilio_tts_voice` and `get_twilio_asr_language` functions.
- Add `resolve_twilio_asr_language` and `resolve_twilio_tts_voice` functions to handle language and voice determination.
- Refactor `create_voice_call_response` and `resp_say_or_tts_play` to use new resolve functions.
- Update constants for default and supported ASR languages and TTS voices.
@devxpy devxpy merged commit 04b0914 into master Jul 25, 2024
1 check passed
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.

2 participants