@getzep/zep-cloud 2.7.0 → 2.9.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/Client.d.ts +3 -3
- package/Client.js +6 -6
- package/api/resources/document/client/Client.js +13 -13
- package/api/resources/graph/client/Client.d.ts +30 -0
- package/api/resources/graph/client/Client.js +157 -4
- package/api/resources/graph/client/requests/EntityTypeRequest.d.ts +16 -0
- package/api/resources/graph/client/requests/EntityTypeRequest.js +5 -0
- package/api/resources/graph/client/requests/GraphSearchQuery.d.ts +2 -0
- package/api/resources/graph/client/requests/index.d.ts +1 -0
- package/api/resources/graph/resources/edge/client/Client.js +4 -4
- package/api/resources/graph/resources/episode/client/Client.js +5 -5
- package/api/resources/graph/resources/node/client/Client.js +3 -3
- package/api/resources/group/client/Client.js +6 -6
- package/api/resources/index.d.ts +2 -2
- package/api/resources/index.js +3 -3
- package/api/resources/memory/client/Client.js +22 -22
- package/api/resources/user/client/Client.js +8 -8
- package/api/types/EntityProperty.d.ts +9 -0
- package/api/types/EntityProperty.js +5 -0
- package/api/types/EntityPropertyType.d.ts +10 -0
- package/api/types/EntityPropertyType.js +12 -0
- package/api/types/EntityType.d.ts +9 -0
- package/api/types/EntityType.js +5 -0
- package/api/types/EntityTypeResponse.d.ts +7 -0
- package/api/types/EntityTypeResponse.js +5 -0
- package/api/types/Episode.d.ts +1 -0
- package/api/types/Message.d.ts +2 -0
- package/api/types/index.d.ts +4 -0
- package/api/types/index.js +4 -0
- package/dist/Client.d.ts +3 -3
- package/dist/Client.js +6 -6
- package/dist/api/resources/document/client/Client.js +13 -13
- package/dist/api/resources/graph/client/Client.d.ts +30 -0
- package/dist/api/resources/graph/client/Client.js +157 -4
- package/dist/api/resources/graph/client/requests/EntityTypeRequest.d.ts +16 -0
- package/dist/api/resources/graph/client/requests/EntityTypeRequest.js +5 -0
- package/dist/api/resources/graph/client/requests/GraphSearchQuery.d.ts +2 -0
- package/dist/api/resources/graph/client/requests/index.d.ts +1 -0
- package/dist/api/resources/graph/resources/edge/client/Client.js +4 -4
- package/dist/api/resources/graph/resources/episode/client/Client.js +5 -5
- package/dist/api/resources/graph/resources/node/client/Client.js +3 -3
- package/dist/api/resources/group/client/Client.js +6 -6
- package/dist/api/resources/index.d.ts +2 -2
- package/dist/api/resources/index.js +3 -3
- package/dist/api/resources/memory/client/Client.js +22 -22
- package/dist/api/resources/user/client/Client.js +8 -8
- package/dist/api/types/EntityProperty.d.ts +9 -0
- package/dist/api/types/EntityProperty.js +5 -0
- package/dist/api/types/EntityPropertyType.d.ts +10 -0
- package/dist/api/types/EntityPropertyType.js +12 -0
- package/dist/api/types/EntityType.d.ts +9 -0
- package/dist/api/types/EntityType.js +5 -0
- package/dist/api/types/EntityTypeResponse.d.ts +7 -0
- package/dist/api/types/EntityTypeResponse.js +5 -0
- package/dist/api/types/Episode.d.ts +1 -0
- package/dist/api/types/Message.d.ts +2 -0
- package/dist/api/types/index.d.ts +4 -0
- package/dist/api/types/index.js +4 -0
- package/dist/serialization/resources/graph/client/requests/EntityTypeRequest.d.ts +13 -0
- package/dist/serialization/resources/graph/client/requests/EntityTypeRequest.js +44 -0
- package/dist/serialization/resources/graph/client/requests/GraphSearchQuery.d.ts +1 -0
- package/dist/serialization/resources/graph/client/requests/GraphSearchQuery.js +1 -0
- package/dist/serialization/resources/graph/client/requests/index.d.ts +1 -0
- package/dist/serialization/resources/graph/client/requests/index.js +3 -1
- package/dist/serialization/resources/index.d.ts +1 -1
- package/dist/serialization/resources/index.js +1 -1
- package/dist/serialization/types/EntityProperty.d.ts +15 -0
- package/dist/serialization/types/EntityProperty.js +46 -0
- package/dist/serialization/types/EntityPropertyType.d.ts +10 -0
- package/dist/serialization/types/EntityPropertyType.js +41 -0
- package/dist/serialization/types/EntityType.d.ts +15 -0
- package/dist/serialization/types/EntityType.js +46 -0
- package/dist/serialization/types/EntityTypeResponse.d.ts +13 -0
- package/dist/serialization/types/EntityTypeResponse.js +44 -0
- package/dist/serialization/types/Episode.d.ts +1 -0
- package/dist/serialization/types/Episode.js +1 -0
- package/dist/serialization/types/Message.d.ts +1 -0
- package/dist/serialization/types/Message.js +1 -0
- package/dist/serialization/types/index.d.ts +4 -0
- package/dist/serialization/types/index.js +4 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/wrapper/graph.d.ts +6 -0
- package/dist/wrapper/graph.js +29 -0
- package/dist/wrapper/index.d.ts +2 -0
- package/dist/wrapper/index.js +4 -0
- package/dist/wrapper/ontology.d.ts +312 -0
- package/dist/wrapper/ontology.js +80 -0
- package/examples/graph/entity_type_example.ts +40 -0
- package/package.json +1 -1
- package/reference.md +311 -186
- package/serialization/resources/graph/client/requests/EntityTypeRequest.d.ts +13 -0
- package/serialization/resources/graph/client/requests/EntityTypeRequest.js +44 -0
- package/serialization/resources/graph/client/requests/GraphSearchQuery.d.ts +1 -0
- package/serialization/resources/graph/client/requests/GraphSearchQuery.js +1 -0
- package/serialization/resources/graph/client/requests/index.d.ts +1 -0
- package/serialization/resources/graph/client/requests/index.js +3 -1
- package/serialization/resources/index.d.ts +1 -1
- package/serialization/resources/index.js +1 -1
- package/serialization/types/EntityProperty.d.ts +15 -0
- package/serialization/types/EntityProperty.js +46 -0
- package/serialization/types/EntityPropertyType.d.ts +10 -0
- package/serialization/types/EntityPropertyType.js +41 -0
- package/serialization/types/EntityType.d.ts +15 -0
- package/serialization/types/EntityType.js +46 -0
- package/serialization/types/EntityTypeResponse.d.ts +13 -0
- package/serialization/types/EntityTypeResponse.js +44 -0
- package/serialization/types/Episode.d.ts +1 -0
- package/serialization/types/Episode.js +1 -0
- package/serialization/types/Message.d.ts +1 -0
- package/serialization/types/Message.js +1 -0
- package/serialization/types/index.d.ts +4 -0
- package/serialization/types/index.js +4 -0
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/wrapper/graph.d.ts +6 -0
- package/wrapper/graph.js +29 -0
- package/wrapper/index.d.ts +2 -0
- package/wrapper/index.js +4 -0
- package/wrapper/ontology.d.ts +312 -0
- package/wrapper/ontology.js +80 -0
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { Zep } from "../index";
|
|
3
|
+
export declare enum EntityPropertyType {
|
|
4
|
+
Text = "Text",
|
|
5
|
+
Int = "Int",
|
|
6
|
+
Float = "Float",
|
|
7
|
+
Boolean = "Boolean"
|
|
8
|
+
}
|
|
9
|
+
export declare const EntityTypeBaseField: z.ZodObject<{
|
|
10
|
+
type: z.ZodNativeEnum<typeof EntityPropertyType>;
|
|
11
|
+
description: z.ZodString;
|
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
|
13
|
+
type: EntityPropertyType;
|
|
14
|
+
description: string;
|
|
15
|
+
}, {
|
|
16
|
+
type: EntityPropertyType;
|
|
17
|
+
description: string;
|
|
18
|
+
}>;
|
|
19
|
+
export interface EntityField<V = any> {
|
|
20
|
+
description: string;
|
|
21
|
+
value?: V;
|
|
22
|
+
}
|
|
23
|
+
export declare const EntityTypeTextFieldSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
24
|
+
type: z.ZodNativeEnum<typeof EntityPropertyType>;
|
|
25
|
+
description: z.ZodString;
|
|
26
|
+
}, {
|
|
27
|
+
type: z.ZodLiteral<EntityPropertyType.Text>;
|
|
28
|
+
value: z.ZodOptional<z.ZodString>;
|
|
29
|
+
}>, "strip", z.ZodTypeAny, {
|
|
30
|
+
type: EntityPropertyType.Text;
|
|
31
|
+
description: string;
|
|
32
|
+
value?: string | undefined;
|
|
33
|
+
}, {
|
|
34
|
+
type: EntityPropertyType.Text;
|
|
35
|
+
description: string;
|
|
36
|
+
value?: string | undefined;
|
|
37
|
+
}>;
|
|
38
|
+
export type EntityTextField = z.infer<typeof EntityTypeTextFieldSchema>;
|
|
39
|
+
export declare const EntityTypeIntFieldSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
40
|
+
type: z.ZodNativeEnum<typeof EntityPropertyType>;
|
|
41
|
+
description: z.ZodString;
|
|
42
|
+
}, {
|
|
43
|
+
type: z.ZodLiteral<EntityPropertyType.Int>;
|
|
44
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
45
|
+
}>, "strip", z.ZodTypeAny, {
|
|
46
|
+
type: EntityPropertyType.Int;
|
|
47
|
+
description: string;
|
|
48
|
+
value?: number | undefined;
|
|
49
|
+
}, {
|
|
50
|
+
type: EntityPropertyType.Int;
|
|
51
|
+
description: string;
|
|
52
|
+
value?: number | undefined;
|
|
53
|
+
}>;
|
|
54
|
+
export type EntityIntField = z.infer<typeof EntityTypeIntFieldSchema>;
|
|
55
|
+
export declare const EntityTypeFloatFieldSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
56
|
+
type: z.ZodNativeEnum<typeof EntityPropertyType>;
|
|
57
|
+
description: z.ZodString;
|
|
58
|
+
}, {
|
|
59
|
+
type: z.ZodLiteral<EntityPropertyType.Float>;
|
|
60
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
61
|
+
}>, "strip", z.ZodTypeAny, {
|
|
62
|
+
type: EntityPropertyType.Float;
|
|
63
|
+
description: string;
|
|
64
|
+
value?: number | undefined;
|
|
65
|
+
}, {
|
|
66
|
+
type: EntityPropertyType.Float;
|
|
67
|
+
description: string;
|
|
68
|
+
value?: number | undefined;
|
|
69
|
+
}>;
|
|
70
|
+
export type EntityFloatField = z.infer<typeof EntityTypeFloatFieldSchema>;
|
|
71
|
+
export declare const EntityTypeBooleanFieldSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
72
|
+
type: z.ZodNativeEnum<typeof EntityPropertyType>;
|
|
73
|
+
description: z.ZodString;
|
|
74
|
+
}, {
|
|
75
|
+
type: z.ZodLiteral<EntityPropertyType.Boolean>;
|
|
76
|
+
value: z.ZodOptional<z.ZodBoolean>;
|
|
77
|
+
}>, "strip", z.ZodTypeAny, {
|
|
78
|
+
type: EntityPropertyType.Boolean;
|
|
79
|
+
description: string;
|
|
80
|
+
value?: boolean | undefined;
|
|
81
|
+
}, {
|
|
82
|
+
type: EntityPropertyType.Boolean;
|
|
83
|
+
description: string;
|
|
84
|
+
value?: boolean | undefined;
|
|
85
|
+
}>;
|
|
86
|
+
export type EntityBooleanField = z.infer<typeof EntityTypeBooleanFieldSchema>;
|
|
87
|
+
export declare const EntityTypeFieldSchema: z.ZodUnion<[z.ZodObject<z.objectUtil.extendShape<{
|
|
88
|
+
type: z.ZodNativeEnum<typeof EntityPropertyType>;
|
|
89
|
+
description: z.ZodString;
|
|
90
|
+
}, {
|
|
91
|
+
type: z.ZodLiteral<EntityPropertyType.Text>;
|
|
92
|
+
value: z.ZodOptional<z.ZodString>;
|
|
93
|
+
}>, "strip", z.ZodTypeAny, {
|
|
94
|
+
type: EntityPropertyType.Text;
|
|
95
|
+
description: string;
|
|
96
|
+
value?: string | undefined;
|
|
97
|
+
}, {
|
|
98
|
+
type: EntityPropertyType.Text;
|
|
99
|
+
description: string;
|
|
100
|
+
value?: string | undefined;
|
|
101
|
+
}>, z.ZodObject<z.objectUtil.extendShape<{
|
|
102
|
+
type: z.ZodNativeEnum<typeof EntityPropertyType>;
|
|
103
|
+
description: z.ZodString;
|
|
104
|
+
}, {
|
|
105
|
+
type: z.ZodLiteral<EntityPropertyType.Int>;
|
|
106
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
107
|
+
}>, "strip", z.ZodTypeAny, {
|
|
108
|
+
type: EntityPropertyType.Int;
|
|
109
|
+
description: string;
|
|
110
|
+
value?: number | undefined;
|
|
111
|
+
}, {
|
|
112
|
+
type: EntityPropertyType.Int;
|
|
113
|
+
description: string;
|
|
114
|
+
value?: number | undefined;
|
|
115
|
+
}>, z.ZodObject<z.objectUtil.extendShape<{
|
|
116
|
+
type: z.ZodNativeEnum<typeof EntityPropertyType>;
|
|
117
|
+
description: z.ZodString;
|
|
118
|
+
}, {
|
|
119
|
+
type: z.ZodLiteral<EntityPropertyType.Float>;
|
|
120
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
121
|
+
}>, "strip", z.ZodTypeAny, {
|
|
122
|
+
type: EntityPropertyType.Float;
|
|
123
|
+
description: string;
|
|
124
|
+
value?: number | undefined;
|
|
125
|
+
}, {
|
|
126
|
+
type: EntityPropertyType.Float;
|
|
127
|
+
description: string;
|
|
128
|
+
value?: number | undefined;
|
|
129
|
+
}>, z.ZodObject<z.objectUtil.extendShape<{
|
|
130
|
+
type: z.ZodNativeEnum<typeof EntityPropertyType>;
|
|
131
|
+
description: z.ZodString;
|
|
132
|
+
}, {
|
|
133
|
+
type: z.ZodLiteral<EntityPropertyType.Boolean>;
|
|
134
|
+
value: z.ZodOptional<z.ZodBoolean>;
|
|
135
|
+
}>, "strip", z.ZodTypeAny, {
|
|
136
|
+
type: EntityPropertyType.Boolean;
|
|
137
|
+
description: string;
|
|
138
|
+
value?: boolean | undefined;
|
|
139
|
+
}, {
|
|
140
|
+
type: EntityPropertyType.Boolean;
|
|
141
|
+
description: string;
|
|
142
|
+
value?: boolean | undefined;
|
|
143
|
+
}>]>;
|
|
144
|
+
export type SupportedEntityField = EntityTextField | EntityIntField | EntityFloatField | EntityBooleanField;
|
|
145
|
+
export declare const EntityFields: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<z.objectUtil.extendShape<{
|
|
146
|
+
type: z.ZodNativeEnum<typeof EntityPropertyType>;
|
|
147
|
+
description: z.ZodString;
|
|
148
|
+
}, {
|
|
149
|
+
type: z.ZodLiteral<EntityPropertyType.Text>;
|
|
150
|
+
value: z.ZodOptional<z.ZodString>;
|
|
151
|
+
}>, "strip", z.ZodTypeAny, {
|
|
152
|
+
type: EntityPropertyType.Text;
|
|
153
|
+
description: string;
|
|
154
|
+
value?: string | undefined;
|
|
155
|
+
}, {
|
|
156
|
+
type: EntityPropertyType.Text;
|
|
157
|
+
description: string;
|
|
158
|
+
value?: string | undefined;
|
|
159
|
+
}>, z.ZodObject<z.objectUtil.extendShape<{
|
|
160
|
+
type: z.ZodNativeEnum<typeof EntityPropertyType>;
|
|
161
|
+
description: z.ZodString;
|
|
162
|
+
}, {
|
|
163
|
+
type: z.ZodLiteral<EntityPropertyType.Int>;
|
|
164
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
165
|
+
}>, "strip", z.ZodTypeAny, {
|
|
166
|
+
type: EntityPropertyType.Int;
|
|
167
|
+
description: string;
|
|
168
|
+
value?: number | undefined;
|
|
169
|
+
}, {
|
|
170
|
+
type: EntityPropertyType.Int;
|
|
171
|
+
description: string;
|
|
172
|
+
value?: number | undefined;
|
|
173
|
+
}>, z.ZodObject<z.objectUtil.extendShape<{
|
|
174
|
+
type: z.ZodNativeEnum<typeof EntityPropertyType>;
|
|
175
|
+
description: z.ZodString;
|
|
176
|
+
}, {
|
|
177
|
+
type: z.ZodLiteral<EntityPropertyType.Float>;
|
|
178
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
179
|
+
}>, "strip", z.ZodTypeAny, {
|
|
180
|
+
type: EntityPropertyType.Float;
|
|
181
|
+
description: string;
|
|
182
|
+
value?: number | undefined;
|
|
183
|
+
}, {
|
|
184
|
+
type: EntityPropertyType.Float;
|
|
185
|
+
description: string;
|
|
186
|
+
value?: number | undefined;
|
|
187
|
+
}>, z.ZodObject<z.objectUtil.extendShape<{
|
|
188
|
+
type: z.ZodNativeEnum<typeof EntityPropertyType>;
|
|
189
|
+
description: z.ZodString;
|
|
190
|
+
}, {
|
|
191
|
+
type: z.ZodLiteral<EntityPropertyType.Boolean>;
|
|
192
|
+
value: z.ZodOptional<z.ZodBoolean>;
|
|
193
|
+
}>, "strip", z.ZodTypeAny, {
|
|
194
|
+
type: EntityPropertyType.Boolean;
|
|
195
|
+
description: string;
|
|
196
|
+
value?: boolean | undefined;
|
|
197
|
+
}, {
|
|
198
|
+
type: EntityPropertyType.Boolean;
|
|
199
|
+
description: string;
|
|
200
|
+
value?: boolean | undefined;
|
|
201
|
+
}>]>>;
|
|
202
|
+
export declare const EntityTypeSchema: z.ZodObject<{
|
|
203
|
+
description: z.ZodDefault<z.ZodString>;
|
|
204
|
+
fields: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<z.objectUtil.extendShape<{
|
|
205
|
+
type: z.ZodNativeEnum<typeof EntityPropertyType>;
|
|
206
|
+
description: z.ZodString;
|
|
207
|
+
}, {
|
|
208
|
+
type: z.ZodLiteral<EntityPropertyType.Text>;
|
|
209
|
+
value: z.ZodOptional<z.ZodString>;
|
|
210
|
+
}>, "strip", z.ZodTypeAny, {
|
|
211
|
+
type: EntityPropertyType.Text;
|
|
212
|
+
description: string;
|
|
213
|
+
value?: string | undefined;
|
|
214
|
+
}, {
|
|
215
|
+
type: EntityPropertyType.Text;
|
|
216
|
+
description: string;
|
|
217
|
+
value?: string | undefined;
|
|
218
|
+
}>, z.ZodObject<z.objectUtil.extendShape<{
|
|
219
|
+
type: z.ZodNativeEnum<typeof EntityPropertyType>;
|
|
220
|
+
description: z.ZodString;
|
|
221
|
+
}, {
|
|
222
|
+
type: z.ZodLiteral<EntityPropertyType.Int>;
|
|
223
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
224
|
+
}>, "strip", z.ZodTypeAny, {
|
|
225
|
+
type: EntityPropertyType.Int;
|
|
226
|
+
description: string;
|
|
227
|
+
value?: number | undefined;
|
|
228
|
+
}, {
|
|
229
|
+
type: EntityPropertyType.Int;
|
|
230
|
+
description: string;
|
|
231
|
+
value?: number | undefined;
|
|
232
|
+
}>, z.ZodObject<z.objectUtil.extendShape<{
|
|
233
|
+
type: z.ZodNativeEnum<typeof EntityPropertyType>;
|
|
234
|
+
description: z.ZodString;
|
|
235
|
+
}, {
|
|
236
|
+
type: z.ZodLiteral<EntityPropertyType.Float>;
|
|
237
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
238
|
+
}>, "strip", z.ZodTypeAny, {
|
|
239
|
+
type: EntityPropertyType.Float;
|
|
240
|
+
description: string;
|
|
241
|
+
value?: number | undefined;
|
|
242
|
+
}, {
|
|
243
|
+
type: EntityPropertyType.Float;
|
|
244
|
+
description: string;
|
|
245
|
+
value?: number | undefined;
|
|
246
|
+
}>, z.ZodObject<z.objectUtil.extendShape<{
|
|
247
|
+
type: z.ZodNativeEnum<typeof EntityPropertyType>;
|
|
248
|
+
description: z.ZodString;
|
|
249
|
+
}, {
|
|
250
|
+
type: z.ZodLiteral<EntityPropertyType.Boolean>;
|
|
251
|
+
value: z.ZodOptional<z.ZodBoolean>;
|
|
252
|
+
}>, "strip", z.ZodTypeAny, {
|
|
253
|
+
type: EntityPropertyType.Boolean;
|
|
254
|
+
description: string;
|
|
255
|
+
value?: boolean | undefined;
|
|
256
|
+
}, {
|
|
257
|
+
type: EntityPropertyType.Boolean;
|
|
258
|
+
description: string;
|
|
259
|
+
value?: boolean | undefined;
|
|
260
|
+
}>]>>;
|
|
261
|
+
}, "strip", z.ZodTypeAny, {
|
|
262
|
+
description: string;
|
|
263
|
+
fields: Record<string, {
|
|
264
|
+
type: EntityPropertyType.Text;
|
|
265
|
+
description: string;
|
|
266
|
+
value?: string | undefined;
|
|
267
|
+
} | {
|
|
268
|
+
type: EntityPropertyType.Int;
|
|
269
|
+
description: string;
|
|
270
|
+
value?: number | undefined;
|
|
271
|
+
} | {
|
|
272
|
+
type: EntityPropertyType.Float;
|
|
273
|
+
description: string;
|
|
274
|
+
value?: number | undefined;
|
|
275
|
+
} | {
|
|
276
|
+
type: EntityPropertyType.Boolean;
|
|
277
|
+
description: string;
|
|
278
|
+
value?: boolean | undefined;
|
|
279
|
+
}>;
|
|
280
|
+
}, {
|
|
281
|
+
fields: Record<string, {
|
|
282
|
+
type: EntityPropertyType.Text;
|
|
283
|
+
description: string;
|
|
284
|
+
value?: string | undefined;
|
|
285
|
+
} | {
|
|
286
|
+
type: EntityPropertyType.Int;
|
|
287
|
+
description: string;
|
|
288
|
+
value?: number | undefined;
|
|
289
|
+
} | {
|
|
290
|
+
type: EntityPropertyType.Float;
|
|
291
|
+
description: string;
|
|
292
|
+
value?: number | undefined;
|
|
293
|
+
} | {
|
|
294
|
+
type: EntityPropertyType.Boolean;
|
|
295
|
+
description: string;
|
|
296
|
+
value?: boolean | undefined;
|
|
297
|
+
}>;
|
|
298
|
+
description?: string | undefined;
|
|
299
|
+
}>;
|
|
300
|
+
export type EntityType = z.infer<typeof EntityTypeSchema>;
|
|
301
|
+
export type EntityData<T extends EntityType> = {
|
|
302
|
+
[P in keyof T["fields"]]: T["fields"][P] extends {
|
|
303
|
+
value?: infer V;
|
|
304
|
+
} ? V : never;
|
|
305
|
+
};
|
|
306
|
+
export declare const entityFields: {
|
|
307
|
+
text: (description: string) => EntityTextField;
|
|
308
|
+
integer: (description: string) => EntityIntField;
|
|
309
|
+
float: (description: string) => EntityFloatField;
|
|
310
|
+
boolean: (description: string) => EntityBooleanField;
|
|
311
|
+
};
|
|
312
|
+
export declare function entityModelToAPISchema(entityType: EntityType, name: string): Zep.EntityType;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.entityFields = exports.EntityTypeSchema = exports.EntityFields = exports.EntityTypeFieldSchema = exports.EntityTypeBooleanFieldSchema = exports.EntityTypeFloatFieldSchema = exports.EntityTypeIntFieldSchema = exports.EntityTypeTextFieldSchema = exports.EntityTypeBaseField = exports.EntityPropertyType = void 0;
|
|
4
|
+
exports.entityModelToAPISchema = entityModelToAPISchema;
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
var EntityPropertyType;
|
|
7
|
+
(function (EntityPropertyType) {
|
|
8
|
+
EntityPropertyType["Text"] = "Text";
|
|
9
|
+
EntityPropertyType["Int"] = "Int";
|
|
10
|
+
EntityPropertyType["Float"] = "Float";
|
|
11
|
+
EntityPropertyType["Boolean"] = "Boolean";
|
|
12
|
+
})(EntityPropertyType || (exports.EntityPropertyType = EntityPropertyType = {}));
|
|
13
|
+
exports.EntityTypeBaseField = zod_1.z.object({
|
|
14
|
+
type: zod_1.z.nativeEnum(EntityPropertyType),
|
|
15
|
+
description: zod_1.z.string(),
|
|
16
|
+
});
|
|
17
|
+
exports.EntityTypeTextFieldSchema = exports.EntityTypeBaseField.extend({
|
|
18
|
+
type: zod_1.z.literal(EntityPropertyType.Text),
|
|
19
|
+
value: zod_1.z.string().optional(),
|
|
20
|
+
});
|
|
21
|
+
exports.EntityTypeIntFieldSchema = exports.EntityTypeBaseField.extend({
|
|
22
|
+
type: zod_1.z.literal(EntityPropertyType.Int),
|
|
23
|
+
value: zod_1.z.number().int().optional(),
|
|
24
|
+
});
|
|
25
|
+
exports.EntityTypeFloatFieldSchema = exports.EntityTypeBaseField.extend({
|
|
26
|
+
type: zod_1.z.literal(EntityPropertyType.Float),
|
|
27
|
+
value: zod_1.z.number().optional(),
|
|
28
|
+
});
|
|
29
|
+
exports.EntityTypeBooleanFieldSchema = exports.EntityTypeBaseField.extend({
|
|
30
|
+
type: zod_1.z.literal(EntityPropertyType.Boolean),
|
|
31
|
+
value: zod_1.z.boolean().optional(),
|
|
32
|
+
});
|
|
33
|
+
exports.EntityTypeFieldSchema = zod_1.z.union([
|
|
34
|
+
exports.EntityTypeTextFieldSchema,
|
|
35
|
+
exports.EntityTypeIntFieldSchema,
|
|
36
|
+
exports.EntityTypeFloatFieldSchema,
|
|
37
|
+
exports.EntityTypeBooleanFieldSchema,
|
|
38
|
+
]);
|
|
39
|
+
exports.EntityFields = zod_1.z.record(exports.EntityTypeFieldSchema);
|
|
40
|
+
exports.EntityTypeSchema = zod_1.z.object({
|
|
41
|
+
description: zod_1.z.string().default(""),
|
|
42
|
+
fields: zod_1.z.record(exports.EntityTypeFieldSchema),
|
|
43
|
+
});
|
|
44
|
+
exports.entityFields = {
|
|
45
|
+
text: (description) => {
|
|
46
|
+
return exports.EntityTypeTextFieldSchema.parse({
|
|
47
|
+
type: EntityPropertyType.Text,
|
|
48
|
+
description,
|
|
49
|
+
});
|
|
50
|
+
},
|
|
51
|
+
integer: (description) => {
|
|
52
|
+
return exports.EntityTypeIntFieldSchema.parse({
|
|
53
|
+
type: EntityPropertyType.Int,
|
|
54
|
+
description,
|
|
55
|
+
});
|
|
56
|
+
},
|
|
57
|
+
float: (description) => {
|
|
58
|
+
return exports.EntityTypeFloatFieldSchema.parse({
|
|
59
|
+
type: EntityPropertyType.Float,
|
|
60
|
+
description,
|
|
61
|
+
});
|
|
62
|
+
},
|
|
63
|
+
boolean: (description) => {
|
|
64
|
+
return exports.EntityTypeBooleanFieldSchema.parse({
|
|
65
|
+
type: EntityPropertyType.Boolean,
|
|
66
|
+
description,
|
|
67
|
+
});
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
function entityModelToAPISchema(entityType, name) {
|
|
71
|
+
return {
|
|
72
|
+
name,
|
|
73
|
+
description: entityType.description,
|
|
74
|
+
properties: Object.entries(entityType.fields).map(([fieldName, fieldDef]) => ({
|
|
75
|
+
name: fieldName,
|
|
76
|
+
type: fieldDef.type,
|
|
77
|
+
description: fieldDef.description,
|
|
78
|
+
})),
|
|
79
|
+
};
|
|
80
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ZepClient } from "../../src";
|
|
2
|
+
import { EntityData, entityFields, EntityType } from "../../src/wrapper/ontology";
|
|
3
|
+
|
|
4
|
+
const API_KEY = process.env.ZEP_API_KEY;
|
|
5
|
+
|
|
6
|
+
async function main() {
|
|
7
|
+
const client = new ZepClient({
|
|
8
|
+
apiKey: API_KEY,
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
const purchaseSchema: EntityType = {
|
|
12
|
+
description: "A purchase",
|
|
13
|
+
fields: {
|
|
14
|
+
product: entityFields.text("The product purchased"),
|
|
15
|
+
quantity: entityFields.integer("The quantity purchased"),
|
|
16
|
+
price: entityFields.float("The price of the product"),
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
type Purchase = EntityData<typeof purchaseSchema>;
|
|
21
|
+
|
|
22
|
+
await client.graph.setEntityTypes({
|
|
23
|
+
Purchase: purchaseSchema,
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const { nodes } = await client.graph.search({
|
|
27
|
+
userId: "<user_id>",
|
|
28
|
+
scope: "nodes",
|
|
29
|
+
query: "ticket purchases",
|
|
30
|
+
searchFilters: {
|
|
31
|
+
nodeLabels: ["Purchase"],
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const purchases: Purchase[] = nodes?.map((node) => node.attributes as Purchase) ?? [];
|
|
36
|
+
|
|
37
|
+
console.log(purchases);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
main().catch(console.error);
|