Skip to content

Commit

Permalink
feat(ai-help): switch to text-embedding-3-small model (#459)
Browse files Browse the repository at this point in the history
  • Loading branch information
caugner authored Apr 5, 2024
1 parent 9d2679f commit 9b65676
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/ai/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ pub const AI_HELP_GPT4_FULL_DOC_NEW_PROMPT: AIHelpConfig = AIHelpConfig {
};

pub const MODEL: &str = "gpt-3.5-turbo";
pub const EMBEDDING_MODEL: &str = "text-embedding-ada-002";
pub const EMBEDDING_MODEL: &str = "text-embedding-3-small";

pub const AI_HELP_SYSTEM_MESSAGE: &str = "You are a very enthusiastic MDN AI who loves \
to help people! Given the following information from MDN, answer the user's question \
Expand Down
6 changes: 3 additions & 3 deletions src/ai/embeddings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ const MACRO_DOCS_QUERY: &str = "SELECT
doc.title,
parent.title_short AS title_parent,
doc.markdown AS content,
doc.embedding <=> $1 AS similarity
doc.embedding_next <=> $1 AS similarity
FROM mdn_doc_macro doc
LEFT JOIN mdn_doc_macro parent ON parent.mdn_url = SUBSTRING(doc.mdn_url, 1, LENGTH(doc.mdn_url) - STRPOS(REVERSE(doc.mdn_url), '/'))
WHERE LENGTH(doc.markdown) >= $4
AND (doc.embedding <=> $1) < $2
AND (doc.embedding_next <=> $1) < $2
AND doc.mdn_url NOT LIKE '/en-US/docs/MDN%'
ORDER BY doc.embedding <=> $1
ORDER BY doc.embedding_next <=> $1
LIMIT $3;";

#[derive(sqlx::FromRow, Debug)]
Expand Down

0 comments on commit 9b65676

Please sign in to comment.