@orq-ai/node 3.9.3 → 3.9.5

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.
Files changed (168) hide show
  1. package/README.md +2 -5
  2. package/bin/mcp-server.js +560 -866
  3. package/bin/mcp-server.js.map +36 -36
  4. package/docs/sdks/knowledge/README.md +77 -0
  5. package/examples/README.md +26 -0
  6. package/examples/contactsCreate.example.ts +40 -0
  7. package/examples/package-lock.json +626 -0
  8. package/examples/package.json +18 -0
  9. package/funcs/deploymentsStream.js +7 -7
  10. package/funcs/deploymentsStream.js.map +1 -1
  11. package/funcs/{knowledgeBasesChunkText.d.ts → knowledgeCreate.d.ts} +3 -6
  12. package/funcs/knowledgeCreate.d.ts.map +1 -0
  13. package/funcs/{knowledgeBasesChunkText.js → knowledgeCreate.js} +7 -10
  14. package/funcs/knowledgeCreate.js.map +1 -0
  15. package/jsr.json +1 -1
  16. package/lib/config.d.ts +3 -3
  17. package/lib/config.js +3 -3
  18. package/lib/event-streams.d.ts +4 -10
  19. package/lib/event-streams.d.ts.map +1 -1
  20. package/lib/event-streams.js +110 -194
  21. package/lib/event-streams.js.map +1 -1
  22. package/lib/matchers.d.ts.map +1 -1
  23. package/lib/matchers.js +1 -4
  24. package/lib/matchers.js.map +1 -1
  25. package/mcp-server/mcp-server.js +1 -1
  26. package/mcp-server/server.js +3 -3
  27. package/mcp-server/server.js.map +1 -1
  28. package/mcp-server/tools/knowledgeCreate.d.ts +8 -0
  29. package/mcp-server/tools/knowledgeCreate.d.ts.map +1 -0
  30. package/mcp-server/tools/{knowledgeBasesChunkText.js → knowledgeCreate.js} +8 -10
  31. package/mcp-server/tools/knowledgeCreate.js.map +1 -0
  32. package/models/operations/createcontact.js +2 -2
  33. package/models/operations/createdataset.js +2 -2
  34. package/models/operations/createdatasetitem.js +2 -2
  35. package/models/operations/createdatasource.js +2 -2
  36. package/models/operations/createeval.js +16 -16
  37. package/models/operations/createknowledge.d.ts +426 -0
  38. package/models/operations/createknowledge.d.ts.map +1 -0
  39. package/models/operations/createknowledge.js +431 -0
  40. package/models/operations/createknowledge.js.map +1 -0
  41. package/models/operations/fileget.js +2 -2
  42. package/models/operations/filelist.js +2 -2
  43. package/models/operations/fileupload.js +2 -2
  44. package/models/operations/getevals.js +28 -28
  45. package/models/operations/index.d.ts +1 -1
  46. package/models/operations/index.d.ts.map +1 -1
  47. package/models/operations/index.js +1 -1
  48. package/models/operations/index.js.map +1 -1
  49. package/models/operations/listcontacts.js +2 -2
  50. package/models/operations/listdatasetdatapoints.js +2 -2
  51. package/models/operations/listdatasets.js +2 -2
  52. package/models/operations/listdatasources.js +2 -2
  53. package/models/operations/retrievecontact.js +2 -2
  54. package/models/operations/retrievedatapoint.js +2 -2
  55. package/models/operations/retrievedataset.js +2 -2
  56. package/models/operations/retrievedatasource.js +2 -2
  57. package/models/operations/updatecontact.js +2 -2
  58. package/models/operations/updatedatapoint.js +2 -2
  59. package/models/operations/updatedataset.js +2 -2
  60. package/models/operations/updatedatasource.js +2 -2
  61. package/models/operations/updateeval.js +16 -16
  62. package/models/operations/updateknowledge.d.ts +106 -106
  63. package/models/operations/updateknowledge.d.ts.map +1 -1
  64. package/models/operations/updateknowledge.js +125 -129
  65. package/models/operations/updateknowledge.js.map +1 -1
  66. package/package.json +1 -1
  67. package/packages/orq-rc/README.md +5 -2
  68. package/packages/orq-rc/docs/sdks/knowledge/README.md +0 -87
  69. package/packages/orq-rc/examples/README.md +26 -0
  70. package/packages/orq-rc/examples/contactsCreate.example.ts +40 -0
  71. package/packages/orq-rc/examples/package-lock.json +626 -0
  72. package/packages/orq-rc/examples/package.json +18 -0
  73. package/packages/orq-rc/jsr.json +1 -1
  74. package/packages/orq-rc/package-lock.json +56 -67
  75. package/packages/orq-rc/package.json +3 -3
  76. package/packages/orq-rc/src/funcs/deploymentsStream.ts +7 -8
  77. package/packages/orq-rc/src/lib/config.ts +3 -3
  78. package/packages/orq-rc/src/lib/event-streams.ts +114 -231
  79. package/packages/orq-rc/src/lib/matchers.ts +1 -4
  80. package/packages/orq-rc/src/mcp-server/mcp-server.ts +1 -1
  81. package/packages/orq-rc/src/mcp-server/server.ts +3 -3
  82. package/packages/orq-rc/src/models/operations/chunktext.ts +63 -57
  83. package/packages/orq-rc/src/models/operations/createcontact.ts +2 -2
  84. package/packages/orq-rc/src/models/operations/createdataset.ts +2 -2
  85. package/packages/orq-rc/src/models/operations/createdatasetitem.ts +2 -2
  86. package/packages/orq-rc/src/models/operations/createdatasource.ts +2 -2
  87. package/packages/orq-rc/src/models/operations/createeval.ts +16 -16
  88. package/packages/orq-rc/src/models/operations/fileget.ts +2 -2
  89. package/packages/orq-rc/src/models/operations/filelist.ts +2 -2
  90. package/packages/orq-rc/src/models/operations/fileupload.ts +2 -2
  91. package/packages/orq-rc/src/models/operations/getevals.ts +28 -28
  92. package/packages/orq-rc/src/models/operations/listcontacts.ts +2 -2
  93. package/packages/orq-rc/src/models/operations/listdatasetdatapoints.ts +2 -2
  94. package/packages/orq-rc/src/models/operations/listdatasets.ts +2 -2
  95. package/packages/orq-rc/src/models/operations/listdatasources.ts +2 -2
  96. package/packages/orq-rc/src/models/operations/retrievecontact.ts +2 -2
  97. package/packages/orq-rc/src/models/operations/retrievedatapoint.ts +2 -2
  98. package/packages/orq-rc/src/models/operations/retrievedataset.ts +2 -2
  99. package/packages/orq-rc/src/models/operations/retrievedatasource.ts +2 -2
  100. package/packages/orq-rc/src/models/operations/updatecontact.ts +2 -2
  101. package/packages/orq-rc/src/models/operations/updatedatapoint.ts +2 -2
  102. package/packages/orq-rc/src/models/operations/updatedataset.ts +2 -2
  103. package/packages/orq-rc/src/models/operations/updatedatasource.ts +2 -2
  104. package/packages/orq-rc/src/models/operations/updateeval.ts +16 -16
  105. package/packages/orq-rc/src/sdk/knowledge.ts +0 -18
  106. package/packages/orq-rc/src/sdk/sdk.ts +6 -0
  107. package/sdk/knowledge.d.ts +4 -0
  108. package/sdk/knowledge.d.ts.map +1 -1
  109. package/sdk/knowledge.js +7 -0
  110. package/sdk/knowledge.js.map +1 -1
  111. package/sdk/sdk.d.ts +0 -3
  112. package/sdk/sdk.d.ts.map +1 -1
  113. package/sdk/sdk.js +0 -4
  114. package/sdk/sdk.js.map +1 -1
  115. package/src/funcs/deploymentsStream.ts +7 -8
  116. package/{packages/orq-rc/src/funcs/knowledgeChunkText.ts → src/funcs/knowledgeCreate.ts} +11 -13
  117. package/src/lib/config.ts +3 -3
  118. package/src/lib/event-streams.ts +114 -231
  119. package/src/lib/matchers.ts +1 -4
  120. package/src/mcp-server/mcp-server.ts +1 -1
  121. package/src/mcp-server/server.ts +3 -3
  122. package/src/mcp-server/tools/knowledgeCreate.ts +35 -0
  123. package/src/models/operations/createcontact.ts +2 -2
  124. package/src/models/operations/createdataset.ts +2 -2
  125. package/src/models/operations/createdatasetitem.ts +2 -2
  126. package/src/models/operations/createdatasource.ts +2 -2
  127. package/src/models/operations/createeval.ts +16 -16
  128. package/src/models/operations/createknowledge.ts +846 -0
  129. package/src/models/operations/fileget.ts +2 -2
  130. package/src/models/operations/filelist.ts +2 -2
  131. package/src/models/operations/fileupload.ts +2 -2
  132. package/src/models/operations/getevals.ts +28 -28
  133. package/src/models/operations/index.ts +1 -1
  134. package/src/models/operations/listcontacts.ts +2 -2
  135. package/src/models/operations/listdatasetdatapoints.ts +2 -2
  136. package/src/models/operations/listdatasets.ts +2 -2
  137. package/src/models/operations/listdatasources.ts +2 -2
  138. package/src/models/operations/retrievecontact.ts +2 -2
  139. package/src/models/operations/retrievedatapoint.ts +2 -2
  140. package/src/models/operations/retrievedataset.ts +2 -2
  141. package/src/models/operations/retrievedatasource.ts +2 -2
  142. package/src/models/operations/updatecontact.ts +2 -2
  143. package/src/models/operations/updatedatapoint.ts +2 -2
  144. package/src/models/operations/updatedataset.ts +2 -2
  145. package/src/models/operations/updatedatasource.ts +2 -2
  146. package/src/models/operations/updateeval.ts +16 -16
  147. package/src/models/operations/updateknowledge.ts +266 -206
  148. package/src/sdk/knowledge.ts +15 -0
  149. package/src/sdk/sdk.ts +0 -6
  150. package/funcs/knowledgeBasesChunkText.d.ts.map +0 -1
  151. package/funcs/knowledgeBasesChunkText.js.map +0 -1
  152. package/mcp-server/tools/knowledgeBasesChunkText.d.ts +0 -8
  153. package/mcp-server/tools/knowledgeBasesChunkText.d.ts.map +0 -1
  154. package/mcp-server/tools/knowledgeBasesChunkText.js.map +0 -1
  155. package/models/operations/chunktext.d.ts +0 -961
  156. package/models/operations/chunktext.d.ts.map +0 -1
  157. package/models/operations/chunktext.js +0 -883
  158. package/models/operations/chunktext.js.map +0 -1
  159. package/packages/orq-rc/src/mcp-server/tools/knowledgeChunkText.ts +0 -37
  160. package/sdk/knowledgebases.d.ts +0 -12
  161. package/sdk/knowledgebases.d.ts.map +0 -1
  162. package/sdk/knowledgebases.js +0 -22
  163. package/sdk/knowledgebases.js.map +0 -1
  164. package/src/models/operations/chunktext.ts +0 -1629
  165. /package/{docs → packages/orq-rc/docs}/sdks/knowledgebases/README.md +0 -0
  166. /package/{src → packages/orq-rc/src}/funcs/knowledgeBasesChunkText.ts +0 -0
  167. /package/{src → packages/orq-rc/src}/mcp-server/tools/knowledgeBasesChunkText.ts +0 -0
  168. /package/{src → packages/orq-rc/src}/sdk/knowledgebases.ts +0 -0
