@copilotkit/voice 1.51.5-next.0 → 1.51.5-next.2

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.
@@ -0,0 +1,34 @@
1
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
2
+ let _copilotkitnext_runtime = require("@copilotkitnext/runtime");
3
+ let openai = require("openai");
4
+ openai = require_runtime.__toESM(openai);
5
+
6
+ //#region src/transcription/transcription-service-openai.ts
7
+ var TranscriptionServiceOpenAI = class extends _copilotkitnext_runtime.TranscriptionService {
8
+ openai;
9
+ model;
10
+ language;
11
+ prompt;
12
+ temperature;
13
+ constructor(config) {
14
+ super();
15
+ this.openai = config.openai ?? new openai.default();
16
+ this.model = config.model ?? "whisper-1";
17
+ this.language = config.language;
18
+ this.prompt = config.prompt;
19
+ this.temperature = config.temperature;
20
+ }
21
+ async transcribeFile(options) {
22
+ return (await this.openai.audio.transcriptions.create({
23
+ file: options.audioFile,
24
+ model: this.model,
25
+ ...this.language && { language: this.language },
26
+ ...this.prompt && { prompt: this.prompt },
27
+ ...this.temperature !== void 0 && { temperature: this.temperature }
28
+ })).text;
29
+ }
30
+ };
31
+
32
+ //#endregion
33
+ exports.TranscriptionServiceOpenAI = TranscriptionServiceOpenAI;
34
+ //# sourceMappingURL=transcription-service-openai.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transcription-service-openai.cjs","names":["TranscriptionService","OpenAI"],"sources":["../../src/transcription/transcription-service-openai.ts"],"sourcesContent":["import {\n TranscribeFileOptions,\n TranscriptionService,\n} from \"@copilotkitnext/runtime\";\nimport OpenAI from \"openai\";\n\n/**\n * Configuration options for the OpenAI transcription service.\n */\nexport interface TranscriptionServiceOpenAIConfig {\n /** OpenAI client instance. */\n openai: OpenAI;\n /** Whisper model to use. Defaults to \"whisper-1\". */\n model?: string;\n /**\n * Language of the audio in ISO-639-1 format (e.g., \"en\", \"de\", \"fr\").\n * Providing the language improves accuracy and latency.\n */\n language?: string;\n /**\n * Optional text to guide the model's style or continue a previous segment.\n * Should match the audio language.\n */\n prompt?: string;\n /**\n * Sampling temperature between 0 and 1.\n * Lower values are more deterministic, higher values more creative.\n */\n temperature?: number;\n}\n\nexport class TranscriptionServiceOpenAI extends TranscriptionService {\n private openai: OpenAI;\n private model: string;\n private language?: string;\n private prompt?: string;\n private temperature?: number;\n\n constructor(config: TranscriptionServiceOpenAIConfig) {\n super();\n this.openai = config.openai ?? new OpenAI();\n this.model = config.model ?? \"whisper-1\";\n this.language = config.language;\n this.prompt = config.prompt;\n this.temperature = config.temperature;\n }\n\n async transcribeFile(options: TranscribeFileOptions): Promise<string> {\n const response = await this.openai.audio.transcriptions.create({\n file: options.audioFile,\n model: this.model,\n ...(this.language && { language: this.language }),\n ...(this.prompt && { prompt: this.prompt }),\n ...(this.temperature !== undefined && { temperature: this.temperature }),\n });\n return response.text;\n }\n}\n"],"mappings":";;;;;;AA+BA,IAAa,6BAAb,cAAgDA,6CAAqB;CACnE,AAAQ;CACR,AAAQ;CACR,AAAQ;CACR,AAAQ;CACR,AAAQ;CAER,YAAY,QAA0C;AACpD,SAAO;AACP,OAAK,SAAS,OAAO,UAAU,IAAIC,gBAAQ;AAC3C,OAAK,QAAQ,OAAO,SAAS;AAC7B,OAAK,WAAW,OAAO;AACvB,OAAK,SAAS,OAAO;AACrB,OAAK,cAAc,OAAO;;CAG5B,MAAM,eAAe,SAAiD;AAQpE,UAPiB,MAAM,KAAK,OAAO,MAAM,eAAe,OAAO;GAC7D,MAAM,QAAQ;GACd,OAAO,KAAK;GACZ,GAAI,KAAK,YAAY,EAAE,UAAU,KAAK,UAAU;GAChD,GAAI,KAAK,UAAU,EAAE,QAAQ,KAAK,QAAQ;GAC1C,GAAI,KAAK,gBAAgB,UAAa,EAAE,aAAa,KAAK,aAAa;GACxE,CAAC,EACc"}
@@ -0,0 +1,40 @@
1
+ import { TranscribeFileOptions, TranscriptionService } from "@copilotkitnext/runtime";
2
+ import OpenAI from "openai";
3
+
4
+ //#region src/transcription/transcription-service-openai.d.ts
5
+ /**
6
+ * Configuration options for the OpenAI transcription service.
7
+ */
8
+ interface TranscriptionServiceOpenAIConfig {
9
+ /** OpenAI client instance. */
10
+ openai: OpenAI;
11
+ /** Whisper model to use. Defaults to "whisper-1". */
12
+ model?: string;
13
+ /**
14
+ * Language of the audio in ISO-639-1 format (e.g., "en", "de", "fr").
15
+ * Providing the language improves accuracy and latency.
16
+ */
17
+ language?: string;
18
+ /**
19
+ * Optional text to guide the model's style or continue a previous segment.
20
+ * Should match the audio language.
21
+ */
22
+ prompt?: string;
23
+ /**
24
+ * Sampling temperature between 0 and 1.
25
+ * Lower values are more deterministic, higher values more creative.
26
+ */
27
+ temperature?: number;
28
+ }
29
+ declare class TranscriptionServiceOpenAI extends TranscriptionService {
30
+ private openai;
31
+ private model;
32
+ private language?;
33
+ private prompt?;
34
+ private temperature?;
35
+ constructor(config: TranscriptionServiceOpenAIConfig);
36
+ transcribeFile(options: TranscribeFileOptions): Promise<string>;
37
+ }
38
+ //#endregion
39
+ export { TranscriptionServiceOpenAI, TranscriptionServiceOpenAIConfig };
40
+ //# sourceMappingURL=transcription-service-openai.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transcription-service-openai.d.cts","names":[],"sources":["../../src/transcription/transcription-service-openai.ts"],"mappings":";;;;;;AASA;UAAiB,gCAAA;;EAEf,MAAA,EAAQ,MAAA;EAAR;EAEA,KAAA;EAAA;;;;EAKA,QAAA;EAUW;AAGb;;;EARE,MAAA;EAwB8B;;;;EAnB9B,WAAA;AAAA;AAAA,cAGW,0BAAA,SAAmC,oBAAA;EAAA,QACtC,MAAA;EAAA,QACA,KAAA;EAAA,QACA,QAAA;EAAA,QACA,MAAA;EAAA,QACA,WAAA;cAEI,MAAA,EAAQ,gCAAA;EASd,cAAA,CAAe,OAAA,EAAS,qBAAA,GAAwB,OAAA;AAAA"}
@@ -0,0 +1,40 @@
1
+ import { TranscribeFileOptions, TranscriptionService } from "@copilotkitnext/runtime";
2
+ import OpenAI from "openai";
3
+
4
+ //#region src/transcription/transcription-service-openai.d.ts
5
+ /**
6
+ * Configuration options for the OpenAI transcription service.
7
+ */
8
+ interface TranscriptionServiceOpenAIConfig {
9
+ /** OpenAI client instance. */
10
+ openai: OpenAI;
11
+ /** Whisper model to use. Defaults to "whisper-1". */
12
+ model?: string;
13
+ /**
14
+ * Language of the audio in ISO-639-1 format (e.g., "en", "de", "fr").
15
+ * Providing the language improves accuracy and latency.
16
+ */
17
+ language?: string;
18
+ /**
19
+ * Optional text to guide the model's style or continue a previous segment.
20
+ * Should match the audio language.
21
+ */
22
+ prompt?: string;
23
+ /**
24
+ * Sampling temperature between 0 and 1.
25
+ * Lower values are more deterministic, higher values more creative.
26
+ */
27
+ temperature?: number;
28
+ }
29
+ declare class TranscriptionServiceOpenAI extends TranscriptionService {
30
+ private openai;
31
+ private model;
32
+ private language?;
33
+ private prompt?;
34
+ private temperature?;
35
+ constructor(config: TranscriptionServiceOpenAIConfig);
36
+ transcribeFile(options: TranscribeFileOptions): Promise<string>;
37
+ }
38
+ //#endregion
39
+ export { TranscriptionServiceOpenAI, TranscriptionServiceOpenAIConfig };
40
+ //# sourceMappingURL=transcription-service-openai.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transcription-service-openai.d.mts","names":[],"sources":["../../src/transcription/transcription-service-openai.ts"],"mappings":";;;;;;AASA;UAAiB,gCAAA;;EAEf,MAAA,EAAQ,MAAA;EAAR;EAEA,KAAA;EAAA;;;;EAKA,QAAA;EAUW;AAGb;;;EARE,MAAA;EAwB8B;;;;EAnB9B,WAAA;AAAA;AAAA,cAGW,0BAAA,SAAmC,oBAAA;EAAA,QACtC,MAAA;EAAA,QACA,KAAA;EAAA,QACA,QAAA;EAAA,QACA,MAAA;EAAA,QACA,WAAA;cAEI,MAAA,EAAQ,gCAAA;EASd,cAAA,CAAe,OAAA,EAAS,qBAAA,GAAwB,OAAA;AAAA"}
@@ -0,0 +1,32 @@
1
+ import { TranscriptionService } from "@copilotkitnext/runtime";
2
+ import OpenAI from "openai";
3
+
4
+ //#region src/transcription/transcription-service-openai.ts
5
+ var TranscriptionServiceOpenAI = class extends TranscriptionService {
6
+ openai;
7
+ model;
8
+ language;
9
+ prompt;
10
+ temperature;
11
+ constructor(config) {
12
+ super();
13
+ this.openai = config.openai ?? new OpenAI();
14
+ this.model = config.model ?? "whisper-1";
15
+ this.language = config.language;
16
+ this.prompt = config.prompt;
17
+ this.temperature = config.temperature;
18
+ }
19
+ async transcribeFile(options) {
20
+ return (await this.openai.audio.transcriptions.create({
21
+ file: options.audioFile,
22
+ model: this.model,
23
+ ...this.language && { language: this.language },
24
+ ...this.prompt && { prompt: this.prompt },
25
+ ...this.temperature !== void 0 && { temperature: this.temperature }
26
+ })).text;
27
+ }
28
+ };
29
+
30
+ //#endregion
31
+ export { TranscriptionServiceOpenAI };
32
+ //# sourceMappingURL=transcription-service-openai.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transcription-service-openai.mjs","names":[],"sources":["../../src/transcription/transcription-service-openai.ts"],"sourcesContent":["import {\n TranscribeFileOptions,\n TranscriptionService,\n} from \"@copilotkitnext/runtime\";\nimport OpenAI from \"openai\";\n\n/**\n * Configuration options for the OpenAI transcription service.\n */\nexport interface TranscriptionServiceOpenAIConfig {\n /** OpenAI client instance. */\n openai: OpenAI;\n /** Whisper model to use. Defaults to \"whisper-1\". */\n model?: string;\n /**\n * Language of the audio in ISO-639-1 format (e.g., \"en\", \"de\", \"fr\").\n * Providing the language improves accuracy and latency.\n */\n language?: string;\n /**\n * Optional text to guide the model's style or continue a previous segment.\n * Should match the audio language.\n */\n prompt?: string;\n /**\n * Sampling temperature between 0 and 1.\n * Lower values are more deterministic, higher values more creative.\n */\n temperature?: number;\n}\n\nexport class TranscriptionServiceOpenAI extends TranscriptionService {\n private openai: OpenAI;\n private model: string;\n private language?: string;\n private prompt?: string;\n private temperature?: number;\n\n constructor(config: TranscriptionServiceOpenAIConfig) {\n super();\n this.openai = config.openai ?? new OpenAI();\n this.model = config.model ?? \"whisper-1\";\n this.language = config.language;\n this.prompt = config.prompt;\n this.temperature = config.temperature;\n }\n\n async transcribeFile(options: TranscribeFileOptions): Promise<string> {\n const response = await this.openai.audio.transcriptions.create({\n file: options.audioFile,\n model: this.model,\n ...(this.language && { language: this.language }),\n ...(this.prompt && { prompt: this.prompt }),\n ...(this.temperature !== undefined && { temperature: this.temperature }),\n });\n return response.text;\n }\n}\n"],"mappings":";;;;AA+BA,IAAa,6BAAb,cAAgD,qBAAqB;CACnE,AAAQ;CACR,AAAQ;CACR,AAAQ;CACR,AAAQ;CACR,AAAQ;CAER,YAAY,QAA0C;AACpD,SAAO;AACP,OAAK,SAAS,OAAO,UAAU,IAAI,QAAQ;AAC3C,OAAK,QAAQ,OAAO,SAAS;AAC7B,OAAK,WAAW,OAAO;AACvB,OAAK,SAAS,OAAO;AACrB,OAAK,cAAc,OAAO;;CAG5B,MAAM,eAAe,SAAiD;AAQpE,UAPiB,MAAM,KAAK,OAAO,MAAM,eAAe,OAAO;GAC7D,MAAM,QAAQ;GACd,OAAO,KAAK;GACZ,GAAI,KAAK,YAAY,EAAE,UAAU,KAAK,UAAU;GAChD,GAAI,KAAK,UAAU,EAAE,QAAQ,KAAK,QAAQ;GAC1C,GAAI,KAAK,gBAAgB,UAAa,EAAE,aAAa,KAAK,aAAa;GACxE,CAAC,EACc"}
package/package.json CHANGED
@@ -1,15 +1,16 @@
1
1
  {
2
2
  "name": "@copilotkit/voice",
3
- "version": "1.51.5-next.0",
3
+ "version": "1.51.5-next.2",
4
4
  "description": "Voice services for CopilotKit (transcription, text-to-speech, etc.)",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
5
+ "main": "./dist/index.cjs",
6
+ "types": "./dist/index.d.cts",
7
+ "type": "module",
7
8
  "exports": {
8
9
  ".": {
9
- "types": "./dist/index.d.ts",
10
10
  "import": "./dist/index.mjs",
11
- "require": "./dist/index.js"
12
- }
11
+ "require": "./dist/index.cjs"
12
+ },
13
+ "./package.json": "./package.json"
13
14
  },
