|
97 | 97 | "metadata": {}, |
98 | 98 | "outputs": [], |
99 | 99 | "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", |
101 | 101 | "DB_NAME = \"langchain_test_db\"\n", |
102 | 102 | "COLLECTION_NAME = \"langchain_graphrag_large_example\"\n", |
103 | 103 | "\n", |
|
278 | 278 | "# Show some sample entities with relationships\n", |
279 | 279 | "print(\"Sample entities with relationships:\\n\")\n", |
280 | 280 | "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", |
282 | 282 | " relationships = entity.get(\"relationships\", {})\n", |
283 | 283 | " target_ids = relationships.get(\"target_ids\", [])\n", |
284 | 284 | " rel_types = relationships.get(\"types\", [])\n", |
285 | 285 | " 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", |
287 | 289 | " print(f\" - {rel_type} -> {target}\")\n", |
288 | 290 | " if len(target_ids) > 3:\n", |
289 | 291 | " print(f\" ... and {len(target_ids) - 3} more\")\n", |
|
0 commit comments