Vectors: Fix passing model id to AI Studio

5a6d93fc0311f1a891ee2b453b30566f79225262

Cohee <18619528+Cohee1207@users.noreply.github.com>

2 files changed, +7 -6Showing whitespace changes
src/endpoints/vectors.js+2 -2
@@ -56,7 +56,7 @@ async function getVector(source, sourceSettings, text, isQuery, directories) {
5656 case 'extras':
5757 return getExtrasVector(text, sourceSettings.extrasUrl, sourceSettings.extrasKey);
5858 case 'palm':
5959 return getMakerSuiteVector(text, directories, sourceSettings.model);
6060 case 'cohere':
6161 return getCohereVector(text, isQuery, directories, sourceSettings.model);
6262 case 'llamacpp':
@@ -105,7 +105,7 @@ async function getBatchVector(source, sourceSettings, texts, isQuery, directorie
105105 results.push(...await getExtrasBatchVector(batch, sourceSettings.extrasUrl, sourceSettings.extrasKey));
106106 break;
107107 case 'palm':
108108 results.push(...await getMakerSuiteBatchVector(batch, directories, sourceSettings.model));
109109 break;
110110 case 'cohere':
111111 results.push(...await getCohereBatchVector(batch, isQuery, directories, sourceSettings.model));
src/vectors/makersuite-vectors.js+5 -4
@@ -7,10 +7,11 @@ const API_MAKERSUITE = 'https://generativelanguage.googleapis.com';
77 * Gets the vector for the given text from gecko model
88 * @param {string[]} texts - The array of texts to get the vector for
99 * @param {import('../users.js').UserDirectoryList} directories - The directories object for the user
10+ * @param {string} model - The model to use for embedding
1011 * @returns {Promise<number[][]>} - The array of vectors for the texts
1112 */
1213export async function getMakerSuiteBatchVector(texts, directories, model) {
1314 const promises = texts.map(text => getMakerSuiteVector(text, directories, model));
1415 return await Promise.all(promises);
1516}
1617
@@ -18,9 +19,10 @@ export async function getMakerSuiteBatchVector(texts, directories) {
1819 * Gets the vector for the given text from Gemini API text-embedding-004 model
1920 * @param {string} text - The text to get the vector for
2021 * @param {import('../users.js').UserDirectoryList} directories - The directories object for the user
22+ * @param {string} model - The model to use for embedding (default is 'text-embedding-004')
2123 * @returns {Promise<number[]>} - The vector for the text
2224 */
2325export async function getMakerSuiteVector(text, directories, model) {
2426 const key = readSecret(directories, SECRET_KEYS.MAKERSUITE);
2527
2628 if (!key) {
@@ -29,7 +31,6 @@ export async function getMakerSuiteVector(text, directories) {
2931 }
3032
3133 const apiUrl = trimTrailingSlash(API_MAKERSUITE);
32- const model = 'text-embedding-004';
3334 const url = `${apiUrl}/v1beta/models/${model}:embedContent?key=${key}`;
3435 const body = {
3536 content: {