weave-typescript 0.26.0 → 0.28.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/dist/weaveapi/consolidation/v1/consolidation.pb.d.ts +134 -0
- package/dist/weaveapi/consolidation/v1/consolidation.pb.js +1620 -0
- package/dist/weaveapi/consolidation/v1/service.pb.d.ts +93 -0
- package/dist/weaveapi/consolidation/v1/service.pb.js +427 -0
- package/dist/weaveapi/ingestion/v1/ingestion.pb.d.ts +433 -0
- package/dist/weaveapi/ingestion/v1/ingestion.pb.js +5626 -0
- package/dist/weaveapi/ingestion/v1/service.pb.d.ts +181 -0
- package/dist/weaveapi/ingestion/v1/service.pb.js +917 -0
- package/dist/weaveapi/model/v1/model.pb.d.ts +10 -0
- package/dist/weaveapi/model/v1/model.pb.js +181 -1
- package/dist/weaveapi/model/v1/service.pb.d.ts +50 -1
- package/dist/weaveapi/model/v1/service.pb.js +464 -1
- package/dist/weaveapi/retrieval/v1/retrieval.pb.d.ts +161 -0
- package/dist/weaveapi/retrieval/v1/retrieval.pb.js +1885 -0
- package/dist/weaveapi/retrieval/v1/service.pb.d.ts +51 -0
- package/dist/weaveapi/retrieval/v1/service.pb.js +164 -0
- package/dist/weavesql/weavedb/chat_sql.d.ts +12 -5
- package/dist/weavesql/weavedb/chat_sql.js +21 -14
- package/dist/weavesql/weavedb/consolidation_sql.d.ts +212 -0
- package/dist/weavesql/weavedb/consolidation_sql.js +470 -0
- package/dist/weavesql/weavedb/document_security_sql.d.ts +128 -0
- package/dist/weavesql/weavedb/document_security_sql.js +284 -0
- package/dist/weavesql/weavedb/ingestion_sql.d.ts +1108 -0
- package/dist/weavesql/weavedb/ingestion_sql.js +2503 -0
- package/dist/weavesql/weavedb/retrieval_sql.d.ts +284 -0
- package/dist/weavesql/weavedb/retrieval_sql.js +769 -0
- package/package.json +2 -2
|
@@ -0,0 +1,1108 @@
|
|
|
1
|
+
import { QueryArrayConfig, QueryArrayResult } from "pg";
|
|
2
|
+
interface Client {
|
|
3
|
+
query: (config: QueryArrayConfig) => Promise<QueryArrayResult>;
|
|
4
|
+
}
|
|
5
|
+
export declare const createDocumentQuery = "-- name: CreateDocument :one\nINSERT INTO weave.documents (\n id,\n organization_id,\n filename,\n mime_type,\n fingerprint,\n storage_ref,\n status,\n scope,\n sensitivity_tags,\n uploaded_by_user_id,\n metadata\n) VALUES (\n $1,\n $2,\n $3,\n $4,\n $5,\n $6,\n $7,\n $8,\n $9,\n $10,\n $11\n)\nRETURNING\n id,\n organization_id,\n filename,\n mime_type,\n parser_name,\n fingerprint,\n storage_ref,\n status,\n scope,\n sensitivity_tags,\n uploaded_by_user_id,\n uploaded_at,\n updated_at,\n page_count,\n char_count,\n metadata";
|
|
6
|
+
export interface CreateDocumentArgs {
|
|
7
|
+
id: string;
|
|
8
|
+
organizationId: string;
|
|
9
|
+
filename: string;
|
|
10
|
+
mimeType: string;
|
|
11
|
+
fingerprint: Buffer | null;
|
|
12
|
+
storageRef: string;
|
|
13
|
+
status: string;
|
|
14
|
+
scope: string;
|
|
15
|
+
sensitivityTags: string[];
|
|
16
|
+
uploadedByUserId: string;
|
|
17
|
+
metadata: any;
|
|
18
|
+
}
|
|
19
|
+
export interface CreateDocumentRow {
|
|
20
|
+
id: string;
|
|
21
|
+
organizationId: string;
|
|
22
|
+
filename: string;
|
|
23
|
+
mimeType: string;
|
|
24
|
+
parserName: string;
|
|
25
|
+
fingerprint: Buffer | null;
|
|
26
|
+
storageRef: string;
|
|
27
|
+
status: string;
|
|
28
|
+
scope: string;
|
|
29
|
+
sensitivityTags: string[];
|
|
30
|
+
uploadedByUserId: string;
|
|
31
|
+
uploadedAt: Date;
|
|
32
|
+
updatedAt: Date;
|
|
33
|
+
pageCount: number | null;
|
|
34
|
+
charCount: number | null;
|
|
35
|
+
metadata: any;
|
|
36
|
+
}
|
|
37
|
+
export declare function createDocument(client: Client, args: CreateDocumentArgs): Promise<CreateDocumentRow | null>;
|
|
38
|
+
export declare const getDocumentByOrganizationAndIDQuery = "-- name: GetDocumentByOrganizationAndID :one\nSELECT\n id,\n organization_id,\n filename,\n mime_type,\n parser_name,\n fingerprint,\n storage_ref,\n status,\n scope,\n sensitivity_tags,\n uploaded_by_user_id,\n uploaded_at,\n updated_at,\n page_count,\n char_count,\n metadata\nFROM weave.documents\nWHERE organization_id = $1\n AND id = $2";
|
|
39
|
+
export interface GetDocumentByOrganizationAndIDArgs {
|
|
40
|
+
organizationId: string;
|
|
41
|
+
id: string;
|
|
42
|
+
}
|
|
43
|
+
export interface GetDocumentByOrganizationAndIDRow {
|
|
44
|
+
id: string;
|
|
45
|
+
organizationId: string;
|
|
46
|
+
filename: string;
|
|
47
|
+
mimeType: string;
|
|
48
|
+
parserName: string;
|
|
49
|
+
fingerprint: Buffer | null;
|
|
50
|
+
storageRef: string;
|
|
51
|
+
status: string;
|
|
52
|
+
scope: string;
|
|
53
|
+
sensitivityTags: string[];
|
|
54
|
+
uploadedByUserId: string;
|
|
55
|
+
uploadedAt: Date;
|
|
56
|
+
updatedAt: Date;
|
|
57
|
+
pageCount: number | null;
|
|
58
|
+
charCount: number | null;
|
|
59
|
+
metadata: any;
|
|
60
|
+
}
|
|
61
|
+
export declare function getDocumentByOrganizationAndID(client: Client, args: GetDocumentByOrganizationAndIDArgs): Promise<GetDocumentByOrganizationAndIDRow | null>;
|
|
62
|
+
export declare const getDocumentByOrganizationAndFingerprintQuery = "-- name: GetDocumentByOrganizationAndFingerprint :one\nSELECT\n id,\n organization_id,\n filename,\n mime_type,\n parser_name,\n fingerprint,\n storage_ref,\n status,\n scope,\n sensitivity_tags,\n uploaded_by_user_id,\n uploaded_at,\n updated_at,\n page_count,\n char_count,\n metadata\nFROM weave.documents\nWHERE organization_id = $1\n AND fingerprint = $2";
|
|
63
|
+
export interface GetDocumentByOrganizationAndFingerprintArgs {
|
|
64
|
+
organizationId: string;
|
|
65
|
+
fingerprint: Buffer | null;
|
|
66
|
+
}
|
|
67
|
+
export interface GetDocumentByOrganizationAndFingerprintRow {
|
|
68
|
+
id: string;
|
|
69
|
+
organizationId: string;
|
|
70
|
+
filename: string;
|
|
71
|
+
mimeType: string;
|
|
72
|
+
parserName: string;
|
|
73
|
+
fingerprint: Buffer | null;
|
|
74
|
+
storageRef: string;
|
|
75
|
+
status: string;
|
|
76
|
+
scope: string;
|
|
77
|
+
sensitivityTags: string[];
|
|
78
|
+
uploadedByUserId: string;
|
|
79
|
+
uploadedAt: Date;
|
|
80
|
+
updatedAt: Date;
|
|
81
|
+
pageCount: number | null;
|
|
82
|
+
charCount: number | null;
|
|
83
|
+
metadata: any;
|
|
84
|
+
}
|
|
85
|
+
export declare function getDocumentByOrganizationAndFingerprint(client: Client, args: GetDocumentByOrganizationAndFingerprintArgs): Promise<GetDocumentByOrganizationAndFingerprintRow | null>;
|
|
86
|
+
export declare const setDocumentParseResultQuery = "-- name: SetDocumentParseResult :one\nUPDATE weave.documents\nSET\n parser_name = $1,\n status = $2,\n page_count = $3,\n char_count = $4,\n updated_at = now()\nWHERE organization_id = $5\n AND id = $6\nRETURNING\n id,\n organization_id,\n filename,\n mime_type,\n parser_name,\n fingerprint,\n storage_ref,\n status,\n scope,\n sensitivity_tags,\n uploaded_by_user_id,\n uploaded_at,\n updated_at,\n page_count,\n char_count,\n metadata";
|
|
87
|
+
export interface SetDocumentParseResultArgs {
|
|
88
|
+
parserName: string;
|
|
89
|
+
status: string;
|
|
90
|
+
pageCount: number | null;
|
|
91
|
+
charCount: number | null;
|
|
92
|
+
organizationId: string;
|
|
93
|
+
id: string;
|
|
94
|
+
}
|
|
95
|
+
export interface SetDocumentParseResultRow {
|
|
96
|
+
id: string;
|
|
97
|
+
organizationId: string;
|
|
98
|
+
filename: string;
|
|
99
|
+
mimeType: string;
|
|
100
|
+
parserName: string;
|
|
101
|
+
fingerprint: Buffer | null;
|
|
102
|
+
storageRef: string;
|
|
103
|
+
status: string;
|
|
104
|
+
scope: string;
|
|
105
|
+
sensitivityTags: string[];
|
|
106
|
+
uploadedByUserId: string;
|
|
107
|
+
uploadedAt: Date;
|
|
108
|
+
updatedAt: Date;
|
|
109
|
+
pageCount: number | null;
|
|
110
|
+
charCount: number | null;
|
|
111
|
+
metadata: any;
|
|
112
|
+
}
|
|
113
|
+
export declare function setDocumentParseResult(client: Client, args: SetDocumentParseResultArgs): Promise<SetDocumentParseResultRow | null>;
|
|
114
|
+
export declare const setDocumentStatusQuery = "-- name: SetDocumentStatus :one\nUPDATE weave.documents\nSET\n status = $1,\n updated_at = now()\nWHERE organization_id = $2\n AND id = $3\nRETURNING\n id,\n organization_id,\n filename,\n mime_type,\n parser_name,\n fingerprint,\n storage_ref,\n status,\n scope,\n sensitivity_tags,\n uploaded_by_user_id,\n uploaded_at,\n updated_at,\n page_count,\n char_count,\n metadata";
|
|
115
|
+
export interface SetDocumentStatusArgs {
|
|
116
|
+
status: string;
|
|
117
|
+
organizationId: string;
|
|
118
|
+
id: string;
|
|
119
|
+
}
|
|
120
|
+
export interface SetDocumentStatusRow {
|
|
121
|
+
id: string;
|
|
122
|
+
organizationId: string;
|
|
123
|
+
filename: string;
|
|
124
|
+
mimeType: string;
|
|
125
|
+
parserName: string;
|
|
126
|
+
fingerprint: Buffer | null;
|
|
127
|
+
storageRef: string;
|
|
128
|
+
status: string;
|
|
129
|
+
scope: string;
|
|
130
|
+
sensitivityTags: string[];
|
|
131
|
+
uploadedByUserId: string;
|
|
132
|
+
uploadedAt: Date;
|
|
133
|
+
updatedAt: Date;
|
|
134
|
+
pageCount: number | null;
|
|
135
|
+
charCount: number | null;
|
|
136
|
+
metadata: any;
|
|
137
|
+
}
|
|
138
|
+
export declare function setDocumentStatus(client: Client, args: SetDocumentStatusArgs): Promise<SetDocumentStatusRow | null>;
|
|
139
|
+
export declare const listDocumentsByOrganizationQuery = "-- name: ListDocumentsByOrganization :many\nSELECT\n id,\n organization_id,\n filename,\n mime_type,\n parser_name,\n fingerprint,\n storage_ref,\n status,\n scope,\n sensitivity_tags,\n uploaded_by_user_id,\n uploaded_at,\n updated_at,\n page_count,\n char_count,\n metadata\nFROM weave.documents\nWHERE organization_id = $1\nORDER BY uploaded_at DESC\nLIMIT $3 OFFSET $2";
|
|
140
|
+
export interface ListDocumentsByOrganizationArgs {
|
|
141
|
+
organizationId: string;
|
|
142
|
+
pageOffset: string;
|
|
143
|
+
pageSize: string;
|
|
144
|
+
}
|
|
145
|
+
export interface ListDocumentsByOrganizationRow {
|
|
146
|
+
id: string;
|
|
147
|
+
organizationId: string;
|
|
148
|
+
filename: string;
|
|
149
|
+
mimeType: string;
|
|
150
|
+
parserName: string;
|
|
151
|
+
fingerprint: Buffer | null;
|
|
152
|
+
storageRef: string;
|
|
153
|
+
status: string;
|
|
154
|
+
scope: string;
|
|
155
|
+
sensitivityTags: string[];
|
|
156
|
+
uploadedByUserId: string;
|
|
157
|
+
uploadedAt: Date;
|
|
158
|
+
updatedAt: Date;
|
|
159
|
+
pageCount: number | null;
|
|
160
|
+
charCount: number | null;
|
|
161
|
+
metadata: any;
|
|
162
|
+
}
|
|
163
|
+
export declare function listDocumentsByOrganization(client: Client, args: ListDocumentsByOrganizationArgs): Promise<ListDocumentsByOrganizationRow[]>;
|
|
164
|
+
export declare const getDatabaseConfigQuery = "-- name: GetDatabaseConfig :one\nSELECT\n id,\n embedding_dimension,\n deployment_mode,\n created_at,\n updated_at\nFROM weave.database_config\nWHERE id = 1";
|
|
165
|
+
export interface GetDatabaseConfigRow {
|
|
166
|
+
id: number;
|
|
167
|
+
embeddingDimension: number;
|
|
168
|
+
deploymentMode: string;
|
|
169
|
+
createdAt: Date;
|
|
170
|
+
updatedAt: Date;
|
|
171
|
+
}
|
|
172
|
+
export declare function getDatabaseConfig(client: Client): Promise<GetDatabaseConfigRow | null>;
|
|
173
|
+
export declare const createIngestionRunQuery = "-- name: CreateIngestionRun :one\nINSERT INTO weave.ingestion_runs (\n id,\n organization_id,\n document_id,\n status,\n reasoning_model_id,\n reasoning_provider_configuration_id,\n embedding_model_id,\n embedding_provider_configuration_id,\n embedding_dimensions\n) VALUES (\n $1,\n $2,\n $3,\n $4,\n $5,\n $6,\n $7,\n $8,\n $9\n)\nRETURNING\n id,\n organization_id,\n document_id,\n status,\n reasoning_model_id,\n reasoning_provider_configuration_id,\n embedding_model_id,\n embedding_provider_configuration_id,\n embedding_dimensions,\n thread_count,\n pending_count,\n approved_count,\n rejected_count,\n error,\n token_usage,\n started_at,\n completed_at,\n committed_at";
|
|
174
|
+
export interface CreateIngestionRunArgs {
|
|
175
|
+
id: string;
|
|
176
|
+
organizationId: string;
|
|
177
|
+
documentId: string;
|
|
178
|
+
status: string;
|
|
179
|
+
reasoningModelId: string | null;
|
|
180
|
+
reasoningProviderConfigurationId: string | null;
|
|
181
|
+
embeddingModelId: string | null;
|
|
182
|
+
embeddingProviderConfigurationId: string | null;
|
|
183
|
+
embeddingDimensions: number | null;
|
|
184
|
+
}
|
|
185
|
+
export interface CreateIngestionRunRow {
|
|
186
|
+
id: string;
|
|
187
|
+
organizationId: string;
|
|
188
|
+
documentId: string;
|
|
189
|
+
status: string;
|
|
190
|
+
reasoningModelId: string | null;
|
|
191
|
+
reasoningProviderConfigurationId: string | null;
|
|
192
|
+
embeddingModelId: string | null;
|
|
193
|
+
embeddingProviderConfigurationId: string | null;
|
|
194
|
+
embeddingDimensions: number | null;
|
|
195
|
+
threadCount: number;
|
|
196
|
+
pendingCount: number;
|
|
197
|
+
approvedCount: number;
|
|
198
|
+
rejectedCount: number;
|
|
199
|
+
error: string;
|
|
200
|
+
tokenUsage: any;
|
|
201
|
+
startedAt: Date;
|
|
202
|
+
completedAt: Date | null;
|
|
203
|
+
committedAt: Date | null;
|
|
204
|
+
}
|
|
205
|
+
export declare function createIngestionRun(client: Client, args: CreateIngestionRunArgs): Promise<CreateIngestionRunRow | null>;
|
|
206
|
+
export declare const getIngestionRunByOrganizationAndIDQuery = "-- name: GetIngestionRunByOrganizationAndID :one\nSELECT\n id,\n organization_id,\n document_id,\n status,\n reasoning_model_id,\n reasoning_provider_configuration_id,\n embedding_model_id,\n embedding_provider_configuration_id,\n embedding_dimensions,\n thread_count,\n pending_count,\n approved_count,\n rejected_count,\n error,\n token_usage,\n started_at,\n completed_at,\n committed_at\nFROM weave.ingestion_runs\nWHERE organization_id = $1\n AND id = $2";
|
|
207
|
+
export interface GetIngestionRunByOrganizationAndIDArgs {
|
|
208
|
+
organizationId: string;
|
|
209
|
+
id: string;
|
|
210
|
+
}
|
|
211
|
+
export interface GetIngestionRunByOrganizationAndIDRow {
|
|
212
|
+
id: string;
|
|
213
|
+
organizationId: string;
|
|
214
|
+
documentId: string;
|
|
215
|
+
status: string;
|
|
216
|
+
reasoningModelId: string | null;
|
|
217
|
+
reasoningProviderConfigurationId: string | null;
|
|
218
|
+
embeddingModelId: string | null;
|
|
219
|
+
embeddingProviderConfigurationId: string | null;
|
|
220
|
+
embeddingDimensions: number | null;
|
|
221
|
+
threadCount: number;
|
|
222
|
+
pendingCount: number;
|
|
223
|
+
approvedCount: number;
|
|
224
|
+
rejectedCount: number;
|
|
225
|
+
error: string;
|
|
226
|
+
tokenUsage: any;
|
|
227
|
+
startedAt: Date;
|
|
228
|
+
completedAt: Date | null;
|
|
229
|
+
committedAt: Date | null;
|
|
230
|
+
}
|
|
231
|
+
export declare function getIngestionRunByOrganizationAndID(client: Client, args: GetIngestionRunByOrganizationAndIDArgs): Promise<GetIngestionRunByOrganizationAndIDRow | null>;
|
|
232
|
+
export declare const updateIngestionRunStateQuery = "-- name: UpdateIngestionRunState :one\nUPDATE weave.ingestion_runs\nSET\n status = $1,\n thread_count = $2,\n pending_count = $3,\n approved_count = $4,\n rejected_count = $5,\n error = $6,\n token_usage = $7,\n completed_at = $8,\n committed_at = $9\nWHERE id = $10\n AND organization_id = $11\nRETURNING\n id,\n organization_id,\n document_id,\n status,\n reasoning_model_id,\n reasoning_provider_configuration_id,\n embedding_model_id,\n embedding_provider_configuration_id,\n embedding_dimensions,\n thread_count,\n pending_count,\n approved_count,\n rejected_count,\n error,\n token_usage,\n started_at,\n completed_at,\n committed_at";
|
|
233
|
+
export interface UpdateIngestionRunStateArgs {
|
|
234
|
+
status: string;
|
|
235
|
+
threadCount: number;
|
|
236
|
+
pendingCount: number;
|
|
237
|
+
approvedCount: number;
|
|
238
|
+
rejectedCount: number;
|
|
239
|
+
error: string;
|
|
240
|
+
tokenUsage: any;
|
|
241
|
+
completedAt: Date | null;
|
|
242
|
+
committedAt: Date | null;
|
|
243
|
+
id: string;
|
|
244
|
+
organizationId: string;
|
|
245
|
+
}
|
|
246
|
+
export interface UpdateIngestionRunStateRow {
|
|
247
|
+
id: string;
|
|
248
|
+
organizationId: string;
|
|
249
|
+
documentId: string;
|
|
250
|
+
status: string;
|
|
251
|
+
reasoningModelId: string | null;
|
|
252
|
+
reasoningProviderConfigurationId: string | null;
|
|
253
|
+
embeddingModelId: string | null;
|
|
254
|
+
embeddingProviderConfigurationId: string | null;
|
|
255
|
+
embeddingDimensions: number | null;
|
|
256
|
+
threadCount: number;
|
|
257
|
+
pendingCount: number;
|
|
258
|
+
approvedCount: number;
|
|
259
|
+
rejectedCount: number;
|
|
260
|
+
error: string;
|
|
261
|
+
tokenUsage: any;
|
|
262
|
+
startedAt: Date;
|
|
263
|
+
completedAt: Date | null;
|
|
264
|
+
committedAt: Date | null;
|
|
265
|
+
}
|
|
266
|
+
export declare function updateIngestionRunState(client: Client, args: UpdateIngestionRunStateArgs): Promise<UpdateIngestionRunStateRow | null>;
|
|
267
|
+
export declare const listIngestionRunsByOrganizationQuery = "-- name: ListIngestionRunsByOrganization :many\nSELECT\n id,\n organization_id,\n document_id,\n status,\n reasoning_model_id,\n reasoning_provider_configuration_id,\n embedding_model_id,\n embedding_provider_configuration_id,\n embedding_dimensions,\n thread_count,\n pending_count,\n approved_count,\n rejected_count,\n error,\n token_usage,\n started_at,\n completed_at,\n committed_at\nFROM weave.ingestion_runs\nWHERE organization_id = $1\nORDER BY started_at DESC\nLIMIT $3 OFFSET $2";
|
|
268
|
+
export interface ListIngestionRunsByOrganizationArgs {
|
|
269
|
+
organizationId: string;
|
|
270
|
+
pageOffset: string;
|
|
271
|
+
pageSize: string;
|
|
272
|
+
}
|
|
273
|
+
export interface ListIngestionRunsByOrganizationRow {
|
|
274
|
+
id: string;
|
|
275
|
+
organizationId: string;
|
|
276
|
+
documentId: string;
|
|
277
|
+
status: string;
|
|
278
|
+
reasoningModelId: string | null;
|
|
279
|
+
reasoningProviderConfigurationId: string | null;
|
|
280
|
+
embeddingModelId: string | null;
|
|
281
|
+
embeddingProviderConfigurationId: string | null;
|
|
282
|
+
embeddingDimensions: number | null;
|
|
283
|
+
threadCount: number;
|
|
284
|
+
pendingCount: number;
|
|
285
|
+
approvedCount: number;
|
|
286
|
+
rejectedCount: number;
|
|
287
|
+
error: string;
|
|
288
|
+
tokenUsage: any;
|
|
289
|
+
startedAt: Date;
|
|
290
|
+
completedAt: Date | null;
|
|
291
|
+
committedAt: Date | null;
|
|
292
|
+
}
|
|
293
|
+
export declare function listIngestionRunsByOrganization(client: Client, args: ListIngestionRunsByOrganizationArgs): Promise<ListIngestionRunsByOrganizationRow[]>;
|
|
294
|
+
export declare const listIngestionRunsByDocumentQuery = "-- name: ListIngestionRunsByDocument :many\nSELECT\n id,\n organization_id,\n document_id,\n status,\n reasoning_model_id,\n reasoning_provider_configuration_id,\n embedding_model_id,\n embedding_provider_configuration_id,\n embedding_dimensions,\n thread_count,\n pending_count,\n approved_count,\n rejected_count,\n error,\n token_usage,\n started_at,\n completed_at,\n committed_at\nFROM weave.ingestion_runs\nWHERE organization_id = $1\n AND document_id = $2\nORDER BY started_at DESC";
|
|
295
|
+
export interface ListIngestionRunsByDocumentArgs {
|
|
296
|
+
organizationId: string;
|
|
297
|
+
documentId: string;
|
|
298
|
+
}
|
|
299
|
+
export interface ListIngestionRunsByDocumentRow {
|
|
300
|
+
id: string;
|
|
301
|
+
organizationId: string;
|
|
302
|
+
documentId: string;
|
|
303
|
+
status: string;
|
|
304
|
+
reasoningModelId: string | null;
|
|
305
|
+
reasoningProviderConfigurationId: string | null;
|
|
306
|
+
embeddingModelId: string | null;
|
|
307
|
+
embeddingProviderConfigurationId: string | null;
|
|
308
|
+
embeddingDimensions: number | null;
|
|
309
|
+
threadCount: number;
|
|
310
|
+
pendingCount: number;
|
|
311
|
+
approvedCount: number;
|
|
312
|
+
rejectedCount: number;
|
|
313
|
+
error: string;
|
|
314
|
+
tokenUsage: any;
|
|
315
|
+
startedAt: Date;
|
|
316
|
+
completedAt: Date | null;
|
|
317
|
+
committedAt: Date | null;
|
|
318
|
+
}
|
|
319
|
+
export declare function listIngestionRunsByDocument(client: Client, args: ListIngestionRunsByDocumentArgs): Promise<ListIngestionRunsByDocumentRow[]>;
|
|
320
|
+
export declare const listIngestionHistoryQuery = "-- name: ListIngestionHistory :many\nSELECT\n r.id AS ingestion_run_id,\n d.id AS document_id,\n d.filename AS document_name,\n d.status AS document_status,\n r.status AS ingestion_status,\n r.thread_count,\n r.pending_count,\n r.approved_count,\n r.rejected_count,\n d.uploaded_at,\n r.started_at,\n r.completed_at,\n r.committed_at\nFROM weave.ingestion_runs r\nJOIN weave.documents d ON d.id = r.document_id\nWHERE r.organization_id = $1\nORDER BY r.started_at DESC\nLIMIT $3 OFFSET $2";
|
|
321
|
+
export interface ListIngestionHistoryArgs {
|
|
322
|
+
organizationId: string;
|
|
323
|
+
pageOffset: string;
|
|
324
|
+
pageSize: string;
|
|
325
|
+
}
|
|
326
|
+
export interface ListIngestionHistoryRow {
|
|
327
|
+
ingestionRunId: string;
|
|
328
|
+
documentId: string;
|
|
329
|
+
documentName: string;
|
|
330
|
+
documentStatus: string;
|
|
331
|
+
ingestionStatus: string;
|
|
332
|
+
threadCount: number;
|
|
333
|
+
pendingCount: number;
|
|
334
|
+
approvedCount: number;
|
|
335
|
+
rejectedCount: number;
|
|
336
|
+
uploadedAt: Date;
|
|
337
|
+
startedAt: Date;
|
|
338
|
+
completedAt: Date | null;
|
|
339
|
+
committedAt: Date | null;
|
|
340
|
+
}
|
|
341
|
+
export declare function listIngestionHistory(client: Client, args: ListIngestionHistoryArgs): Promise<ListIngestionHistoryRow[]>;
|
|
342
|
+
export declare const deleteDocumentTagsByDocumentIDQuery = "-- name: DeleteDocumentTagsByDocumentID :exec\nDELETE FROM weave.document_tags dt\nUSING weave.documents d\nWHERE dt.document_id = d.id\n AND d.organization_id = $1\n AND dt.document_id = $2";
|
|
343
|
+
export interface DeleteDocumentTagsByDocumentIDArgs {
|
|
344
|
+
organizationId: string;
|
|
345
|
+
documentId: string;
|
|
346
|
+
}
|
|
347
|
+
export declare function deleteDocumentTagsByDocumentID(client: Client, args: DeleteDocumentTagsByDocumentIDArgs): Promise<void>;
|
|
348
|
+
export declare const createDocumentTagQuery = "-- name: CreateDocumentTag :one\nINSERT INTO weave.document_tags (\n document_id,\n tag,\n confidence\n) VALUES (\n $1,\n $2,\n $3\n)\nRETURNING document_id, tag, confidence";
|
|
349
|
+
export interface CreateDocumentTagArgs {
|
|
350
|
+
documentId: string;
|
|
351
|
+
tag: string;
|
|
352
|
+
confidence: number;
|
|
353
|
+
}
|
|
354
|
+
export interface CreateDocumentTagRow {
|
|
355
|
+
documentId: string;
|
|
356
|
+
tag: string;
|
|
357
|
+
confidence: number;
|
|
358
|
+
}
|
|
359
|
+
export declare function createDocumentTag(client: Client, args: CreateDocumentTagArgs): Promise<CreateDocumentTagRow | null>;
|
|
360
|
+
export declare const listDocumentTagsByDocumentIDQuery = "-- name: ListDocumentTagsByDocumentID :many\nSELECT document_id, tag, confidence\nFROM weave.document_tags dt\nJOIN weave.documents d ON d.id = dt.document_id\nWHERE d.organization_id = $1\n AND dt.document_id = $2\nORDER BY confidence DESC, tag ASC";
|
|
361
|
+
export interface ListDocumentTagsByDocumentIDArgs {
|
|
362
|
+
organizationId: string;
|
|
363
|
+
documentId: string;
|
|
364
|
+
}
|
|
365
|
+
export interface ListDocumentTagsByDocumentIDRow {
|
|
366
|
+
documentId: string;
|
|
367
|
+
tag: string;
|
|
368
|
+
confidence: number;
|
|
369
|
+
}
|
|
370
|
+
export declare function listDocumentTagsByDocumentID(client: Client, args: ListDocumentTagsByDocumentIDArgs): Promise<ListDocumentTagsByDocumentIDRow[]>;
|
|
371
|
+
export declare const createThreadQuery = "-- name: CreateThread :one\nINSERT INTO weave.threads (\n id,\n organization_id,\n document_id,\n ingestion_run_id,\n text,\n knowledge_type,\n facet_fields,\n confidence,\n temporal_validity,\n classification,\n retrieval_status,\n source_location,\n metadata\n) VALUES (\n $1,\n $2,\n $3,\n $4,\n $5,\n $6,\n $7,\n $8,\n $9,\n $10,\n $11,\n $12,\n $13\n)\nRETURNING\n id,\n organization_id,\n document_id,\n ingestion_run_id,\n text,\n text_original,\n knowledge_type,\n facet_fields,\n confidence,\n temporal_validity,\n classification,\n retrieval_status,\n source_location,\n superseded_by,\n supersedes,\n cluster_id,\n extracted_at,\n approved_at,\n approved_by_user_id,\n edited,\n metadata";
|
|
372
|
+
export interface CreateThreadArgs {
|
|
373
|
+
id: string;
|
|
374
|
+
organizationId: string;
|
|
375
|
+
documentId: string;
|
|
376
|
+
ingestionRunId: string;
|
|
377
|
+
text: string;
|
|
378
|
+
knowledgeType: string;
|
|
379
|
+
facetFields: any;
|
|
380
|
+
confidence: number;
|
|
381
|
+
temporalValidity: any | null;
|
|
382
|
+
classification: string;
|
|
383
|
+
retrievalStatus: string;
|
|
384
|
+
sourceLocation: any;
|
|
385
|
+
metadata: any;
|
|
386
|
+
}
|
|
387
|
+
export interface CreateThreadRow {
|
|
388
|
+
id: string;
|
|
389
|
+
organizationId: string;
|
|
390
|
+
documentId: string;
|
|
391
|
+
ingestionRunId: string;
|
|
392
|
+
text: string;
|
|
393
|
+
textOriginal: string | null;
|
|
394
|
+
knowledgeType: string;
|
|
395
|
+
facetFields: any;
|
|
396
|
+
confidence: number;
|
|
397
|
+
temporalValidity: any | null;
|
|
398
|
+
classification: string;
|
|
399
|
+
retrievalStatus: string;
|
|
400
|
+
sourceLocation: any;
|
|
401
|
+
supersededBy: string | null;
|
|
402
|
+
supersedes: string[];
|
|
403
|
+
clusterId: string | null;
|
|
404
|
+
extractedAt: Date;
|
|
405
|
+
approvedAt: Date | null;
|
|
406
|
+
approvedByUserId: string | null;
|
|
407
|
+
edited: boolean;
|
|
408
|
+
metadata: any;
|
|
409
|
+
}
|
|
410
|
+
export declare function createThread(client: Client, args: CreateThreadArgs): Promise<CreateThreadRow | null>;
|
|
411
|
+
export declare const getThreadByOrganizationAndIDQuery = "-- name: GetThreadByOrganizationAndID :one\nSELECT\n t.id,\n t.organization_id,\n t.document_id,\n d.filename AS document_name,\n t.ingestion_run_id,\n t.text,\n t.text_original,\n t.knowledge_type,\n t.facet_fields,\n t.confidence,\n t.temporal_validity,\n t.classification,\n t.retrieval_status,\n t.source_location,\n t.superseded_by,\n t.supersedes,\n t.cluster_id,\n t.extracted_at,\n t.approved_at,\n t.approved_by_user_id,\n t.edited,\n t.metadata\nFROM weave.threads t\nJOIN weave.documents d ON d.id = t.document_id\nWHERE t.organization_id = $1\n AND t.id = $2";
|
|
412
|
+
export interface GetThreadByOrganizationAndIDArgs {
|
|
413
|
+
organizationId: string;
|
|
414
|
+
id: string;
|
|
415
|
+
}
|
|
416
|
+
export interface GetThreadByOrganizationAndIDRow {
|
|
417
|
+
id: string;
|
|
418
|
+
organizationId: string;
|
|
419
|
+
documentId: string;
|
|
420
|
+
documentName: string;
|
|
421
|
+
ingestionRunId: string;
|
|
422
|
+
text: string;
|
|
423
|
+
textOriginal: string | null;
|
|
424
|
+
knowledgeType: string;
|
|
425
|
+
facetFields: any;
|
|
426
|
+
confidence: number;
|
|
427
|
+
temporalValidity: any | null;
|
|
428
|
+
classification: string;
|
|
429
|
+
retrievalStatus: string;
|
|
430
|
+
sourceLocation: any;
|
|
431
|
+
supersededBy: string | null;
|
|
432
|
+
supersedes: string[];
|
|
433
|
+
clusterId: string | null;
|
|
434
|
+
extractedAt: Date;
|
|
435
|
+
approvedAt: Date | null;
|
|
436
|
+
approvedByUserId: string | null;
|
|
437
|
+
edited: boolean;
|
|
438
|
+
metadata: any;
|
|
439
|
+
}
|
|
440
|
+
export declare function getThreadByOrganizationAndID(client: Client, args: GetThreadByOrganizationAndIDArgs): Promise<GetThreadByOrganizationAndIDRow | null>;
|
|
441
|
+
export declare const listThreadsByIngestionRunQuery = "-- name: ListThreadsByIngestionRun :many\nSELECT\n t.id,\n t.organization_id,\n t.document_id,\n d.filename AS document_name,\n t.ingestion_run_id,\n t.text,\n t.text_original,\n t.knowledge_type,\n t.facet_fields,\n t.confidence,\n t.temporal_validity,\n t.classification,\n t.retrieval_status,\n t.source_location,\n t.superseded_by,\n t.supersedes,\n t.cluster_id,\n t.extracted_at,\n t.approved_at,\n t.approved_by_user_id,\n t.edited,\n t.metadata\nFROM weave.threads t\nJOIN weave.documents d ON d.id = t.document_id\nWHERE t.organization_id = $1\n AND t.ingestion_run_id = $2\nORDER BY t.extracted_at ASC, t.id ASC";
|
|
442
|
+
export interface ListThreadsByIngestionRunArgs {
|
|
443
|
+
organizationId: string;
|
|
444
|
+
ingestionRunId: string;
|
|
445
|
+
}
|
|
446
|
+
export interface ListThreadsByIngestionRunRow {
|
|
447
|
+
id: string;
|
|
448
|
+
organizationId: string;
|
|
449
|
+
documentId: string;
|
|
450
|
+
documentName: string;
|
|
451
|
+
ingestionRunId: string;
|
|
452
|
+
text: string;
|
|
453
|
+
textOriginal: string | null;
|
|
454
|
+
knowledgeType: string;
|
|
455
|
+
facetFields: any;
|
|
456
|
+
confidence: number;
|
|
457
|
+
temporalValidity: any | null;
|
|
458
|
+
classification: string;
|
|
459
|
+
retrievalStatus: string;
|
|
460
|
+
sourceLocation: any;
|
|
461
|
+
supersededBy: string | null;
|
|
462
|
+
supersedes: string[];
|
|
463
|
+
clusterId: string | null;
|
|
464
|
+
extractedAt: Date;
|
|
465
|
+
approvedAt: Date | null;
|
|
466
|
+
approvedByUserId: string | null;
|
|
467
|
+
edited: boolean;
|
|
468
|
+
metadata: any;
|
|
469
|
+
}
|
|
470
|
+
export declare function listThreadsByIngestionRun(client: Client, args: ListThreadsByIngestionRunArgs): Promise<ListThreadsByIngestionRunRow[]>;
|
|
471
|
+
export declare const listPendingThreadsByRunQuery = "-- name: ListPendingThreadsByRun :many\nSELECT\n id,\n organization_id,\n document_id,\n ingestion_run_id,\n text,\n text_original,\n knowledge_type,\n facet_fields,\n confidence,\n temporal_validity,\n classification,\n retrieval_status,\n source_location,\n superseded_by,\n supersedes,\n cluster_id,\n extracted_at,\n approved_at,\n approved_by_user_id,\n edited,\n metadata\nFROM weave.threads\nWHERE organization_id = $1\n AND ingestion_run_id = $2\n AND retrieval_status = 'THREAD_RETRIEVAL_STATUS_PENDING'\nORDER BY extracted_at ASC, id ASC";
|
|
472
|
+
export interface ListPendingThreadsByRunArgs {
|
|
473
|
+
organizationId: string;
|
|
474
|
+
ingestionRunId: string;
|
|
475
|
+
}
|
|
476
|
+
export interface ListPendingThreadsByRunRow {
|
|
477
|
+
id: string;
|
|
478
|
+
organizationId: string;
|
|
479
|
+
documentId: string;
|
|
480
|
+
ingestionRunId: string;
|
|
481
|
+
text: string;
|
|
482
|
+
textOriginal: string | null;
|
|
483
|
+
knowledgeType: string;
|
|
484
|
+
facetFields: any;
|
|
485
|
+
confidence: number;
|
|
486
|
+
temporalValidity: any | null;
|
|
487
|
+
classification: string;
|
|
488
|
+
retrievalStatus: string;
|
|
489
|
+
sourceLocation: any;
|
|
490
|
+
supersededBy: string | null;
|
|
491
|
+
supersedes: string[];
|
|
492
|
+
clusterId: string | null;
|
|
493
|
+
extractedAt: Date;
|
|
494
|
+
approvedAt: Date | null;
|
|
495
|
+
approvedByUserId: string | null;
|
|
496
|
+
edited: boolean;
|
|
497
|
+
metadata: any;
|
|
498
|
+
}
|
|
499
|
+
export declare function listPendingThreadsByRun(client: Client, args: ListPendingThreadsByRunArgs): Promise<ListPendingThreadsByRunRow[]>;
|
|
500
|
+
export declare const listPendingThreadsByOrganizationQuery = "-- name: ListPendingThreadsByOrganization :many\nSELECT\n t.id,\n t.organization_id,\n t.document_id,\n d.filename AS document_name,\n t.ingestion_run_id,\n t.text,\n t.text_original,\n t.knowledge_type,\n t.facet_fields,\n t.confidence,\n t.temporal_validity,\n t.classification,\n t.retrieval_status,\n t.source_location,\n t.superseded_by,\n t.supersedes,\n t.cluster_id,\n t.extracted_at,\n t.approved_at,\n t.approved_by_user_id,\n t.edited,\n t.metadata\nFROM weave.threads t\nJOIN weave.documents d ON d.id = t.document_id\nWHERE t.organization_id = $1\n AND t.retrieval_status = 'THREAD_RETRIEVAL_STATUS_PENDING'\nORDER BY t.extracted_at DESC, t.id DESC\nLIMIT $3 OFFSET $2";
|
|
501
|
+
export interface ListPendingThreadsByOrganizationArgs {
|
|
502
|
+
organizationId: string;
|
|
503
|
+
pageOffset: string;
|
|
504
|
+
pageSize: string;
|
|
505
|
+
}
|
|
506
|
+
export interface ListPendingThreadsByOrganizationRow {
|
|
507
|
+
id: string;
|
|
508
|
+
organizationId: string;
|
|
509
|
+
documentId: string;
|
|
510
|
+
documentName: string;
|
|
511
|
+
ingestionRunId: string;
|
|
512
|
+
text: string;
|
|
513
|
+
textOriginal: string | null;
|
|
514
|
+
knowledgeType: string;
|
|
515
|
+
facetFields: any;
|
|
516
|
+
confidence: number;
|
|
517
|
+
temporalValidity: any | null;
|
|
518
|
+
classification: string;
|
|
519
|
+
retrievalStatus: string;
|
|
520
|
+
sourceLocation: any;
|
|
521
|
+
supersededBy: string | null;
|
|
522
|
+
supersedes: string[];
|
|
523
|
+
clusterId: string | null;
|
|
524
|
+
extractedAt: Date;
|
|
525
|
+
approvedAt: Date | null;
|
|
526
|
+
approvedByUserId: string | null;
|
|
527
|
+
edited: boolean;
|
|
528
|
+
metadata: any;
|
|
529
|
+
}
|
|
530
|
+
export declare function listPendingThreadsByOrganization(client: Client, args: ListPendingThreadsByOrganizationArgs): Promise<ListPendingThreadsByOrganizationRow[]>;
|
|
531
|
+
export declare const updateThreadEmbeddingQuery = "-- name: UpdateThreadEmbedding :one\nUPDATE weave.threads\nSET\n embedding = $1::vector\nWHERE organization_id = $2\n AND id = $3\n AND retrieval_status = 'THREAD_RETRIEVAL_STATUS_PENDING'\nRETURNING\n id,\n organization_id,\n document_id,\n ingestion_run_id,\n text,\n text_original,\n knowledge_type,\n facet_fields,\n confidence,\n temporal_validity,\n classification,\n retrieval_status,\n source_location,\n superseded_by,\n supersedes,\n cluster_id,\n extracted_at,\n approved_at,\n approved_by_user_id,\n edited,\n metadata";
|
|
532
|
+
export interface UpdateThreadEmbeddingArgs {
|
|
533
|
+
embedding: string;
|
|
534
|
+
organizationId: string;
|
|
535
|
+
id: string;
|
|
536
|
+
}
|
|
537
|
+
export interface UpdateThreadEmbeddingRow {
|
|
538
|
+
id: string;
|
|
539
|
+
organizationId: string;
|
|
540
|
+
documentId: string;
|
|
541
|
+
ingestionRunId: string;
|
|
542
|
+
text: string;
|
|
543
|
+
textOriginal: string | null;
|
|
544
|
+
knowledgeType: string;
|
|
545
|
+
facetFields: any;
|
|
546
|
+
confidence: number;
|
|
547
|
+
temporalValidity: any | null;
|
|
548
|
+
classification: string;
|
|
549
|
+
retrievalStatus: string;
|
|
550
|
+
sourceLocation: any;
|
|
551
|
+
supersededBy: string | null;
|
|
552
|
+
supersedes: string[];
|
|
553
|
+
clusterId: string | null;
|
|
554
|
+
extractedAt: Date;
|
|
555
|
+
approvedAt: Date | null;
|
|
556
|
+
approvedByUserId: string | null;
|
|
557
|
+
edited: boolean;
|
|
558
|
+
metadata: any;
|
|
559
|
+
}
|
|
560
|
+
export declare function updateThreadEmbedding(client: Client, args: UpdateThreadEmbeddingArgs): Promise<UpdateThreadEmbeddingRow | null>;
|
|
561
|
+
export declare const setThreadNextEmbeddingQuery = "-- name: SetThreadNextEmbedding :one\nUPDATE weave.threads\nSET\n embedding_next = $1::vector\nWHERE organization_id = $2\n AND id = $3\n AND retrieval_status = 'THREAD_RETRIEVAL_STATUS_PENDING'\nRETURNING\n id,\n organization_id,\n document_id,\n ingestion_run_id,\n text,\n text_original,\n knowledge_type,\n facet_fields,\n confidence,\n temporal_validity,\n classification,\n retrieval_status,\n source_location,\n superseded_by,\n supersedes,\n cluster_id,\n extracted_at,\n approved_at,\n approved_by_user_id,\n edited,\n metadata";
|
|
562
|
+
export interface SetThreadNextEmbeddingArgs {
|
|
563
|
+
embedding: string;
|
|
564
|
+
organizationId: string;
|
|
565
|
+
id: string;
|
|
566
|
+
}
|
|
567
|
+
export interface SetThreadNextEmbeddingRow {
|
|
568
|
+
id: string;
|
|
569
|
+
organizationId: string;
|
|
570
|
+
documentId: string;
|
|
571
|
+
ingestionRunId: string;
|
|
572
|
+
text: string;
|
|
573
|
+
textOriginal: string | null;
|
|
574
|
+
knowledgeType: string;
|
|
575
|
+
facetFields: any;
|
|
576
|
+
confidence: number;
|
|
577
|
+
temporalValidity: any | null;
|
|
578
|
+
classification: string;
|
|
579
|
+
retrievalStatus: string;
|
|
580
|
+
sourceLocation: any;
|
|
581
|
+
supersededBy: string | null;
|
|
582
|
+
supersedes: string[];
|
|
583
|
+
clusterId: string | null;
|
|
584
|
+
extractedAt: Date;
|
|
585
|
+
approvedAt: Date | null;
|
|
586
|
+
approvedByUserId: string | null;
|
|
587
|
+
edited: boolean;
|
|
588
|
+
metadata: any;
|
|
589
|
+
}
|
|
590
|
+
export declare function setThreadNextEmbedding(client: Client, args: SetThreadNextEmbeddingArgs): Promise<SetThreadNextEmbeddingRow | null>;
|
|
591
|
+
export declare const promoteThreadNextEmbeddingsByOrganizationQuery = "-- name: PromoteThreadNextEmbeddingsByOrganization :execrows\nUPDATE weave.threads\nSET\n embedding = embedding_next,\n embedding_next = NULL\nWHERE organization_id = $1\n AND embedding_next IS NOT NULL";
|
|
592
|
+
export interface PromoteThreadNextEmbeddingsByOrganizationArgs {
|
|
593
|
+
organizationId: string;
|
|
594
|
+
}
|
|
595
|
+
export declare const updateThreadClassificationQuery = "-- name: UpdateThreadClassification :one\nUPDATE weave.threads\nSET\n classification = $1,\n supersedes = $2\nWHERE organization_id = $3\n AND id = $4\nRETURNING\n id,\n organization_id,\n document_id,\n ingestion_run_id,\n text,\n text_original,\n knowledge_type,\n facet_fields,\n confidence,\n temporal_validity,\n classification,\n retrieval_status,\n source_location,\n superseded_by,\n supersedes,\n cluster_id,\n extracted_at,\n approved_at,\n approved_by_user_id,\n edited,\n metadata";
|
|
596
|
+
export interface UpdateThreadClassificationArgs {
|
|
597
|
+
classification: string;
|
|
598
|
+
supersedes: string[];
|
|
599
|
+
organizationId: string;
|
|
600
|
+
id: string;
|
|
601
|
+
}
|
|
602
|
+
export interface UpdateThreadClassificationRow {
|
|
603
|
+
id: string;
|
|
604
|
+
organizationId: string;
|
|
605
|
+
documentId: string;
|
|
606
|
+
ingestionRunId: string;
|
|
607
|
+
text: string;
|
|
608
|
+
textOriginal: string | null;
|
|
609
|
+
knowledgeType: string;
|
|
610
|
+
facetFields: any;
|
|
611
|
+
confidence: number;
|
|
612
|
+
temporalValidity: any | null;
|
|
613
|
+
classification: string;
|
|
614
|
+
retrievalStatus: string;
|
|
615
|
+
sourceLocation: any;
|
|
616
|
+
supersededBy: string | null;
|
|
617
|
+
supersedes: string[];
|
|
618
|
+
clusterId: string | null;
|
|
619
|
+
extractedAt: Date;
|
|
620
|
+
approvedAt: Date | null;
|
|
621
|
+
approvedByUserId: string | null;
|
|
622
|
+
edited: boolean;
|
|
623
|
+
metadata: any;
|
|
624
|
+
}
|
|
625
|
+
export declare function updateThreadClassification(client: Client, args: UpdateThreadClassificationArgs): Promise<UpdateThreadClassificationRow | null>;
|
|
626
|
+
export declare const editPendingThreadQuery = "-- name: EditPendingThread :one\nUPDATE weave.threads\nSET\n text_original = CASE\n WHEN text_original IS NULL OR text_original = '' THEN text\n ELSE text_original\n END,\n text = $1,\n edited = TRUE\nWHERE id = $2\n AND organization_id = $3\n AND retrieval_status = 'THREAD_RETRIEVAL_STATUS_PENDING'\nRETURNING\n id,\n organization_id,\n document_id,\n ingestion_run_id,\n text,\n text_original,\n knowledge_type,\n facet_fields,\n confidence,\n temporal_validity,\n classification,\n retrieval_status,\n source_location,\n superseded_by,\n supersedes,\n cluster_id,\n extracted_at,\n approved_at,\n approved_by_user_id,\n edited,\n metadata";
|
|
627
|
+
export interface EditPendingThreadArgs {
|
|
628
|
+
text: string;
|
|
629
|
+
id: string;
|
|
630
|
+
organizationId: string;
|
|
631
|
+
}
|
|
632
|
+
export interface EditPendingThreadRow {
|
|
633
|
+
id: string;
|
|
634
|
+
organizationId: string;
|
|
635
|
+
documentId: string;
|
|
636
|
+
ingestionRunId: string;
|
|
637
|
+
text: string;
|
|
638
|
+
textOriginal: string | null;
|
|
639
|
+
knowledgeType: string;
|
|
640
|
+
facetFields: any;
|
|
641
|
+
confidence: number;
|
|
642
|
+
temporalValidity: any | null;
|
|
643
|
+
classification: string;
|
|
644
|
+
retrievalStatus: string;
|
|
645
|
+
sourceLocation: any;
|
|
646
|
+
supersededBy: string | null;
|
|
647
|
+
supersedes: string[];
|
|
648
|
+
clusterId: string | null;
|
|
649
|
+
extractedAt: Date;
|
|
650
|
+
approvedAt: Date | null;
|
|
651
|
+
approvedByUserId: string | null;
|
|
652
|
+
edited: boolean;
|
|
653
|
+
metadata: any;
|
|
654
|
+
}
|
|
655
|
+
export declare function editPendingThread(client: Client, args: EditPendingThreadArgs): Promise<EditPendingThreadRow | null>;
|
|
656
|
+
export declare const approveThreadQuery = "-- name: ApproveThread :one\nUPDATE weave.threads\nSET\n retrieval_status = 'THREAD_RETRIEVAL_STATUS_APPROVED',\n approved_at = now(),\n approved_by_user_id = $1,\n embedding = COALESCE($2::vector, embedding),\n embedding_next = NULL\nWHERE id = $3\n AND organization_id = $4\n AND retrieval_status = 'THREAD_RETRIEVAL_STATUS_PENDING'\nRETURNING\n id,\n organization_id,\n document_id,\n ingestion_run_id,\n text,\n text_original,\n knowledge_type,\n facet_fields,\n confidence,\n temporal_validity,\n classification,\n retrieval_status,\n source_location,\n superseded_by,\n supersedes,\n cluster_id,\n extracted_at,\n approved_at,\n approved_by_user_id,\n edited,\n metadata";
|
|
657
|
+
export interface ApproveThreadArgs {
|
|
658
|
+
approvedByUserId: string | null;
|
|
659
|
+
embedding: string | null;
|
|
660
|
+
id: string;
|
|
661
|
+
organizationId: string;
|
|
662
|
+
}
|
|
663
|
+
export interface ApproveThreadRow {
|
|
664
|
+
id: string;
|
|
665
|
+
organizationId: string;
|
|
666
|
+
documentId: string;
|
|
667
|
+
ingestionRunId: string;
|
|
668
|
+
text: string;
|
|
669
|
+
textOriginal: string | null;
|
|
670
|
+
knowledgeType: string;
|
|
671
|
+
facetFields: any;
|
|
672
|
+
confidence: number;
|
|
673
|
+
temporalValidity: any | null;
|
|
674
|
+
classification: string;
|
|
675
|
+
retrievalStatus: string;
|
|
676
|
+
sourceLocation: any;
|
|
677
|
+
supersededBy: string | null;
|
|
678
|
+
supersedes: string[];
|
|
679
|
+
clusterId: string | null;
|
|
680
|
+
extractedAt: Date;
|
|
681
|
+
approvedAt: Date | null;
|
|
682
|
+
approvedByUserId: string | null;
|
|
683
|
+
edited: boolean;
|
|
684
|
+
metadata: any;
|
|
685
|
+
}
|
|
686
|
+
export declare function approveThread(client: Client, args: ApproveThreadArgs): Promise<ApproveThreadRow | null>;
|
|
687
|
+
export declare const bulkApproveThreadsQuery = "-- name: BulkApproveThreads :many\nUPDATE weave.threads\nSET\n retrieval_status = 'THREAD_RETRIEVAL_STATUS_APPROVED',\n approved_at = now(),\n approved_by_user_id = $1,\n embedding_next = NULL\nWHERE organization_id = $2\n AND ingestion_run_id = $3\n AND id = ANY($4::uuid[])\n AND retrieval_status = 'THREAD_RETRIEVAL_STATUS_PENDING'\nRETURNING\n id,\n organization_id,\n document_id,\n ingestion_run_id,\n text,\n text_original,\n knowledge_type,\n facet_fields,\n confidence,\n temporal_validity,\n classification,\n retrieval_status,\n source_location,\n superseded_by,\n supersedes,\n cluster_id,\n extracted_at,\n approved_at,\n approved_by_user_id,\n edited,\n metadata";
|
|
688
|
+
export interface BulkApproveThreadsArgs {
|
|
689
|
+
approvedByUserId: string | null;
|
|
690
|
+
organizationId: string;
|
|
691
|
+
ingestionRunId: string;
|
|
692
|
+
threadIds: string[];
|
|
693
|
+
}
|
|
694
|
+
export interface BulkApproveThreadsRow {
|
|
695
|
+
id: string;
|
|
696
|
+
organizationId: string;
|
|
697
|
+
documentId: string;
|
|
698
|
+
ingestionRunId: string;
|
|
699
|
+
text: string;
|
|
700
|
+
textOriginal: string | null;
|
|
701
|
+
knowledgeType: string;
|
|
702
|
+
facetFields: any;
|
|
703
|
+
confidence: number;
|
|
704
|
+
temporalValidity: any | null;
|
|
705
|
+
classification: string;
|
|
706
|
+
retrievalStatus: string;
|
|
707
|
+
sourceLocation: any;
|
|
708
|
+
supersededBy: string | null;
|
|
709
|
+
supersedes: string[];
|
|
710
|
+
clusterId: string | null;
|
|
711
|
+
extractedAt: Date;
|
|
712
|
+
approvedAt: Date | null;
|
|
713
|
+
approvedByUserId: string | null;
|
|
714
|
+
edited: boolean;
|
|
715
|
+
metadata: any;
|
|
716
|
+
}
|
|
717
|
+
export declare function bulkApproveThreads(client: Client, args: BulkApproveThreadsArgs): Promise<BulkApproveThreadsRow[]>;
|
|
718
|
+
export declare const rejectThreadQuery = "-- name: RejectThread :one\nUPDATE weave.threads\nSET\n retrieval_status = 'THREAD_RETRIEVAL_STATUS_REJECTED'\nWHERE organization_id = $1\n AND id = $2\n AND retrieval_status = 'THREAD_RETRIEVAL_STATUS_PENDING'\nRETURNING\n id,\n organization_id,\n document_id,\n ingestion_run_id,\n text,\n text_original,\n knowledge_type,\n facet_fields,\n confidence,\n temporal_validity,\n classification,\n retrieval_status,\n source_location,\n superseded_by,\n supersedes,\n cluster_id,\n extracted_at,\n approved_at,\n approved_by_user_id,\n edited,\n metadata";
|
|
719
|
+
export interface RejectThreadArgs {
|
|
720
|
+
organizationId: string;
|
|
721
|
+
id: string;
|
|
722
|
+
}
|
|
723
|
+
export interface RejectThreadRow {
|
|
724
|
+
id: string;
|
|
725
|
+
organizationId: string;
|
|
726
|
+
documentId: string;
|
|
727
|
+
ingestionRunId: string;
|
|
728
|
+
text: string;
|
|
729
|
+
textOriginal: string | null;
|
|
730
|
+
knowledgeType: string;
|
|
731
|
+
facetFields: any;
|
|
732
|
+
confidence: number;
|
|
733
|
+
temporalValidity: any | null;
|
|
734
|
+
classification: string;
|
|
735
|
+
retrievalStatus: string;
|
|
736
|
+
sourceLocation: any;
|
|
737
|
+
supersededBy: string | null;
|
|
738
|
+
supersedes: string[];
|
|
739
|
+
clusterId: string | null;
|
|
740
|
+
extractedAt: Date;
|
|
741
|
+
approvedAt: Date | null;
|
|
742
|
+
approvedByUserId: string | null;
|
|
743
|
+
edited: boolean;
|
|
744
|
+
metadata: any;
|
|
745
|
+
}
|
|
746
|
+
export declare function rejectThread(client: Client, args: RejectThreadArgs): Promise<RejectThreadRow | null>;
|
|
747
|
+
export declare const bulkRejectThreadsQuery = "-- name: BulkRejectThreads :many\nUPDATE weave.threads\nSET\n retrieval_status = 'THREAD_RETRIEVAL_STATUS_REJECTED'\nWHERE organization_id = $1\n AND ingestion_run_id = $2\n AND id = ANY($3::uuid[])\n AND retrieval_status = 'THREAD_RETRIEVAL_STATUS_PENDING'\nRETURNING\n id,\n organization_id,\n document_id,\n ingestion_run_id,\n text,\n text_original,\n knowledge_type,\n facet_fields,\n confidence,\n temporal_validity,\n classification,\n retrieval_status,\n source_location,\n superseded_by,\n supersedes,\n cluster_id,\n extracted_at,\n approved_at,\n approved_by_user_id,\n edited,\n metadata";
|
|
748
|
+
export interface BulkRejectThreadsArgs {
|
|
749
|
+
organizationId: string;
|
|
750
|
+
ingestionRunId: string;
|
|
751
|
+
threadIds: string[];
|
|
752
|
+
}
|
|
753
|
+
export interface BulkRejectThreadsRow {
|
|
754
|
+
id: string;
|
|
755
|
+
organizationId: string;
|
|
756
|
+
documentId: string;
|
|
757
|
+
ingestionRunId: string;
|
|
758
|
+
text: string;
|
|
759
|
+
textOriginal: string | null;
|
|
760
|
+
knowledgeType: string;
|
|
761
|
+
facetFields: any;
|
|
762
|
+
confidence: number;
|
|
763
|
+
temporalValidity: any | null;
|
|
764
|
+
classification: string;
|
|
765
|
+
retrievalStatus: string;
|
|
766
|
+
sourceLocation: any;
|
|
767
|
+
supersededBy: string | null;
|
|
768
|
+
supersedes: string[];
|
|
769
|
+
clusterId: string | null;
|
|
770
|
+
extractedAt: Date;
|
|
771
|
+
approvedAt: Date | null;
|
|
772
|
+
approvedByUserId: string | null;
|
|
773
|
+
edited: boolean;
|
|
774
|
+
metadata: any;
|
|
775
|
+
}
|
|
776
|
+
export declare function bulkRejectThreads(client: Client, args: BulkRejectThreadsArgs): Promise<BulkRejectThreadsRow[]>;
|
|
777
|
+
export declare const markThreadsSupersededQuery = "-- name: MarkThreadsSuperseded :execrows\nUPDATE weave.threads\nSET\n retrieval_status = 'THREAD_RETRIEVAL_STATUS_SUPERSEDED',\n superseded_by = $1\nWHERE organization_id = $2\n AND id = ANY($3::uuid[])";
|
|
778
|
+
export interface MarkThreadsSupersededArgs {
|
|
779
|
+
supersededBy: string | null;
|
|
780
|
+
organizationId: string;
|
|
781
|
+
threadIds: string[];
|
|
782
|
+
}
|
|
783
|
+
export declare const listThreadsBySupersedesQuery = "-- name: ListThreadsBySupersedes :many\nSELECT\n id,\n organization_id,\n document_id,\n ingestion_run_id,\n text,\n text_original,\n knowledge_type,\n facet_fields,\n confidence,\n temporal_validity,\n classification,\n retrieval_status,\n source_location,\n superseded_by,\n supersedes,\n cluster_id,\n extracted_at,\n approved_at,\n approved_by_user_id,\n edited,\n metadata\nFROM weave.threads\nWHERE organization_id = $1\n AND $2 = ANY(supersedes)\nORDER BY approved_at DESC NULLS LAST, extracted_at DESC, id DESC";
|
|
784
|
+
export interface ListThreadsBySupersedesArgs {
|
|
785
|
+
organizationId: string;
|
|
786
|
+
threadId: string[];
|
|
787
|
+
}
|
|
788
|
+
export interface ListThreadsBySupersedesRow {
|
|
789
|
+
id: string;
|
|
790
|
+
organizationId: string;
|
|
791
|
+
documentId: string;
|
|
792
|
+
ingestionRunId: string;
|
|
793
|
+
text: string;
|
|
794
|
+
textOriginal: string | null;
|
|
795
|
+
knowledgeType: string;
|
|
796
|
+
facetFields: any;
|
|
797
|
+
confidence: number;
|
|
798
|
+
temporalValidity: any | null;
|
|
799
|
+
classification: string;
|
|
800
|
+
retrievalStatus: string;
|
|
801
|
+
sourceLocation: any;
|
|
802
|
+
supersededBy: string | null;
|
|
803
|
+
supersedes: string[];
|
|
804
|
+
clusterId: string | null;
|
|
805
|
+
extractedAt: Date;
|
|
806
|
+
approvedAt: Date | null;
|
|
807
|
+
approvedByUserId: string | null;
|
|
808
|
+
edited: boolean;
|
|
809
|
+
metadata: any;
|
|
810
|
+
}
|
|
811
|
+
export declare function listThreadsBySupersedes(client: Client, args: ListThreadsBySupersedesArgs): Promise<ListThreadsBySupersedesRow[]>;
|
|
812
|
+
export declare const listThreadsByIDsQuery = "-- name: ListThreadsByIDs :many\nSELECT\n id,\n organization_id,\n document_id,\n ingestion_run_id,\n text,\n text_original,\n knowledge_type,\n facet_fields,\n confidence,\n temporal_validity,\n classification,\n retrieval_status,\n source_location,\n superseded_by,\n supersedes,\n cluster_id,\n extracted_at,\n approved_at,\n approved_by_user_id,\n edited,\n metadata\nFROM weave.threads\nWHERE organization_id = $1\n AND id = ANY($2::uuid[])\nORDER BY extracted_at ASC, id ASC";
|
|
813
|
+
export interface ListThreadsByIDsArgs {
|
|
814
|
+
organizationId: string;
|
|
815
|
+
threadIds: string[];
|
|
816
|
+
}
|
|
817
|
+
export interface ListThreadsByIDsRow {
|
|
818
|
+
id: string;
|
|
819
|
+
organizationId: string;
|
|
820
|
+
documentId: string;
|
|
821
|
+
ingestionRunId: string;
|
|
822
|
+
text: string;
|
|
823
|
+
textOriginal: string | null;
|
|
824
|
+
knowledgeType: string;
|
|
825
|
+
facetFields: any;
|
|
826
|
+
confidence: number;
|
|
827
|
+
temporalValidity: any | null;
|
|
828
|
+
classification: string;
|
|
829
|
+
retrievalStatus: string;
|
|
830
|
+
sourceLocation: any;
|
|
831
|
+
supersededBy: string | null;
|
|
832
|
+
supersedes: string[];
|
|
833
|
+
clusterId: string | null;
|
|
834
|
+
extractedAt: Date;
|
|
835
|
+
approvedAt: Date | null;
|
|
836
|
+
approvedByUserId: string | null;
|
|
837
|
+
edited: boolean;
|
|
838
|
+
metadata: any;
|
|
839
|
+
}
|
|
840
|
+
export declare function listThreadsByIDs(client: Client, args: ListThreadsByIDsArgs): Promise<ListThreadsByIDsRow[]>;
|
|
841
|
+
export declare const getIngestionRunThreadCountsQuery = "-- name: GetIngestionRunThreadCounts :one\nSELECT\n COUNT(*)::int AS thread_count,\n COUNT(*) FILTER (\n WHERE retrieval_status = 'THREAD_RETRIEVAL_STATUS_PENDING'\n )::int AS pending_count,\n COUNT(*) FILTER (\n WHERE retrieval_status = 'THREAD_RETRIEVAL_STATUS_APPROVED'\n )::int AS approved_count,\n COUNT(*) FILTER (\n WHERE retrieval_status = 'THREAD_RETRIEVAL_STATUS_REJECTED'\n )::int AS rejected_count\nFROM weave.threads\nWHERE organization_id = $1\n AND ingestion_run_id = $2";
|
|
842
|
+
export interface GetIngestionRunThreadCountsArgs {
|
|
843
|
+
organizationId: string;
|
|
844
|
+
ingestionRunId: string;
|
|
845
|
+
}
|
|
846
|
+
export interface GetIngestionRunThreadCountsRow {
|
|
847
|
+
threadCount: number;
|
|
848
|
+
pendingCount: number;
|
|
849
|
+
approvedCount: number;
|
|
850
|
+
rejectedCount: number;
|
|
851
|
+
}
|
|
852
|
+
export declare function getIngestionRunThreadCounts(client: Client, args: GetIngestionRunThreadCountsArgs): Promise<GetIngestionRunThreadCountsRow | null>;
|
|
853
|
+
export declare const deleteThreadReconciliationByPendingThreadQuery = "-- name: DeleteThreadReconciliationByPendingThread :exec\nDELETE FROM weave.thread_reconciliation tr\nUSING weave.threads t\nWHERE tr.pending_thread_id = t.id\n AND t.organization_id = $1\n AND tr.pending_thread_id = $2";
|
|
854
|
+
export interface DeleteThreadReconciliationByPendingThreadArgs {
|
|
855
|
+
organizationId: string;
|
|
856
|
+
pendingThreadId: string;
|
|
857
|
+
}
|
|
858
|
+
export declare function deleteThreadReconciliationByPendingThread(client: Client, args: DeleteThreadReconciliationByPendingThreadArgs): Promise<void>;
|
|
859
|
+
export declare const upsertThreadReconciliationQuery = "-- name: UpsertThreadReconciliation :one\nINSERT INTO weave.thread_reconciliation (\n pending_thread_id,\n existing_thread_id,\n similarity,\n entity_overlap\n) VALUES (\n $1,\n $2,\n $3,\n $4\n)\nON CONFLICT (pending_thread_id, existing_thread_id) DO UPDATE\nSET\n similarity = EXCLUDED.similarity,\n entity_overlap = EXCLUDED.entity_overlap\nRETURNING\n pending_thread_id,\n existing_thread_id,\n similarity,\n entity_overlap";
|
|
860
|
+
export interface UpsertThreadReconciliationArgs {
|
|
861
|
+
pendingThreadId: string;
|
|
862
|
+
existingThreadId: string;
|
|
863
|
+
similarity: number;
|
|
864
|
+
entityOverlap: number;
|
|
865
|
+
}
|
|
866
|
+
export interface UpsertThreadReconciliationRow {
|
|
867
|
+
pendingThreadId: string;
|
|
868
|
+
existingThreadId: string;
|
|
869
|
+
similarity: number;
|
|
870
|
+
entityOverlap: number;
|
|
871
|
+
}
|
|
872
|
+
export declare function upsertThreadReconciliation(client: Client, args: UpsertThreadReconciliationArgs): Promise<UpsertThreadReconciliationRow | null>;
|
|
873
|
+
export declare const listThreadReconciliationByPendingThreadQuery = "-- name: ListThreadReconciliationByPendingThread :many\nSELECT\n pending_thread_id,\n existing_thread_id,\n similarity,\n entity_overlap\nFROM weave.thread_reconciliation\nWHERE pending_thread_id IN (\n SELECT id\n FROM weave.threads\n WHERE organization_id = $1\n AND id = $2\n)\nORDER BY similarity DESC, entity_overlap DESC, existing_thread_id ASC";
|
|
874
|
+
export interface ListThreadReconciliationByPendingThreadArgs {
|
|
875
|
+
organizationId: string;
|
|
876
|
+
pendingThreadId: string;
|
|
877
|
+
}
|
|
878
|
+
export interface ListThreadReconciliationByPendingThreadRow {
|
|
879
|
+
pendingThreadId: string;
|
|
880
|
+
existingThreadId: string;
|
|
881
|
+
similarity: number;
|
|
882
|
+
entityOverlap: number;
|
|
883
|
+
}
|
|
884
|
+
export declare function listThreadReconciliationByPendingThread(client: Client, args: ListThreadReconciliationByPendingThreadArgs): Promise<ListThreadReconciliationByPendingThreadRow[]>;
|
|
885
|
+
export declare const createThreadActivityQuery = "-- name: CreateThreadActivity :one\nINSERT INTO weave.thread_activity (\n id,\n thread_id,\n action,\n actor_id,\n metadata\n) VALUES (\n $1,\n $2,\n $3,\n $4,\n $5\n)\nRETURNING\n id,\n thread_id,\n action,\n actor_id,\n metadata,\n created_at";
|
|
886
|
+
export interface CreateThreadActivityArgs {
|
|
887
|
+
id: string;
|
|
888
|
+
threadId: string;
|
|
889
|
+
action: string;
|
|
890
|
+
actorId: string | null;
|
|
891
|
+
metadata: any;
|
|
892
|
+
}
|
|
893
|
+
export interface CreateThreadActivityRow {
|
|
894
|
+
id: string;
|
|
895
|
+
threadId: string;
|
|
896
|
+
action: string;
|
|
897
|
+
actorId: string | null;
|
|
898
|
+
metadata: any;
|
|
899
|
+
createdAt: Date;
|
|
900
|
+
}
|
|
901
|
+
export declare function createThreadActivity(client: Client, args: CreateThreadActivityArgs): Promise<CreateThreadActivityRow | null>;
|
|
902
|
+
export declare const listThreadActivityByThreadQuery = "-- name: ListThreadActivityByThread :many\nSELECT\n id,\n thread_id,\n action,\n actor_id,\n metadata,\n created_at\nFROM weave.thread_activity\nWHERE thread_id IN (\n SELECT t.id\n FROM weave.threads t\n WHERE t.organization_id = $1\n AND t.id = $2\n)\nORDER BY created_at DESC";
|
|
903
|
+
export interface ListThreadActivityByThreadArgs {
|
|
904
|
+
organizationId: string;
|
|
905
|
+
threadId: string;
|
|
906
|
+
}
|
|
907
|
+
export interface ListThreadActivityByThreadRow {
|
|
908
|
+
id: string;
|
|
909
|
+
threadId: string;
|
|
910
|
+
action: string;
|
|
911
|
+
actorId: string | null;
|
|
912
|
+
metadata: any;
|
|
913
|
+
createdAt: Date;
|
|
914
|
+
}
|
|
915
|
+
export declare function listThreadActivityByThread(client: Client, args: ListThreadActivityByThreadArgs): Promise<ListThreadActivityByThreadRow[]>;
|
|
916
|
+
export declare const upsertEntityQuery = "-- name: UpsertEntity :one\nINSERT INTO weave.entities (\n id,\n organization_id,\n name,\n type,\n canonical,\n metadata\n) VALUES (\n $1,\n $2,\n $3,\n $4,\n $5,\n $6\n)\nON CONFLICT (organization_id, type, canonical) DO UPDATE\nSET\n name = EXCLUDED.name,\n metadata = EXCLUDED.metadata,\n updated_at = now()\nRETURNING\n id,\n organization_id,\n name,\n type,\n canonical,\n metadata,\n created_at,\n updated_at";
|
|
917
|
+
export interface UpsertEntityArgs {
|
|
918
|
+
id: string;
|
|
919
|
+
organizationId: string;
|
|
920
|
+
name: string;
|
|
921
|
+
type: string;
|
|
922
|
+
canonical: string;
|
|
923
|
+
metadata: any;
|
|
924
|
+
}
|
|
925
|
+
export interface UpsertEntityRow {
|
|
926
|
+
id: string;
|
|
927
|
+
organizationId: string;
|
|
928
|
+
name: string;
|
|
929
|
+
type: string;
|
|
930
|
+
canonical: string;
|
|
931
|
+
metadata: any;
|
|
932
|
+
createdAt: Date;
|
|
933
|
+
updatedAt: Date;
|
|
934
|
+
}
|
|
935
|
+
export declare function upsertEntity(client: Client, args: UpsertEntityArgs): Promise<UpsertEntityRow | null>;
|
|
936
|
+
export declare const upsertThreadEntityQuery = "-- name: UpsertThreadEntity :one\nINSERT INTO weave.thread_entities (\n thread_id,\n entity_id,\n role,\n confidence\n) VALUES (\n $1,\n $2,\n $3,\n $4\n)\nON CONFLICT (thread_id, entity_id) DO UPDATE\nSET\n role = EXCLUDED.role,\n confidence = EXCLUDED.confidence\nRETURNING\n thread_id,\n entity_id,\n role,\n confidence";
|
|
937
|
+
export interface UpsertThreadEntityArgs {
|
|
938
|
+
threadId: string;
|
|
939
|
+
entityId: string;
|
|
940
|
+
role: string;
|
|
941
|
+
confidence: number;
|
|
942
|
+
}
|
|
943
|
+
export interface UpsertThreadEntityRow {
|
|
944
|
+
threadId: string;
|
|
945
|
+
entityId: string;
|
|
946
|
+
role: string;
|
|
947
|
+
confidence: number;
|
|
948
|
+
}
|
|
949
|
+
export declare function upsertThreadEntity(client: Client, args: UpsertThreadEntityArgs): Promise<UpsertThreadEntityRow | null>;
|
|
950
|
+
export declare const upsertEntityRelationshipQuery = "-- name: UpsertEntityRelationship :one\nINSERT INTO weave.entity_relationships (\n id,\n organization_id,\n source_entity_id,\n target_entity_id,\n relationship,\n source_thread_id,\n confidence\n) VALUES (\n $1,\n $2,\n $3,\n $4,\n $5,\n $6,\n $7\n)\nON CONFLICT (source_entity_id, target_entity_id, relationship, source_thread_id) DO UPDATE\nSET\n confidence = EXCLUDED.confidence\nRETURNING\n id,\n organization_id,\n source_entity_id,\n target_entity_id,\n relationship,\n source_thread_id,\n confidence,\n created_at";
|
|
951
|
+
export interface UpsertEntityRelationshipArgs {
|
|
952
|
+
id: string;
|
|
953
|
+
organizationId: string;
|
|
954
|
+
sourceEntityId: string;
|
|
955
|
+
targetEntityId: string;
|
|
956
|
+
relationship: string;
|
|
957
|
+
sourceThreadId: string;
|
|
958
|
+
confidence: number;
|
|
959
|
+
}
|
|
960
|
+
export interface UpsertEntityRelationshipRow {
|
|
961
|
+
id: string;
|
|
962
|
+
organizationId: string;
|
|
963
|
+
sourceEntityId: string;
|
|
964
|
+
targetEntityId: string;
|
|
965
|
+
relationship: string;
|
|
966
|
+
sourceThreadId: string;
|
|
967
|
+
confidence: number;
|
|
968
|
+
createdAt: Date;
|
|
969
|
+
}
|
|
970
|
+
export declare function upsertEntityRelationship(client: Client, args: UpsertEntityRelationshipArgs): Promise<UpsertEntityRelationshipRow | null>;
|
|
971
|
+
export declare const listEntitiesByThreadQuery = "-- name: ListEntitiesByThread :many\nSELECT\n e.id,\n e.organization_id,\n e.name,\n e.type,\n e.canonical,\n e.metadata,\n e.created_at,\n e.updated_at,\n te.role,\n te.confidence AS relationship_confidence\nFROM weave.thread_entities te\nJOIN weave.entities e ON e.id = te.entity_id\nWHERE te.thread_id IN (\n SELECT t.id\n FROM weave.threads t\n WHERE t.organization_id = $1\n AND t.id = $2\n)\nORDER BY e.type ASC, e.canonical ASC";
|
|
972
|
+
export interface ListEntitiesByThreadArgs {
|
|
973
|
+
organizationId: string;
|
|
974
|
+
threadId: string;
|
|
975
|
+
}
|
|
976
|
+
export interface ListEntitiesByThreadRow {
|
|
977
|
+
id: string;
|
|
978
|
+
organizationId: string;
|
|
979
|
+
name: string;
|
|
980
|
+
type: string;
|
|
981
|
+
canonical: string;
|
|
982
|
+
metadata: any;
|
|
983
|
+
createdAt: Date;
|
|
984
|
+
updatedAt: Date;
|
|
985
|
+
role: string;
|
|
986
|
+
relationshipConfidence: number;
|
|
987
|
+
}
|
|
988
|
+
export declare function listEntitiesByThread(client: Client, args: ListEntitiesByThreadArgs): Promise<ListEntitiesByThreadRow[]>;
|
|
989
|
+
export declare const ensureOrganizationIngestionSettingsQuery = "-- name: EnsureOrganizationIngestionSettings :one\nWITH upsert AS (\n INSERT INTO weave.org_ingestion_settings (organization_id)\n VALUES ($1)\n ON CONFLICT (organization_id) DO UPDATE\n SET organization_id = EXCLUDED.organization_id\n RETURNING\n organization_id,\n reasoning_model_id,\n reasoning_provider_configuration_id,\n embedding_model_id,\n embedding_provider_configuration_id,\n updated_at\n)\nSELECT\n upsert.organization_id,\n upsert.reasoning_model_id,\n upsert.reasoning_provider_configuration_id,\n upsert.embedding_model_id,\n upsert.embedding_provider_configuration_id,\n cfg.embedding_dimension AS embedding_dimensions,\n upsert.updated_at\nFROM upsert\nJOIN weave.database_config cfg\n ON cfg.id = 1";
|
|
990
|
+
export interface EnsureOrganizationIngestionSettingsArgs {
|
|
991
|
+
organizationId: string;
|
|
992
|
+
}
|
|
993
|
+
export interface EnsureOrganizationIngestionSettingsRow {
|
|
994
|
+
organizationId: string;
|
|
995
|
+
reasoningModelId: string | null;
|
|
996
|
+
reasoningProviderConfigurationId: string | null;
|
|
997
|
+
embeddingModelId: string | null;
|
|
998
|
+
embeddingProviderConfigurationId: string | null;
|
|
999
|
+
embeddingDimensions: number;
|
|
1000
|
+
updatedAt: Date;
|
|
1001
|
+
}
|
|
1002
|
+
export declare function ensureOrganizationIngestionSettings(client: Client, args: EnsureOrganizationIngestionSettingsArgs): Promise<EnsureOrganizationIngestionSettingsRow | null>;
|
|
1003
|
+
export declare const getOrganizationIngestionSettingsQuery = "-- name: GetOrganizationIngestionSettings :one\nSELECT\n settings.organization_id,\n settings.reasoning_model_id,\n settings.reasoning_provider_configuration_id,\n settings.embedding_model_id,\n settings.embedding_provider_configuration_id,\n cfg.embedding_dimension AS embedding_dimensions,\n settings.updated_at\nFROM weave.org_ingestion_settings settings\nJOIN weave.database_config cfg\n ON cfg.id = 1\nWHERE settings.organization_id = $1";
|
|
1004
|
+
export interface GetOrganizationIngestionSettingsArgs {
|
|
1005
|
+
organizationId: string;
|
|
1006
|
+
}
|
|
1007
|
+
export interface GetOrganizationIngestionSettingsRow {
|
|
1008
|
+
organizationId: string;
|
|
1009
|
+
reasoningModelId: string | null;
|
|
1010
|
+
reasoningProviderConfigurationId: string | null;
|
|
1011
|
+
embeddingModelId: string | null;
|
|
1012
|
+
embeddingProviderConfigurationId: string | null;
|
|
1013
|
+
embeddingDimensions: number;
|
|
1014
|
+
updatedAt: Date;
|
|
1015
|
+
}
|
|
1016
|
+
export declare function getOrganizationIngestionSettings(client: Client, args: GetOrganizationIngestionSettingsArgs): Promise<GetOrganizationIngestionSettingsRow | null>;
|
|
1017
|
+
export declare const upsertOrganizationIngestionSettingsQuery = "-- name: UpsertOrganizationIngestionSettings :one\nWITH cfg AS (\n SELECT embedding_dimension\n FROM weave.database_config\n WHERE id = 1\n AND ($1 = 0 OR $1 = embedding_dimension)\n), upsert AS (\n INSERT INTO weave.org_ingestion_settings (\n organization_id,\n reasoning_model_id,\n reasoning_provider_configuration_id,\n embedding_model_id,\n embedding_provider_configuration_id\n )\n SELECT\n $2,\n $3,\n $4,\n $5,\n $6\n FROM cfg\n ON CONFLICT (organization_id) DO UPDATE\n SET\n reasoning_model_id = EXCLUDED.reasoning_model_id,\n reasoning_provider_configuration_id = EXCLUDED.reasoning_provider_configuration_id,\n embedding_model_id = EXCLUDED.embedding_model_id,\n embedding_provider_configuration_id = EXCLUDED.embedding_provider_configuration_id,\n updated_at = now()\n RETURNING\n organization_id,\n reasoning_model_id,\n reasoning_provider_configuration_id,\n embedding_model_id,\n embedding_provider_configuration_id,\n updated_at\n)\nSELECT\n upsert.organization_id,\n upsert.reasoning_model_id,\n upsert.reasoning_provider_configuration_id,\n upsert.embedding_model_id,\n upsert.embedding_provider_configuration_id,\n cfg.embedding_dimension AS embedding_dimensions,\n upsert.updated_at\nFROM upsert\nJOIN cfg\n ON TRUE";
|
|
1018
|
+
export interface UpsertOrganizationIngestionSettingsArgs {
|
|
1019
|
+
embeddingDimensions: string | null;
|
|
1020
|
+
organizationId: string;
|
|
1021
|
+
reasoningModelId: string | null;
|
|
1022
|
+
reasoningProviderConfigurationId: string | null;
|
|
1023
|
+
embeddingModelId: string | null;
|
|
1024
|
+
embeddingProviderConfigurationId: string | null;
|
|
1025
|
+
}
|
|
1026
|
+
export interface UpsertOrganizationIngestionSettingsRow {
|
|
1027
|
+
organizationId: string;
|
|
1028
|
+
reasoningModelId: string | null;
|
|
1029
|
+
reasoningProviderConfigurationId: string | null;
|
|
1030
|
+
embeddingModelId: string | null;
|
|
1031
|
+
embeddingProviderConfigurationId: string | null;
|
|
1032
|
+
embeddingDimensions: number;
|
|
1033
|
+
updatedAt: Date;
|
|
1034
|
+
}
|
|
1035
|
+
export declare function upsertOrganizationIngestionSettings(client: Client, args: UpsertOrganizationIngestionSettingsArgs): Promise<UpsertOrganizationIngestionSettingsRow | null>;
|
|
1036
|
+
export declare const syncOrganizationIngestionReasoningDefaultsQuery = "-- name: SyncOrganizationIngestionReasoningDefaults :one\nWITH cfg AS (\n SELECT embedding_dimension\n FROM weave.database_config\n WHERE id = 1\n), upsert AS (\n INSERT INTO weave.org_ingestion_settings (\n organization_id,\n reasoning_model_id,\n reasoning_provider_configuration_id\n )\n SELECT\n cs.organization_id,\n cs.default_chat_model_id,\n cs.default_provider_configuration_id\n FROM weave.organization_chat_settings cs\n WHERE cs.organization_id = $1\n ON CONFLICT (organization_id) DO UPDATE\n SET\n reasoning_model_id = COALESCE(weave.org_ingestion_settings.reasoning_model_id, EXCLUDED.reasoning_model_id),\n reasoning_provider_configuration_id = COALESCE(\n weave.org_ingestion_settings.reasoning_provider_configuration_id,\n EXCLUDED.reasoning_provider_configuration_id\n ),\n updated_at = now()\n RETURNING\n organization_id,\n reasoning_model_id,\n reasoning_provider_configuration_id,\n embedding_model_id,\n embedding_provider_configuration_id,\n updated_at\n)\nSELECT\n upsert.organization_id,\n upsert.reasoning_model_id,\n upsert.reasoning_provider_configuration_id,\n upsert.embedding_model_id,\n upsert.embedding_provider_configuration_id,\n cfg.embedding_dimension AS embedding_dimensions,\n upsert.updated_at\nFROM upsert\nJOIN cfg\n ON TRUE";
|
|
1037
|
+
export interface SyncOrganizationIngestionReasoningDefaultsArgs {
|
|
1038
|
+
organizationId: string;
|
|
1039
|
+
}
|
|
1040
|
+
export interface SyncOrganizationIngestionReasoningDefaultsRow {
|
|
1041
|
+
organizationId: string;
|
|
1042
|
+
reasoningModelId: string | null;
|
|
1043
|
+
reasoningProviderConfigurationId: string | null;
|
|
1044
|
+
embeddingModelId: string | null;
|
|
1045
|
+
embeddingProviderConfigurationId: string | null;
|
|
1046
|
+
embeddingDimensions: number;
|
|
1047
|
+
updatedAt: Date;
|
|
1048
|
+
}
|
|
1049
|
+
export declare function syncOrganizationIngestionReasoningDefaults(client: Client, args: SyncOrganizationIngestionReasoningDefaultsArgs): Promise<SyncOrganizationIngestionReasoningDefaultsRow | null>;
|
|
1050
|
+
export declare const listFacetConfigsQuery = "-- name: ListFacetConfigs :many\nSELECT\n organization_id,\n knowledge_type,\n label,\n extraction_hint,\n required_fields,\n active\nFROM weave.org_facet_config\nWHERE organization_id = $1\nORDER BY knowledge_type ASC";
|
|
1051
|
+
export interface ListFacetConfigsArgs {
|
|
1052
|
+
organizationId: string;
|
|
1053
|
+
}
|
|
1054
|
+
export interface ListFacetConfigsRow {
|
|
1055
|
+
organizationId: string;
|
|
1056
|
+
knowledgeType: string;
|
|
1057
|
+
label: string;
|
|
1058
|
+
extractionHint: string;
|
|
1059
|
+
requiredFields: any;
|
|
1060
|
+
active: boolean;
|
|
1061
|
+
}
|
|
1062
|
+
export declare function listFacetConfigs(client: Client, args: ListFacetConfigsArgs): Promise<ListFacetConfigsRow[]>;
|
|
1063
|
+
export declare const listActiveFacetConfigsQuery = "-- name: ListActiveFacetConfigs :many\nSELECT\n organization_id,\n knowledge_type,\n label,\n extraction_hint,\n required_fields,\n active\nFROM weave.org_facet_config\nWHERE organization_id = $1\n AND active = TRUE\nORDER BY knowledge_type ASC";
|
|
1064
|
+
export interface ListActiveFacetConfigsArgs {
|
|
1065
|
+
organizationId: string;
|
|
1066
|
+
}
|
|
1067
|
+
export interface ListActiveFacetConfigsRow {
|
|
1068
|
+
organizationId: string;
|
|
1069
|
+
knowledgeType: string;
|
|
1070
|
+
label: string;
|
|
1071
|
+
extractionHint: string;
|
|
1072
|
+
requiredFields: any;
|
|
1073
|
+
active: boolean;
|
|
1074
|
+
}
|
|
1075
|
+
export declare function listActiveFacetConfigs(client: Client, args: ListActiveFacetConfigsArgs): Promise<ListActiveFacetConfigsRow[]>;
|
|
1076
|
+
export declare const upsertFacetConfigQuery = "-- name: UpsertFacetConfig :one\nINSERT INTO weave.org_facet_config (\n organization_id,\n knowledge_type,\n label,\n extraction_hint,\n required_fields,\n active\n) VALUES (\n $1,\n $2,\n $3,\n $4,\n $5,\n $6\n)\nON CONFLICT (organization_id, knowledge_type) DO UPDATE\nSET\n label = EXCLUDED.label,\n extraction_hint = EXCLUDED.extraction_hint,\n required_fields = EXCLUDED.required_fields,\n active = EXCLUDED.active\nRETURNING\n organization_id,\n knowledge_type,\n label,\n extraction_hint,\n required_fields,\n active";
|
|
1077
|
+
export interface UpsertFacetConfigArgs {
|
|
1078
|
+
organizationId: string;
|
|
1079
|
+
knowledgeType: string;
|
|
1080
|
+
label: string;
|
|
1081
|
+
extractionHint: string;
|
|
1082
|
+
requiredFields: any;
|
|
1083
|
+
active: boolean;
|
|
1084
|
+
}
|
|
1085
|
+
export interface UpsertFacetConfigRow {
|
|
1086
|
+
organizationId: string;
|
|
1087
|
+
knowledgeType: string;
|
|
1088
|
+
label: string;
|
|
1089
|
+
extractionHint: string;
|
|
1090
|
+
requiredFields: any;
|
|
1091
|
+
active: boolean;
|
|
1092
|
+
}
|
|
1093
|
+
export declare function upsertFacetConfig(client: Client, args: UpsertFacetConfigArgs): Promise<UpsertFacetConfigRow | null>;
|
|
1094
|
+
export declare const deactivateFacetConfigQuery = "-- name: DeactivateFacetConfig :one\nUPDATE weave.org_facet_config\nSET active = FALSE\nWHERE organization_id = $1\n AND knowledge_type = $2\nRETURNING\n organization_id,\n knowledge_type,\n label,\n extraction_hint,\n required_fields,\n active";
|
|
1095
|
+
export interface DeactivateFacetConfigArgs {
|
|
1096
|
+
organizationId: string;
|
|
1097
|
+
knowledgeType: string;
|
|
1098
|
+
}
|
|
1099
|
+
export interface DeactivateFacetConfigRow {
|
|
1100
|
+
organizationId: string;
|
|
1101
|
+
knowledgeType: string;
|
|
1102
|
+
label: string;
|
|
1103
|
+
extractionHint: string;
|
|
1104
|
+
requiredFields: any;
|
|
1105
|
+
active: boolean;
|
|
1106
|
+
}
|
|
1107
|
+
export declare function deactivateFacetConfig(client: Client, args: DeactivateFacetConfigArgs): Promise<DeactivateFacetConfigRow | null>;
|
|
1108
|
+
export {};
|