@getzep/zep-cloud 2.12.3 → 2.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/api/resources/document/client/Client.js +13 -13
  2. package/api/resources/graph/client/Client.js +6 -6
  3. package/api/resources/graph/client/requests/EntityTypeRequest.d.ts +1 -0
  4. package/api/resources/graph/resources/edge/client/Client.js +4 -4
  5. package/api/resources/graph/resources/episode/client/Client.js +5 -5
  6. package/api/resources/graph/resources/node/client/Client.js +5 -5
  7. package/api/resources/group/client/Client.js +6 -6
  8. package/api/resources/memory/client/Client.js +22 -22
  9. package/api/resources/user/client/Client.js +8 -8
  10. package/api/types/EdgeType.d.ts +10 -0
  11. package/api/types/EdgeType.js +5 -0
  12. package/api/types/EntityEdge.d.ts +2 -0
  13. package/api/types/EntityEdgeSourceTarget.d.ts +9 -0
  14. package/api/types/EntityEdgeSourceTarget.js +5 -0
  15. package/api/types/EntityTypeResponse.d.ts +1 -0
  16. package/api/types/SearchFilters.d.ts +2 -0
  17. package/api/types/index.d.ts +2 -0
  18. package/api/types/index.js +2 -0
  19. package/dist/api/resources/document/client/Client.js +13 -13
  20. package/dist/api/resources/graph/client/Client.js +6 -6
  21. package/dist/api/resources/graph/client/requests/EntityTypeRequest.d.ts +1 -0
  22. package/dist/api/resources/graph/resources/edge/client/Client.js +4 -4
  23. package/dist/api/resources/graph/resources/episode/client/Client.js +5 -5
  24. package/dist/api/resources/graph/resources/node/client/Client.js +5 -5
  25. package/dist/api/resources/group/client/Client.js +6 -6
  26. package/dist/api/resources/memory/client/Client.js +22 -22
  27. package/dist/api/resources/user/client/Client.js +8 -8
  28. package/dist/api/types/EdgeType.d.ts +10 -0
  29. package/dist/api/types/EdgeType.js +5 -0
  30. package/dist/api/types/EntityEdge.d.ts +2 -0
  31. package/dist/api/types/EntityEdgeSourceTarget.d.ts +9 -0
  32. package/dist/api/types/EntityEdgeSourceTarget.js +5 -0
  33. package/dist/api/types/EntityTypeResponse.d.ts +1 -0
  34. package/dist/api/types/SearchFilters.d.ts +2 -0
  35. package/dist/api/types/index.d.ts +2 -0
  36. package/dist/api/types/index.js +2 -0
  37. package/dist/serialization/resources/graph/client/requests/EntityTypeRequest.d.ts +2 -0
  38. package/dist/serialization/resources/graph/client/requests/EntityTypeRequest.js +2 -0
  39. package/dist/serialization/types/EdgeType.d.ts +17 -0
  40. package/dist/serialization/types/EdgeType.js +48 -0
  41. package/dist/serialization/types/EntityEdge.d.ts +1 -0
  42. package/dist/serialization/types/EntityEdge.js +1 -0
  43. package/dist/serialization/types/EntityEdgeSourceTarget.d.ts +13 -0
  44. package/dist/serialization/types/EntityEdgeSourceTarget.js +44 -0
  45. package/dist/serialization/types/EntityTypeResponse.d.ts +2 -0
  46. package/dist/serialization/types/EntityTypeResponse.js +2 -0
  47. package/dist/serialization/types/SearchFilters.d.ts +1 -0
  48. package/dist/serialization/types/SearchFilters.js +1 -0
  49. package/dist/serialization/types/index.d.ts +2 -0
  50. package/dist/serialization/types/index.js +2 -0
  51. package/dist/version.d.ts +1 -1
  52. package/dist/version.js +1 -1
  53. package/dist/wrapper/graph.d.ts +40 -2
  54. package/dist/wrapper/graph.js +45 -3
  55. package/dist/wrapper/ontology.d.ts +124 -0
  56. package/dist/wrapper/ontology.js +21 -1
  57. package/examples/graph/entity_type_example.ts +24 -20
  58. package/package.json +1 -1
  59. package/serialization/resources/graph/client/requests/EntityTypeRequest.d.ts +2 -0
  60. package/serialization/resources/graph/client/requests/EntityTypeRequest.js +2 -0
  61. package/serialization/types/EdgeType.d.ts +17 -0
  62. package/serialization/types/EdgeType.js +48 -0
  63. package/serialization/types/EntityEdge.d.ts +1 -0
  64. package/serialization/types/EntityEdge.js +1 -0
  65. package/serialization/types/EntityEdgeSourceTarget.d.ts +13 -0
  66. package/serialization/types/EntityEdgeSourceTarget.js +44 -0
  67. package/serialization/types/EntityTypeResponse.d.ts +2 -0
  68. package/serialization/types/EntityTypeResponse.js +2 -0
  69. package/serialization/types/SearchFilters.d.ts +1 -0
  70. package/serialization/types/SearchFilters.js +1 -0
  71. package/serialization/types/index.d.ts +2 -0
  72. package/serialization/types/index.js +2 -0
  73. package/version.d.ts +1 -1
  74. package/version.js +1 -1
  75. package/wrapper/graph.d.ts +40 -2
  76. package/wrapper/graph.js +45 -3
  77. package/wrapper/ontology.d.ts +124 -0
  78. package/wrapper/ontology.js +21 -1
