Neo4j
GraphDB Implementation
This section details the Neo4j implementation of the BaseGraphDB
interface. The implementation is structured into several subclasses, each handling a specific group of methods from the BaseGraphDB
interface. These subclasses are then inherited by the Neo4jGraphInterface
, which serves as a unified interface for interacting with the Neo4j implementation.
Graph Interface
memora.graph_db.neo4j.Neo4jGraphInterface
Neo4jGraphInterface(
uri: str,
username: str,
password: str,
database: str,
associated_vector_db: Optional[BaseVectorDB] = None,
enable_logging: bool = False,
)
Bases: Neo4jOrganization
, Neo4jAgent
, Neo4jUser
, Neo4jInteraction
, Neo4jMemory
PARAMETER | DESCRIPTION |
---|---|
uri
|
The URI of the Neo4j database.
TYPE:
|
username
|
The username for authentication.
TYPE:
|
password
|
The password for authentication.
TYPE:
|
database
|
The name of the Neo4j database.
TYPE:
|
associated_vector_db
|
The vector database to be associated with the graph for data consistency (e.g adding / deleting memories across both.)
TYPE:
|
enable_logging
|
Whether to enable console logging
TYPE:
|
Example
from memora.graph_db.neo4j import Neo4jGraphInterface
from qdrant_client import AsyncQdrantClient
from memora.vector_db.qdrant import QdrantDB
neo4j_interface = Neo4jGraphInterface(
uri="Neo4jURI",
username="Neo4jUsername",
password="Neo4jPassword",
database="Neo4jDatabaseName",
# Optional Association
associated_vector_db=QdrantDB(async_client=AsyncQdrantClient(url="QDRANT_URL", api_key="QDRANT_API_KEY"))
)
Source code in memora/graph_db/neo4j/interface.py
Attributes
Functions
close
async
get_associated_vector_db
The vector database associated with the graph database, these is used inside the graph transactional blocks to ensure data consistency when handling memories across both stores (e.g., saving memories to the vector store and creating corresponding nodes in the graph db).
Source code in memora/graph_db/neo4j/interface.py
migrate_to_schema_for_memora_v0_3_x
async
Migrate the Neo4j graph database schema to the version that works with Memora v0.3.x
This migration involves establishing :DATE_OBTAINED relationships between Memory
nodes and Date
nodes based on
their org_id, user_id, obtained_at
attributes and dropping the index :Interaction (updated_at) -> interaction_updated_timestamp
(because
Neo4j does not utilize it for index-backed sorting)
Source code in memora/graph_db/neo4j/interface.py
setup
async
Sets up Neo4j database constraints and indices for the graph schema.
Source code in memora/graph_db/neo4j/interface.py
Component Classes
memora.graph_db.neo4j.Neo4jOrganization
Bases: BaseGraphDB
Functions
create_organization
async
Creates a new organization in the Neo4j graph database.
PARAMETER | DESCRIPTION |
---|---|
org_name
|
The name of the organization to create.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Organization
|
Organization object containing:
|
Source code in memora/graph_db/neo4j/organization.py
delete_organization
async
Deletes an organization from the Neo4j graph database.
Warning
This operation will delete all nodes and relationships from this organization including users, agents, memories, interactions etc.
PARAMETER | DESCRIPTION |
---|---|
org_id
|
Short UUID string identifying the organization to delete.
TYPE:
|
Source code in memora/graph_db/neo4j/organization.py
get_all_organizations
async
Gets all organizations from the graph database.
RETURNS | DESCRIPTION |
---|---|
List[Organization]
|
List[Organization] each containing:
|
Source code in memora/graph_db/neo4j/organization.py
get_organization
async
Gets a specific organization from the Neo4j graph database.
PARAMETER | DESCRIPTION |
---|---|
org_id
|
Short UUID string identifying the organization to retrieve.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Organization
|
Organization object containing:
|
Source code in memora/graph_db/neo4j/organization.py
update_organization
async
Updates an existing organization in the Neo4j graph database.
PARAMETER | DESCRIPTION |
---|---|
org_id
|
The Short UUID of the organization to update.
TYPE:
|
new_org_name
|
The new name for the organization.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Organization
|
Organization object containing:
|
Source code in memora/graph_db/neo4j/organization.py
memora.graph_db.neo4j.Neo4jAgent
Bases: BaseGraphDB
Functions
create_agent
async
Creates a new agent in the Neo4j graph database.
PARAMETER | DESCRIPTION |
---|---|
org_id
|
Short UUID string identifying the organization.
TYPE:
|
agent_label
|
Label/name for the agent.
TYPE:
|
user_id
|
Optional Short UUID of the user. This is used when the agent is created specifically for a user, indicating that both the organization and the user will have this agent.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Agent
|
Agent containing:
|
Source code in memora/graph_db/neo4j/agent.py
delete_agent
async
Deletes an agent from the Neo4j graph database.
PARAMETER | DESCRIPTION |
---|---|
org_id
|
Short UUID string identifying the organization.
TYPE:
|
agent_id
|
Short UUID string identifying the agent to delete.
TYPE:
|
Source code in memora/graph_db/neo4j/agent.py
get_agent
async
Gets a specific agent belonging to the specified organization from the Neo4j graph database.
PARAMETER | DESCRIPTION |
---|---|
org_id
|
Short UUID string identifying the organization.
TYPE:
|
agent_id
|
Short UUID string identifying the agent to retrieve.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Agent
|
Agent containing:
|
Source code in memora/graph_db/neo4j/agent.py
get_all_org_agents
async
Gets all agents belonging to the specified organization from the Neo4j graph database.
PARAMETER | DESCRIPTION |
---|---|
org_id
|
Short UUID string identifying the organization.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
List[Agent]
|
A List[Agent], each containing:
|
Source code in memora/graph_db/neo4j/agent.py
get_all_user_agents
async
Gets all agents for a user within an organization from the Neo4j graph database.
PARAMETER | DESCRIPTION |
---|---|
org_id
|
Short UUID string identifying the organization.
TYPE:
|
user_id
|
Short UUID string identifying the user.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
List[Agent]
|
A List[Agent], each containing:
|
Source code in memora/graph_db/neo4j/agent.py
update_agent
async
Updates an existing agent in the Neo4j graph database.
PARAMETER | DESCRIPTION |
---|---|
org_id
|
Short UUID string identifying the organization.
TYPE:
|
agent_id
|
Short UUID string identifying the agent to update.
TYPE:
|
new_agent_label
|
New label/name for the agent.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Agent
|
Agent containing:
|
Source code in memora/graph_db/neo4j/agent.py
memora.graph_db.neo4j.Neo4jUser
Bases: BaseGraphDB
Functions
create_user
async
Creates a new user in the Neo4j graph database.
PARAMETER | DESCRIPTION |
---|---|
org_id
|
Short UUID string identifying the organization.
TYPE:
|
user_name
|
Name for the user.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
User
|
User containing:
|
Source code in memora/graph_db/neo4j/user.py
delete_user
async
Deletes a user from the Neo4j graph database.
PARAMETER | DESCRIPTION |
---|---|
org_id
|
Short UUID string identifying the organization.
TYPE:
|
user_id
|
Short UUID string identifying the user to delete.
TYPE:
|
Source code in memora/graph_db/neo4j/user.py
get_all_org_users
async
Gets all users belonging to the specified organization from the graph database.
PARAMETER | DESCRIPTION |
---|---|
org_id
|
Short UUID string identifying the organization.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
List[User]
|
List[User], each containing:
|
Source code in memora/graph_db/neo4j/user.py
get_user
async
Gets a specific user belonging to the specified organization from the Neo4j graph database.
PARAMETER | DESCRIPTION |
---|---|
org_id
|
Short UUID string identifying the organization.
TYPE:
|
user_id
|
Short UUID string identifying the user to retrieve.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
User
|
User containing:
|
Source code in memora/graph_db/neo4j/user.py
update_user
async
Updates an existing user in the Neo4j graph database.
PARAMETER | DESCRIPTION |
---|---|
org_id
|
Short UUID string identifying the organization.
TYPE:
|
user_id
|
Short UUID string identifying the user to update.
TYPE:
|
new_user_name
|
The new name for the user.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
User
|
User containing:
|
Source code in memora/graph_db/neo4j/user.py
memora.graph_db.neo4j.Neo4jInteraction
Bases: BaseGraphDB
Functions
delete_all_user_interactions_and_their_memories
async
Deletes all interactions and their associated memories for a specific user in an organization.
PARAMETER | DESCRIPTION |
---|---|
org_id
|
Short UUID string identifying the organization
TYPE:
|
user_id
|
Short UUID string identifying the user whose interactions should be deleted
TYPE:
|
Note
If the graph database is associated with a vector database, the memories are also deleted there for data consistency.
Source code in memora/graph_db/neo4j/interaction.py
delete_user_interaction_and_its_memories
async
Deletes an interaction record and its associated memories.
PARAMETER | DESCRIPTION |
---|---|
org_id
|
Short UUID string identifying the organization.
TYPE:
|
user_id
|
Short UUID string identifying the user.
TYPE:
|
interaction_id
|
Short UUID string identifying the interaction to delete.
TYPE:
|
Note
If the graph database is associated with a vector database, the memories are also deleted there for data consistency.
Source code in memora/graph_db/neo4j/interaction.py
954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 |
|
get_all_user_interactions
async
get_all_user_interactions(
org_id: str,
user_id: str,
with_their_messages: bool = True,
with_their_memories: bool = True,
skip: int = 0,
limit: int = 100,
) -> List[models.Interaction]
Retrieves all interactions for a specific user in an organization.
Note
Interactions are sorted in descending order by their updated at datetime. (So most recent interactions are first).
PARAMETER | DESCRIPTION |
---|---|
org_id
|
Short UUID string identifying the organization.
TYPE:
|
user_id
|
Short UUID string identifying the user.
TYPE:
|
with_their_messages
|
Whether to also retrieve messages of an interaction.
TYPE:
|
with_their_memories
|
Whether to also retrieve memories gotten across all occurrences of an interaction.
TYPE:
|
skip
|
Number of interactions to skip. (Useful for pagination)
TYPE:
|
limit
|
Maximum number of interactions to retrieve. (Useful for pagination)
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
List[Interaction]
|
List[Interaction], each containing an Interaction with:
|
Note
A memory won't have a message source, if its interaction was updated with a conflicting conversation thread that lead to truncation of the former thread. See graph.update_interaction_and_memories
Source code in memora/graph_db/neo4j/interaction.py
797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 |
|
get_interaction
async
get_interaction(
org_id: str,
user_id: str,
interaction_id: str,
with_messages: bool = True,
with_memories: bool = True,
) -> models.Interaction
Retrieves all messages associated with a specific interaction.
PARAMETER | DESCRIPTION |
---|---|
org_id
|
Short UUID string identifying the organization.
TYPE:
|
user_id
|
Short UUID string identifying the user.
TYPE:
|
interaction_id
|
Short UUID string identifying the interaction.
TYPE:
|
with_messages
|
Whether to retrieve messages along with the interaction.
TYPE:
|
with_memories
|
Whether to also retrieve memories gotten across all occurrences of this interaction.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Interaction
|
Interaction containing:
|
Note
A memory won't have a message source, if its interaction was updated with a conflicting conversation thread that lead to truncation of the former thread. See graph.update_interaction_and_memories
Source code in memora/graph_db/neo4j/interaction.py
638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 |
|
save_interaction_with_memories
async
save_interaction_with_memories(
org_id: str,
agent_id: str,
user_id: str,
memories_and_interaction: MemoriesAndInteraction,
) -> Tuple[str, datetime]
Creates a new interaction record with associated memories.
PARAMETER | DESCRIPTION |
---|---|
org_id
|
Short UUID string identifying the organization.
TYPE:
|
agent_id
|
Short UUID string identifying the agent.
TYPE:
|
user_id
|
Short UUID string identifying the user.
TYPE:
|
memories_and_interaction
|
Contains both the interaction and the associated memories.
TYPE:
|
Note
If the graph database is associated with a vector database, the memories are also stored there for data consistency.
RETURNS | DESCRIPTION |
---|---|
Tuple[str, datetime]
|
Tuple[str, datetime] containing:
|
Source code in memora/graph_db/neo4j/interaction.py
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 |
|
update_interaction_and_memories
async
update_interaction_and_memories(
org_id: str,
agent_id: str,
user_id: str,
interaction_id: str,
updated_memories_and_interaction: MemoriesAndInteraction,
) -> Tuple[str, datetime]
Update an existing interaction record and add new memories.
Compares updated interaction with existing one
- If differences are found, truncates existing record from that point and replaces with updated version. Old memories from truncated message(s) remain but become standalone (no longer linked to truncated messages).
- If no differences, appends new messages from the update.
New memories are always added, regardless of interaction changes.
PARAMETER | DESCRIPTION |
---|---|
org_id
|
Short UUID string identifying the organization.
TYPE:
|
agent_id
|
Short UUID string identifying the agent in the updated interaction.
TYPE:
|
user_id
|
Short UUID string identifying the user.
TYPE:
|
interaction_id
|
Short UUID string identifying the interaction to update.
TYPE:
|
updated_memories_and_interaction
|
Contains both the updated interaction and the associated new memories.
TYPE:
|
Note
If the graph database is associated with a vector database, the memories are also stored there for data consistency.
RETURNS | DESCRIPTION |
---|---|
Tuple[str, datetime]
|
Tuple[str, datetime] containing:
|
Source code in memora/graph_db/neo4j/interaction.py
392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 |
|
memora.graph_db.neo4j.Neo4jMemory
Bases: BaseGraphDB
Functions
delete_all_user_memories
async
Deletes all memories of a specific user.
PARAMETER | DESCRIPTION |
---|---|
org_id
|
Short UUID string identifying the organization
TYPE:
|
user_id
|
Short UUID string identifying the user
TYPE:
|
Note
If the graph database is associated with a vector database, the memories are also deleted there for data consistency.
Source code in memora/graph_db/neo4j/memory.py
delete_user_memory
async
Deletes a specific memory.
PARAMETER | DESCRIPTION |
---|---|
org_id
|
Short UUID string identifying the organization
TYPE:
|
user_id
|
Short UUID string identifying the user
TYPE:
|
memory_id
|
UUID string identifying the memory to delete
TYPE:
|
Note
If the graph database is associated with a vector database, the memory is also deleted there for data consistency.
Source code in memora/graph_db/neo4j/memory.py
fetch_user_memories_resolved
async
Fetches memories from the Neo4j GraphDB by their IDs, resolves any contrary updates, and replaces user/agent placeholders with actual names.
This method performs several operations
- Retrieves memories using (org_id, user_id, memory_ids)
- If a memory has a CONTRARY_UPDATE relationship, uses the newer memory version
- Replaces user_id & agent_id placeholders (e.g 'user_abc123' or 'agent_xyz789') in memories with actual user names / agent labels
PARAMETER | DESCRIPTION |
---|---|
org_user_mem_ids
|
List of Dicts containing org, user, and memory ids of the memories to fetch and process
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
List[Memory]
|
List[Memory] containing memory details:
|
Example
>>> org_user_mem_ids = [{'memory_id': '443ac3a8-fe87-49a4-93d2-05d3eb58ddeb', 'org_id': 'gmDr4sUiWMNqbGAiV8ijbU', 'user_id': 'CcyKXxhi2skEcDpRzNZim7'}, ...]
>>> memories = graphInstance.fetch_memories_resolved(org_user_mem_ids)
>>> print([memoryObj.memory for memoryObj in memories])
["John asked for help with a wedding ring", "Sarah is allergic to peanuts"]
Note
- Org, user, and memory IDs are typically retrieved from a vector database before being passed to this method.
- A memory won't have a message source, if its interaction was updated with a conflicting conversation thread that lead to truncation of the former thread. See
graph.update_interaction_and_memories
Source code in memora/graph_db/neo4j/memory.py
fetch_user_memories_resolved_batch
async
fetch_user_memories_resolved_batch(
batch_org_user_mem_ids: List[List[Dict[str, str]]]
) -> List[List[models.Memory]]
Fetches memories from the Neo4j GraphDB by their IDs, resolves any contrary updates, and replaces user/agent placeholders with actual names.
This method performs several operations
- Retrieves memories using (org_id, user_id, memory_ids)
- If a memory has a CONTRARY_UPDATE relationship, uses the newer memory version
- Replaces user_id & agent_id placeholders (e.g 'user_abc123' or 'agent_xyz789') in memories with actual user names / agent labels
PARAMETER | DESCRIPTION |
---|---|
batch_org_user_mem_ids
|
List of lists containing Dicts with org, user, and memory ids of the memories to fetch and process
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
List[List[Memory]]
|
List[List[Memory]] with memory details:
|
Example
>>> batch_org_user_mem_ids = [[{"memory_id": "413ac3a8-fe87-49a4-93d2-05d3eb58ddeb", "org_id": "gmDr4sUiWMNqbGAiV8ijbU", "user_id": "CcyKXxhi2skEcDpRzNZim7"}, ...], [{...}, ...]]
>>> batch_memories = graphInstance.fetch_memories_resolved_batch(batch_org_user_mem_ids)
>>> print([[memoryObj.memory for memoryObj in memories] for memories in batch_memories])
[["John asked for help with a wedding ring", "Sarah is allergic to peanuts"], ["John is about to propose to Sarah"]]
Note
- Batch org, user, and memory IDs are typically retrieved from a vector database before being passed to this method.
- A memory won't have a message source, if its interaction was updated with a conflicting conversation thread that lead to truncation of the former thread. See
graph.update_interaction_and_memories
Source code in memora/graph_db/neo4j/memory.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
|
get_all_user_memories
async
get_all_user_memories(
org_id: str,
user_id: str,
agent_id: Optional[str] = None,
skip: int = 0,
limit: int = 1000,
) -> List[models.Memory]
Retrieves all memories associated with a specific user.
Note
Memories are sorted in descending order by their obtained at datetime. (So most recent memories are first).
PARAMETER | DESCRIPTION |
---|---|
org_id
|
Short UUID string identifying the organization
TYPE:
|
user_id
|
Short UUID string identifying the user
TYPE:
|
agent_id
|
Optional short UUID string identifying the agent. If provided, only memories obtained from interactions with this agent are returned. Otherwise, all memories associated with the user are returned.
TYPE:
|
skip
|
Number of interactions to skip. (Useful for pagination)
TYPE:
|
limit
|
Maximum number of interactions to retrieve. (Useful for pagination)
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
List[Memory]
|
List[Memory] containing memory details:
|
Note
- A memory won't have a message source, if its interaction was updated with a conflicting conversation thread that lead to truncation of the former thread. See
graph.update_interaction_and_memories
Source code in memora/graph_db/neo4j/memory.py
365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 |
|
get_user_memory
async
Retrieves a specific memory.
PARAMETER | DESCRIPTION |
---|---|
org_id
|
Short UUID string identifying the organization
TYPE:
|
user_id
|
Short UUID string identifying the user
TYPE:
|
memory_id
|
UUID string identifying the memory
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Memory
|
Memory containing memory details:
|
Note
- The memory won't have a message source, if its interaction was updated with a conflicting conversation thread that lead to truncation of the former thread. See
graph.update_interaction_and_memories
Source code in memora/graph_db/neo4j/memory.py
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 |
|
get_user_memory_history
async
Retrieves the history of a specific memory.
PARAMETER | DESCRIPTION |
---|---|
org_id
|
Short UUID string identifying the organization
TYPE:
|
user_id
|
Short UUID string identifying the user
TYPE:
|
memory_id
|
UUID string identifying the memory
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
List[Memory]
|
List[Memory] containing the history of memory details in descending order (starting with the current version, to the oldest version):
|
Note
- A memory won't have a message source, if its interaction was updated with a conflicting conversation thread that lead to truncation of the former thread. See
graph.update_interaction_and_memories
Source code in memora/graph_db/neo4j/memory.py
269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 |
|