From 95a87291fd821bb02fe1bb0f3e9cb65f3e75e39b Mon Sep 17 00:00:00 2001 From: Erick Friis Date: Tue, 1 Oct 2024 09:18:07 -0700 Subject: [PATCH] community: deprecate community ollama integrations (#26733) --- libs/community/langchain_community/chat_models/ollama.py | 5 +++++ libs/community/langchain_community/embeddings/ollama.py | 6 ++++++ libs/community/langchain_community/llms/ollama.py | 6 ++++++ 3 files changed, 17 insertions(+) diff --git a/libs/community/langchain_community/chat_models/ollama.py b/libs/community/langchain_community/chat_models/ollama.py index 298bfca97f6..0a3788b48d5 100644 --- a/libs/community/langchain_community/chat_models/ollama.py +++ b/libs/community/langchain_community/chat_models/ollama.py @@ -47,6 +47,11 @@ def _chat_stream_response_to_chat_generation_chunk( ) +@deprecated( + since="0.3.1", + removal="1.0.0", + alternative_import="langchain_ollama.ChatOllama", +) class ChatOllama(BaseChatModel, _OllamaCommon): """Ollama locally runs large language models. diff --git a/libs/community/langchain_community/embeddings/ollama.py b/libs/community/langchain_community/embeddings/ollama.py index b55cff9b6fa..ddec6fe39b8 100644 --- a/libs/community/langchain_community/embeddings/ollama.py +++ b/libs/community/langchain_community/embeddings/ollama.py @@ -2,12 +2,18 @@ import logging from typing import Any, Dict, List, Mapping, Optional import requests +from langchain_core._api.deprecation import deprecated from langchain_core.embeddings import Embeddings from pydantic import BaseModel, ConfigDict logger = logging.getLogger(__name__) +@deprecated( + since="0.3.1", + removal="1.0.0", + alternative_import="langchain_ollama.OllamaEmbeddings", +) class OllamaEmbeddings(BaseModel, Embeddings): """Ollama locally runs large language models. diff --git a/libs/community/langchain_community/llms/ollama.py b/libs/community/langchain_community/llms/ollama.py index 580ed68b330..72b6107967d 100644 --- a/libs/community/langchain_community/llms/ollama.py +++ b/libs/community/langchain_community/llms/ollama.py @@ -16,6 +16,7 @@ from typing import ( import aiohttp import requests +from langchain_core._api.deprecation import deprecated from langchain_core.callbacks import ( AsyncCallbackManagerForLLMRun, CallbackManagerForLLMRun, @@ -389,6 +390,11 @@ class _OllamaCommon(BaseLanguageModel): return final_chunk +@deprecated( + since="0.3.1", + removal="1.0.0", + alternative_import="langchain_ollama.OllamaLLM", +) class Ollama(BaseLLM, _OllamaCommon): """Ollama locally runs large language models. To use, follow the instructions at https://ollama.ai/.