sst 3.0.1-12 → 3.0.1-16
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.
- package/dist/vector-client.d.ts +51 -11
- package/dist/vector-client.js +2 -2
- package/package.json +2 -1
package/dist/vector-client.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ export type IngestEvent = {
|
|
|
35
35
|
* }
|
|
36
36
|
* ```
|
|
37
37
|
*/
|
|
38
|
-
metadata: any
|
|
38
|
+
metadata: Record<string, any>;
|
|
39
39
|
};
|
|
40
40
|
export type RetrieveEvent = {
|
|
41
41
|
/**
|
|
@@ -66,9 +66,9 @@ export type RetrieveEvent = {
|
|
|
66
66
|
* @example
|
|
67
67
|
* ```js
|
|
68
68
|
* {
|
|
69
|
-
*
|
|
69
|
+
* include: {
|
|
70
70
|
* type: "movie",
|
|
71
|
-
*
|
|
71
|
+
* release: "2001",
|
|
72
72
|
* }
|
|
73
73
|
* }
|
|
74
74
|
* ```
|
|
@@ -83,10 +83,39 @@ export type RetrieveEvent = {
|
|
|
83
83
|
* {
|
|
84
84
|
* type: "book",
|
|
85
85
|
* name: "Spiderman",
|
|
86
|
-
* release: "
|
|
86
|
+
* release: "2001",
|
|
87
|
+
* }
|
|
88
|
+
*/
|
|
89
|
+
include: Record<string, any>;
|
|
90
|
+
/**
|
|
91
|
+
* Exclude embeddings with metadata that match the provided fields.
|
|
92
|
+
* @example
|
|
93
|
+
* ```js
|
|
94
|
+
* {
|
|
95
|
+
* include: {
|
|
96
|
+
* type: "movie",
|
|
97
|
+
* release: "2001",
|
|
98
|
+
* },
|
|
99
|
+
* exclude: {
|
|
100
|
+
* name: "Spiderman",
|
|
101
|
+
* }
|
|
102
|
+
* }
|
|
103
|
+
* ```
|
|
104
|
+
* This will match the embedding with metadata:
|
|
105
|
+
* {
|
|
106
|
+
* type: "movie",
|
|
107
|
+
* name: "A Beautiful Mind",
|
|
108
|
+
* release: "2001",
|
|
109
|
+
* }
|
|
110
|
+
*
|
|
111
|
+
* But not the embedding with metadata:
|
|
112
|
+
* {
|
|
113
|
+
* type: "book",
|
|
114
|
+
* name: "Spiderman",
|
|
115
|
+
* release: "2001",
|
|
87
116
|
* }
|
|
88
117
|
*/
|
|
89
|
-
|
|
118
|
+
exclude?: Record<string, any>;
|
|
90
119
|
/**
|
|
91
120
|
* The threshold of similarity between the prompt and the retrieved embeddings.
|
|
92
121
|
* Only embeddings with a similarity score higher than the threshold will be returned.
|
|
@@ -122,22 +151,33 @@ export type RemoveEvent = {
|
|
|
122
151
|
* To remove embeddings for movie with id "movie-123":
|
|
123
152
|
* ```js
|
|
124
153
|
* {
|
|
125
|
-
*
|
|
154
|
+
* include: {
|
|
126
155
|
* id: "movie-123",
|
|
127
156
|
* }
|
|
128
157
|
* }
|
|
129
158
|
* ```
|
|
130
159
|
* To remove embeddings for all movies:
|
|
131
160
|
* {
|
|
132
|
-
*
|
|
161
|
+
* include: {
|
|
133
162
|
* type: "movie",
|
|
134
163
|
* }
|
|
135
164
|
* }
|
|
136
165
|
*/
|
|
137
|
-
|
|
166
|
+
include: Record<string, any>;
|
|
167
|
+
};
|
|
168
|
+
type RetriveResponse = {
|
|
169
|
+
/**
|
|
170
|
+
* Metadata for the event in JSON format that was provided when ingesting the embedding.
|
|
171
|
+
*/
|
|
172
|
+
metadata: Record<string, any>;
|
|
173
|
+
/**
|
|
174
|
+
* The similarity score between the prompt and the retrieved embedding.
|
|
175
|
+
*/
|
|
176
|
+
score: number;
|
|
138
177
|
};
|
|
139
178
|
export declare const VectorClient: (name: string) => {
|
|
140
|
-
ingest: (event: IngestEvent) => Promise<
|
|
141
|
-
retrieve: (event: RetrieveEvent) => Promise<
|
|
142
|
-
remove: (event: RemoveEvent) => Promise<
|
|
179
|
+
ingest: (event: IngestEvent) => Promise<void>;
|
|
180
|
+
retrieve: (event: RetrieveEvent) => Promise<RetriveResponse>;
|
|
181
|
+
remove: (event: RemoveEvent) => Promise<void>;
|
|
143
182
|
};
|
|
183
|
+
export {};
|
package/dist/vector-client.js
CHANGED
|
@@ -8,7 +8,7 @@ export const VectorClient = (name) => {
|
|
|
8
8
|
FunctionName: Resource[name].ingestorFunctionName,
|
|
9
9
|
Payload: JSON.stringify(event),
|
|
10
10
|
}));
|
|
11
|
-
|
|
11
|
+
parsePayload(ret, "Failed to ingest into the vector db");
|
|
12
12
|
},
|
|
13
13
|
retrieve: async (event) => {
|
|
14
14
|
const ret = await lambda.send(new InvokeCommand({
|
|
@@ -22,7 +22,7 @@ export const VectorClient = (name) => {
|
|
|
22
22
|
FunctionName: Resource[name].removerFunctionName,
|
|
23
23
|
Payload: JSON.stringify(event),
|
|
24
24
|
}));
|
|
25
|
-
|
|
25
|
+
parsePayload(ret, "Failed to remove from the vector db");
|
|
26
26
|
},
|
|
27
27
|
};
|
|
28
28
|
};
|
package/package.json
CHANGED