AI记忆体 (AIMemory)¶
AIMemory ¶
Bases: BaseMemory
AI Memory (人工智能内存) 是机器人的主内存模块,负责存储和管理所有与知识图谱、文档存储和搜索相关的信息。
AI Memory is the main memory module of the robot, responsible for storing and managing all information related to the knowledge graph, document storage, and search operations.
Attributes:
| Name | Type | Description |
|---|---|---|
docs |
Optional[BaseDocStore]
|
文档存储模块,用于存储和检索文档。 | The document store module for storing and retrieving documents. |
top_k |
int
|
在向量检索时返回的最高k个结果的数量。The number of top results to return in vector searches. |
recall_strict |
bool
|
指定在回忆(检索)内容时是否采用严格模式。Specifies whether to use strict mode when recalling (retrieving) content. 在严格模式下,将严格遵守Token限制。| In strict mode, token limitations are strictly adhered to. |
kg_format |
Literal[...]
|
定义知识图谱节点输出的格式。 | Defines the format for the output of knowledge graph nodes. |
enable_kg_query_expansion |
bool
|
指定是否在进行知识图谱检索时使用当前会话中的历史记录来扩展检索。 | Specifies whether to use the history of the current session to expand searches when querying the knowledge graph. 这可以提高检索的 相关性,但可能增加执行时间。This can improve the relevance of the retrieval but may increase execution time. |
使用此类可以有效地管理和查询与机器人操作相关的各种信息资源,包括但不限于知识图谱数据和文档。
Notes
注意使用此模块时需要手动管理不同的数据源,比如要手动保证DocStore与Memos共用相同的存储,使用Memos召回的EleId会在DocStore进行查找。如果不保证一致性,可能会导致召回失败。 AIMemory的设计是使用分离式的存储设计,主要方便调试,同时可以方便拆卸与组合不同的Store以观察效果。但是在实际使用时,需要非常了解各个模块的作用与边界。
Using this class, various information resources related to robot operations, including but not limited to knowledge graph data and documents, can be effectively managed and queried.
validate_docs ¶
validate_docs() -> Self
Validate the docs field.
验证 docs 字段。
Source code in tfrobot/brain/memory/ai_memory.py
194 195 196 197 198 199 200 201 202 203 204 | |
recall ¶
recall(current_input: UserAndAssMsg, chunk_size: int | Annotated[list[int], Len(4, 4)], length_function: Callable[[str], int], exclude_str: Optional[str] = None) -> Tuple[Optional[list[UserAndAssMsg]], Optional[list[DocElement]], Optional[str]]
Recalls the content from memory based on the given natural language input.
根据给定的自然语言输入从内存中检索内容。
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
current_input
|
str
|
The message user input. This is used to recall the content from memory. It is usually 用户输入的消息。用这个来从内存中回忆内容。通常由聊天输入历史记录格式化。 |
required |
chunk_size
|
Union[int, List[int]]
|
The size of the content to recall. It can be a single number or a list of numbers. If it is a list, the first number is the size of the conversation content to recall, the second number is the size of the memo content to recall, the third number is the size of the knowledge content to recall, and the fourth number is the size of the keyword content to recall. If it is a single number, it will be converted into four equal numbers. 要回忆的内容的大小。可以是单个数字或数字列表。如果是列表,第一个数字是要回忆的对话内容的大小,第二个数字是要回忆的备忘内容的大小, 第三个数字是要回忆的知识内容的大小,第四个数字是要回忆的关键字内容的大小。如果是单个数字,将被转换为四个相等的数字。 |
required |
length_function
|
Callable
|
A function to calculate the length of the content to recall. 用于计算所回忆内容长度的函数。 |
required |
exclude_str
|
Optional[str]
|
The string to exclude from the recall. Defaults to None. 要从回忆中排除的字符串。默认为 None。 |
None
|
Returns:
| Type | Description |
|---|---|
Tuple[Optional[list[UserAndAssMsg]], Optional[list[DocElement]], Optional[str]]
|
Tuple[Optional[list[BaseMessage]], Optional[list[DocElement]], Optional[str]]: The content recalled from memory. 分别是代表对话、文档元素和知识的内容。 |
Source code in tfrobot/brain/memory/ai_memory.py
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 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 | |
async_recall
async
¶
async_recall(current_input: UserAndAssMsg, chunk_size: int | Annotated[list[int], Len(4, 4)], length_function: Callable[[str], int], exclude_str: Optional[str] = None) -> Tuple[Optional[list[UserAndAssMsg]], Optional[list[DocElement]], Optional[str]]
Recall方法的Async异步版本
Source code in tfrobot/brain/memory/ai_memory.py
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 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 | |
commit ¶
commit(msg: UserAndAssMsg) -> None
Commits the chain result to memory.
将链结果提交到记忆中。
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
msg
|
UserAndAssMsg
|
The chain result to commit. 要提交的链结果。 |
required |
Source code in tfrobot/brain/memory/ai_memory.py
476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 | |
acommit
async
¶
acommit(msg: UserAndAssMsg) -> None
Commits the chain result to memory asynchronously.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
msg
|
UserAndAssMsg
|
The chain result to commit. |
required |
Source code in tfrobot/brain/memory/ai_memory.py
493 494 495 496 497 498 499 500 501 502 503 504 | |
get_platforms ¶
get_platforms() -> Sequence[tuple[PLATFORM_ID, str]] | None
AIMemory目前支持挂载单个ConversationManager
- DictBaseConversationManager不支持platform,因此返回None
- PGBaseConversationManager使用基于DPE的platform结构,因此返回查询结果
目前 get_platforms 还不是 BaseConversationManager 标准协议内容,因此在此会尝试使用动态获取属性的方法来判断是否可以使用
Returns:
| Type | Description |
|---|---|
Sequence[tuple[PLATFORM_ID, str]] | None
|
list[tuple[PLATFORM_ID, str]] | None: 注意可能返回空 |
Source code in tfrobot/brain/memory/ai_memory.py
506 507 508 509 510 511 512 513 514 515 516 517 518 | |
aget_platforms
async
¶
aget_platforms() -> Sequence[tuple[PLATFORM_ID, str]] | None
AIMemory目前支持挂载单个ConversationManager的异步版本
- DictBaseConversationManager不支持platform,因此返回None
- PGBaseConversationManager使用基于DPE的platform结构,因此返回查询结果
目前 get_platforms 还不是 BaseConversationManager 标准协议内容,因此在此会尝试使用动态获取属性的方法来判断是否可以使用
Returns:
| Type | Description |
|---|---|
Sequence[tuple[PLATFORM_ID, str]] | None
|
list[tuple[PLATFORM_ID, str]] | None: 注意可能返回空 |
Source code in tfrobot/brain/memory/ai_memory.py
520 521 522 523 524 525 526 527 528 529 530 531 532 | |
add_platform ¶
add_platform(platform_name: str) -> PLATFORM_ID
添加Platform,返回值为PlatformID | Add platform and return platform ID
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
platform_name
|
str
|
Platform名称 | Platform name |
required |
Returns:
| Name | Type | Description |
|---|---|---|
PLATFORM_ID |
PLATFORM_ID
|
PlatformID |
Source code in tfrobot/brain/memory/ai_memory.py
534 535 536 537 538 539 540 541 542 543 544 545 546 547 | |
aadd_platform
async
¶
aadd_platform(platform_name: str) -> PLATFORM_ID
添加Platform,返回值为PlatformID | Add platform and return platform ID
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
platform_name
|
str
|
Platform名称 | Platform name |
required |
Returns:
| Name | Type | Description |
|---|---|---|
PLATFORM_ID |
PLATFORM_ID
|
PlatformID |
Source code in tfrobot/brain/memory/ai_memory.py
549 550 551 552 553 554 555 556 557 558 559 560 561 562 | |
update_platform ¶
update_platform(platform_id: PLATFORM_ID, platform_name: str) -> None
更新Platform名称 | Update platform name
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
platform_id
|
PLATFORM_ID
|
Platform的ID | Platform ID |
required |
platform_name
|
str
|
新的Platform名称 | New platform name |
required |
Source code in tfrobot/brain/memory/ai_memory.py
564 565 566 567 568 569 570 571 572 573 574 575 | |
aupdate_platform
async
¶
aupdate_platform(platform_id: PLATFORM_ID, platform_name: str) -> None
更新Platform名称 | Update platform name
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
platform_id
|
PLATFORM_ID
|
Platform的ID | Platform ID |
required |
platform_name
|
str
|
新的Platform名称 | New platform name |
required |
Source code in tfrobot/brain/memory/ai_memory.py
577 578 579 580 581 582 583 584 585 586 587 588 | |
delete_platform ¶
delete_platform(platform_id: PLATFORM_ID) -> None
删除Platform | Delete platform
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
platform_id
|
PLATFORM_ID
|
要删除的Platform的ID | Platform ID to delete |
required |
Source code in tfrobot/brain/memory/ai_memory.py
590 591 592 593 594 595 596 597 598 599 600 | |
adelete_platform
async
¶
adelete_platform(platform_id: PLATFORM_ID) -> None
删除Platform | Delete platform
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
platform_id
|
PLATFORM_ID
|
要删除的Platform的ID | Platform ID to delete |
required |
Source code in tfrobot/brain/memory/ai_memory.py
602 603 604 605 606 607 608 609 610 611 612 | |
get_conversations ¶
get_conversations(cursor: Optional[str] = None, count: Optional[int] = None, platform_id: Optional[PLATFORM_ID] = None) -> tuple[list[tuple[CONVERSATION_KEY, str]], str]
Get all conversations from memory.
从记忆中获取所有对话。
因为会话排序随时有可能打乱,因此每次请求的时候指定一个初始位置是很有必要的。如此一来,前台可以获取到最新并且没有重复的对话。这里的最佳实践本来应该 使用游标,比如使用 update_timestamp * 1000 + id % 1000 生成游标。但我们系统并非专业的会话管理系统,其数据压力和数据量都不会过大,因此这里 不单独维护游标字段,而是直接让前台动态使用当前最后一个对话的ID作为游标。这样可以保证前台获取到的对话是最新的,且不会重复。如果有问题,刷新页面即可解决。
count支持负值,表示从后向前取数。
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cursor
|
Optional[str]
|
The cursor to start from. | 起始游标 |
None
|
count
|
Optional[int]
|
The number of conversations to get. | 要获取的对话数量。 |
None
|
platform_id
|
Optional[int]
|
The platform id to filter conversations. | 要过滤的平台 ID。 |
None
|
Returns:
| Type | Description |
|---|---|
tuple[list[tuple[CONVERSATION_KEY, str]], str]
|
tuple[list[tuple[CONVERSATION_KEY, str]], str]: The conversations and the cursor. | 对话和游标。 |
Source code in tfrobot/brain/memory/ai_memory.py
614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 | |
aget_conversations
async
¶
aget_conversations(cursor: Optional[str] = None, count: Optional[int] = None, platform_id: Optional[PLATFORM_ID] = None) -> tuple[list[tuple[CONVERSATION_KEY, str]], str]
Get all conversations from memory asynchronously.
Source code in tfrobot/brain/memory/ai_memory.py
641 642 643 644 645 646 647 648 | |
get_conversation ¶
get_conversation(conversation_id: CONVERSATION_KEY) -> Optional[BaseBufferStore]
Get a conversation by its id.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
conversation_id
|
CONVERSATION_KEY
|
The id of the conversation to get. | 要获取的会话的 ID。 |
required |
Returns:
| Type | Description |
|---|---|
Optional[BaseBufferStore]
|
Optional[BaseBufferStore]: The conversation buffer store. | 会话缓存存储。 |
Source code in tfrobot/brain/memory/ai_memory.py
650 651 652 653 654 655 656 657 658 659 660 661 662 663 | |
aget_conversation
async
¶
aget_conversation(conversation_id: CONVERSATION_KEY) -> Optional[BaseBufferStore]
Get a conversation by its id asynchronously.
Source code in tfrobot/brain/memory/ai_memory.py
665 666 667 668 669 670 | |
get_conversation_messages ¶
get_conversation_messages(conversation_id: CONVERSATION_KEY, page: int, size: int, type_include: Optional[list[str]] = None, type_exclude: Optional[list[str]] = None, role_include: Optional[list[str]] = None, role_exclude: Optional[list[str]] = None, filter_meta: Optional[Callable[[Attributes], bool]] = None) -> list[UserAndAssMsg]
Get messages from a conversation by conversation_manager.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
conversation_id
|
int | str
|
The id/index of the conversation. | 对话的索引。 |
required |
page
|
int
|
The page number. | 页码。 |
required |
size
|
int
|
The size of the page. | 页的大小。 |
required |
type_include
|
Optional[list[str]]
|
The message types to include. | 要包含的消息类型。 |
None
|
type_exclude
|
Optional[list[str]]
|
The message types to exclude. | 要排除的消息类型。 |
None
|
role_include
|
Optional[list[str]]
|
The message roles to include. | 要包含的消息角色。 |
None
|
role_exclude
|
Optional[list[str]]
|
The message roles to exclude. | 要排除的消息角色。 |
None
|
filter_meta
|
Optional[Callable[[Attributes], bool]]
|
The function to filter messages by metadata. | 用于根据 元数据过滤消息的函数。 |
None
|
Returns:
| Type | Description |
|---|---|
list[UserAndAssMsg]
|
list[UserAndAssMsg]: The messages from the conversation. | 对话中的消息。 |
Source code in tfrobot/brain/memory/ai_memory.py
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 | |
aget_conversation_messages
async
¶
aget_conversation_messages(conversation_id: CONVERSATION_KEY, page: int, size: int, type_include: Optional[list[str]] = None, type_exclude: Optional[list[str]] = None, role_include: Optional[list[str]] = None, role_exclude: Optional[list[str]] = None, filter_meta: Optional[Callable[[Attributes], bool]] = None) -> list[UserAndAssMsg]
Get messages from a conversation by conversation_manager asynchronously.
Source code in tfrobot/brain/memory/ai_memory.py
707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 | |
get_latest_msg_from_conversation ¶
get_latest_msg_from_conversation(conversation_id: CONVERSATION_KEY) -> Optional[UserAndAssMsg]
获取会话的最新消息
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
conversation_id
|
int | str
|
The id/index of the conversation. | 对话的索引。 |
required |
Returns:
| Type | Description |
|---|---|
Optional[UserAndAssMsg]
|
Optional[UserAndAssMsg]: The latest message from the conversation. | 会话的最新消息。 |
Source code in tfrobot/brain/memory/ai_memory.py
726 727 728 729 730 731 732 733 734 735 736 737 738 739 | |
aget_latest_msg_from_conversation
async
¶
aget_latest_msg_from_conversation(conversation_id: CONVERSATION_KEY) -> Optional[UserAndAssMsg]
获取会话的最新消息
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
conversation_id
|
int | str
|
The id/index of the conversation. | 对话的索引。 |
required |
Returns:
| Type | Description |
|---|---|
Optional[UserAndAssMsg]
|
Optional[UserAndAssMsg]: The latest message from the conversation. | 会话的最新消息。 |
Source code in tfrobot/brain/memory/ai_memory.py
741 742 743 744 745 746 747 748 749 750 751 752 753 754 | |
get_conversation_messages_by_cursor ¶
get_conversation_messages_by_cursor(conversation_id: CONVERSATION_KEY, count: int, cursor: Optional[str] = None, type_include: Optional[list[str]] = None, type_exclude: Optional[list[str]] = None, role_include: Optional[list[str]] = None, role_exclude: Optional[list[str]] = None, filter_meta: Optional[Callable[[Attributes], bool]] = None) -> tuple[list[UserAndAssMsg], str]
Get messages from a conversation by cursor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
conversation_id
|
CONVERSATION_KEY
|
The id of the conversation. | 会话的 ID。 |
required |
cursor
|
Optional[str]
|
The cursor to get messages. | 获取消息的游标。 |
None
|
count
|
int
|
The number of messages to get. | 要获取的消息数量。 |
required |
type_include
|
Optional[list[str]]
|
The message types to include. | 要包含的消息类型。 |
None
|
type_exclude
|
Optional[list[str]]
|
The message types to exclude. | 要排除的消息类型。 |
None
|
role_include
|
Optional[list[str]]
|
The message roles to include. | 要包含的消息角色。 |
None
|
role_exclude
|
Optional[list[str]]
|
The message roles to exclude. | 要排除的消息角色。 |
None
|
filter_meta
|
Optional[Callable[[Attributes], bool]]
|
The function to filter messages by metadata. | 用于根据 |
None
|
Returns:
| Type | Description |
|---|---|
tuple[list[UserAndAssMsg], str]
|
tuple[list[UserAndAssMsg], str]: The messages from the conversation and the cursor. | 对话中的消息和游标。 |
Source code in tfrobot/brain/memory/ai_memory.py
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 | |
aget_conversation_messages_by_cursor
async
¶
aget_conversation_messages_by_cursor(conversation_id: CONVERSATION_KEY, count: int, cursor: Optional[str] = None, type_include: Optional[list[str]] = None, type_exclude: Optional[list[str]] = None, role_include: Optional[list[str]] = None, role_exclude: Optional[list[str]] = None, filter_meta: Optional[Callable[[Attributes], bool]] = None) -> tuple[list[UserAndAssMsg], str]
Get messages from a conversation by cursor asynchronously.
Source code in tfrobot/brain/memory/ai_memory.py
790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 | |
add_conversation ¶
add_conversation(name: str, platform_id: Optional[PLATFORM_ID] = None) -> CONVERSATION_KEY
Add a conversation to the memory.
是否需要传递platform_id,取决于具体的实现。建议尽可能都传。
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the conversation. | 会话的名称。 |
required |
platform_id
|
Optional[int]
|
The platform id of the conversation. | 会话的平台 ID。 |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
CONVERSATION_KEY |
CONVERSATION_KEY
|
The key of the conversation. | 会话的键。 |
Source code in tfrobot/brain/memory/ai_memory.py
809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 | |
aadd_conversation
async
¶
aadd_conversation(name: str, platform_id: Optional[PLATFORM_ID] = None) -> CONVERSATION_KEY
Add a conversation asynchronously.
Source code in tfrobot/brain/memory/ai_memory.py
827 828 829 830 831 832 | |
update_conversation ¶
update_conversation(conversation_id: CONVERSATION_KEY, name: str) -> None
Update the name of a conversation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
conversation_id
|
CONVERSATION_KEY
|
The id of the conversation to update. | 要更新的会话的 ID。 |
required |
name
|
str
|
The new name of the conversation. | 会话的新名称。 |
required |
Source code in tfrobot/brain/memory/ai_memory.py
834 835 836 837 838 839 840 841 842 843 | |
aupdate_conversation
async
¶
aupdate_conversation(conversation_id: CONVERSATION_KEY, name: str) -> None
Update the name of a conversation asynchronously.
Source code in tfrobot/brain/memory/ai_memory.py
845 846 847 848 | |
delete_conversation ¶
delete_conversation(conversation_id: CONVERSATION_KEY) -> None
Delete a conversation by its id.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
conversation_id
|
CONVERSATION_KEY
|
The id of the conversation to delete. | 要删除的会话的 ID。 |
required |
Source code in tfrobot/brain/memory/ai_memory.py
850 851 852 853 854 855 856 857 858 | |
adelete_conversation
async
¶
adelete_conversation(conversation_id: CONVERSATION_KEY) -> None
Delete a conversation asynchronously.
Source code in tfrobot/brain/memory/ai_memory.py
860 861 862 863 | |
get_docs ¶
get_docs(page: Optional[int] = None, size: Optional[int] = None, keywords: Optional[list[str]] = None) -> list[Document]
Get documents from the memory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
page
|
Optional[int]
|
The page number. | 页码。 |
None
|
size
|
Optional[int]
|
The size of the page. | 页的大小。 |
None
|
keywords
|
Optional[list[str]]
|
The keywords to search for. | 要搜索的关键字。 |
None
|
Returns:
| Type | Description |
|---|---|
list[Document]
|
list[Document]: The documents from the memory. | 记忆中的文档。 |
Source code in tfrobot/brain/memory/ai_memory.py
865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 | |
aget_docs
async
¶
aget_docs(page: Optional[int] = None, size: Optional[int] = None, keywords: Optional[list[str]] = None) -> list[Document]
Get documents from the memory asynchronously.
Source code in tfrobot/brain/memory/ai_memory.py
884 885 886 887 888 889 890 891 | |
get_doc ¶
get_doc(doc_id: int) -> Document
Get a document by its id.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
doc_id
|
int
|
The id of the document to get. | 要获取的文档的 ID. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Document |
Document
|
The document from the memory. | 记忆中的文档。 |
Source code in tfrobot/brain/memory/ai_memory.py
893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 | |
aget_doc
async
¶
aget_doc(doc_id: int) -> Document
Get a document by its id asynchronously.
Source code in tfrobot/brain/memory/ai_memory.py
911 912 913 914 915 916 917 918 919 | |
add_doc ¶
add_doc(doc: Document) -> DocId
Add a document to the memory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
doc
|
Document
|
The document to add. | 要添加的文档。 |
required |
Returns:
| Name | Type | Description |
|---|---|---|
DocId |
DocId
|
The id of the document. | 文档的 ID。 |
Source code in tfrobot/brain/memory/ai_memory.py
921 922 923 924 925 926 927 928 929 930 931 932 933 934 | |
aadd_doc
async
¶
aadd_doc(doc: Document) -> DocId
Add a document to the memory asynchronously.
Source code in tfrobot/brain/memory/ai_memory.py
936 937 938 939 940 941 | |
update_doc ¶
update_doc(doc: Document) -> None
Update a document in the memory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
doc
|
Document
|
The updated document. | 更新的文档。 |
required |
Source code in tfrobot/brain/memory/ai_memory.py
943 944 945 946 947 948 949 950 951 952 953 954 | |
aupdate_doc
async
¶
aupdate_doc(doc: Document) -> None
Update a document in the memory asynchronously.
Source code in tfrobot/brain/memory/ai_memory.py
956 957 958 959 960 961 962 | |
delete_doc ¶
delete_doc(doc_id: int) -> None
Delete a document by its id.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
doc_id
|
int
|
The id of the document to delete. | 要删除的文档的 ID. |
required |
Source code in tfrobot/brain/memory/ai_memory.py
964 965 966 967 968 969 970 971 972 | |
adelete_doc
async
¶
adelete_doc(doc_id: int) -> None
Delete a document by its id asynchronously.
Source code in tfrobot/brain/memory/ai_memory.py
974 975 976 977 | |
get_pages ¶
get_pages(page: Optional[int], size: Optional[int], keywords: Optional[list[str]], doc_ids: Optional[list[int]]) -> list[DocPage]
Get pages from the memory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
page
|
Optional[int]
|
The page number. | 页码。 |
required |
size
|
Optional[int]
|
The size of the page. | 页的大小。 |
required |
keywords
|
Optional[list[str]]
|
The keywords to search for. | 要搜索的关键字。 |
required |
doc_ids
|
Optional[list[int]]
|
The document ids to search for. | 要搜索的文档 ID。 |
required |
Returns:
| Type | Description |
|---|---|
list[DocPage]
|
list[DocPage]: The pages from the memory. | 记忆中的页面。 |
Source code in tfrobot/brain/memory/ai_memory.py
979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 | |
aget_pages
async
¶
aget_pages(page: Optional[int], size: Optional[int], keywords: Optional[list[str]], doc_ids: Optional[list[int]]) -> list[DocPage]
Get pages from the memory asynchronously.
Source code in tfrobot/brain/memory/ai_memory.py
999 1000 1001 1002 1003 1004 1005 1006 | |
get_page ¶
get_page(page_id: int) -> DocPage
Get a page by its id.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
page_id
|
int
|
The id of the page to get. | 要获取的页面的 ID. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
DocPage |
DocPage
|
The page from the memory. | 记忆中的页面。 |
Source code in tfrobot/brain/memory/ai_memory.py
1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 | |
aget_page
async
¶
aget_page(page_id: int) -> DocPage
Get a page by its id asynchronously.
Source code in tfrobot/brain/memory/ai_memory.py
1026 1027 1028 1029 1030 1031 1032 1033 1034 | |
add_page ¶
add_page(page: DocPage) -> PageId
Add a page to the memory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
page
|
DocPage
|
The page to add. | 要添加的页面。 |
required |
Returns:
| Name | Type | Description |
|---|---|---|
PageId |
PageId
|
The id of the page. | 页面的 ID。 |
Source code in tfrobot/brain/memory/ai_memory.py
1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 | |
aadd_page
async
¶
aadd_page(page: DocPage) -> PageId
Add a page to the memory asynchronously.
Source code in tfrobot/brain/memory/ai_memory.py
1051 1052 1053 1054 1055 1056 | |
update_page ¶
update_page(page: DocPage) -> None
Update a page in the memory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
page
|
DocPage
|
The updated page. | 更新的页面。 |
required |
Source code in tfrobot/brain/memory/ai_memory.py
1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 | |
aupdate_page
async
¶
aupdate_page(page: DocPage) -> None
Update a page in the memory asynchronously.
Source code in tfrobot/brain/memory/ai_memory.py
1071 1072 1073 1074 1075 1076 1077 | |
delete_page ¶
delete_page(page_id: int) -> None
Delete a page by its id.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
page_id
|
int
|
The id of the page to delete. | 要删除的页面的 ID. |
required |
Source code in tfrobot/brain/memory/ai_memory.py
1079 1080 1081 1082 1083 1084 1085 1086 1087 | |
adelete_page
async
¶
adelete_page(page_id: int) -> None
Delete a page by its id asynchronously.
Source code in tfrobot/brain/memory/ai_memory.py
1089 1090 1091 1092 | |
get_elements ¶
get_elements(page: Optional[int], size: Optional[int], keywords: Optional[list[str]], page_ids: Optional[list[int]]) -> list[DocElement]
Get all elements from memory.
从记忆中获取所有元素。
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
page
|
Optional[int]
|
The page number. |
required |
size
|
Optional[int]
|
The size of the page. |
required |
keywords
|
Optional[list[str]]
|
The keywords to search for. |
required |
page_ids
|
Optional[list[int]]
|
The page ids to search for. |
required |
Returns:
| Type | Description |
|---|---|
list[DocElement]
|
list[DocElement]: The list of all elements. |
Source code in tfrobot/brain/memory/ai_memory.py
1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 | |
get_element ¶
get_element(element_id: int) -> DocElement
Get a DocElement by its id.
通过element_id获取DocElement
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
element_id
|
int
|
|
required |
Returns:
| Type | Description |
|---|---|
DocElement
|
DocElement |
Source code in tfrobot/brain/memory/ai_memory.py
1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 | |
aget_element
async
¶
aget_element(element_id: int) -> DocElement
Get a DocElement by its id asynchronously.
Source code in tfrobot/brain/memory/ai_memory.py
1144 1145 1146 1147 1148 1149 1150 1151 1152 | |
add_element ¶
add_element(element: DocElement) -> EleId
Add a DocElement to memory.
添加DocElement 返回element_id
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
element
|
DocElement
|
|
required |
Returns:
| Type | Description |
|---|---|
EleId
|
int |
Source code in tfrobot/brain/memory/ai_memory.py
1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 | |
aadd_element
async
¶
aadd_element(element: DocElement) -> EleId
Add a DocElement to memory asynchronously.
Source code in tfrobot/brain/memory/ai_memory.py
1171 1172 1173 1174 1175 1176 | |
update_element ¶
update_element(element: DocElement) -> None
Update a DocElement in memory.
更新DocElement
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
element
|
DocElement
|
|
required |
Source code in tfrobot/brain/memory/ai_memory.py
1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 | |
aupdate_element
async
¶
aupdate_element(element: DocElement) -> None
Update a DocElement in memory asynchronously.
Source code in tfrobot/brain/memory/ai_memory.py
1193 1194 1195 1196 1197 1198 1199 | |
delete_element ¶
delete_element(element_id: int) -> None
Delete a DocElement by its id.
删除DocElement
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
element_id
|
int
|
|
required |
Source code in tfrobot/brain/memory/ai_memory.py
1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 | |
adelete_element
async
¶
adelete_element(element_id: int) -> None
Delete a DocElement by its id asynchronously.
Source code in tfrobot/brain/memory/ai_memory.py
1213 1214 1215 1216 | |
add_graph_cls ¶
add_graph_cls(class_iri: CLS_IRI, super_classes: Optional[list[str]] = None, annotations: Optional[dict] = None) -> CLS_IRI
Add a new class to the graph database.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
class_iri
|
str
|
class iri | 类的IRI |
required |
super_classes
|
Optional[list[str]]
|
super classes | 父类 |
None
|
annotations
|
Optional[dict]
|
annotations | 注解 |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
CLS_IRI
|
class iri | 类的IRI |
Source code in tfrobot/brain/memory/ai_memory.py
1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 | |
aadd_graph_cls
async
¶
aadd_graph_cls(class_iri: CLS_IRI, super_classes: Optional[list[str]] = None, annotations: Optional[dict] = None) -> CLS_IRI
Add a new class to the graph database asynchronously.
Source code in tfrobot/brain/memory/ai_memory.py
1237 1238 1239 1240 1241 1242 | |
update_graph_cls ¶
update_graph_cls(class_iri: CLS_IRI, new_super_classes: Optional[list[str]] = None, new_annotations: Optional[dict] = None) -> None
Update a class in the graph database.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
class_iri
|
str
|
class iri | 类的IRI |
required |
new_super_classes
|
Optional[list[str]]
|
new super classes | 新的父类 |
None
|
new_annotations
|
Optional[dict]
|
new annotations | 新的注解 |
None
|
Source code in tfrobot/brain/memory/ai_memory.py
1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 | |
aupdate_graph_cls
async
¶
aupdate_graph_cls(class_iri: CLS_IRI, new_super_classes: Optional[list[str]] = None, new_annotations: Optional[dict] = None) -> None
Update a class in the graph database asynchronously.
Source code in tfrobot/brain/memory/ai_memory.py
1258 1259 1260 1261 1262 1263 | |
delete_graph_cls ¶
delete_graph_cls(class_iri: CLS_IRI) -> None
Delete a class from the graph database.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
class_iri
|
str
|
class iri | 类的IRI |
required |
Source code in tfrobot/brain/memory/ai_memory.py
1265 1266 1267 1268 1269 1270 1271 1272 1273 | |
adelete_graph_cls
async
¶
adelete_graph_cls(class_iri: CLS_IRI) -> None
Delete a class from the graph database asynchronously.
Source code in tfrobot/brain/memory/ai_memory.py
1275 1276 1277 1278 | |
add_graph_property ¶
add_graph_property(property_iri: PROP_IRI, property_type: Literal['object', 'data'], domain: Optional[list[CLS_IRI]] = None, o_range: Optional[list] = None, is_functional: bool = False, is_inverse_functional: bool = False, is_symmetric: bool = False, is_transitive: bool = False, is_asymmetric: bool = False, is_reflexive: bool = False, is_irreflexive: bool = False, trigger_words: Optional[list[str]] = None) -> PROP_IRI
Add a new property to the graph database.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
property_iri
|
PROP_IRI
|
property iri | 属性的IRI |
required |
property_type
|
Literal['object', 'data']
|
property type | 属性类型 |
required |
domain
|
Optional[list[str]]
|
domain | 领域 |
None
|
o_range
|
Optional[list]
|
range | 范围 |
None
|
is_functional
|
bool
|
is functional | 是否是功能性的 |
False
|
is_inverse_functional
|
bool
|
is inverse functional | 是否是反功能性的 |
False
|
is_symmetric
|
bool
|
is symmetric | 是否是对 |
False
|
is_transitive
|
bool
|
is transitive | 是否是传递性的 |
False
|
is_asymmetric
|
bool
|
is asymmetric | 是否是非对称的 |
False
|
is_reflexive
|
bool
|
is reflexive | 是否是自反的 |
False
|
is_irreflexive
|
bool
|
is irreflexive | 是否是非自反的 |
False
|
trigger_words
|
Optional[list[str]]
|
trigger words | 触发词 |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
PROP_IRI
|
property iri | 属性的IRI |
Source code in tfrobot/brain/memory/ai_memory.py
1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 | |
aadd_graph_property
async
¶
aadd_graph_property(property_iri: PROP_IRI, property_type: Literal['object', 'data'], domain: Optional[list[CLS_IRI]] = None, o_range: Optional[list] = None, is_functional: bool = False, is_inverse_functional: bool = False, is_symmetric: bool = False, is_transitive: bool = False, is_asymmetric: bool = False, is_reflexive: bool = False, is_irreflexive: bool = False, trigger_words: Optional[list[str]] = None) -> PROP_IRI
Add a new property to the graph database asynchronously.
Source code in tfrobot/brain/memory/ai_memory.py
1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 | |
update_graph_property ¶
update_graph_property(property_iri: PROP_IRI, domain: Optional[list[CLS_IRI]] = None, o_range: Optional[list] = None, is_functional: Optional[bool] = None, is_inverse_functional: Optional[bool] = None, is_symmetric: Optional[bool] = None, is_transitive: Optional[bool] = None, is_asymmetric: Optional[bool] = None, is_reflexive: Optional[bool] = None, is_irreflexive: Optional[bool] = None, trigger_words: Optional[list[str]] = None) -> None
Update a property in the graph database.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
property_iri
|
str
|
property iri | 属性的IRI |
required |
domain
|
Optional[list[str]]
|
domain | 领域 |
None
|
o_range
|
Optional[list]
|
range | 范围 |
None
|
is_functional
|
Optional[bool]
|
is functional | 是否是功能性的 |
None
|
is_inverse_functional
|
Optional[bool]
|
is inverse functional | 是否是反功能性的 |
None
|
is_symmetric
|
Optional[bool]
|
is symmetric | 是否是对 |
None
|
is_transitive
|
Optional[bool]
|
is transitive | 是否是传递性的 |
None
|
is_asymmetric
|
Optional[bool]
|
is asymmetric | 是否是非对称的 |
None
|
is_reflexive
|
Optional[bool]
|
is reflexive | 是否是自反的 |
None
|
is_irreflexive
|
Optional[bool]
|
is irreflexive | 是否是非自反的 |
None
|
trigger_words
|
Optional[list[str]]
|
trigger words | 触发词 |
None
|
Source code in tfrobot/brain/memory/ai_memory.py
1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 | |
aupdate_graph_property
async
¶
aupdate_graph_property(property_iri: PROP_IRI, domain: Optional[list[CLS_IRI]] = None, o_range: Optional[list] = None, is_functional: Optional[bool] = None, is_inverse_functional: Optional[bool] = None, is_symmetric: Optional[bool] = None, is_transitive: Optional[bool] = None, is_asymmetric: Optional[bool] = None, is_reflexive: Optional[bool] = None, is_irreflexive: Optional[bool] = None, trigger_words: Optional[list[str]] = None) -> None
Update a property in the graph database asynchronously.
Source code in tfrobot/brain/memory/ai_memory.py
1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 | |
delete_graph_property ¶
delete_graph_property(property_iri: PROP_IRI) -> None
Delete a property from the graph database.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
property_iri
|
str
|
property iri | 属性的IRI |
required |
Source code in tfrobot/brain/memory/ai_memory.py
1440 1441 1442 1443 1444 1445 1446 1447 1448 | |
adelete_graph_property
async
¶
adelete_graph_property(property_iri: PROP_IRI) -> None
Delete a property from the graph database asynchronously.
Source code in tfrobot/brain/memory/ai_memory.py
1450 1451 1452 1453 | |
add_graph_entity ¶
add_graph_entity(cls_iri: CLS_IRI, info: dict) -> IND_IRI
Add a new entity to the graph database.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cls_iri
|
str
|
class iri | 类的IRI |
required |
info
|
dict
|
entity info | 实体信息 |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
IND_IRI
|
entity iri | 实体的IRI |
Source code in tfrobot/brain/memory/ai_memory.py
1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 | |
aadd_graph_entity
async
¶
aadd_graph_entity(cls_iri: CLS_IRI, info: dict) -> IND_IRI
Add a new entity to the graph database asynchronously.
Source code in tfrobot/brain/memory/ai_memory.py
1471 1472 1473 1474 | |
update_graph_entity ¶
update_graph_entity(entity_iri: IND_IRI, info: dict) -> None
Update an entity in the graph database.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entity_iri
|
str
|
entity iri | 实体的IRI |
required |
info
|
dict
|
entity info | 实体信息 |
required |
Source code in tfrobot/brain/memory/ai_memory.py
1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 | |
aupdate_graph_entity
async
¶
aupdate_graph_entity(entity_iri: IND_IRI, info: dict) -> None
Update an entity in the graph database asynchronously.
Source code in tfrobot/brain/memory/ai_memory.py
1487 1488 1489 1490 | |
delete_graph_entity ¶
delete_graph_entity(entity_iri: IND_IRI) -> None
Delete an entity from the graph database.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entity_iri
|
str
|
entity iri | 实体的IRI |
required |
Source code in tfrobot/brain/memory/ai_memory.py
1492 1493 1494 1495 1496 1497 1498 1499 1500 | |
adelete_graph_entity
async
¶
adelete_graph_entity(entity_iri: IND_IRI) -> None
Delete an entity from the graph database asynchronously.
Source code in tfrobot/brain/memory/ai_memory.py
1502 1503 1504 1505 | |
get_graph_cls ¶
get_graph_cls(class_iri: CLS_IRI) -> Optional[ThingClass]
获取指定类的详细信息。
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
class_iri
|
CLS_IRI
|
类的IRI。 |
required |
Returns:
| Type | Description |
|---|---|
Optional[ThingClass]
|
Optional[ThingClass]: 类的详细信息。 |
Source code in tfrobot/brain/memory/ai_memory.py
1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 | |
aget_graph_cls
async
¶
aget_graph_cls(class_iri: CLS_IRI) -> Optional[ThingClass]
获取指定类的详细信息。
Source code in tfrobot/brain/memory/ai_memory.py
1521 1522 1523 1524 | |
get_all_graph_clses ¶
get_all_graph_clses() -> list[ThingClass]
获取所有类的详细信息。
Returns:
| Type | Description |
|---|---|
list[ThingClass]
|
list[ThingClass]: 所有类的详细信息。 |
Source code in tfrobot/brain/memory/ai_memory.py
1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 | |
aget_all_graph_clses
async
¶
aget_all_graph_clses() -> list[ThingClass]
获取所有类的详细信息。
Source code in tfrobot/brain/memory/ai_memory.py
1537 1538 1539 1540 | |
get_graph_property ¶
get_graph_property(property_iri: PROP_IRI) -> Optional[PropertyClass]
获取指定属性的详细信息。
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
property_iri
|
PROP_IRI
|
属性的IRI。 |
required |
Returns:
| Type | Description |
|---|---|
Optional[PropertyClass]
|
Optional[PropertyClass]: 属性的详细信息。 |
Source code in tfrobot/brain/memory/ai_memory.py
1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 | |
aget_graph_property
async
¶
aget_graph_property(property_iri: PROP_IRI) -> Optional[PropertyClass]
获取指定属性的详细信息。
Source code in tfrobot/brain/memory/ai_memory.py
1556 1557 1558 1559 | |
get_all_graph_properties ¶
get_all_graph_properties(prop_type: Optional[Literal['object', 'data', 'annotation']] = None) -> list[PropertyClass]
获取所有属性的详细信息。
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prop_type
|
Optional[Literal['object', 'data', 'annotation']]
|
属性的类型。 |
None
|
Returns:
| Type | Description |
|---|---|
list[PropertyClass]
|
list[PropertyClass]: 所有属性的详细信息。 |
Source code in tfrobot/brain/memory/ai_memory.py
1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 | |
aget_all_graph_properties
async
¶
aget_all_graph_properties(prop_type: Optional[Literal['object', 'data', 'annotation']] = None) -> list[PropertyClass]
获取所有属性的详细信息。
Source code in tfrobot/brain/memory/ai_memory.py
1585 1586 1587 1588 1589 1590 | |
get_graph_entity ¶
get_graph_entity(entity_iri: IND_IRI) -> Optional[Thing]
获取指定实体的详细信息。
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entity_iri
|
IND_IRI
|
实体的IRI。 |
required |
Returns:
| Type | Description |
|---|---|
Optional[Thing]
|
Optional[Thing]: 实体的详细信息。 |
Source code in tfrobot/brain/memory/ai_memory.py
1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 | |
aget_graph_entity
async
¶
aget_graph_entity(entity_iri: IND_IRI) -> Optional[Thing]
获取指定实体的详细信息。
Source code in tfrobot/brain/memory/ai_memory.py
1606 1607 1608 1609 | |
get_graph_entities_by_cls ¶
get_graph_entities_by_cls(cls_iri: CLS_IRI) -> list[Thing]
获取指定类的所有实体。
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cls_iri
|
CLS_IRI
|
类的IRI。 |
required |
Returns:
| Type | Description |
|---|---|
list[Thing]
|
list[Thing]: 指定类的所有实体。 |
Source code in tfrobot/brain/memory/ai_memory.py
1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 | |
aget_graph_entities_by_cls
async
¶
aget_graph_entities_by_cls(cls_iri: CLS_IRI) -> list[Thing]
获取指定类的所有实体。
Source code in tfrobot/brain/memory/ai_memory.py
1627 1628 1629 1630 | |
get_all_graph_entities ¶
get_all_graph_entities() -> list[Thing]
获取所有实体的详细信息。
Returns:
| Type | Description |
|---|---|
list[Thing]
|
list[Thing]: 所有实体的详细信息。 |
Source code in tfrobot/brain/memory/ai_memory.py
1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 | |
aget_all_graph_entities
async
¶
aget_all_graph_entities() -> list[Thing]
获取所有实体的详细信息。
Source code in tfrobot/brain/memory/ai_memory.py
1646 1647 1648 1649 | |