Download tests/test_01_dk.py from recommender-system/llmproccrs: direct link, hf CLI and curl.
- Browser
- Download file 1.12 kB
-
https://huggingface.co/recommender-system/llmproccrs/resolve/main/tests/test_01_dk.py
- Command line
-
hf download hf://recommender-system/llmproccrs/tests/test_01_dk.py
-
curl -L -o test_01_dk.py https://huggingface.co/recommender-system/llmproccrs/resolve/main/tests/test_01_dk.py
1.12 kB
| import sys | |
| import os | |
| # --- BAGIAN INI PENTING (JANGAN DIHAPUS) --- | |
| # Menambahkan folder root project (..) ke path python | |
| sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) | |
| # ------------------------------------------- | |
| from config import Config | |
| from modules.domain_knowledge.vector_store import VectorStore | |
| def test_dk(): | |
| print("=== TESTING MODULE: DOMAIN & KNOWLEDGE ===") | |
| # 1. Cek Path | |
| print(f"Loading Config from: {os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))}") | |
| # 2. Init | |
| try: | |
| # Pastikan path Chroma DB sesuai config | |
| print(f"Database Path: {Config.CHROMA_DB_DIR}") | |
| kb = VectorStore(Config.CHROMA_DB_DIR, Config.COLLECTION_NAME) | |
| print("✅ Koneksi ke Vector Store berhasil.") | |
| except Exception as e: | |
| print(f"❌ Gagal koneksi DB: {e}") | |
| return | |
| # 3. Test Count Data | |
| count = kb.get_count() | |
| print(f"Jumlah data di database: {count}") | |
| if count == 0: | |
| print("⚠️ Data kosong. Silakan jalankan 'scripts/run_ingestion.py' dulu.") | |
| if __name__ == "__main__": | |
| test_dk() |