@redaksjon/protokoll 0.0.8 → 0.0.10
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/.cursor/rules/definition-of-done.md +89 -0
- package/.cursor/rules/no-emoticons.md +43 -0
- package/LICENSE +1 -1
- package/README.md +928 -35
- package/dist/agentic/executor.js +315 -0
- package/dist/agentic/executor.js.map +1 -0
- package/dist/agentic/index.js +19 -0
- package/dist/agentic/index.js.map +1 -0
- package/dist/agentic/registry.js +41 -0
- package/dist/agentic/registry.js.map +1 -0
- package/dist/agentic/tools/lookup-person.js +66 -0
- package/dist/agentic/tools/lookup-person.js.map +1 -0
- package/dist/agentic/tools/lookup-project.js +93 -0
- package/dist/agentic/tools/lookup-project.js.map +1 -0
- package/dist/agentic/tools/route-note.js +45 -0
- package/dist/agentic/tools/route-note.js.map +1 -0
- package/dist/agentic/tools/store-context.js +51 -0
- package/dist/agentic/tools/store-context.js.map +1 -0
- package/dist/agentic/tools/verify-spelling.js +57 -0
- package/dist/agentic/tools/verify-spelling.js.map +1 -0
- package/dist/arguments.js +23 -6
- package/dist/arguments.js.map +1 -1
- package/dist/constants.js +13 -11
- package/dist/constants.js.map +1 -1
- package/dist/context/discovery.js +114 -0
- package/dist/context/discovery.js.map +1 -0
- package/dist/context/index.js +58 -0
- package/dist/context/index.js.map +1 -0
- package/dist/context/storage.js +131 -0
- package/dist/context/storage.js.map +1 -0
- package/dist/interactive/handler.js +223 -0
- package/dist/interactive/handler.js.map +1 -0
- package/dist/interactive/index.js +18 -0
- package/dist/interactive/index.js.map +1 -0
- package/dist/interactive/onboarding.js +28 -0
- package/dist/interactive/onboarding.js.map +1 -0
- package/dist/main.js +0 -0
- package/dist/output/index.js +8 -0
- package/dist/output/index.js.map +1 -0
- package/dist/output/manager.js +105 -0
- package/dist/output/manager.js.map +1 -0
- package/dist/phases/complete.js +107 -0
- package/dist/phases/complete.js.map +1 -0
- package/dist/phases/locate.js +14 -5
- package/dist/phases/locate.js.map +1 -1
- package/dist/pipeline/index.js +8 -0
- package/dist/pipeline/index.js.map +1 -0
- package/dist/pipeline/orchestrator.js +281 -0
- package/dist/pipeline/orchestrator.js.map +1 -0
- package/dist/prompt/instructions/transcribe.md +6 -6
- package/dist/prompt/personas/transcriber.md +5 -5
- package/dist/protokoll.js +38 -5
- package/dist/protokoll.js.map +1 -1
- package/dist/reasoning/client.js +150 -0
- package/dist/reasoning/client.js.map +1 -0
- package/dist/reasoning/index.js +36 -0
- package/dist/reasoning/index.js.map +1 -0
- package/dist/reasoning/strategy.js +60 -0
- package/dist/reasoning/strategy.js.map +1 -0
- package/dist/reflection/collector.js +124 -0
- package/dist/reflection/collector.js.map +1 -0
- package/dist/reflection/index.js +16 -0
- package/dist/reflection/index.js.map +1 -0
- package/dist/reflection/reporter.js +238 -0
- package/dist/reflection/reporter.js.map +1 -0
- package/dist/routing/classifier.js +201 -0
- package/dist/routing/classifier.js.map +1 -0
- package/dist/routing/index.js +27 -0
- package/dist/routing/index.js.map +1 -0
- package/dist/routing/router.js +153 -0
- package/dist/routing/router.js.map +1 -0
- package/dist/transcription/index.js +41 -0
- package/dist/transcription/index.js.map +1 -0
- package/dist/transcription/service.js +64 -0
- package/dist/transcription/service.js.map +1 -0
- package/dist/transcription/types.js +31 -0
- package/dist/transcription/types.js.map +1 -0
- package/dist/util/media.js +4 -4
- package/dist/util/media.js.map +1 -1
- package/dist/util/metadata.js +95 -0
- package/dist/util/metadata.js.map +1 -0
- package/dist/util/storage.js +2 -2
- package/dist/util/storage.js.map +1 -1
- package/docs/examples.md +224 -0
- package/docs/index.html +5 -3
- package/docs/package-lock.json +639 -332
- package/docs/package.json +5 -4
- package/docs/troubleshooting.md +257 -0
- package/docs/vite.config.js +9 -3
- package/eslint.config.mjs +1 -0
- package/guide/architecture.md +217 -0
- package/guide/configuration.md +199 -0
- package/guide/context-system.md +215 -0
- package/guide/development.md +273 -0
- package/guide/index.md +91 -0
- package/guide/interactive.md +199 -0
- package/guide/quickstart.md +138 -0
- package/guide/reasoning.md +193 -0
- package/guide/routing.md +222 -0
- package/package.json +10 -7
- package/tsconfig.tsbuildinfo +1 -1
- package/vitest.config.ts +27 -5
- package/dist/phases/transcribe.js +0 -149
- package/dist/phases/transcribe.js.map +0 -1
- package/dist/processor.js +0 -35
- package/dist/processor.js.map +0 -1
- package/dist/prompt/transcribe.js +0 -41
- package/dist/prompt/transcribe.js.map +0 -1
- package/dist/util/general.js +0 -39
- package/dist/util/general.js.map +0 -1
- package/dist/util/openai.js +0 -92
- package/dist/util/openai.js.map +0 -1
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import { getLogger } from '../logging.js';
|
|
2
|
-
import { create as create$1 } from '../util/storage.js';
|
|
3
|
-
import { create as create$2 } from '../util/media.js';
|
|
4
|
-
import { transcribeAudio, createCompletion } from '../util/openai.js';
|
|
5
|
-
import { stringifyJSON } from '../util/general.js';
|
|
6
|
-
import path from 'path';
|
|
7
|
-
import { Formatter } from '@riotprompt/riotprompt';
|
|
8
|
-
import { create as create$3 } from '../prompt/transcribe.js';
|
|
9
|
-
|
|
10
|
-
const create = (config, operator)=>{
|
|
11
|
-
const logger = getLogger();
|
|
12
|
-
const storage = create$1({
|
|
13
|
-
log: logger.debug
|
|
14
|
-
});
|
|
15
|
-
const media = create$2(logger);
|
|
16
|
-
const prompts = create$3(config.model, config);
|
|
17
|
-
const transcribe = async (creation, outputPath, contextPath, interimPath, filename, hash, audioFile)=>{
|
|
18
|
-
if (!outputPath) {
|
|
19
|
-
throw new Error("outputPath is required for transcribe function");
|
|
20
|
-
}
|
|
21
|
-
if (!audioFile) {
|
|
22
|
-
throw new Error("audioFile is required for transcribe function");
|
|
23
|
-
}
|
|
24
|
-
// Remove extension from audioFile and make the name filesafe
|
|
25
|
-
const audioFileBasename = path.basename(audioFile, path.extname(audioFile)).replace(/[^a-zA-Z0-9_-]/g, '_') // Replace non-alphanumeric chars with underscore
|
|
26
|
-
.replace(/_+/g, '_') // Replace multiple underscores with a single one
|
|
27
|
-
.trim();
|
|
28
|
-
logger.debug(`Processed audio filename: ${audioFileBasename}`);
|
|
29
|
-
let transcriptOutputFilename = await operator.constructFilename(creation, 'transcript', hash, {
|
|
30
|
-
subject: audioFileBasename
|
|
31
|
-
});
|
|
32
|
-
// Ensure the filename ends with .json
|
|
33
|
-
if (!transcriptOutputFilename.endsWith('.json')) {
|
|
34
|
-
logger.warn('constructFilename did not return a .json file for transcript, appending extension: %s', transcriptOutputFilename);
|
|
35
|
-
transcriptOutputFilename += '.json';
|
|
36
|
-
}
|
|
37
|
-
const transcriptOutputPath = path.join(interimPath, transcriptOutputFilename);
|
|
38
|
-
// Check if transcription already exists
|
|
39
|
-
if (await storage.exists(transcriptOutputPath)) {
|
|
40
|
-
logger.info('Transcription file %s already exists, returning existing content...', transcriptOutputPath);
|
|
41
|
-
const existingContent = await storage.readFile(transcriptOutputPath, 'utf8');
|
|
42
|
-
return JSON.parse(existingContent);
|
|
43
|
-
}
|
|
44
|
-
const baseDebugFilename = path.parse(transcriptOutputFilename).name;
|
|
45
|
-
const transcriptionDebugFile = config.debug ? path.join(interimPath, `${baseDebugFilename}.transcription.raw.response.json`) : undefined;
|
|
46
|
-
// Check if audio file exceeds the size limit
|
|
47
|
-
const fileSize = await media.getFileSize(audioFile);
|
|
48
|
-
logger.debug(`Audio file size: ${fileSize} bytes, max size: ${config.maxAudioSize} bytes`);
|
|
49
|
-
let transcription;
|
|
50
|
-
if (fileSize > config.maxAudioSize) {
|
|
51
|
-
logger.info(`Audio file exceeds maximum size (${fileSize} > ${config.maxAudioSize} bytes), splitting into chunks`);
|
|
52
|
-
// Create a temporary directory for the audio chunks
|
|
53
|
-
const tempDir = path.join(config.tempDirectory, `split_audio_${hash}`);
|
|
54
|
-
await storage.createDirectory(tempDir);
|
|
55
|
-
try {
|
|
56
|
-
// Split the audio file into chunks
|
|
57
|
-
const audioChunks = await media.splitAudioFile(audioFile, tempDir, config.maxAudioSize);
|
|
58
|
-
logger.info(`Split audio file into ${audioChunks.length} chunks`);
|
|
59
|
-
// Transcribe each chunk
|
|
60
|
-
const transcriptions = [];
|
|
61
|
-
for(let i = 0; i < audioChunks.length; i++){
|
|
62
|
-
const chunkPath = audioChunks[i];
|
|
63
|
-
logger.info(`Transcribing chunk ${i + 1}/${audioChunks.length}: ${chunkPath}`);
|
|
64
|
-
const chunkDebugFile = config.debug ? path.join(interimPath, `${baseDebugFilename}.transcription.chunk${i + 1}.raw.response.json`) : undefined;
|
|
65
|
-
const chunkTranscription = await transcribeAudio(chunkPath, {
|
|
66
|
-
model: config.transcriptionModel,
|
|
67
|
-
debug: config.debug,
|
|
68
|
-
debugFile: chunkDebugFile
|
|
69
|
-
});
|
|
70
|
-
transcriptions.push(chunkTranscription);
|
|
71
|
-
}
|
|
72
|
-
// Combine all transcriptions
|
|
73
|
-
const combinedText = transcriptions.map((t)=>t.text).join(' ');
|
|
74
|
-
transcription = {
|
|
75
|
-
text: combinedText
|
|
76
|
-
};
|
|
77
|
-
// Save each individual chunk for debugging
|
|
78
|
-
await storage.writeFile(path.join(interimPath, `${baseDebugFilename}.transcription.combined.json`), stringifyJSON({
|
|
79
|
-
chunks: transcriptions,
|
|
80
|
-
combined: transcription
|
|
81
|
-
}), 'utf8');
|
|
82
|
-
// Clean up temporary files if not in debug mode
|
|
83
|
-
if (!config.debug) {
|
|
84
|
-
for (const chunk of audioChunks){
|
|
85
|
-
try {
|
|
86
|
-
await storage.deleteFile(chunk);
|
|
87
|
-
} catch (error) {
|
|
88
|
-
logger.warn(`Failed to delete temporary chunk ${chunk}: ${error}`);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
} catch (error) {
|
|
93
|
-
logger.error(`Error processing split audio files: ${error}`);
|
|
94
|
-
throw new Error(`Failed to process split audio files: ${error}`);
|
|
95
|
-
}
|
|
96
|
-
} else {
|
|
97
|
-
// If file size is within the limit, transcribe normally
|
|
98
|
-
transcription = await transcribeAudio(audioFile, {
|
|
99
|
-
model: config.transcriptionModel,
|
|
100
|
-
debug: config.debug,
|
|
101
|
-
debugFile: transcriptionDebugFile
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
// Save the transcription
|
|
105
|
-
await storage.writeFile(transcriptOutputPath, stringifyJSON(transcription), 'utf8');
|
|
106
|
-
logger.debug('Wrote transcription to %s', transcriptOutputPath);
|
|
107
|
-
// Create markdown version of the transcript
|
|
108
|
-
const markdownOutputFilename = transcriptOutputFilename.replace('.json', '.md');
|
|
109
|
-
const markdownOutputPath = path.join(outputPath, markdownOutputFilename);
|
|
110
|
-
// Only create the markdown file if it doesn't already exist
|
|
111
|
-
if (!await storage.exists(markdownOutputPath)) {
|
|
112
|
-
logger.info('Creating Markdown version of the transcription...');
|
|
113
|
-
// Create a prompt for the transcription formatting task
|
|
114
|
-
const prompt = await prompts.createTranscribePrompt(transcription.text);
|
|
115
|
-
// Format the prompt using the override utility
|
|
116
|
-
const formatter = Formatter.create();
|
|
117
|
-
const chatRequest = formatter.formatPrompt(config.model, prompt);
|
|
118
|
-
// Debug file paths for the request and response
|
|
119
|
-
const requestDebugFile = config.debug ? path.join(interimPath, `${baseDebugFilename}.markdown.request.json`) : undefined;
|
|
120
|
-
const responseDebugFile = config.debug ? path.join(interimPath, `${baseDebugFilename}.markdown.response.json`) : undefined;
|
|
121
|
-
// Write debug file for the request if in debug mode
|
|
122
|
-
if (config.debug && requestDebugFile) {
|
|
123
|
-
await storage.writeFile(requestDebugFile, stringifyJSON(chatRequest), 'utf8');
|
|
124
|
-
logger.debug('Wrote chat request to %s', requestDebugFile);
|
|
125
|
-
}
|
|
126
|
-
// Call the model to convert the transcription to markdown
|
|
127
|
-
const markdownContent = await createCompletion(chatRequest.messages, {
|
|
128
|
-
model: config.model,
|
|
129
|
-
debug: config.debug,
|
|
130
|
-
debugFile: responseDebugFile
|
|
131
|
-
});
|
|
132
|
-
// Save the markdown version
|
|
133
|
-
await storage.writeFile(markdownOutputPath, markdownContent, 'utf8');
|
|
134
|
-
logger.debug('Wrote markdown transcription to %s', markdownOutputPath);
|
|
135
|
-
} else {
|
|
136
|
-
logger.info('Markdown transcription file %s already exists, skipping...', markdownOutputPath);
|
|
137
|
-
}
|
|
138
|
-
return {
|
|
139
|
-
...transcription,
|
|
140
|
-
audioFileBasename
|
|
141
|
-
};
|
|
142
|
-
};
|
|
143
|
-
return {
|
|
144
|
-
transcribe
|
|
145
|
-
};
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
export { create };
|
|
149
|
-
//# sourceMappingURL=transcribe.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transcribe.js","sources":["../../src/phases/transcribe.ts"],"sourcesContent":["import * as Dreadcabinet from '@theunwalked/dreadcabinet';\nimport { Config } from '@/protokoll';\nimport * as Logging from '@/logging';\nimport * as Storage from '@/util/storage';\nimport * as Media from '@/util/media';\nimport * as OpenAI from '@/util/openai';\nimport { stringifyJSON } from '@/util/general';\nimport path from 'path';\nimport { ChatCompletionMessageParam } from 'openai/resources';\nimport { Chat, Formatter } from '@riotprompt/riotprompt';\nimport * as TranscribePrompt from '@/prompt/transcribe';\n\nexport interface Transcription {\n text: string;\n audioFileBasename: string;\n}\n\nexport interface Instance {\n transcribe: (creation: Date, outputPath: string, contextPath: string, interimPath: string, filename: string, hash: string, audioFile: string) => Promise<Transcription>;\n}\n\nexport const create = (config: Config, operator: Dreadcabinet.Operator): Instance => {\n const logger = Logging.getLogger();\n const storage = Storage.create({ log: logger.debug });\n const media = Media.create(logger);\n const prompts = TranscribePrompt.create(config.model as Chat.Model, config);\n\n const transcribe = async (creation: Date, outputPath: string, contextPath: string, interimPath: string, filename: string, hash: string, audioFile: string): Promise<Transcription> => {\n if (!outputPath) {\n throw new Error(\"outputPath is required for transcribe function\");\n }\n\n if (!audioFile) {\n throw new Error(\"audioFile is required for transcribe function\");\n }\n\n // Remove extension from audioFile and make the name filesafe\n const audioFileBasename = path.basename(audioFile, path.extname(audioFile))\n .replace(/[^a-zA-Z0-9_-]/g, '_') // Replace non-alphanumeric chars with underscore\n .replace(/_+/g, '_') // Replace multiple underscores with a single one\n .trim();\n\n logger.debug(`Processed audio filename: ${audioFileBasename}`);\n\n let transcriptOutputFilename = await operator.constructFilename(creation, 'transcript', hash, { subject: audioFileBasename });\n // Ensure the filename ends with .json\n if (!transcriptOutputFilename.endsWith('.json')) {\n logger.warn('constructFilename did not return a .json file for transcript, appending extension: %s', transcriptOutputFilename);\n transcriptOutputFilename += '.json';\n }\n\n const transcriptOutputPath = path.join(interimPath, transcriptOutputFilename);\n\n // Check if transcription already exists\n if (await storage.exists(transcriptOutputPath)) {\n logger.info('Transcription file %s already exists, returning existing content...', transcriptOutputPath);\n const existingContent = await storage.readFile(transcriptOutputPath, 'utf8');\n return JSON.parse(existingContent);\n }\n\n const baseDebugFilename = path.parse(transcriptOutputFilename).name;\n const transcriptionDebugFile = config.debug ? path.join(interimPath, `${baseDebugFilename}.transcription.raw.response.json`) : undefined;\n\n // Check if audio file exceeds the size limit\n const fileSize = await media.getFileSize(audioFile);\n logger.debug(`Audio file size: ${fileSize} bytes, max size: ${config.maxAudioSize} bytes`);\n\n let transcription: OpenAI.Transcription;\n\n if (fileSize > config.maxAudioSize) {\n logger.info(`Audio file exceeds maximum size (${fileSize} > ${config.maxAudioSize} bytes), splitting into chunks`);\n\n // Create a temporary directory for the audio chunks\n const tempDir = path.join(config.tempDirectory, `split_audio_${hash}`);\n await storage.createDirectory(tempDir);\n\n try {\n // Split the audio file into chunks\n const audioChunks = await media.splitAudioFile(audioFile, tempDir, config.maxAudioSize);\n logger.info(`Split audio file into ${audioChunks.length} chunks`);\n\n // Transcribe each chunk\n const transcriptions: OpenAI.Transcription[] = [];\n for (let i = 0; i < audioChunks.length; i++) {\n const chunkPath = audioChunks[i];\n logger.info(`Transcribing chunk ${i + 1}/${audioChunks.length}: ${chunkPath}`);\n\n const chunkDebugFile = config.debug ?\n path.join(interimPath, `${baseDebugFilename}.transcription.chunk${i + 1}.raw.response.json`) :\n undefined;\n\n const chunkTranscription = await OpenAI.transcribeAudio(chunkPath, {\n model: config.transcriptionModel,\n debug: config.debug,\n debugFile: chunkDebugFile\n });\n\n transcriptions.push(chunkTranscription);\n }\n\n // Combine all transcriptions\n const combinedText = transcriptions.map(t => t.text).join(' ');\n transcription = { text: combinedText };\n\n // Save each individual chunk for debugging\n await storage.writeFile(\n path.join(interimPath, `${baseDebugFilename}.transcription.combined.json`),\n stringifyJSON({ chunks: transcriptions, combined: transcription }),\n 'utf8'\n );\n\n // Clean up temporary files if not in debug mode\n if (!config.debug) {\n for (const chunk of audioChunks) {\n try {\n await storage.deleteFile(chunk);\n } catch (error) {\n logger.warn(`Failed to delete temporary chunk ${chunk}: ${error}`);\n }\n }\n }\n } catch (error) {\n logger.error(`Error processing split audio files: ${error}`);\n throw new Error(`Failed to process split audio files: ${error}`);\n }\n } else {\n // If file size is within the limit, transcribe normally\n transcription = await OpenAI.transcribeAudio(audioFile, {\n model: config.transcriptionModel,\n debug: config.debug,\n debugFile: transcriptionDebugFile\n });\n }\n\n // Save the transcription\n await storage.writeFile(transcriptOutputPath, stringifyJSON(transcription), 'utf8');\n logger.debug('Wrote transcription to %s', transcriptOutputPath);\n\n // Create markdown version of the transcript\n const markdownOutputFilename = transcriptOutputFilename.replace('.json', '.md');\n const markdownOutputPath = path.join(outputPath, markdownOutputFilename);\n\n // Only create the markdown file if it doesn't already exist\n if (!await storage.exists(markdownOutputPath)) {\n logger.info('Creating Markdown version of the transcription...');\n\n // Create a prompt for the transcription formatting task\n const prompt = await prompts.createTranscribePrompt(transcription.text);\n\n // Format the prompt using the override utility\n const formatter = Formatter.create();\n const chatRequest: Chat.Request = formatter.formatPrompt(config.model as Chat.Model, prompt);\n\n // Debug file paths for the request and response\n const requestDebugFile = config.debug ?\n path.join(interimPath, `${baseDebugFilename}.markdown.request.json`) :\n undefined;\n\n const responseDebugFile = config.debug ?\n path.join(interimPath, `${baseDebugFilename}.markdown.response.json`) :\n undefined;\n\n // Write debug file for the request if in debug mode\n if (config.debug && requestDebugFile) {\n await storage.writeFile(requestDebugFile, stringifyJSON(chatRequest), 'utf8');\n logger.debug('Wrote chat request to %s', requestDebugFile);\n }\n\n // Call the model to convert the transcription to markdown\n const markdownContent = await OpenAI.createCompletion(\n chatRequest.messages as ChatCompletionMessageParam[],\n {\n model: config.model,\n debug: config.debug,\n debugFile: responseDebugFile\n }\n );\n\n // Save the markdown version\n await storage.writeFile(markdownOutputPath, markdownContent, 'utf8');\n logger.debug('Wrote markdown transcription to %s', markdownOutputPath);\n } else {\n logger.info('Markdown transcription file %s already exists, skipping...', markdownOutputPath);\n }\n\n return {\n ...transcription,\n audioFileBasename,\n };\n }\n\n return {\n transcribe,\n }\n} "],"names":["create","config","operator","logger","Logging","storage","Storage","log","debug","media","Media","prompts","TranscribePrompt","model","transcribe","creation","outputPath","contextPath","interimPath","filename","hash","audioFile","Error","audioFileBasename","path","basename","extname","replace","trim","transcriptOutputFilename","constructFilename","subject","endsWith","warn","transcriptOutputPath","join","exists","info","existingContent","readFile","JSON","parse","baseDebugFilename","name","transcriptionDebugFile","undefined","fileSize","getFileSize","maxAudioSize","transcription","tempDir","tempDirectory","createDirectory","audioChunks","splitAudioFile","length","transcriptions","i","chunkPath","chunkDebugFile","chunkTranscription","OpenAI","transcriptionModel","debugFile","push","combinedText","map","t","text","writeFile","stringifyJSON","chunks","combined","chunk","deleteFile","error","markdownOutputFilename","markdownOutputPath","prompt","createTranscribePrompt","formatter","Formatter","chatRequest","formatPrompt","requestDebugFile","responseDebugFile","markdownContent","messages"],"mappings":";;;;;;;;;AAqBO,MAAMA,MAAAA,GAAS,CAACC,MAAAA,EAAgBC,QAAAA,GAAAA;IACnC,MAAMC,MAAAA,GAASC,SAAiB,EAAA;IAChC,MAAMC,OAAAA,GAAUC,QAAc,CAAC;AAAEC,QAAAA,GAAAA,EAAKJ,OAAOK;AAAM,KAAA,CAAA;IACnD,MAAMC,KAAAA,GAAQC,Q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B,CACjDqB,WAAAA,CAAYK,QAAQ,EACpB;AACI1E,gBAAAA,KAAAA,EAAOZ,OAAOY,KAAK;AACnBL,gBAAAA,KAAAA,EAAOP,OAAOO,KAAK;gBACnBuD,SAAAA,EAAWsB;AACf,aAAA,CAAA;;AAIJ,YAAA,MAAMhF,OAAAA,CAAQgE,SAAS,CAACQ,kBAAAA,EAAoBS,eAAAA,EAAiB,MAAA,CAAA;YAC7DnF,MAAAA,CAAOK,KAAK,CAAC,oCAAA,EAAsCqE,kBAAAA,CAAAA;QACvD,CAAA,MAAO;YACH1E,MAAAA,CAAOkC,IAAI,CAAC,4DAAA,EAA8DwC,kBAAAA,CAAAA;AAC9E,QAAA;QAEA,OAAO;AACH,YAAA,GAAG5B,aAAa;AAChB1B,YAAAA;AACJ,SAAA;AACJ,IAAA,CAAA;IAEA,OAAO;AACHT,QAAAA;AACJ,KAAA;AACJ;;;;"}
|
package/dist/processor.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { getLogger } from './logging.js';
|
|
2
|
-
import { create as create$1 } from './phases/transcribe.js';
|
|
3
|
-
import { create as create$2 } from './phases/locate.js';
|
|
4
|
-
|
|
5
|
-
const create = (config, operator)=>{
|
|
6
|
-
const logger = getLogger();
|
|
7
|
-
const transcribePhase = create$1(config, operator);
|
|
8
|
-
const locatePhase = create$2(config, operator);
|
|
9
|
-
const process = async (audioFile)=>{
|
|
10
|
-
logger.verbose('Processing file %s', audioFile);
|
|
11
|
-
// Locate the contents in time and on the filesystem
|
|
12
|
-
logger.debug('Locating file %s', audioFile);
|
|
13
|
-
const { creationTime, outputPath, contextPath, interimPath, transcriptionFilename, hash } = await locatePhase.locate(audioFile);
|
|
14
|
-
logger.debug('Locate complete: %s', JSON.stringify({
|
|
15
|
-
creationTime,
|
|
16
|
-
outputPath,
|
|
17
|
-
contextPath,
|
|
18
|
-
interimPath,
|
|
19
|
-
transcriptionFilename,
|
|
20
|
-
hash
|
|
21
|
-
}));
|
|
22
|
-
// Transcribe the audio
|
|
23
|
-
logger.debug('Transcribing file %s', audioFile);
|
|
24
|
-
await transcribePhase.transcribe(creationTime, outputPath, contextPath, interimPath, transcriptionFilename, hash, audioFile);
|
|
25
|
-
logger.info('Transcription complete for file %s', audioFile);
|
|
26
|
-
logger.info('Transcription saved to: %s', transcriptionFilename);
|
|
27
|
-
return;
|
|
28
|
-
};
|
|
29
|
-
return {
|
|
30
|
-
process
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export { create };
|
|
35
|
-
//# sourceMappingURL=processor.js.map
|
package/dist/processor.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"processor.js","sources":["../src/processor.ts"],"sourcesContent":["import * as Logging from '@/logging';\nimport * as TranscribePhase from '@/phases/transcribe';\nimport * as LocatePhase from '@/phases/locate';\nimport * as Dreadcabinet from '@theunwalked/dreadcabinet';\nimport { Config } from '@/protokoll';\n\nexport interface Transcription {\n text: string;\n audioFileBasename: string;\n}\n\nexport interface Instance {\n process(file: string): Promise<void>;\n}\n\nexport const create = (config: Config, operator: Dreadcabinet.Operator): Instance => {\n const logger = Logging.getLogger();\n\n const transcribePhase: TranscribePhase.Instance = TranscribePhase.create(config, operator);\n const locatePhase: LocatePhase.Instance = LocatePhase.create(config, operator);\n\n const process = async (audioFile: string) => {\n logger.verbose('Processing file %s', audioFile);\n\n // Locate the contents in time and on the filesystem\n logger.debug('Locating file %s', audioFile);\n const { creationTime, outputPath, contextPath, interimPath, transcriptionFilename, hash } = await locatePhase.locate(audioFile);\n logger.debug('Locate complete: %s', JSON.stringify({ creationTime, outputPath, contextPath, interimPath, transcriptionFilename, hash }));\n\n // Transcribe the audio\n logger.debug('Transcribing file %s', audioFile);\n await transcribePhase.transcribe(creationTime, outputPath, contextPath, interimPath, transcriptionFilename, hash, audioFile);\n\n logger.info('Transcription complete for file %s', audioFile);\n logger.info('Transcription saved to: %s', transcriptionFilename);\n return;\n }\n\n return {\n process,\n }\n}\n\n\n"],"names":["create","config","operator","logger","Logging","transcribePhase","TranscribePhase","locatePhase","LocatePhase","process","audioFile","verbose","debug","creationTime","outputPath","contextPath","interimPath","transcriptionFilename","hash","locate","JSON","stringify","transcribe","info"],"mappings":";;;;AAeO,MAAMA,MAAAA,GAAS,CAACC,MAAAA,EAAgBC,QAAAA,GAAAA;IACnC,MAAMC,MAAAA,GAASC,SAAiB,EAAA;AAEhC,IAAA,MAAMC,eAAAA,GAA4CC,QAAsB,CAACL,MAAAA,EAAQC,QAAAA,CAAAA;AACjF,IAAA,MAAMK,WAAAA,GAAoCC,QAAkB,CAACP,MAAAA,EAAQC,QAAAA,CAAAA;AAErE,IAAA,MAAMO,UAAU,OAAOC,SAAAA,GAAAA;QACnBP,MAAAA,CAAOQ,OAAO,CAAC,oBAAA,EAAsBD,SAAAA,CAAAA;;QAGrCP,MAAAA,CAAOS,KAAK,CAAC,kBAAA,EAAoBF,SAAAA,CAAAA;AACjC,QAAA,MAAM,EAAEG,YAAY,EAAEC,UAAU,EAAEC,WAAW,EAAEC,WAAW,EAAEC,qBAAqB,EAAEC,IAAI,EAAE,GAAG,MAAMX,WAAAA,CAAYY,MAAM,CAACT,SAAAA,CAAAA;AACrHP,QAAAA,MAAAA,CAAOS,KAAK,CAAC,qBAAA,EAAuBQ,IAAAA,CAAKC,SAAS,CAAC;AAAER,YAAAA,YAAAA;AAAcC,YAAAA,UAAAA;AAAYC,YAAAA,WAAAA;AAAaC,YAAAA,WAAAA;AAAaC,YAAAA,qBAAAA;AAAuBC,YAAAA;AAAK,SAAA,CAAA,CAAA;;QAGrIf,MAAAA,CAAOS,KAAK,CAAC,sBAAA,EAAwBF,SAAAA,CAAAA;QACrC,MAAML,eAAAA,CAAgBiB,UAAU,CAACT,YAAAA,EAAcC,YAAYC,WAAAA,EAAaC,WAAAA,EAAaC,uBAAuBC,IAAAA,EAAMR,SAAAA,CAAAA;QAElHP,MAAAA,CAAOoB,IAAI,CAAC,oCAAA,EAAsCb,SAAAA,CAAAA;QAClDP,MAAAA,CAAOoB,IAAI,CAAC,4BAAA,EAA8BN,qBAAAA,CAAAA;AAC1C,QAAA;AACJ,IAAA,CAAA;IAEA,OAAO;AACHR,QAAAA;AACJ,KAAA;AACJ;;;;"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { Builder } from '@riotprompt/riotprompt';
|
|
2
|
-
import { DEFAULT_PERSONA_TRANSCRIBER_FILE, DEFAULT_INSTRUCTIONS_TRANSCRIBE_FILE } from '../constants.js';
|
|
3
|
-
import { fileURLToPath } from 'url';
|
|
4
|
-
import path from 'path';
|
|
5
|
-
import { getLogger } from '../logging.js';
|
|
6
|
-
|
|
7
|
-
const __filename$1 = fileURLToPath(import.meta.url);
|
|
8
|
-
const __dirname$1 = path.dirname(__filename$1);
|
|
9
|
-
/**
|
|
10
|
-
* Creates a prompt for the transcription formatting task
|
|
11
|
-
*/ const createTranscribePrompt = async (transcriptionText, config)=>{
|
|
12
|
-
const logger = getLogger();
|
|
13
|
-
let builder = Builder.create({
|
|
14
|
-
logger,
|
|
15
|
-
basePath: __dirname$1,
|
|
16
|
-
overridePaths: [
|
|
17
|
-
config.configDirectory
|
|
18
|
-
],
|
|
19
|
-
overrides: config.overrides
|
|
20
|
-
});
|
|
21
|
-
builder = await builder.addPersonaPath(DEFAULT_PERSONA_TRANSCRIBER_FILE);
|
|
22
|
-
builder = await builder.addInstructionPath(DEFAULT_INSTRUCTIONS_TRANSCRIBE_FILE);
|
|
23
|
-
builder = await builder.addContent(transcriptionText);
|
|
24
|
-
if (config.contextDirectories) {
|
|
25
|
-
builder = await builder.loadContext(config.contextDirectories);
|
|
26
|
-
}
|
|
27
|
-
const prompt = await builder.build();
|
|
28
|
-
return prompt;
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* Create a factory for transcribe prompts
|
|
32
|
-
*/ const create = (model, config)=>{
|
|
33
|
-
return {
|
|
34
|
-
createTranscribePrompt: async (transcriptionText)=>{
|
|
35
|
-
return createTranscribePrompt(transcriptionText, config);
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export { create, createTranscribePrompt };
|
|
41
|
-
//# sourceMappingURL=transcribe.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transcribe.js","sources":["../../src/prompt/transcribe.ts"],"sourcesContent":["import { Builder, Chat, Prompt } from \"@riotprompt/riotprompt\";\nimport { DEFAULT_INSTRUCTIONS_TRANSCRIBE_FILE, DEFAULT_PERSONA_TRANSCRIBER_FILE } from '@/constants';\nimport { Config } from '@/protokoll';\nimport { fileURLToPath } from \"url\";\nimport path from \"path\";\nimport { getLogger } from \"@/logging\";\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = path.dirname(__filename);\n\n/**\n * Creates a prompt for the transcription formatting task\n */\nexport const createTranscribePrompt = async (\n transcriptionText: string,\n config: Config\n): Promise<Prompt> => {\n const logger = getLogger();\n let builder: Builder.Instance = Builder.create({ logger, basePath: __dirname, overridePaths: [config.configDirectory], overrides: config.overrides });\n builder = await builder.addPersonaPath(DEFAULT_PERSONA_TRANSCRIBER_FILE);\n builder = await builder.addInstructionPath(DEFAULT_INSTRUCTIONS_TRANSCRIBE_FILE);\n builder = await builder.addContent(transcriptionText);\n if (config.contextDirectories) {\n builder = await builder.loadContext(config.contextDirectories);\n }\n\n const prompt = await builder.build();\n return prompt;\n};\n\n/**\n * Factory interface for transcribe prompts\n */\nexport interface Factory {\n createTranscribePrompt: (transcriptionText: string) => Promise<Prompt>;\n}\n\n/**\n * Create a factory for transcribe prompts\n */\nexport const create = (model: Chat.Model, config: Config): Factory => {\n return {\n createTranscribePrompt: async (transcriptionText: string): Promise<Prompt> => {\n return createTranscribePrompt(transcriptionText, config);\n }\n };\n}; "],"names":["__filename","fileURLToPath","url","__dirname","path","dirname","createTranscribePrompt","transcriptionText","config","logger","getLogger","builder","Builder","create","basePath","overridePaths","configDirectory","overrides","addPersonaPath","DEFAULT_PERSONA_TRANSCRIBER_FILE","addInstructionPath","DEFAULT_INSTRUCTIONS_TRANSCRIBE_FILE","addContent","contextDirectories","loadContext","prompt","build","model"],"mappings":";;;;;;AAOA,MAAMA,YAAAA,GAAaC,aAAAA,CAAc,MAAA,CAAA,IAAA,CAAYC,GAAG,CAAA;AAChD,MAAMC,WAAAA,GAAYC,IAAAA,CAAKC,OAAO,CAACL,YAAAA,CAAAA;AAE/B;;AAEC,IACM,MAAMM,sBAAAA,GAAyB,OAClCC,iBAAAA,EACAC,MAAAA,GAAAA;AAEA,IAAA,MAAMC,MAAAA,GAASC,SAAAA,EAAAA;IACf,IAAIC,OAAAA,GAA4BC,OAAAA,CAAQC,MAAM,CAAC;AAAEJ,QAAAA,MAAAA;QAAQK,QAAAA,EAAUX,WAAAA;QAAWY,aAAAA,EAAe;AAACP,YAAAA,MAAAA,CAAOQ;AAAgB,SAAA;AAAEC,QAAAA,SAAAA,EAAWT,OAAOS;AAAU,KAAA,CAAA;IACnJN,OAAAA,GAAU,MAAMA,OAAAA,CAAQO,cAAc,CAACC,gCAAAA,CAAAA;IACvCR,OAAAA,GAAU,MAAMA,OAAAA,CAAQS,kBAAkB,CAACC,oCAAAA,CAAAA;IAC3CV,OAAAA,GAAU,MAAMA,OAAAA,CAAQW,UAAU,CAACf,iBAAAA,CAAAA;IACnC,IAAIC,MAAAA,CAAOe,kBAAkB,EAAE;AAC3BZ,QAAAA,OAAAA,GAAU,MAAMA,OAAAA,CAAQa,WAAW,CAAChB,OAAOe,kBAAkB,CAAA;AACjE,IAAA;IAEA,MAAME,MAAAA,GAAS,MAAMd,OAAAA,CAAQe,KAAK,EAAA;IAClC,OAAOD,MAAAA;AACX;AASA;;AAEC,IACM,MAAMZ,MAAAA,GAAS,CAACc,KAAAA,EAAmBnB,MAAAA,GAAAA;IACtC,OAAO;AACHF,QAAAA,sBAAAA,EAAwB,OAAOC,iBAAAA,GAAAA;AAC3B,YAAA,OAAOD,uBAAuBC,iBAAAA,EAAmBC,MAAAA,CAAAA;AACrD,QAAA;AACJ,KAAA;AACJ;;;;"}
|
package/dist/util/general.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
// Utility function for deep merging two objects.
|
|
2
|
-
//Recursive implementation of jSON.stringify;
|
|
3
|
-
const stringifyJSON = function(obj) {
|
|
4
|
-
const arrOfKeyVals = [];
|
|
5
|
-
const arrVals = [];
|
|
6
|
-
let objKeys = [];
|
|
7
|
-
/*********CHECK FOR PRIMITIVE TYPES**********/ if (typeof obj === 'number' || typeof obj === 'boolean' || obj === null) return '' + obj;
|
|
8
|
-
else if (typeof obj === 'string') return '"' + obj + '"';
|
|
9
|
-
else if (Array.isArray(obj)) {
|
|
10
|
-
//check for empty array
|
|
11
|
-
if (obj[0] === undefined) return '[]';
|
|
12
|
-
else {
|
|
13
|
-
obj.forEach(function(el) {
|
|
14
|
-
arrVals.push(stringifyJSON(el));
|
|
15
|
-
});
|
|
16
|
-
return '[' + arrVals + ']';
|
|
17
|
-
}
|
|
18
|
-
} else if (obj instanceof Object) {
|
|
19
|
-
//get object keys
|
|
20
|
-
objKeys = Object.keys(obj);
|
|
21
|
-
//set key output;
|
|
22
|
-
objKeys.forEach(function(key) {
|
|
23
|
-
const keyOut = '"' + key + '":';
|
|
24
|
-
const keyValOut = obj[key];
|
|
25
|
-
//skip functions and undefined properties
|
|
26
|
-
if (keyValOut instanceof Function || keyValOut === undefined) arrOfKeyVals.push('');
|
|
27
|
-
else if (typeof keyValOut === 'string') arrOfKeyVals.push(keyOut + '"' + keyValOut + '"');
|
|
28
|
-
else if (typeof keyValOut === 'boolean' || typeof keyValOut === 'number' || keyValOut === null) arrOfKeyVals.push(keyOut + keyValOut);
|
|
29
|
-
else if (keyValOut instanceof Object) {
|
|
30
|
-
arrOfKeyVals.push(keyOut + stringifyJSON(keyValOut));
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
return '{' + arrOfKeyVals + '}';
|
|
34
|
-
}
|
|
35
|
-
return '';
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export { stringifyJSON };
|
|
39
|
-
//# sourceMappingURL=general.js.map
|
package/dist/util/general.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"general.js","sources":["../../src/util/general.ts"],"sourcesContent":["// Utility function for deep merging two objects.\nexport function deepMerge(target: any, source: any): any {\n for (const key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n // Block prototype-polluting keys\n if (key === '__proto__' || key === 'constructor') {\n continue;\n }\n if (source[key] && typeof source[key] === 'object' && !Array.isArray(source[key])) {\n if (!target[key]) {\n target[key] = {};\n }\n deepMerge(target[key], source[key]);\n } else {\n target[key] = source[key];\n }\n }\n }\n return target;\n}\n\n//Recursive implementation of jSON.stringify;\nexport const stringifyJSON = function (obj: any): string {\n\n const arrOfKeyVals: string[] = [];\n const arrVals: string[] = [];\n let objKeys: string[] = [];\n\n /*********CHECK FOR PRIMITIVE TYPES**********/\n if (typeof obj === 'number' || typeof obj === 'boolean' || obj === null)\n return '' + obj;\n else if (typeof obj === 'string')\n return '\"' + obj + '\"';\n\n /*********CHECK FOR ARRAY**********/\n else if (Array.isArray(obj)) {\n //check for empty array\n if (obj[0] === undefined)\n return '[]';\n else {\n obj.forEach(function (el) {\n arrVals.push(stringifyJSON(el));\n });\n return '[' + arrVals + ']';\n }\n }\n /*********CHECK FOR OBJECT**********/\n else if (obj instanceof Object) {\n //get object keys\n objKeys = Object.keys(obj);\n //set key output;\n objKeys.forEach(function (key) {\n const keyOut = '\"' + key + '\":';\n const keyValOut = obj[key];\n //skip functions and undefined properties\n if (keyValOut instanceof Function || keyValOut === undefined)\n arrOfKeyVals.push('');\n else if (typeof keyValOut === 'string')\n arrOfKeyVals.push(keyOut + '\"' + keyValOut + '\"');\n else if (typeof keyValOut === 'boolean' || typeof keyValOut === 'number' || keyValOut === null)\n arrOfKeyVals.push(keyOut + keyValOut);\n //check for nested objects, call recursively until no more objects\n else if (keyValOut instanceof Object) {\n arrOfKeyVals.push(keyOut + stringifyJSON(keyValOut));\n }\n });\n return '{' + arrOfKeyVals + '}';\n }\n return '';\n};"],"names":["stringifyJSON","obj","arrOfKeyVals","arrVals","objKeys","Array","isArray","undefined","forEach","el","push","Object","keys","key","keyOut","keyValOut","Function"],"mappings":"AAAA;AAqBA;AACO,MAAMA,aAAAA,GAAgB,SAAUC,GAAQ,EAAA;AAE3C,IAAA,MAAMC,eAAyB,EAAE;AACjC,IAAA,MAAMC,UAAoB,EAAE;AAC5B,IAAA,IAAIC,UAAoB,EAAE;mDAG1B,IAAI,OAAOH,GAAAA,KAAQ,QAAA,IAAY,OAAOA,GAAAA,KAAQ,SAAA,IAAaA,GAAAA,KAAQ,IAAA,EAC/D,OAAO,EAAA,GAAKA,GAAAA;AACX,SAAA,IAAI,OAAOA,GAAAA,KAAQ,QAAA,EACpB,OAAO,MAAMA,GAAAA,GAAM,GAAA;SAGlB,IAAII,KAAAA,CAAMC,OAAO,CAACL,GAAAA,CAAAA,EAAM;;AAEzB,QAAA,IAAIA,GAAG,CAAC,CAAA,CAAE,KAAKM,WACX,OAAO,IAAA;AACN,aAAA;YACDN,GAAAA,CAAIO,OAAO,CAAC,SAAUC,EAAE,EAAA;gBACpBN,OAAAA,CAAQO,IAAI,CAACV,aAAAA,CAAcS,EAAAA,CAAAA,CAAAA;AAC/B,YAAA,CAAA,CAAA;AACA,YAAA,OAAO,MAAMN,OAAAA,GAAU,GAAA;AAC3B,QAAA;IACJ,CAAA,MAEK,IAAIF,eAAeU,MAAAA,EAAQ;;QAE5BP,OAAAA,GAAUO,MAAAA,CAAOC,IAAI,CAACX,GAAAA,CAAAA;;QAEtBG,OAAAA,CAAQI,OAAO,CAAC,SAAUK,GAAG,EAAA;YACzB,MAAMC,MAAAA,GAAS,MAAMD,GAAAA,GAAM,IAAA;YAC3B,MAAME,SAAAA,GAAYd,GAAG,CAACY,GAAAA,CAAI;;AAE1B,YAAA,IAAIE,qBAAqBC,QAAAA,IAAYD,SAAAA,KAAcR,SAAAA,EAC/CL,YAAAA,CAAaQ,IAAI,CAAC,EAAA,CAAA;iBACjB,IAAI,OAAOK,cAAc,QAAA,EAC1Bb,YAAAA,CAAaQ,IAAI,CAACI,MAAAA,GAAS,MAAMC,SAAAA,GAAY,GAAA,CAAA;iBAC5C,IAAI,OAAOA,SAAAA,KAAc,SAAA,IAAa,OAAOA,SAAAA,KAAc,QAAA,IAAYA,SAAAA,KAAc,IAAA,EACtFb,YAAAA,CAAaQ,IAAI,CAACI,MAAAA,GAASC,SAAAA,CAAAA;AAE1B,iBAAA,IAAIA,qBAAqBJ,MAAAA,EAAQ;gBAClCT,YAAAA,CAAaQ,IAAI,CAACI,MAAAA,GAASd,aAAAA,CAAce,SAAAA,CAAAA,CAAAA;AAC7C,YAAA;AACJ,QAAA,CAAA,CAAA;AACA,QAAA,OAAO,MAAMb,YAAAA,GAAe,GAAA;AAChC,IAAA;IACA,OAAO,EAAA;AACX;;;;"}
|
package/dist/util/openai.js
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { OpenAI } from 'openai';
|
|
2
|
-
import { create } from './storage.js';
|
|
3
|
-
import { getLogger } from '../logging.js';
|
|
4
|
-
|
|
5
|
-
class OpenAIError extends Error {
|
|
6
|
-
constructor(message){
|
|
7
|
-
super(message);
|
|
8
|
-
this.name = 'OpenAIError';
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
async function createCompletion(messages, options = {
|
|
12
|
-
model: "gpt-4o-mini"
|
|
13
|
-
}) {
|
|
14
|
-
const logger = getLogger();
|
|
15
|
-
const storage = create({
|
|
16
|
-
log: logger.debug
|
|
17
|
-
});
|
|
18
|
-
try {
|
|
19
|
-
var _completion_choices__message_content, _completion_choices__message, _completion_choices_;
|
|
20
|
-
const apiKey = process.env.OPENAI_API_KEY;
|
|
21
|
-
if (!apiKey) {
|
|
22
|
-
throw new OpenAIError('OPENAI_API_KEY environment variable is not set');
|
|
23
|
-
}
|
|
24
|
-
const openai = new OpenAI({
|
|
25
|
-
apiKey: apiKey
|
|
26
|
-
});
|
|
27
|
-
logger.debug('Sending prompt to OpenAI: %j', messages);
|
|
28
|
-
const completion = await openai.chat.completions.create({
|
|
29
|
-
model: options.model || "gpt-4o-mini",
|
|
30
|
-
messages,
|
|
31
|
-
max_completion_tokens: 10000,
|
|
32
|
-
response_format: options.responseFormat
|
|
33
|
-
});
|
|
34
|
-
if (options.debug && options.debugFile) {
|
|
35
|
-
await storage.writeFile(options.debugFile, JSON.stringify(completion, null, 2), 'utf8');
|
|
36
|
-
logger.debug('Wrote debug file to %s', options.debugFile);
|
|
37
|
-
}
|
|
38
|
-
const response = (_completion_choices_ = completion.choices[0]) === null || _completion_choices_ === void 0 ? void 0 : (_completion_choices__message = _completion_choices_.message) === null || _completion_choices__message === void 0 ? void 0 : (_completion_choices__message_content = _completion_choices__message.content) === null || _completion_choices__message_content === void 0 ? void 0 : _completion_choices__message_content.trim();
|
|
39
|
-
if (!response) {
|
|
40
|
-
throw new OpenAIError('No response received from OpenAI');
|
|
41
|
-
}
|
|
42
|
-
logger.debug('Received response from OpenAI: %s', response);
|
|
43
|
-
if (options.responseFormat) {
|
|
44
|
-
return JSON.parse(response);
|
|
45
|
-
} else {
|
|
46
|
-
return response;
|
|
47
|
-
}
|
|
48
|
-
} catch (error) {
|
|
49
|
-
logger.error('Error calling OpenAI API: %s %s', error.message, error.stack);
|
|
50
|
-
throw new OpenAIError(`Failed to create completion: ${error.message}`);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
async function transcribeAudio(filePath, options = {
|
|
54
|
-
model: "whisper-1"
|
|
55
|
-
}) {
|
|
56
|
-
const logger = getLogger();
|
|
57
|
-
const storage = create({
|
|
58
|
-
log: logger.debug
|
|
59
|
-
});
|
|
60
|
-
try {
|
|
61
|
-
const apiKey = process.env.OPENAI_API_KEY;
|
|
62
|
-
if (!apiKey) {
|
|
63
|
-
throw new OpenAIError('OPENAI_API_KEY environment variable is not set');
|
|
64
|
-
}
|
|
65
|
-
const openai = new OpenAI({
|
|
66
|
-
apiKey: apiKey
|
|
67
|
-
});
|
|
68
|
-
logger.debug('Transcribing audio file: %s', filePath);
|
|
69
|
-
const audioStream = await storage.readStream(filePath);
|
|
70
|
-
const transcription = await openai.audio.transcriptions.create({
|
|
71
|
-
model: options.model || "whisper-1",
|
|
72
|
-
file: audioStream,
|
|
73
|
-
response_format: "json"
|
|
74
|
-
});
|
|
75
|
-
if (options.debug && options.debugFile) {
|
|
76
|
-
await storage.writeFile(options.debugFile, JSON.stringify(transcription, null, 2), 'utf8');
|
|
77
|
-
logger.debug('Wrote debug file to %s', options.debugFile);
|
|
78
|
-
}
|
|
79
|
-
const response = transcription;
|
|
80
|
-
if (!response) {
|
|
81
|
-
throw new OpenAIError('No transcription received from OpenAI');
|
|
82
|
-
}
|
|
83
|
-
logger.debug('Received transcription from OpenAI: %s', response);
|
|
84
|
-
return response;
|
|
85
|
-
} catch (error) {
|
|
86
|
-
logger.error('Error transcribing audio file: %s %s', error.message, error.stack);
|
|
87
|
-
throw new OpenAIError(`Failed to transcribe audio: ${error.message}`);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export { OpenAIError, createCompletion, transcribeAudio };
|
|
92
|
-
//# sourceMappingURL=openai.js.map
|
package/dist/util/openai.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"openai.js","sources":["../../src/util/openai.ts"],"sourcesContent":["import { OpenAI } from 'openai';\nimport { ChatCompletionMessageParam } from 'openai/resources';\nimport * as Storage from '@/util/storage';\nimport { getLogger } from '@/logging';\nexport interface Transcription {\n text: string;\n}\n\nexport class OpenAIError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'OpenAIError';\n }\n}\n\n\nexport async function createCompletion(messages: ChatCompletionMessageParam[], options: { responseFormat?: any, model?: string, debug?: boolean, debugFile?: string } = { model: \"gpt-4o-mini\" }): Promise<string | any> {\n const logger = getLogger();\n const storage = Storage.create({ log: logger.debug });\n try {\n const apiKey = process.env.OPENAI_API_KEY;\n if (!apiKey) {\n throw new OpenAIError('OPENAI_API_KEY environment variable is not set');\n }\n\n const openai = new OpenAI({\n apiKey: apiKey,\n });\n\n logger.debug('Sending prompt to OpenAI: %j', messages);\n\n const completion = await openai.chat.completions.create({\n model: options.model || \"gpt-4o-mini\",\n messages,\n max_completion_tokens: 10000,\n response_format: options.responseFormat,\n });\n\n if (options.debug && options.debugFile) {\n await storage.writeFile(options.debugFile, JSON.stringify(completion, null, 2), 'utf8');\n logger.debug('Wrote debug file to %s', options.debugFile);\n }\n\n const response = completion.choices[0]?.message?.content?.trim();\n if (!response) {\n throw new OpenAIError('No response received from OpenAI');\n }\n\n logger.debug('Received response from OpenAI: %s', response);\n if (options.responseFormat) {\n return JSON.parse(response);\n } else {\n return response;\n }\n\n } catch (error: any) {\n logger.error('Error calling OpenAI API: %s %s', error.message, error.stack);\n throw new OpenAIError(`Failed to create completion: ${error.message}`);\n }\n}\n\nexport async function transcribeAudio(filePath: string, options: { model?: string, debug?: boolean, debugFile?: string } = { model: \"whisper-1\" }): Promise<Transcription> {\n const logger = getLogger();\n const storage = Storage.create({ log: logger.debug });\n try {\n const apiKey = process.env.OPENAI_API_KEY;\n if (!apiKey) {\n throw new OpenAIError('OPENAI_API_KEY environment variable is not set');\n }\n\n const openai = new OpenAI({\n apiKey: apiKey,\n });\n\n logger.debug('Transcribing audio file: %s', filePath);\n\n const audioStream = await storage.readStream(filePath);\n const transcription = await openai.audio.transcriptions.create({\n model: options.model || \"whisper-1\",\n file: audioStream,\n response_format: \"json\",\n });\n\n if (options.debug && options.debugFile) {\n await storage.writeFile(options.debugFile, JSON.stringify(transcription, null, 2), 'utf8');\n logger.debug('Wrote debug file to %s', options.debugFile);\n }\n\n const response = transcription;\n if (!response) {\n throw new OpenAIError('No transcription received from OpenAI');\n }\n\n logger.debug('Received transcription from OpenAI: %s', response);\n return response;\n\n } catch (error: any) {\n logger.error('Error transcribing audio file: %s %s', error.message, error.stack);\n throw new OpenAIError(`Failed to transcribe audio: ${error.message}`);\n }\n}\n"],"names":["OpenAIError","Error","message","name","createCompletion","messages","options","model","logger","getLogger","storage","Storage","log","debug","completion","apiKey","process","env","OPENAI_API_KEY","openai","OpenAI","chat","completions","create","max_completion_tokens","response_format","responseFormat","debugFile","writeFile","JSON","stringify","response","choices","content","trim","parse","error","stack","transcribeAudio","filePath","audioStream","readStream","transcription","audio","transcriptions","file"],"mappings":";;;;AAQO,MAAMA,WAAAA,SAAoBC,KAAAA,CAAAA;AAC7B,IAAA,WAAA,CAAYC,OAAe,CAAE;AACzB,QAAA,KAAK,CAACA,OAAAA,CAAAA;QACN,IAAI,CAACC,IAAI,GAAG,aAAA;AAChB,IAAA;AACJ;AAGO,eAAeC,gBAAAA,CAAiBC,QAAsC,EAAEC,OAAAA,GAAyF;IAAEC,KAAAA,EAAO;AAAc,CAAC,EAAA;AAC5L,IAAA,MAAMC,MAAAA,GAASC,SAAAA,EAAAA;IACf,MAAMC,OAAAA,GAAUC,MAAc,CAAC;AAAEC,QAAAA,GAAAA,EAAKJ,OAAOK;AAAM,KAAA,CAAA;IACnD,IAAI;AAwBiBC,QAAAA,IAAAA,oCAAAA,EAAAA,4BAAAA,EAAAA,oBAAAA;AAvBjB,QAAA,MAAMC,MAAAA,GAASC,OAAAA,CAAQC,GAAG,CAACC,cAAc;AACzC,QAAA,IAAI,CAACH,MAAAA,EAAQ;AACT,YAAA,MAAM,IAAIf,WAAAA,CAAY,gDAAA,CAAA;AAC1B,QAAA;QAEA,MAAMmB,MAAAA,GAAS,IAAIC,MAAAA,CAAO;YACtBL,MAAAA,EAAQA;AACZ,SAAA,CAAA;QAEAP,MAAAA,CAAOK,KAAK,CAAC,8BAAA,EAAgCR,QAAAA,CAAAA;QAE7C,MAAMS,UAAAA,GAAa,MAAMK,MAAAA,CAAOE,IAAI,CAACC,WAAW,CAACC,MAAM,CAAC;YACpDhB,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