@@ -297,12 +297,135 @@ export declare const EntityTypeSchema: z.ZodObject<{
297
297
  }>;
298
298
  description?: string | undefined;
299
299
  }>;
300
+ export declare const EdgeTypeSchema: z.ZodObject<z.objectUtil.extendShape<{
301
+ description: z.ZodDefault<z.ZodString>;
302
+ fields: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<z.objectUtil.extendShape<{
303
+ type: z.ZodNativeEnum<typeof EntityPropertyType>;
304
+ description: z.ZodString;
305
+ }, {
306
+ type: z.ZodLiteral<EntityPropertyType.Text>;
307
+ value: z.ZodOptional<z.ZodString>;
308
+ }>, "strip", z.ZodTypeAny, {
309
+ type: EntityPropertyType.Text;
310
+ description: string;
311
+ value?: string | undefined;
312
+ }, {
313
+ type: EntityPropertyType.Text;
314
+ description: string;
315
+ value?: string | undefined;
316
+ }>, z.ZodObject<z.objectUtil.extendShape<{
317
+ type: z.ZodNativeEnum<typeof EntityPropertyType>;
318
+ description: z.ZodString;
319
+ }, {
320
+ type: z.ZodLiteral<EntityPropertyType.Int>;
321
+ value: z.ZodOptional<z.ZodNumber>;
322
+ }>, "strip", z.ZodTypeAny, {
323
+ type: EntityPropertyType.Int;
324
+ description: string;
325
+ value?: number | undefined;
326
+ }, {
327
+ type: EntityPropertyType.Int;
328
+ description: string;
329
+ value?: number | undefined;
330
+ }>, z.ZodObject<z.objectUtil.extendShape<{
331
+ type: z.ZodNativeEnum<typeof EntityPropertyType>;
332
+ description: z.ZodString;
333
+ }, {
334
+ type: z.ZodLiteral<EntityPropertyType.Float>;
335
+ value: z.ZodOptional<z.ZodNumber>;
336
+ }>, "strip", z.ZodTypeAny, {
337
+ type: EntityPropertyType.Float;
338
+ description: string;
339
+ value?: number | undefined;
340
+ }, {
341
+ type: EntityPropertyType.Float;
342
+ description: string;
343
+ value?: number | undefined;
344
+ }>, z.ZodObject<z.objectUtil.extendShape<{
345
+ type: z.ZodNativeEnum<typeof EntityPropertyType>;
346
+ description: z.ZodString;
347
+ }, {
348
+ type: z.ZodLiteral<EntityPropertyType.Boolean>;
349
+ value: z.ZodOptional<z.ZodBoolean>;
350
+ }>, "strip", z.ZodTypeAny, {
351
+ type: EntityPropertyType.Boolean;
352
+ description: string;
353
+ value?: boolean | undefined;
354
+ }, {
355
+ type: EntityPropertyType.Boolean;
356
+ description: string;
357
+ value?: boolean | undefined;
358
+ }>]>>;
359
+ }, {
360
+ sourceTargets: z.ZodOptional<z.ZodArray<z.ZodObject<{
361
+ source: z.ZodOptional<z.ZodString>;
362
+ target: z.ZodOptional<z.ZodString>;
363
+ }, "strip", z.ZodTypeAny, {
364
+ source?: string | undefined;
365
+ target?: string | undefined;
366
+ }, {
367
+ source?: string | undefined;
368
+ target?: string | undefined;
369
+ }>, "many">>;
370
+ }>, "strip", z.ZodTypeAny, {
371
+ description: string;
372
+ fields: Record<string, {
373
+ type: EntityPropertyType.Text;
374
+ description: string;
375
+ value?: string | undefined;
376
+ } | {
377
+ type: EntityPropertyType.Int;
378
+ description: string;
379
+ value?: number | undefined;
380
+ } | {
381
+ type: EntityPropertyType.Float;
382
+ description: string;
383
+ value?: number | undefined;
384
+ } | {
385
+ type: EntityPropertyType.Boolean;
386
+ description: string;
387
+ value?: boolean | undefined;
388
+ }>;
389
+ sourceTargets?: {
390
+ source?: string | undefined;
391
+ target?: string | undefined;
392
+ }[] | undefined;
393
+ }, {
394
+ fields: Record<string, {
395
+ type: EntityPropertyType.Text;
396
+ description: string;
397
+ value?: string | undefined;
398
+ } | {
399
+ type: EntityPropertyType.Int;
400
+ description: string;
401
+ value?: number | undefined;
402
+ } | {
403
+ type: EntityPropertyType.Float;
404
+ description: string;
405
+ value?: number | undefined;
406
+ } | {
407
+ type: EntityPropertyType.Boolean;
408
+ description: string;
409
+ value?: boolean | undefined;
410
+ }>;
411
+ description?: string | undefined;
412
+ sourceTargets?: {
413
+ source?: string | undefined;
414
+ target?: string | undefined;
415
+ }[] | undefined;
416
+ }>;
300
417
  export type EntityType = z.infer<typeof EntityTypeSchema>;
