update experimental (#8402)

some changes were made to experimental, porting them over
This commit is contained in:
Harrison Chase
2023-07-28 13:01:36 -07:00
committed by GitHub
parent af7e70d4af
commit 3a78450883
13 changed files with 58 additions and 22 deletions

View File

@@ -11,11 +11,10 @@ from langchain_experimental.generative_agents.memory import GenerativeAgentMemor
class GenerativeAgent(BaseModel):
"""A character with memory and innate characteristics."""
"""An Agent as a character with memory and innate characteristics."""
name: str
"""The character's name."""
age: Optional[int] = None
"""The optional age of the character."""
traits: str = "N/A"
@@ -29,13 +28,10 @@ class GenerativeAgent(BaseModel):
verbose: bool = False
summary: str = "" #: :meta private:
"""Stateful self-summary generated via reflection on the character's memory."""
summary_refresh_seconds: int = 3600 #: :meta private:
"""How frequently to re-generate the summary."""
last_refreshed: datetime = Field(default_factory=datetime.now) # : :meta private:
"""The last time the character's summary was regenerated."""
daily_summaries: List[str] = Field(default_factory=list) # : :meta private:
"""Summary of the events in the plan that the agent took."""

View File

@@ -14,24 +14,21 @@ logger = logging.getLogger(__name__)
class GenerativeAgentMemory(BaseMemory):
"""Memory for the generative agent."""
llm: BaseLanguageModel
"""The core language model."""
memory_retriever: TimeWeightedVectorStoreRetriever
"""The retriever to fetch related memories."""
verbose: bool = False
reflection_threshold: Optional[float] = None
"""When aggregate_importance exceeds reflection_threshold, stop to reflect."""
current_plan: List[str] = []
"""The current plan of the agent."""
# A weight of 0.15 makes this less important than it
# would be otherwise, relative to salience and time
importance_weight: float = 0.15
"""How much weight to assign the memory importance."""
aggregate_importance: float = 0.0 # : :meta private:
"""Track the sum of the 'importance' of recent memories.