mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-10 15:06:18 +00: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 :
8713ac23a8
**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:
parent
f55f67055f
commit
9024593468
@ -89,6 +89,12 @@ class _OllamaCommon(BaseLanguageModel):
|
|||||||
to more diverse text, while a lower value (e.g., 0.5) will
|
to more diverse text, while a lower value (e.g., 0.5) will
|
||||||
generate more focused and conservative text. (Default: 0.9)"""
|
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
|
@property
|
||||||
def _default_params(self) -> Dict[str, Any]:
|
def _default_params(self) -> Dict[str, Any]:
|
||||||
"""Get the default parameters for calling Ollama."""
|
"""Get the default parameters for calling Ollama."""
|
||||||
@ -109,6 +115,8 @@ class _OllamaCommon(BaseLanguageModel):
|
|||||||
"top_k": self.top_k,
|
"top_k": self.top_k,
|
||||||
"top_p": self.top_p,
|
"top_p": self.top_p,
|
||||||
},
|
},
|
||||||
|
"system": self.system,
|
||||||
|
"template": self.template,
|
||||||
}
|
}
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
Loading…
Reference in New Issue
Block a user