Skip to content

Commit

Permalink
perf: 🔄 add retry option to fetch requests
Browse files Browse the repository at this point in the history
  • Loading branch information
pelikhan committed Dec 6, 2024
1 parent 0a6876a commit 985453d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/core/src/ollama.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ async function listModels(
// Fetch the list of models from the remote API
const res = await fetch(cfg.base.replace("/v1", "/api/tags"), {
method: "GET",
retries: 0,
})
if (res.status !== 200) return []
// Parse and format the response into LanguageModelInfo objects
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/openai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ async function listModels(
...getConfigHeaders(cfg),
Accept: "application/json",
},
retries: 0
})
if (res.status !== 200) return []
const { data } = (await res.json()) as {
Expand Down

0 comments on commit 985453d

Please sign in to comment.