Skip to content

Commit 7be9eb8

Browse files
Merge pull request #82 from makeiteasierapps/adjust-similiarity-settings
changed match threshold to 0.1 and embeddings model to 3-small
2 parents 55aa14c + c5e0ca6 commit 7be9eb8

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

supabase/functions/chat/index.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,22 +83,20 @@ const chat = async (req) => {
8383
});
8484
}
8585

86-
console.log("messageHistory: ", messageHistory);
8786

8887
// Embed the last messageHistory message using OpenAI's embeddings API
8988
const embeddingsResponse = await openaiClient.embeddings.create({
90-
model: "text-embedding-ada-002",
89+
model: "text-embedding-3-small",
9190
input: messageHistory[messageHistory.length - 1].content,
9291
});
9392
const embeddings = embeddingsResponse.data[0].embedding;
94-
console.log("Embeddings:", embeddings);
9593

9694
// Retrieve records from Supabase based on embeddings similarity
9795
const { data: relevantRecords, error: recordsError } = await supabase.rpc(
9896
"match_records_embeddings_similarity",
9997
{
10098
query_embedding: JSON.stringify(embeddings),
101-
match_threshold: 0.8,
99+
match_threshold: 0.1,
102100
match_count: 10,
103101
}
104102
);
@@ -107,6 +105,7 @@ const chat = async (req) => {
107105
console.log("recordsError: ", recordsError);
108106
throw new ApplicationError("Error getting records from Supabase");
109107
}
108+
console.log("relevantRecords: ", relevantRecords);
110109

111110
let messages = [
112111
{
@@ -120,7 +119,6 @@ const chat = async (req) => {
120119
},
121120
...messageHistory,
122121
];
123-
console.log("messages: ", messages);
124122

125123
try {
126124
const responseMessage = await generateResponse(

0 commit comments

Comments
 (0)