garden.engram.searchMemories
Schema Diff
+37 -6
Compatibility Analysis
Backward Compatible
Backward compatible. 2 non-breaking changes.
Non-Breaking Changes (2)
- AddedVertex AddedVertex { vertex_id: "garden.engram.searchMemories:output.mode" }
- AddedEdge AddedEdge { src: "garden.engram.searchMemories:output", tgt: "garden.engram.searchMemories:output.mode", kind: "prop", name: Some("mode") }
Migration Guidance
Added Elements
AddedVertex { vertex_id: "garden.engram.searchMemories:output.mode" }
Additional Notes
- Non-breaking: AddedEdge { src: "garden.engram.searchMemories:output", tgt: "garden.engram.searchMemories:output.mode", kind: "prop", name: Some("mode") }
1
1
{
2
2
"$type": "com.atproto.lexicon.schema",
3
3
"defs": {
4
4
"main": {
5
-
"description": "Vector search over a space's memories. The caller embeds its query with the space's model and query prefix. Requires a space credential for the space, presented with an HTTP message signature whose audience is this service's DID.",
5
+
"description": "Search over a space's memories, by meaning and exact words. The caller embeds its query with the space's model and query prefix and sends vector, model and modelDigest, plus q: once the space has a keyword index, the results rank by both (hybrid). A service that runs the space's model may instead embed q itself when no vector is sent; one that can't (it doesn't embed queries, doesn't run the space's model, or doesn't embed for the space's authority) searches by keyword alone instead, unless mode asks otherwise. The response's mode says what ran. Requires a space credential for the space, presented with an HTTP message signature whose audience is this service's DID.",
6
6
"errors": [
7
7
{
8
8
"description": "This service does not index the space.",
9
9
"name": "UnknownSpace"
10
10
},
11
11
{
12
12
"description": "The space's authority hasn't declared an embedding model.",
13
13
"name": "NoModel"
14
14
},
15
15
{
16
16
"description": "The query's model isn't the space's model. Re-read the space's config.",
17
17
"name": "ModelMismatch"
18
18
},
19
19
{
20
+
"description": "q was sent without a vector, this service doesn't run the space's model, and keyword search couldn't run instead (mode hybrid, or the space has no keyword index yet). Embed the query with the space's model and send the vector.",
21
+
"name": "ModelNotHosted"
22
+
},
23
+
{
24
+
"description": "This service doesn't embed queries for this space's authority, and keyword search couldn't run instead (mode hybrid, or the space has no keyword index yet).",
25
+
"name": "TextSearchNotAllowed"
26
+
},
27
+
{
28
+
"description": "mode keyword, and the space's keyword index is still being built. Search with a vector meanwhile.",
29
+
"name": "KeywordIndexBuilding"
30
+
},
31
+
{
32
+
"description": "Too many queries are being embedded. Retry shortly.",
33
+
"name": "EmbedderBusy"
34
+
},
35
+
{
20
36
"description": "The space's index is loading. Retry shortly.",
21
37
"name": "IndexLoading"
22
38
},
23
39
{
24
40
"description": "Too many searches for this space.",
25
41
"name": "RateLimitExceeded"
26
42
}
27
43
],
28
44
"output": {
29
45
"encoding": "application/json",
30
46
"schema": {
31
47
"properties": {
32
48
"approximate": {
33
49
"description": "Set when the index couldn't re-rank in time, so results are ranked by a coarser comparison and may be less precise.",
34
50
"type": "boolean"
35
51
},
36
52
"memories": {
37
53
"items": {
38
54
"ref": "garden.engram.defs#memoryView",
39
55
"type": "ref"
40
56
},
41
57
"type": "array"
58
+
},
59
+
"mode": {
60
+
"description": "What ran: hybrid, vector (no q, mode vector, or a space whose keyword index is still being built), or keyword (mode keyword, or a fallback when q couldn't be embedded).",
61
+
"knownValues": [
62
+
"hybrid",
63
+
"vector",
64
+
"keyword"
65
+
],
66
+
"type": "string"
42
67
}
43
68
},
44
69
"required": [
45
70
"memories"
46
71
],
47
72
"type": "object"
48
73
}
49
74
},
50
75
"parameters": {
51
76
"properties": {
52
77
"author": {
53
78
"description": "Only memories written by this DID.",
54
79
"format": "did",
55
80
"type": "string"
56
81
},
57
82
"limit": {
58
83
"default": 10,
59
84
"maximum": 50,
60
85
"minimum": 1,
61
86
"type": "integer"
62
87
},
88
+
"mode": {
89
+
"description": "hybrid (the default with q and a vector) ranks by meaning and exact words; vector ignores q for ranking; keyword ranks by q's words alone, needs no vector, and answers KeywordIndexBuilding until the space has a keyword index. An explicit mode never falls back.",
90
+
"knownValues": [
91
+
"hybrid",
92
+
"vector",
93
+
"keyword"
94
+
],
95
+
"type": "string"
96
+
},
63
97
"model": {
64
98
"description": "Must match the space's model.",
65
99
"type": "string"
66
100
},
67
101
"modelDigest": {
68
102
"description": "Must match the space's model digest.",
69
103
"type": "string"
70
104
},
71
105
"q": {
72
-
"description": "The query's text. Optional and not used for ranking yet; kept for keyword search later.",
106
+
"description": "The query's text. With a vector, it makes the search hybrid once the space has a keyword index. Sent alone, a service that embeds queries (at most 1000 characters) embeds it with the space's model and query prefix; otherwise the search is by keyword alone.",
73
107
"maxLength": 4000,
74
108
"type": "string"
75
109
},
76
110
"since": {
77
111
"description": "Only memories created at or after this time.",
78
112
"format": "datetime",
79
113
"type": "string"
80
114
},
81
115
"space": {
82
116
"description": "The space URI.",
83
117
"type": "string"
84
118
},
85
119
"tags": {
86
120
"description": "Only memories carrying every one of these tags.",
87
121
"items": {
88
122
"type": "string"
89
123
},
90
124
"maxLength": 16,
91
125
"type": "array"
92
126
},
93
127
"vector": {
94
128
"description": "The query's vector: little-endian IEEE half precision, base64url-encoded without padding.",
95
129
"maxLength": 43000,
96
130
"type": "string"
97
131
}
98
132
},
99
133
"required": [
100
-
"space",
101
-
"vector",
102
-
"model",
103
-
"modelDigest"
134
+
"space"
104
135
],
105
136
"type": "params"
106
137
},
107
138
"type": "query"
108
139
}
109
140
},
110
141
"id": "garden.engram.searchMemories",
111
142
"lexicon": 1
112
143
}