|
30 | 30 | "this by running the following command: \n", |
31 | 31 | "\n", |
32 | 32 | "TODO: Updated the command when the vector search is available in the official\n", |
33 | | - "Memgraph docker image\n", |
34 | | - "```bash\n", |
35 | | - "docker run -p 7687:7687 -p 7444:7444 memgraph/memgraph-mage:exp-vector-1 --log-level=TRACE --also-log-to-stderr --telemetry-enabled=False --experimental-vector-indexes='tag__Entity__embedding__{\"dimension\":384,\"limit\":3000}'\n", |
36 | | - "```\n", |
| 33 | + "Memgraph docker image\n" |
| 34 | + ] |
| 35 | + }, |
| 36 | + { |
| 37 | + "cell_type": "code", |
| 38 | + "execution_count": null, |
| 39 | + "metadata": { |
| 40 | + "vscode": { |
| 41 | + "languageId": "shellscript" |
| 42 | + } |
| 43 | + }, |
| 44 | + "outputs": [], |
| 45 | + "source": [ |
| 46 | + "\n", |
| 47 | + "\n", |
| 48 | + "docker run -p 7687:7687 -p 7444:7444 memgraph/memgraph-mage:exp-vector-1 --log-level=TRACE --also-log-to-stderr --telemetry-enabled=False --experimental-vector-indexes='tag__Entity__embedding__{\"dimension\":384,\"limit\":3000}'\n" |
| 49 | + ] |
| 50 | + }, |
| 51 | + { |
| 52 | + "cell_type": "markdown", |
| 53 | + "metadata": {}, |
| 54 | + "source": [ |
| 55 | + "\n", |
37 | 56 | "\n", |
38 | 57 | "You can run this command outside of this notebook. \n", |
39 | 58 | "\n", |
|
46 | 65 | "execution_count": null, |
47 | 66 | "metadata": { |
48 | 67 | "vscode": { |
49 | | - "languageId": "markdown" |
| 68 | + "languageId": "shellscript" |
50 | 69 | } |
51 | 70 | }, |
52 | 71 | "outputs": [], |
53 | 72 | "source": [ |
54 | | - "```bash\n", |
55 | | - "cat ./data/memgraph-export-got.cypherl | docker run -i memgraph/mgconsole --host=localhost\n", |
56 | | - "``` " |
| 73 | + "\n", |
| 74 | + "cat ./data/memgraph-export-got.cypherl | docker run -i memgraph/mgconsole --host=localhost\n" |
57 | 75 | ] |
58 | 76 | }, |
59 | 77 | { |
|
355 | 373 | "7. Ask LLM the question with the relevant data " |
356 | 374 | ] |
357 | 375 | }, |
358 | | - { |
359 | | - "cell_type": "code", |
360 | | - "execution_count": null, |
361 | | - "metadata": {}, |
362 | | - "outputs": [], |
363 | | - "source": [] |
364 | | - }, |
365 | 376 | { |
366 | 377 | "cell_type": "code", |
367 | 378 | "execution_count": null, |
|
433 | 444 | "\n", |
434 | 445 | "Here are a few examples of questions and answers: \n", |
435 | 446 | "\n", |
436 | | - "`To whom was Viserys Targaryen loyal to?`\n", |
| 447 | + "**To whom was Viserys Targaryen loyal to?**\n", |
437 | 448 | "\n", |
438 | 449 | "The response is:\n", |
439 | | - "**Based on the provided data, Viserys Targaryen was loyal to House Targaryen. This information is derived from the relationships indicating that Viserys Targaryen was loyal to House Targaryen and the connections between them**\n", |
| 450 | + "Based on the provided data, Viserys Targaryen was loyal to House Targaryen. This information is derived from the relationships indicating that Viserys Targaryen was loyal to House Targaryen and the connections between them\n", |
440 | 451 | "\n", |
441 | | - "`Who killed Viserys Targaryen in Game of thrones?`\n", |
| 452 | + "**Who killed Viserys Targaryen in Game of thrones?**\n", |
442 | 453 | "\n", |
443 | 454 | "The response is:\n", |
444 | 455 | "\n", |
445 | 456 | "**Based on the provided relevance expansion data, Khal Drogo killed Viserys Targaryen in \"Game of Thrones.\" This information is inferred from the relationship where Khal Drogo is linked to Viserys Targaryen with the action of being \"KILLED\" by Khal Drogo. The data does not show any other character directly killing Viserys Targaryen.\n", |
446 | 457 | "**\n", |
447 | 458 | "\n", |
448 | | - "`\"What was the weapon used to kill Viserys Targaryen in Game of Thrones?\"`\n", |
| 459 | + "**\"What was the weapon used to kill Viserys Targaryen in Game of Thrones?\"**\n", |
449 | 460 | "\n", |
450 | 461 | "The response is: \n", |
451 | | - "**\n", |
452 | | - "Based on the provided data, the weapon used to kill Viserys Targaryen in Game of Thrones was not explicitly mentioned. The data only shows that Khal Drogo was involved in the killing of Viserys Targaryen. There is no specific mention of the weapon used in the relevance expansion data. Therefore, I do not have enough information to answer the question about the weapon used to kill Viserys Targaryen.**\n", |
| 462 | + "\n", |
| 463 | + "Based on the provided data, the weapon used to kill Viserys Targaryen in Game of Thrones was not explicitly mentioned. The data only shows that Khal Drogo was involved in the killing of Viserys Targaryen. There is no specific mention of the weapon used in the relevance expansion data. Therefore, I do not have enough information to answer the question about the weapon used to kill Viserys Targaryen.\n", |
453 | 464 | "\n", |
454 | 465 | "This response is wrong, there is a method mentioned, not weapon, but LLM didn't catch the context due to different naming. \n", |
455 | 466 | "\n", |
456 | | - "`\"Who betrayed Viserys Targaryen in Game of Thrones?\"`\n", |
| 467 | + "**\"Who betrayed Viserys Targaryen in Game of Thrones?\"**\n", |
457 | 468 | "\n", |
458 | 469 | "Based on the provided data, Khal Drogo betrayed Viserys Targaryen in Game of Thrones by killing him. This conclusion is drawn from the relationship between Khal Drogo and Viserys Targaryen where it is stated that Khal Drogo killed Viserys Targaryen.\n", |
459 | 470 | "\n", |
460 | 471 | "This response is based on the killing relationship, but betrayal could have different consequences. \n", |
461 | 472 | "\n", |
462 | 473 | "Let's expand this knowledge. \n", |
463 | 474 | "\n", |
464 | | - "`\"Who betrayed Viserys Targaryen in Game of Thrones?\"`\n", |
| 475 | + "**\"Who betrayed Viserys Targaryen in Game of Thrones?\"**\n", |
| 476 | + "\n", |
465 | 477 | "Based on the provided data, Khal Drogo betrayed Viserys Targaryen in Game of Thrones. This conclusion is derived from the relationship between Viserys Targaryen and Khal Drogo, where Khal Drogo is connected to Viserys Targaryen through the 'BETRAYED_BY' relationship, indicating that Khal Drogo betrayed Viserys Targaryen." |
466 | 478 | ] |
467 | 479 | }, |
|
714 | 726 | "cell_type": "markdown", |
715 | 727 | "metadata": {}, |
716 | 728 | "source": [ |
717 | | - "The dataset now has additional knowledge: \n", |
718 | | - "`\n", |
719 | | - "Executed query: MATCH (a {id: 1}), (b {id: 2}) CREATE (a)-[:PARENT_OF]->(b)\n", |
720 | | - "Executed query: MATCH (a {id: 1}), (b {id: 3}) CREATE (a)-[:SIBLING_OF]->(b)\n", |
721 | | - "Executed query: MATCH (a {id: 1}), (b {id: 4}) CREATE (a)-[:LOYAL_TO]->(b)\n", |
722 | | - "Executed query: MATCH (a {id: 1}), (b {id: 5}) CREATE (a)-[:HAPPENED_IN]->(b)\n", |
723 | | - "Executed query: MATCH (a {id: 1}), (b {id: 6}) CREATE (a)-[:HAPPENED_IN]->(b)\n", |
724 | | - "Executed query: MATCH (a {id: 1}), (b {id: 7}) CREATE (a)-[:SIBLING_OF]->(b)\n", |
725 | | - "Executed query: MATCH (a {id: 1}), (b {id: 8}) CREATE (a)-[:MARRIED_TO]->(b)\n", |
726 | | - "Executed query: MATCH (a {id: 1}), (b {id: 9}) CREATE (a)-[:HEALED_BY]->(b)\n", |
727 | | - "Executed query: MATCH (a {id: 8}), (b {id: 9}) CREATE (a)-[:RULES]->(b)\n", |
728 | | - "Executed query: MATCH (a {id: 8}), (b {id: 1}) CREATE (a)-[:BETRAYED_BY]->(b)\n", |
729 | | - "` \n", |
730 | | - "\n", |
731 | | - "Now again asking the same question yields a correct answer: `\"Who betrayed Viserys Targaryen in Game of Thrones?\"`\n", |
| 729 | + "The dataset now has additional knowledge: " |
| 730 | + ] |
| 731 | + }, |
| 732 | + { |
| 733 | + "cell_type": "code", |
| 734 | + "execution_count": null, |
| 735 | + "metadata": { |
| 736 | + "vscode": { |
| 737 | + "languageId": "sql" |
| 738 | + } |
| 739 | + }, |
| 740 | + "outputs": [], |
| 741 | + "source": [ |
| 742 | + "\n", |
| 743 | + "\n", |
| 744 | + "MATCH (a {id: 1}), (b {id: 2}) CREATE (a)-[:PARENT_OF]->(b)\n", |
| 745 | + "MATCH (a {id: 1}), (b {id: 3}) CREATE (a)-[:SIBLING_OF]->(b)\n", |
| 746 | + "MATCH (a {id: 1}), (b {id: 4}) CREATE (a)-[:LOYAL_TO]->(b)\n", |
| 747 | + "MATCH (a {id: 1}), (b {id: 5}) CREATE (a)-[:HAPPENED_IN]->(b)\n", |
| 748 | + "MATCH (a {id: 1}), (b {id: 6}) CREATE (a)-[:HAPPENED_IN]->(b)\n", |
| 749 | + "MATCH (a {id: 1}), (b {id: 7}) CREATE (a)-[:SIBLING_OF]->(b)\n", |
| 750 | + "MATCH (a {id: 1}), (b {id: 8}) CREATE (a)-[:MARRIED_TO]->(b)\n", |
| 751 | + "MATCH (a {id: 1}), (b {id: 9}) CREATE (a)-[:HEALED_BY]->(b)\n", |
| 752 | + "MATCH (a {id: 8}), (b {id: 9}) CREATE (a)-[:RULES]->(b)\n", |
| 753 | + "MATCH (a {id: 8}), (b {id: 1}) CREATE (a)-[:BETRAYED_BY]->(b)\n", |
| 754 | + "\n", |
| 755 | + "\n" |
| 756 | + ] |
| 757 | + }, |
| 758 | + { |
| 759 | + "cell_type": "markdown", |
| 760 | + "metadata": {}, |
| 761 | + "source": [ |
| 762 | + "\n", |
| 763 | + "Now again asking the same question yields a correct answer: **\"Who betrayed Viserys Targaryen in Game of Thrones?\"**\n", |
732 | 764 | "\n", |
733 | 765 | "Based on the provided data, Khal Drogo betrayed Viserys Targaryen in Game of Thrones. This conclusion is derived from the relationship between Viserys Targaryen and Khal Drogo, where Khal Drogo is connected to Viserys Targaryen through the 'BETRAYED_BY' relationship, indicating that Khal Drogo betrayed Viserys Targaryen.\n", |
734 | 766 | "\n" |
|
0 commit comments