File tree 1 file changed +4
-4
lines changed
1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -122,10 +122,7 @@ export function defineFirestoreRetriever(
122
122
collection : z . string ( ) . optional ( ) ,
123
123
} ) ,
124
124
} ,
125
- async ( input , options ) => {
126
- // Single embedding for text input
127
- const embedding = await ai . embed ( { embedder, content : input } ) [ 0 ]
128
- . embedding ;
125
+ async ( content , options ) => {
129
126
if ( ! options . collection && ! collection ) {
130
127
throw new Error (
131
128
'Must specify a collection to query in Firestore retriever.'
@@ -137,6 +134,9 @@ export function defineFirestoreRetriever(
137
134
for ( const field in options . where || { } ) {
138
135
query = query . where ( field , '==' , options . where ! [ field ] ) ;
139
136
}
137
+ // Single embedding for text input
138
+ const embeddings = await ai . embed ( { embedder, content } ) ;
139
+ const embedding = embeddings [ 0 ] . embedding ;
140
140
const result = await query
141
141
. findNearest ( vectorField , embedding , {
142
142
limit : options . limit || 10 ,
You can’t perform that action at this time.
0 commit comments