Skip to content

armgit / letta

Public Imported from GitHub
0

Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.

feat: added `persona/human_name` fields to `Preset` (#1134)

Charles Packer1f192be107d5
diff --git a/memgpt/agent.py b/memgpt/agent.py
index 65d15d223..1d8c6aeff 100644
--- a/memgpt/agent.py
+++ b/memgpt/agent.py
@@ -199,8 +199,8 @@ class Agent(object):
init_agent_state = AgentState(
name=name if name else create_random_username(),
user_id=created_by,
- persona=preset.persona,
- human=preset.human,
+ persona=preset.persona_name,
+ human=preset.human_name,
llm_config=llm_config,
embedding_config=embedding_config,
preset=preset.name, # TODO link via preset.id instead of name?
diff --git a/memgpt/cli/cli.py b/memgpt/cli/cli.py
index 577695727..1097f268d 100644
--- a/memgpt/cli/cli.py
+++ b/memgpt/cli/cli.py
@@ -668,8 +668,8 @@ def run(
preset_obj.human = ms.get_human(human, user.id).text
preset_obj.persona = ms.get_persona(persona, user.id).text
- typer.secho(f"-> 🤖 Using persona profile '{preset_obj.persona}'", fg=typer.colors.WHITE)
- typer.secho(f"-> 🧑 Using human profile '{preset_obj.human}'", fg=typer.colors.WHITE)
+ typer.secho(f"-> 🤖 Using persona profile: '{preset_obj.persona_name}'", fg=typer.colors.WHITE)
+ typer.secho(f"-> 🧑 Using human profile: '{preset_obj.human_name}'", fg=typer.colors.WHITE)
memgpt_agent = Agent(
interface=interface(),
diff --git a/memgpt/data_types.py b/memgpt/data_types.py
index 7a2fd59d9..b637f5b1f 100644
--- a/memgpt/data_types.py
+++ b/memgpt/data_types.py
@@ -543,7 +543,9 @@ class Preset(BaseModel):
created_at: datetime = Field(default_factory=datetime.now, description="The unix timestamp of when the preset was created.")
system: str = Field(..., description="The system prompt of the preset.")
persona: str = Field(default=get_persona_text(DEFAULT_PERSONA), description="The persona of the preset.")
+ persona_name: Optional[str] = Field(None, description="The name of the persona of the preset.")
human: str = Field(default=get_human_text(DEFAULT_HUMAN), description="The human of the preset.")
+ human_name: Optional[str] = Field(None, description="The name of the human of the preset.")
functions_schema: List[Dict] = Field(..., description="The functions schema of the preset.")
# functions: List[str] = Field(..., description="The functions of the preset.") # TODO: convert to ID
# sources: List[str] = Field(..., description="The sources of the preset.") # TODO: convert to ID
diff --git a/memgpt/metadata.py b/memgpt/metadata.py
index 50a49870a..c8fc2c41a 100644
--- a/memgpt/metadata.py
+++ b/memgpt/metadata.py
@@ -270,7 +270,9 @@ class PresetModel(Base):
description = Column(String)
system = Column(String)
human = Column(String)
+ human_name = Column(String, nullable=False)
persona = Column(String)
+ persona_name = Column(String, nullable=False)
preset = Column(String)
created_at = Column(DateTime(timezone=True), server_default=func.now())
@@ -288,6 +290,8 @@ class PresetModel(Base):
system=self.system,
human=self.human,
persona=self.persona,
+ human_name=self.human_name,
+ persona_name=self.persona_name,
preset=self.preset,
created_at=self.created_at,
functions_schema=self.functions_schema,
diff --git a/memgpt/presets/presets.py b/memgpt/presets/presets.py
index 5505900a1..6250e6304 100644
--- a/memgpt/presets/presets.py
+++ b/memgpt/presets/presets.py
@@ -52,6 +52,8 @@ def create_preset_from_file(filename: str, name: str, user_id: uuid.UUID, ms: Me
system=gpt_system.get_system_text(preset_system_prompt),
persona=get_persona_text(DEFAULT_PERSONA),
human=get_human_text(DEFAULT_HUMAN),
+ persona_name=DEFAULT_PERSONA,
+ human_name=DEFAULT_HUMAN,
functions_schema=functions_schema,
)
ms.create_preset(preset)
@@ -79,7 +81,9 @@ def add_default_presets(user_id: uuid.UUID, ms: MetadataStore):
name=preset_name,
system=gpt_system.get_system_text(preset_system_prompt),
persona=get_persona_text(DEFAULT_PERSONA),
+ persona_name=DEFAULT_PERSONA,
human=get_human_text(DEFAULT_HUMAN),
+ human_name=DEFAULT_HUMAN,
functions_schema=functions_schema,
)
ms.create_preset(preset)