From 0621cd920a6461b46778fc5dfc1b02014c494517 Mon Sep 17 00:00:00 2001 From: Gavin Mogan Date: Sun, 16 Feb 2025 09:10:52 -0800 Subject: fix: custom fetch wrapper for ollama inference. Fixes #656 (#1032) * Add configurable fetch timeout for Ollama client * Worker service needs access to the .env file * repair typescript types * Update customFetch.ts * update the config docs --------- Co-authored-by: sbarbett Co-authored-by: Mohamed Bassem --- packages/shared/inference.ts | 2 ++ 1 file changed, 2 insertions(+) (limited to 'packages/shared/inference.ts') diff --git a/packages/shared/inference.ts b/packages/shared/inference.ts index e5ddf5ca..92d9dd94 100644 --- a/packages/shared/inference.ts +++ b/packages/shared/inference.ts @@ -2,6 +2,7 @@ import { Ollama } from "ollama"; import OpenAI from "openai"; import serverConfig from "./config"; +import { customFetch } from "./customFetch"; import logger from "./logger"; export interface InferenceResponse { @@ -153,6 +154,7 @@ class OllamaInferenceClient implements InferenceClient { constructor() { this.ollama = new Ollama({ host: serverConfig.inference.ollamaBaseUrl, + fetch: customFetch, // Use the custom fetch with configurable timeout }); } -- cgit v1.2.3-70-g09d2