langchain.schema.messages.ChatMessage¶
- class langchain.schema.messages.ChatMessage(*, content: str, additional_kwargs: dict = None, role: str)[source]¶
Bases:
BaseMessageA Message that can be assigned an arbitrary speaker (i.e. role).
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- param additional_kwargs: dict [Optional]¶
Any additional information.
- param content: str [Required]¶
The string contents of the message.
- param role: str [Required]¶
The speaker / role of the Message.
- to_json() Union[SerializedConstructor, SerializedNotImplemented]¶
- to_json_not_implemented() SerializedNotImplemented¶
- property lc_attributes: Dict¶
Return a list of attribute names that should be included in the serialized kwargs. These attributes must be accepted by the constructor.
- property lc_namespace: List[str]¶
Return the namespace of the langchain object. eg. [“langchain”, “llms”, “openai”]
- property lc_secrets: Dict[str, str]¶
Return a map of constructor argument names to secret ids. eg. {“openai_api_key”: “OPENAI_API_KEY”}
- property lc_serializable: bool¶
Whether this class is LangChain serializable.
- property type: str¶
Type of the message, used for serialization.