Skip to content

Commit 6a3c29d

Browse files
jlau-icelyingbug
authored andcommitted
fix: correctly extract host from completion_url by handling both v1 and non-v1 endpoints
1 parent 98049ef commit 6a3c29d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

docreader/parser/caption.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,8 @@ def _call_ollama_api(self, image_base64: str) -> Optional[CaptionChatResp]:
238238
"""Call Ollama API for image captioning using base64 encoded image data."""
239239

240240
# Extract host URL by removing the chat completions endpoint
241-
host = self.completion_url.replace("/v1/chat/completions", "")
241+
# Handle both "/v1/chat/completions" and "/chat/completions" patterns
242+
host = self.completion_url.replace("/v1/chat/completions", "").replace("/chat/completions", "")
242243

243244
# Initialize Ollama client with host and timeout
244245
client = ollama.Client(

0 commit comments

Comments
 (0)