Vectors: Fix passing model id to AI Studio
| @@ -56,7 +56,7 @@ async function getVector(source, sourceSettings, text, isQuery, directories) { | ||
| 56 | 56 | case 'extras': |
| 57 | 57 | return getExtrasVector(text, sourceSettings.extrasUrl, sourceSettings.extrasKey); |
| 58 | 58 | case 'palm': |
| 59 | 59 | return getMakerSuiteVector(text, directories, sourceSettings.model); |
| 60 | 60 | case 'cohere': |
| 61 | 61 | return getCohereVector(text, isQuery, directories, sourceSettings.model); |
| 62 | 62 | case 'llamacpp': |
| @@ -105,7 +105,7 @@ async function getBatchVector(source, sourceSettings, texts, isQuery, directorie | ||
| 105 | 105 | results.push(...await getExtrasBatchVector(batch, sourceSettings.extrasUrl, sourceSettings.extrasKey)); |
| 106 | 106 | break; |
| 107 | 107 | case 'palm': |
| 108 | 108 | results.push(...await getMakerSuiteBatchVector(batch, directories, sourceSettings.model)); |
| 109 | 109 | break; |
| 110 | 110 | case 'cohere': |
| 111 | 111 | results.push(...await getCohereBatchVector(batch, isQuery, directories, sourceSettings.model)); |
| @@ -7,10 +7,11 @@ const API_MAKERSUITE = 'https://generativelanguage.googleapis.com'; | ||
| 7 | 7 | * Gets the vector for the given text from gecko model |
| 8 | 8 | * @param {string[]} texts - The array of texts to get the vector for |
| 9 | 9 | * @param {import('../users.js').UserDirectoryList} directories - The directories object for the user |
| 10 | + * @param {string} model - The model to use for embedding | |
| 10 | 11 | * @returns {Promise<number[][]>} - The array of vectors for the texts |
| 11 | 12 | */ |
| 12 | 13 | export async function getMakerSuiteBatchVector(texts, directories, model) { |
| 13 | 14 | const promises = texts.map(text => getMakerSuiteVector(text, directories, model)); |
| 14 | 15 | return await Promise.all(promises); |
| 15 | 16 | } |
| 16 | 17 | |
| @@ -18,9 +19,10 @@ export async function getMakerSuiteBatchVector(texts, directories) { | ||
| 18 | 19 | * Gets the vector for the given text from Gemini API text-embedding-004 model |
| 19 | 20 | * @param {string} text - The text to get the vector for |
| 20 | 21 | * @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') | |
| 21 | 23 | * @returns {Promise<number[]>} - The vector for the text |
| 22 | 24 | */ |
| 23 | 25 | export async function getMakerSuiteVector(text, directories, model) { |
| 24 | 26 | const key = readSecret(directories, SECRET_KEYS.MAKERSUITE); |
| 25 | 27 | |
| 26 | 28 | if (!key) { |
| @@ -29,7 +31,6 @@ export async function getMakerSuiteVector(text, directories) { | ||
| 29 | 31 | } |
| 30 | 32 | |
| 31 | 33 | const apiUrl = trimTrailingSlash(API_MAKERSUITE); |
| 32 | - const model = 'text-embedding-004'; | |
| 33 | 34 | const url = `${apiUrl}/v1beta/models/${model}:embedContent?key=${key}`; |
| 34 | 35 | const body = { |
| 35 | 36 | content: { |