MCPcopy Create free account
hub / github.com/AQ-MedAI/MedMemoryBench / delete

Function delete

methods/letta/cli/cli_config.py:197–227  ·  view source on GitHub ↗

Delete a source from the archival memory.

(option: str, name: str)

Source from the content-addressed store, hash-verified

195
196@app.command()
197def delete(option: str, name: str):
198 """Delete a source from the archival memory."""
199 from letta.client.client import create_client
200
201 client = create_client(base_url=os.getenv("MEMGPT_BASE_URL"), token=os.getenv("MEMGPT_API_KEY"))
202 try:
203 # delete from metadata
204 if option == "source":
205 # delete metadata
206 source_id = client.get_source_id(name)
207 assert source_id is not None, f"Source {name} does not exist"
208 client.delete_source(source_id)
209 elif option == "agent":
210 agent_id = client.get_agent_id(name)
211 assert agent_id is not None, f"Agent {name} does not exist"
212 client.delete_agent(agent_id=agent_id)
213 elif option == "human":
214 human_id = client.get_human_id(name)
215 assert human_id is not None, f"Human {name} does not exist"
216 client.delete_human(human_id)
217 elif option == "persona":
218 persona_id = client.get_persona_id(name)
219 assert persona_id is not None, f"Persona {name} does not exist"
220 client.delete_persona(persona_id)
221 else:
222 raise ValueError(f"Option {option} not implemented")
223
224 typer.secho(f"Deleted {option} '{name}'", fg=typer.colors.GREEN)
225
226 except Exception as e:
227 typer.secho(f"Failed to delete {option}'{name}'\n{e}", fg=typer.colors.RED)

Callers 15

_replace_pivot_rowsMethod · 0.50
update_agentMethod · 0.50
delete_by_client_idMethod · 0.50
delete_by_user_idMethod · 0.50
delete_by_client_idMethod · 0.50
delete_by_user_idMethod · 0.50
delete_by_client_idMethod · 0.50
delete_by_user_idMethod · 0.50
delete_by_user_idMethod · 0.50
delete_by_client_idMethod · 0.50
delete_by_user_idMethod · 0.50

Calls 9

create_clientFunction · 0.90
get_source_idMethod · 0.45
delete_sourceMethod · 0.45
get_agent_idMethod · 0.45
delete_agentMethod · 0.45
get_human_idMethod · 0.45
delete_humanMethod · 0.45
get_persona_idMethod · 0.45
delete_personaMethod · 0.45

Tested by

no test coverage detected