@knowledge-stack/ksapi 1.25.1 → 1.27.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.
- package/.openapi-generator/FILES +4 -0
- package/README.md +5 -2
- package/dist/apis/ThreadsApi.d.ts +45 -1
- package/dist/apis/ThreadsApi.js +46 -0
- package/dist/esm/apis/ThreadsApi.d.ts +45 -1
- package/dist/esm/apis/ThreadsApi.js +47 -1
- package/dist/esm/models/ChunkMetadataInput.d.ts +6 -0
- package/dist/esm/models/ChunkMetadataInput.js +2 -0
- package/dist/esm/models/ChunkMetadataOutput.d.ts +6 -0
- package/dist/esm/models/ChunkMetadataOutput.js +2 -0
- package/dist/esm/models/UserMessageRequest.d.ts +47 -0
- package/dist/esm/models/UserMessageRequest.js +42 -0
- package/dist/esm/models/UserMessageResponse.d.ts +47 -0
- package/dist/esm/models/UserMessageResponse.js +44 -0
- package/dist/esm/models/index.d.ts +2 -0
- package/dist/esm/models/index.js +2 -0
- package/dist/models/ChunkMetadataInput.d.ts +6 -0
- package/dist/models/ChunkMetadataInput.js +2 -0
- package/dist/models/ChunkMetadataOutput.d.ts +6 -0
- package/dist/models/ChunkMetadataOutput.js +2 -0
- package/dist/models/UserMessageRequest.d.ts +47 -0
- package/dist/models/UserMessageRequest.js +50 -0
- package/dist/models/UserMessageResponse.d.ts +47 -0
- package/dist/models/UserMessageResponse.js +52 -0
- package/dist/models/index.d.ts +2 -0
- package/dist/models/index.js +2 -0
- package/docs/ChunkMetadataInput.md +2 -0
- package/docs/ChunkMetadataOutput.md +2 -0
- package/docs/ThreadsApi.md +75 -0
- package/docs/UserMessageRequest.md +35 -0
- package/docs/UserMessageResponse.md +35 -0
- package/package.json +1 -1
- package/src/apis/ThreadsApi.ts +97 -0
- package/src/models/ChunkMetadataInput.ts +8 -0
- package/src/models/ChunkMetadataOutput.ts +8 -0
- package/src/models/UserMessageRequest.ts +82 -0
- package/src/models/UserMessageResponse.ts +83 -0
- package/src/models/index.ts +2 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Knowledge Stack API
|
|
3
|
+
* Knowledge Stack backend API for authentication and knowledge management
|
|
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
|
+
* Request to send a user message and trigger agent generation.
|
|
14
|
+
* @export
|
|
15
|
+
* @interface UserMessageRequest
|
|
16
|
+
*/
|
|
17
|
+
export interface UserMessageRequest {
|
|
18
|
+
/**
|
|
19
|
+
* User input text. Mock agent dev controls may be embedded here (e.g. /mock duration=5 wps=3 scenario=tool_call_once).
|
|
20
|
+
* @type {string}
|
|
21
|
+
* @memberof UserMessageRequest
|
|
22
|
+
*/
|
|
23
|
+
inputText?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Check if a given object implements the UserMessageRequest interface.
|
|
27
|
+
*/
|
|
28
|
+
export declare function instanceOfUserMessageRequest(value: object): value is UserMessageRequest;
|
|
29
|
+
export declare function UserMessageRequestFromJSON(json: any): UserMessageRequest;
|
|
30
|
+
export declare function UserMessageRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): UserMessageRequest;
|
|
31
|
+
export declare function UserMessageRequestToJSON(json: any): UserMessageRequest;
|
|
32
|
+
export declare function UserMessageRequestToJSONTyped(value?: UserMessageRequest | null, ignoreDiscriminator?: boolean): any;
|
|
33
|
+
export declare const UserMessageRequestPropertyValidationAttributesMap: {
|
|
34
|
+
[property: string]: {
|
|
35
|
+
maxLength?: number;
|
|
36
|
+
minLength?: number;
|
|
37
|
+
pattern?: string;
|
|
38
|
+
maximum?: number;
|
|
39
|
+
exclusiveMaximum?: boolean;
|
|
40
|
+
minimum?: number;
|
|
41
|
+
exclusiveMinimum?: boolean;
|
|
42
|
+
multipleOf?: number;
|
|
43
|
+
maxItems?: number;
|
|
44
|
+
minItems?: number;
|
|
45
|
+
uniqueItems?: boolean;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
/**
|
|
5
|
+
* Knowledge Stack API
|
|
6
|
+
* Knowledge Stack backend API for authentication and knowledge management
|
|
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.UserMessageRequestPropertyValidationAttributesMap = void 0;
|
|
17
|
+
exports.instanceOfUserMessageRequest = instanceOfUserMessageRequest;
|
|
18
|
+
exports.UserMessageRequestFromJSON = UserMessageRequestFromJSON;
|
|
19
|
+
exports.UserMessageRequestFromJSONTyped = UserMessageRequestFromJSONTyped;
|
|
20
|
+
exports.UserMessageRequestToJSON = UserMessageRequestToJSON;
|
|
21
|
+
exports.UserMessageRequestToJSONTyped = UserMessageRequestToJSONTyped;
|
|
22
|
+
/**
|
|
23
|
+
* Check if a given object implements the UserMessageRequest interface.
|
|
24
|
+
*/
|
|
25
|
+
function instanceOfUserMessageRequest(value) {
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
function UserMessageRequestFromJSON(json) {
|
|
29
|
+
return UserMessageRequestFromJSONTyped(json, false);
|
|
30
|
+
}
|
|
31
|
+
function UserMessageRequestFromJSONTyped(json, ignoreDiscriminator) {
|
|
32
|
+
if (json == null) {
|
|
33
|
+
return json;
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
'inputText': json['input_text'] == null ? undefined : json['input_text'],
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function UserMessageRequestToJSON(json) {
|
|
40
|
+
return UserMessageRequestToJSONTyped(json, false);
|
|
41
|
+
}
|
|
42
|
+
function UserMessageRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
43
|
+
if (value == null) {
|
|
44
|
+
return value;
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
'input_text': value['inputText'],
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
exports.UserMessageRequestPropertyValidationAttributesMap = {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Knowledge Stack API
|
|
3
|
+
* Knowledge Stack backend API for authentication and knowledge management
|
|
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
|
+
* 202 response from POST /{thread_id}/user_message.
|
|
14
|
+
* @export
|
|
15
|
+
* @interface UserMessageResponse
|
|
16
|
+
*/
|
|
17
|
+
export interface UserMessageResponse {
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @type {string}
|
|
21
|
+
* @memberof UserMessageResponse
|
|
22
|
+
*/
|
|
23
|
+
workflowId: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Check if a given object implements the UserMessageResponse interface.
|
|
27
|
+
*/
|
|
28
|
+
export declare function instanceOfUserMessageResponse(value: object): value is UserMessageResponse;
|
|
29
|
+
export declare function UserMessageResponseFromJSON(json: any): UserMessageResponse;
|
|
30
|
+
export declare function UserMessageResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): UserMessageResponse;
|
|
31
|
+
export declare function UserMessageResponseToJSON(json: any): UserMessageResponse;
|
|
32
|
+
export declare function UserMessageResponseToJSONTyped(value?: UserMessageResponse | null, ignoreDiscriminator?: boolean): any;
|
|
33
|
+
export declare const UserMessageResponsePropertyValidationAttributesMap: {
|
|
34
|
+
[property: string]: {
|
|
35
|
+
maxLength?: number;
|
|
36
|
+
minLength?: number;
|
|
37
|
+
pattern?: string;
|
|
38
|
+
maximum?: number;
|
|
39
|
+
exclusiveMaximum?: boolean;
|
|
40
|
+
minimum?: number;
|
|
41
|
+
exclusiveMinimum?: boolean;
|
|
42
|
+
multipleOf?: number;
|
|
43
|
+
maxItems?: number;
|
|
44
|
+
minItems?: number;
|
|
45
|
+
uniqueItems?: boolean;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
/**
|
|
5
|
+
* Knowledge Stack API
|
|
6
|
+
* Knowledge Stack backend API for authentication and knowledge management
|
|
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.UserMessageResponsePropertyValidationAttributesMap = void 0;
|
|
17
|
+
exports.instanceOfUserMessageResponse = instanceOfUserMessageResponse;
|
|
18
|
+
exports.UserMessageResponseFromJSON = UserMessageResponseFromJSON;
|
|
19
|
+
exports.UserMessageResponseFromJSONTyped = UserMessageResponseFromJSONTyped;
|
|
20
|
+
exports.UserMessageResponseToJSON = UserMessageResponseToJSON;
|
|
21
|
+
exports.UserMessageResponseToJSONTyped = UserMessageResponseToJSONTyped;
|
|
22
|
+
/**
|
|
23
|
+
* Check if a given object implements the UserMessageResponse interface.
|
|
24
|
+
*/
|
|
25
|
+
function instanceOfUserMessageResponse(value) {
|
|
26
|
+
if (!('workflowId' in value) || value['workflowId'] === undefined)
|
|
27
|
+
return false;
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
function UserMessageResponseFromJSON(json) {
|
|
31
|
+
return UserMessageResponseFromJSONTyped(json, false);
|
|
32
|
+
}
|
|
33
|
+
function UserMessageResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
34
|
+
if (json == null) {
|
|
35
|
+
return json;
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
'workflowId': json['workflow_id'],
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function UserMessageResponseToJSON(json) {
|
|
42
|
+
return UserMessageResponseToJSONTyped(json, false);
|
|
43
|
+
}
|
|
44
|
+
function UserMessageResponseToJSONTyped(value, ignoreDiscriminator = false) {
|
|
45
|
+
if (value == null) {
|
|
46
|
+
return value;
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
'workflow_id': value['workflowId'],
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
exports.UserMessageResponsePropertyValidationAttributesMap = {};
|
package/dist/models/index.d.ts
CHANGED
|
@@ -94,6 +94,8 @@ export * from './UpdateTagRequest';
|
|
|
94
94
|
export * from './UpdateTenantRequest';
|
|
95
95
|
export * from './UpdateThreadRequest';
|
|
96
96
|
export * from './UpdateUserRequest';
|
|
97
|
+
export * from './UserMessageRequest';
|
|
98
|
+
export * from './UserMessageResponse';
|
|
97
99
|
export * from './UserResponse';
|
|
98
100
|
export * from './ValidationError';
|
|
99
101
|
export * from './VersionChunkIdsResponse';
|
package/dist/models/index.js
CHANGED
|
@@ -112,6 +112,8 @@ __exportStar(require("./UpdateTagRequest"), exports);
|
|
|
112
112
|
__exportStar(require("./UpdateTenantRequest"), exports);
|
|
113
113
|
__exportStar(require("./UpdateThreadRequest"), exports);
|
|
114
114
|
__exportStar(require("./UpdateUserRequest"), exports);
|
|
115
|
+
__exportStar(require("./UserMessageRequest"), exports);
|
|
116
|
+
__exportStar(require("./UserMessageResponse"), exports);
|
|
115
117
|
__exportStar(require("./UserResponse"), exports);
|
|
116
118
|
__exportStar(require("./ValidationError"), exports);
|
|
117
119
|
__exportStar(require("./VersionChunkIdsResponse"), exports);
|
|
@@ -9,6 +9,7 @@ Name | Type
|
|
|
9
9
|
------------ | -------------
|
|
10
10
|
`polygons` | [Array<PolygonReference>](PolygonReference.md)
|
|
11
11
|
`s3Url` | string
|
|
12
|
+
`summary` | string
|
|
12
13
|
|
|
13
14
|
## Example
|
|
14
15
|
|
|
@@ -19,6 +20,7 @@ import type { ChunkMetadataInput } from '@knowledge-stack/ksapi'
|
|
|
19
20
|
const example = {
|
|
20
21
|
"polygons": null,
|
|
21
22
|
"s3Url": null,
|
|
23
|
+
"summary": null,
|
|
22
24
|
} satisfies ChunkMetadataInput
|
|
23
25
|
|
|
24
26
|
console.log(example)
|
|
@@ -9,6 +9,7 @@ Name | Type
|
|
|
9
9
|
------------ | -------------
|
|
10
10
|
`polygons` | [Array<PolygonReference>](PolygonReference.md)
|
|
11
11
|
`s3Url` | string
|
|
12
|
+
`summary` | string
|
|
12
13
|
|
|
13
14
|
## Example
|
|
14
15
|
|
|
@@ -19,6 +20,7 @@ import type { ChunkMetadataOutput } from '@knowledge-stack/ksapi'
|
|
|
19
20
|
const example = {
|
|
20
21
|
"polygons": null,
|
|
21
22
|
"s3Url": null,
|
|
23
|
+
"summary": null,
|
|
22
24
|
} satisfies ChunkMetadataOutput
|
|
23
25
|
|
|
24
26
|
console.log(example)
|
package/docs/ThreadsApi.md
CHANGED
|
@@ -8,6 +8,7 @@ All URIs are relative to *http://localhost:8000*
|
|
|
8
8
|
| [**deleteThread**](ThreadsApi.md#deletethread) | **DELETE** /v1/threads/{thread_id} | Delete Thread Handler |
|
|
9
9
|
| [**getThread**](ThreadsApi.md#getthread) | **GET** /v1/threads/{thread_id} | Get Thread Handler |
|
|
10
10
|
| [**listThreads**](ThreadsApi.md#listthreads) | **GET** /v1/threads | List Threads Handler |
|
|
11
|
+
| [**sendUserMessage**](ThreadsApi.md#sendusermessage) | **POST** /v1/threads/{thread_id}/user_message | Send User Message Handler |
|
|
11
12
|
| [**streamThread**](ThreadsApi.md#streamthread) | **GET** /v1/threads/{thread_id}/stream | Stream Thread Handler |
|
|
12
13
|
| [**updateThread**](ThreadsApi.md#updatethreadoperation) | **PATCH** /v1/threads/{thread_id} | Update Thread Handler |
|
|
13
14
|
|
|
@@ -303,6 +304,80 @@ No authorization required
|
|
|
303
304
|
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
304
305
|
|
|
305
306
|
|
|
307
|
+
## sendUserMessage
|
|
308
|
+
|
|
309
|
+
> UserMessageResponse sendUserMessage(threadId, userMessageRequest, ksUat)
|
|
310
|
+
|
|
311
|
+
Send User Message Handler
|
|
312
|
+
|
|
313
|
+
Send a user message and trigger agent generation. Returns immediately with a workflow_id. Connect to GET /{thread_id}/stream (SSE) before or after calling this endpoint to receive the streamed output.
|
|
314
|
+
|
|
315
|
+
### Example
|
|
316
|
+
|
|
317
|
+
```ts
|
|
318
|
+
import {
|
|
319
|
+
Configuration,
|
|
320
|
+
ThreadsApi,
|
|
321
|
+
} from '@knowledge-stack/ksapi';
|
|
322
|
+
import type { SendUserMessageRequest } from '@knowledge-stack/ksapi';
|
|
323
|
+
|
|
324
|
+
async function example() {
|
|
325
|
+
console.log("🚀 Testing @knowledge-stack/ksapi SDK...");
|
|
326
|
+
const api = new ThreadsApi();
|
|
327
|
+
|
|
328
|
+
const body = {
|
|
329
|
+
// string
|
|
330
|
+
threadId: 38400000-8cf0-11bd-b23e-10b96e4ef00d,
|
|
331
|
+
// UserMessageRequest
|
|
332
|
+
userMessageRequest: ...,
|
|
333
|
+
// string (optional)
|
|
334
|
+
ksUat: ksUat_example,
|
|
335
|
+
} satisfies SendUserMessageRequest;
|
|
336
|
+
|
|
337
|
+
try {
|
|
338
|
+
const data = await api.sendUserMessage(body);
|
|
339
|
+
console.log(data);
|
|
340
|
+
} catch (error) {
|
|
341
|
+
console.error(error);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
// Run the test
|
|
346
|
+
example().catch(console.error);
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
### Parameters
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
| Name | Type | Description | Notes |
|
|
353
|
+
|------------- | ------------- | ------------- | -------------|
|
|
354
|
+
| **threadId** | `string` | | [Defaults to `undefined`] |
|
|
355
|
+
| **userMessageRequest** | [UserMessageRequest](UserMessageRequest.md) | | |
|
|
356
|
+
| **ksUat** | `string` | | [Optional] [Defaults to `undefined`] |
|
|
357
|
+
|
|
358
|
+
### Return type
|
|
359
|
+
|
|
360
|
+
[**UserMessageResponse**](UserMessageResponse.md)
|
|
361
|
+
|
|
362
|
+
### Authorization
|
|
363
|
+
|
|
364
|
+
No authorization required
|
|
365
|
+
|
|
366
|
+
### HTTP request headers
|
|
367
|
+
|
|
368
|
+
- **Content-Type**: `application/json`
|
|
369
|
+
- **Accept**: `application/json`
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
### HTTP response details
|
|
373
|
+
| Status code | Description | Response headers |
|
|
374
|
+
|-------------|-------------|------------------|
|
|
375
|
+
| **202** | Successful Response | - |
|
|
376
|
+
| **422** | Validation Error | - |
|
|
377
|
+
|
|
378
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
379
|
+
|
|
380
|
+
|
|
306
381
|
## streamThread
|
|
307
382
|
|
|
308
383
|
> streamThread(threadId, lastMessageId, lastEntryId, ksUat)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
|
|
2
|
+
# UserMessageRequest
|
|
3
|
+
|
|
4
|
+
Request to send a user message and trigger agent generation.
|
|
5
|
+
|
|
6
|
+
## Properties
|
|
7
|
+
|
|
8
|
+
Name | Type
|
|
9
|
+
------------ | -------------
|
|
10
|
+
`inputText` | string
|
|
11
|
+
|
|
12
|
+
## Example
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
import type { UserMessageRequest } from '@knowledge-stack/ksapi'
|
|
16
|
+
|
|
17
|
+
// TODO: Update the object below with actual values
|
|
18
|
+
const example = {
|
|
19
|
+
"inputText": null,
|
|
20
|
+
} satisfies UserMessageRequest
|
|
21
|
+
|
|
22
|
+
console.log(example)
|
|
23
|
+
|
|
24
|
+
// Convert the instance to a JSON string
|
|
25
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
26
|
+
console.log(exampleJSON)
|
|
27
|
+
|
|
28
|
+
// Parse the JSON string back to an object
|
|
29
|
+
const exampleParsed = JSON.parse(exampleJSON) as UserMessageRequest
|
|
30
|
+
console.log(exampleParsed)
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
34
|
+
|
|
35
|
+
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
|
|
2
|
+
# UserMessageResponse
|
|
3
|
+
|
|
4
|
+
202 response from POST /{thread_id}/user_message.
|
|
5
|
+
|
|
6
|
+
## Properties
|
|
7
|
+
|
|
8
|
+
Name | Type
|
|
9
|
+
------------ | -------------
|
|
10
|
+
`workflowId` | string
|
|
11
|
+
|
|
12
|
+
## Example
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
import type { UserMessageResponse } from '@knowledge-stack/ksapi'
|
|
16
|
+
|
|
17
|
+
// TODO: Update the object below with actual values
|
|
18
|
+
const example = {
|
|
19
|
+
"workflowId": null,
|
|
20
|
+
} satisfies UserMessageResponse
|
|
21
|
+
|
|
22
|
+
console.log(example)
|
|
23
|
+
|
|
24
|
+
// Convert the instance to a JSON string
|
|
25
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
26
|
+
console.log(exampleJSON)
|
|
27
|
+
|
|
28
|
+
// Parse the JSON string back to an object
|
|
29
|
+
const exampleParsed = JSON.parse(exampleJSON) as UserMessageResponse
|
|
30
|
+
console.log(exampleParsed)
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
34
|
+
|
|
35
|
+
|
package/package.json
CHANGED
package/src/apis/ThreadsApi.ts
CHANGED
|
@@ -20,6 +20,8 @@ import type {
|
|
|
20
20
|
PaginatedResponseThreadResponse,
|
|
21
21
|
ThreadResponse,
|
|
22
22
|
UpdateThreadRequest,
|
|
23
|
+
UserMessageRequest,
|
|
24
|
+
UserMessageResponse,
|
|
23
25
|
} from '../models/index';
|
|
24
26
|
import {
|
|
25
27
|
CreateThreadRequestFromJSON,
|
|
@@ -32,6 +34,10 @@ import {
|
|
|
32
34
|
ThreadResponseToJSON,
|
|
33
35
|
UpdateThreadRequestFromJSON,
|
|
34
36
|
UpdateThreadRequestToJSON,
|
|
37
|
+
UserMessageRequestFromJSON,
|
|
38
|
+
UserMessageRequestToJSON,
|
|
39
|
+
UserMessageResponseFromJSON,
|
|
40
|
+
UserMessageResponseToJSON,
|
|
35
41
|
} from '../models/index';
|
|
36
42
|
|
|
37
43
|
export interface CreateThreadOperationRequest {
|
|
@@ -56,6 +62,12 @@ export interface ListThreadsRequest {
|
|
|
56
62
|
ksUat?: string | null;
|
|
57
63
|
}
|
|
58
64
|
|
|
65
|
+
export interface SendUserMessageRequest {
|
|
66
|
+
threadId: string;
|
|
67
|
+
userMessageRequest: UserMessageRequest;
|
|
68
|
+
ksUat?: string | null;
|
|
69
|
+
}
|
|
70
|
+
|
|
59
71
|
export interface StreamThreadRequest {
|
|
60
72
|
threadId: string;
|
|
61
73
|
lastMessageId?: string | null;
|
|
@@ -184,6 +196,34 @@ export interface ThreadsApiInterface {
|
|
|
184
196
|
*/
|
|
185
197
|
listThreads(requestParameters: ListThreadsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PaginatedResponseThreadResponse>;
|
|
186
198
|
|
|
199
|
+
/**
|
|
200
|
+
* Creates request options for sendUserMessage without sending the request
|
|
201
|
+
* @param {string} threadId
|
|
202
|
+
* @param {UserMessageRequest} userMessageRequest
|
|
203
|
+
* @param {string} [ksUat]
|
|
204
|
+
* @throws {RequiredError}
|
|
205
|
+
* @memberof ThreadsApiInterface
|
|
206
|
+
*/
|
|
207
|
+
sendUserMessageRequestOpts(requestParameters: SendUserMessageRequest): Promise<runtime.RequestOpts>;
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Send a user message and trigger agent generation. Returns immediately with a workflow_id. Connect to GET /{thread_id}/stream (SSE) before or after calling this endpoint to receive the streamed output.
|
|
211
|
+
* @summary Send User Message Handler
|
|
212
|
+
* @param {string} threadId
|
|
213
|
+
* @param {UserMessageRequest} userMessageRequest
|
|
214
|
+
* @param {string} [ksUat]
|
|
215
|
+
* @param {*} [options] Override http request option.
|
|
216
|
+
* @throws {RequiredError}
|
|
217
|
+
* @memberof ThreadsApiInterface
|
|
218
|
+
*/
|
|
219
|
+
sendUserMessageRaw(requestParameters: SendUserMessageRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<UserMessageResponse>>;
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Send a user message and trigger agent generation. Returns immediately with a workflow_id. Connect to GET /{thread_id}/stream (SSE) before or after calling this endpoint to receive the streamed output.
|
|
223
|
+
* Send User Message Handler
|
|
224
|
+
*/
|
|
225
|
+
sendUserMessage(requestParameters: SendUserMessageRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<UserMessageResponse>;
|
|
226
|
+
|
|
187
227
|
/**
|
|
188
228
|
* Creates request options for streamThread without sending the request
|
|
189
229
|
* @param {string} threadId
|
|
@@ -442,6 +482,63 @@ export class ThreadsApi extends runtime.BaseAPI implements ThreadsApiInterface {
|
|
|
442
482
|
return await response.value();
|
|
443
483
|
}
|
|
444
484
|
|
|
485
|
+
/**
|
|
486
|
+
* Creates request options for sendUserMessage without sending the request
|
|
487
|
+
*/
|
|
488
|
+
async sendUserMessageRequestOpts(requestParameters: SendUserMessageRequest): Promise<runtime.RequestOpts> {
|
|
489
|
+
if (requestParameters['threadId'] == null) {
|
|
490
|
+
throw new runtime.RequiredError(
|
|
491
|
+
'threadId',
|
|
492
|
+
'Required parameter "threadId" was null or undefined when calling sendUserMessage().'
|
|
493
|
+
);
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
if (requestParameters['userMessageRequest'] == null) {
|
|
497
|
+
throw new runtime.RequiredError(
|
|
498
|
+
'userMessageRequest',
|
|
499
|
+
'Required parameter "userMessageRequest" was null or undefined when calling sendUserMessage().'
|
|
500
|
+
);
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
const queryParameters: any = {};
|
|
504
|
+
|
|
505
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
506
|
+
|
|
507
|
+
headerParameters['Content-Type'] = 'application/json';
|
|
508
|
+
|
|
509
|
+
|
|
510
|
+
let urlPath = `/v1/threads/{thread_id}/user_message`;
|
|
511
|
+
urlPath = urlPath.replace(`{${"thread_id"}}`, encodeURIComponent(String(requestParameters['threadId'])));
|
|
512
|
+
|
|
513
|
+
return {
|
|
514
|
+
path: urlPath,
|
|
515
|
+
method: 'POST',
|
|
516
|
+
headers: headerParameters,
|
|
517
|
+
query: queryParameters,
|
|
518
|
+
body: UserMessageRequestToJSON(requestParameters['userMessageRequest']),
|
|
519
|
+
};
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
/**
|
|
523
|
+
* Send a user message and trigger agent generation. Returns immediately with a workflow_id. Connect to GET /{thread_id}/stream (SSE) before or after calling this endpoint to receive the streamed output.
|
|
524
|
+
* Send User Message Handler
|
|
525
|
+
*/
|
|
526
|
+
async sendUserMessageRaw(requestParameters: SendUserMessageRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<UserMessageResponse>> {
|
|
527
|
+
const requestOptions = await this.sendUserMessageRequestOpts(requestParameters);
|
|
528
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
529
|
+
|
|
530
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => UserMessageResponseFromJSON(jsonValue));
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
/**
|
|
534
|
+
* Send a user message and trigger agent generation. Returns immediately with a workflow_id. Connect to GET /{thread_id}/stream (SSE) before or after calling this endpoint to receive the streamed output.
|
|
535
|
+
* Send User Message Handler
|
|
536
|
+
*/
|
|
537
|
+
async sendUserMessage(requestParameters: SendUserMessageRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<UserMessageResponse> {
|
|
538
|
+
const response = await this.sendUserMessageRaw(requestParameters, initOverrides);
|
|
539
|
+
return await response.value();
|
|
540
|
+
}
|
|
541
|
+
|
|
445
542
|
/**
|
|
446
543
|
* Creates request options for streamThread without sending the request
|
|
447
544
|
*/
|
|
@@ -39,6 +39,12 @@ export interface ChunkMetadataInput {
|
|
|
39
39
|
* @memberof ChunkMetadataInput
|
|
40
40
|
*/
|
|
41
41
|
s3Url?: string | null;
|
|
42
|
+
/**
|
|
43
|
+
* LLM-generated summary of the chunk content. Used for TABLE chunks to enrich embedding text.
|
|
44
|
+
* @type {string}
|
|
45
|
+
* @memberof ChunkMetadataInput
|
|
46
|
+
*/
|
|
47
|
+
summary?: string | null;
|
|
42
48
|
}
|
|
43
49
|
|
|
44
50
|
/**
|
|
@@ -60,6 +66,7 @@ export function ChunkMetadataInputFromJSONTyped(json: any, ignoreDiscriminator:
|
|
|
60
66
|
|
|
61
67
|
'polygons': json['polygons'] == null ? undefined : ((json['polygons'] as Array<any>).map(PolygonReferenceFromJSON)),
|
|
62
68
|
's3Url': json['s3_url'] == null ? undefined : json['s3_url'],
|
|
69
|
+
'summary': json['summary'] == null ? undefined : json['summary'],
|
|
63
70
|
};
|
|
64
71
|
}
|
|
65
72
|
|
|
@@ -76,6 +83,7 @@ export function ChunkMetadataInputToJSONTyped(value?: ChunkMetadataInput | null,
|
|
|
76
83
|
|
|
77
84
|
'polygons': value['polygons'] == null ? undefined : ((value['polygons'] as Array<any>).map(PolygonReferenceToJSON)),
|
|
78
85
|
's3_url': value['s3Url'],
|
|
86
|
+
'summary': value['summary'],
|
|
79
87
|
};
|
|
80
88
|
}
|
|
81
89
|
|
|
@@ -39,6 +39,12 @@ export interface ChunkMetadataOutput {
|
|
|
39
39
|
* @memberof ChunkMetadataOutput
|
|
40
40
|
*/
|
|
41
41
|
s3Url?: string | null;
|
|
42
|
+
/**
|
|
43
|
+
* LLM-generated summary of the chunk content. Used for TABLE chunks to enrich embedding text.
|
|
44
|
+
* @type {string}
|
|
45
|
+
* @memberof ChunkMetadataOutput
|
|
46
|
+
*/
|
|
47
|
+
summary?: string | null;
|
|
42
48
|
}
|
|
43
49
|
|
|
44
50
|
/**
|
|
@@ -60,6 +66,7 @@ export function ChunkMetadataOutputFromJSONTyped(json: any, ignoreDiscriminator:
|
|
|
60
66
|
|
|
61
67
|
'polygons': json['polygons'] == null ? undefined : ((json['polygons'] as Array<any>).map(PolygonReferenceFromJSON)),
|
|
62
68
|
's3Url': json['s3_url'] == null ? undefined : json['s3_url'],
|
|
69
|
+
'summary': json['summary'] == null ? undefined : json['summary'],
|
|
63
70
|
};
|
|
64
71
|
}
|
|
65
72
|
|
|
@@ -76,6 +83,7 @@ export function ChunkMetadataOutputToJSONTyped(value?: ChunkMetadataOutput | nul
|
|
|
76
83
|
|
|
77
84
|
'polygons': value['polygons'] == null ? undefined : ((value['polygons'] as Array<any>).map(PolygonReferenceToJSON)),
|
|
78
85
|
's3_url': value['s3Url'],
|
|
86
|
+
'summary': value['summary'],
|
|
79
87
|
};
|
|
80
88
|
}
|
|
81
89
|
|