diff --git a/package.json b/package.json index d4011ac..855fa25 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ztimson/ai-utils", - "version": "0.7.0", + "version": "0.7.1", "description": "AI Utility library", "author": "Zak Timson", "license": "MIT", diff --git a/src/audio.ts b/src/audio.ts index ae80bf7..c227242 100644 --- a/src/audio.ts +++ b/src/audio.ts @@ -40,9 +40,11 @@ export class Audio { if(!this.ai.language.defaultModel) throw new Error('Configure an LLM for advanced ASR speaker detection'); p = p.then(async transcript => { if(!transcript) return transcript; - const names = await this.ai.language.json(transcript, '{1: "Detected Name"}', { + let chunks = this.ai.language.chunk(transcript, 500, 0); + if(chunks.length > 4) chunks = [...chunks.slice(0, 3), chunks.at(-1)]; + const names = await this.ai.language.json(chunks.join('\n'), '{1: "Detected Name"}', { system: 'Use this following transcript to identify speakers. Only identify speakers you are sure about', - temperature: 0.2, + temperature: 0.1, }); Object.entries(names).forEach(([speaker, name]) => { transcript = (transcript).replaceAll(`[Speaker ${speaker}]`, `[${name}]`);