@getzep/zep-cloud 2.7.0 → 2.8.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/Client.d.ts +3 -3
  2. package/Client.js +6 -6
  3. package/api/resources/document/client/Client.js +13 -13
  4. package/api/resources/graph/client/Client.d.ts +30 -0
  5. package/api/resources/graph/client/Client.js +157 -4
  6. package/api/resources/graph/client/requests/EntityTypeRequest.d.ts +16 -0
  7. package/api/resources/graph/client/requests/EntityTypeRequest.js +5 -0
  8. package/api/resources/graph/client/requests/GraphSearchQuery.d.ts +2 -0
  9. package/api/resources/graph/client/requests/index.d.ts +1 -0
  10. package/api/resources/graph/resources/edge/client/Client.js +4 -4
  11. package/api/resources/graph/resources/episode/client/Client.js +5 -5
  12. package/api/resources/graph/resources/node/client/Client.js +3 -3
  13. package/api/resources/group/client/Client.js +6 -6
  14. package/api/resources/index.d.ts +2 -2
  15. package/api/resources/index.js +3 -3
  16. package/api/resources/memory/client/Client.js +22 -22
  17. package/api/resources/user/client/Client.js +8 -8
  18. package/api/types/EntityProperty.d.ts +9 -0
  19. package/api/types/EntityProperty.js +5 -0
  20. package/api/types/EntityPropertyType.d.ts +10 -0
  21. package/api/types/EntityPropertyType.js +12 -0
  22. package/api/types/EntityType.d.ts +9 -0
  23. package/api/types/EntityType.js +5 -0
  24. package/api/types/EntityTypeResponse.d.ts +7 -0
  25. package/api/types/EntityTypeResponse.js +5 -0
  26. package/api/types/index.d.ts +4 -0
  27. package/api/types/index.js +4 -0
  28. package/dist/Client.d.ts +3 -3
  29. package/dist/Client.js +6 -6
  30. package/dist/api/resources/document/client/Client.js +13 -13
  31. package/dist/api/resources/graph/client/Client.d.ts +30 -0
  32. package/dist/api/resources/graph/client/Client.js +157 -4
  33. package/dist/api/resources/graph/client/requests/EntityTypeRequest.d.ts +16 -0
  34. package/dist/api/resources/graph/client/requests/EntityTypeRequest.js +5 -0
  35. package/dist/api/resources/graph/client/requests/GraphSearchQuery.d.ts +2 -0
  36. package/dist/api/resources/graph/client/requests/index.d.ts +1 -0
  37. package/dist/api/resources/graph/resources/edge/client/Client.js +4 -4
  38. package/dist/api/resources/graph/resources/episode/client/Client.js +5 -5
  39. package/dist/api/resources/graph/resources/node/client/Client.js +3 -3
  40. package/dist/api/resources/group/client/Client.js +6 -6
  41. package/dist/api/resources/index.d.ts +2 -2
  42. package/dist/api/resources/index.js +3 -3
  43. package/dist/api/resources/memory/client/Client.js +22 -22
  44. package/dist/api/resources/user/client/Client.js +8 -8
  45. package/dist/api/types/EntityProperty.d.ts +9 -0
  46. package/dist/api/types/EntityProperty.js +5 -0
  47. package/dist/api/types/EntityPropertyType.d.ts +10 -0
  48. package/dist/api/types/EntityPropertyType.js +12 -0
  49. package/dist/api/types/EntityType.d.ts +9 -0
  50. package/dist/api/types/EntityType.js +5 -0
  51. package/dist/api/types/EntityTypeResponse.d.ts +7 -0
  52. package/dist/api/types/EntityTypeResponse.js +5 -0
  53. package/dist/api/types/index.d.ts +4 -0
  54. package/dist/api/types/index.js +4 -0
  55. package/dist/serialization/resources/graph/client/requests/EntityTypeRequest.d.ts +13 -0
  56. package/dist/serialization/resources/graph/client/requests/EntityTypeRequest.js +44 -0
  57. package/dist/serialization/resources/graph/client/requests/GraphSearchQuery.d.ts +1 -0
  58. package/dist/serialization/resources/graph/client/requests/GraphSearchQuery.js +1 -0
  59. package/dist/serialization/resources/graph/client/requests/index.d.ts +1 -0
  60. package/dist/serialization/resources/graph/client/requests/index.js +3 -1
  61. package/dist/serialization/resources/index.d.ts +1 -1
  62. package/dist/serialization/resources/index.js +1 -1
  63. package/dist/serialization/types/EntityProperty.d.ts +15 -0
  64. package/dist/serialization/types/EntityProperty.js +46 -0
  65. package/dist/serialization/types/EntityPropertyType.d.ts +10 -0
  66. package/dist/serialization/types/EntityPropertyType.js +41 -0
  67. package/dist/serialization/types/EntityType.d.ts +15 -0
  68. package/dist/serialization/types/EntityType.js +46 -0
  69. package/dist/serialization/types/EntityTypeResponse.d.ts +13 -0
  70. package/dist/serialization/types/EntityTypeResponse.js +44 -0
  71. package/dist/serialization/types/index.d.ts +4 -0
  72. package/dist/serialization/types/index.js +4 -0
  73. package/dist/version.d.ts +1 -1
  74. package/dist/version.js +1 -1
  75. package/dist/wrapper/graph.d.ts +6 -0
  76. package/dist/wrapper/graph.js +29 -0
  77. package/dist/wrapper/index.d.ts +2 -0
  78. package/dist/wrapper/index.js +4 -0
  79. package/dist/wrapper/ontology.d.ts +312 -0
  80. package/dist/wrapper/ontology.js +80 -0
  81. package/examples/graph/entity_type_example.ts +40 -0
  82. package/package.json +1 -1
  83. package/reference.md +311 -186
  84. package/serialization/resources/graph/client/requests/EntityTypeRequest.d.ts +13 -0
  85. package/serialization/resources/graph/client/requests/EntityTypeRequest.js +44 -0
  86. package/serialization/resources/graph/client/requests/GraphSearchQuery.d.ts +1 -0
  87. package/serialization/resources/graph/client/requests/GraphSearchQuery.js +1 -0
  88. package/serialization/resources/graph/client/requests/index.d.ts +1 -0
  89. package/serialization/resources/graph/client/requests/index.js +3 -1
  90. package/serialization/resources/index.d.ts +1 -1
  91. package/serialization/resources/index.js +1 -1
  92. package/serialization/types/EntityProperty.d.ts +15 -0
  93. package/serialization/types/EntityProperty.js +46 -0
  94. package/serialization/types/EntityPropertyType.d.ts +10 -0
  95. package/serialization/types/EntityPropertyType.js +41 -0
  96. package/serialization/types/EntityType.d.ts +15 -0
  97. package/serialization/types/EntityType.js +46 -0
  98. package/serialization/types/EntityTypeResponse.d.ts +13 -0
  99. package/serialization/types/EntityTypeResponse.js +44 -0
  100. package/serialization/types/index.d.ts +4 -0
  101. package/serialization/types/index.js +4 -0
  102. package/version.d.ts +1 -1
  103. package/version.js +1 -1
  104. package/wrapper/graph.d.ts +6 -0
  105. package/wrapper/graph.js +29 -0
  106. package/wrapper/index.d.ts +2 -0
  107. package/wrapper/index.js +4 -0
  108. package/wrapper/ontology.d.ts +312 -0
  109. package/wrapper/ontology.js +80 -0
@@ -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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getzep/zep-cloud",
3
- "version": "2.7.0",
3
+ "version": "2.8.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",