418
+ export type EdgeType = z.infer<typeof EdgeTypeSchema>;
301
419
  export type EntityData<T extends EntityType> = {
302
420
  [P in keyof T["fields"]]: T["fields"][P] extends {
303
421
  value?: infer V;
304
422
  } ? V : never;
305
423
  };
424
+ export type EdgeData<T extends EdgeType> = {
425
+ [P in keyof T["fields"]]: T["fields"][P] extends {
426
+ value?: infer V;
427
+ } ? V : never;
428
+ };
306
429
  export declare const entityFields: {
307
430
  text: (description: string) => EntityTextField;
308
431
  integer: (description: string) => EntityIntField;
@@ -310,3 +433,4 @@ export declare const entityFields: {
310
433
  boolean: (description: string) => EntityBooleanField;
311
434
  };
312
435
  export declare function entityModelToAPISchema(entityType: EntityType, name: string): Zep.EntityType;
436
+ export declare function edgeModelToAPISchema(entityType: EdgeType, name: string): Zep.EdgeType;
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
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;
3
+ exports.entityFields = exports.EdgeTypeSchema = exports.EntityTypeSchema = exports.EntityFields = exports.EntityTypeFieldSchema = exports.EntityTypeBooleanFieldSchema = exports.EntityTypeFloatFieldSchema = exports.EntityTypeIntFieldSchema = exports.EntityTypeTextFieldSchema = exports.EntityTypeBaseField = exports.EntityPropertyType = void 0;
4
4
  exports.entityModelToAPISchema = entityModelToAPISchema;
5
+ exports.edgeModelToAPISchema = edgeModelToAPISchema;
5
6
  const zod_1 = require("zod");
6
7
  var EntityPropertyType;
7
8
  (function (EntityPropertyType) {
@@ -41,6 +42,13 @@ exports.EntityTypeSchema = zod_1.z.object({
41
42
  description: zod_1.z.string().default(""),
42
43
  fields: zod_1.z.record(exports.EntityTypeFieldSchema),
43
44
  });
45
+ const EdgeSourceTarget = zod_1.z.object({
46
+ source: zod_1.z.string().optional(),
47
+ target: zod_1.z.string().optional(),
48
+ });
49
+ exports.EdgeTypeSchema = exports.EntityTypeSchema.extend({
50
+ sourceTargets: zod_1.z.array(EdgeSourceTarget).optional(),
51
+ });
44
52
  exports.entityFields = {
45
53
  text: (description) => {
46
54
  return exports.EntityTypeTextFieldSchema.parse({
@@ -78,3 +86,15 @@ function entityModelToAPISchema(entityType, name) {
78
86
  })),
79
87
  };
80
88
  }
89
+ function edgeModelToAPISchema(entityType, name) {
90
+ return {
91
+ name,
92
+ description: entityType.description,
93
+ sourceTargets: entityType.sourceTargets,
94
+ properties: Object.entries(entityType.fields).map(([fieldName, fieldDef]) => ({
95
+ name: fieldName,
96
+ type: fieldDef.type,
97
+ description: fieldDef.description,
98
+ })),
99
+ };
100
+ }
@@ -1,5 +1,5 @@
1
1
  import { ZepClient } from "../../src";
2
- import { EntityData, entityFields, EntityType } from "../../src/wrapper/ontology";
2
+ import { EntityData, entityFields, EntityType, EdgeType } from "../../src/wrapper/ontology";
3
3
 
4
4
  const API_KEY = process.env.ZEP_API_KEY;
5
5
 
@@ -8,33 +8,37 @@ async function main() {
8
8
  apiKey: API_KEY,
9
9
  });
10
10
 
11
- const purchaseSchema: EntityType = {
12
- description: "A purchase",
11
+ const travelDestinationSchema: EntityType = {
12
+ description: "A travel destination entity",
13
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"),
14
+ destination_name: entityFields.text("The name of travel destination"),
17
15
  },
18
16
  };
19
17
 
20
- type Purchase = EntityData<typeof purchaseSchema>;
18
+ type TravelDestination = EntityData<typeof travelDestinationSchema>;
21
19
 
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"],
20
+ const isTravelingTo: EdgeType = {
21
+ description: "An edge representing a traveler going to a destination.",
22
+ fields: {
23
+ travel_date: entityFields.text("The date of the travel"),
24
+ purpose: entityFields.text("The purpose of the travel"),
32
25
  },
33
- });
26
+ sourceTargets: [
27
+ {
28
+ source: "User",
29
+ target: "TravelDestination",
30
+ }
31
+ ]
32
+ }
34
33
 
