langchain.memory.motorhead_memory.MotorheadMemory

class langchain.memory.motorhead_memory.MotorheadMemory(*, chat_memory: BaseChatMessageHistory = None, output_key: Optional[str] = None, input_key: Optional[str] = None, return_messages: bool = False, url: str = 'https://api.getmetal.io/v1/motorhead', session_id: str, context: Optional[str] = None, api_key: Optional[str] = None, client_id: Optional[str] = None, timeout: int = 3000, memory_key: str = 'history')[source]

Bases: BaseChatMemory

Chat message memory backed by Motorhead service.

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 api_key: Optional[str] = None
param chat_memory: BaseChatMessageHistory [Optional]
param client_id: Optional[str] = None
param context: Optional[str] = None
param input_key: Optional[str] = None
param output_key: Optional[str] = None
param return_messages: bool = False
param session_id: str [Required]
param url: str = 'https://api.getmetal.io/v1/motorhead'
clear() None

Clear memory contents.

delete_session() None[source]

Delete a session

async init() None[source]
load_memory_variables(values: Dict[str, Any]) Dict[str, Any][source]

Return key-value pairs given the text input to the chain.

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]

The string keys this memory class will add to chain inputs.

model Config

Bases: object

Configuration for this pydantic object.

arbitrary_types_allowed = True

Examples using MotorheadMemory