14
15
  "unpkg": "./dist/index.umd.js",
15
16
  "jsdelivr": "./dist/index.umd.js",
@@ -19,26 +20,29 @@
19
20
  "devDependencies": {
20
21
  "@types/node": "^22.15.3",
21
22
  "eslint": "^9.30.0",
22
- "tsup": "^8.5.0",
23
+ "tsdown": "^0.20.3",
23
24
  "typescript": "5.8.2",
24
25
  "vitest": "^3.0.5",
25
- "@copilotkitnext/eslint-config": "1.51.5-next.0",
26
- "@copilotkitnext/typescript-config": "1.51.5-next.0"
26
+ "@copilotkitnext/typescript-config": "1.51.5-next.2",
27
+ "@copilotkitnext/eslint-config": "1.51.5-next.2"
27
28
  },
28
29
  "dependencies": {
29
30
  "openai": "^5.9.0",
30
- "@copilotkitnext/runtime": "1.51.5-next.0"
31
+ "@copilotkitnext/runtime": "1.51.5-next.2"
31
32
  },
32
33
  "engines": {
33
34
  "node": ">=18"
34
35
  },
36
+ "module": "./dist/index.mjs",
35
37
  "scripts": {
36
- "build": "tsup && rollup -c rollup.config.mjs",
37
- "dev": "tsup --watch",
38
+ "build": "tsdown",
39
+ "dev": "tsdown --watch",
38
40
  "lint": "eslint . --max-warnings 0",
39
41
  "check-types": "tsc --noEmit",
40
42
  "test": "vitest run",
41
43
  "test:watch": "vitest",
42
- "test:coverage": "vitest run --coverage"
44
+ "test:coverage": "vitest run --coverage",
45
+ "publint": "publint .",
46
+ "attw": "attw --pack . --profile node16"
43
47
  }
