@knowledge-stack/ksapi 2.10.2 → 2.11.0

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.
@@ -369,6 +369,8 @@ docs/TimeseriesPoint.md
369
369
  docs/ToolDisplayType.md
370
370
  docs/ToolPart.md
371
371
  docs/ToolStatus.md
372
+ docs/TranscriptionResponse.md
373
+ docs/TranscriptionsApi.md
372
374
  docs/TransferOwnerRequest.md
373
375
  docs/TransferOwnerResponse.md
374
376
  docs/TrashApi.md
@@ -472,6 +474,7 @@ src/apis/TenantGroupsApi.ts
472
474
  src/apis/TenantsApi.ts
473
475
  src/apis/ThreadMessagesApi.ts
474
476
  src/apis/ThreadsApi.ts
477
+ src/apis/TranscriptionsApi.ts
475
478
  src/apis/TrashApi.ts
476
479
  src/apis/UserPermissionsApi.ts
477
480
  src/apis/UsersApi.ts
@@ -812,6 +815,7 @@ src/models/TimeseriesPoint.ts
812
815
  src/models/ToolDisplayType.ts
813
816
  src/models/ToolPart.ts
814
817
  src/models/ToolStatus.ts
818
+ src/models/TranscriptionResponse.ts
815
819
  src/models/TransferOwnerRequest.ts
816
820
  src/models/TransferOwnerResponse.ts
817
821
  src/models/TrashItemDetailResponse.ts
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # @knowledge-stack/ksapi@2.10.2
1
+ # @knowledge-stack/ksapi@2.11.0
2
2
 
3
3
  A TypeScript SDK client for the localhost API.
4
4
 
