KnowledgeMesh / app /core /models.py
pkheria's picture
Replace YouTube ingestion with Medium extraction
9707a84
Raw
History Blame Contribute Delete
873 Bytes
from dataclasses import dataclass, field
from enum import Enum
from pathlib import Path
from typing import Any
class SourceType(str, Enum):
PDF = "pdf"
ARXIV = "arxiv"
MEDIUM = "medium"
@dataclass(frozen=True)
class Document:
source_type: SourceType
title: str
text: str
source: str
metadata: dict[str, Any] = field(default_factory=dict)
@dataclass(frozen=True)
class Chunk:
id: str
text: str
index: int
source_type: SourceType
source: str
title: str
metadata: dict[str, Any] = field(default_factory=dict)
@dataclass(frozen=True)
class IngestionResult:
document: Document
chunks: list[Chunk]
collection_name: str
export_path: Path
@dataclass(frozen=True)
class SearchResult:
score: float
text: str
title: str
source: str
source_type: str
metadata: dict[str, Any]