@getzep/zep-cloud 2.12.3 → 2.14.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 (109) 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.d.ts +1 -1
  6. package/api/resources/graph/resources/episode/client/Client.js +6 -6
  7. package/api/resources/graph/resources/node/client/Client.js +5 -5
  8. package/api/resources/group/client/Client.js +6 -6
  9. package/api/resources/memory/client/Client.js +22 -22
  10. package/api/resources/user/client/Client.js +8 -8
  11. package/api/types/EdgeType.d.ts +10 -0
  12. package/api/types/EdgeType.js +5 -0
  13. package/api/types/EntityEdge.d.ts +2 -0
  14. package/api/types/EntityEdgeSourceTarget.d.ts +9 -0
  15. package/api/types/EntityEdgeSourceTarget.js +5 -0
  16. package/api/types/EntityTypeResponse.d.ts +1 -0
  17. package/api/types/Episode.d.ts +4 -0
  18. package/api/types/EpisodeMentions.d.ts +8 -0
  19. package/api/types/EpisodeMentions.js +5 -0
  20. package/api/types/GraphSearchResults.d.ts +1 -0
  21. package/api/types/GraphSearchScope.d.ts +2 -1
  22. package/api/types/GraphSearchScope.js +1 -0
  23. package/api/types/SearchFilters.d.ts +2 -0
  24. package/api/types/index.d.ts +4 -1
  25. package/api/types/index.js +4 -1
  26. package/dist/api/resources/document/client/Client.js +13 -13
  27. package/dist/api/resources/graph/client/Client.js +6 -6
  28. package/dist/api/resources/graph/client/requests/EntityTypeRequest.d.ts +1 -0
  29. package/dist/api/resources/graph/resources/edge/client/Client.js +4 -4
  30. package/dist/api/resources/graph/resources/episode/client/Client.d.ts +1 -1
  31. package/dist/api/resources/graph/resources/episode/client/Client.js +6 -6
  32. package/dist/api/resources/graph/resources/node/client/Client.js +5 -5
  33. package/dist/api/resources/group/client/Client.js +6 -6
  34. package/dist/api/resources/memory/client/Client.js +22 -22
  35. package/dist/api/resources/user/client/Client.js +8 -8
  36. package/dist/api/types/EdgeType.d.ts +10 -0
  37. package/dist/api/types/EdgeType.js +5 -0
  38. package/dist/api/types/EntityEdge.d.ts +2 -0
  39. package/dist/api/types/EntityEdgeSourceTarget.d.ts +9 -0
  40. package/dist/api/types/EntityEdgeSourceTarget.js +5 -0
  41. package/dist/api/types/EntityTypeResponse.d.ts +1 -0
  42. package/dist/api/types/Episode.d.ts +4 -0
  43. package/dist/api/types/EpisodeMentions.d.ts +8 -0
  44. package/dist/api/types/EpisodeMentions.js +5 -0
  45. package/dist/api/types/GraphSearchResults.d.ts +1 -0
  46. package/dist/api/types/GraphSearchScope.d.ts +2 -1
  47. package/dist/api/types/GraphSearchScope.js +1 -0
  48. package/dist/api/types/SearchFilters.d.ts +2 -0
  49. package/dist/api/types/index.d.ts +4 -1
  50. package/dist/api/types/index.js +4 -1
  51. package/dist/serialization/resources/graph/client/requests/EntityTypeRequest.d.ts +2 -0
  52. package/dist/serialization/resources/graph/client/requests/EntityTypeRequest.js +2 -0
  53. package/dist/serialization/types/EdgeType.d.ts +17 -0
  54. package/dist/serialization/types/EdgeType.js +48 -0
  55. package/dist/serialization/types/EntityEdge.d.ts +1 -0
  56. package/dist/serialization/types/EntityEdge.js +1 -0
  57. package/dist/serialization/types/EntityEdgeSourceTarget.d.ts +13 -0
  58. package/dist/serialization/types/EntityEdgeSourceTarget.js +44 -0
  59. package/dist/serialization/types/EntityTypeResponse.d.ts +2 -0
  60. package/dist/serialization/types/EntityTypeResponse.js +2 -0
  61. package/dist/serialization/types/Episode.d.ts +3 -0
  62. package/dist/serialization/types/Episode.js +3 -0
  63. package/dist/serialization/types/EpisodeMentions.d.ts +15 -0
  64. package/dist/serialization/types/EpisodeMentions.js +46 -0
  65. package/dist/serialization/types/GraphSearchResults.d.ts +2 -0
  66. package/dist/serialization/types/GraphSearchResults.js +2 -0
  67. package/dist/serialization/types/GraphSearchScope.d.ts +1 -1
  68. package/dist/serialization/types/GraphSearchScope.js +1 -1
  69. package/dist/serialization/types/SearchFilters.d.ts +1 -0
  70. package/dist/serialization/types/SearchFilters.js +1 -0
  71. package/dist/serialization/types/index.d.ts +4 -1
  72. package/dist/serialization/types/index.js +4 -1
  73. package/dist/version.d.ts +1 -1
  74. package/dist/version.js +1 -1
  75. package/dist/wrapper/graph.d.ts +40 -2
  76. package/dist/wrapper/graph.js +45 -3
  77. package/dist/wrapper/ontology.d.ts +124 -0
  78. package/dist/wrapper/ontology.js +21 -1
  79. package/examples/graph/entity_type_example.ts +24 -20
  80. package/package.json +1 -1
  81. package/reference.md +1 -1
  82. package/serialization/resources/graph/client/requests/EntityTypeRequest.d.ts +2 -0
  83. package/serialization/resources/graph/client/requests/EntityTypeRequest.js +2 -0
  84. package/serialization/types/EdgeType.d.ts +17 -0
  85. package/serialization/types/EdgeType.js +48 -0
  86. package/serialization/types/EntityEdge.d.ts +1 -0
  87. package/serialization/types/EntityEdge.js +1 -0
  88. package/serialization/types/EntityEdgeSourceTarget.d.ts +13 -0
  89. package/serialization/types/EntityEdgeSourceTarget.js +44 -0
  90. package/serialization/types/EntityTypeResponse.d.ts +2 -0
  91. package/serialization/types/EntityTypeResponse.js +2 -0
  92. package/serialization/types/Episode.d.ts +3 -0
  93. package/serialization/types/Episode.js +3 -0
  94. package/serialization/types/EpisodeMentions.d.ts +15 -0
  95. package/serialization/types/EpisodeMentions.js +46 -0
  96. package/serialization/types/GraphSearchResults.d.ts +2 -0
  97. package/serialization/types/GraphSearchResults.js +2 -0
  98. package/serialization/types/GraphSearchScope.d.ts +1 -1
  99. package/serialization/types/GraphSearchScope.js +1 -1
  100. package/serialization/types/SearchFilters.d.ts +1 -0
  101. package/serialization/types/SearchFilters.js +1 -0
  102. package/serialization/types/index.d.ts +4 -1
  103. package/serialization/types/index.js +4 -1
  104. package/version.d.ts +1 -1
  105. package/version.js +1 -1
  106. package/wrapper/graph.d.ts +40 -2
  107. package/wrapper/graph.js +45 -3
  108. package/wrapper/ontology.d.ts +124 -0
  109. package/wrapper/ontology.js +21 -1