@@ -258,6 +258,7 @@ All URIs are relative to *http://localhost:8000*
258
258
  *ThreadsApi* | [**sendUserMessage**](docs/ThreadsApi.md#sendusermessage) | **POST** /v1/threads/{thread_id}/user_message | Send User Message Handler
259
259
  *ThreadsApi* | [**streamThread**](docs/ThreadsApi.md#streamthread) | **GET** /v1/threads/{thread_id}/stream | Stream Thread Handler
260
260
  *ThreadsApi* | [**updateThread**](docs/ThreadsApi.md#updatethreadoperation) | **PATCH** /v1/threads/{thread_id} | Update Thread Handler
261
+ *TranscriptionsApi* | [**createTranscription**](docs/TranscriptionsApi.md#createtranscription) | **POST** /v1/transcriptions | Create Transcription Handler
261
262
  *TrashApi* | [**bulkPermanentlyDeleteTrash**](docs/TrashApi.md#bulkpermanentlydeletetrash) | **POST** /v1/trash/bulk-delete | Bulk Permanently Delete Trash Handler
262
263
  *TrashApi* | [**bulkRestoreTrash**](docs/TrashApi.md#bulkrestoretrash) | **POST** /v1/trash/bulk-restore | Bulk Restore Trash Handler
263
264
  *TrashApi* | [**getTrashItem**](docs/TrashApi.md#gettrashitem) | **GET** /v1/trash/{path_part_id} | Get Trash Item Handler
@@ -636,6 +637,7 @@ All URIs are relative to *http://localhost:8000*
636
637
  - [ToolDisplayType](docs/ToolDisplayType.md)
637
638
  - [ToolPart](docs/ToolPart.md)
638
639
  - [ToolStatus](docs/ToolStatus.md)
640
+ - [TranscriptionResponse](docs/TranscriptionResponse.md)
639
641
  - [TransferOwnerRequest](docs/TransferOwnerRequest.md)
640
642
  - [TransferOwnerResponse](docs/TransferOwnerResponse.md)
641
643
  - [TrashItemDetailResponse](docs/TrashItemDetailResponse.md)
@@ -722,7 +724,7 @@ and is automatically generated by the
722
724
  [OpenAPI Generator](https://openapi-generator.tech) project:
723
725
 
724
726
  - API version: `0.1.0`
725
- - Package version: `2.10.2`
727
+ - Package version: `2.11.0`
726
728
  - Generator version: `7.21.0`
727
729
  - Build package: `org.openapitools.codegen.languages.TypeScriptFetchClientCodegen`
728
730
 
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Knowledge Stack API
3
+ * Knowledge Stack backend API for authentication and knowledge management. ## Integrating (RPA / machine clients) **Base URL.** Knowledge Stack is self-hosted — point at your own deployment host (see `servers`). The `localhost` entry is for local development only. **Authentication.** Send `Authorization: Bearer <api-key>` on every request. Mint an API key once via `POST /v1/api-keys` from a signed-in browser session; the raw `sk-user-...` secret is returned **only** at creation, so store it then. A key inherits its owning user\'s live tenant role and path permissions — create RPA keys from a least-privilege user, and set `expires_at` for rotation. The `ks_uat` cookie scheme is browser-only and cannot be used by headless clients. **Async work is polled, not pushed.** There are no outbound webhooks. - `POST /v1/documents/ingest` returns `201` immediately with a `workflow_id`; poll `GET /v1/system-jobs/document_versions/{workflow_id}` until `status` is terminal (anything other than `pending`/`processing`). The `Location` response header points at this poll resource. - `POST /v1/workflow-runs/{run_id}/start` returns `202`; poll `GET /v1/workflow-runs/{run_id}` until `execution_state` is `COMPLETED` or `FAILED`. The `Location` header points at the run resource. - `POST /v1/agent/ask` is **synchronous** — it blocks until the agent finishes and returns the answer inline. Use a generous HTTP timeout. **Pagination.** List endpoints accept `limit`/`offset` and return `{items, total, limit, offset}`. **Errors.** Every non-2xx body is `{detail, code, request_id}`. `code` is a stable value from a closed set (see the `ErrorResponse` schema\'s `code` enum) — branch on it rather than parsing `detail`. Quota rejections return `429` with a `Retry-After` header; transient lock contention returns a retryable `503`. Quote `request_id` (also the `x-request-id` response header) to support. **Idempotency.** `POST /v1/workflow-runs` accepts an `idempotency_key` to dedupe retried run creation. `agent/ask` charges one message *before* running and does not refund a client-cancelled call.
4
+ *
5
+ * The version of the OpenAPI document: 0.1.0
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ import * as runtime from '../runtime';
13
+ import type { SupportedLanguage, TranscriptionResponse } from '../models/index';
14
+ export interface CreateTranscriptionRequest {
15
+ file: Blob;
16
+ language?: SupportedLanguage;
17
+ }
18
+ /**
19
+ * TranscriptionsApi - interface
20
+ *
21
+ * @export
22
+ * @interface TranscriptionsApiInterface
23
+ */
24
+ export interface TranscriptionsApiInterface {
25
+ /**
26
+ * Creates request options for createTranscription without sending the request
27
+ * @param {Blob} file The audio clip. Accepts what a browser records (audio/webm, audio/ogg, audio/mp4) plus audio/mpeg, audio/wav and audio/flac. Re-encoded server-side, so the container does not have to match the backend.
28
+ * @param {SupportedLanguage} [language]
29
+ * @throws {RequiredError}
30
+ * @memberof TranscriptionsApiInterface
31
+ */
32
+ createTranscriptionRequestOpts(requestParameters: CreateTranscriptionRequest): Promise<runtime.RequestOpts>;
33
+ /**
34
+ * Transcribe a short spoken clip to text. **Answers synchronously.** Unlike document ingestion there is no `Location` header and nothing to poll — the transcript is in the response body. Expect roughly a second per 10s of audio. Send `multipart/form-data` with a `file` part; add `language` only to pin `zh` or `en` instead of auto-detecting. The clip is re-encoded server-side to mono 16 kHz mp3, so any listed container works. Limits: **25 MiB** and **5 min** per clip. Errors, all carrying the standard `code`/`request_id` body: `413` clip over either limit · `415` content type not accepted · `422` empty clip, or audio that could not be decoded · `503` the speech backend is unreachable or unconfigured. The audio is held for one ASR call and never persisted; the transcript is never logged.
35
+ * @summary Create Transcription Handler
36
+ * @param {Blob} file The audio clip. Accepts what a browser records (audio/webm, audio/ogg, audio/mp4) plus audio/mpeg, audio/wav and audio/flac. Re-encoded server-side, so the container does not have to match the backend.
37
+ * @param {SupportedLanguage} [language]
38
+ * @param {*} [options] Override http request option.
39
+ * @throws {RequiredError}
40
+ * @memberof TranscriptionsApiInterface
41
+ */
42
+ createTranscriptionRaw(requestParameters: CreateTranscriptionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<TranscriptionResponse>>;
43
+ /**
44
+ * Transcribe a short spoken clip to text. **Answers synchronously.** Unlike document ingestion there is no `Location` header and nothing to poll — the transcript is in the response body. Expect roughly a second per 10s of audio. Send `multipart/form-data` with a `file` part; add `language` only to pin `zh` or `en` instead of auto-detecting. The clip is re-encoded server-side to mono 16 kHz mp3, so any listed container works. Limits: **25 MiB** and **5 min** per clip. Errors, all carrying the standard `code`/`request_id` body: `413` clip over either limit · `415` content type not accepted · `422` empty clip, or audio that could not be decoded · `503` the speech backend is unreachable or unconfigured. The audio is held for one ASR call and never persisted; the transcript is never logged.
45
+ * Create Transcription Handler
46
+ */
47
+ createTranscription(requestParameters: CreateTranscriptionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<TranscriptionResponse>;
48
+ }
49
+ /**
50
+ *
51
+ */
52
+ export declare class TranscriptionsApi extends runtime.BaseAPI implements TranscriptionsApiInterface {
53
+ /**
54
+ * Creates request options for createTranscription without sending the request
55
+ */
56
+ createTranscriptionRequestOpts(requestParameters: CreateTranscriptionRequest): Promise<runtime.RequestOpts>;
57
+ /**
58
+ * Transcribe a short spoken clip to text. **Answers synchronously.** Unlike document ingestion there is no `Location` header and nothing to poll — the transcript is in the response body. Expect roughly a second per 10s of audio. Send `multipart/form-data` with a `file` part; add `language` only to pin `zh` or `en` instead of auto-detecting. The clip is re-encoded server-side to mono 16 kHz mp3, so any listed container works. Limits: **25 MiB** and **5 min** per clip. Errors, all carrying the standard `code`/`request_id` body: `413` clip over either limit · `415` content type not accepted · `422` empty clip, or audio that could not be decoded · `503` the speech backend is unreachable or unconfigured. The audio is held for one ASR call and never persisted; the transcript is never logged.
59
+ * Create Transcription Handler
60
+ */
61
+ createTranscriptionRaw(requestParameters: CreateTranscriptionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<TranscriptionResponse>>;
62
+ /**
63
+ * Transcribe a short spoken clip to text. **Answers synchronously.** Unlike document ingestion there is no `Location` header and nothing to poll — the transcript is in the response body. Expect roughly a second per 10s of audio. Send `multipart/form-data` with a `file` part; add `language` only to pin `zh` or `en` instead of auto-detecting. The clip is re-encoded server-side to mono 16 kHz mp3, so any listed container works. Limits: **25 MiB** and **5 min** per clip. Errors, all carrying the standard `code`/`request_id` body: `413` clip over either limit · `415` content type not accepted · `422` empty clip, or audio that could not be decoded · `503` the speech backend is unreachable or unconfigured. The audio is held for one ASR call and never persisted; the transcript is never logged.
64
+ * Create Transcription Handler
65
+ */
66
+ createTranscription(requestParameters: CreateTranscriptionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<TranscriptionResponse>;
67
+ }
@@ -0,0 +1,135 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * Knowledge Stack API
6
+ * Knowledge Stack backend API for authentication and knowledge management. ## Integrating (RPA / machine clients) **Base URL.** Knowledge Stack is self-hosted — point at your own deployment host (see `servers`). The `localhost` entry is for local development only. **Authentication.** Send `Authorization: Bearer <api-key>` on every request. Mint an API key once via `POST /v1/api-keys` from a signed-in browser session; the raw `sk-user-...` secret is returned **only** at creation, so store it then. A key inherits its owning user\'s live tenant role and path permissions — create RPA keys from a least-privilege user, and set `expires_at` for rotation. The `ks_uat` cookie scheme is browser-only and cannot be used by headless clients. **Async work is polled, not pushed.** There are no outbound webhooks. - `POST /v1/documents/ingest` returns `201` immediately with a `workflow_id`; poll `GET /v1/system-jobs/document_versions/{workflow_id}` until `status` is terminal (anything other than `pending`/`processing`). The `Location` response header points at this poll resource. - `POST /v1/workflow-runs/{run_id}/start` returns `202`; poll `GET /v1/workflow-runs/{run_id}` until `execution_state` is `COMPLETED` or `FAILED`. The `Location` header points at the run resource. - `POST /v1/agent/ask` is **synchronous** — it blocks until the agent finishes and returns the answer inline. Use a generous HTTP timeout. **Pagination.** List endpoints accept `limit`/`offset` and return `{items, total, limit, offset}`. **Errors.** Every non-2xx body is `{detail, code, request_id}`. `code` is a stable value from a closed set (see the `ErrorResponse` schema\'s `code` enum) — branch on it rather than parsing `detail`. Quota rejections return `429` with a `Retry-After` header; transient lock contention returns a retryable `503`. Quote `request_id` (also the `x-request-id` response header) to support. **Idempotency.** `POST /v1/workflow-runs` accepts an `idempotency_key` to dedupe retried run creation. `agent/ask` charges one message *before* running and does not refund a client-cancelled call.
7
+ *
8
+ * The version of the OpenAPI document: 0.1.0
9
+ *
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ var desc = Object.getOwnPropertyDescriptor(m, k);
18
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
19
+ desc = { enumerable: true, get: function() { return m[k]; } };
20
+ }
21
+ Object.defineProperty(o, k2, desc);
22
+ }) : (function(o, m, k, k2) {
23
+ if (k2 === undefined) k2 = k;
24
+ o[k2] = m[k];
25
+ }));
26
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
27
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
28
+ }) : function(o, v) {
29
+ o["default"] = v;
30
+ });
31
+ var __importStar = (this && this.__importStar) || (function () {
32
+ var ownKeys = function(o) {
33
+ ownKeys = Object.getOwnPropertyNames || function (o) {
34
+ var ar = [];
35
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
36
+ return ar;
37
+ };
38
+ return ownKeys(o);
39
+ };
40
+ return function (mod) {
41
+ if (mod && mod.__esModule) return mod;
42
+ var result = {};
43
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
44
+ __setModuleDefault(result, mod);
45
+ return result;
46
+ };
47
+ })();
48
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
49
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
50
+ return new (P || (P = Promise))(function (resolve, reject) {
51
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
52
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
53
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
54
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
55
+ });
56
+ };
57
+ Object.defineProperty(exports, "__esModule", { value: true });
58
+ exports.TranscriptionsApi = void 0;
59
+ const runtime = __importStar(require("../runtime"));
60
+ const index_1 = require("../models/index");
61
+ /**
62
+ *
63
+ */
64
+ class TranscriptionsApi extends runtime.BaseAPI {
65
+ /**
66
+ * Creates request options for createTranscription without sending the request
67
+ */
68
+ createTranscriptionRequestOpts(requestParameters) {
69
+ return __awaiter(this, void 0, void 0, function* () {
70
+ if (requestParameters['file'] == null) {
71
+ throw new runtime.RequiredError('file', 'Required parameter "file" was null or undefined when calling createTranscription().');
72
+ }
73
+ const queryParameters = {};
74
+ const headerParameters = {};
75
+ if (this.configuration && this.configuration.accessToken) {
76
+ const token = this.configuration.accessToken;
77
+ const tokenString = yield token("bearerAuth", []);
78
+ if (tokenString) {
79
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
80
+ }
81
+ }
82
+ const consumes = [
83
+ { contentType: 'multipart/form-data' },
84
+ ];
85
+ // @ts-ignore: canConsumeForm may be unused
86
+ const canConsumeForm = runtime.canConsumeForm(consumes);
87
+ let formParams;
88
+ let useForm = false;
89
+ // use FormData to transmit files using content-type "multipart/form-data"
90
+ useForm = canConsumeForm;
91
+ if (useForm) {
92
+ formParams = new FormData();
93
+ }
94
+ else {
95
+ formParams = new URLSearchParams();
96
+ }
97
+ if (requestParameters['file'] != null) {
98
+ formParams.append('file', requestParameters['file']);
99
+ }
100
+ if (requestParameters['language'] != null) {
101
+ formParams.append('language', requestParameters['language']);
102
+ }
103
+ let urlPath = `/v1/transcriptions`;
104
+ return {
105
+ path: urlPath,
106
+ method: 'POST',
107
+ headers: headerParameters,
108
+ query: queryParameters,
109
+ body: formParams,
110
+ };
111
+ });
112
+ }
113
+ /**
114
+ * Transcribe a short spoken clip to text. **Answers synchronously.** Unlike document ingestion there is no `Location` header and nothing to poll — the transcript is in the response body. Expect roughly a second per 10s of audio. Send `multipart/form-data` with a `file` part; add `language` only to pin `zh` or `en` instead of auto-detecting. The clip is re-encoded server-side to mono 16 kHz mp3, so any listed container works. Limits: **25 MiB** and **5 min** per clip. Errors, all carrying the standard `code`/`request_id` body: `413` clip over either limit · `415` content type not accepted · `422` empty clip, or audio that could not be decoded · `503` the speech backend is unreachable or unconfigured. The audio is held for one ASR call and never persisted; the transcript is never logged.
115
+ * Create Transcription Handler
116
+ */
117
+ createTranscriptionRaw(requestParameters, initOverrides) {
118
+ return __awaiter(this, void 0, void 0, function* () {
119
+ const requestOptions = yield this.createTranscriptionRequestOpts(requestParameters);
120
+ const response = yield this.request(requestOptions, initOverrides);
121
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.TranscriptionResponseFromJSON)(jsonValue));
122
+ });
123
+ }
124
+ /**
125
+ * Transcribe a short spoken clip to text. **Answers synchronously.** Unlike document ingestion there is no `Location` header and nothing to poll — the transcript is in the response body. Expect roughly a second per 10s of audio. Send `multipart/form-data` with a `file` part; add `language` only to pin `zh` or `en` instead of auto-detecting. The clip is re-encoded server-side to mono 16 kHz mp3, so any listed container works. Limits: **25 MiB** and **5 min** per clip. Errors, all carrying the standard `code`/`request_id` body: `413` clip over either limit · `415` content type not accepted · `422` empty clip, or audio that could not be decoded · `503` the speech backend is unreachable or unconfigured. The audio is held for one ASR call and never persisted; the transcript is never logged.
126
+ * Create Transcription Handler
127
+ */
128
+ createTranscription(requestParameters, initOverrides) {
129
+ return __awaiter(this, void 0, void 0, function* () {
130
+ const response = yield this.createTranscriptionRaw(requestParameters, initOverrides);
131
+ return yield response.value();
132
+ });
133
+ }
134
+ }
135
+ exports.TranscriptionsApi = TranscriptionsApi;
@@ -33,6 +33,7 @@ export * from './TenantGroupsApi';
33
33
  export * from './TenantsApi';
34
34
  export * from './ThreadMessagesApi';
35
35
  export * from './ThreadsApi';
36
+ export * from './TranscriptionsApi';
36
37
  export * from './TrashApi';
37
38
  export * from './UserPermissionsApi';
38
39
  export * from './UsersApi';
@@ -51,6 +51,7 @@ __exportStar(require("./TenantGroupsApi"), exports);
51
51
  __exportStar(require("./TenantsApi"), exports);
52
52
  __exportStar(require("./ThreadMessagesApi"), exports);
53
53
  __exportStar(require("./ThreadsApi"), exports);
54
+ __exportStar(require("./TranscriptionsApi"), exports);
54
55
  __exportStar(require("./TrashApi"), exports);
55
56
  __exportStar(require("./UserPermissionsApi"), exports);
56
57
  __exportStar(require("./UsersApi"), exports);
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Knowledge Stack API
3
+ * Knowledge Stack backend API for authentication and knowledge management. ## Integrating (RPA / machine clients) **Base URL.** Knowledge Stack is self-hosted — point at your own deployment host (see `servers`). The `localhost` entry is for local development only. **Authentication.** Send `Authorization: Bearer <api-key>` on every request. Mint an API key once via `POST /v1/api-keys` from a signed-in browser session; the raw `sk-user-...` secret is returned **only** at creation, so store it then. A key inherits its owning user\'s live tenant role and path permissions — create RPA keys from a least-privilege user, and set `expires_at` for rotation. The `ks_uat` cookie scheme is browser-only and cannot be used by headless clients. **Async work is polled, not pushed.** There are no outbound webhooks. - `POST /v1/documents/ingest` returns `201` immediately with a `workflow_id`; poll `GET /v1/system-jobs/document_versions/{workflow_id}` until `status` is terminal (anything other than `pending`/`processing`). The `Location` response header points at this poll resource. - `POST /v1/workflow-runs/{run_id}/start` returns `202`; poll `GET /v1/workflow-runs/{run_id}` until `execution_state` is `COMPLETED` or `FAILED`. The `Location` header points at the run resource. - `POST /v1/agent/ask` is **synchronous** — it blocks until the agent finishes and returns the answer inline. Use a generous HTTP timeout. **Pagination.** List endpoints accept `limit`/`offset` and return `{items, total, limit, offset}`. **Errors.** Every non-2xx body is `{detail, code, request_id}`. `code` is a stable value from a closed set (see the `ErrorResponse` schema\'s `code` enum) — branch on it rather than parsing `detail`. Quota rejections return `429` with a `Retry-After` header; transient lock contention returns a retryable `503`. Quote `request_id` (also the `x-request-id` response header) to support. **Idempotency.** `POST /v1/workflow-runs` accepts an `idempotency_key` to dedupe retried run creation. `agent/ask` charges one message *before* running and does not refund a client-cancelled call.
4
+ *
5
+ * The version of the OpenAPI document: 0.1.0
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ import * as runtime from '../runtime';
13
+ import type { SupportedLanguage, TranscriptionResponse } from '../models/index';
14
+ export interface CreateTranscriptionRequest {
15
+ file: Blob;
16
+ language?: SupportedLanguage;
17
+ }
18
+ /**
19
+ * TranscriptionsApi - interface
20
+ *
21
+ * @export
22
+ * @interface TranscriptionsApiInterface
23
+ */
24
+ export interface TranscriptionsApiInterface {
25
+ /**
26
+ * Creates request options for createTranscription without sending the request
27
+ * @param {Blob} file The audio clip. Accepts what a browser records (audio/webm, audio/ogg, audio/mp4) plus audio/mpeg, audio/wav and audio/flac. Re-encoded server-side, so the container does not have to match the backend.
28
+ * @param {SupportedLanguage} [language]
29
+ * @throws {RequiredError}
30
+ * @memberof TranscriptionsApiInterface
31
+ */
32
+ createTranscriptionRequestOpts(requestParameters: CreateTranscriptionRequest): Promise<runtime.RequestOpts>;
33
+ /**
34
+ * Transcribe a short spoken clip to text. **Answers synchronously.** Unlike document ingestion there is no `Location` header and nothing to poll — the transcript is in the response body. Expect roughly a second per 10s of audio. Send `multipart/form-data` with a `file` part; add `language` only to pin `zh` or `en` instead of auto-detecting. The clip is re-encoded server-side to mono 16 kHz mp3, so any listed container works. Limits: **25 MiB** and **5 min** per clip. Errors, all carrying the standard `code`/`request_id` body: `413` clip over either limit · `415` content type not accepted · `422` empty clip, or audio that could not be decoded · `503` the speech backend is unreachable or unconfigured. The audio is held for one ASR call and never persisted; the transcript is never logged.
35
+ * @summary Create Transcription Handler
36
+ * @param {Blob} file The audio clip. Accepts what a browser records (audio/webm, audio/ogg, audio/mp4) plus audio/mpeg, audio/wav and audio/flac. Re-encoded server-side, so the container does not have to match the backend.
37
+ * @param {SupportedLanguage} [language]
38
+ * @param {*} [options] Override http request option.
39
+ * @throws {RequiredError}
40
+ * @memberof TranscriptionsApiInterface
41
+ */
42
+ createTranscriptionRaw(requestParameters: CreateTranscriptionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<TranscriptionResponse>>;
43
+ /**
44
+ * Transcribe a short spoken clip to text. **Answers synchronously.** Unlike document ingestion there is no `Location` header and nothing to poll — the transcript is in the response body. Expect roughly a second per 10s of audio. Send `multipart/form-data` with a `file` part; add `language` only to pin `zh` or `en` instead of auto-detecting. The clip is re-encoded server-side to mono 16 kHz mp3, so any listed container works. Limits: **25 MiB** and **5 min** per clip. Errors, all carrying the standard `code`/`request_id` body: `413` clip over either limit · `415` content type not accepted · `422` empty clip, or audio that could not be decoded · `503` the speech backend is unreachable or unconfigured. The audio is held for one ASR call and never persisted; the transcript is never logged.
45
+ * Create Transcription Handler
46
+ */
47
+ createTranscription(requestParameters: CreateTranscriptionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<TranscriptionResponse>;
48
+ }
49
+ /**
50
+ *
51
+ */
52
+ export declare class TranscriptionsApi extends runtime.BaseAPI implements TranscriptionsApiInterface {
53
+ /**
54
+ * Creates request options for createTranscription without sending the request
55
+ */
56
+ createTranscriptionRequestOpts(requestParameters: CreateTranscriptionRequest): Promise<runtime.RequestOpts>;
57
+ /**
58
+ * Transcribe a short spoken clip to text. **Answers synchronously.** Unlike document ingestion there is no `Location` header and nothing to poll — the transcript is in the response body. Expect roughly a second per 10s of audio. Send `multipart/form-data` with a `file` part; add `language` only to pin `zh` or `en` instead of auto-detecting. The clip is re-encoded server-side to mono 16 kHz mp3, so any listed container works. Limits: **25 MiB** and **5 min** per clip. Errors, all carrying the standard `code`/`request_id` body: `413` clip over either limit · `415` content type not accepted · `422` empty clip, or audio that could not be decoded · `503` the speech backend is unreachable or unconfigured. The audio is held for one ASR call and never persisted; the transcript is never logged.
59
+ * Create Transcription Handler
60
+ */
61
+ createTranscriptionRaw(requestParameters: CreateTranscriptionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<TranscriptionResponse>>;
62
+ /**
63
+ * Transcribe a short spoken clip to text. **Answers synchronously.** Unlike document ingestion there is no `Location` header and nothing to poll — the transcript is in the response body. Expect roughly a second per 10s of audio. Send `multipart/form-data` with a `file` part; add `language` only to pin `zh` or `en` instead of auto-detecting. The clip is re-encoded server-side to mono 16 kHz mp3, so any listed container works. Limits: **25 MiB** and **5 min** per clip. Errors, all carrying the standard `code`/`request_id` body: `413` clip over either limit · `415` content type not accepted · `422` empty clip, or audio that could not be decoded · `503` the speech backend is unreachable or unconfigured. The audio is held for one ASR call and never persisted; the transcript is never logged.
64
+ * Create Transcription Handler
65
+ */
66
+ createTranscription(requestParameters: CreateTranscriptionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<TranscriptionResponse>;
67
+ }
@@ -0,0 +1,98 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Knowledge Stack API
5
+ * Knowledge Stack backend API for authentication and knowledge management. ## Integrating (RPA / machine clients) **Base URL.** Knowledge Stack is self-hosted — point at your own deployment host (see `servers`). The `localhost` entry is for local development only. **Authentication.** Send `Authorization: Bearer <api-key>` on every request. Mint an API key once via `POST /v1/api-keys` from a signed-in browser session; the raw `sk-user-...` secret is returned **only** at creation, so store it then. A key inherits its owning user\'s live tenant role and path permissions — create RPA keys from a least-privilege user, and set `expires_at` for rotation. The `ks_uat` cookie scheme is browser-only and cannot be used by headless clients. **Async work is polled, not pushed.** There are no outbound webhooks. - `POST /v1/documents/ingest` returns `201` immediately with a `workflow_id`; poll `GET /v1/system-jobs/document_versions/{workflow_id}` until `status` is terminal (anything other than `pending`/`processing`). The `Location` response header points at this poll resource. - `POST /v1/workflow-runs/{run_id}/start` returns `202`; poll `GET /v1/workflow-runs/{run_id}` until `execution_state` is `COMPLETED` or `FAILED`. The `Location` header points at the run resource. - `POST /v1/agent/ask` is **synchronous** — it blocks until the agent finishes and returns the answer inline. Use a generous HTTP timeout. **Pagination.** List endpoints accept `limit`/`offset` and return `{items, total, limit, offset}`. **Errors.** Every non-2xx body is `{detail, code, request_id}`. `code` is a stable value from a closed set (see the `ErrorResponse` schema\'s `code` enum) — branch on it rather than parsing `detail`. Quota rejections return `429` with a `Retry-After` header; transient lock contention returns a retryable `503`. Quote `request_id` (also the `x-request-id` response header) to support. **Idempotency.** `POST /v1/workflow-runs` accepts an `idempotency_key` to dedupe retried run creation. `agent/ask` charges one message *before* running and does not refund a client-cancelled call.
6
+ *
7
+ * The version of the OpenAPI document: 0.1.0
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
+ return new (P || (P = Promise))(function (resolve, reject) {
17
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
21
+ });
22
+ };
23
+ import * as runtime from '../runtime';
24
+ import { TranscriptionResponseFromJSON, } from '../models/index';
25
+ /**
26
+ *
27
+ */
28
+ export class TranscriptionsApi extends runtime.BaseAPI {
29
+ /**
30
+ * Creates request options for createTranscription without sending the request
31
+ */
32
+ createTranscriptionRequestOpts(requestParameters) {
33
+ return __awaiter(this, void 0, void 0, function* () {
34
+ if (requestParameters['file'] == null) {
35
+ throw new runtime.RequiredError('file', 'Required parameter "file" was null or undefined when calling createTranscription().');
36
+ }
37
+ const queryParameters = {};
38
+ const headerParameters = {};
39
+ if (this.configuration && this.configuration.accessToken) {
40
+ const token = this.configuration.accessToken;
41
+ const tokenString = yield token("bearerAuth", []);
42
+ if (tokenString) {
43
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
44
+ }
45
+ }
46
+ const consumes = [
47
+ { contentType: 'multipart/form-data' },
48
+ ];
49
+ // @ts-ignore: canConsumeForm may be unused
50
+ const canConsumeForm = runtime.canConsumeForm(consumes);
51
+ let formParams;
52
+ let useForm = false;
53
+ // use FormData to transmit files using content-type "multipart/form-data"
54
+ useForm = canConsumeForm;
55
+ if (useForm) {
56
+ formParams = new FormData();
57
+ }
58
+ else {
59
+ formParams = new URLSearchParams();
60
+ }
61
+ if (requestParameters['file'] != null) {
62
+ formParams.append('file', requestParameters['file']);
63
+ }
64
+ if (requestParameters['language'] != null) {
65
+ formParams.append('language', requestParameters['language']);
66
+ }
67
+ let urlPath = `/v1/transcriptions`;
68
+ return {
69
+ path: urlPath,
70
+ method: 'POST',
71
+ headers: headerParameters,
72
+ query: queryParameters,
73
+ body: formParams,
74
+ };
75
+ });
76
+ }
77
+ /**
78
+ * Transcribe a short spoken clip to text. **Answers synchronously.** Unlike document ingestion there is no `Location` header and nothing to poll — the transcript is in the response body. Expect roughly a second per 10s of audio. Send `multipart/form-data` with a `file` part; add `language` only to pin `zh` or `en` instead of auto-detecting. The clip is re-encoded server-side to mono 16 kHz mp3, so any listed container works. Limits: **25 MiB** and **5 min** per clip. Errors, all carrying the standard `code`/`request_id` body: `413` clip over either limit · `415` content type not accepted · `422` empty clip, or audio that could not be decoded · `503` the speech backend is unreachable or unconfigured. The audio is held for one ASR call and never persisted; the transcript is never logged.
79
+ * Create Transcription Handler
80
+ */
81
+ createTranscriptionRaw(requestParameters, initOverrides) {
82
+ return __awaiter(this, void 0, void 0, function* () {
83
+ const requestOptions = yield this.createTranscriptionRequestOpts(requestParameters);
84
+ const response = yield this.request(requestOptions, initOverrides);
85
+ return new runtime.JSONApiResponse(response, (jsonValue) => TranscriptionResponseFromJSON(jsonValue));
86
+ });
87
+ }
88
+ /**
89
+ * Transcribe a short spoken clip to text. **Answers synchronously.** Unlike document ingestion there is no `Location` header and nothing to poll — the transcript is in the response body. Expect roughly a second per 10s of audio. Send `multipart/form-data` with a `file` part; add `language` only to pin `zh` or `en` instead of auto-detecting. The clip is re-encoded server-side to mono 16 kHz mp3, so any listed container works. Limits: **25 MiB** and **5 min** per clip. Errors, all carrying the standard `code`/`request_id` body: `413` clip over either limit · `415` content type not accepted · `422` empty clip, or audio that could not be decoded · `503` the speech backend is unreachable or unconfigured. The audio is held for one ASR call and never persisted; the transcript is never logged.
90
+ * Create Transcription Handler
91
+ */
92
+ createTranscription(requestParameters, initOverrides) {
93
+ return __awaiter(this, void 0, void 0, function* () {
94
+ const response = yield this.createTranscriptionRaw(requestParameters, initOverrides);
95
+ return yield response.value();
96
+ });
97
+ }
98
+ }
@@ -33,6 +33,7 @@ export * from './TenantGroupsApi';
33
33
  export * from './TenantsApi';
34
34
  export * from './ThreadMessagesApi';
35
35
  export * from './ThreadsApi';
36
+ export * from './TranscriptionsApi';
36
37
  export * from './TrashApi';
37
38
  export * from './UserPermissionsApi';
38
39
  export * from './UsersApi';
@@ -35,6 +35,7 @@ export * from './TenantGroupsApi';
35
35
  export * from './TenantsApi';
36
36
  export * from './ThreadMessagesApi';
37
37
  export * from './ThreadsApi';
38
+ export * from './TranscriptionsApi';
38
39
  export * from './TrashApi';
39
40
  export * from './UserPermissionsApi';
40
41
  export * from './UsersApi';
@@ -46,6 +46,8 @@ export declare const ErrorResponseCodeEnum: {
46
46
  readonly NotFound: 'not_found';
47
47
  readonly Conflict: 'conflict';
48
48
  readonly RunBusy: 'run_busy';
49
+ readonly PayloadTooLarge: 'payload_too_large';
50
+ readonly UnsupportedMediaType: 'unsupported_media_type';
49
51
  readonly UnprocessableEntity: 'unprocessable_entity';
50
52
  readonly TooManyRequests: 'too_many_requests';
51
53
  readonly QuotaExceeded: 'quota_exceeded';
@@ -23,6 +23,8 @@ export const ErrorResponseCodeEnum = {
23
23
  NotFound: 'not_found',
24
24
  Conflict: 'conflict',
25
25
  RunBusy: 'run_busy',
26
+ PayloadTooLarge: 'payload_too_large',
27
+ UnsupportedMediaType: 'unsupported_media_type',
26
28
  UnprocessableEntity: 'unprocessable_entity',
27
29
  TooManyRequests: 'too_many_requests',
28
30
  QuotaExceeded: 'quota_exceeded',
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Knowledge Stack API
3
+ * Knowledge Stack backend API for authentication and knowledge management. ## Integrating (RPA / machine clients) **Base URL.** Knowledge Stack is self-hosted — point at your own deployment host (see `servers`). The `localhost` entry is for local development only. **Authentication.** Send `Authorization: Bearer <api-key>` on every request. Mint an API key once via `POST /v1/api-keys` from a signed-in browser session; the raw `sk-user-...` secret is returned **only** at creation, so store it then. A key inherits its owning user\'s live tenant role and path permissions — create RPA keys from a least-privilege user, and set `expires_at` for rotation. The `ks_uat` cookie scheme is browser-only and cannot be used by headless clients. **Async work is polled, not pushed.** There are no outbound webhooks. - `POST /v1/documents/ingest` returns `201` immediately with a `workflow_id`; poll `GET /v1/system-jobs/document_versions/{workflow_id}` until `status` is terminal (anything other than `pending`/`processing`). The `Location` response header points at this poll resource. - `POST /v1/workflow-runs/{run_id}/start` returns `202`; poll `GET /v1/workflow-runs/{run_id}` until `execution_state` is `COMPLETED` or `FAILED`. The `Location` header points at the run resource. - `POST /v1/agent/ask` is **synchronous** — it blocks until the agent finishes and returns the answer inline. Use a generous HTTP timeout. **Pagination.** List endpoints accept `limit`/`offset` and return `{items, total, limit, offset}`. **Errors.** Every non-2xx body is `{detail, code, request_id}`. `code` is a stable value from a closed set (see the `ErrorResponse` schema\'s `code` enum) — branch on it rather than parsing `detail`. Quota rejections return `429` with a `Retry-After` header; transient lock contention returns a retryable `503`. Quote `request_id` (also the `x-request-id` response header) to support. **Idempotency.** `POST /v1/workflow-runs` accepts an `idempotency_key` to dedupe retried run creation. `agent/ask` charges one message *before* running and does not refund a client-cancelled call.
4
+ *
5
+ * The version of the OpenAPI document: 0.1.0
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ /**
13
+ * A spoken clip rendered as text, ready to send as a chat message.
14
+ * @export
15
+ * @interface TranscriptionResponse
16
+ */
17
+ export interface TranscriptionResponse {
18
+ /**
19
+ * The transcript. Empty when the clip contained no speech, which is a success, not an error.
20
+ * @type {string}
21
+ * @memberof TranscriptionResponse
22
+ */
23
+ text: string;
24
+ /**
25
+ * The language ASR detected, or the one the caller pinned. Null when the backend reports none; the text is still valid.
26
+ * @type {string}
27
+ * @memberof TranscriptionResponse
28
+ */
29
+ language?: string | null;
30
+ }
31
+ export declare const TranscriptionResponsePropertyValidationAttributesMap: {
32
+ [property: string]: {
33
+ maxLength?: number;
34
+ minLength?: number;
35
+ pattern?: string;
36
+ maximum?: number;
37
+ exclusiveMaximum?: boolean;
38
+ minimum?: number;
39
+ exclusiveMinimum?: boolean;
40
+ multipleOf?: number;
41
+ maxItems?: number;
42
+ minItems?: number;
43
+ uniqueItems?: boolean;
44
+ };
45
+ };
46
+ /**
47
+ * Check if a given object implements the TranscriptionResponse interface.
48
+ */
49
+ export declare function instanceOfTranscriptionResponse(value: object): value is TranscriptionResponse;
50
+ export declare function TranscriptionResponseFromJSON(json: any): TranscriptionResponse;
51
+ export declare function TranscriptionResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): TranscriptionResponse;
52
+ export declare function TranscriptionResponseToJSON(json: any): TranscriptionResponse;
53
+ export declare function TranscriptionResponseToJSONTyped(value?: TranscriptionResponse | null, ignoreDiscriminator?: boolean): any;
@@ -0,0 +1,46 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Knowledge Stack API
5
+ * Knowledge Stack backend API for authentication and knowledge management. ## Integrating (RPA / machine clients) **Base URL.** Knowledge Stack is self-hosted — point at your own deployment host (see `servers`). The `localhost` entry is for local development only. **Authentication.** Send `Authorization: Bearer <api-key>` on every request. Mint an API key once via `POST /v1/api-keys` from a signed-in browser session; the raw `sk-user-...` secret is returned **only** at creation, so store it then. A key inherits its owning user\'s live tenant role and path permissions — create RPA keys from a least-privilege user, and set `expires_at` for rotation. The `ks_uat` cookie scheme is browser-only and cannot be used by headless clients. **Async work is polled, not pushed.** There are no outbound webhooks. - `POST /v1/documents/ingest` returns `201` immediately with a `workflow_id`; poll `GET /v1/system-jobs/document_versions/{workflow_id}` until `status` is terminal (anything other than `pending`/`processing`). The `Location` response header points at this poll resource. - `POST /v1/workflow-runs/{run_id}/start` returns `202`; poll `GET /v1/workflow-runs/{run_id}` until `execution_state` is `COMPLETED` or `FAILED`. The `Location` header points at the run resource. - `POST /v1/agent/ask` is **synchronous** — it blocks until the agent finishes and returns the answer inline. Use a generous HTTP timeout. **Pagination.** List endpoints accept `limit`/`offset` and return `{items, total, limit, offset}`. **Errors.** Every non-2xx body is `{detail, code, request_id}`. `code` is a stable value from a closed set (see the `ErrorResponse` schema\'s `code` enum) — branch on it rather than parsing `detail`. Quota rejections return `429` with a `Retry-After` header; transient lock contention returns a retryable `503`. Quote `request_id` (also the `x-request-id` response header) to support. **Idempotency.** `POST /v1/workflow-runs` accepts an `idempotency_key` to dedupe retried run creation. `agent/ask` charges one message *before* running and does not refund a client-cancelled call.
6
+ *
7
+ * The version of the OpenAPI document: 0.1.0
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+ export const TranscriptionResponsePropertyValidationAttributesMap = {};
15
+ /**
16
+ * Check if a given object implements the TranscriptionResponse interface.
17
+ */
18
+ export function instanceOfTranscriptionResponse(value) {
19
+ if (!('text' in value) || value['text'] === undefined)
20
+ return false;
21
+ return true;
22
+ }
23
+ export function TranscriptionResponseFromJSON(json) {
24
+ return TranscriptionResponseFromJSONTyped(json, false);
25
+ }
26
+ export function TranscriptionResponseFromJSONTyped(json, ignoreDiscriminator) {
27
+ if (json == null) {
28
+ return json;
29
+ }
30
+ return {
31
+ 'text': json['text'],
32
+ 'language': json['language'] == null ? undefined : json['language'],
33
+ };
34
+ }
35
+ export function TranscriptionResponseToJSON(json) {
36
+ return TranscriptionResponseToJSONTyped(json, false);
37
+ }
38
+ export function TranscriptionResponseToJSONTyped(value, ignoreDiscriminator = false) {
39
+ if (value == null) {
40
+ return value;
41
+ }
42
+ return {
43
+ 'text': value['text'],
44
+ 'language': value['language'],
45
+ };
46
+ }
@@ -330,6 +330,7 @@ export * from './TimeseriesPoint';
330
330
  export * from './ToolDisplayType';
331
331
  export * from './ToolPart';
332
332
  export * from './ToolStatus';
333
+ export * from './TranscriptionResponse';
333
334
  export * from './TransferOwnerRequest';
334
335
  export * from './TransferOwnerResponse';
335
336
  export * from './TrashItemDetailResponse';
@@ -332,6 +332,7 @@ export * from './TimeseriesPoint';
332
332
  export * from './ToolDisplayType';
333
333
  export * from './ToolPart';
334
334
  export * from './ToolStatus';
335
+ export * from './TranscriptionResponse';
335
336
  export * from './TransferOwnerRequest';
336
337
  export * from './TransferOwnerResponse';
337
338
  export * from './TrashItemDetailResponse';
@@ -46,6 +46,8 @@ export declare const ErrorResponseCodeEnum: {
46
46
  readonly NotFound: 'not_found';
47
47
  readonly Conflict: 'conflict';
48
48
  readonly RunBusy: 'run_busy';
49
+ readonly PayloadTooLarge: 'payload_too_large';
50
+ readonly UnsupportedMediaType: 'unsupported_media_type';
49
51
  readonly UnprocessableEntity: 'unprocessable_entity';
50
52
  readonly TooManyRequests: 'too_many_requests';
51
53
  readonly QuotaExceeded: 'quota_exceeded';
@@ -31,6 +31,8 @@ exports.ErrorResponseCodeEnum = {
31
31
  NotFound: 'not_found',
32
32
  Conflict: 'conflict',
33
33
  RunBusy: 'run_busy',
34
+ PayloadTooLarge: 'payload_too_large',
35
+ UnsupportedMediaType: 'unsupported_media_type',
34
36
  UnprocessableEntity: 'unprocessable_entity',
35
37
  TooManyRequests: 'too_many_requests',
36
38
  QuotaExceeded: 'quota_exceeded',
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Knowledge Stack API
3
+ * Knowledge Stack backend API for authentication and knowledge management. ## Integrating (RPA / machine clients) **Base URL.** Knowledge Stack is self-hosted — point at your own deployment host (see `servers`). The `localhost` entry is for local development only. **Authentication.** Send `Authorization: Bearer <api-key>` on every request. Mint an API key once via `POST /v1/api-keys` from a signed-in browser session; the raw `sk-user-...` secret is returned **only** at creation, so store it then. A key inherits its owning user\'s live tenant role and path permissions — create RPA keys from a least-privilege user, and set `expires_at` for rotation. The `ks_uat` cookie scheme is browser-only and cannot be used by headless clients. **Async work is polled, not pushed.** There are no outbound webhooks. - `POST /v1/documents/ingest` returns `201` immediately with a `workflow_id`; poll `GET /v1/system-jobs/document_versions/{workflow_id}` until `status` is terminal (anything other than `pending`/`processing`). The `Location` response header points at this poll resource. - `POST /v1/workflow-runs/{run_id}/start` returns `202`; poll `GET /v1/workflow-runs/{run_id}` until `execution_state` is `COMPLETED` or `FAILED`. The `Location` header points at the run resource. - `POST /v1/agent/ask` is **synchronous** — it blocks until the agent finishes and returns the answer inline. Use a generous HTTP timeout. **Pagination.** List endpoints accept `limit`/`offset` and return `{items, total, limit, offset}`. **Errors.** Every non-2xx body is `{detail, code, request_id}`. `code` is a stable value from a closed set (see the `ErrorResponse` schema\'s `code` enum) — branch on it rather than parsing `detail`. Quota rejections return `429` with a `Retry-After` header; transient lock contention returns a retryable `503`. Quote `request_id` (also the `x-request-id` response header) to support. **Idempotency.** `POST /v1/workflow-runs` accepts an `idempotency_key` to dedupe retried run creation. `agent/ask` charges one message *before* running and does not refund a client-cancelled call.
4
+ *
5
+ * The version of the OpenAPI document: 0.1.0
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ /**
13
+ * A spoken clip rendered as text, ready to send as a chat message.
14
+ * @export
15
+ * @interface TranscriptionResponse
16
+ */
17
+ export interface TranscriptionResponse {
18
+ /**
19
+ * The transcript. Empty when the clip contained no speech, which is a success, not an error.
20
+ * @type {string}
21
+ * @memberof TranscriptionResponse
22
+ */
23
+ text: string;
24
+ /**
25
+ * The language ASR detected, or the one the caller pinned. Null when the backend reports none; the text is still valid.
26
+ * @type {string}
27
+ * @memberof TranscriptionResponse
28
+ */
29
+ language?: string | null;
30
+ }
31
+ export declare const TranscriptionResponsePropertyValidationAttributesMap: {
32
+ [property: string]: {
33
+ maxLength?: number;
34
+ minLength?: number;
35
+ pattern?: string;
36
+ maximum?: number;
37
+ exclusiveMaximum?: boolean;
38
+ minimum?: number;
39
+ exclusiveMinimum?: boolean;
40
+ multipleOf?: number;
41
+ maxItems?: number;
42
+ minItems?: number;
43
+ uniqueItems?: boolean;
44
+ };
45
+ };
46
+ /**
47
+ * Check if a given object implements the TranscriptionResponse interface.
48
+ */
49
+ export declare function instanceOfTranscriptionResponse(value: object): value is TranscriptionResponse;
50
+ export declare function TranscriptionResponseFromJSON(json: any): TranscriptionResponse;
51
+ export declare function TranscriptionResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): TranscriptionResponse;
52
+ export declare function TranscriptionResponseToJSON(json: any): TranscriptionResponse;
53
+ export declare function TranscriptionResponseToJSONTyped(value?: TranscriptionResponse | null, ignoreDiscriminator?: boolean): any;
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * Knowledge Stack API
6
+ * Knowledge Stack backend API for authentication and knowledge management. ## Integrating (RPA / machine clients) **Base URL.** Knowledge Stack is self-hosted — point at your own deployment host (see `servers`). The `localhost` entry is for local development only. **Authentication.** Send `Authorization: Bearer <api-key>` on every request. Mint an API key once via `POST /v1/api-keys` from a signed-in browser session; the raw `sk-user-...` secret is returned **only** at creation, so store it then. A key inherits its owning user\'s live tenant role and path permissions — create RPA keys from a least-privilege user, and set `expires_at` for rotation. The `ks_uat` cookie scheme is browser-only and cannot be used by headless clients. **Async work is polled, not pushed.** There are no outbound webhooks. - `POST /v1/documents/ingest` returns `201` immediately with a `workflow_id`; poll `GET /v1/system-jobs/document_versions/{workflow_id}` until `status` is terminal (anything other than `pending`/`processing`). The `Location` response header points at this poll resource. - `POST /v1/workflow-runs/{run_id}/start` returns `202`; poll `GET /v1/workflow-runs/{run_id}` until `execution_state` is `COMPLETED` or `FAILED`. The `Location` header points at the run resource. - `POST /v1/agent/ask` is **synchronous** — it blocks until the agent finishes and returns the answer inline. Use a generous HTTP timeout. **Pagination.** List endpoints accept `limit`/`offset` and return `{items, total, limit, offset}`. **Errors.** Every non-2xx body is `{detail, code, request_id}`. `code` is a stable value from a closed set (see the `ErrorResponse` schema\'s `code` enum) — branch on it rather than parsing `detail`. Quota rejections return `429` with a `Retry-After` header; transient lock contention returns a retryable `503`. Quote `request_id` (also the `x-request-id` response header) to support. **Idempotency.** `POST /v1/workflow-runs` accepts an `idempotency_key` to dedupe retried run creation. `agent/ask` charges one message *before* running and does not refund a client-cancelled call.
7
+ *
8
+ * The version of the OpenAPI document: 0.1.0
9
+ *
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.TranscriptionResponsePropertyValidationAttributesMap = void 0;
17
+ exports.instanceOfTranscriptionResponse = instanceOfTranscriptionResponse;
18
+ exports.TranscriptionResponseFromJSON = TranscriptionResponseFromJSON;
19
+ exports.TranscriptionResponseFromJSONTyped = TranscriptionResponseFromJSONTyped;
20
+ exports.TranscriptionResponseToJSON = TranscriptionResponseToJSON;
21
+ exports.TranscriptionResponseToJSONTyped = TranscriptionResponseToJSONTyped;
22
+ exports.TranscriptionResponsePropertyValidationAttributesMap = {};
23
+ /**
24
+ * Check if a given object implements the TranscriptionResponse interface.
25
+ */
26
+ function instanceOfTranscriptionResponse(value) {
27
+ if (!('text' in value) || value['text'] === undefined)
28
+ return false;
29
+ return true;
30
+ }
31
+ function TranscriptionResponseFromJSON(json) {
32
+ return TranscriptionResponseFromJSONTyped(json, false);
33
+ }
34
+ function TranscriptionResponseFromJSONTyped(json, ignoreDiscriminator) {
35
+ if (json == null) {
36
+ return json;
37
+ }
38
+ return {
39
+ 'text': json['text'],
40
+ 'language': json['language'] == null ? undefined : json['language'],
41
+ };
42
+ }
43
+ function TranscriptionResponseToJSON(json) {
44
+ return TranscriptionResponseToJSONTyped(json, false);
45
+ }
46
+ function TranscriptionResponseToJSONTyped(value, ignoreDiscriminator = false) {
47
+ if (value == null) {
48
+ return value;
49
+ }
50
+ return {
51
+ 'text': value['text'],
52
+ 'language': value['language'],
53
+ };
54
+ }
@@ -330,6 +330,7 @@ export * from './TimeseriesPoint';
330
330
  export * from './ToolDisplayType';
331
331
  export * from './ToolPart';
332
332
  export * from './ToolStatus';
333
+ export * from './TranscriptionResponse';
333
334
  export * from './TransferOwnerRequest';
334
335
  export * from './TransferOwnerResponse';
335
336
  export * from './TrashItemDetailResponse';
@@ -348,6 +348,7 @@ __exportStar(require("./TimeseriesPoint"), exports);
348
348
  __exportStar(require("./ToolDisplayType"), exports);
349
349
  __exportStar(require("./ToolPart"), exports);
350
350
  __exportStar(require("./ToolStatus"), exports);
351
+ __exportStar(require("./TranscriptionResponse"), exports);
351
352
  __exportStar(require("./TransferOwnerRequest"), exports);
352
353
  __exportStar(require("./TransferOwnerResponse"), exports);
353
354
  __exportStar(require("./TrashItemDetailResponse"), exports);
@@ -0,0 +1,37 @@
1
+
2
+ # TranscriptionResponse
3
+
4
+ A spoken clip rendered as text, ready to send as a chat message.
5
+
6
+ ## Properties
7
+
8
+ Name | Type
9
+ ------------ | -------------
10
+ `text` | string
11
+ `language` | string
12
+
13
+ ## Example
14
+
15
+ ```typescript
16
+ import type { TranscriptionResponse } from '@knowledge-stack/ksapi'
17
+
18
+ // TODO: Update the object below with actual values
19
+ const example = {
20
+ "text": 请帮我总结这份文档,
21
+ "language": zh,
22
+ } satisfies TranscriptionResponse
23
+
24
+ console.log(example)
25
+
26
+ // Convert the instance to a JSON string
27
+ const exampleJSON: string = JSON.stringify(example)
28
+ console.log(exampleJSON)
29
+
30
+ // Parse the JSON string back to an object
31
+ const exampleParsed = JSON.parse(exampleJSON) as TranscriptionResponse
32
+ console.log(exampleParsed)
33
+ ```
34
+
35
+ [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
36
+
37
+
@@ -0,0 +1,87 @@
1
+ # TranscriptionsApi
2
+
3
+ All URIs are relative to *http://localhost:8000*
4
+
5
+ | Method | HTTP request | Description |
6
+ |------------- | ------------- | -------------|
7
+ | [**createTranscription**](TranscriptionsApi.md#createtranscription) | **POST** /v1/transcriptions | Create Transcription Handler |
8
+
9
+
10
+
11
+ ## createTranscription
12
+
13
+ > TranscriptionResponse createTranscription(file, language)
14
+
15
+ Create Transcription Handler
16
+
17
+ Transcribe a short spoken clip to text. **Answers synchronously.** Unlike document ingestion there is no &#x60;Location&#x60; header and nothing to poll — the transcript is in the response body. Expect roughly a second per 10s of audio. Send &#x60;multipart/form-data&#x60; with a &#x60;file&#x60; part; add &#x60;language&#x60; only to pin &#x60;zh&#x60; or &#x60;en&#x60; instead of auto-detecting. The clip is re-encoded server-side to mono 16 kHz mp3, so any listed container works. Limits: **25 MiB** and **5 min** per clip. Errors, all carrying the standard &#x60;code&#x60;/&#x60;request_id&#x60; body: &#x60;413&#x60; clip over either limit · &#x60;415&#x60; content type not accepted · &#x60;422&#x60; empty clip, or audio that could not be decoded · &#x60;503&#x60; the speech backend is unreachable or unconfigured. The audio is held for one ASR call and never persisted; the transcript is never logged.
18
+
19
+ ### Example
20
+
21
+ ```ts
22
+ import {
23
+ Configuration,
24
+ TranscriptionsApi,
25
+ } from '@knowledge-stack/ksapi';
26
+ import type { CreateTranscriptionRequest } from '@knowledge-stack/ksapi';
27
+
28
+ async function example() {
29
+ console.log("🚀 Testing @knowledge-stack/ksapi SDK...");
30
+ const config = new Configuration({
31
+ // To configure API key authorization: cookieAuth
32
+ apiKey: "YOUR API KEY",
33
+ // Configure HTTP bearer authorization: bearerAuth
34
+ accessToken: "YOUR BEARER TOKEN",
35
+ });
36
+ const api = new TranscriptionsApi(config);
37
+
38
+ const body = {
39
+ // Blob | The audio clip. Accepts what a browser records (audio/webm, audio/ogg, audio/mp4) plus audio/mpeg, audio/wav and audio/flac. Re-encoded server-side, so the container does not have to match the backend.
40
+ file: BINARY_DATA_HERE,
41
+ // SupportedLanguage (optional)
42
+ language: ...,
43
+ } satisfies CreateTranscriptionRequest;
44
+
45
+ try {
46
+ const data = await api.createTranscription(body);
47
+ console.log(data);
48
+ } catch (error) {
49
+ console.error(error);
50
+ }
51
+ }
52
+
53
+ // Run the test
54
+ example().catch(console.error);
55
+ ```
56
+
57
+ ### Parameters
58
+
59
+
60
+ | Name | Type | Description | Notes |
61
+ |------------- | ------------- | ------------- | -------------|
62
+ | **file** | `Blob` | The audio clip. Accepts what a browser records (audio/webm, audio/ogg, audio/mp4) plus audio/mpeg, audio/wav and audio/flac. Re-encoded server-side, so the container does not have to match the backend. | [Defaults to `undefined`] |
63
+ | **language** | `SupportedLanguage` | | [Optional] [Defaults to `undefined`] [Enum: en, zh] |
64
+
65
+ ### Return type
66
+
67
+ [**TranscriptionResponse**](TranscriptionResponse.md)
68
+
69
+ ### Authorization
70
+
71
+ [cookieAuth](../README.md#cookieAuth), [bearerAuth](../README.md#bearerAuth)
72
+
73
+ ### HTTP request headers
74
+
75
+ - **Content-Type**: `multipart/form-data`
76
+ - **Accept**: `application/json`
77
+
78
+
79
+ ### HTTP response details
80
+ | Status code | Description | Response headers |
81
+ |-------------|-------------|------------------|
82
+ | **200** | Successful Response | - |
83
+ | **422** | Validation Error | - |
84
+ | **0** | Error response. | - |
85
+
86
+ [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
87
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knowledge-stack/ksapi",
3
- "version": "2.10.2",
3
+ "version": "2.11.0",
4
4
  "description": "OpenAPI client for @knowledge-stack/ksapi",
5
5
  "author": "OpenAPI-Generator",
6
6
  "repository": {
@@ -0,0 +1,158 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Knowledge Stack API
5
+ * Knowledge Stack backend API for authentication and knowledge management. ## Integrating (RPA / machine clients) **Base URL.** Knowledge Stack is self-hosted — point at your own deployment host (see `servers`). The `localhost` entry is for local development only. **Authentication.** Send `Authorization: Bearer <api-key>` on every request. Mint an API key once via `POST /v1/api-keys` from a signed-in browser session; the raw `sk-user-...` secret is returned **only** at creation, so store it then. A key inherits its owning user\'s live tenant role and path permissions — create RPA keys from a least-privilege user, and set `expires_at` for rotation. The `ks_uat` cookie scheme is browser-only and cannot be used by headless clients. **Async work is polled, not pushed.** There are no outbound webhooks. - `POST /v1/documents/ingest` returns `201` immediately with a `workflow_id`; poll `GET /v1/system-jobs/document_versions/{workflow_id}` until `status` is terminal (anything other than `pending`/`processing`). The `Location` response header points at this poll resource. - `POST /v1/workflow-runs/{run_id}/start` returns `202`; poll `GET /v1/workflow-runs/{run_id}` until `execution_state` is `COMPLETED` or `FAILED`. The `Location` header points at the run resource. - `POST /v1/agent/ask` is **synchronous** — it blocks until the agent finishes and returns the answer inline. Use a generous HTTP timeout. **Pagination.** List endpoints accept `limit`/`offset` and return `{items, total, limit, offset}`. **Errors.** Every non-2xx body is `{detail, code, request_id}`. `code` is a stable value from a closed set (see the `ErrorResponse` schema\'s `code` enum) — branch on it rather than parsing `detail`. Quota rejections return `429` with a `Retry-After` header; transient lock contention returns a retryable `503`. Quote `request_id` (also the `x-request-id` response header) to support. **Idempotency.** `POST /v1/workflow-runs` accepts an `idempotency_key` to dedupe retried run creation. `agent/ask` charges one message *before* running and does not refund a client-cancelled call.
6
+ *
7
+ * The version of the OpenAPI document: 0.1.0
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+
16
+ import * as runtime from '../runtime';
17
+ import type {
18
+ ErrorResponse,
19
+ HTTPValidationError,
20
+ SupportedLanguage,
21
+ TranscriptionResponse,
22
+ } from '../models/index';
23
+ import {
24
+ ErrorResponseFromJSON,
25
+ ErrorResponseToJSON,
26
+ HTTPValidationErrorFromJSON,
27
+ HTTPValidationErrorToJSON,
28
+ SupportedLanguageFromJSON,
29
+ SupportedLanguageToJSON,
30
+ TranscriptionResponseFromJSON,
31
+ TranscriptionResponseToJSON,
32
+ } from '../models/index';
33
+
34
+ export interface CreateTranscriptionRequest {
35
+ file: Blob;
36
+ language?: SupportedLanguage;
37
+ }
38
+
39
+ /**
40
+ * TranscriptionsApi - interface
41
+ *
42
+ * @export
43
+ * @interface TranscriptionsApiInterface
44
+ */
45
+ export interface TranscriptionsApiInterface {
46
+ /**
47
+ * Creates request options for createTranscription without sending the request
48
+ * @param {Blob} file The audio clip. Accepts what a browser records (audio/webm, audio/ogg, audio/mp4) plus audio/mpeg, audio/wav and audio/flac. Re-encoded server-side, so the container does not have to match the backend.
49
+ * @param {SupportedLanguage} [language]
50
+ * @throws {RequiredError}
51
+ * @memberof TranscriptionsApiInterface
52
+ */
53
+ createTranscriptionRequestOpts(requestParameters: CreateTranscriptionRequest): Promise<runtime.RequestOpts>;
54
+
55
+ /**
56
+ * Transcribe a short spoken clip to text. **Answers synchronously.** Unlike document ingestion there is no `Location` header and nothing to poll — the transcript is in the response body. Expect roughly a second per 10s of audio. Send `multipart/form-data` with a `file` part; add `language` only to pin `zh` or `en` instead of auto-detecting. The clip is re-encoded server-side to mono 16 kHz mp3, so any listed container works. Limits: **25 MiB** and **5 min** per clip. Errors, all carrying the standard `code`/`request_id` body: `413` clip over either limit · `415` content type not accepted · `422` empty clip, or audio that could not be decoded · `503` the speech backend is unreachable or unconfigured. The audio is held for one ASR call and never persisted; the transcript is never logged.
57
+ * @summary Create Transcription Handler
58
+ * @param {Blob} file The audio clip. Accepts what a browser records (audio/webm, audio/ogg, audio/mp4) plus audio/mpeg, audio/wav and audio/flac. Re-encoded server-side, so the container does not have to match the backend.
59
+ * @param {SupportedLanguage} [language]
60
+ * @param {*} [options] Override http request option.
61
+ * @throws {RequiredError}
62
+ * @memberof TranscriptionsApiInterface
63
+ */
64
+ createTranscriptionRaw(requestParameters: CreateTranscriptionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<TranscriptionResponse>>;
65
+
66
+ /**
67
+ * Transcribe a short spoken clip to text. **Answers synchronously.** Unlike document ingestion there is no `Location` header and nothing to poll — the transcript is in the response body. Expect roughly a second per 10s of audio. Send `multipart/form-data` with a `file` part; add `language` only to pin `zh` or `en` instead of auto-detecting. The clip is re-encoded server-side to mono 16 kHz mp3, so any listed container works. Limits: **25 MiB** and **5 min** per clip. Errors, all carrying the standard `code`/`request_id` body: `413` clip over either limit · `415` content type not accepted · `422` empty clip, or audio that could not be decoded · `503` the speech backend is unreachable or unconfigured. The audio is held for one ASR call and never persisted; the transcript is never logged.
68
+ * Create Transcription Handler
69
+ */
70
+ createTranscription(requestParameters: CreateTranscriptionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<TranscriptionResponse>;
71
+
72
+ }
73
+
74
+ /**
75
+ *
76
+ */
77
+ export class TranscriptionsApi extends runtime.BaseAPI implements TranscriptionsApiInterface {
78
+
79
+ /**
80
+ * Creates request options for createTranscription without sending the request
81
+ */
82
+ async createTranscriptionRequestOpts(requestParameters: CreateTranscriptionRequest): Promise<runtime.RequestOpts> {
83
+ if (requestParameters['file'] == null) {
84
+ throw new runtime.RequiredError(
85
+ 'file',
86
+ 'Required parameter "file" was null or undefined when calling createTranscription().'
87
+ );
88
+ }
89
+
90
+ const queryParameters: any = {};
91
+
92
+ const headerParameters: runtime.HTTPHeaders = {};
93
+
94
+ if (this.configuration && this.configuration.accessToken) {
95
+ const token = this.configuration.accessToken;
96
+ const tokenString = await token("bearerAuth", []);
97
+
98
+ if (tokenString) {
99
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
100
+ }
101
+ }
102
+ const consumes: runtime.Consume[] = [
103
+ { contentType: 'multipart/form-data' },
104
+ ];
105
+ // @ts-ignore: canConsumeForm may be unused
106
+ const canConsumeForm = runtime.canConsumeForm(consumes);
107
+
108
+ let formParams: { append(param: string, value: any): any };
109
+ let useForm = false;
110
+ // use FormData to transmit files using content-type "multipart/form-data"
111
+ useForm = canConsumeForm;
112
+ if (useForm) {
113
+ formParams = new FormData();
114
+ } else {
115
+ formParams = new URLSearchParams();
116
+ }
117
+
118
+ if (requestParameters['file'] != null) {
119
+ formParams.append('file', requestParameters['file'] as any);
120
+ }
121
+
122
+ if (requestParameters['language'] != null) {
123
+ formParams.append('language', requestParameters['language'] as any);
124
+ }
125
+
126
+
127
+ let urlPath = `/v1/transcriptions`;
128
+
129
+ return {
130
+ path: urlPath,
131
+ method: 'POST',
132
+ headers: headerParameters,
133
+ query: queryParameters,
134
+ body: formParams,
135
+ };
136
+ }
137
+
138
+ /**
139
+ * Transcribe a short spoken clip to text. **Answers synchronously.** Unlike document ingestion there is no `Location` header and nothing to poll — the transcript is in the response body. Expect roughly a second per 10s of audio. Send `multipart/form-data` with a `file` part; add `language` only to pin `zh` or `en` instead of auto-detecting. The clip is re-encoded server-side to mono 16 kHz mp3, so any listed container works. Limits: **25 MiB** and **5 min** per clip. Errors, all carrying the standard `code`/`request_id` body: `413` clip over either limit · `415` content type not accepted · `422` empty clip, or audio that could not be decoded · `503` the speech backend is unreachable or unconfigured. The audio is held for one ASR call and never persisted; the transcript is never logged.
140
+ * Create Transcription Handler
141
+ */
142
+ async createTranscriptionRaw(requestParameters: CreateTranscriptionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<TranscriptionResponse>> {
143
+ const requestOptions = await this.createTranscriptionRequestOpts(requestParameters);
144
+ const response = await this.request(requestOptions, initOverrides);
145
+
146
+ return new runtime.JSONApiResponse(response, (jsonValue) => TranscriptionResponseFromJSON(jsonValue));
147
+ }
148
+
149
+ /**
150
+ * Transcribe a short spoken clip to text. **Answers synchronously.** Unlike document ingestion there is no `Location` header and nothing to poll — the transcript is in the response body. Expect roughly a second per 10s of audio. Send `multipart/form-data` with a `file` part; add `language` only to pin `zh` or `en` instead of auto-detecting. The clip is re-encoded server-side to mono 16 kHz mp3, so any listed container works. Limits: **25 MiB** and **5 min** per clip. Errors, all carrying the standard `code`/`request_id` body: `413` clip over either limit · `415` content type not accepted · `422` empty clip, or audio that could not be decoded · `503` the speech backend is unreachable or unconfigured. The audio is held for one ASR call and never persisted; the transcript is never logged.
151
+ * Create Transcription Handler
152
+ */
153
+ async createTranscription(requestParameters: CreateTranscriptionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<TranscriptionResponse> {
154
+ const response = await this.createTranscriptionRaw(requestParameters, initOverrides);
155
+ return await response.value();
156
+ }
157
+
158
+ }
package/src/apis/index.ts CHANGED
@@ -35,6 +35,7 @@ export * from './TenantGroupsApi';
35
35
  export * from './TenantsApi';
36
36
  export * from './ThreadMessagesApi';
37
37
  export * from './ThreadsApi';
38
+ export * from './TranscriptionsApi';
38
39
  export * from './TrashApi';
39
40
  export * from './UserPermissionsApi';
40
41
  export * from './UsersApi';
@@ -52,6 +52,8 @@ export const ErrorResponseCodeEnum = {
52
52
  NotFound: 'not_found',
53
53
  Conflict: 'conflict',
54
54
  RunBusy: 'run_busy',
55
+ PayloadTooLarge: 'payload_too_large',
56
+ UnsupportedMediaType: 'unsupported_media_type',
55
57
  UnprocessableEntity: 'unprocessable_entity',
56
58
  TooManyRequests: 'too_many_requests',
57
59
  QuotaExceeded: 'quota_exceeded',
@@ -0,0 +1,91 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Knowledge Stack API
5
+ * Knowledge Stack backend API for authentication and knowledge management. ## Integrating (RPA / machine clients) **Base URL.** Knowledge Stack is self-hosted — point at your own deployment host (see `servers`). The `localhost` entry is for local development only. **Authentication.** Send `Authorization: Bearer <api-key>` on every request. Mint an API key once via `POST /v1/api-keys` from a signed-in browser session; the raw `sk-user-...` secret is returned **only** at creation, so store it then. A key inherits its owning user\'s live tenant role and path permissions — create RPA keys from a least-privilege user, and set `expires_at` for rotation. The `ks_uat` cookie scheme is browser-only and cannot be used by headless clients. **Async work is polled, not pushed.** There are no outbound webhooks. - `POST /v1/documents/ingest` returns `201` immediately with a `workflow_id`; poll `GET /v1/system-jobs/document_versions/{workflow_id}` until `status` is terminal (anything other than `pending`/`processing`). The `Location` response header points at this poll resource. - `POST /v1/workflow-runs/{run_id}/start` returns `202`; poll `GET /v1/workflow-runs/{run_id}` until `execution_state` is `COMPLETED` or `FAILED`. The `Location` header points at the run resource. - `POST /v1/agent/ask` is **synchronous** — it blocks until the agent finishes and returns the answer inline. Use a generous HTTP timeout. **Pagination.** List endpoints accept `limit`/`offset` and return `{items, total, limit, offset}`. **Errors.** Every non-2xx body is `{detail, code, request_id}`. `code` is a stable value from a closed set (see the `ErrorResponse` schema\'s `code` enum) — branch on it rather than parsing `detail`. Quota rejections return `429` with a `Retry-After` header; transient lock contention returns a retryable `503`. Quote `request_id` (also the `x-request-id` response header) to support. **Idempotency.** `POST /v1/workflow-runs` accepts an `idempotency_key` to dedupe retried run creation. `agent/ask` charges one message *before* running and does not refund a client-cancelled call.
6
+ *
7
+ * The version of the OpenAPI document: 0.1.0
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+ import { mapValues } from '../runtime';
16
+ /**
17
+ * A spoken clip rendered as text, ready to send as a chat message.
18
+ * @export
19
+ * @interface TranscriptionResponse
20
+ */
21
+ export interface TranscriptionResponse {
22
+ /**
23
+ * The transcript. Empty when the clip contained no speech, which is a success, not an error.
24
+ * @type {string}
25
+ * @memberof TranscriptionResponse
26
+ */
27
+ text: string;
28
+ /**
29
+ * The language ASR detected, or the one the caller pinned. Null when the backend reports none; the text is still valid.
30
+ * @type {string}
31
+ * @memberof TranscriptionResponse
32
+ */
33
+ language?: string | null;
34
+ }
35
+ export const TranscriptionResponsePropertyValidationAttributesMap: {
36
+ [property: string]: {
37
+ maxLength?: number,
38
+ minLength?: number,
39
+ pattern?: string,
40
+ maximum?: number,
41
+ exclusiveMaximum?: boolean,
42
+ minimum?: number,
43
+ exclusiveMinimum?: boolean,
44
+ multipleOf?: number,
45
+ maxItems?: number,
46
+ minItems?: number,
47
+ uniqueItems?: boolean
48
+ }
49
+ } = {
50
+ }
51
+
52
+
53
+ /**
54
+ * Check if a given object implements the TranscriptionResponse interface.
55
+ */
56
+ export function instanceOfTranscriptionResponse(value: object): value is TranscriptionResponse {
57
+ if (!('text' in value) || value['text'] === undefined) return false;
58
+ return true;
59
+ }
60
+
61
+ export function TranscriptionResponseFromJSON(json: any): TranscriptionResponse {
62
+ return TranscriptionResponseFromJSONTyped(json, false);
63
+ }
64
+
65
+ export function TranscriptionResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): TranscriptionResponse {
66
+ if (json == null) {
67
+ return json;
68
+ }
69
+ return {
70
+
71
+ 'text': json['text'],
72
+ 'language': json['language'] == null ? undefined : json['language'],
73
+ };
74
+ }
75
+
76
+ export function TranscriptionResponseToJSON(json: any): TranscriptionResponse {
77
+ return TranscriptionResponseToJSONTyped(json, false);
78
+ }
79
+
80
+ export function TranscriptionResponseToJSONTyped(value?: TranscriptionResponse | null, ignoreDiscriminator: boolean = false): any {
81
+ if (value == null) {
82
+ return value;
83
+ }
84
+
85
+ return {
86
+
87
+ 'text': value['text'],
88
+ 'language': value['language'],
89
+ };
90
+ }
91
+
@@ -332,6 +332,7 @@ export * from './TimeseriesPoint';
332
332
  export * from './ToolDisplayType';
333
333
  export * from './ToolPart';
334
334
  export * from './ToolStatus';
335
+ export * from './TranscriptionResponse';
335
336
  export * from './TransferOwnerRequest';
336
337
  export * from './TransferOwnerResponse';
337
338
  export * from './TrashItemDetailResponse';