Deepgram language detection
# support
d
In an assistant, is it possible for me to get the detected_language from Deepgram and then change the prompt based on the results? See the json results below from Deepgram: { "metadata": { "transaction_key": "string", "request_id": "string", "sha256": "string", "created": "string", "duration": 0, "channels": 0 }, "results": { "channels": [ { "alternatives":[], "detected_language": "fr", "language_confidence": 0.0 } ] }
v
@deathless Yes, it is certainly possible to change the prompt based on the detected language from Deepgram. Once you receive the JSON results from Deepgram, you can extract the
detected_language
value and use it to tailor the prompt or response in the language that was detected. This allows for a more personalized and relevant user experience. If you need to set the language for transcription or any other service, please provide the language you would like to set, and I can assist you with that.
You can continue this conversation by mentioning me in the message.
d
@Vapi how di i actually do it using VAPI assistants or the VAPI api?
v
@deathless To change the prompt based on the detected language using VAPI (Voice API), you would typically follow these steps: 1. **Receive the Transcription**: After the audio is processed by Deepgram, you'll receive the transcription results in the JSON format you've shown. 2. **Parse the JSON**: In your VAPI assistant or server-side code, parse the JSON to extract the
detected_language
. For example, in JavaScript, you could do something like this:
Copy code
javascript
const deepgramResponse = /* the JSON response from Deepgram */;
const detectedLanguage = deepgramResponse.results.channels[0].detected_language;
3. **Set the Prompt Language**: Based on the
detected_language
, you can set the language for the next prompt. This could involve selecting a pre-written prompt in the detected language or using a translation service to translate your prompt. 4. **Respond to the User**: Use the VAPI to send the prompt back to the user in the detected language. If you're using a VAPI assistant, you would set the response language accordingly. 5. **Update the Assistant Logic**: If you need to continue the conversation in the detected language, ensure that your assistant logic can handle the language switch and continue to interact with the user appropriately. If you're looking to implement this and need to know specific API calls or methods within VAPI to set the language or handle the conversation, please provide more details or ask for support for more info on this.
s
@deathless soon we are rolling language detection which can detect language change transcriber language during the call, but prompt won't be changed as of now.
d
@Shubham Bajaj so it won't be possible to detect the language and then change the prompt based on the language?
s
prompt change based on the language is not possible.
2 Views