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