Update OllamaEmbeddingsProvider.ts (#1839)

This commit is contained in:
Patrick Erichsen 2024-07-26 08:43:24 -07:00 • committed by GitHub
parent 6611d8a6e7
commit 7cb15acfe2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -10,7 +10,13 @@ async function embedOne(
customFetch: FetchFunction,
) {
const embedding = await withExponentialBackoff<number[]>(async () => {
const resp = await customFetch(new URL("api/embeddings", options.apiBase), {
let apiBase = options.apiBase!;
if (!apiBase.endsWith("/")) {
apiBase += "/";
}
const resp = await customFetch(new URL("api/embeddings", apiBase), {
method: "POST",
body: JSON.stringify({
model: options.model,