langchain.memory.buffer.ConversationStringBufferMemory¶
- class langchain.memory.buffer.ConversationStringBufferMemory(*, human_prefix: str = 'Human', ai_prefix: str = 'AI', buffer: str = '', output_key: Optional[str] = None, input_key: Optional[str] = None, memory_key: str = 'history')[source]¶
Bases:
BaseMemoryBuffer for storing conversation memory.
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 ai_prefix: str = 'AI'¶
Prefix to use for AI generated responses.
- param buffer: str = ''¶
- param human_prefix: str = 'Human'¶
- param input_key: Optional[str] = None¶
- param output_key: Optional[str] = None¶
- save_context(inputs: Dict[str, Any], outputs: Dict[str, str]) None[source]¶
Save context from this conversation to buffer.
- 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¶
Return whether or not the class is serializable.
- property memory_variables: List[str]¶
Will always return list of memory variables. :meta private: