♻️ use custom requestOptions with CohereEmbeddingsProvider

This commit is contained in:
Nate Sesti 2024-04-23 22:47:23 -07:00
parent 5a40c7c327
commit 8ccfd2b072

View file

@ -1,4 +1,4 @@
import fetch, { Response } from "node-fetch";
import { Response } from "node-fetch";
import { EmbedOptions } from "../..";
import { withExponentialBackoff } from "../../util/withExponentialBackoff";
import BaseEmbeddingsProvider from "./BaseEmbeddingsProvider";
@ -35,7 +35,7 @@ class CohereEmbeddingsProvider extends BaseEmbeddingsProvider {
batchedChunks.map(async (batch) => {
const fetchWithBackoff = () =>
withExponentialBackoff<Response>(() =>
fetch(new URL("embed", this.options.apiBase), {
this.fetch(new URL("embed", this.options.apiBase), {
method: "POST",
body: JSON.stringify({
texts: batch,