@@ -0,0 +1,846 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { ClosedEnum } from "../../types/enums.js";
9
+ import { Result as SafeParseResult } from "../../types/fp.js";
10
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
11
+
12
+ /**
13
+ * The retrieval type to use for the knowledge base. If not provided, Hybrid Search will be used as a default query strategy.
14
+ */
15
+ export const RetrievalType = {
16
+ VectorSearch: "vector_search",
17
+ KeywordSearch: "keyword_search",
18
+ HybridSearch: "hybrid_search",
19
+ } as const;
20
+ /**
21
+ * The retrieval type to use for the knowledge base. If not provided, Hybrid Search will be used as a default query strategy.
22
+ */
23
+ export type RetrievalType = ClosedEnum<typeof RetrievalType>;
24
+
25
+ /**
26
+ * The rerank configuration for the knowledge base. In case the model is provided it will be used to enhance the search precision.
27
+ */
28
+ export type RerankConfig = {
29
+ /**
30
+ * The threshold value used to filter the rerank results, only documents with a relevance score greater than the threshold will be returned
31
+ */
32
+ rerankThreshold?: number | undefined;
33
+ /**
34
+ * The rerank model to use for the knowledge base.
35
+ */
36
+ rerankModel: string;
37
+ };
38
+
39
+ /**
40
+ * The Agentic RAG configuration for the knowledge base. If `null` is provided, Agentic RAG will be disabled.
41
+ */
42
+ export type AgenticRagConfig = {
43
+ /**
44
+ * The model to use for the Agentic RAG
45
+ */
46
+ model: string;
47
+ };
48
+
49
+ /**
50
+ * The retrieval settings for the knowledge base. If not provider, Hybrid Search will be used as a default query strategy.
51
+ */
52
+ export type RetrievalSettings = {
53
+ /**
54
+ * The retrieval type to use for the knowledge base. If not provided, Hybrid Search will be used as a default query strategy.
55
+ */
56
+ retrievalType?: RetrievalType | undefined;
57
+ /**
58
+ * The number of results to return from the search.
59
+ */
60
+ topK?: number | undefined;
61
+ /**
62
+ * The threshold value used to filter the search results, only documents with a relevance score greater than the threshold will be returned
63
+ */
64
+ threshold?: number | undefined;
65
+ /**
66
+ * The rerank configuration for the knowledge base. In case the model is provided it will be used to enhance the search precision.
67
+ */
68
+ rerankConfig?: RerankConfig | null | undefined;
69
+ /**
70
+ * The Agentic RAG configuration for the knowledge base. If `null` is provided, Agentic RAG will be disabled.
71
+ */
72
+ agenticRagConfig?: AgenticRagConfig | null | undefined;
73
+ };
74
+
75
+ export type CreateKnowledgeRequestBody = {
76
+ key: string;
77
+ description?: string | undefined;
78
+ /**
79
+ * The embeddings model to use for the knowledge base. This model will be used to embed the chunks when they are added to the knowledge base.
80
+ */
81
+ embeddingModel: string;
82
+ /**
83
+ * The retrieval settings for the knowledge base. If not provider, Hybrid Search will be used as a default query strategy.
84
+ */
85
+ retrievalSettings?: RetrievalSettings | undefined;
86
+ /**
87
+ * The path where the entity is stored in the project structure. The first element of the path always represents the project name. Any subsequent path element after the project will be created as a folder in the project if it does not exists.
88
+ */
89
+ path: string;
90
+ };
91
+
92
+ /**
93
+ * The retrieval type to use for the knowledge base. If not provided, Hybrid Search will be used as a default query strategy.
94
+ */
95
+ export const CreateKnowledgeRetrievalType = {
96
+ VectorSearch: "vector_search",
97
+ KeywordSearch: "keyword_search",
98
+ HybridSearch: "hybrid_search",
99
+ } as const;
100
+ /**
101
+ * The retrieval type to use for the knowledge base. If not provided, Hybrid Search will be used as a default query strategy.
102
+ */
103
+ export type CreateKnowledgeRetrievalType = ClosedEnum<
104
+ typeof CreateKnowledgeRetrievalType
105
+ >;
106
+
107
+ /**
108
+ * The rerank configuration for the knowledge base. In case the model is provided it will be used to enhance the search precision.
109
+ */
110
+ export type CreateKnowledgeRerankConfig = {
111
+ /**
112
+ * The threshold value used to filter the rerank results, only documents with a relevance score greater than the threshold will be returned
113
+ */
114
+ rerankThreshold?: number | undefined;
115
+ /**
116
+ * The rerank model to use for the knowledge base.
117
+ */
118
+ rerankModel: string;
119
+ };
120
+
121
+ /**
122
+ * The Agentic RAG configuration for the knowledge base. If `null` is provided, Agentic RAG will be disabled.
123
+ */
124
+ export type CreateKnowledgeAgenticRagConfig = {
125
+ /**
126
+ * The model to use for the Agentic RAG
127
+ */
128
+ model: string;
129
+ };
130
+
131
+ /**
132
+ * The retrieval settings for the knowledge base. If not provider, Hybrid Search will be used as a default query strategy.
133
+ */
134
+ export type CreateKnowledgeRetrievalSettings = {
135
+ /**
136
+ * The retrieval type to use for the knowledge base. If not provided, Hybrid Search will be used as a default query strategy.
137
+ */
138
+ retrievalType?: CreateKnowledgeRetrievalType | undefined;
139
+ /**
140
+ * The number of results to return from the search.
141
+ */
142
+ topK?: number | undefined;
143
+ /**
144
+ * The threshold value used to filter the search results, only documents with a relevance score greater than the threshold will be returned
145
+ */
146
+ threshold?: number | undefined;
147
+ /**
148
+ * The rerank configuration for the knowledge base. In case the model is provided it will be used to enhance the search precision.
149
+ */
150
+ rerankConfig?: CreateKnowledgeRerankConfig | null | undefined;
151
+ /**
152
+ * The Agentic RAG configuration for the knowledge base. If `null` is provided, Agentic RAG will be disabled.
153
+ */
154
+ agenticRagConfig?: CreateKnowledgeAgenticRagConfig | null | undefined;
155
+ };
156
+
157
+ /**
158
+ * Knowledge Base object
159
+ */
160
+ export type CreateKnowledgeResponseBody = {
161
+ /**
162
+ * The unique identifier of the knowledge base.
163
+ */
164
+ id: string;
165
+ /**
166
+ * The creation date of the knowledge base.
167
+ */
168
+ created: string;
169
+ /**
170
+ * The description of the knowledge base.
171
+ */
172
+ description?: string | undefined;
173
+ /**
174
+ * The unique key of the knowledge base.
175
+ */
176
+ key: string;
177
+ /**
178
+ * The embeddings model used for the knowledge base.
179
+ */
180
+ model: string;
181
+ /**
182
+ * The project/domain ID of the knowledge base.
183
+ */
184
+ domainId: string;
185
+ /**
186
+ * The path where the entity is stored in the project structure. The first element of the path always represents the project name. Any subsequent path element after the project will be created as a folder in the project if it does not exists.
187
+ */
188
+ path?: string | undefined;
189
+ /**
190
+ * The retrieval settings for the knowledge base. If not provider, Hybrid Search will be used as a default query strategy.
191
+ */
192
+ retrievalSettings?: CreateKnowledgeRetrievalSettings | undefined;
193
+ createdById?: string | null | undefined;
194
+ updatedById?: string | null | undefined;
195
+ /**
196
+ * The last update date of the knowledge base.
197
+ */
198
+ updated: string;
199
+ };
200
+
201
+ /** @internal */
202
+ export const RetrievalType$inboundSchema: z.ZodNativeEnum<
203
+ typeof RetrievalType
204
+ > = z.nativeEnum(RetrievalType);
205
+
206
+ /** @internal */
207
+ export const RetrievalType$outboundSchema: z.ZodNativeEnum<
208
+ typeof RetrievalType
209
+ > = RetrievalType$inboundSchema;
210
+
211
+ /**
212
+ * @internal
213
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
214
+ */
215
+ export namespace RetrievalType$ {
216
+ /** @deprecated use `RetrievalType$inboundSchema` instead. */
217
+ export const inboundSchema = RetrievalType$inboundSchema;
218
+ /** @deprecated use `RetrievalType$outboundSchema` instead. */
219
+ export const outboundSchema = RetrievalType$outboundSchema;
220
+ }
221
+
222
+ /** @internal */
223
+ export const RerankConfig$inboundSchema: z.ZodType<
224
+ RerankConfig,
225
+ z.ZodTypeDef,
226
+ unknown
227
+ > = z.object({
228
+ rerank_threshold: z.number().default(0.5),
229
+ rerank_model: z.string(),
230
+ }).transform((v) => {
231
+ return remap$(v, {
232
+ "rerank_threshold": "rerankThreshold",
233
+ "rerank_model": "rerankModel",
234
+ });
235
+ });
236
+
237
+ /** @internal */
238
+ export type RerankConfig$Outbound = {
239
+ rerank_threshold: number;
240
+ rerank_model: string;
241
+ };
242
+
243
+ /** @internal */
244
+ export const RerankConfig$outboundSchema: z.ZodType<
245
+ RerankConfig$Outbound,
246
+ z.ZodTypeDef,
247
+ RerankConfig
248
+ > = z.object({
249
+ rerankThreshold: z.number().default(0.5),
250
+ rerankModel: z.string(),
251
+ }).transform((v) => {
252
+ return remap$(v, {
253
+ rerankThreshold: "rerank_threshold",
254
+ rerankModel: "rerank_model",
255
+ });
256
+ });
257
+
258
+ /**
259
+ * @internal
260
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
261
+ */
262
+ export namespace RerankConfig$ {
263
+ /** @deprecated use `RerankConfig$inboundSchema` instead. */
264
+ export const inboundSchema = RerankConfig$inboundSchema;
265
+ /** @deprecated use `RerankConfig$outboundSchema` instead. */
266
+ export const outboundSchema = RerankConfig$outboundSchema;
267
+ /** @deprecated use `RerankConfig$Outbound` instead. */
268
+ export type Outbound = RerankConfig$Outbound;
269
+ }
270
+
271
+ export function rerankConfigToJSON(rerankConfig: RerankConfig): string {
272
+ return JSON.stringify(RerankConfig$outboundSchema.parse(rerankConfig));
273
+ }
274
+
275
+ export function rerankConfigFromJSON(
276
+ jsonString: string,
277
+ ): SafeParseResult<RerankConfig, SDKValidationError> {
278
+ return safeParse(
279
+ jsonString,
280
+ (x) => RerankConfig$inboundSchema.parse(JSON.parse(x)),
281
+ `Failed to parse 'RerankConfig' from JSON`,
282
+ );
283
+ }
284
+
285
+ /** @internal */
286
+ export const AgenticRagConfig$inboundSchema: z.ZodType<
287
+ AgenticRagConfig,
288
+ z.ZodTypeDef,
289
+ unknown
290
+ > = z.object({
291
+ model: z.string(),
292
+ });
293
+
294
+ /** @internal */
295
+ export type AgenticRagConfig$Outbound = {
296
+ model: string;
297
+ };
298
+
299
+ /** @internal */
300
+ export const AgenticRagConfig$outboundSchema: z.ZodType<
301
+ AgenticRagConfig$Outbound,
302
+ z.ZodTypeDef,
303
+ AgenticRagConfig
304
+ > = z.object({
305
+ model: z.string(),
306
+ });
307
+
308
+ /**
309
+ * @internal
310
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
311
+ */
312
+ export namespace AgenticRagConfig$ {
313
+ /** @deprecated use `AgenticRagConfig$inboundSchema` instead. */
314
+ export const inboundSchema = AgenticRagConfig$inboundSchema;
315
+ /** @deprecated use `AgenticRagConfig$outboundSchema` instead. */
316
+ export const outboundSchema = AgenticRagConfig$outboundSchema;
317
+ /** @deprecated use `AgenticRagConfig$Outbound` instead. */
318
+ export type Outbound = AgenticRagConfig$Outbound;
319
+ }
320
+
321
+ export function agenticRagConfigToJSON(
322
+ agenticRagConfig: AgenticRagConfig,
323
+ ): string {
324
+ return JSON.stringify(
325
+ AgenticRagConfig$outboundSchema.parse(agenticRagConfig),
326
+ );
327
+ }
328
+
329
+ export function agenticRagConfigFromJSON(
330
+ jsonString: string,
331
+ ): SafeParseResult<AgenticRagConfig, SDKValidationError> {
332
+ return safeParse(
333
+ jsonString,
334
+ (x) => AgenticRagConfig$inboundSchema.parse(JSON.parse(x)),
335
+ `Failed to parse 'AgenticRagConfig' from JSON`,
336
+ );
337
+ }
338
+
339
+ /** @internal */
340
+ export const RetrievalSettings$inboundSchema: z.ZodType<
341
+ RetrievalSettings,
342
+ z.ZodTypeDef,
343
+ unknown
344
+ > = z.object({
345
+ retrieval_type: RetrievalType$inboundSchema.default("hybrid_search"),
346
+ top_k: z.number().int().default(5),
347
+ threshold: z.number().default(0),
348
+ rerank_config: z.nullable(z.lazy(() => RerankConfig$inboundSchema))
349
+ .optional(),
350
+ agentic_rag_config: z.nullable(z.lazy(() => AgenticRagConfig$inboundSchema))
351
+ .optional(),
352
+ }).transform((v) => {
353
+ return remap$(v, {
354
+ "retrieval_type": "retrievalType",
355
+ "top_k": "topK",
356
+ "rerank_config": "rerankConfig",
357
+ "agentic_rag_config": "agenticRagConfig",
358
+ });
359
+ });
360
+
361
+ /** @internal */
362
+ export type RetrievalSettings$Outbound = {
363
+ retrieval_type: string;
364
+ top_k: number;
365
+ threshold: number;
366
+ rerank_config?: RerankConfig$Outbound | null | undefined;
367
+ agentic_rag_config?: AgenticRagConfig$Outbound | null | undefined;
368
+ };
369
+
370
+ /** @internal */
371
+ export const RetrievalSettings$outboundSchema: z.ZodType<
372
+ RetrievalSettings$Outbound,
373
+ z.ZodTypeDef,
374
+ RetrievalSettings
375
+ > = z.object({
376
+ retrievalType: RetrievalType$outboundSchema.default("hybrid_search"),
377
+ topK: z.number().int().default(5),
378
+ threshold: z.number().default(0),
379
+ rerankConfig: z.nullable(z.lazy(() => RerankConfig$outboundSchema))
380
+ .optional(),
381
+ agenticRagConfig: z.nullable(z.lazy(() => AgenticRagConfig$outboundSchema))
382
+ .optional(),
383
+ }).transform((v) => {
384
+ return remap$(v, {
385
+ retrievalType: "retrieval_type",
386
+ topK: "top_k",
387
+ rerankConfig: "rerank_config",
388
+ agenticRagConfig: "agentic_rag_config",
389
+ });
390
+ });
391
+
392
+ /**
393
+ * @internal
394
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
395
+ */
396
+ export namespace RetrievalSettings$ {
397
+ /** @deprecated use `RetrievalSettings$inboundSchema` instead. */
398
+ export const inboundSchema = RetrievalSettings$inboundSchema;
399
+ /** @deprecated use `RetrievalSettings$outboundSchema` instead. */
400
+ export const outboundSchema = RetrievalSettings$outboundSchema;
401
+ /** @deprecated use `RetrievalSettings$Outbound` instead. */
402
+ export type Outbound = RetrievalSettings$Outbound;
403
+ }
404
+
405
+ export function retrievalSettingsToJSON(
406
+ retrievalSettings: RetrievalSettings,
407
+ ): string {
408
+ return JSON.stringify(
409
+ RetrievalSettings$outboundSchema.parse(retrievalSettings),
410
+ );
411
+ }
412
+
413
+ export function retrievalSettingsFromJSON(
414
+ jsonString: string,
415
+ ): SafeParseResult<RetrievalSettings, SDKValidationError> {
416
+ return safeParse(
417
+ jsonString,
418
+ (x) => RetrievalSettings$inboundSchema.parse(JSON.parse(x)),
419
+ `Failed to parse 'RetrievalSettings' from JSON`,
420
+ );
421
+ }
422
+
423
+ /** @internal */
424
+ export const CreateKnowledgeRequestBody$inboundSchema: z.ZodType<
425
+ CreateKnowledgeRequestBody,
426
+ z.ZodTypeDef,
427
+ unknown
428
+ > = z.object({
429
+ key: z.string(),
430
+ description: z.string().optional(),
431
+ embedding_model: z.string(),
432
+ retrieval_settings: z.lazy(() => RetrievalSettings$inboundSchema).optional(),
433
+ path: z.string(),
434
+ }).transform((v) => {
435
+ return remap$(v, {
436
+ "embedding_model": "embeddingModel",
437
+ "retrieval_settings": "retrievalSettings",
438
+ });
439
+ });
440
+
441
+ /** @internal */
442
+ export type CreateKnowledgeRequestBody$Outbound = {
443
+ key: string;
444
+ description?: string | undefined;
445
+ embedding_model: string;
446
+ retrieval_settings?: RetrievalSettings$Outbound | undefined;
447
+ path: string;
448
+ };
449
+
450
+ /** @internal */
451
+ export const CreateKnowledgeRequestBody$outboundSchema: z.ZodType<
452
+ CreateKnowledgeRequestBody$Outbound,
453
+ z.ZodTypeDef,
454
+ CreateKnowledgeRequestBody
455
+ > = z.object({
456
+ key: z.string(),
457
+ description: z.string().optional(),
458
+ embeddingModel: z.string(),
459
+ retrievalSettings: z.lazy(() => RetrievalSettings$outboundSchema).optional(),
460
+ path: z.string(),
461
+ }).transform((v) => {
462
+ return remap$(v, {
463
+ embeddingModel: "embedding_model",
464
+ retrievalSettings: "retrieval_settings",
465
+ });
466
+ });
467
+
468
+ /**
469
+ * @internal
470
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
471
+ */
472
+ export namespace CreateKnowledgeRequestBody$ {
473
+ /** @deprecated use `CreateKnowledgeRequestBody$inboundSchema` instead. */
474
+ export const inboundSchema = CreateKnowledgeRequestBody$inboundSchema;
475
+ /** @deprecated use `CreateKnowledgeRequestBody$outboundSchema` instead. */
476
+ export const outboundSchema = CreateKnowledgeRequestBody$outboundSchema;
477
+ /** @deprecated use `CreateKnowledgeRequestBody$Outbound` instead. */
478
+ export type Outbound = CreateKnowledgeRequestBody$Outbound;
479
+ }
480
+
481
+ export function createKnowledgeRequestBodyToJSON(
482
+ createKnowledgeRequestBody: CreateKnowledgeRequestBody,
483
+ ): string {
484
+ return JSON.stringify(
485
+ CreateKnowledgeRequestBody$outboundSchema.parse(createKnowledgeRequestBody),
486
+ );
487
+ }
488
+
489
+ export function createKnowledgeRequestBodyFromJSON(
490
+ jsonString: string,
491
+ ): SafeParseResult<CreateKnowledgeRequestBody, SDKValidationError> {
492
+ return safeParse(
493
+ jsonString,
494
+ (x) => CreateKnowledgeRequestBody$inboundSchema.parse(JSON.parse(x)),
495
+ `Failed to parse 'CreateKnowledgeRequestBody' from JSON`,
496
+ );
497
+ }
498
+
499
+ /** @internal */
500
+ export const CreateKnowledgeRetrievalType$inboundSchema: z.ZodNativeEnum<
501
+ typeof CreateKnowledgeRetrievalType
502
+ > = z.nativeEnum(CreateKnowledgeRetrievalType);
503
+
504
+ /** @internal */
505
+ export const CreateKnowledgeRetrievalType$outboundSchema: z.ZodNativeEnum<
506
+ typeof CreateKnowledgeRetrievalType
507
+ > = CreateKnowledgeRetrievalType$inboundSchema;
508
+
509
+ /**
510
+ * @internal
511
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
512
+ */
513
+ export namespace CreateKnowledgeRetrievalType$ {
514
+ /** @deprecated use `CreateKnowledgeRetrievalType$inboundSchema` instead. */
515
+ export const inboundSchema = CreateKnowledgeRetrievalType$inboundSchema;
516
+ /** @deprecated use `CreateKnowledgeRetrievalType$outboundSchema` instead. */
517
+ export const outboundSchema = CreateKnowledgeRetrievalType$outboundSchema;
518
+ }
519
+
520
+ /** @internal */
521
+ export const CreateKnowledgeRerankConfig$inboundSchema: z.ZodType<
522
+ CreateKnowledgeRerankConfig,
523
+ z.ZodTypeDef,
524
+ unknown
525
+ > = z.object({
526
+ rerank_threshold: z.number().default(0.5),
527
+ rerank_model: z.string(),
528
+ }).transform((v) => {
529
+ return remap$(v, {
530
+ "rerank_threshold": "rerankThreshold",
531
+ "rerank_model": "rerankModel",
532
+ });
533
+ });
534
+
535
+ /** @internal */
536
+ export type CreateKnowledgeRerankConfig$Outbound = {
537
+ rerank_threshold: number;
538
+ rerank_model: string;
539
+ };
540
+
541
+ /** @internal */
542
+ export const CreateKnowledgeRerankConfig$outboundSchema: z.ZodType<
543
+ CreateKnowledgeRerankConfig$Outbound,
544
+ z.ZodTypeDef,
545
+ CreateKnowledgeRerankConfig
546
+ > = z.object({
547
+ rerankThreshold: z.number().default(0.5),
548
+ rerankModel: z.string(),
549
+ }).transform((v) => {
550
+ return remap$(v, {
551
+ rerankThreshold: "rerank_threshold",
552
+ rerankModel: "rerank_model",
553
+ });
554
+ });
555
+
556
+ /**
557
+ * @internal
558
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
559
+ */
560
+ export namespace CreateKnowledgeRerankConfig$ {
561
+ /** @deprecated use `CreateKnowledgeRerankConfig$inboundSchema` instead. */
562
+ export const inboundSchema = CreateKnowledgeRerankConfig$inboundSchema;
563
+ /** @deprecated use `CreateKnowledgeRerankConfig$outboundSchema` instead. */
564
+ export const outboundSchema = CreateKnowledgeRerankConfig$outboundSchema;
565
+ /** @deprecated use `CreateKnowledgeRerankConfig$Outbound` instead. */
566
+ export type Outbound = CreateKnowledgeRerankConfig$Outbound;
567
+ }
568
+
569
+ export function createKnowledgeRerankConfigToJSON(
570
+ createKnowledgeRerankConfig: CreateKnowledgeRerankConfig,
571
+ ): string {
572
+ return JSON.stringify(
573
+ CreateKnowledgeRerankConfig$outboundSchema.parse(
574
+ createKnowledgeRerankConfig,
575
+ ),
576
+ );
577
+ }
578
+
579
+ export function createKnowledgeRerankConfigFromJSON(
580
+ jsonString: string,
581
+ ): SafeParseResult<CreateKnowledgeRerankConfig, SDKValidationError> {
582
+ return safeParse(
583
+ jsonString,
584
+ (x) => CreateKnowledgeRerankConfig$inboundSchema.parse(JSON.parse(x)),
585
+ `Failed to parse 'CreateKnowledgeRerankConfig' from JSON`,
586
+ );
587
+ }
588
+
589
+ /** @internal */
590
+ export const CreateKnowledgeAgenticRagConfig$inboundSchema: z.ZodType<
591
+ CreateKnowledgeAgenticRagConfig,
592
+ z.ZodTypeDef,
593
+ unknown
594
+ > = z.object({
595
+ model: z.string(),
596
+ });
597
+
598
+ /** @internal */
599
+ export type CreateKnowledgeAgenticRagConfig$Outbound = {
600
+ model: string;
601
+ };
602
+
603
+ /** @internal */
604
+ export const CreateKnowledgeAgenticRagConfig$outboundSchema: z.ZodType<
605
+ CreateKnowledgeAgenticRagConfig$Outbound,
606
+ z.ZodTypeDef,
607
+ CreateKnowledgeAgenticRagConfig
608
+ > = z.object({
609
+ model: z.string(),
610
+ });
611
+
612
+ /**
613
+ * @internal
614
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
615
+ */
616
+ export namespace CreateKnowledgeAgenticRagConfig$ {
617
+ /** @deprecated use `CreateKnowledgeAgenticRagConfig$inboundSchema` instead. */
618
+ export const inboundSchema = CreateKnowledgeAgenticRagConfig$inboundSchema;
619
+ /** @deprecated use `CreateKnowledgeAgenticRagConfig$outboundSchema` instead. */
620
+ export const outboundSchema = CreateKnowledgeAgenticRagConfig$outboundSchema;
621
+ /** @deprecated use `CreateKnowledgeAgenticRagConfig$Outbound` instead. */
622
+ export type Outbound = CreateKnowledgeAgenticRagConfig$Outbound;
623
+ }
624
+
625
+ export function createKnowledgeAgenticRagConfigToJSON(
626
+ createKnowledgeAgenticRagConfig: CreateKnowledgeAgenticRagConfig,
627
+ ): string {
628
+ return JSON.stringify(
629
+ CreateKnowledgeAgenticRagConfig$outboundSchema.parse(
630
+ createKnowledgeAgenticRagConfig,
631
+ ),
632
+ );
633
+ }
634
+
635
+ export function createKnowledgeAgenticRagConfigFromJSON(
636
+ jsonString: string,
637
+ ): SafeParseResult<CreateKnowledgeAgenticRagConfig, SDKValidationError> {
638
+ return safeParse(
639
+ jsonString,
640
+ (x) => CreateKnowledgeAgenticRagConfig$inboundSchema.parse(JSON.parse(x)),
641
+ `Failed to parse 'CreateKnowledgeAgenticRagConfig' from JSON`,
642
+ );
643
+ }
644
+
645
+ /** @internal */
646
+ export const CreateKnowledgeRetrievalSettings$inboundSchema: z.ZodType<
647
+ CreateKnowledgeRetrievalSettings,
648
+ z.ZodTypeDef,
649
+ unknown
650
+ > = z.object({
651
+ retrieval_type: CreateKnowledgeRetrievalType$inboundSchema.default(
652
+ "hybrid_search",
653
+ ),
654
+ top_k: z.number().int().default(5),
655
+ threshold: z.number().default(0),
656
+ rerank_config: z.nullable(
657
+ z.lazy(() => CreateKnowledgeRerankConfig$inboundSchema),
658
+ ).optional(),
659
+ agentic_rag_config: z.nullable(
660
+ z.lazy(() => CreateKnowledgeAgenticRagConfig$inboundSchema),
661
+ ).optional(),
662
+ }).transform((v) => {
663
+ return remap$(v, {
664
+ "retrieval_type": "retrievalType",
665
+ "top_k": "topK",
666
+ "rerank_config": "rerankConfig",
667
+ "agentic_rag_config": "agenticRagConfig",
668
+ });
669
+ });
670
+
671
+ /** @internal */
672
+ export type CreateKnowledgeRetrievalSettings$Outbound = {
673
+ retrieval_type: string;
674
+ top_k: number;
675
+ threshold: number;
676
+ rerank_config?: CreateKnowledgeRerankConfig$Outbound | null | undefined;
677
+ agentic_rag_config?:
678
+ | CreateKnowledgeAgenticRagConfig$Outbound
679
+ | null
680
+ | undefined;
681
+ };
682
+
683
+ /** @internal */
684
+ export const CreateKnowledgeRetrievalSettings$outboundSchema: z.ZodType<
685
+ CreateKnowledgeRetrievalSettings$Outbound,
686
+ z.ZodTypeDef,
687
+ CreateKnowledgeRetrievalSettings
688
+ > = z.object({
689
+ retrievalType: CreateKnowledgeRetrievalType$outboundSchema.default(
690
+ "hybrid_search",
691
+ ),
692
+ topK: z.number().int().default(5),
693
+ threshold: z.number().default(0),
694
+ rerankConfig: z.nullable(
695
+ z.lazy(() => CreateKnowledgeRerankConfig$outboundSchema),
696
+ ).optional(),
697
+ agenticRagConfig: z.nullable(
698
+ z.lazy(() => CreateKnowledgeAgenticRagConfig$outboundSchema),
699
+ ).optional(),
700
+ }).transform((v) => {
701
+ return remap$(v, {
702
+ retrievalType: "retrieval_type",
703
+ topK: "top_k",
704
+ rerankConfig: "rerank_config",
705
+ agenticRagConfig: "agentic_rag_config",
706
+ });
707
+ });
708
+
709
+ /**
710
+ * @internal
711
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
712
+ */
713
+ export namespace CreateKnowledgeRetrievalSettings$ {
714
+ /** @deprecated use `CreateKnowledgeRetrievalSettings$inboundSchema` instead. */
715
+ export const inboundSchema = CreateKnowledgeRetrievalSettings$inboundSchema;
716
+ /** @deprecated use `CreateKnowledgeRetrievalSettings$outboundSchema` instead. */
717
+ export const outboundSchema = CreateKnowledgeRetrievalSettings$outboundSchema;
718
+ /** @deprecated use `CreateKnowledgeRetrievalSettings$Outbound` instead. */
719
+ export type Outbound = CreateKnowledgeRetrievalSettings$Outbound;
720
+ }
721
+
722
+ export function createKnowledgeRetrievalSettingsToJSON(
723
+ createKnowledgeRetrievalSettings: CreateKnowledgeRetrievalSettings,
724
+ ): string {
725
+ return JSON.stringify(
726
+ CreateKnowledgeRetrievalSettings$outboundSchema.parse(
727
+ createKnowledgeRetrievalSettings,
728
+ ),
729
+ );
730
+ }
731
+
732
+ export function createKnowledgeRetrievalSettingsFromJSON(
733
+ jsonString: string,
734
+ ): SafeParseResult<CreateKnowledgeRetrievalSettings, SDKValidationError> {
735
+ return safeParse(
736
+ jsonString,
737
+ (x) => CreateKnowledgeRetrievalSettings$inboundSchema.parse(JSON.parse(x)),
738
+ `Failed to parse 'CreateKnowledgeRetrievalSettings' from JSON`,
739
+ );
740
+ }
741
+
742
+ /** @internal */
743
+ export const CreateKnowledgeResponseBody$inboundSchema: z.ZodType<
744
+ CreateKnowledgeResponseBody,
745
+ z.ZodTypeDef,
746
+ unknown
747
+ > = z.object({
748
+ _id: z.string(),
749
+ created: z.string(),
750
+ description: z.string().optional(),
751
+ key: z.string(),
752
+ model: z.string(),
753
+ domain_id: z.string(),
754
+ path: z.string().optional(),
755
+ retrieval_settings: z.lazy(() =>
756
+ CreateKnowledgeRetrievalSettings$inboundSchema
757
+ ).optional(),
758
+ created_by_id: z.nullable(z.string()).optional(),
759
+ updated_by_id: z.nullable(z.string()).optional(),
760
+ updated: z.string(),
761
+ }).transform((v) => {
762
+ return remap$(v, {
763
+ "_id": "id",
764
+ "domain_id": "domainId",
765
+ "retrieval_settings": "retrievalSettings",
766
+ "created_by_id": "createdById",
767
+ "updated_by_id": "updatedById",
768
+ });
769
+ });
770
+
771
+ /** @internal */
772
+ export type CreateKnowledgeResponseBody$Outbound = {
773
+ _id: string;
774
+ created: string;
775
+ description?: string | undefined;
776
+ key: string;
777
+ model: string;
778
+ domain_id: string;
779
+ path?: string | undefined;
780
+ retrieval_settings?: CreateKnowledgeRetrievalSettings$Outbound | undefined;
781
+ created_by_id?: string | null | undefined;
782
+ updated_by_id?: string | null | undefined;
783
+ updated: string;
784
+ };
785
+
786
+ /** @internal */
787
+ export const CreateKnowledgeResponseBody$outboundSchema: z.ZodType<
788
+ CreateKnowledgeResponseBody$Outbound,
789
+ z.ZodTypeDef,
790
+ CreateKnowledgeResponseBody
791
+ > = z.object({
792
+ id: z.string(),
793
+ created: z.string(),
794
+ description: z.string().optional(),
795
+ key: z.string(),
796
+ model: z.string(),
797
+ domainId: z.string(),
798
+ path: z.string().optional(),
799
+ retrievalSettings: z.lazy(() =>
800
+ CreateKnowledgeRetrievalSettings$outboundSchema
801
+ ).optional(),
802
+ createdById: z.nullable(z.string()).optional(),
803
+ updatedById: z.nullable(z.string()).optional(),
804
+ updated: z.string(),
805
+ }).transform((v) => {
806
+ return remap$(v, {
807
+ id: "_id",
808
+ domainId: "domain_id",
809
+ retrievalSettings: "retrieval_settings",
810
+ createdById: "created_by_id",
811
+ updatedById: "updated_by_id",
812
+ });
813
+ });
814
+
815
+ /**
816
+ * @internal
817
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
818
+ */
819
+ export namespace CreateKnowledgeResponseBody$ {
820
+ /** @deprecated use `CreateKnowledgeResponseBody$inboundSchema` instead. */
821
+ export const inboundSchema = CreateKnowledgeResponseBody$inboundSchema;
822
+ /** @deprecated use `CreateKnowledgeResponseBody$outboundSchema` instead. */
823
+ export const outboundSchema = CreateKnowledgeResponseBody$outboundSchema;
824
+ /** @deprecated use `CreateKnowledgeResponseBody$Outbound` instead. */
825
+ export type Outbound = CreateKnowledgeResponseBody$Outbound;
826
+ }
827
+
828
+ export function createKnowledgeResponseBodyToJSON(
829
+ createKnowledgeResponseBody: CreateKnowledgeResponseBody,
830
+ ): string {
831
+ return JSON.stringify(
832
+ CreateKnowledgeResponseBody$outboundSchema.parse(
833
+ createKnowledgeResponseBody,
834
+ ),
835
+ );
836
+ }
837
+
838
+ export function createKnowledgeResponseBodyFromJSON(
839
+ jsonString: string,
840
+ ): SafeParseResult<CreateKnowledgeResponseBody, SDKValidationError> {
841
+ return safeParse(
842
+ jsonString,
843
+ (x) => CreateKnowledgeResponseBody$inboundSchema.parse(JSON.parse(x)),
844
+ `Failed to parse 'CreateKnowledgeResponseBody' from JSON`,
845
+ );
846
+ }