Refactor: Upgrade AI Stack to 2025 Standards (LangChain 0.3 + Pinecone v6) #40
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR modernizes the entire b0bot stack to resolve critical API failures and dependency conflicts found in the current main branch.
The Problems Solved:
API Failure: The old huggingface_hub version was trying to access api-inference.huggingface.co, which returned a 410 Gone error (deprecated API).
Database Crash: The code was using dictionary syntax (.get()) for Pinecone responses, but the new Pinecone v6 client returns Objects, causing crash loops.
Dependency Hell: langchain-classic and other outdated packages were causing version locks that prevented installing modern tools.
The Fixes:
Upgraded Stack: Bumped langchain and huggingface_hub to latest stable versions.
Refactored Service: Rewrote NewsService.py to use LCEL (Pipe syntax |) instead of the deprecated LLMChain.
Fixed Model: Updated NewsModel.py to use object dot-notation for vector metadata access.
Verified: Tested locally with the Mistral route; successfully retrieved and summarized news.