MCPcopy Create free account

hub / github.com/WujiangXu/A-mem / functions

Functions109 in github.com/WujiangXu/A-mem

↓ 9 callersFunction_extract_section
Extract the text between *marker*: and the next known marker (or end). Args: text: Full LLM response marker: Section header to fi
llm_text_parsers.py:83
↓ 8 callersFunction_parse_list_items
Parse a section of text into a list of items. Handles: - Bullet points (-, *, numbered) - Comma-separated values - One item per
llm_text_parsers.py:46
↓ 8 callersMethodget_completion
(self, prompt: str, response_format: dict, temperature: float = 0.7)
memory_layer.py:43
↓ 8 callersMethodsearch
Search for similar documents using cosine similarity. Args: query: Query text k: Number of results to return
memory_layer.py:588
↓ 7 callersMethodload
Load retriever state from disk
memory_layer.py:447
↓ 6 callersMethodadd_documents
One-time Add documents to both BM25 and semantic index
memory_layer.py:473
↓ 5 callersMethodget_completion
(self, prompt: str, temperature: float = 0.7)
memory_layer_robust.py:188
↓ 5 callersFunctionstrip_markdown_fences
Remove ```json ... ``` or ``` ... ``` fences from LLM output.
llm_text_parsers.py:18
↓ 4 callersMethodadd_note
Add a new memory note
memory_layer.py:714
↓ 3 callersFunction_heuristic_keywords
Extract heuristic keywords from content text.
llm_text_parsers.py:470
↓ 3 callersFunctionload_locomo_dataset
Load the LoComo dataset from a JSON file, including image-based content by using captions. Args: file_path: Path to the JSON fil
load_dataset.py:98
↓ 3 callersFunctionparse_with_json_fallback
Try JSON parsing first; fall back to section-marker parsing. Many models emit valid JSON even without strict mode, so we try that first for b
llm_text_parsers.py:26
↓ 3 callersMethodsave
Save retriever state to disk
memory_layer.py:421
↓ 2 callersFunction_heuristic_context
Extract a heuristic context sentence from content.
llm_text_parsers.py:504
↓ 2 callersFunctionaggregate_metrics
Calculate aggregate statistics for all metrics, split by category.
utils.py:167
↓ 2 callersFunctioncalculate_metrics
Calculate comprehensive evaluation metrics for a prediction.
utils.py:109
↓ 2 callersMethodfind_related_memories
Find related memories using hybrid retrieval
memory_layer.py:859
↓ 2 callersMethodfind_related_memories_raw
Find related memories using hybrid retrieval
memory_layer.py:877
↓ 2 callersMethodload_from_local_memory
Load retriever state from memory
memory_layer.py:466
↓ 2 callersFunctionsimple_tokenize
Simple tokenization function.
utils.py:34
↓ 2 callersFunctionsimple_tokenize
(text)
memory_layer.py:21
↓ 2 callersFunctionvalidate_analysis_result
Validate and repair the analysis result. - If keywords is empty, extract capitalized words / nouns heuristically. - If context is empty, use
llm_text_parsers.py:430
↓ 1 callersMethod_generate_empty_response
(self, response_format: dict)
memory_layer.py:74
↓ 1 callersMethod_generate_empty_response
(self, response_format: dict)
memory_layer.py:123
↓ 1 callersMethod_generate_empty_response
(self, response_format: dict)
memory_layer.py:195
↓ 1 callersMethod_generate_empty_value
(self, schema_type: str, schema_items: dict = None)
memory_layer.py:61
↓ 1 callersMethod_generate_empty_value
(self, schema_type: str, schema_items: dict = None)
memory_layer.py:110
↓ 1 callersMethod_generate_empty_value
(self, schema_type: str, schema_items: dict = None)
memory_layer.py:182
↓ 1 callersFunction_section_parse
(resp: str, content_text: str = "")
llm_text_parsers.py:219
↓ 1 callersMethodadd_memory
(self, content, time=None)
test_advanced.py:57
↓ 1 callersMethodadd_memory
(self, content, time=None)
test_advanced_robust.py:75
↓ 1 callersMethodanalyze_content
Analyze content using plain-text prompt + section-marker parsing.
memory_layer_robust.py:318
↓ 1 callersMethodanalyze_content
Analyze content to extract keywords, context, and other metadata
memory_layer.py:308
↓ 1 callersMethodanswer_question
Generate answer for a question given the conversation context.
test_advanced.py:127
↓ 1 callersMethodanswer_question
Generate answer for a question — plain text, no JSON schema.
test_advanced_robust.py:109
↓ 1 callersFunctioncalculate_bert_scores
Calculate BERTScore for semantic similarity.
utils.py:68
↓ 1 callersFunctioncalculate_bleu_scores
Calculate BLEU scores with different n-gram settings.
utils.py:50
↓ 1 callersFunctioncalculate_meteor_score
Calculate METEOR score for the prediction.
utils.py:85
↓ 1 callersFunctioncalculate_rouge_scores
Calculate ROUGE scores for prediction against reference.
utils.py:40
↓ 1 callersFunctioncalculate_sentence_similarity
Calculate sentence embedding similarity using SentenceBERT.
utils.py:93
↓ 1 callersMethodcheck_connectivity
Send a test call to verify the backend is reachable.
memory_layer_robust.py:83
↓ 1 callersMethodconsolidate_memories
Re-initialize the retriever with current memory state.
memory_layer_robust.py:399
↓ 1 callersMethodconsolidate_memories
Consolidate memories: update retriever with new documents This function re-initializes the retriever and updates it with all memory d
memory_layer.py:729
↓ 1 callersFunctionevaluate_dataset
Evaluate the agent on the LoComo dataset. Args: dataset_path: Path to the dataset file model: Name of the model to use
test_advanced.py:217
↓ 1 callersFunctionevaluate_dataset
Evaluate the robust agent on the LoComo dataset.
test_advanced_robust.py:174
↓ 1 callersMethodfind_related_memories
Find related memories using embedding retrieval.
memory_layer_robust.py:411
↓ 1 callersMethodgenerate_query_llm
(self, question)
test_advanced.py:95
↓ 1 callersMethodgenerate_query_llm
Generate query keywords — plain text, no JSON schema.
test_advanced_robust.py:96
↓ 1 callersMethodget_completion
Get a plain-text completion from the LLM.
memory_layer_robust.py:79
↓ 1 callersFunctionmain
()
test_advanced.py:403
↓ 1 callersFunctionmain
()
test_advanced_robust.py:332
↓ 1 callersFunctionparse_analyze_content
Parse the analyze_content LLM response. Returns: {"keywords": [...], "context": "...", "tags": [...]}
llm_text_parsers.py:213
↓ 1 callersFunctionparse_conversation
Parse conversation data.
load_dataset.py:79
↓ 1 callersFunctionparse_evolution_decision
Parse the evolution decision response. Returns: {"decision": "NO_EVOLUTION|STRENGTHEN|UPDATE_NEIGHBOR|STRENGTHEN_AND_UPDATE", "r
llm_text_parsers.py:237
↓ 1 callersFunctionparse_keywords_response
Parse generate_query_llm response. If JSON with "keywords", extract it. Otherwise return raw text.
llm_text_parsers.py:411
↓ 1 callersFunctionparse_plain_text_answer
Parse a plain-text answer response (for QA evaluation). If the model returned JSON with an "answer" field, extract it. Otherwise return the r
llm_text_parsers.py:380
↓ 1 callersFunctionparse_relevant_parts
Parse retrieve_memory_llm response. If JSON with "relevant_parts", extract it. Otherwise return raw text.
llm_text_parsers.py:396
↓ 1 callersFunctionparse_session
Parse a single session's data, including turns with images by using their captions.
load_dataset.py:59
↓ 1 callersFunctionparse_strengthen_details
Parse the strengthen details response. Returns: {"connections": [int, ...], "tags": [str, ...]}
llm_text_parsers.py:292
↓ 1 callersFunctionparse_update_neighbors
Parse the update neighbors response. Returns: [{"context": "...", "tags": [...]}, ...] — one per neighbor
llm_text_parsers.py:326
↓ 1 callersMethodprocess_memory
Process a memory note for evolution using plain-text LLM calls. Uses up to 3 sequential calls (conditional): 1. Evolution decision
memory_layer_robust.py:463
↓ 1 callersMethodprocess_memory
Process a memory note and return an evolution label
memory_layer.py:753
↓ 1 callersMethodretrieve_memory
(self, content, k=10)
test_advanced.py:60
↓ 1 callersMethodretrieve_memory
(self, content, k=10)
test_advanced_robust.py:78
↓ 1 callersFunctionrun_tests
Run system tests
memory_layer.py:900
↓ 1 callersFunctionsetup_logger
Set up logging configuration.
test_advanced.py:198
↓ 1 callersFunctionsetup_logger
Set up logging configuration.
test_advanced_robust.py:156
Method__init__
(self, model: str = "gpt-4", api_key: Optional[str] = None)
memory_layer_robust.py:98
Method__init__
(self, model: str = "llama2")
memory_layer_robust.py:127
Method__init__
(self, model: str = "llama2", sglang_host: str = "http://localhost", sglang_
memory_layer_robust.py:148
Method__init__
(self, model: str = "llama2", vllm_host: str = "http://localhost", vllm_port
memory_layer_robust.py:179
Method__init__
(self, model: str, api_base: Optional[str] = None, api_key: Optional[str] = None)
memory_layer_robust.py:212
Method__init__
(self, backend: Literal["openai", "ollama", "sglang", "vllm"] = "sglang", mo
memory_layer_robust.py:246
Method__init__
(self, content: str, id: Optional[str] = None, keywords: Op
memory_layer_robust.py:276
Method__init__
(self, model_name: str = 'all-MiniLM-L6-v2', llm_backend: str = "sglang",
memory_layer_robust.py:355
Method__init__
(self, model, backend, retrieve_k, temperature_c5, sglang_host="http://localhost", sglang_port=30000)
test_advanced.py:39
Method__init__
(self, model, backend, retrieve_k, temperature_c5, sglang_host="http://localhost", sglang_por
test_advanced_robust.py:56
Method__init__
(self, model: str = "gpt-4", api_key: Optional[str] = None)
memory_layer.py:31
Method__init__
(self, model: str = "llama2")
memory_layer.py:57
Method__init__
(self, model: str = "llama2", sglang_host: str = "http://localhost", sglang_port: int = 30000)
memory_layer.py:104
Method__init__
(self, model: str, api_base: Optional[str] = None, api_key: Optional[str] = None)
memory_layer.py:177
Method__init__
(self, backend: Literal["openai", "ollama", "sglang"] = "sglang", model: st
memory_layer.py:238
Method__init__
(self, content: str, id: Optional[str] = None, keywords: O
memory_layer.py:263
Method__init__
Initialize the hybrid retriever. Args: model_name: Name of the SentenceTransformer model to use alpha: Weight
memory_layer.py:406
Method__init__
Initialize the simple embedding retriever. Args: model_name: Name of the SentenceTransformer model to use
memory_layer.py:557
Method__init__
(self, model_name: str = 'all-MiniLM-L6-v2', llm_backend: str = "sglang",
memory_layer.py:668
Methodadd_document
Add a single document to the retriever. Args: document: Text content to add Returns: boo
memory_layer.py:492
Methodadd_documents
Add documents to the retriever.
memory_layer.py:568
Methodadd_note
Add a new memory note.
memory_layer_robust.py:377
Functiondecorator
(func)
memory_layer_robust.py:46
Methodfinal_answer
Get the appropriate answer based on category.
load_dataset.py:17
Methodfind_related_memories_raw
Find related memories with neighborhood expansion.
memory_layer_robust.py:430
Methodget_completion
(self, prompt: str, temperature: float = 0.7)
memory_layer_robust.py:111
Methodget_completion
(self, prompt: str, temperature: float = 0.7)
memory_layer_robust.py:131
Methodget_completion
(self, prompt: str, temperature: float = 0.7)
memory_layer_robust.py:157
Methodget_completion
(self, prompt: str, temperature: float = 0.7)
memory_layer_robust.py:221
Methodget_completion
Get completion from LLM
memory_layer.py:26
Methodget_completion
(self, prompt: str, response_format: dict, temperature: float = 0.7)
memory_layer.py:88
Methodget_completion
(self, prompt: str, response_format: dict, temperature: float = 0.7)
memory_layer.py:137
Methodget_completion
(self, prompt: str, response_format: dict, temperature: float = 0.7)
memory_layer.py:209
next →1–100 of 109, ranked by callers