Skip to content

Commit e7e880d

Browse files
committed
ci(py312): make MLX deps macOS/arm64-only; fix E402/import order; minor lint & requirements tidy
1 parent 6dee29a commit e7e880d

File tree

6 files changed

+11
-13
lines changed

6 files changed

+11
-13
lines changed

app/database/scylla_connection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def reset_singleton(cls):
7777

7878
import gc
7979
for _ in range(3):
80-
collected = gc.collect()
80+
gc.collect()
8181
time.sleep(0.1)
8282

8383
logger.info("ScyllaDB singleton reset complete")

app/services/chatbot_service.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def __init__(
142142
GENERATION_SERVICE_AVAILABLE
143143
)
144144

145-
logger.info(f"Enhanced ChatbotService initialized")
145+
logger.info("Enhanced ChatbotService initialized")
146146
logger.info(f" Real generation available: {self.real_generation_available}")
147147
logger.info(f" Response strategy: {self.cfg.response_strategy}")
148148
logger.info(f" Context optimization: {self.cfg.context_window_optimization}")
@@ -622,16 +622,16 @@ def _generate_template_response(self, message: str, context: str) -> str:
622622
context_preview = context[:800] + "..." if len(context) > 800 else context
623623

624624
return (
625-
f"Based on the available information:\n\n"
625+
"Based on the available information:\n\n"
626626
f"{context_preview}\n\n"
627627
f"This should help address your question about: \"{message[:100]}...\"\n\n"
628-
f"If you need more specific details, please let me know!"
628+
"If you need more specific details, please let me know!"
629629
)
630630
else:
631631
return (
632632
f"I understand you're asking about: \"{message[:100]}...\"\n\n"
633-
f"I don't have specific information available right now, but I'd be happy to help "
634-
f"if you could provide more details or rephrase your question."
633+
"I don't have specific information available right now, but I'd be happy to help "
634+
"if you could provide more details or rephrase your question."
635635
)
636636

637637
def _enhanced_fallback_answer(self, message: str, context: str = "") -> str:

app/services/embedding_service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def __init__(self, config: Optional[EmbeddingConfig] = None):
8484
# Memory monitoring
8585
self._process = psutil.Process()
8686

87-
logger.info(f"sentence-transformers/all-mpnet-base-v2 EmbeddingService initialized")
87+
logger.info("sentence-transformers/all-mpnet-base-v2 EmbeddingService initialized")
8888

8989
async def embed_query(self, text: str) -> List[float]:
9090
"""

app/services/knowledge_service.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ def __init__(
243243

244244
# FIXED: Check vector search availability at runtime, not init time
245245
# We'll check this when we actually need it
246-
logger.info(f" Atlas Vector Search available: Will check at runtime")
246+
logger.info(" Atlas Vector Search available: Will check at runtime")
247247

248248
def _get_mongo_manager(self):
249249
"""Get the MongoDB manager instance - FIXED to use the getter function"""
@@ -845,7 +845,7 @@ async def mongo_hybrid_search_embeddings(
845845
})
846846

847847
if not candidates:
848-
logger.warning(f"No documents found even with broader retrieval")
848+
logger.warning("No documents found even with broader retrieval")
849849
return []
850850

851851
logger.info(f"Using {len(candidates)} candidates for re-ranking")

app/utils/seed_data.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919

2020
from bson import ObjectId
2121
from motor.motor_asyncio import AsyncIOMotorCollection
22-
23-
# Enhanced imports with better error handling
2422
from app.database.mongo_connection import enhanced_mongo_manager as mongo_manager
2523
from app.database.mongo_connection import init_enhanced_mongo, close_enhanced_mongo
2624

@@ -741,7 +739,7 @@ async def _process_chunk_batch(self, chunk_data_batch: List[Dict], embedding_tex
741739

742740
# Retry with smaller batch if enabled
743741
if len(chunk_data_batch) > 1 and self.config.max_retries > 0:
744-
logger.warning(f"🔄 Retrying batch with smaller size...")
742+
logger.warning("🔄 Retrying batch with smaller size...")
745743
mid = len(chunk_data_batch) // 2
746744

747745
batch1 = await self._process_chunk_batch(chunk_data_batch[:mid], embedding_texts[:mid], emb_coll)

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ mammoth==1.10.0
5353
MarkupSafe==3.0.2
5454
mlx==0.28.0; platform_system == "Darwin" and platform_machine == "arm64"
5555
mlx-lm==0.26.3; platform_system == "Darwin" and platform_machine == "arm64"
56-
mlx-metal==0.28.0; platform_system == "Darwin" and platform_machine == "arm64"
56+
mlx-metal>=0.28.0; platform_system == "Darwin" and platform_machine == "arm64"
5757
motor==3.7.1
5858
mpmath==1.3.0
5959
msgpack==1.1.1

0 commit comments

Comments
 (0)