索引
GraphStore #
基类:Protocol
抽象图存储协议。
此协议定义了图存储的接口,负责存储和检索知识图谱数据。
属性
名称 | 类型 | 描述 |
---|---|---|
client |
Any
|
Any: 用于连接图存储的客户端。 |
get |
列表[列表[字符串]]
|
Callable[[str], List[List[str]]]: 获取给定主题的三元组。 |
get_rel_map |
字典[字符串, 列表[列表[字符串]]]
|
Callable[[Optional[List[str]], int], Dict[str, List[List[str]]]]: 获取最大深度的所有主题关系映射。 |
upsert_triplet |
无
|
Callable[[str, str, str], None]: 插入或更新三元组。 |
delete |
无
|
Callable[[str, str, str], None]: 删除三元组。 |
persist |
无
|
Callable[[str, Optional[fsspec.AbstractFileSystem]], None]: 将图存储持久化到文件。 |
get_schema |
str
|
Callable[[bool], str]: 获取图存储的模式。 |
源代码位于 llama-index-core/llama_index/core/graph_stores/types.py
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 |
|
get #
get(subj: str) -> List[List[str]]
获取三元组。
源代码位于 llama-index-core/llama_index/core/graph_stores/types.py
243 244 245 |
|
get_rel_map #
get_rel_map(subjs: Optional[List[str]] = None, depth: int = 2, limit: int = 30) -> Dict[str, List[List[str]]]
获取深度感知关系映射。
源代码位于 llama-index-core/llama_index/core/graph_stores/types.py
247 248 249 250 251 |
|
upsert_triplet #
upsert_triplet(subj: str, rel: str, obj: str) -> None
添加三元组。
源代码位于 llama-index-core/llama_index/core/graph_stores/types.py
253 254 255 |
|
delete #
delete(subj: str, rel: str, obj: str) -> None
删除三元组。
源代码位于 llama-index-core/llama_index/core/graph_stores/types.py
257 258 259 |
|
persist #
persist(persist_path: str, fs: Optional[AbstractFileSystem] = None) -> None
将图存储持久化到文件。
源代码位于 llama-index-core/llama_index/core/graph_stores/types.py
261 262 263 264 265 |
|
get_schema #
get_schema(refresh: bool = False) -> str
获取图存储的模式。
源代码位于 llama-index-core/llama_index/core/graph_stores/types.py
267 268 269 |
|
query #
query(query: str, param_map: Optional[Dict[str, Any]] = {}) -> Any
使用语句和参数查询图存储。
源代码位于 llama-index-core/llama_index/core/graph_stores/types.py
271 272 273 |
|
PropertyGraphStore #
基类:ABC
抽象标注图存储协议。
此协议定义了图存储的接口,负责存储和检索知识图谱数据。
属性
名称 | 类型 | 描述 |
---|---|---|
client |
Any
|
Any: 用于连接图存储的客户端。 |
get |
列表[LabelledNode]
|
Callable[[str], List[List[str]]]: 获取给定主题的三元组。 |
get_rel_map |
列表[三元组]
|
Callable[[Optional[List[str]], int], Dict[str, List[List[str]]]]: 获取最大深度的所有主题关系映射。 |
upsert_triplet |
列表[三元组]
|
Callable[[str, str, str], None]: 插入或更新三元组。 |
delete |
无
|
Callable[[str, str, str], None]: 删除三元组。 |
persist |
无
|
Callable[[str, Optional[fsspec.AbstractFileSystem]], None]: 将图存储持久化到文件。 |
源代码位于 llama-index-core/llama_index/core/graph_stores/types.py
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 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 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 |
|
get 抽象方法
#
get(properties: Optional[dict] = None, ids: Optional[List[str]] = None) -> List[LabelledNode]
获取值匹配的节点。
源代码位于 llama-index-core/llama_index/core/graph_stores/types.py
303 304 305 306 307 308 309 310 |
|
get_triplets 抽象方法
#
get_triplets(entity_names: Optional[List[str]] = None, relation_names: Optional[List[str]] = None, properties: Optional[dict] = None, ids: Optional[List[str]] = None) -> List[Triplet]
获取值匹配的三元组。
源代码位于 llama-index-core/llama_index/core/graph_stores/types.py
312 313 314 315 316 317 318 319 320 321 |
|
get_rel_map 抽象方法
#
get_rel_map(graph_nodes: List[LabelledNode], depth: int = 2, limit: int = 30, ignore_rels: Optional[List[str]] = None) -> List[Triplet]
获取深度感知关系映射。
源代码位于 llama-index-core/llama_index/core/graph_stores/types.py
323 324 325 326 327 328 329 330 331 332 |
|
get_llama_nodes #
get_llama_nodes(node_ids: List[str]) -> List[BaseNode]
获取 llama-index 节点。
源代码位于 llama-index-core/llama_index/core/graph_stores/types.py
334 335 336 337 338 339 340 341 342 343 344 345 |
|
upsert_nodes 抽象方法
#
upsert_nodes(nodes: Sequence[LabelledNode]) -> None
插入或更新节点。
源代码位于 llama-index-core/llama_index/core/graph_stores/types.py
347 348 349 350 |
|
upsert_relations 抽象方法
#
upsert_relations(relations: List[Relation]) -> None
插入或更新关系。
源代码位于 llama-index-core/llama_index/core/graph_stores/types.py
352 353 354 355 |
|
upsert_llama_nodes #
upsert_llama_nodes(llama_nodes: List[BaseNode]) -> None
添加 llama-index 节点。
源代码位于 llama-index-core/llama_index/core/graph_stores/types.py
357 358 359 360 361 362 363 364 365 366 367 368 369 370 |
|
delete 抽象方法
#
delete(entity_names: Optional[List[str]] = None, relation_names: Optional[List[str]] = None, properties: Optional[dict] = None, ids: Optional[List[str]] = None) -> None
删除匹配数据。
源代码位于 llama-index-core/llama_index/core/graph_stores/types.py
372 373 374 375 376 377 378 379 380 381 |
|
delete_llama_nodes #
delete_llama_nodes(node_ids: Optional[List[str]] = None, ref_doc_ids: Optional[List[str]] = None) -> None
删除 llama-index 节点。
旨在删除与给定 llama-index 的 node_ids 或 ref_doc_ids 相关联的图存储中的任何节点。
源代码位于 llama-index-core/llama_index/core/graph_stores/types.py
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 |
|
structured_query 抽象方法
#
structured_query(query: str, param_map: Optional[Dict[str, Any]] = None) -> Any
使用语句和参数查询图存储。
源代码位于 llama-index-core/llama_index/core/graph_stores/types.py
412 413 414 415 416 417 |
|
vector_query 抽象方法
#
vector_query(query: VectorStoreQuery, **kwargs: Any) -> Tuple[List[LabelledNode], List[float]]
使用向量存储查询图存储。
源代码位于 llama-index-core/llama_index/core/graph_stores/types.py
419 420 421 422 423 424 |
|
persist #
persist(persist_path: str, fs: Optional[AbstractFileSystem] = None) -> None
将图存储持久化到文件。
源代码位于 llama-index-core/llama_index/core/graph_stores/types.py
426 427 428 429 430 |
|
get_schema #
get_schema(refresh: bool = False) -> Any
获取图存储的模式。
源代码位于 llama-index-core/llama_index/core/graph_stores/types.py
432 433 434 |
|
get_schema_str #
get_schema_str(refresh: bool = False) -> str
获取图存储的模式字符串表示。
源代码位于 llama-index-core/llama_index/core/graph_stores/types.py
436 437 438 |
|
aget 异步
#
aget(properties: Optional[dict] = None, ids: Optional[List[str]] = None) -> List[LabelledNode]
异步获取值匹配的节点。
源代码位于 llama-index-core/llama_index/core/graph_stores/types.py
442 443 444 445 446 447 448 |
|
aget_triplets 异步
#
aget_triplets(entity_names: Optional[List[str]] = None, relation_names: Optional[List[str]] = None, properties: Optional[dict] = None, ids: Optional[List[str]] = None) -> List[Triplet]
异步获取值匹配的三元组。
源代码位于 llama-index-core/llama_index/core/graph_stores/types.py
450 451 452 453 454 455 456 457 458 |
|
aget_rel_map 异步
#
aget_rel_map(graph_nodes: List[LabelledNode], depth: int = 2, limit: int = 30, ignore_rels: Optional[List[str]] = None) -> List[Triplet]
异步获取深度感知关系映射。
源代码位于 llama-index-core/llama_index/core/graph_stores/types.py
460 461 462 463 464 465 466 467 468 |
|
aget_llama_nodes 异步
#
aget_llama_nodes(node_ids: List[str]) -> List[BaseNode]
异步获取节点。
源代码位于 llama-index-core/llama_index/core/graph_stores/types.py
470 471 472 473 474 475 476 477 478 479 480 481 |
|
aupsert_nodes 异步
#
aupsert_nodes(nodes: List[LabelledNode]) -> None
异步添加节点。
源代码位于 llama-index-core/llama_index/core/graph_stores/types.py
483 484 485 |
|
aupsert_relations 异步
#
aupsert_relations(relations: List[Relation]) -> None
异步添加关系。
源代码位于 llama-index-core/llama_index/core/graph_stores/types.py
487 488 489 |
|
adelete 异步
#
adelete(entity_names: Optional[List[str]] = None, relation_names: Optional[List[str]] = None, properties: Optional[dict] = None, ids: Optional[List[str]] = None) -> None
异步删除匹配数据。
源代码位于 llama-index-core/llama_index/core/graph_stores/types.py
491 492 493 494 495 496 497 498 499 |
|
adelete_llama_nodes 异步
#
adelete_llama_nodes(node_ids: Optional[List[str]] = None, ref_doc_ids: Optional[List[str]] = None) -> None
异步删除 llama-index 节点。
源代码位于 llama-index-core/llama_index/core/graph_stores/types.py
501 502 503 504 505 506 507 |
|
astructured_query 异步
#
astructured_query(query: str, param_map: Optional[Dict[str, Any]] = {}) -> Any
异步使用语句和参数查询图存储。
源代码位于 llama-index-core/llama_index/core/graph_stores/types.py
509 510 511 512 513 |
|
avector_query 异步
#
avector_query(query: VectorStoreQuery, **kwargs: Any) -> Tuple[List[LabelledNode], List[float]]
异步使用向量存储查询图存储。
源代码位于 llama-index-core/llama_index/core/graph_stores/types.py
515 516 517 518 519 |
|
aget_schema 异步
#
aget_schema(refresh: bool = False) -> str
异步获取图存储的模式。
源代码位于 llama-index-core/llama_index/core/graph_stores/types.py
521 522 523 |
|
aget_schema_str 异步
#
aget_schema_str(refresh: bool = False) -> str
异步获取图存储的模式字符串表示。
源代码位于 llama-index-core/llama_index/core/graph_stores/types.py
525 526 527 |
|