@@ -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
  });
@@ -4,6 +4,7 @@
4
4
  import * as serializers from "../index";
5
5
  import * as Zep from "../../api/index";
6
6
  import * as core from "../../core";
7
+ import { RoleType } from "./RoleType";
7
8
  import { GraphDataType } from "./GraphDataType";
8
9
  export declare const Episode: core.serialization.ObjectSchema<serializers.Episode.Raw, Zep.Episode>;
9
10
  export declare namespace Episode {
@@ -11,6 +12,8 @@ export declare namespace Episode {
11
12
  content: string;
12
13
  created_at: string;
13
14
  processed?: boolean | null;
15
+ role?: string | null;
16
+ role_type?: RoleType.Raw | null;
14
17
  session_id?: string | null;
15
18
  source?: GraphDataType.Raw | null;
16
19
  source_description?: string | null;
@@ -38,11 +38,14 @@ var __importStar = (this && this.__importStar) || (function () {
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.Episode = void 0;
40
40
  const core = __importStar(require("../../core"));
41
+ const RoleType_1 = require("./RoleType");
41
42
  const GraphDataType_1 = require("./GraphDataType");
42
43
  exports.Episode = core.serialization.object({
43
44
  content: core.serialization.string(),
44
45
  createdAt: core.serialization.property("created_at", core.serialization.string()),
45
46
  processed: core.serialization.boolean().optional(),
47
+ role: core.serialization.string().optional(),
48
+ roleType: core.serialization.property("role_type", RoleType_1.RoleType.optional()),
46
49
  sessionId: core.serialization.property("session_id", core.serialization.string().optional()),
47
50
  source: GraphDataType_1.GraphDataType.optional(),
48
51
  sourceDescription: core.serialization.property("source_description", core.serialization.string().optional()),
@@ -0,0 +1,15 @@
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 { EntityEdge } from "./EntityEdge";
8
+ import { EntityNode } from "./EntityNode";
9
+ export declare const EpisodeMentions: core.serialization.ObjectSchema<serializers.EpisodeMentions.Raw, Zep.EpisodeMentions>;
10
+ export declare namespace EpisodeMentions {
11
+ interface Raw {
12
+ edges?: EntityEdge.Raw[] | null;
13
+ nodes?: EntityNode.Raw[] | null;
14
+ }
15
+ }
@@ -0,0 +1,46 @@
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.EpisodeMentions = void 0;
40
+ const core = __importStar(require("../../core"));
41
+ const EntityEdge_1 = require("./EntityEdge");
42
+ const EntityNode_1 = require("./EntityNode");
43
+ exports.EpisodeMentions = core.serialization.object({
44
+ edges: core.serialization.list(EntityEdge_1.EntityEdge).optional(),
45
+ nodes: core.serialization.list(EntityNode_1.EntityNode).optional(),
46
+ });
@@ -5,11 +5,13 @@ import * as serializers from "../index";
5
5
  import * as Zep from "../../api/index";
6
6
  import * as core from "../../core";
7
7
  import { EntityEdge } from "./EntityEdge";
8
+ import { Episode } from "./Episode";
8
9
  import { EntityNode } from "./EntityNode";
9
10
  export declare const GraphSearchResults: core.serialization.ObjectSchema<serializers.GraphSearchResults.Raw, Zep.GraphSearchResults>;
10
11
  export declare namespace GraphSearchResults {
11
12
  interface Raw {
12
13
  edges?: EntityEdge.Raw[] | null;
14
+ episodes?: Episode.Raw[] | null;
13
15
  nodes?: EntityNode.Raw[] | null;
14
16
  }
15
17
  }
@@ -39,8 +39,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.GraphSearchResults = void 0;
40
40
  const core = __importStar(require("../../core"));
41
41
  const EntityEdge_1 = require("./EntityEdge");
42
+ const Episode_1 = require("./Episode");
42
43
  const EntityNode_1 = require("./EntityNode");
43
44
  exports.GraphSearchResults = core.serialization.object({
44
45
  edges: core.serialization.list(EntityEdge_1.EntityEdge).optional(),
46
+ episodes: core.serialization.list(Episode_1.Episode).optional(),
45
47
  nodes: core.serialization.list(EntityNode_1.EntityNode).optional(),
46
48
  });
@@ -6,5 +6,5 @@ import * as Zep from "../../api/index";
6
6
  import * as core from "../../core";
7
7
  export declare const GraphSearchScope: core.serialization.Schema<serializers.GraphSearchScope.Raw, Zep.GraphSearchScope>;
8
8
  export declare namespace GraphSearchScope {
9
- type Raw = "edges" | "nodes";
9
+ type Raw = "edges" | "nodes" | "episodes";
10
10
  }
@@ -38,4 +38,4 @@ var __importStar = (this && this.__importStar) || (function () {
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.GraphSearchScope = void 0;
40
40
  const core = __importStar(require("../../core"));
41
- exports.GraphSearchScope = core.serialization.enum_(["edges", "nodes"]);
41
+ exports.GraphSearchScope = core.serialization.enum_(["edges", "nodes", "episodes"]);
@@ -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,12 +4,15 @@ 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";
12
14
  export * from "./EpisodeData";
15
+ export * from "./EpisodeMentions";
13
16
  export * from "./Fact";
14
17
  export * from "./FactRatingInstruction";
15
18
  export * from "./FactResponse";
@@ -18,6 +21,7 @@ export * from "./GraphEdgesRequest";
18
21
  export * from "./Episode";
19
22
  export * from "./EpisodeResponse";
20
23
  export * from "./GraphNodesRequest";
24
+ export * from "./GraphSearchResults";
21
25
  export * from "./Group";
22
26
  export * from "./GroupListResponse";
23
27
  export * from "./Memory";
@@ -41,7 +45,6 @@ export * from "./UserNodeResponse";
41
45
  export * from "./AddTripleResponse";
42
46
  export * from "./EntityEdge";
43
47
  export * from "./EntityNode";
44
- export * from "./GraphSearchResults";
45
48
  export * from "./GraphSearchScope";
46
49
  export * from "./Reranker";
47
50
  export * from "./SearchFilters";
@@ -20,12 +20,15 @@ __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);
28
30
  __exportStar(require("./EpisodeData"), exports);
31
+ __exportStar(require("./EpisodeMentions"), exports);
29
32
  __exportStar(require("./Fact"), exports);
30
33
  __exportStar(require("./FactRatingInstruction"), exports);
31
34
  __exportStar(require("./FactResponse"), exports);
@@ -34,6 +37,7 @@ __exportStar(require("./GraphEdgesRequest"), exports);
34
37
  __exportStar(require("./Episode"), exports);
35
38
  __exportStar(require("./EpisodeResponse"), exports);
36
39
  __exportStar(require("./GraphNodesRequest"), exports);
40
+ __exportStar(require("./GraphSearchResults"), exports);
37
41
  __exportStar(require("./Group"), exports);
38
42
  __exportStar(require("./GroupListResponse"), exports);
39
43
  __exportStar(require("./Memory"), exports);
@@ -57,7 +61,6 @@ __exportStar(require("./UserNodeResponse"), exports);
57
61
  __exportStar(require("./AddTripleResponse"), exports);
58
62
  __exportStar(require("./EntityEdge"), exports);
59
63
  __exportStar(require("./EntityNode"), exports);
60
- __exportStar(require("./GraphSearchResults"), exports);
61
64
  __exportStar(require("./GraphSearchScope"), exports);
62
65
  __exportStar(require("./Reranker"), exports);
63
66
  __exportStar(require("./SearchFilters"), exports);
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "2.12.3";
1
+ export declare const SDK_VERSION = "2.14.0";
package/dist/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.14.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
  }
@@ -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
  }
@@ -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
+ }