Skip to content

Commit ac478dc

Browse files
committed
Notebook formatting
1 parent d88c170 commit ac478dc

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

libs/langchain-mongodb/examples/GraphRAG.ipynb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
"metadata": {},
9898
"outputs": [],
9999
"source": [
100-
"CONNECTION_STRING = os.environ.get(\"MONGODB_URI\", \"\")\n",
100+
"CONNECTION_STRING = os.environ.get(\"MONGODB_URI\", \"mongodb://127.0.0.1:27017\")\n",
101101
"DB_NAME = \"langchain_test_db\"\n",
102102
"COLLECTION_NAME = \"langchain_graphrag_large_example\"\n",
103103
"\n",
@@ -278,12 +278,14 @@
278278
"# Show some sample entities with relationships\n",
279279
"print(\"Sample entities with relationships:\\n\")\n",
280280
"for i, entity in enumerate(entities_with_relationships[:5]):\n",
281-
" print(f\"{i+1}. {entity['_id']} ({entity.get('type')})\")\n",
281+
" print(f\"{i + 1}. {entity['_id']} ({entity.get('type')})\")\n",
282282
" relationships = entity.get(\"relationships\", {})\n",
283283
" target_ids = relationships.get(\"target_ids\", [])\n",
284284
" rel_types = relationships.get(\"types\", [])\n",
285285
" print(f\" Relationships: {len(target_ids)}\")\n",
286-
" for _, (target, rel_type) in enumerate(zip(target_ids[:3], rel_types[:3])):\n",
286+
" for _, (target, rel_type) in enumerate(\n",
287+
" zip(target_ids[:3], rel_types[:3], strict=False)\n",
288+
" ):\n",
287289
" print(f\" - {rel_type} -> {target}\")\n",
288290
" if len(target_ids) > 3:\n",
289291
" print(f\" ... and {len(target_ids) - 3} more\")\n",

0 commit comments

Comments
 (0)