Fix failing tests (#3304)

This commit is contained in:
Parshva Daftari
2025-08-13 01:53:54 +05:30
committed by GitHub
parent 2145ffdb1c
commit c89dc72f79
+33 -33
View File
@@ -88,14 +88,16 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from mem0 import Memory\n",
"import os\n",
"import logging\n",
"import sys\n",
"import boto3\n",
"from opensearchpy import OpenSearch, RequestsHttpConnection, AWSV4SignerAuth\n",
"from opensearchpy import RequestsHttpConnection, AWSV4SignerAuth\n",
"from dotenv import load_dotenv\n",
"\n",
"load_dotenv()\n",
@@ -110,9 +112,7 @@
" datefmt=\"%Y-%m-%d %H:%M:%S\",\n",
" stream=sys.stdout, # Explicitly set output to stdout\n",
")"
],
"outputs": [],
"execution_count": null
]
},
{
"cell_type": "markdown",
@@ -126,7 +126,9 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"bedrock_embedder_model = \"amazon.titan-embed-text-v2:0\"\n",
"bedrock_llm_model = \"us.anthropic.claude-3-7-sonnet-20250219-v1:0\"\n",
@@ -176,9 +178,7 @@
" },\n",
" },\n",
"}"
],
"outputs": [],
"execution_count": null
]
},
{
"cell_type": "markdown",
@@ -191,7 +191,9 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"m = Memory.from_config(config_dict=config)\n",
"\n",
@@ -199,9 +201,7 @@
"user_id = \"alice\"\n",
"\n",
"m.delete_all(user_id=user_id)"
],
"outputs": [],
"execution_count": null
]
},
{
"cell_type": "markdown",
@@ -214,7 +214,9 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"messages = [\n",
" {\n",
@@ -232,13 +234,11 @@
"\n",
"for e in all_results[\"relations\"]:\n",
" print(f\"edge \\\"{e['source']}\\\" --{e['relationship']}--> \\\"{e['target']}\\\"\")"
],
"outputs": [],
"execution_count": null
]
},
{
"metadata": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## Graph Explorer Visualization\n",
"\n",
@@ -262,7 +262,9 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"messages = [\n",
" {\n",
@@ -280,13 +282,11 @@
"\n",
"for e in all_results[\"relations\"]:\n",
" print(f\"edge \\\"{e['source']}\\\" --{e['relationship']}--> \\\"{e['target']}\\\"\")"
],
"outputs": [],
"execution_count": null
]
},
{
"metadata": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"### Graph Explorer Visualization Example\n",
"\n",
@@ -304,7 +304,9 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"messages = [\n",
" {\n",
@@ -322,13 +324,11 @@
"\n",
"for e in all_results[\"relations\"]:\n",
" print(f\"edge \\\"{e['source']}\\\" --{e['relationship']}--> \\\"{e['target']}\\\"\")"
],
"outputs": [],
"execution_count": null
]
},
{
"metadata": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"### Graph Explorer Visualization Example\n",
"\n",
@@ -348,7 +348,9 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"messages = [\n",
" {\n",
@@ -366,13 +368,11 @@
"\n",
"for e in all_results[\"relations\"]:\n",
" print(f\"edge \\\"{e['source']}\\\" --{e['relationship']}--> \\\"{e['target']}\\\"\")"
],
"outputs": [],
"execution_count": null
]
},
{
"metadata": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"### Graph Explorer Visualization Example\n",
"\n",
@@ -404,30 +404,30 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"search_results = m.search(\"what does alice love?\", user_id=user_id)\n",
"for result in search_results[\"results\"]:\n",
" print(f\"\\\"{result['memory']}\\\" [score: {result['score']}]\")\n",
"for relation in search_results[\"relations\"]:\n",
" print(f\"{relation}\")"
],
"outputs": [],
"execution_count": null
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"m.delete_all(user_id)\n",
"m.reset()"
],
"outputs": [],
"execution_count": null
]
},
{
"metadata": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## Conclusion\n",
"\n",