Skip to content

The agent engineering platform.

ollama[patch]: delete suffix slash to avoid redirect (#18260)

mackong2c42f3a95556
diff --git a/libs/community/langchain_community/chat_models/ollama.py b/libs/community/langchain_community/chat_models/ollama.py
index a35adcd966..1562a69845 100644
--- a/libs/community/langchain_community/chat_models/ollama.py
+++ b/libs/community/langchain_community/chat_models/ollama.py
@@ -159,7 +159,7 @@ class ChatOllama(BaseChatModel, _OllamaCommon):
"messages": self._convert_messages_to_ollama_messages(messages),
}
yield from self._create_stream(
- payload=payload, stop=stop, api_url=f"{self.base_url}/api/chat/", **kwargs
+ payload=payload, stop=stop, api_url=f"{self.base_url}/api/chat", **kwargs
)
async def _acreate_chat_stream(
@@ -172,7 +172,7 @@ class ChatOllama(BaseChatModel, _OllamaCommon):
"messages": self._convert_messages_to_ollama_messages(messages),
}
async for stream_resp in self._acreate_stream(
- payload=payload, stop=stop, api_url=f"{self.base_url}/api/chat/", **kwargs
+ payload=payload, stop=stop, api_url=f"{self.base_url}/api/chat", **kwargs
):
yield stream_resp