Closed jeffgca closed 2 months ago
Hi @jeffgca, I removed your API key from the code you shared here. Make sure to reset your API key in the dashboard so the old key which is now compromised, stops working.
When you use audio_url
, the configured string is taken as is and no pre-processing is done to it.
However, you can use the audio
option which accepts file paths, URLs, buffers, streams, and data-URLs.
When you use
audio_url
, the configured string is taken as is and no pre-processing is done to it. However, you can use theaudio
option which accepts file paths, URLs, buffers, streams, and data-URLs.
Thanks for replying so quickly, and sorry about the api key.
This is the boilerplate code from the onboarding process:
// Start by making sure the `assemblyai` package is installed.
// If not, you can install it by running the following command:
// npm install assemblyai
import { AssemblyAI } from 'assemblyai';
const client = new AssemblyAI({
apiKey: '***',
});
const FILE_URL =
'https://storage.googleapis.com/aai-web-samples/5_common_sports_injuries.mp3';
// You can also transcribe a local file by passing in a file path
// const FILE_URL = './path/to/file.mp3';
// Request parameters where speaker_labels has been enabled
const data = {
audio_url: FILE_URL,
speaker_labels: true
}
const run = async () => {
const transcript = await client.transcripts.transcribe(data);
console.log(transcript.text);
for (let utterance of transcript.utterances) {
console.log(`Speaker ${utterance.speaker}: ${utterance.text}`);
}
};
run();
You should probably expand this boilerplate code to mention that, maybe something like:
// Start by making sure the `assemblyai` package is installed.
// If not, you can install it by running the following command:
// npm install assemblyai
import { AssemblyAI } from 'assemblyai';
const client = new AssemblyAI({
apiKey: '***',
});
const FILE_URL =
'https://storage.googleapis.com/aai-web-samples/5_common_sports_injuries.mp3';
// Request parameters where speaker_labels has been enabled
const data = {
audio_url: FILE_URL,
speaker_labels: true
}
// You can also transcribe a local file by passing in a file path
// const FILE_PATH = './path/to/file.mp3';
// const data = {
// audio: FILE_PATH,
// speaker_labels: true
// }
const run = async () => {
const transcript = await client.transcripts.transcribe(data);
console.log(transcript.text);
for (let utterance of transcript.utterances) {
console.log(`Speaker ${utterance.speaker}: ${utterance.text}`);
}
};
run();
Thank you for catching that! I'll update the onboarding scripts and get back to you.
The samples have been update to use the audio
option. Thank you for reporting!
For this page in the docs:
https://www.assemblyai.com/docs/getting-started/transcribe-an-audio-file
It says:
This fails with this error message:
My code: