async embedChunks(textChunks = []) {
    if (!(await this.#isAlive()))
      throw new Error(
        `Ollama service could not be reached. Is Ollama running?`
      );
    this.log(
      `Embedding ${textChunks.length} chunks of text with ${this.model}.`
    );

    let data = [];
    let error = null;

    for (const chunk of textChunks) {
      try {
        const res = await this.client.embeddings({
          model: this.model,
          prompt: chunk,
          options: {
            // Always set the num_ctx to the max chunk length defined by the user in the settings
            // so that the maximum context window is used and content is not truncated.
            num_ctx: this.embeddingMaxChunkLength,
          },
        });

        const { embedding } = res;
        if (!Array.isArray(embedding) || embedding.length === 0)
          throw new Error("Ollama returned an empty embedding for chunk!");

        data.push(embedding);
      } catch (err) {
        this.log(err.message);
        error = err.message;
        data = [];
        break;
      }
    }

    if (!!error) throw new Error(`Ollama Failed to embed: ${error}`);
    return data.length > 0 ? data : null;
  }
This function takes an array of text chunks and embeds them using the Ollama API.
chunks are processed sequentially to avoid overwhelming the API with too many requests
or running out of resources on the endpoint running the ollama instance.

We will use the num_ctx option to set the maximum context window to the max chunk length defined by the user in the settings
so that the maximum context window is used and content is not truncated.

We also assume the default keep alive option. This could cause issues with models being unloaded and reloaded
on load memory machines, but that is simply a user-end issue we cannot control. If the LLM and embedder are
constantly being loaded and unloaded, the user should use another LLM or Embedder to avoid this issue.
@param {string[]} textChunks - An array of text chunks to embed.
@returns {Promise<Array<number[]>>} - A promise that resolves to an array of embeddings.