mirror of
https://github.com/Mintplex-Labs/langchain-python.git
synced 2026-07-19 13:26:32 -04:00
added system prompt and template fields to ollama (#13022)
**Description** the ollama api now supports passing system prompt and template directly instead of modifying the model file , but the ollama integration in langchain did not have this change updated . The update just adds these two parameters to it ( there are 2 more parameters that are pending to be updated, I was not sure about their utility wrt to langchain ) Refer : https://github.com/jmorganca/ollama/commit/8713ac23a86e1eaf8b94f93bb0d51d13b0225d87 **Issue** : None Applicable **Dependencies** : None Changed **Twitter handle** : https://twitter.com/violetto96 --------- Co-authored-by: Eugene Yurtsev <eyurtsev@gmail.com>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user