File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -122,10 +122,7 @@ export function defineFirestoreRetriever(
122122 collection : z . string ( ) . optional ( ) ,
123123 } ) ,
124124 } ,
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 ) => {
129126 if ( ! options . collection && ! collection ) {
130127 throw new Error (
131128 'Must specify a collection to query in Firestore retriever.'
@@ -137,6 +134,9 @@ export function defineFirestoreRetriever(
137134 for ( const field in options . where || { } ) {
138135 query = query . where ( field , '==' , options . where ! [ field ] ) ;
139136 }
137+ // Single embedding for text input
138+ const embeddings = await ai . embed ( { embedder, content } ) ;
139+ const embedding = embeddings [ 0 ] . embedding ;
140140 const result = await query
141141 . findNearest ( vectorField , embedding , {
142142 limit : options . limit || 10 ,
You can’t perform that action at this time.
0 commit comments