@vibesdotdev/integrations-whisper 0.0.0-stage → 1.0.0-rc.4
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/LICENSE +126 -0
- package/README.md +10 -2
- package/dist/ai/index.d.ts +5 -0
- package/dist/ai/index.d.ts.map +1 -0
- package/dist/ai/index.js +5 -0
- package/dist/ai/index.js.map +1 -0
- package/dist/ai/provider.plugin.d.ts +6 -0
- package/dist/ai/provider.plugin.d.ts.map +1 -0
- package/dist/ai/provider.plugin.js +111 -0
- package/dist/ai/provider.plugin.js.map +1 -0
- package/dist/ai/providers/cloud/speech/whisper/config/config.whisper.descriptor.d.ts +4206 -0
- package/dist/ai/providers/cloud/speech/whisper/config/config.whisper.descriptor.d.ts.map +1 -0
- package/dist/ai/providers/cloud/speech/whisper/config/config.whisper.descriptor.js +54 -0
- package/dist/ai/providers/cloud/speech/whisper/config/config.whisper.descriptor.js.map +1 -0
- package/dist/ai/providers/cloud/speech/whisper/config/schemas/index.d.ts +12 -0
- package/dist/ai/providers/cloud/speech/whisper/config/schemas/index.d.ts.map +1 -0
- package/dist/ai/providers/cloud/speech/whisper/config/schemas/index.js +10 -0
- package/dist/ai/providers/cloud/speech/whisper/config/schemas/index.js.map +1 -0
- package/dist/ai/providers/cloud/speech/whisper/index.d.ts +5 -0
- package/dist/ai/providers/cloud/speech/whisper/index.d.ts.map +1 -0
- package/dist/ai/providers/cloud/speech/whisper/index.js +4 -0
- package/dist/ai/providers/cloud/speech/whisper/index.js.map +1 -0
- package/dist/ai/providers/cloud/speech/whisper/provider.whisper.descriptor.d.ts +183 -0
- package/dist/ai/providers/cloud/speech/whisper/provider.whisper.descriptor.d.ts.map +1 -0
- package/dist/ai/providers/cloud/speech/whisper/provider.whisper.descriptor.js +47 -0
- package/dist/ai/providers/cloud/speech/whisper/provider.whisper.descriptor.js.map +1 -0
- package/dist/ai/providers/whisper/detection/system.d.ts +17 -0
- package/dist/ai/providers/whisper/detection/system.d.ts.map +1 -0
- package/dist/ai/providers/whisper/detection/system.js +35 -0
- package/dist/ai/providers/whisper/detection/system.js.map +1 -0
- package/dist/ai/providers/whisper/recommendations.d.ts +27 -0
- package/dist/ai/providers/whisper/recommendations.d.ts.map +1 -0
- package/dist/ai/providers/whisper/recommendations.js +68 -0
- package/dist/ai/providers/whisper/recommendations.js.map +1 -0
- package/dist/ai/providers/whisper/whisper.provider.impl.d.ts +18 -0
- package/dist/ai/providers/whisper/whisper.provider.impl.d.ts.map +1 -0
- package/dist/ai/providers/whisper/whisper.provider.impl.js +63 -0
- package/dist/ai/providers/whisper/whisper.provider.impl.js.map +1 -0
- package/dist/ai/specs/whisper-cli/whisper-cli.spec.descriptor.d.ts +35 -0
- package/dist/ai/specs/whisper-cli/whisper-cli.spec.descriptor.d.ts.map +1 -0
- package/dist/ai/specs/whisper-cli/whisper-cli.spec.descriptor.js +24 -0
- package/dist/ai/specs/whisper-cli/whisper-cli.spec.descriptor.js.map +1 -0
- package/dist/ai/specs/whisper-cli/whisper-cli.spec.impl.d.ts +31 -0
- package/dist/ai/specs/whisper-cli/whisper-cli.spec.impl.d.ts.map +1 -0
- package/dist/ai/specs/whisper-cli/whisper-cli.spec.impl.js +60 -0
- package/dist/ai/specs/whisper-cli/whisper-cli.spec.impl.js.map +1 -0
- package/dist/ai/specs/whisper-hf-cli/whisper-hf-cli.spec.descriptor.d.ts +25 -0
- package/dist/ai/specs/whisper-hf-cli/whisper-hf-cli.spec.descriptor.d.ts.map +1 -0
- package/dist/ai/specs/whisper-hf-cli/whisper-hf-cli.spec.descriptor.js +14 -0
- package/dist/ai/specs/whisper-hf-cli/whisper-hf-cli.spec.descriptor.js.map +1 -0
- package/dist/ai/specs/whisper-hf-cli/whisper-hf-cli.spec.impl.d.ts +31 -0
- package/dist/ai/specs/whisper-hf-cli/whisper-hf-cli.spec.impl.d.ts.map +1 -0
- package/dist/ai/specs/whisper-hf-cli/whisper-hf-cli.spec.impl.js +52 -0
- package/dist/ai/specs/whisper-hf-cli/whisper-hf-cli.spec.impl.js.map +1 -0
- package/dist/ai/specs/wire.d.ts +545 -0
- package/dist/ai/specs/wire.d.ts.map +1 -0
- package/dist/ai/specs/wire.js +80 -0
- package/dist/ai/specs/wire.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/schemas/wire.d.ts +30 -0
- package/dist/schemas/wire.d.ts.map +1 -0
- package/dist/schemas/wire.js +20 -0
- package/dist/schemas/wire.js.map +1 -0
- package/package.json +98 -4
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `spec-whisper-cli` — whisper.cpp command-line dialect.
|
|
3
|
+
*
|
|
4
|
+
* Encodes `TranscriptionRequest` to whisper.cpp argv. Audio is
|
|
5
|
+
* written to a temp file by the transport (placeholder `{audio}`).
|
|
6
|
+
* Decodes whisper.cpp's collected `--output-json` file into `TranscriptionResponse`
|
|
7
|
+
* with segments and language metadata.
|
|
8
|
+
*
|
|
9
|
+
* Consumer scope only — `transport-process` is consumer-only.
|
|
10
|
+
*/
|
|
11
|
+
declare const _default: {
|
|
12
|
+
id: string;
|
|
13
|
+
kind: "ai/spec";
|
|
14
|
+
name: string;
|
|
15
|
+
description: string;
|
|
16
|
+
modalities: ("image" | "text" | "audio" | "video" | "embedding" | "transcription" | "evaluation" | "speech" | "ocr")[];
|
|
17
|
+
streamFraming: "none" | "sse" | "sse-named" | "ndjson" | "binary-chunked" | "ws-frame";
|
|
18
|
+
toolCallEnvelope: string;
|
|
19
|
+
transports: string[];
|
|
20
|
+
external: boolean;
|
|
21
|
+
priority: number;
|
|
22
|
+
enabled: boolean;
|
|
23
|
+
capabilities?: ("streaming" | "json_mode" | "text_generation" | "chat_completion" | "function_calling" | "embedding_generation" | "image_generation_text_to_image" | "image_generation_image_to_image" | "image_generation_inpainting" | "image_generation_outpainting" | "image_upscaling" | "image_editing_via_instructions" | "audio_generation_text_to_speech" | "audio_generation_voice_cloning" | "audio_generation_music" | "audio_generation_sound_effects" | "audio_transcription" | "audio_transcription_realtime" | "video_generation_text_to_video" | "workflow_execution" | "code_generation" | "image_understanding" | "structured_evaluation")[] | undefined;
|
|
24
|
+
imageControls?: {
|
|
25
|
+
steps: boolean;
|
|
26
|
+
cfg: boolean;
|
|
27
|
+
sampler: boolean;
|
|
28
|
+
scheduler: boolean;
|
|
29
|
+
negativePrompt: boolean;
|
|
30
|
+
seed: boolean;
|
|
31
|
+
} | undefined;
|
|
32
|
+
tags?: string[] | undefined;
|
|
33
|
+
};
|
|
34
|
+
export default _default;
|
|
35
|
+
//# sourceMappingURL=whisper-cli.spec.descriptor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"whisper-cli.spec.descriptor.d.ts","sourceRoot":"","sources":["../../../../src/ai/specs/whisper-cli/whisper-cli.spec.descriptor.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;;;;;;;;;;;;;;;;;;;;;;;;AACH,wBAYG"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { createAISpecDescriptor } from '@vibesdotdev/ai/specs/schemas/descriptor';
|
|
2
|
+
/**
|
|
3
|
+
* `spec-whisper-cli` — whisper.cpp command-line dialect.
|
|
4
|
+
*
|
|
5
|
+
* Encodes `TranscriptionRequest` to whisper.cpp argv. Audio is
|
|
6
|
+
* written to a temp file by the transport (placeholder `{audio}`).
|
|
7
|
+
* Decodes whisper.cpp's collected `--output-json` file into `TranscriptionResponse`
|
|
8
|
+
* with segments and language metadata.
|
|
9
|
+
*
|
|
10
|
+
* Consumer scope only — `transport-process` is consumer-only.
|
|
11
|
+
*/
|
|
12
|
+
export default createAISpecDescriptor({
|
|
13
|
+
id: 'whisper-cli',
|
|
14
|
+
name: 'whisper.cpp CLI',
|
|
15
|
+
description: 'whisper.cpp argv dialect — `-m model -l lang --output-json -f audiofile`. The collected JSON output file contains the transcript.',
|
|
16
|
+
modalities: ['transcription'],
|
|
17
|
+
streamFraming: 'none',
|
|
18
|
+
toolCallEnvelope: 'none',
|
|
19
|
+
transports: ['process'],
|
|
20
|
+
capabilities: ['audio_transcription'],
|
|
21
|
+
priority: 100,
|
|
22
|
+
tags: ['whisper-cpp', 'cli', 'consumer-only']
|
|
23
|
+
});
|
|
24
|
+
//# sourceMappingURL=whisper-cli.spec.descriptor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"whisper-cli.spec.descriptor.js","sourceRoot":"","sources":["../../../../src/ai/specs/whisper-cli/whisper-cli.spec.descriptor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAElF;;;;;;;;;GASG;AACH,eAAe,sBAAsB,CAAC;IACrC,EAAE,EAAE,aAAa;IACjB,IAAI,EAAE,iBAAiB;IACvB,WAAW,EACV,mIAAmI;IACpI,UAAU,EAAE,CAAC,eAAe,CAAC;IAC7B,aAAa,EAAE,MAAM;IACrB,gBAAgB,EAAE,MAAM;IACxB,UAAU,EAAE,CAAC,SAAS,CAAC;IACvB,YAAY,EAAE,CAAC,qBAAqB,CAAC;IACrC,QAAQ,EAAE,GAAG;IACb,IAAI,EAAE,CAAC,aAAa,EAAE,KAAK,EAAE,eAAe,CAAC;CAC7C,CAAC,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { AISpecInterface, DecodedEvent, SpecCallContext, WireRequest, WireResponseChunk } from '@vibesdotdev/ai/specs/interfaces';
|
|
2
|
+
import type { GenerationRequest } from '@vibesdotdev/ai/interfaces';
|
|
3
|
+
import type { Modality } from '@vibesdotdev/ai/models/schemas';
|
|
4
|
+
export default class WhisperCliSpec implements AISpecInterface {
|
|
5
|
+
readonly descriptor: {
|
|
6
|
+
id: string;
|
|
7
|
+
kind: "ai/spec";
|
|
8
|
+
name: string;
|
|
9
|
+
description: string;
|
|
10
|
+
modalities: ("image" | "text" | "audio" | "video" | "embedding" | "transcription" | "evaluation" | "speech" | "ocr")[];
|
|
11
|
+
streamFraming: "none" | "sse" | "sse-named" | "ndjson" | "binary-chunked" | "ws-frame";
|
|
12
|
+
toolCallEnvelope: string;
|
|
13
|
+
transports: string[];
|
|
14
|
+
external: boolean;
|
|
15
|
+
priority: number;
|
|
16
|
+
enabled: boolean;
|
|
17
|
+
capabilities?: ("streaming" | "json_mode" | "text_generation" | "chat_completion" | "function_calling" | "embedding_generation" | "image_generation_text_to_image" | "image_generation_image_to_image" | "image_generation_inpainting" | "image_generation_outpainting" | "image_upscaling" | "image_editing_via_instructions" | "audio_generation_text_to_speech" | "audio_generation_voice_cloning" | "audio_generation_music" | "audio_generation_sound_effects" | "audio_transcription" | "audio_transcription_realtime" | "video_generation_text_to_video" | "workflow_execution" | "code_generation" | "image_understanding" | "structured_evaluation")[] | undefined;
|
|
18
|
+
imageControls?: {
|
|
19
|
+
steps: boolean;
|
|
20
|
+
cfg: boolean;
|
|
21
|
+
sampler: boolean;
|
|
22
|
+
scheduler: boolean;
|
|
23
|
+
negativePrompt: boolean;
|
|
24
|
+
seed: boolean;
|
|
25
|
+
} | undefined;
|
|
26
|
+
tags?: string[] | undefined;
|
|
27
|
+
};
|
|
28
|
+
encodeRequest<M extends Modality>(request: GenerationRequest<M>, context: SpecCallContext): WireRequest;
|
|
29
|
+
decodeResponse<M extends Modality>(chunks: AsyncIterable<WireResponseChunk>, _request: GenerationRequest<M>, context: SpecCallContext): AsyncIterable<DecodedEvent<M>>;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=whisper-cli.spec.impl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"whisper-cli.spec.impl.d.ts","sourceRoot":"","sources":["../../../../src/ai/specs/whisper-cli/whisper-cli.spec.impl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACvI,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAK/D,MAAM,CAAC,OAAO,OAAO,cAAe,YAAW,eAAe;IAC7D,QAAQ,CAAC,UAAU;;;;;;;;;;;;;;;;;;;;;;MAAc;IACjC,aAAa,CAAC,CAAC,SAAS,QAAQ,EAAE,OAAO,EAAE,iBAAiB,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,eAAe,GAAG,WAAW;IAiChG,cAAc,CAAC,CAAC,SAAS,QAAQ,EAAE,MAAM,EAAE,aAAa,CAAC,iBAAiB,CAAC,EAAE,QAAQ,EAAE,iBAAiB,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,eAAe,GAAG,aAAa,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;CAkB7K"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { CppOutputSchema } from "../../../schemas/wire.js";
|
|
2
|
+
import { readRequest, readOutput, parseOutput, refusal, resultEvent } from "../wire.js";
|
|
3
|
+
import descriptor from "./whisper-cli.spec.descriptor.js";
|
|
4
|
+
export default class WhisperCliSpec {
|
|
5
|
+
descriptor = descriptor;
|
|
6
|
+
encodeRequest(request, context) {
|
|
7
|
+
const { request: input, audio } = readRequest(request);
|
|
8
|
+
const args = ['-m', context.wireModelId];
|
|
9
|
+
const language = input.language ?? 'auto';
|
|
10
|
+
if (language !== 'auto') {
|
|
11
|
+
args.push('-l', language);
|
|
12
|
+
}
|
|
13
|
+
if (input.task === 'translate')
|
|
14
|
+
args.push('--translate');
|
|
15
|
+
args.push('--output-json');
|
|
16
|
+
args.push('--output-file', '{output}');
|
|
17
|
+
// The bundled Desktop path is deliberately CPU-safe. The native
|
|
18
|
+
// application owns a separate Metal-backed streaming path; process
|
|
19
|
+
// execution must also work in restricted/background runtimes where a
|
|
20
|
+
// Metal allocation can be denied.
|
|
21
|
+
args.push('--no-gpu');
|
|
22
|
+
args.push('-t', '4');
|
|
23
|
+
args.push('-f', '{audio}');
|
|
24
|
+
return {
|
|
25
|
+
method: 'POST',
|
|
26
|
+
path: '',
|
|
27
|
+
headers: {},
|
|
28
|
+
body: {
|
|
29
|
+
args,
|
|
30
|
+
files: { audio: audio },
|
|
31
|
+
outputFiles: ['output'],
|
|
32
|
+
outputFileSuffixes: { output: '.json' },
|
|
33
|
+
suppressStdout: true
|
|
34
|
+
},
|
|
35
|
+
streaming: false
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
async *decodeResponse(chunks, _request, context) {
|
|
39
|
+
try {
|
|
40
|
+
const parsed = CppOutputSchema.safeParse(await parseOutput(await readOutput(chunks), true));
|
|
41
|
+
if (!parsed.success)
|
|
42
|
+
throw refusal('invalid-vendor-payload');
|
|
43
|
+
const output = parsed.data;
|
|
44
|
+
yield resultEvent(context, {
|
|
45
|
+
text: output.transcription.map((segment) => segment.text).join(' ').trim(),
|
|
46
|
+
language: output.result?.language,
|
|
47
|
+
segments: output.transcription.map((segment, id) => ({
|
|
48
|
+
id, start: (segment.offsets?.from ?? 0) / 1000,
|
|
49
|
+
end: (segment.offsets?.to ?? 0) / 1000, text: segment.text
|
|
50
|
+
}))
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
if (!(error instanceof Error))
|
|
55
|
+
throw error;
|
|
56
|
+
yield { kind: 'error', error };
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=whisper-cli.spec.impl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"whisper-cli.spec.impl.js","sourceRoot":"","sources":["../../../../src/ai/specs/whisper-cli/whisper-cli.spec.impl.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,UAAU,E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}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
id: string;
|
|
3
|
+
kind: "ai/spec";
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
modalities: ("image" | "text" | "audio" | "video" | "embedding" | "transcription" | "evaluation" | "speech" | "ocr")[];
|
|
7
|
+
streamFraming: "none" | "sse" | "sse-named" | "ndjson" | "binary-chunked" | "ws-frame";
|
|
8
|
+
toolCallEnvelope: string;
|
|
9
|
+
transports: string[];
|
|
10
|
+
external: boolean;
|
|
11
|
+
priority: number;
|
|
12
|
+
enabled: boolean;
|
|
13
|
+
capabilities?: ("streaming" | "json_mode" | "text_generation" | "chat_completion" | "function_calling" | "embedding_generation" | "image_generation_text_to_image" | "image_generation_image_to_image" | "image_generation_inpainting" | "image_generation_outpainting" | "image_upscaling" | "image_editing_via_instructions" | "audio_generation_text_to_speech" | "audio_generation_voice_cloning" | "audio_generation_music" | "audio_generation_sound_effects" | "audio_transcription" | "audio_transcription_realtime" | "video_generation_text_to_video" | "workflow_execution" | "code_generation" | "image_understanding" | "structured_evaluation")[] | undefined;
|
|
14
|
+
imageControls?: {
|
|
15
|
+
steps: boolean;
|
|
16
|
+
cfg: boolean;
|
|
17
|
+
sampler: boolean;
|
|
18
|
+
scheduler: boolean;
|
|
19
|
+
negativePrompt: boolean;
|
|
20
|
+
seed: boolean;
|
|
21
|
+
} | undefined;
|
|
22
|
+
tags?: string[] | undefined;
|
|
23
|
+
};
|
|
24
|
+
export default _default;
|
|
25
|
+
//# sourceMappingURL=whisper-hf-cli.spec.descriptor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"whisper-hf-cli.spec.descriptor.d.ts","sourceRoot":"","sources":["../../../../src/ai/specs/whisper-hf-cli/whisper-hf-cli.spec.descriptor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAEA,wBAWG"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createAISpecDescriptor } from '@vibesdotdev/ai/specs/schemas/descriptor';
|
|
2
|
+
export default createAISpecDescriptor({
|
|
3
|
+
id: 'whisper-hf-cli',
|
|
4
|
+
name: 'Whisper HuggingFace (Python)',
|
|
5
|
+
description: 'Local HuggingFace transformers Whisper transcription through Python.',
|
|
6
|
+
modalities: ['transcription'],
|
|
7
|
+
streamFraming: 'none',
|
|
8
|
+
toolCallEnvelope: 'none',
|
|
9
|
+
transports: ['process'],
|
|
10
|
+
capabilities: ['audio_transcription'],
|
|
11
|
+
priority: 90,
|
|
12
|
+
tags: ['whisper', 'huggingface', 'python', 'consumer-only']
|
|
13
|
+
});
|
|
14
|
+
//# sourceMappingURL=whisper-hf-cli.spec.descriptor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"whisper-hf-cli.spec.descriptor.js","sourceRoot":"","sources":["../../../../src/ai/specs/whisper-hf-cli/whisper-hf-cli.spec.descriptor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAElF,eAAe,sBAAsB,CAAC;IACrC,EAAE,EAAE,gBAAgB;IACpB,IAAI,EAAE,8BAA8B;IACpC,WAAW,EAAE,sEAAsE;IACnF,UAAU,EAAE,CAAC,eAAe,CAAC;IAC7B,aAAa,EAAE,MAAM;IACrB,gBAAgB,EAAE,MAAM;IACxB,UAAU,EAAE,CAAC,SAAS,CAAC;IACvB,YAAY,EAAE,CAAC,qBAAqB,CAAC;IACrC,QAAQ,EAAE,EAAE;IACZ,IAAI,EAAE,CAAC,SAAS,EAAE,aAAa,EAAE,QAAQ,EAAE,eAAe,CAAC;CAC3D,CAAC,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { AISpecInterface, DecodedEvent, SpecCallContext, WireRequest, WireResponseChunk } from '@vibesdotdev/ai/specs/interfaces';
|
|
2
|
+
import type { GenerationRequest } from '@vibesdotdev/ai/interfaces';
|
|
3
|
+
import type { Modality } from '@vibesdotdev/ai/models/schemas';
|
|
4
|
+
export default class WhisperHfCliSpec implements AISpecInterface {
|
|
5
|
+
readonly descriptor: {
|
|
6
|
+
id: string;
|
|
7
|
+
kind: "ai/spec";
|
|
8
|
+
name: string;
|
|
9
|
+
description: string;
|
|
10
|
+
modalities: ("image" | "text" | "audio" | "video" | "embedding" | "transcription" | "evaluation" | "speech" | "ocr")[];
|
|
11
|
+
streamFraming: "none" | "sse" | "sse-named" | "ndjson" | "binary-chunked" | "ws-frame";
|
|
12
|
+
toolCallEnvelope: string;
|
|
13
|
+
transports: string[];
|
|
14
|
+
external: boolean;
|
|
15
|
+
priority: number;
|
|
16
|
+
enabled: boolean;
|
|
17
|
+
capabilities?: ("streaming" | "json_mode" | "text_generation" | "chat_completion" | "function_calling" | "embedding_generation" | "image_generation_text_to_image" | "image_generation_image_to_image" | "image_generation_inpainting" | "image_generation_outpainting" | "image_upscaling" | "image_editing_via_instructions" | "audio_generation_text_to_speech" | "audio_generation_voice_cloning" | "audio_generation_music" | "audio_generation_sound_effects" | "audio_transcription" | "audio_transcription_realtime" | "video_generation_text_to_video" | "workflow_execution" | "code_generation" | "image_understanding" | "structured_evaluation")[] | undefined;
|
|
18
|
+
imageControls?: {
|
|
19
|
+
steps: boolean;
|
|
20
|
+
cfg: boolean;
|
|
21
|
+
sampler: boolean;
|
|
22
|
+
scheduler: boolean;
|
|
23
|
+
negativePrompt: boolean;
|
|
24
|
+
seed: boolean;
|
|
25
|
+
} | undefined;
|
|
26
|
+
tags?: string[] | undefined;
|
|
27
|
+
};
|
|
28
|
+
encodeRequest<M extends Modality>(request: GenerationRequest<M>, context: SpecCallContext): WireRequest;
|
|
29
|
+
decodeResponse<M extends Modality>(chunks: AsyncIterable<WireResponseChunk>, _request: GenerationRequest<M>, context: SpecCallContext): AsyncIterable<DecodedEvent<M>>;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=whisper-hf-cli.spec.impl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"whisper-hf-cli.spec.impl.d.ts","sourceRoot":"","sources":["../../../../src/ai/specs/whisper-hf-cli/whisper-hf-cli.spec.impl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACvI,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAK/D,MAAM,CAAC,OAAO,OAAO,gBAAiB,YAAW,eAAe;IAC/D,QAAQ,CAAC,UAAU;;;;;;;;;;;;;;;;;;;;;;MAAc;IACjC,aAAa,CAAC,CAAC,SAAS,QAAQ,EAAE,OAAO,EAAE,iBAAiB,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,eAAe,GAAG,WAAW;IAUhG,cAAc,CAAC,CAAC,SAAS,QAAQ,EAAE,MAAM,EAAE,aAAa,CAAC,iBAAiB,CAAC,EAAE,QAAQ,EAAE,iBAAiB,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,eAAe,GAAG,aAAa,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;CAc7K"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { HfOutputSchema } from "../../../schemas/wire.js";
|
|
2
|
+
import { readRequest, readOutput, parseOutput, refusal, resultEvent } from "../wire.js";
|
|
3
|
+
import descriptor from "./whisper-hf-cli.spec.descriptor.js";
|
|
4
|
+
export default class WhisperHfCliSpec {
|
|
5
|
+
descriptor = descriptor;
|
|
6
|
+
encodeRequest(request, context) {
|
|
7
|
+
const { request: input, audio } = readRequest(request);
|
|
8
|
+
const script = buildScript({
|
|
9
|
+
modelId: context.wireModelId || 'base',
|
|
10
|
+
language: input.language,
|
|
11
|
+
task: input.task === 'translate' ? 'translate' : 'transcribe',
|
|
12
|
+
wordTimestamps: input.wordTimestamps === true
|
|
13
|
+
});
|
|
14
|
+
return { method: 'POST', path: '', headers: {}, body: { args: ['-c', script], files: { audio } }, streaming: false };
|
|
15
|
+
}
|
|
16
|
+
async *decodeResponse(chunks, _request, context) {
|
|
17
|
+
try {
|
|
18
|
+
const parsed = HfOutputSchema.safeParse(await parseOutput(await readOutput(chunks), false));
|
|
19
|
+
if (!parsed.success)
|
|
20
|
+
throw refusal('invalid-vendor-payload');
|
|
21
|
+
yield resultEvent(context, {
|
|
22
|
+
text: parsed.data.text,
|
|
23
|
+
language: parsed.data.language ?? undefined,
|
|
24
|
+
segments: parsed.data.segments?.map((segment, id) => ({ id, ...segment }))
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
if (!(error instanceof Error))
|
|
29
|
+
throw error;
|
|
30
|
+
yield { kind: 'error', error };
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function buildScript(args) {
|
|
35
|
+
const modelId = args.modelId.includes('/') ? args.modelId : `openai/whisper-${args.modelId}`;
|
|
36
|
+
const language = args.language ? JSON.stringify(args.language) : 'None';
|
|
37
|
+
return [
|
|
38
|
+
'import json',
|
|
39
|
+
'from transformers import pipeline',
|
|
40
|
+
`pipe = pipeline("automatic-speech-recognition", model=${JSON.stringify(modelId)})`,
|
|
41
|
+
`kwargs = {"task": ${JSON.stringify(args.task)}}`,
|
|
42
|
+
`language = ${language}`,
|
|
43
|
+
'if language is not None: kwargs["language"] = language',
|
|
44
|
+
`result = pipe("{audio}", return_timestamps=${args.wordTimestamps ? '"word"' : 'True'}, generate_kwargs=kwargs)`,
|
|
45
|
+
'segments = []',
|
|
46
|
+
'for chunk in result.get("chunks", []):',
|
|
47
|
+
' stamp = chunk.get("timestamp") or (0, 0)',
|
|
48
|
+
' segments.append({"start": stamp[0] or 0, "end": stamp[1] or 0, "text": chunk.get("text", "")})',
|
|
49
|
+
'print(json.dumps({"text": result.get("text", ""), "segments": segments, "language": language}))'
|
|
50
|
+
].join('\n');
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=whisper-hf-cli.spec.impl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"whisper-hf-cli.spec.impl.js","sourceRoot":"","sources":["../../../../src/ai/specs/whisper-hf-cli/whisper-hf-cli.spec.impl.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACxF,OAAO,UAAU,MAAM,qCAAqC,CAAC;AAE7D,MAAM,CAAC,OAAO,OAAO,gBAAgB;IAC3B,UAAU,GAAG,UAAU,CAAC;IACjC,aAAa,CAAqB,OAA6B,EAAE,OAAwB;QACxF,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;QACvD,MAAM,MAAM,GAAG,WAAW,CAAC;YAC1B,OAAO,EAAE,OAAO,CAAC,WAAW,IAAI,MAAM;YACtC,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,IAAI,EAAE,KAAK,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,YAAY;YAC7D,cAAc,EAAE,KAAK,CAAC,cAAc,KAAK,IAAI;SAC7C,CAAC,CAAC;QACH,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;IACtH,CAAC;IACD,KAAK,CAAC,CAAC,cAAc,CAAqB,MAAwC,EAAE,QAA8B,EAAE,OA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