langchain_ollama: Support keep_alive in embeddings (#30251)

- Description: Adds support for keep_alive in Ollama Embeddings see
https://github.com/ollama/ollama/issues/6401.
Builds on top of of
https://github.com/langchain-ai/langchain/pull/29296. I have this use
case where I want to keep the embeddings model in cpu forever.
- Dependencies: no deps are being introduced.
- Issue: haven't created an issue yet.
This commit is contained in:
Stavros Kontopoulos
2025-03-14 20:56:50 +02:00
committed by GitHub
parent 65a8f30729
commit ac22cde130
2 changed files with 12 additions and 5 deletions

View File

@@ -5,4 +5,4 @@ from langchain_ollama.embeddings import OllamaEmbeddings
def test_initialization() -> None:
"""Test embedding model initialization."""
OllamaEmbeddings(model="llama3")
OllamaEmbeddings(model="llama3", keep_alive=1)