Repository navigation
Expand file tree
/
Copy pathtypes.go
More file actions
294 lines (260 loc) · 11.2 KB
/
Copy pathtypes.go
File metadata and controls
294 lines (260 loc) · 11.2 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
package graphiti
import "time"
// Observation represents Langfuse observation object to link
type Observation struct {
ID string `json:"id"`
TraceID string `json:"trace_id"`
Time time.Time `json:"time"`
}
// Message represents a message in the system
type Message struct {
Content string `json:"content"`
UUID *string `json:"uuid,omitempty"`
Name string `json:"name,omitempty"`
Author string `json:"author"`
Timestamp time.Time `json:"timestamp"`
SourceDescription string `json:"source_description,omitempty"`
}
// Result represents a generic result response
type Result struct {
Message string `json:"message"`
Success bool `json:"success"`
}
// HealthCheckResponse represents the health check response
type HealthCheckResponse struct {
Status string `json:"status"`
}
// SearchQuery represents a search query request
type SearchQuery struct {
GroupIDs *[]string `json:"group_ids,omitempty"`
Query string `json:"query"`
MaxFacts int `json:"max_facts,omitempty"`
Observation *Observation `json:"observation,omitempty"`
}
// FactResult represents a fact result from the graph
type FactResult struct {
UUID string `json:"uuid"`
Name string `json:"name"`
Fact string `json:"fact"`
ValidAt *time.Time `json:"valid_at,omitempty"`
InvalidAt *time.Time `json:"invalid_at,omitempty"`
CreatedAt time.Time `json:"created_at"`
ExpiredAt *time.Time `json:"expired_at,omitempty"`
}
// SearchResults represents the results of a search query
type SearchResults struct {
Facts []FactResult `json:"facts"`
}
// GetMemoryRequest represents a request to get memory
type GetMemoryRequest struct {
GroupID string `json:"group_id"`
MaxFacts int `json:"max_facts,omitempty"`
CenterNodeUUID *string `json:"center_node_uuid"`
Messages []Message `json:"messages"`
Observation *Observation `json:"observation,omitempty"`
}
// GetMemoryResponse represents the response from getting memory
type GetMemoryResponse struct {
Facts []FactResult `json:"facts"`
}
// AddMessagesRequest represents a request to add messages
type AddMessagesRequest struct {
GroupID string `json:"group_id"`
Messages []Message `json:"messages"`
Observation *Observation `json:"observation,omitempty"`
}
// AddEntityNodeRequest represents a request to add an entity node
type AddEntityNodeRequest struct {
UUID string `json:"uuid"`
GroupID string `json:"group_id"`
Name string `json:"name"`
Summary string `json:"summary,omitempty"`
Observation *Observation `json:"observation,omitempty"`
}
// EntityNode represents an entity node in the graph
type EntityNode struct {
UUID string `json:"uuid"`
GroupID string `json:"group_id"`
Name string `json:"name"`
Summary string `json:"summary,omitempty"`
CreatedAt time.Time `json:"created_at"`
Labels []string `json:"labels,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
// Episode represents an episode in the graph
type Episode struct {
UUID string `json:"uuid"`
GroupID string `json:"group_id"`
Name string `json:"name"`
Content string `json:"content"`
Source string `json:"source"`
SourceDescription string `json:"source_description,omitempty"`
CreatedAt time.Time `json:"created_at"`
ValidAt time.Time `json:"valid_at"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
// Advanced Search Types
// NodeResult represents a node result from search
type NodeResult struct {
UUID string `json:"uuid"`
Name string `json:"name"`
Labels []string `json:"labels"`
Summary string `json:"summary"`
CreatedAt time.Time `json:"created_at"`
Attributes map[string]interface{} `json:"attributes,omitempty"`
}
// EdgeResult represents an edge result from search
type EdgeResult struct {
UUID string `json:"uuid"`
Name string `json:"name"`
Fact string `json:"fact"`
SourceNodeUUID string `json:"source_node_uuid"`
TargetNodeUUID string `json:"target_node_uuid"`
ValidAt *time.Time `json:"valid_at,omitempty"`
InvalidAt *time.Time `json:"invalid_at,omitempty"`
CreatedAt time.Time `json:"created_at"`
ExpiredAt *time.Time `json:"expired_at,omitempty"`
}
// EpisodeResult represents an episode result from search
type EpisodeResult struct {
UUID string `json:"uuid"`
Content string `json:"content"`
Source string `json:"source"`
SourceDescription string `json:"source_description"`
CreatedAt time.Time `json:"created_at"`
ValidAt time.Time `json:"valid_at"`
}
// CommunityResult represents a community result from search
type CommunityResult struct {
UUID string `json:"uuid"`
Name string `json:"name"`
Summary string `json:"summary"`
CreatedAt time.Time `json:"created_at"`
}
// TimeWindow represents a time window
type TimeWindow struct {
Start time.Time `json:"start"`
End time.Time `json:"end"`
}
// TemporalSearchRequest represents a temporal window search request
type TemporalSearchRequest struct {
Query string `json:"query"`
GroupID *string `json:"group_id,omitempty"`
TimeStart time.Time `json:"time_start"`
TimeEnd time.Time `json:"time_end"`
MaxResults int `json:"max_results,omitempty"`
Observation *Observation `json:"observation,omitempty"`
}
// TemporalSearchResponse represents a temporal window search response
type TemporalSearchResponse struct {
Edges []EdgeResult `json:"edges"`
EdgeScores []float64 `json:"edge_scores"`
Nodes []NodeResult `json:"nodes"`
NodeScores []float64 `json:"node_scores"`
Episodes []EpisodeResult `json:"episodes"`
EpisodeScores []float64 `json:"episode_scores"`
TimeWindow TimeWindow `json:"time_window"`
}
// EntityRelationshipSearchRequest represents an entity relationships search request
type EntityRelationshipSearchRequest struct {
Query string `json:"query"`
GroupID *string `json:"group_id,omitempty"`
CenterNodeUUID string `json:"center_node_uuid"`
MaxDepth int `json:"max_depth,omitempty"`
NodeLabels *[]string `json:"node_labels,omitempty"`
EdgeTypes *[]string `json:"edge_types,omitempty"`
MaxResults int `json:"max_results,omitempty"`
Observation *Observation `json:"observation,omitempty"`
}
// EntityRelationshipSearchResponse represents an entity relationships search response
type EntityRelationshipSearchResponse struct {
Edges []EdgeResult `json:"edges"`
EdgeDistances []float64 `json:"edge_distances"`
Nodes []NodeResult `json:"nodes"`
NodeDistances []float64 `json:"node_distances"`
CenterNode *NodeResult `json:"center_node,omitempty"`
}
// DiverseSearchRequest represents a diverse results search request
type DiverseSearchRequest struct {
Query string `json:"query"`
GroupID *string `json:"group_id,omitempty"`
DiversityLevel string `json:"diversity_level,omitempty"`
MaxResults int `json:"max_results,omitempty"`
Observation *Observation `json:"observation,omitempty"`
}
// DiverseSearchResponse represents a diverse results search response
type DiverseSearchResponse struct {
Edges []EdgeResult `json:"edges"`
EdgeMMRScores []float64 `json:"edge_mmr_scores"`
Nodes []NodeResult `json:"nodes"`
NodeMMRScores []float64 `json:"node_mmr_scores"`
Episodes []EpisodeResult `json:"episodes"`
EpisodeScores []float64 `json:"episode_scores"`
Communities []CommunityResult `json:"communities"`
CommunityMMRScores []float64 `json:"community_mmr_scores"`
}
// EpisodeContextSearchRequest represents an episode context search request
type EpisodeContextSearchRequest struct {
Query string `json:"query"`
GroupID *string `json:"group_id,omitempty"`
MaxResults int `json:"max_results,omitempty"`
Observation *Observation `json:"observation,omitempty"`
}
// EpisodeContextSearchResponse represents an episode context search response
type EpisodeContextSearchResponse struct {
Episodes []EpisodeResult `json:"episodes"`
RerankerScores []float64 `json:"reranker_scores"`
MentionedNodes []NodeResult `json:"mentioned_nodes"`
MentionedNodeScores []float64 `json:"mentioned_node_scores"`
}
// SuccessfulToolsSearchRequest represents a successful tools search request
type SuccessfulToolsSearchRequest struct {
Query string `json:"query"`
GroupID *string `json:"group_id,omitempty"`
MinMentions int `json:"min_mentions,omitempty"`
MaxResults int `json:"max_results,omitempty"`
Observation *Observation `json:"observation,omitempty"`
}
// SuccessfulToolsSearchResponse represents a successful tools search response
type SuccessfulToolsSearchResponse struct {
Edges []EdgeResult `json:"edges"`
EdgeMentionCounts []float64 `json:"edge_mention_counts"`
Nodes []NodeResult `json:"nodes"`
NodeMentionCounts []float64 `json:"node_mention_counts"`
Episodes []EpisodeResult `json:"episodes"`
EpisodeScores []float64 `json:"episode_scores"`
}
// RecentContextSearchRequest represents a recent context search request
type RecentContextSearchRequest struct {
Query string `json:"query"`
GroupID *string `json:"group_id,omitempty"`
RecencyWindow string `json:"recency_window,omitempty"`
MaxResults int `json:"max_results,omitempty"`
Observation *Observation `json:"observation,omitempty"`
}
// RecentContextSearchResponse represents a recent context search response
type RecentContextSearchResponse struct {
Edges []EdgeResult `json:"edges"`
EdgeScores []float64 `json:"edge_scores"`
Nodes []NodeResult `json:"nodes"`
NodeScores []float64 `json:"node_scores"`
Episodes []EpisodeResult `json:"episodes"`
EpisodeScores []float64 `json:"episode_scores"`
TimeWindow TimeWindow `json:"time_window"`
}
// EntityByLabelSearchRequest represents an entity by label search request
type EntityByLabelSearchRequest struct {
Query string `json:"query"`
GroupID *string `json:"group_id,omitempty"`
NodeLabels []string `json:"node_labels"`
EdgeTypes *[]string `json:"edge_types,omitempty"`
MaxResults int `json:"max_results,omitempty"`
Observation *Observation `json:"observation,omitempty"`
}
// EntityByLabelSearchResponse represents an entity by label search response
type EntityByLabelSearchResponse struct {
Nodes []NodeResult `json:"nodes"`
NodeScores []float64 `json:"node_scores"`
Edges []EdgeResult `json:"edges"`
EdgeScores []float64 `json:"edge_scores"`
}