id
stringlengths
14
15
text
stringlengths
49
2.47k
source
stringlengths
61
166
0b5c55164a55-2
Return a full header of the agent’s status, summary, and current time. get_summary(force_refresh: bool = False, now: Optional[datetime] = None) → str[source]¶ Return a descriptive summary of the agent. json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntSt...
https://api.python.langchain.com/en/latest/generative_agents/langchain_experimental.generative_agents.generative_agent.GenerativeAgent.html
0b5c55164a55-3
classmethod update_forward_refs(**localns: Any) → None¶ Try to update ForwardRefs on fields based on this Model, globalns and localns. classmethod validate(value: Any) → Model¶
https://api.python.langchain.com/en/latest/generative_agents/langchain_experimental.generative_agents.generative_agent.GenerativeAgent.html
8e75f318102f-0
langchain_experimental.generative_agents.memory.GenerativeAgentMemory¶ class langchain_experimental.generative_agents.memory.GenerativeAgentMemory[source]¶ Bases: BaseMemory Memory for the generative agent. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the inp...
https://api.python.langchain.com/en/latest/generative_agents/langchain_experimental.generative_agents.memory.GenerativeAgentMemory.html
8e75f318102f-1
Add an observations or memories to the agent’s memory. add_memory(memory_content: str, now: Optional[datetime] = None) → List[str][source]¶ Add an observation or memory to the agent’s memory. chain(prompt: PromptTemplate) → LLMChain[source]¶ clear() → None[source]¶ Clear memory contents. classmethod construct(_fields_s...
https://api.python.langchain.com/en/latest/generative_agents/langchain_experimental.generative_agents.memory.GenerativeAgentMemory.html
8e75f318102f-2
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. fetch_memories(observation: str, now: Optional[datetime] = None) → List[Document][source]¶ Fetch related memories. format_memories_detail(relevant_memories: List[Document]) → str[source]¶ format_memories_simple(...
https://api.python.langchain.com/en/latest/generative_agents/langchain_experimental.generative_agents.memory.GenerativeAgentMemory.html
8e75f318102f-3
Reflect on recent observations and generate ‘insights’. save_context(inputs: Dict[str, Any], outputs: Dict[str, Any]) → None[source]¶ Save the context of this model run to memory. classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶ classmethod schema_json(*, by_alias...
https://api.python.langchain.com/en/latest/generative_agents/langchain_experimental.generative_agents.memory.GenerativeAgentMemory.html
20b596aa5161-0
langchain.utils.utils.guard_import¶ langchain.utils.utils.guard_import(module_name: str, *, pip_name: Optional[str] = None, package: Optional[str] = None) → Any[source]¶ Dynamically imports a module and raises a helpful exception if the module is not installed.
https://api.python.langchain.com/en/latest/utils/langchain.utils.utils.guard_import.html
7165189d5b71-0
langchain.utils.strings.stringify_value¶ langchain.utils.strings.stringify_value(val: Any) → str[source]¶ Stringify a value. Parameters val – The value to stringify. Returns The stringified value. Return type str
https://api.python.langchain.com/en/latest/utils/langchain.utils.strings.stringify_value.html
82ebf17b45d6-0
langchain.utils.math.cosine_similarity¶ langchain.utils.math.cosine_similarity(X: Union[List[List[float]], List[ndarray], ndarray], Y: Union[List[List[float]], List[ndarray], ndarray]) → ndarray[source]¶ Row-wise cosine similarity between two equal-width matrices.
https://api.python.langchain.com/en/latest/utils/langchain.utils.math.cosine_similarity.html
96ba6bcf9ee0-0
langchain.utils.input.get_bolded_text¶ langchain.utils.input.get_bolded_text(text: str) → str[source]¶ Get bolded text.
https://api.python.langchain.com/en/latest/utils/langchain.utils.input.get_bolded_text.html
4017cbe5104b-0
langchain.utils.formatting.StrictFormatter¶ class langchain.utils.formatting.StrictFormatter[source]¶ A subclass of formatter that checks for extra keys. Methods __init__() check_unused_args(used_args, args, kwargs) Check to see if extra parameters are passed. convert_field(value, conversion) format(format_string, /, *...
https://api.python.langchain.com/en/latest/utils/langchain.utils.formatting.StrictFormatter.html
6c0d1403a505-0
langchain.utils.input.get_color_mapping¶ langchain.utils.input.get_color_mapping(items: List[str], excluded_colors: Optional[List] = None) → Dict[str, str][source]¶ Get mapping for items to a support color.
https://api.python.langchain.com/en/latest/utils/langchain.utils.input.get_color_mapping.html
8618c562a532-0
langchain.utils.utils.check_package_version¶ langchain.utils.utils.check_package_version(package: str, lt_version: Optional[str] = None, lte_version: Optional[str] = None, gt_version: Optional[str] = None, gte_version: Optional[str] = None) → None[source]¶ Check the version of a package.
https://api.python.langchain.com/en/latest/utils/langchain.utils.utils.check_package_version.html
81e403e302f3-0
langchain.utils.utils.get_pydantic_field_names¶ langchain.utils.utils.get_pydantic_field_names(pydantic_cls: Any) → Set[str][source]¶ Get field names, including aliases, for a pydantic class. Parameters pydantic_cls – Pydantic class.
https://api.python.langchain.com/en/latest/utils/langchain.utils.utils.get_pydantic_field_names.html
f3ce42742a9d-0
langchain.utils.input.get_colored_text¶ langchain.utils.input.get_colored_text(text: str, color: str) → str[source]¶ Get colored text.
https://api.python.langchain.com/en/latest/utils/langchain.utils.input.get_colored_text.html
5e121653c77f-0
langchain.utils.math.cosine_similarity_top_k¶ langchain.utils.math.cosine_similarity_top_k(X: Union[List[List[float]], List[ndarray], ndarray], Y: Union[List[List[float]], List[ndarray], ndarray], top_k: Optional[int] = 5, score_threshold: Optional[float] = None) → Tuple[List[Tuple[int, int]], List[float]][source]¶ Row...
https://api.python.langchain.com/en/latest/utils/langchain.utils.math.cosine_similarity_top_k.html
b977c0643605-0
langchain.utils.utils.xor_args¶ langchain.utils.utils.xor_args(*arg_groups: Tuple[str, ...]) → Callable[source]¶ Validate specified keyword args are mutually exclusive.
https://api.python.langchain.com/en/latest/utils/langchain.utils.utils.xor_args.html
76c55d11e1a5-0
langchain.utils.utils.raise_for_status_with_text¶ langchain.utils.utils.raise_for_status_with_text(response: Response) → None[source]¶ Raise an error with the response text.
https://api.python.langchain.com/en/latest/utils/langchain.utils.utils.raise_for_status_with_text.html
752c37d6c6ba-0
langchain.utils.strings.comma_list¶ langchain.utils.strings.comma_list(items: List[Any]) → str[source]¶ Convert a list to a comma-separated string.
https://api.python.langchain.com/en/latest/utils/langchain.utils.strings.comma_list.html
907b0c6afc34-0
langchain.utils.input.print_text¶ langchain.utils.input.print_text(text: str, color: Optional[str] = None, end: str = '', file: Optional[TextIO] = None) → None[source]¶ Print text with highlighting and no end characters.
https://api.python.langchain.com/en/latest/utils/langchain.utils.input.print_text.html
845e65141467-0
langchain.utils.utils.mock_now¶ langchain.utils.utils.mock_now(dt_value)[source]¶ Context manager for mocking out datetime.now() in unit tests. Example: with mock_now(datetime.datetime(2011, 2, 3, 10, 11)): assert datetime.datetime.now() == datetime.datetime(2011, 2, 3, 10, 11)
https://api.python.langchain.com/en/latest/utils/langchain.utils.utils.mock_now.html
ffc666bfaf31-0
langchain.utils.env.get_from_env¶ langchain.utils.env.get_from_env(key: str, env_key: str, default: Optional[str] = None) → str[source]¶ Get a value from a dictionary or an environment variable.
https://api.python.langchain.com/en/latest/utils/langchain.utils.env.get_from_env.html
f279f557f9be-0
langchain.utils.strings.stringify_dict¶ langchain.utils.strings.stringify_dict(data: dict) → str[source]¶ Stringify a dictionary. Parameters data – The dictionary to stringify. Returns The stringified dictionary. Return type str
https://api.python.langchain.com/en/latest/utils/langchain.utils.strings.stringify_dict.html
8b3358bd391d-0
langchain.utils.env.get_from_dict_or_env¶ langchain.utils.env.get_from_dict_or_env(data: Dict[str, Any], key: str, env_key: str, default: Optional[str] = None) → str[source]¶ Get a value from a dictionary or an environment variable.
https://api.python.langchain.com/en/latest/utils/langchain.utils.env.get_from_dict_or_env.html
e6f13a7b3c05-0
langchain.utils.utils.build_extra_kwargs¶ langchain.utils.utils.build_extra_kwargs(extra_kwargs: Dict[str, Any], values: Dict[str, Any], all_required_field_names: Set[str]) → Dict[str, Any][source]¶
https://api.python.langchain.com/en/latest/utils/langchain.utils.utils.build_extra_kwargs.html
5d50cc1fd707-0
langchain.memory.buffer_window.ConversationBufferWindowMemory¶ class langchain.memory.buffer_window.ConversationBufferWindowMemory[source]¶ Bases: BaseChatMemory Buffer for storing conversation memory inside a limited size window. Create a new model by parsing and validating input data from keyword arguments. Raises Va...
https://api.python.langchain.com/en/latest/memory/langchain.memory.buffer_window.ConversationBufferWindowMemory.html
5d50cc1fd707-1
deep – set to True to make a deep copy of the model Returns new model instance dict(*, 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, ex...
https://api.python.langchain.com/en/latest/memory/langchain.memory.buffer_window.ConversationBufferWindowMemory.html
5d50cc1fd707-2
classmethod parse_obj(obj: Any) → Model¶ classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ save_context(inputs: Dict[str, Any], outputs: Dict[str, str]) → None¶ Save context from this conversation to buff...
https://api.python.langchain.com/en/latest/memory/langchain.memory.buffer_window.ConversationBufferWindowMemory.html
86c8affee6a7-0
langchain.memory.readonly.ReadOnlySharedMemory¶ class langchain.memory.readonly.ReadOnlySharedMemory[source]¶ Bases: BaseMemory A memory wrapper that is read-only and cannot be changed. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the input data cannot be par...
https://api.python.langchain.com/en/latest/memory/langchain.memory.readonly.ReadOnlySharedMemory.html
86c8affee6a7-1
deep – set to True to make a deep copy of the model Returns new model instance dict(*, 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, ex...
https://api.python.langchain.com/en/latest/memory/langchain.memory.readonly.ReadOnlySharedMemory.html
86c8affee6a7-2
classmethod parse_obj(obj: Any) → Model¶ classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ save_context(inputs: Dict[str, Any], outputs: Dict[str, str]) → None[source]¶ Nothing should be saved or changed ...
https://api.python.langchain.com/en/latest/memory/langchain.memory.readonly.ReadOnlySharedMemory.html
8831fc51c425-0
langchain.memory.vectorstore.VectorStoreRetrieverMemory¶ class langchain.memory.vectorstore.VectorStoreRetrieverMemory[source]¶ Bases: BaseMemory VectorStoreRetriever-backed memory. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the input data cannot be parsed ...
https://api.python.langchain.com/en/latest/memory/langchain.memory.vectorstore.VectorStoreRetrieverMemory.html
8831fc51c425-1
exclude – fields to exclude from new model, as with values this takes precedence over include update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data deep – set to True to make a deep copy of the model Returns new model instance dict(*, i...
https://api.python.langchain.com/en/latest/memory/langchain.memory.vectorstore.VectorStoreRetrieverMemory.html
8831fc51c425-2
Return history buffer. classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ classmethod parse_obj(obj: Any) → Model¶ classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: ...
https://api.python.langchain.com/en/latest/memory/langchain.memory.vectorstore.VectorStoreRetrieverMemory.html
8831fc51c425-3
property lc_serializable: bool¶ Return whether or not the class is serializable. property memory_variables: List[str]¶ The list of keys emitted from the load_memory_variables method.
https://api.python.langchain.com/en/latest/memory/langchain.memory.vectorstore.VectorStoreRetrieverMemory.html
600f4089ac57-0
langchain.memory.chat_message_histories.dynamodb.DynamoDBChatMessageHistory¶ class langchain.memory.chat_message_histories.dynamodb.DynamoDBChatMessageHistory(table_name: str, session_id: str, endpoint_url: Optional[str] = None)[source]¶ Chat message history that stores history in AWS DynamoDB. This class expects that ...
https://api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.dynamodb.DynamoDBChatMessageHistory.html
600f4089ac57-1
Parameters message – The string contents of a human message. clear() → None[source]¶ Clear session memory from DynamoDB Examples using DynamoDBChatMessageHistory¶ Dynamodb Chat Message History
https://api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.dynamodb.DynamoDBChatMessageHistory.html
6bf3718c37b7-0
langchain.memory.entity.ConversationEntityMemory¶ class langchain.memory.entity.ConversationEntityMemory[source]¶ Bases: BaseChatMemory Entity extractor & summarizer memory. Extracts named entities from the recent chat history and generates summaries. With a swappable entity store, persisting entities across conversati...
https://api.python.langchain.com/en/latest/memory/langchain.memory.entity.ConversationEntityMemory.html
6bf3718c37b7-1
param entity_extraction_prompt: langchain.schema.prompt_template.BasePromptTemplate = PromptTemplate(input_variables=['history', 'input'], output_parser=None, partial_variables={}, template='You are an AI assistant reading the transcript of a conversation between an AI and a human. Extract all of the proper nouns from ...
https://api.python.langchain.com/en/latest/memory/langchain.memory.entity.ConversationEntityMemory.html
6bf3718c37b7-2
line:\nPerson #1: i\'m trying to improve Langchain\'s interfaces, the UX, its integrations with various products the user might want ... a lot of stuff. I\'m working with Person #2.\nOutput: Langchain, Person #2\nEND OF EXAMPLE\n\nConversation history (for reference only):\n{history}\nLast line of conversation (for ext...
https://api.python.langchain.com/en/latest/memory/langchain.memory.entity.ConversationEntityMemory.html
6bf3718c37b7-3
param entity_store: langchain.memory.entity.BaseEntityStore [Optional]¶ param entity_summarization_prompt: langchain.schema.prompt_template.BasePromptTemplate = PromptTemplate(input_variables=['entity', 'summary', 'history', 'input'], output_parser=None, partial_variables={}, template='You are an AI assistant helping a...
https://api.python.langchain.com/en/latest/memory/langchain.memory.entity.ConversationEntityMemory.html
6bf3718c37b7-4
Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny...
https://api.python.langchain.com/en/latest/memory/langchain.memory.entity.ConversationEntityMemory.html
6bf3718c37b7-5
classmethod from_orm(obj: Any) → Model¶ 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_n...
https://api.python.langchain.com/en/latest/memory/langchain.memory.entity.ConversationEntityMemory.html
6bf3718c37b7-6
Generates a summary for each entity in the entity cache by prompting the model, and saves these summaries to the entity store. classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶ classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions...
https://api.python.langchain.com/en/latest/memory/langchain.memory.entity.ConversationEntityMemory.html
c62138de87e6-0
langchain.memory.zep_memory.ZepMemory¶ class langchain.memory.zep_memory.ZepMemory[source]¶ Bases: ConversationBufferMemory Persist your chain history to the Zep Memory Server. The number of messages returned by Zep and when the Zep server summarizes chat histories is configurable. See the Zep documentation for more de...
https://api.python.langchain.com/en/latest/memory/langchain.memory.zep_memory.ZepMemory.html
c62138de87e6-1
“http://localhost:8000”. api_key (Optional[str], optional) – Your Zep API key. Defaults to None. output_key (Optional[str], optional) – The key to use for the output message. Defaults to None. input_key (Optional[str], optional) – The key to use for the input message. Defaults to None. return_messages (bool, optional) ...
https://api.python.langchain.com/en/latest/memory/langchain.memory.zep_memory.ZepMemory.html
c62138de87e6-2
Behaves as if Config.extra = ‘allow’ was set since it adds all passed values copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) → Model¶ Duplicate a model, optionally...
https://api.python.langchain.com/en/latest/memory/langchain.memory.zep_memory.ZepMemory.html
c62138de87e6-3
classmethod from_orm(obj: Any) → Model¶ 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_n...
https://api.python.langchain.com/en/latest/memory/langchain.memory.zep_memory.ZepMemory.html
c62138de87e6-4
the context. Defaults to None Returns None classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶ classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶ to_json() → Union[SerializedConstructor, ...
https://api.python.langchain.com/en/latest/memory/langchain.memory.zep_memory.ZepMemory.html
97b72f3fb690-0
langchain.memory.chat_message_histories.cassandra.CassandraChatMessageHistory¶ class langchain.memory.chat_message_histories.cassandra.CassandraChatMessageHistory(session_id: str, session: Session, keyspace: str, table_name: str = 'message_store', ttl_seconds: int | None = None)[source]¶ Chat message history that store...
https://api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.cassandra.CassandraChatMessageHistory.html
97b72f3fb690-1
message – The string contents of a human message. clear() → None[source]¶ Clear session memory from DB Examples using CassandraChatMessageHistory¶ Cassandra Chat Message History Cassandra
https://api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.cassandra.CassandraChatMessageHistory.html
5d44800831eb-0
langchain.memory.chat_message_histories.cosmos_db.CosmosDBChatMessageHistory¶ class langchain.memory.chat_message_histories.cosmos_db.CosmosDBChatMessageHistory(cosmos_endpoint: str, cosmos_database: str, cosmos_container: str, session_id: str, user_id: str, credential: Any = None, connection_string: Optional[str] = No...
https://api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.cosmos_db.CosmosDBChatMessageHistory.html
5d44800831eb-1
Convenience method for adding a human message string to the store. clear() Clear session memory from this memory and cosmos. load_messages() Retrieve the messages from Cosmos prepare_cosmos() Prepare the CosmosDB client. upsert_messages() Update the cosmosdb item. __init__(cosmos_endpoint: str, cosmos_database: str, co...
https://api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.cosmos_db.CosmosDBChatMessageHistory.html
5d44800831eb-2
Convenience method for adding a human message string to the store. Parameters message – The string contents of a human message. clear() → None[source]¶ Clear session memory from this memory and cosmos. load_messages() → None[source]¶ Retrieve the messages from Cosmos prepare_cosmos() → None[source]¶ Prepare the CosmosD...
https://api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.cosmos_db.CosmosDBChatMessageHistory.html
219aa3602a27-0
langchain.memory.buffer.ConversationStringBufferMemory¶ class langchain.memory.buffer.ConversationStringBufferMemory[source]¶ Bases: BaseMemory Buffer 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 parse...
https://api.python.langchain.com/en/latest/memory/langchain.memory.buffer.ConversationStringBufferMemory.html
219aa3602a27-1
deep – set to True to make a deep copy of the model Returns new model instance dict(*, 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, ex...
https://api.python.langchain.com/en/latest/memory/langchain.memory.buffer.ConversationStringBufferMemory.html
219aa3602a27-2
classmethod parse_obj(obj: Any) → Model¶ classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ save_context(inputs: Dict[str, Any], outputs: Dict[str, str]) → None[source]¶ Save context from this conversation...
https://api.python.langchain.com/en/latest/memory/langchain.memory.buffer.ConversationStringBufferMemory.html
c9559bce2e68-0
langchain.memory.combined.CombinedMemory¶ class langchain.memory.combined.CombinedMemory[source]¶ Bases: BaseMemory Combining multiple memories’ data together. 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....
https://api.python.langchain.com/en/latest/memory/langchain.memory.combined.CombinedMemory.html
c9559bce2e68-1
deep – set to True to make a deep copy of the model Returns new model instance dict(*, 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, ex...
https://api.python.langchain.com/en/latest/memory/langchain.memory.combined.CombinedMemory.html
c9559bce2e68-2
classmethod parse_obj(obj: Any) → Model¶ classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ save_context(inputs: Dict[str, Any], outputs: Dict[str, str]) → None[source]¶ Save context from this session for ...
https://api.python.langchain.com/en/latest/memory/langchain.memory.combined.CombinedMemory.html
3c89e856bbf0-0
langchain.memory.chat_message_histories.sql.SQLChatMessageHistory¶ class langchain.memory.chat_message_histories.sql.SQLChatMessageHistory(session_id: str, connection_string: str, table_name: str = 'message_store')[source]¶ Chat message history stored in an SQL database. Attributes messages Retrieve all messages from d...
https://api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.sql.SQLChatMessageHistory.html
b382a115e67d-0
langchain.memory.entity.InMemoryEntityStore¶ class langchain.memory.entity.InMemoryEntityStore[source]¶ Bases: BaseEntityStore In-memory Entity store. 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 st...
https://api.python.langchain.com/en/latest/memory/langchain.memory.entity.InMemoryEntityStore.html
b382a115e67d-1
delete(key: str) → None[source]¶ Delete entity value from store. dict(*, 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...
https://api.python.langchain.com/en/latest/memory/langchain.memory.entity.InMemoryEntityStore.html
b382a115e67d-2
classmethod parse_obj(obj: Any) → Model¶ classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶ classmet...
https://api.python.langchain.com/en/latest/memory/langchain.memory.entity.InMemoryEntityStore.html
9b935016dcfe-0
langchain.memory.entity.RedisEntityStore¶ class langchain.memory.entity.RedisEntityStore[source]¶ Bases: BaseEntityStore Redis-backed Entity store. Entities get a TTL of 1 day by default, and that TTL is extended by 3 days every time the entity is read back. Create a new model by parsing and validating input data from ...
https://api.python.langchain.com/en/latest/memory/langchain.memory.entity.RedisEntityStore.html
9b935016dcfe-1
deep – set to True to make a deep copy of the model Returns new model instance delete(key: str) → None[source]¶ Delete entity value from store. dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip...
https://api.python.langchain.com/en/latest/memory/langchain.memory.entity.RedisEntityStore.html
9b935016dcfe-2
classmethod parse_obj(obj: Any) → Model¶ classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶ classmet...
https://api.python.langchain.com/en/latest/memory/langchain.memory.entity.RedisEntityStore.html
98e1871013ea-0
langchain.memory.chat_message_histories.momento.MomentoChatMessageHistory¶ class langchain.memory.chat_message_histories.momento.MomentoChatMessageHistory(session_id: str, cache_client: momento.CacheClient, cache_name: str, *, key_prefix: str = 'message_store:', ttl: Optional[timedelta] = None, ensure_cache_exists: boo...
https://api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.momento.MomentoChatMessageHistory.html
98e1871013ea-1
add_message(message) Store a message in the cache. add_user_message(message) Convenience method for adding a human message string to the store. clear() Remove the session's messages from the cache. from_client_params(session_id, cache_name, ...) Construct cache from CacheClient parameters. __init__(session_id: str, cac...
https://api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.momento.MomentoChatMessageHistory.html
98e1871013ea-2
Store a message in the cache. Parameters message (BaseMessage) – The message object to store. Raises SdkException – Momento service or network error. Exception – Unexpected response. add_user_message(message: str) → None¶ Convenience method for adding a human message string to the store. Parameters message – The string...
https://api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.momento.MomentoChatMessageHistory.html
0bb83e5d25de-0
langchain.memory.chat_message_histories.rocksetdb.RocksetChatMessageHistory¶ class langchain.memory.chat_message_histories.rocksetdb.RocksetChatMessageHistory(session_id: str, client: ~typing.Any, collection: str, workspace: str = 'commons', messages_key: str = 'messages', sync: bool = False, message_uuid_method: ~typi...
https://api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.rocksetdb.RocksetChatMessageHistory.html
0bb83e5d25de-1
If set, all messages will have an id field within the additional_kwargs property. If this param is not set and sync is False, message IDs will not be created. If this param is not set and sync is True, the uuid.uuid4 method will be used to create message IDs. Attributes ADD_TIMEOUT_MS CREATE_TIMEOUT_MS SLEEP_INTERVAL_M...
https://api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.rocksetdb.RocksetChatMessageHistory.html
0bb83e5d25de-2
to False. NOTE: setting this to True will slow down performance. message_uuid_method (-) – The method that generates message IDs. If set, all messages will have an id field within the additional_kwargs property. If this param is not set and sync is False, message IDs will not be created. If this param is not set and sy...
https://api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.rocksetdb.RocksetChatMessageHistory.html
6838872f5b18-0
langchain.memory.token_buffer.ConversationTokenBufferMemory¶ class langchain.memory.token_buffer.ConversationTokenBufferMemory[source]¶ Bases: BaseChatMemory Conversation chat memory with token limit. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the input dat...
https://api.python.langchain.com/en/latest/memory/langchain.memory.token_buffer.ConversationTokenBufferMemory.html
6838872f5b18-1
the new model: you should trust this data deep – set to True to make a deep copy of the model Returns new model instance dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[boo...
https://api.python.langchain.com/en/latest/memory/langchain.memory.token_buffer.ConversationTokenBufferMemory.html
6838872f5b18-2
classmethod parse_obj(obj: Any) → Model¶ classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ save_context(inputs: Dict[str, Any], outputs: Dict[str, str]) → None[source]¶ Save context from this conversation...
https://api.python.langchain.com/en/latest/memory/langchain.memory.token_buffer.ConversationTokenBufferMemory.html
538db85c38af-0
langchain.memory.chat_message_histories.postgres.PostgresChatMessageHistory¶ class langchain.memory.chat_message_histories.postgres.PostgresChatMessageHistory(session_id: str, connection_string: str = 'postgresql://postgres:mypassword@localhost/chat_history', table_name: str = 'message_store')[source]¶ Chat message his...
https://api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.postgres.PostgresChatMessageHistory.html
68226e211433-0
langchain.memory.buffer.ConversationBufferMemory¶ class langchain.memory.buffer.ConversationBufferMemory[source]¶ Bases: BaseChatMemory Buffer 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 for...
https://api.python.langchain.com/en/latest/memory/langchain.memory.buffer.ConversationBufferMemory.html
68226e211433-1
deep – set to True to make a deep copy of the model Returns new model instance dict(*, 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, ex...
https://api.python.langchain.com/en/latest/memory/langchain.memory.buffer.ConversationBufferMemory.html
68226e211433-2
classmethod parse_obj(obj: Any) → Model¶ classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ save_context(inputs: Dict[str, Any], outputs: Dict[str, str]) → None¶ Save context from this conversation to buff...
https://api.python.langchain.com/en/latest/memory/langchain.memory.buffer.ConversationBufferMemory.html
68226e211433-3
Bedrock QA over Documents Structure answers with OpenAI functions Agent Debates with Tools Adding Message Memory backed by a database to an Agent How to add memory to a Multi-Input Chain How to add Memory to an LLMChain How to use multiple memory classes in the same chain How to customize conversational memory How to a...
https://api.python.langchain.com/en/latest/memory/langchain.memory.buffer.ConversationBufferMemory.html
b93dde8ae89c-0
langchain.memory.utils.get_prompt_input_key¶ langchain.memory.utils.get_prompt_input_key(inputs: Dict[str, Any], memory_variables: List[str]) → str[source]¶ Get the prompt input key. Parameters inputs – Dict[str, Any] memory_variables – List[str] Returns A prompt input key.
https://api.python.langchain.com/en/latest/memory/langchain.memory.utils.get_prompt_input_key.html
2f09108b2269-0
langchain.memory.chat_message_histories.firestore.FirestoreChatMessageHistory¶ class langchain.memory.chat_message_histories.firestore.FirestoreChatMessageHistory(collection_name: str, session_id: str, user_id: str, firestore_client: Optional[Client] = None)[source]¶ Chat message history backed by Google Firestore. Ini...
https://api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.firestore.FirestoreChatMessageHistory.html
2f09108b2269-1
Add a Message object to the store. Parameters message – A BaseMessage object to store. add_user_message(message: str) → None¶ Convenience method for adding a human message string to the store. Parameters message – The string contents of a human message. clear() → None[source]¶ Clear session memory from this memory and ...
https://api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.firestore.FirestoreChatMessageHistory.html
63fa2f7992ef-0
langchain.memory.entity.SQLiteEntityStore¶ class langchain.memory.entity.SQLiteEntityStore[source]¶ Bases: BaseEntityStore SQLite-backed Entity store 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 ses...
https://api.python.langchain.com/en/latest/memory/langchain.memory.entity.SQLiteEntityStore.html
63fa2f7992ef-1
delete(key: str) → None[source]¶ Delete entity value from store. dict(*, 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...
https://api.python.langchain.com/en/latest/memory/langchain.memory.entity.SQLiteEntityStore.html
63fa2f7992ef-2
classmethod parse_obj(obj: Any) → Model¶ classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶ classmet...
https://api.python.langchain.com/en/latest/memory/langchain.memory.entity.SQLiteEntityStore.html
4f679dd73139-0
langchain.memory.summary.SummarizerMixin¶ class langchain.memory.summary.SummarizerMixin[source]¶ Bases: BaseModel Mixin for summarizer. 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 =...
https://api.python.langchain.com/en/latest/memory/langchain.memory.summary.SummarizerMixin.html
4f679dd73139-1
Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny...
https://api.python.langchain.com/en/latest/memory/langchain.memory.summary.SummarizerMixin.html
4f679dd73139-2
classmethod from_orm(obj: Any) → Model¶ 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_n...
https://api.python.langchain.com/en/latest/memory/langchain.memory.summary.SummarizerMixin.html
08865e1789ce-0
langchain.memory.chat_message_histories.zep.ZepChatMessageHistory¶ class langchain.memory.chat_message_histories.zep.ZepChatMessageHistory(session_id: str, url: str = 'http://localhost:8000', api_key: Optional[str] = None)[source]¶ Chat message history that uses Zep as a backend. Recommended usage: # Set up Zep Chat Hi...
https://api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.zep.ZepChatMessageHistory.html
08865e1789ce-1
Append the message to the Zep memory history add_user_message(message[, metadata]) Convenience method for adding a human message string to the store. clear() Clear session memory from Zep. search(query[, metadata, limit]) Search Zep memory for messages matching the query __init__(session_id: str, url: str = 'http://loc...
https://api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.zep.ZepChatMessageHistory.html
151707fd9008-0
langchain.memory.chat_message_histories.in_memory.ChatMessageHistory¶ class langchain.memory.chat_message_histories.in_memory.ChatMessageHistory[source]¶ Bases: BaseChatMessageHistory, BaseModel In memory implementation of chat message history. Stores messages in an in memory list. Create a new model by parsing and val...
https://api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.in_memory.ChatMessageHistory.html
151707fd9008-1
Parameters include – fields to include in new model exclude – fields to exclude from new model, as with values this takes precedence over include update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data deep – set to True to make a deep co...
https://api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.in_memory.ChatMessageHistory.html
151707fd9008-2
classmethod parse_obj(obj: Any) → Model¶ classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶ classmet...
https://api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.in_memory.ChatMessageHistory.html
116b556ba24e-0
langchain.memory.summary_buffer.ConversationSummaryBufferMemory¶ class langchain.memory.summary_buffer.ConversationSummaryBufferMemory[source]¶ Bases: BaseChatMemory, SummarizerMixin Buffer with summarizer for storing conversation memory. Create a new model by parsing and validating input data from keyword arguments. R...
https://api.python.langchain.com/en/latest/memory/langchain.memory.summary_buffer.ConversationSummaryBufferMemory.html
116b556ba24e-1
param return_messages: bool = False¶ param summary_message_cls: Type[BaseMessage] = <class 'langchain.schema.messages.SystemMessage'>¶ clear() → None[source]¶ Clear memory contents. classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model¶ Creates a new model setting __dict__ and __fields_set_...
https://api.python.langchain.com/en/latest/memory/langchain.memory.summary_buffer.ConversationSummaryBufferMemory.html
116b556ba24e-2
classmethod from_orm(obj: Any) → Model¶ 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_n...
https://api.python.langchain.com/en/latest/memory/langchain.memory.summary_buffer.ConversationSummaryBufferMemory.html
116b556ba24e-3
classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶ to_json() → Union[SerializedConstructor, SerializedNotImplemented]¶ to_json_not_implemented() → SerializedNotImplemented¶ classmethod update_forward_refs(**localns: Any) → None¶ Try to upda...
https://api.python.langchain.com/en/latest/memory/langchain.memory.summary_buffer.ConversationSummaryBufferMemory.html
044b462b7714-0
langchain.memory.summary.ConversationSummaryMemory¶ class langchain.memory.summary.ConversationSummaryMemory[source]¶ Bases: BaseChatMemory, SummarizerMixin Conversation summarizer to chat memory. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the input data ca...
https://api.python.langchain.com/en/latest/memory/langchain.memory.summary.ConversationSummaryMemory.html