|
| __init__ (self, embedding_model, int chunk_size=128, int chunk_overlap=32, index_dir="./vector_store/") |
|
| build_index_from_markdown (self, str dir_path, bool strip_markdown=True, bool recursive=True) |
|
| build_index_from_texts (self, list[str] texts) |
|
| save_index (self) |
|
| load_index (self) |
|
List[str] | search (self, str query, int k) |
|
◆ __init__()
iragent.models.KnowledgeGraphBuilder.__init__ |
( |
| self, |
|
|
| embedding_model, |
|
|
int | chunk_size = 128, |
|
|
int | chunk_overlap = 32, |
|
|
| index_dir = "./vector_store/" ) |
◆ _chunker()
list[str] iragent.models.KnowledgeGraphBuilder._chunker |
( |
| self, |
|
|
str | text ) |
|
protected |
Splits text into overlapping chunks based on token count.
Args:
text: The input text to split.
max_tokens: Maximum tokens per chunk.
overlap: Number of tokens to overlap between chunks.
model_name: Model name for tokenizer compatibility.
Returns:
List of text chunks.
◆ _normalize()
np.ndarray iragent.models.KnowledgeGraphBuilder._normalize |
( |
| self, |
|
|
np.ndarray | vectors ) |
|
protected |
◆ _read_markdown_and_chunk()
list[str] iragent.models.KnowledgeGraphBuilder._read_markdown_and_chunk |
( |
| self, |
|
|
str | dir_path, |
|
|
bool | strip_markdown = True, |
|
|
bool | recursive = True ) |
|
protected |
◆ build_index_from_markdown()
iragent.models.KnowledgeGraphBuilder.build_index_from_markdown |
( |
| self, |
|
|
str | dir_path, |
|
|
bool | strip_markdown = True, |
|
|
bool | recursive = True ) |
◆ build_index_from_texts()
iragent.models.KnowledgeGraphBuilder.build_index_from_texts |
( |
| self, |
|
|
list[str] | texts ) |
Create a FAISS index from a list of texts
◆ load_index()
iragent.models.KnowledgeGraphBuilder.load_index |
( |
| self | ) |
|
Load FAISS index from disk
◆ save_index()
iragent.models.KnowledgeGraphBuilder.save_index |
( |
| self | ) |
|
◆ search()
List[str] iragent.models.KnowledgeGraphBuilder.search |
( |
| self, |
|
|
str | query, |
|
|
int | k ) |
Search for nearest neighbors, this function get query: str and k:int as input.
◆ chunk_overlap
iragent.models.KnowledgeGraphBuilder.chunk_overlap = chunk_overlap |
◆ chunk_size
iragent.models.KnowledgeGraphBuilder.chunk_size = chunk_size |
◆ docs_path
iragent.models.KnowledgeGraphBuilder.docs_path = os.path.join(index_dir, "faiss_index.index.docs") |
◆ document
list iragent.models.KnowledgeGraphBuilder.document = [] |
◆ embedding_model
iragent.models.KnowledgeGraphBuilder.embedding_model = embedding_model |
◆ faiss
iragent.models.KnowledgeGraphBuilder.faiss = faiss |
◆ index
iragent.models.KnowledgeGraphBuilder.index = None |
◆ index_dir
iragent.models.KnowledgeGraphBuilder.index_dir = index_dir |
◆ index_path
iragent.models.KnowledgeGraphBuilder.index_path = os.path.join(index_dir, "faiss_index.index") |
The documentation for this class was generated from the following file: