@reminix/sdk 0.11.0 → 0.13.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/CHANGELOG.md +21 -0
- package/client.d.mts +10 -4
- package/client.d.mts.map +1 -1
- package/client.d.ts +10 -4
- package/client.d.ts.map +1 -1
- package/client.js +6 -0
- package/client.js.map +1 -1
- package/client.mjs +6 -0
- package/client.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/agents.d.mts +112 -27
- package/resources/agents.d.mts.map +1 -1
- package/resources/agents.d.ts +112 -27
- package/resources/agents.d.ts.map +1 -1
- package/resources/agents.js +2 -2
- package/resources/agents.js.map +1 -1
- package/resources/agents.mjs +2 -2
- package/resources/agents.mjs.map +1 -1
- package/resources/execution-logs.d.mts +3 -3
- package/resources/execution-logs.d.mts.map +1 -1
- package/resources/execution-logs.d.ts +3 -3
- package/resources/execution-logs.d.ts.map +1 -1
- package/resources/execution-logs.js +1 -1
- package/resources/execution-logs.mjs +1 -1
- package/resources/index.d.mts +4 -2
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +4 -2
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +5 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +2 -0
- package/resources/index.mjs.map +1 -1
- package/resources/knowledge/collections/collections.d.mts +89 -0
- package/resources/knowledge/collections/collections.d.mts.map +1 -0
- package/resources/knowledge/collections/collections.d.ts +89 -0
- package/resources/knowledge/collections/collections.d.ts.map +1 -0
- package/resources/knowledge/collections/collections.js +56 -0
- package/resources/knowledge/collections/collections.js.map +1 -0
- package/resources/knowledge/collections/collections.mjs +51 -0
- package/resources/knowledge/collections/collections.mjs.map +1 -0
- package/resources/knowledge/collections/documents.d.mts +121 -0
- package/resources/knowledge/collections/documents.d.mts.map +1 -0
- package/resources/knowledge/collections/documents.d.ts +121 -0
- package/resources/knowledge/collections/documents.d.ts.map +1 -0
- package/resources/knowledge/collections/documents.js +62 -0
- package/resources/knowledge/collections/documents.js.map +1 -0
- package/resources/knowledge/collections/documents.mjs +58 -0
- package/resources/knowledge/collections/documents.mjs.map +1 -0
- package/resources/knowledge/collections/index.d.mts +3 -0
- package/resources/knowledge/collections/index.d.mts.map +1 -0
- package/resources/knowledge/collections/index.d.ts +3 -0
- package/resources/knowledge/collections/index.d.ts.map +1 -0
- package/resources/knowledge/collections/index.js +9 -0
- package/resources/knowledge/collections/index.js.map +1 -0
- package/resources/knowledge/collections/index.mjs +4 -0
- package/resources/knowledge/collections/index.mjs.map +1 -0
- package/resources/knowledge/collections.d.mts +2 -0
- package/resources/knowledge/collections.d.mts.map +1 -0
- package/resources/knowledge/collections.d.ts +2 -0
- package/resources/knowledge/collections.d.ts.map +1 -0
- package/resources/knowledge/collections.js +6 -0
- package/resources/knowledge/collections.js.map +1 -0
- package/resources/knowledge/collections.mjs +3 -0
- package/resources/knowledge/collections.mjs.map +1 -0
- package/resources/knowledge/index.d.mts +3 -0
- package/resources/knowledge/index.d.mts.map +1 -0
- package/resources/knowledge/index.d.ts +3 -0
- package/resources/knowledge/index.d.ts.map +1 -0
- package/resources/knowledge/index.js +9 -0
- package/resources/knowledge/index.js.map +1 -0
- package/resources/knowledge/index.mjs +4 -0
- package/resources/knowledge/index.mjs.map +1 -0
- package/resources/knowledge/knowledge.d.mts +65 -0
- package/resources/knowledge/knowledge.d.mts.map +1 -0
- package/resources/knowledge/knowledge.d.ts +65 -0
- package/resources/knowledge/knowledge.d.ts.map +1 -0
- package/resources/knowledge/knowledge.js +26 -0
- package/resources/knowledge/knowledge.js.map +1 -0
- package/resources/knowledge/knowledge.mjs +21 -0
- package/resources/knowledge/knowledge.mjs.map +1 -0
- package/resources/knowledge.d.mts +2 -0
- package/resources/knowledge.d.mts.map +1 -0
- package/resources/knowledge.d.ts +2 -0
- package/resources/knowledge.d.ts.map +1 -0
- package/resources/knowledge.js +6 -0
- package/resources/knowledge.js.map +1 -0
- package/resources/knowledge.mjs +3 -0
- package/resources/knowledge.mjs.map +1 -0
- package/resources/memory.d.mts +148 -0
- package/resources/memory.d.mts.map +1 -0
- package/resources/memory.d.ts +148 -0
- package/resources/memory.d.ts.map +1 -0
- package/resources/memory.js +82 -0
- package/resources/memory.js.map +1 -0
- package/resources/memory.mjs +78 -0
- package/resources/memory.mjs.map +1 -0
- package/resources/tools.d.mts +69 -11
- package/resources/tools.d.mts.map +1 -1
- package/resources/tools.d.ts +69 -11
- package/resources/tools.d.ts.map +1 -1
- package/resources/tools.js +7 -7
- package/resources/tools.js.map +1 -1
- package/resources/tools.mjs +7 -7
- package/resources/tools.mjs.map +1 -1
- package/src/client.ts +42 -12
- package/src/resources/agents.ts +142 -40
- package/src/resources/execution-logs.ts +3 -3
- package/src/resources/index.ts +16 -6
- package/src/resources/knowledge/collections/collections.ts +167 -0
- package/src/resources/knowledge/collections/documents.ts +200 -0
- package/src/resources/knowledge/collections/index.ts +22 -0
- package/src/resources/knowledge/collections.ts +3 -0
- package/src/resources/knowledge/index.ts +11 -0
- package/src/resources/knowledge/knowledge.ts +101 -0
- package/src/resources/knowledge.ts +3 -0
- package/src/resources/memory.ts +188 -0
- package/src/resources/tools.ts +81 -13
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -22,7 +22,7 @@ export class ExecutionLogs extends APIResource {
|
|
|
22
22
|
*
|
|
23
23
|
* **Filters:**
|
|
24
24
|
*
|
|
25
|
-
* - `type`: Filter by execution type (
|
|
25
|
+
* - `type`: Filter by execution type (agent_invoke, agent_chat, tool_call)
|
|
26
26
|
* - `source`: Filter by request source (api, cli, dashboard, widget, sdk)
|
|
27
27
|
* - `name`: Filter by agent or tool name
|
|
28
28
|
* - `status`: Filter by result status (success, error, timeout)
|
|
@@ -81,7 +81,7 @@ export interface ExecutionLog {
|
|
|
81
81
|
/**
|
|
82
82
|
* Type of execution
|
|
83
83
|
*/
|
|
84
|
-
type: '
|
|
84
|
+
type: 'agent_invoke' | 'agent_chat' | 'tool_call';
|
|
85
85
|
|
|
86
86
|
/**
|
|
87
87
|
* Input parameters
|
|
@@ -113,7 +113,7 @@ export interface ExecutionLogListParams extends CursorParams {
|
|
|
113
113
|
/**
|
|
114
114
|
* Filter by execution type
|
|
115
115
|
*/
|
|
116
|
-
type?: '
|
|
116
|
+
type?: 'agent_invoke' | 'agent_chat' | 'tool_call';
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
export declare namespace ExecutionLogs {
|
package/src/resources/index.ts
CHANGED
|
@@ -4,17 +4,19 @@ export {
|
|
|
4
4
|
Agents,
|
|
5
5
|
type Agent,
|
|
6
6
|
type AgentConfig,
|
|
7
|
+
type AgentKnowledgeBaseConfig,
|
|
8
|
+
type AgentMemoryConfig,
|
|
7
9
|
type ChatMessage,
|
|
8
10
|
type StreamChunk,
|
|
9
11
|
type AgentChatResponse,
|
|
10
|
-
type
|
|
12
|
+
type AgentInvokeResponse,
|
|
11
13
|
type AgentListParams,
|
|
12
14
|
type AgentChatParams,
|
|
13
15
|
type AgentChatParamsNonStreaming,
|
|
14
16
|
type AgentChatParamsStreaming,
|
|
15
|
-
type
|
|
16
|
-
type
|
|
17
|
-
type
|
|
17
|
+
type AgentInvokeParams,
|
|
18
|
+
type AgentInvokeParamsNonStreaming,
|
|
19
|
+
type AgentInvokeParamsStreaming,
|
|
18
20
|
type AgentsCursor,
|
|
19
21
|
} from './agents';
|
|
20
22
|
export { ClientTokens, type ClientTokenCreateResponse, type ClientTokenCreateParams } from './client-tokens';
|
|
@@ -31,12 +33,20 @@ export {
|
|
|
31
33
|
type ExecutionLogListParams,
|
|
32
34
|
type ExecutionLogsCursor,
|
|
33
35
|
} from './execution-logs';
|
|
36
|
+
export { Knowledge, type KnowledgeSearchResponse, type KnowledgeSearchParams } from './knowledge/knowledge';
|
|
37
|
+
export {
|
|
38
|
+
MemoryResource,
|
|
39
|
+
type Memory,
|
|
40
|
+
type MemoryListResponse,
|
|
41
|
+
type MemoryDeleteAllResponse,
|
|
42
|
+
type MemoryStoreParams,
|
|
43
|
+
} from './memory';
|
|
34
44
|
export { Projects, type Project } from './projects';
|
|
35
45
|
export {
|
|
36
46
|
Tools,
|
|
37
47
|
type Tool,
|
|
38
|
-
type
|
|
48
|
+
type ToolCallResponse,
|
|
39
49
|
type ToolListParams,
|
|
40
|
-
type
|
|
50
|
+
type ToolCallParams,
|
|
41
51
|
type ToolsCursor,
|
|
42
52
|
} from './tools';
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../../../core/resource';
|
|
4
|
+
import * as DocumentsAPI from './documents';
|
|
5
|
+
import {
|
|
6
|
+
DocumentDeleteParams,
|
|
7
|
+
DocumentListParams,
|
|
8
|
+
DocumentProcessParams,
|
|
9
|
+
DocumentProcessResponse,
|
|
10
|
+
DocumentRetrieveParams,
|
|
11
|
+
DocumentUploadParams,
|
|
12
|
+
DocumentUploadResponse,
|
|
13
|
+
Documents,
|
|
14
|
+
KnowledgeDocument,
|
|
15
|
+
KnowledgeDocumentsCursor,
|
|
16
|
+
} from './documents';
|
|
17
|
+
import { APIPromise } from '../../../core/api-promise';
|
|
18
|
+
import { Cursor, type CursorParams, PagePromise } from '../../../core/pagination';
|
|
19
|
+
import { buildHeaders } from '../../../internal/headers';
|
|
20
|
+
import { RequestOptions } from '../../../internal/request-options';
|
|
21
|
+
import { path } from '../../../internal/utils/path';
|
|
22
|
+
|
|
23
|
+
export class Collections extends APIResource {
|
|
24
|
+
documents: DocumentsAPI.Documents = new DocumentsAPI.Documents(this._client);
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Create a new knowledge collection for storing documents.
|
|
28
|
+
*/
|
|
29
|
+
create(body: CollectionCreateParams, options?: RequestOptions): APIPromise<KnowledgeCollection> {
|
|
30
|
+
return this._client.post('/knowledge/collections', { body, ...options });
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Get details of a knowledge collection including document stats.
|
|
35
|
+
*/
|
|
36
|
+
retrieve(id: string, options?: RequestOptions): APIPromise<KnowledgeCollection> {
|
|
37
|
+
return this._client.get(path`/knowledge/collections/${id}`, options);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Update a knowledge collection name or description.
|
|
42
|
+
*/
|
|
43
|
+
update(
|
|
44
|
+
id: string,
|
|
45
|
+
body: CollectionUpdateParams | null | undefined = {},
|
|
46
|
+
options?: RequestOptions,
|
|
47
|
+
): APIPromise<KnowledgeCollection> {
|
|
48
|
+
return this._client.patch(path`/knowledge/collections/${id}`, { body, ...options });
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* List all knowledge collections for the project.
|
|
53
|
+
*/
|
|
54
|
+
list(
|
|
55
|
+
query: CollectionListParams | null | undefined = {},
|
|
56
|
+
options?: RequestOptions,
|
|
57
|
+
): PagePromise<KnowledgeCollectionsCursor, KnowledgeCollection> {
|
|
58
|
+
return this._client.getAPIList('/knowledge/collections', Cursor<KnowledgeCollection>, {
|
|
59
|
+
query,
|
|
60
|
+
...options,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Delete a knowledge collection and all its documents.
|
|
66
|
+
*/
|
|
67
|
+
delete(id: string, options?: RequestOptions): APIPromise<void> {
|
|
68
|
+
return this._client.delete(path`/knowledge/collections/${id}`, {
|
|
69
|
+
...options,
|
|
70
|
+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export type KnowledgeCollectionsCursor = Cursor<KnowledgeCollection>;
|
|
76
|
+
|
|
77
|
+
export interface KnowledgeCollection {
|
|
78
|
+
/**
|
|
79
|
+
* Unique collection ID
|
|
80
|
+
*/
|
|
81
|
+
id: string;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* When the collection was created
|
|
85
|
+
*/
|
|
86
|
+
createdAt: string;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Collection description
|
|
90
|
+
*/
|
|
91
|
+
description: string | null;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Embedding model used
|
|
95
|
+
*/
|
|
96
|
+
embeddingModel: string;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Collection name
|
|
100
|
+
*/
|
|
101
|
+
name: string;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Project ID
|
|
105
|
+
*/
|
|
106
|
+
projectId: string;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* When the collection was last updated
|
|
110
|
+
*/
|
|
111
|
+
updatedAt: string;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Total number of documents
|
|
115
|
+
*/
|
|
116
|
+
documentCount?: number;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Number of processed documents
|
|
120
|
+
*/
|
|
121
|
+
readyDocumentCount?: number;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export interface CollectionCreateParams {
|
|
125
|
+
/**
|
|
126
|
+
* Collection name
|
|
127
|
+
*/
|
|
128
|
+
name: string;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Collection description
|
|
132
|
+
*/
|
|
133
|
+
description?: string;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export interface CollectionUpdateParams {
|
|
137
|
+
description?: string;
|
|
138
|
+
|
|
139
|
+
name?: string;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export interface CollectionListParams extends CursorParams {}
|
|
143
|
+
|
|
144
|
+
Collections.Documents = Documents;
|
|
145
|
+
|
|
146
|
+
export declare namespace Collections {
|
|
147
|
+
export {
|
|
148
|
+
type KnowledgeCollection as KnowledgeCollection,
|
|
149
|
+
type KnowledgeCollectionsCursor as KnowledgeCollectionsCursor,
|
|
150
|
+
type CollectionCreateParams as CollectionCreateParams,
|
|
151
|
+
type CollectionUpdateParams as CollectionUpdateParams,
|
|
152
|
+
type CollectionListParams as CollectionListParams,
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
export {
|
|
156
|
+
Documents as Documents,
|
|
157
|
+
type KnowledgeDocument as KnowledgeDocument,
|
|
158
|
+
type DocumentProcessResponse as DocumentProcessResponse,
|
|
159
|
+
type DocumentUploadResponse as DocumentUploadResponse,
|
|
160
|
+
type KnowledgeDocumentsCursor as KnowledgeDocumentsCursor,
|
|
161
|
+
type DocumentRetrieveParams as DocumentRetrieveParams,
|
|
162
|
+
type DocumentListParams as DocumentListParams,
|
|
163
|
+
type DocumentDeleteParams as DocumentDeleteParams,
|
|
164
|
+
type DocumentProcessParams as DocumentProcessParams,
|
|
165
|
+
type DocumentUploadParams as DocumentUploadParams,
|
|
166
|
+
};
|
|
167
|
+
}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../../../core/resource';
|
|
4
|
+
import { APIPromise } from '../../../core/api-promise';
|
|
5
|
+
import { Cursor, type CursorParams, PagePromise } from '../../../core/pagination';
|
|
6
|
+
import { buildHeaders } from '../../../internal/headers';
|
|
7
|
+
import { RequestOptions } from '../../../internal/request-options';
|
|
8
|
+
import { path } from '../../../internal/utils/path';
|
|
9
|
+
|
|
10
|
+
export class Documents extends APIResource {
|
|
11
|
+
/**
|
|
12
|
+
* Get details of a document.
|
|
13
|
+
*/
|
|
14
|
+
retrieve(
|
|
15
|
+
documentID: string,
|
|
16
|
+
params: DocumentRetrieveParams,
|
|
17
|
+
options?: RequestOptions,
|
|
18
|
+
): APIPromise<KnowledgeDocument> {
|
|
19
|
+
const { collectionId } = params;
|
|
20
|
+
return this._client.get(path`/knowledge/collections/${collectionId}/documents/${documentID}`, options);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* List all documents in a knowledge collection.
|
|
25
|
+
*/
|
|
26
|
+
list(
|
|
27
|
+
id: string,
|
|
28
|
+
query: DocumentListParams | null | undefined = {},
|
|
29
|
+
options?: RequestOptions,
|
|
30
|
+
): PagePromise<KnowledgeDocumentsCursor, KnowledgeDocument> {
|
|
31
|
+
return this._client.getAPIList(path`/knowledge/collections/${id}/documents`, Cursor<KnowledgeDocument>, {
|
|
32
|
+
query,
|
|
33
|
+
...options,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Delete a document and its associated data.
|
|
39
|
+
*/
|
|
40
|
+
delete(documentID: string, params: DocumentDeleteParams, options?: RequestOptions): APIPromise<void> {
|
|
41
|
+
const { collectionId } = params;
|
|
42
|
+
return this._client.delete(path`/knowledge/collections/${collectionId}/documents/${documentID}`, {
|
|
43
|
+
...options,
|
|
44
|
+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Trigger processing for a document after upload.
|
|
50
|
+
*
|
|
51
|
+
* This extracts text from the document, splits it into chunks, generates
|
|
52
|
+
* embeddings, and stores them for search.
|
|
53
|
+
*
|
|
54
|
+
* The document status will transition: pending → processing → ready (or failed).
|
|
55
|
+
*/
|
|
56
|
+
process(
|
|
57
|
+
documentID: string,
|
|
58
|
+
params: DocumentProcessParams,
|
|
59
|
+
options?: RequestOptions,
|
|
60
|
+
): APIPromise<DocumentProcessResponse> {
|
|
61
|
+
const { collectionId, ...body } = params;
|
|
62
|
+
return this._client.post(path`/knowledge/collections/${collectionId}/documents/${documentID}/process`, {
|
|
63
|
+
body,
|
|
64
|
+
...options,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Create a document record and get a presigned URL for upload.
|
|
70
|
+
*
|
|
71
|
+
* After receiving the response, upload the file to the presigned URL using a PUT
|
|
72
|
+
* request. The document will be processed automatically after upload.
|
|
73
|
+
*/
|
|
74
|
+
upload(
|
|
75
|
+
id: string,
|
|
76
|
+
body: DocumentUploadParams,
|
|
77
|
+
options?: RequestOptions,
|
|
78
|
+
): APIPromise<DocumentUploadResponse> {
|
|
79
|
+
return this._client.post(path`/knowledge/collections/${id}/documents`, { body, ...options });
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export type KnowledgeDocumentsCursor = Cursor<KnowledgeDocument>;
|
|
84
|
+
|
|
85
|
+
export interface KnowledgeDocument {
|
|
86
|
+
/**
|
|
87
|
+
* Unique document ID
|
|
88
|
+
*/
|
|
89
|
+
id: string;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Collection ID
|
|
93
|
+
*/
|
|
94
|
+
collectionId: string;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* When the document was created
|
|
98
|
+
*/
|
|
99
|
+
createdAt: string;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* MIME type
|
|
103
|
+
*/
|
|
104
|
+
mimeType: string;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Document name
|
|
108
|
+
*/
|
|
109
|
+
name: string;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* S3 URL of the document
|
|
113
|
+
*/
|
|
114
|
+
sourceUrl: string;
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Processing status
|
|
118
|
+
*/
|
|
119
|
+
status: 'pending' | 'processing' | 'ready' | 'failed';
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* When the document was last updated
|
|
123
|
+
*/
|
|
124
|
+
updatedAt: string;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Document metadata
|
|
128
|
+
*/
|
|
129
|
+
metadata?: unknown;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export interface DocumentProcessResponse {
|
|
133
|
+
document: KnowledgeDocument;
|
|
134
|
+
|
|
135
|
+
message: string;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export interface DocumentUploadResponse {
|
|
139
|
+
document: KnowledgeDocument;
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Presigned URL for uploading the file
|
|
143
|
+
*/
|
|
144
|
+
uploadUrl: string;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export interface DocumentRetrieveParams {
|
|
148
|
+
collectionId: string;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export interface DocumentListParams extends CursorParams {
|
|
152
|
+
status?: 'pending' | 'processing' | 'ready' | 'failed';
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export interface DocumentDeleteParams {
|
|
156
|
+
collectionId: string;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export interface DocumentProcessParams {
|
|
160
|
+
/**
|
|
161
|
+
* Path param
|
|
162
|
+
*/
|
|
163
|
+
collectionId: string;
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Body param: Use Unstructured.io for extraction if available
|
|
167
|
+
*/
|
|
168
|
+
preferUnstructured?: boolean;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export interface DocumentUploadParams {
|
|
172
|
+
/**
|
|
173
|
+
* MIME type of the document
|
|
174
|
+
*/
|
|
175
|
+
mimeType: string;
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Document name (filename)
|
|
179
|
+
*/
|
|
180
|
+
name: string;
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* File size in bytes
|
|
184
|
+
*/
|
|
185
|
+
size?: number;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export declare namespace Documents {
|
|
189
|
+
export {
|
|
190
|
+
type KnowledgeDocument as KnowledgeDocument,
|
|
191
|
+
type DocumentProcessResponse as DocumentProcessResponse,
|
|
192
|
+
type DocumentUploadResponse as DocumentUploadResponse,
|
|
193
|
+
type KnowledgeDocumentsCursor as KnowledgeDocumentsCursor,
|
|
194
|
+
type DocumentRetrieveParams as DocumentRetrieveParams,
|
|
195
|
+
type DocumentListParams as DocumentListParams,
|
|
196
|
+
type DocumentDeleteParams as DocumentDeleteParams,
|
|
197
|
+
type DocumentProcessParams as DocumentProcessParams,
|
|
198
|
+
type DocumentUploadParams as DocumentUploadParams,
|
|
199
|
+
};
|
|
200
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
export {
|
|
4
|
+
Collections,
|
|
5
|
+
type KnowledgeCollection,
|
|
6
|
+
type CollectionCreateParams,
|
|
7
|
+
type CollectionUpdateParams,
|
|
8
|
+
type CollectionListParams,
|
|
9
|
+
type KnowledgeCollectionsCursor,
|
|
10
|
+
} from './collections';
|
|
11
|
+
export {
|
|
12
|
+
Documents,
|
|
13
|
+
type KnowledgeDocument,
|
|
14
|
+
type DocumentProcessResponse,
|
|
15
|
+
type DocumentUploadResponse,
|
|
16
|
+
type DocumentRetrieveParams,
|
|
17
|
+
type DocumentListParams,
|
|
18
|
+
type DocumentDeleteParams,
|
|
19
|
+
type DocumentProcessParams,
|
|
20
|
+
type DocumentUploadParams,
|
|
21
|
+
type KnowledgeDocumentsCursor,
|
|
22
|
+
} from './documents';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
export {
|
|
4
|
+
Collections,
|
|
5
|
+
type KnowledgeCollection,
|
|
6
|
+
type CollectionCreateParams,
|
|
7
|
+
type CollectionUpdateParams,
|
|
8
|
+
type CollectionListParams,
|
|
9
|
+
type KnowledgeCollectionsCursor,
|
|
10
|
+
} from './collections/index';
|
|
11
|
+
export { Knowledge, type KnowledgeSearchResponse, type KnowledgeSearchParams } from './knowledge';
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../../core/resource';
|
|
4
|
+
import * as CollectionsAPI from './collections/collections';
|
|
5
|
+
import {
|
|
6
|
+
CollectionCreateParams,
|
|
7
|
+
CollectionListParams,
|
|
8
|
+
CollectionUpdateParams,
|
|
9
|
+
Collections,
|
|
10
|
+
KnowledgeCollection,
|
|
11
|
+
KnowledgeCollectionsCursor,
|
|
12
|
+
} from './collections/collections';
|
|
13
|
+
import { APIPromise } from '../../core/api-promise';
|
|
14
|
+
import { RequestOptions } from '../../internal/request-options';
|
|
15
|
+
|
|
16
|
+
export class Knowledge extends APIResource {
|
|
17
|
+
collections: CollectionsAPI.Collections = new CollectionsAPI.Collections(this._client);
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Search across one or more knowledge collections using semantic similarity.
|
|
21
|
+
*
|
|
22
|
+
* The search uses vector embeddings to find the most relevant content. Results are
|
|
23
|
+
* ordered by relevance score (0-1, higher is more similar).
|
|
24
|
+
*/
|
|
25
|
+
search(body: KnowledgeSearchParams, options?: RequestOptions): APIPromise<KnowledgeSearchResponse> {
|
|
26
|
+
return this._client.post('/knowledge/search', { body, ...options });
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface KnowledgeSearchResponse {
|
|
31
|
+
chunks: Array<KnowledgeSearchResponse.Chunk>;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Number of results found
|
|
35
|
+
*/
|
|
36
|
+
count: number;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export namespace KnowledgeSearchResponse {
|
|
40
|
+
export interface Chunk {
|
|
41
|
+
/**
|
|
42
|
+
* Position in document
|
|
43
|
+
*/
|
|
44
|
+
chunkIndex: number;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Chunk text content
|
|
48
|
+
*/
|
|
49
|
+
content: string;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Source document ID
|
|
53
|
+
*/
|
|
54
|
+
documentId: string;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Similarity score (0-1)
|
|
58
|
+
*/
|
|
59
|
+
score: number;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface KnowledgeSearchParams {
|
|
64
|
+
/**
|
|
65
|
+
* Collection IDs to search
|
|
66
|
+
*/
|
|
67
|
+
collectionIds: Array<string>;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Natural language search query
|
|
71
|
+
*/
|
|
72
|
+
query: string;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Maximum number of results
|
|
76
|
+
*/
|
|
77
|
+
limit?: number;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Minimum similarity score (0-1)
|
|
81
|
+
*/
|
|
82
|
+
threshold?: number;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
Knowledge.Collections = Collections;
|
|
86
|
+
|
|
87
|
+
export declare namespace Knowledge {
|
|
88
|
+
export {
|
|
89
|
+
type KnowledgeSearchResponse as KnowledgeSearchResponse,
|
|
90
|
+
type KnowledgeSearchParams as KnowledgeSearchParams,
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export {
|
|
94
|
+
Collections as Collections,
|
|
95
|
+
type KnowledgeCollection as KnowledgeCollection,
|
|
96
|
+
type KnowledgeCollectionsCursor as KnowledgeCollectionsCursor,
|
|
97
|
+
type CollectionCreateParams as CollectionCreateParams,
|
|
98
|
+
type CollectionUpdateParams as CollectionUpdateParams,
|
|
99
|
+
type CollectionListParams as CollectionListParams,
|
|
100
|
+
};
|
|
101
|
+
}
|