namespace.py 892 B

12345678910111213141516171819202122232425262728
  1. from __future__ import annotations
  2. from typing import Iterable
  3. # All namespace should not be changed
  4. class NameSpace:
  5. KV_STORE_FULL_DOCS = "full_docs"
  6. KV_STORE_TEXT_CHUNKS = "text_chunks"
  7. KV_STORE_LLM_RESPONSE_CACHE = "llm_response_cache"
  8. KV_STORE_FULL_ENTITIES = "full_entities"
  9. KV_STORE_FULL_RELATIONS = "full_relations"
  10. KV_STORE_ENTITY_CHUNKS = "entity_chunks"
  11. KV_STORE_RELATION_CHUNKS = "relation_chunks"
  12. VECTOR_STORE_ENTITIES = "entities"
  13. VECTOR_STORE_RELATIONSHIPS = "relationships"
  14. VECTOR_STORE_CHUNKS = "chunks"
  15. GRAPH_STORE_CHUNK_ENTITY_RELATION = "chunk_entity_relation"
  16. DOC_STATUS = "doc_status"
  17. def is_namespace(namespace: str, base_namespace: str | Iterable[str]):
  18. if isinstance(base_namespace, str):
  19. return namespace.endswith(base_namespace)
  20. return any(is_namespace(namespace, ns) for ns in base_namespace)