Add check for "embeddings" module.

This commit is contained in:
Cohee
2024-01-24 16:51:57 +02:00
parent 62170afd03
commit 0ad756c923
2 changed files with 41 additions and 16 deletions

View File

@@ -4,7 +4,7 @@ const fetch = require('node-fetch').default;
* Gets the vector for the given text from SillyTavern-extras
* @param {string[]} texts - The array of texts to get the vectors for
* @param {string} apiUrl - The Extras API URL
* @param {string} - The Extras API key, or empty string if API key not enabled
* @param {string} apiKey - The Extras API key, or empty string if API key not enabled
* @returns {Promise<number[][]>} - The array of vectors for the texts
*/
async function getExtrasBatchVector(texts, apiUrl, apiKey) {
@@ -15,7 +15,7 @@ async function getExtrasBatchVector(texts, apiUrl, apiKey) {
* Gets the vector for the given text from SillyTavern-extras
* @param {string} text - The text to get the vector for
* @param {string} apiUrl - The Extras API URL
* @param {string} - The Extras API key, or empty string if API key not enabled
* @param {string} apiKey - The Extras API key, or empty string if API key not enabled
* @returns {Promise<number[]>} - The vector for the text
*/
async function getExtrasVector(text, apiUrl, apiKey) {
@@ -26,8 +26,8 @@ async function getExtrasVector(text, apiUrl, apiKey) {
* Gets the vector for the given text from SillyTavern-extras
* @param {string|string[]} text - The text or texts to get the vector(s) for
* @param {string} apiUrl - The Extras API URL
* @param {string} - The Extras API key, or empty string if API key not enabled
* @returns {Promise<number[]>|Promise<number[][]>} - The vector for a single text, or the array of vectors for multiple texts
* @param {string} apiKey - The Extras API key, or empty string if API key not enabled *
* @returns {Promise<Array>} - The vector for a single text if input is string, or the array of vectors for multiple texts if input is string[]
*/
async function getExtrasVectorImpl(text, apiUrl, apiKey) {
let url;