44
48
  }
@@ -0,0 +1,35 @@
1
+ import { defineConfig } from "tsdown";
2
+
3
+ const isWatch = process.argv.includes("--watch");
4
+
5
+ export default defineConfig([
6
+ {
7
+ entry: ["src/index.ts"],
8
+ format: ["esm", "cjs"],
9
+ dts: !isWatch,
10
+ sourcemap: true,
11
+ clean: !isWatch,
12
+ target: "es2022",
13
+ outDir: "dist",
14
+ unbundle: true,
15
+ exports: true,
16
+ },
17
+ {
18
+ entry: ["src/index.ts"],
19
+ format: ["umd"],
20
+ globalName: "CopilotKitVoice",
21
+ sourcemap: true,
22
+ target: "es2018",
23
+ outDir: "dist",
24
+ external: [],
25
+ codeSplitting: false,
26
+ outputOptions(options) {
27
+ options.entryFileNames = "[name].umd.js";
28
+ options.globals = {
29
+ "@copilotkitnext/runtime": "CopilotKitNextRuntime",
30
+ openai: "openai",
31
+ };
32
+ return options;
33
+ },
34
+ },
35
+ ]);
package/dist/index.d.ts DELETED
@@ -1,38 +0,0 @@
1
- import { TranscriptionService, TranscribeFileOptions } from '@copilotkitnext/runtime';
2
- import OpenAI from 'openai';
3
-
4
- /**
5
- * Configuration options for the OpenAI transcription service.
6
- */
7
- interface TranscriptionServiceOpenAIConfig {
8
- /** OpenAI client instance. */
9
- openai: OpenAI;
10
- /** Whisper model to use. Defaults to "whisper-1". */
11
- model?: string;
12
- /**
13
- * Language of the audio in ISO-639-1 format (e.g., "en", "de", "fr").
14
- * Providing the language improves accuracy and latency.
15
- */
16
- language?: string;
17
- /**
18
- * Optional text to guide the model's style or continue a previous segment.
19
- * Should match the audio language.
20
- */
21
- prompt?: string;
22
- /**
23
- * Sampling temperature between 0 and 1.
24
- * Lower values are more deterministic, higher values more creative.
25
- */
26
- temperature?: number;
27
- }
28
- declare class TranscriptionServiceOpenAI extends TranscriptionService {
29
- private openai;
30
- private model;
31
- private language?;
32
- private prompt?;
33
- private temperature?;
34
- constructor(config: TranscriptionServiceOpenAIConfig);
35
- transcribeFile(options: TranscribeFileOptions): Promise<string>;
36
- }
37
-
38
- export { TranscriptionServiceOpenAI, type TranscriptionServiceOpenAIConfig };
package/dist/index.js DELETED
@@ -1,69 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/index.ts
31
- var index_exports = {};
32
- __export(index_exports, {
33
- TranscriptionServiceOpenAI: () => TranscriptionServiceOpenAI
34
- });
35
- module.exports = __toCommonJS(index_exports);
36
-
37
- // src/transcription/transcription-service-openai.ts
38
- var import_runtime = require("@copilotkitnext/runtime");
39
- var import_openai = __toESM(require("openai"));
40
- var TranscriptionServiceOpenAI = class extends import_runtime.TranscriptionService {
41
- openai;
42
- model;
43
- language;
44
- prompt;
45
- temperature;
46
- constructor(config) {
47
- super();
48
- this.openai = config.openai ?? new import_openai.default();
49
- this.model = config.model ?? "whisper-1";
50
- this.language = config.language;
51
- this.prompt = config.prompt;
52
- this.temperature = config.temperature;
53
- }
54
- async transcribeFile(options) {
55
- const response = await this.openai.audio.transcriptions.create({
56
- file: options.audioFile,
57
- model: this.model,
58
- ...this.language && { language: this.language },
59
- ...this.prompt && { prompt: this.prompt },
60
- ...this.temperature !== void 0 && { temperature: this.temperature }
61
- });
62
- return response.text;
63
- }
64
- };
65
- // Annotate the CommonJS export names for ESM import in node:
66
- 0 && (module.exports = {
67
- TranscriptionServiceOpenAI
68
- });
69
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/index.ts","../src/transcription/transcription-service-openai.ts"],"sourcesContent":["// Transcription services\nexport * from \"./transcription/transcription-service-openai\";\n","import {\n TranscribeFileOptions,\n TranscriptionService,\n} from \"@copilotkitnext/runtime\";\nimport OpenAI from \"openai\";\n\n/**\n * Configuration options for the OpenAI transcription service.\n */\nexport interface TranscriptionServiceOpenAIConfig {\n /** OpenAI client instance. */\n openai: OpenAI;\n /** Whisper model to use. Defaults to \"whisper-1\". */\n model?: string;\n /**\n * Language of the audio in ISO-639-1 format (e.g., \"en\", \"de\", \"fr\").\n * Providing the language improves accuracy and latency.\n */\n language?: string;\n /**\n * Optional text to guide the model's style or continue a previous segment.\n * Should match the audio language.\n */\n prompt?: string;\n /**\n * Sampling temperature between 0 and 1.\n * Lower values are more deterministic, higher values more creative.\n */\n temperature?: number;\n}\n\nexport class TranscriptionServiceOpenAI extends TranscriptionService {\n private openai: OpenAI;\n private model: string;\n private language?: string;\n private prompt?: string;\n private temperature?: number;\n\n constructor(config: TranscriptionServiceOpenAIConfig) {\n super();\n this.openai = config.openai ?? new OpenAI();\n this.model = config.model ?? \"whisper-1\";\n this.language = config.language;\n this.prompt = config.prompt;\n this.temperature = config.temperature;\n }\n\n async transcribeFile(options: TranscribeFileOptions): Promise<string> {\n const response = await this.openai.audio.transcriptions.create({\n file: options.audioFile,\n model: this.model,\n ...(this.language && { language: this.language }),\n ...(this.prompt && { prompt: this.prompt }),\n ...(this.temperature !== undefined && { temperature: this.temperature }),\n });\n return response.text;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,qBAGO;AACP,oBAAmB;AA2BZ,IAAM,6BAAN,cAAyC,oCAAqB;AAAA,EAC3D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAER,YAAY,QAA0C;AACpD,UAAM;AACN,SAAK,SAAS,OAAO,UAAU,IAAI,cAAAA,QAAO;AAC1C,SAAK,QAAQ,OAAO,SAAS;AAC7B,SAAK,WAAW,OAAO;AACvB,SAAK,SAAS,OAAO;AACrB,SAAK,cAAc,OAAO;AAAA,EAC5B;AAAA,EAEA,MAAM,eAAe,SAAiD;AACpE,UAAM,WAAW,MAAM,KAAK,OAAO,MAAM,eAAe,OAAO;AAAA,MAC7D,MAAM,QAAQ;AAAA,MACd,OAAO,KAAK;AAAA,MACZ,GAAI,KAAK,YAAY,EAAE,UAAU,KAAK,SAAS;AAAA,MAC/C,GAAI,KAAK,UAAU,EAAE,QAAQ,KAAK,OAAO;AAAA,MACzC,GAAI,KAAK,gBAAgB,UAAa,EAAE,aAAa,KAAK,YAAY;AAAA,IACxE,CAAC;AACD,WAAO,SAAS;AAAA,EAClB;AACF;","names":["OpenAI"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/transcription/transcription-service-openai.ts"],"sourcesContent":["import {\n TranscribeFileOptions,\n TranscriptionService,\n} from \"@copilotkitnext/runtime\";\nimport OpenAI from \"openai\";\n\n/**\n * Configuration options for the OpenAI transcription service.\n */\nexport interface TranscriptionServiceOpenAIConfig {\n /** OpenAI client instance. */\n openai: OpenAI;\n /** Whisper model to use. Defaults to \"whisper-1\". */\n model?: string;\n /**\n * Language of the audio in ISO-639-1 format (e.g., \"en\", \"de\", \"fr\").\n * Providing the language improves accuracy and latency.\n */\n language?: string;\n /**\n * Optional text to guide the model's style or continue a previous segment.\n * Should match the audio language.\n */\n prompt?: string;\n /**\n * Sampling temperature between 0 and 1.\n * Lower values are more deterministic, higher values more creative.\n */\n temperature?: number;\n}\n\nexport class TranscriptionServiceOpenAI extends TranscriptionService {\n private openai: OpenAI;\n private model: string;\n private language?: string;\n private prompt?: string;\n private temperature?: number;\n\n constructor(config: TranscriptionServiceOpenAIConfig) {\n super();\n this.openai = config.openai ?? new OpenAI();\n this.model = config.model ?? \"whisper-1\";\n this.language = config.language;\n this.prompt = config.prompt;\n this.temperature = config.temperature;\n }\n\n async transcribeFile(options: TranscribeFileOptions): Promise<string> {\n const response = await this.openai.audio.transcriptions.create({\n file: options.audioFile,\n model: this.model,\n ...(this.language && { language: this.language }),\n ...(this.prompt && { prompt: this.prompt }),\n ...(this.temperature !== undefined && { temperature: this.temperature }),\n });\n return response.text;\n }\n}\n"],"mappings":";AAAA;AAAA,EAEE;AAAA,OACK;AACP,OAAO,YAAY;AA2BZ,IAAM,6BAAN,cAAyC,qBAAqB;AAAA,EAC3D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAER,YAAY,QAA0C;AACpD,UAAM;AACN,SAAK,SAAS,OAAO,UAAU,IAAI,OAAO;AAC1C,SAAK,QAAQ,OAAO,SAAS;AAC7B,SAAK,WAAW,OAAO;AACvB,SAAK,SAAS,OAAO;AACrB,SAAK,cAAc,OAAO;AAAA,EAC5B;AAAA,EAEA,MAAM,eAAe,SAAiD;AACpE,UAAM,WAAW,MAAM,KAAK,OAAO,MAAM,eAAe,OAAO;AAAA,MAC7D,MAAM,QAAQ;AAAA,MACd,OAAO,KAAK;AAAA,MACZ,GAAI,KAAK,YAAY,EAAE,UAAU,KAAK,SAAS;AAAA,MAC/C,GAAI,KAAK,UAAU,EAAE,QAAQ,KAAK,OAAO;AAAA,MACzC,GAAI,KAAK,gBAAgB,UAAa,EAAE,aAAa,KAAK,YAAY;AAAA,IACxE,CAAC;AACD,WAAO,SAAS;AAAA,EAClB;AACF;","names":[]}
package/rollup.config.mjs DELETED
@@ -1,34 +0,0 @@
1
- import resolve from '@rollup/plugin-node-resolve';
2
- import commonjs from '@rollup/plugin-commonjs';
3
- import typescript from '@rollup/plugin-typescript';
4
- import terser from '@rollup/plugin-terser';
5
- import json from '@rollup/plugin-json';
6
-
7
- function onwarn(warning, warn) {
8
- // Ignore circular dependency warnings from node_modules
9
- if (warning.code === 'CIRCULAR_DEPENDENCY' && warning.ids?.some(id => id.includes('node_modules'))) return;
10
- // Ignore "this" rewritten to "undefined" warnings from node_modules
11
- if (warning.code === 'THIS_IS_UNDEFINED' && warning.id?.includes('node_modules')) return;
12
- warn(warning);
13
- }
14
-
15
- export default {
16
- input: 'src/index.ts',
17
- output: {
18
- file: 'dist/index.umd.js',
19
- format: 'umd',
20
- name: 'CopilotKitVoice',
21
- sourcemap: true,
22
- inlineDynamicImports: true,
23
- globals: {},
24
- },
25
- external: [],
26
- onwarn,
27
- plugins: [
28
- resolve({ browser: true, preferBuiltins: false }),
29
- commonjs(),
30
- json(),
31
- typescript({ tsconfig: './tsconfig.json', declaration: false, declarationMap: false, compilerOptions: { target: 'ES2018', module: 'ESNext', moduleResolution: 'Bundler' } }),
32
- terser(),
33
- ],
34
- };
package/tsup.config.ts DELETED
@@ -1,13 +0,0 @@
1
- import { defineConfig } from "tsup";
2
-
3
- const isWatch = process.argv.includes("--watch");
4
-
5
- export default defineConfig({
6
- entry: ["src/index.ts"],
7
- format: ["cjs", "esm"],
8
- dts: isWatch ? false : true,
9
- sourcemap: true,
10
- clean: !isWatch,
11
- target: "es2022",
12
- outDir: "dist",
13
- });