@@ -83,22 +83,20 @@ const chat = async (req) => {
83
83
} ) ;
84
84
}
85
85
86
- console . log ( "messageHistory: " , messageHistory ) ;
87
86
88
87
// Embed the last messageHistory message using OpenAI's embeddings API
89
88
const embeddingsResponse = await openaiClient . embeddings . create ( {
90
- model : "text-embedding-ada-002 " ,
89
+ model : "text-embedding-3-small " ,
91
90
input : messageHistory [ messageHistory . length - 1 ] . content ,
92
91
} ) ;
93
92
const embeddings = embeddingsResponse . data [ 0 ] . embedding ;
94
- console . log ( "Embeddings:" , embeddings ) ;
95
93
96
94
// Retrieve records from Supabase based on embeddings similarity
97
95
const { data : relevantRecords , error : recordsError } = await supabase . rpc (
98
96
"match_records_embeddings_similarity" ,
99
97
{
100
98
query_embedding : JSON . stringify ( embeddings ) ,
101
- match_threshold : 0.8 ,
99
+ match_threshold : 0.1 ,
102
100
match_count : 10 ,
103
101
}
104
102
) ;
@@ -107,6 +105,7 @@ const chat = async (req) => {
107
105
console . log ( "recordsError: " , recordsError ) ;
108
106
throw new ApplicationError ( "Error getting records from Supabase" ) ;
109
107
}
108
+ console . log ( "relevantRecords: " , relevantRecords ) ;
110
109
111
110
let messages = [
112
111
{
@@ -120,7 +119,6 @@ const chat = async (req) => {
120
119
} ,
121
120
...messageHistory ,
122
121
] ;
123
- console . log ( "messages: " , messages ) ;
124
122
125
123
try {
126
124
const responseMessage = await generateResponse (
0 commit comments