@xuda.io/ai_module 1.1.3955 → 1.1.3957
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.mjs +4 -3
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -3450,17 +3450,18 @@ const get_drive_file_stream = async function (drive_type, app_id, uid, file_path
|
|
|
3450
3450
|
}
|
|
3451
3451
|
};
|
|
3452
3452
|
|
|
3453
|
-
const transcribe = async function (stream) {
|
|
3453
|
+
const transcribe = async function (uid, stream, metadata) {
|
|
3454
3454
|
try {
|
|
3455
|
+
const model = 'whisper-1';
|
|
3455
3456
|
const resp = await client.audio.transcriptions.create({
|
|
3456
|
-
model
|
|
3457
|
+
model, // or "gpt-4o-transcribe", "whisper-1"
|
|
3457
3458
|
file: stream, //fs.createReadStream(filePath),
|
|
3458
3459
|
|
|
3459
3460
|
response_format: 'text', // "text" | "json" | "verbose_json" | "srt" | "vtt"
|
|
3460
3461
|
language: 'en', // hint language (ISO 639-1), e.g. "he" for Hebrew
|
|
3461
3462
|
// temperature: 0 // lower = more literal
|
|
3462
3463
|
});
|
|
3463
|
-
|
|
3464
|
+
record_chat_usage(uid, 0, resp.length || 0, 'transcribe', prompt, model, metadata);
|
|
3464
3465
|
console.log(resp); // or resp for JSON formats
|
|
3465
3466
|
return resp;
|
|
3466
3467
|
} catch (error) {
|