Returns
a chat prompt template
classmethod from_orm(obj: Any) → Model¶
classmethod from_role_strings(string_messages: List[Tuple[str, str]]) → ChatPromptTemplate[source]¶
Create a chat prompt template from a list of (role, template) tuples.
Parameters
string_messages – list of (role, template) tuples.
Returns
a chat prompt template
classmethod from_strings(string_messages: List[Tuple[Type[BaseMessagePromptTemplate], str]]) → ChatPromptTemplate[source]¶
Create a chat prompt template from a list of (role class, template) tuples.
Parameters
string_messages – list of (role class, template) tuples.
Returns
a chat prompt template
classmethod from_template(template: str, **kwargs: Any) → ChatPromptTemplate[source]¶
Create a chat prompt template from a template string.
Creates a chat template consisting of a single message assumed to be from
the human.
Parameters
template – template string
**kwargs – keyword arguments to pass to the constructor.
Returns
A new instance of this class.
invoke(input: Dict, config: langchain.schema.runnable.RunnableConfig | None = None) → PromptValue¶
json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, encoder: Optional[Callable[[Any], Any]] = None, models_as_dict: bool = True, **dumps_kwargs: Any) → unicode¶
Generate a JSON representation of the model, include and exclude arguments as per dict().
encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps().