-
Notifications
You must be signed in to change notification settings - Fork 655
Expand file tree
/
Copy pathdefault_ontology.py
More file actions
139 lines (95 loc) · 3.95 KB
/
Copy pathdefault_ontology.py
File metadata and controls
139 lines (95 loc) · 3.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
from pydantic import BaseModel, Field
class User(BaseModel):
"""A Zep user specified by role in chat messages. There can only be a single User entity."""
user_id: str | None = Field(..., description="user_id of the Zep user.")
role_type: str = Field(..., description="The role assigned to the actor.")
email: str = Field(
...,
description="The user's email address, used for communication and login purposes.",
)
first_name: str | None = Field(..., description="The user's first name.")
last_name: str | None = Field(..., description="The user's last name.")
class Assistant(BaseModel):
"""Represents the AI assistant in the conversation. This entity is a singleton. All entities of the AI Assistant type represent the same entity."""
assistant_name: str | None = Field(..., description="The name of the assistant")
class Preference(BaseModel):
"""
IMPORTANT: Prioritize this classification over ALL other classifications except User and Assistant.
Represents entities mentioned in contexts expressing user preferences, choices, opinions, or selections. Use LOW THRESHOLD for sensitivity.
Trigger patterns: "I want/like/prefer/choose X", "I don't want/dislike/avoid/reject Y", "X is better/worse", "rather have X than Y", "no X please", "skip X", "go with X instead", etc. Here, X or Y should be classified as Preference.
"""
...
class Location(BaseModel):
"""
IMPORTANT: Before using this classification, first check if the entity is a:
User, Assistant, Preference, Organization, Document, Event - if so, use those instead.
Represents a physical or virtual place where activities occur or entities exist.
Examples: home, office, New York, restaurant, website, virtual meeting room.
"""
...
class Event(BaseModel):
"""
Represents a time-bound activity, occurrence, or experience.
Examples: meeting, vacation, appointment, project, celebration, accident.
"""
...
class Object(BaseModel):
"""
IMPORTANT: Use this classification ONLY as a last resort. First check if entity fits into:
User, Assistant, Preference, Organization, Document, Event, Location, Topic - if so, use those instead.
Represents a physical item, tool, device, or possession.
Examples: car, phone, book, medication, equipment, furniture.
"""
...
class Topic(BaseModel):
"""
IMPORTANT: Use this classification ONLY as a last resort. First check if entity fits into:
User, Assistant, Preference, Organization, Document, Event, Location - if so, use those instead.
Represents a subject of conversation, interest, or knowledge domain.
Examples: health, technology, sports, politics, work projects, hobbies.
"""
...
class Organization(BaseModel):
"""
Represents a company, institution, group, or formal entity.
Examples: employer, school, hospital, government agency, club, team.
"""
...
class Document(BaseModel):
"""
Represents information content in various forms.
Examples: book, article, report, email, video, podcast, presentation.
"""
...
# =============================================================================
# CUSTOM EDGE TYPES
# =============================================================================
class LocatedAt(BaseModel):
"""
Represents that an entity exists or occurs at a specific location.
"""
...
class OccurredAt(BaseModel):
"""
Represents that an event happened at a specific time or location.
"""
...
ZEP_NODE_ONTOLOGY = {
"User": User,
"Assistant": Assistant,
"Preference": Preference,
"Location": Location,
"Event": Event,
"Object": Object,
"Topic": Topic,
"Organization": Organization,
"Document": Document,
}
ZEP_EDGE_ONTOLOGY = {
"LOCATED_AT": LocatedAt,
"OCCURRED_AT": OccurredAt,
}
ZEP_EDGE_TYPE_MAP = {
("Event", "Entity"): ["OCCURRED_AT"],
("Entity", "Location"): ["LOCATED_AT"],
}