35
- const purchases: Purchase[] = nodes?.map((node) => node.attributes as Purchase) ?? [];
34
+ await client.graph.setEntityTypes({
35
+ TravelDestination: travelDestinationSchema,
36
+ }, {
37
+ IS_TRAVELING_TO: isTravelingTo,
38
+ });
36
39
 
37
- console.log(purchases);
40
+ const customTypes = await client.graph.listEntityTypes();
41
+ console.log(JSON.stringify(customTypes, null, 2));
38
42
  }
39
43
 
40
44
  main().catch(console.error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getzep/zep-cloud",
3
- "version": "2.12.3",
3
+ "version": "2.13.0",
4
4
  "private": false,
5
5
  "repository": "https://github.com/getzep/zep-js",
6
6
  "description": "Zep: Fast, scalable building blocks for production LLM apps",
@@ -4,10 +4,12 @@
4
4
  import * as serializers from "../../../../index";
5
5
  import * as Zep from "../../../../../api/index";
6
6
  import * as core from "../../../../../core";
7
+ import { EdgeType } from "../../../../types/EdgeType";
7
8
  import { EntityType } from "../../../../types/EntityType";
8
9
  export declare const EntityTypeRequest: core.serialization.Schema<serializers.EntityTypeRequest.Raw, Zep.EntityTypeRequest>;
9
10
  export declare namespace EntityTypeRequest {
10
11
  interface Raw {
12
+ edge_types?: EdgeType.Raw[] | null;
11
13
  entity_types?: EntityType.Raw[] | null;
12
14
  }
13
15
  }
@@ -38,7 +38,9 @@ var __importStar = (this && this.__importStar) || (function () {
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.EntityTypeRequest = void 0;
40
40
  const core = __importStar(require("../../../../../core"));
41
+ const EdgeType_1 = require("../../../../types/EdgeType");
41
42
  const EntityType_1 = require("../../../../types/EntityType");
42
43
  exports.EntityTypeRequest = core.serialization.object({
44
+ edgeTypes: core.serialization.property("edge_types", core.serialization.list(EdgeType_1.EdgeType).optional()),
43
45
  entityTypes: core.serialization.property("entity_types", core.serialization.list(EntityType_1.EntityType).optional()),
44
46
  });
@@ -0,0 +1,17 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as serializers from "../index";
5
+ import * as Zep from "../../api/index";
6
+ import * as core from "../../core";
7
+ import { EntityProperty } from "./EntityProperty";
8
+ import { EntityEdgeSourceTarget } from "./EntityEdgeSourceTarget";
9
+ export declare const EdgeType: core.serialization.ObjectSchema<serializers.EdgeType.Raw, Zep.EdgeType>;
10
+ export declare namespace EdgeType {
11
+ interface Raw {
12
+ description: string;
13
+ name: string;
14
+ properties?: EntityProperty.Raw[] | null;
15
+ source_targets?: EntityEdgeSourceTarget.Raw[] | null;
16
+ }
17
+ }
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.EdgeType = void 0;
40
+ const core = __importStar(require("../../core"));
41
+ const EntityProperty_1 = require("./EntityProperty");
42
+ const EntityEdgeSourceTarget_1 = require("./EntityEdgeSourceTarget");
43
+ exports.EdgeType = core.serialization.object({
44
+ description: core.serialization.string(),
45
+ name: core.serialization.string(),
46
+ properties: core.serialization.list(EntityProperty_1.EntityProperty).optional(),
47
+ sourceTargets: core.serialization.property("source_targets", core.serialization.list(EntityEdgeSourceTarget_1.EntityEdgeSourceTarget).optional()),
48
+ });
@@ -7,6 +7,7 @@ import * as core from "../../core";
7
7
  export declare const EntityEdge: core.serialization.ObjectSchema<serializers.EntityEdge.Raw, Zep.EntityEdge>;
8
8
  export declare namespace EntityEdge {
9
9
  interface Raw {
10
+ attributes?: Record<string, unknown> | null;
10
11
  created_at: string;
11
12
  episodes?: string[] | null;
12
13
  expired_at?: string | null;
@@ -39,6 +39,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.EntityEdge = void 0;
40
40
  const core = __importStar(require("../../core"));
41
41
  exports.EntityEdge = core.serialization.object({
42
+ attributes: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(),
42
43
  createdAt: core.serialization.property("created_at", core.serialization.string()),
43
44
  episodes: core.serialization.list(core.serialization.string()).optional(),
44
45
  expiredAt: core.serialization.property("expired_at", core.serialization.string().optional()),
@@ -0,0 +1,13 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as serializers from "../index";
5
+ import * as Zep from "../../api/index";
6
+ import * as core from "../../core";
7
+ export declare const EntityEdgeSourceTarget: core.serialization.ObjectSchema<serializers.EntityEdgeSourceTarget.Raw, Zep.EntityEdgeSourceTarget>;
8
+ export declare namespace EntityEdgeSourceTarget {
9
+ interface Raw {
10
+ source?: string | null;
11
+ target?: string | null;
12
+ }
13
+ }
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.EntityEdgeSourceTarget = void 0;
40
+ const core = __importStar(require("../../core"));
41
+ exports.EntityEdgeSourceTarget = core.serialization.object({
42
+ source: core.serialization.string().optional(),
43
+ target: core.serialization.string().optional(),
44
+ });
@@ -4,10 +4,12 @@
4
4
  import * as serializers from "../index";
5
5
  import * as Zep from "../../api/index";
6
6
  import * as core from "../../core";
7
+ import { EdgeType } from "./EdgeType";
7
8
  import { EntityType } from "./EntityType";
8
9
  export declare const EntityTypeResponse: core.serialization.ObjectSchema<serializers.EntityTypeResponse.Raw, Zep.EntityTypeResponse>;
9
10
  export declare namespace EntityTypeResponse {
10
11
  interface Raw {
12
+ edge_types?: EdgeType.Raw[] | null;
11
13
  entity_types?: EntityType.Raw[] | null;
12
14
  }
13
15
  }
@@ -38,7 +38,9 @@ var __importStar = (this && this.__importStar) || (function () {
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.EntityTypeResponse = void 0;
40
40
  const core = __importStar(require("../../core"));
41
+ const EdgeType_1 = require("./EdgeType");
41
42
  const EntityType_1 = require("./EntityType");
42
43
  exports.EntityTypeResponse = core.serialization.object({
44
+ edgeTypes: core.serialization.property("edge_types", core.serialization.list(EdgeType_1.EdgeType).optional()),
43
45
  entityTypes: core.serialization.property("entity_types", core.serialization.list(EntityType_1.EntityType).optional()),
44
46
  });
@@ -7,6 +7,7 @@ import * as core from "../../core";
7
7
  export declare const SearchFilters: core.serialization.ObjectSchema<serializers.SearchFilters.Raw, Zep.SearchFilters>;
8
8
  export declare namespace SearchFilters {
9
9
  interface Raw {
10
+ edge_types?: string[] | null;
10
11
  node_labels?: string[] | null;
11
12
  }
12
13
  }
@@ -39,5 +39,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.SearchFilters = void 0;
40
40
  const core = __importStar(require("../../core"));
41
41
  exports.SearchFilters = core.serialization.object({
42
+ edgeTypes: core.serialization.property("edge_types", core.serialization.list(core.serialization.string()).optional()),
42
43
  nodeLabels: core.serialization.property("node_labels", core.serialization.list(core.serialization.string()).optional()),
43
44
  });
@@ -4,8 +4,10 @@ export * from "./ApidataDocument";
4
4
  export * from "./ApidataDocumentCollection";
5
5
  export * from "./ApidataDocumentSearchResponse";
6
6
  export * from "./ApidataDocumentWithScore";
7
+ export * from "./EdgeType";
7
8
  export * from "./EndSessionResponse";
8
9
  export * from "./EndSessionsResponse";
10
+ export * from "./EntityEdgeSourceTarget";
9
11
  export * from "./EntityProperty";
10
12
  export * from "./EntityType";
11
13
  export * from "./EntityTypeResponse";
@@ -20,8 +20,10 @@ __exportStar(require("./ApidataDocument"), exports);
20
20
  __exportStar(require("./ApidataDocumentCollection"), exports);
21
21
  __exportStar(require("./ApidataDocumentSearchResponse"), exports);
22
22
  __exportStar(require("./ApidataDocumentWithScore"), exports);
23
+ __exportStar(require("./EdgeType"), exports);
23
24
  __exportStar(require("./EndSessionResponse"), exports);
24
25
  __exportStar(require("./EndSessionsResponse"), exports);
26
+ __exportStar(require("./EntityEdgeSourceTarget"), exports);
25
27
  __exportStar(require("./EntityProperty"), exports);
26
28
  __exportStar(require("./EntityType"), exports);
27
29
  __exportStar(require("./EntityTypeResponse"), exports);
package/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "2.12.3";
1
+ export declare const SDK_VERSION = "2.13.0";
package/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "2.12.3";
4
+ exports.SDK_VERSION = "2.13.0";
@@ -1,6 +1,44 @@
1
1
  import { Graph as BaseGraph } from "../api/resources/graph/client/Client";
2
2
  import { Zep } from "../index";
3
- import { EntityType } from "./ontology";
3
+ import { EdgeType, EntityType } from "./ontology";
4
4
  export declare class Graph extends BaseGraph {
5
- setEntityTypes(entityTypes: Record<string, EntityType>, requestOptions?: BaseGraph.RequestOptions): Promise<Zep.SuccessResponse>;
5
+ /**
6
+ * Sets the entity and edge types for a project, replacing any existing ones.
7
+ *
8
+ * @param {Record<string, EntityType>} entityTypes
9
+ * @param {Record<string, EdgeType>} edgeTypes
10
+ * @param {Graph.RequestOptions} requestOptions - Request-specific configuration.
11
+ *
12
+ * @throws {@link Zep.BadRequestError}
13
+ * @throws {@link Zep.InternalServerError}
14
+ *
15
+ * @example
16
+ * const travelDestinationSchema: EntityType = {
17
+ * description: "A travel destination entity",
18
+ * fields: {
19
+ * destination_name: entityFields.text("The name of travel destination"),
20
+ * },
21
+ * };
22
+ *
23
+ * const isTravelingTo: EdgeType = {
24
+ * description: "An edge representing a traveler going to a destination.",
25
+ * fields: {
26
+ * travel_date: entityFields.text("The date of the travel"),
27
+ * purpose: entityFields.text("The purpose of the travel"),
28
+ * },
29
+ * sourceTargets: [
30
+ * {
31
+ * source: "User",
32
+ * target: "TravelDestination",
33
+ * }
34
+ * ]
35
+ * }
36
+ *
37
+ * await client.graph.setEntityTypes({
38
+ * TravelDestination: travelDestinationSchema,
39
+ * }, {
40
+ * IS_TRAVELING_TO: isTravelingTo,
41
+ * });
42
+ */
43
+ setEntityTypes(entityTypes: Record<string, EntityType>, edgeTypes: Record<string, EdgeType>, requestOptions?: BaseGraph.RequestOptions): Promise<Zep.SuccessResponse>;
6
44
  }
package/wrapper/graph.js CHANGED
@@ -13,15 +13,57 @@ exports.Graph = void 0;
13
13
  const Client_1 = require("../api/resources/graph/client/Client");
14
14
  const ontology_1 = require("./ontology");
15
15
  class Graph extends Client_1.Graph {
16
- setEntityTypes(entityTypes, requestOptions) {
16
+ /**
17
+ * Sets the entity and edge types for a project, replacing any existing ones.
18
+ *
19
+ * @param {Record<string, EntityType>} entityTypes
20
+ * @param {Record<string, EdgeType>} edgeTypes
21
+ * @param {Graph.RequestOptions} requestOptions - Request-specific configuration.
22
+ *
23
+ * @throws {@link Zep.BadRequestError}
24
+ * @throws {@link Zep.InternalServerError}
25
+ *
26
+ * @example
27
+ * const travelDestinationSchema: EntityType = {
28
+ * description: "A travel destination entity",
29
+ * fields: {
30
+ * destination_name: entityFields.text("The name of travel destination"),
31
+ * },
32
+ * };
33
+ *
34
+ * const isTravelingTo: EdgeType = {
35
+ * description: "An edge representing a traveler going to a destination.",
36
+ * fields: {
37
+ * travel_date: entityFields.text("The date of the travel"),
38
+ * purpose: entityFields.text("The purpose of the travel"),
39
+ * },
40
+ * sourceTargets: [
41
+ * {
42
+ * source: "User",
43
+ * target: "TravelDestination",
44
+ * }
45
+ * ]
46
+ * }
47
+ *
48
+ * await client.graph.setEntityTypes({
49
+ * TravelDestination: travelDestinationSchema,
50
+ * }, {
51
+ * IS_TRAVELING_TO: isTravelingTo,
52
+ * });
53
+ */
54
+ setEntityTypes(entityTypes, edgeTypes, requestOptions) {
17
55
  return __awaiter(this, void 0, void 0, function* () {
18
56
  const validatedEntityTypes = Object.keys(entityTypes).map((key) => {
19
57
  const schema = entityTypes[key];
20
- const entityType = (0, ontology_1.entityModelToAPISchema)(schema, key);
21
- return entityType;
58
+ return (0, ontology_1.entityModelToAPISchema)(schema, key);
59
+ });
60
+ const validatedEdgeTypes = Object.keys(edgeTypes).map((key) => {
61
+ const schema = edgeTypes[key];
62
+ return (0, ontology_1.edgeModelToAPISchema)(schema, key);
22
63
  });
23
64
  return this.setEntityTypesInternal({
24
65
  entityTypes: validatedEntityTypes,
66
+ edgeTypes: validatedEdgeTypes,
25
67
  }, requestOptions);
26
68
  });
27
69
  }