Skip to content

The agent engineering platform.

added system prompt and template fields to ollama (#13022)

Govind.S.B902459346834
diff --git a/libs/langchain/langchain/llms/ollama.py b/libs/langchain/langchain/llms/ollama.py
index f065298175..8f5e303510 100644
--- a/libs/langchain/langchain/llms/ollama.py
+++ b/libs/langchain/langchain/llms/ollama.py
@@ -89,6 +89,12 @@ class _OllamaCommon(BaseLanguageModel):
to more diverse text, while a lower value (e.g., 0.5) will
generate more focused and conservative text. (Default: 0.9)"""
+ system: Optional[str] = None
+ """system prompt (overrides what is defined in the Modelfile)"""
+
+ template: Optional[str] = None
+ """full prompt or prompt template (overrides what is defined in the Modelfile)"""
+
@property
def _default_params(self) -> Dict[str, Any]:
"""Get the default parameters for calling Ollama."""
@@ -109,6 +115,8 @@ class _OllamaCommon(BaseLanguageModel):
"top_k": self.top_k,
"top_p": self.top_p,
},
+ "system": self.system,
+ "template": self.template,
}
@property